Skip to content

Commit

Permalink
fix(form): fix className is undefined error
Browse files Browse the repository at this point in the history
close #7126
  • Loading branch information
chenshuai2144 committed Jun 24, 2023
1 parent 70ad3bc commit a27d453
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/field/src/components/Select/LightSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const LightSelect: React.ForwardRefRenderFunction<
{
[`${prefixCls}-searchable`]: showSearch,
},
`${prefixCls}-container-${restProps.placement}`,
`${prefixCls}-container-${restProps.placement || 'bottomLeft'}`,
className,
)}
style={style}
Expand Down
4 changes: 3 additions & 1 deletion packages/form/src/components/List/ListContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ const ProFormListContainer: React.FC<ProFormListItemProps> = (props) => {
} = creatorButtonProps || {};
return (
<Button
className={`${prefixCls}-creator-button-${position} ${hashId}`.trim()}
className={`${prefixCls}-creator-button-${position} ${
hashId || ''
}`.trim()}
type="dashed"
loading={loading}
block
Expand Down
8 changes: 6 additions & 2 deletions packages/form/src/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ const ProFormListItem: React.FC<
{
listDom: (
<div
className={`${prefixCls}-container ${containerClassName} ${hashId}`.trim()}
className={`${prefixCls}-container ${containerClassName || ''} ${
hashId || ''
}`.trim()}
style={{
width: grid ? '100%' : undefined,
...containerStyle,
Expand All @@ -480,7 +482,9 @@ const ProFormListItem: React.FC<
}}
>
<div
className={`${prefixCls}-container ${containerClassName} ${hashId}`.trim()}
className={`${prefixCls}-container ${
containerClassName || ''
} ${hashId}`.trim()}
style={{
width: grid ? '100%' : undefined,
...containerStyle,
Expand Down
54 changes: 27 additions & 27 deletions tests/form/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Dependency/demos
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -987,7 +987,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Dependency/demos
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -1364,7 +1364,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Dependency/demos
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -9839,7 +9839,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/base
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -10285,7 +10285,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/coun
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -10527,7 +10527,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/cust
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -12009,7 +12009,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/depe
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -12538,7 +12538,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/hori
style="padding-block-end: 0;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -12663,7 +12663,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/hori
style="display: inline-flex; margin-inline-end: 25px;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -12730,7 +12730,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/hori
style="display: inline-flex; margin-inline-end: 25px;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -13211,7 +13211,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/list
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -14059,7 +14059,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/list
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -14552,7 +14552,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/nest
class="ant-pro-card-body"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -14754,7 +14754,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/nest
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -15289,7 +15289,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/Group/demos/pro-
class="ant-pro-card-body"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -16899,7 +16899,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/QueryFilter/demo
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-searchable ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-searchable ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-focused ant-select-single ant-select-show-arrow ant-select-show-search"
Expand Down Expand Up @@ -17031,7 +17031,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/QueryFilter/demo
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-multiple ant-select-allow-clear ant-select-show-arrow ant-select-show-search"
Expand Down Expand Up @@ -18626,7 +18626,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/QueryFilter/demo
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-searchable ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-searchable ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-focused ant-select-single ant-select-allow-clear ant-select-show-arrow ant-select-show-search"
Expand Down Expand Up @@ -20487,7 +20487,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/QueryFilter/demo
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-searchable ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-searchable ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-focused ant-select-single ant-select-show-arrow ant-select-show-search"
Expand Down Expand Up @@ -20619,7 +20619,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/QueryFilter/demo
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-multiple ant-select-allow-clear ant-select-show-arrow ant-select-show-search"
Expand Down Expand Up @@ -31583,7 +31583,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/SchemaForm/demos
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
style="width: 100%;"
>
<div
Expand Down Expand Up @@ -33075,7 +33075,7 @@ exports[`form demos 📸 renders ./packages/form/src/components/SchemaForm/demos
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -42933,7 +42933,7 @@ exports[`form demos 📸 renders ./packages/form/src/demos/base-test.tsx correct
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -50793,7 +50793,7 @@ exports[`form demos 📸 renders ./packages/form/src/demos/modalform-test.tsx co
style="padding-block-end: 0;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -50918,7 +50918,7 @@ exports[`form demos 📸 renders ./packages/form/src/demos/modalform-test.tsx co
style="display: inline-flex; margin-inline-end: 25px;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-form-item"
Expand Down Expand Up @@ -52355,7 +52355,7 @@ exports[`form demos 📸 renders ./packages/form/src/demos/pro-form-dependency.d
class="ant-pro-card-body"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down Expand Up @@ -52481,7 +52481,7 @@ exports[`form demos 📸 renders ./packages/form/src/demos/pro-form-dependency.d
style="display: flex; align-items: flex-end;"
>
<div
class="ant-pro-form-list-container undefined"
class="ant-pro-form-list-container"
>
<div
class="ant-pro-form-group"
Expand Down
2 changes: 1 addition & 1 deletion tests/list/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3377,7 +3377,7 @@ exports[`list demos 📸 renders ./packages/list/src/demos/filter.tsx correctly
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-single ant-select-allow-clear ant-select-show-arrow"
Expand Down
2 changes: 1 addition & 1 deletion tests/table/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30171,7 +30171,7 @@ exports[`table demos 📸 renders ./packages/table/src/demos/lightfilter.tsx cor
>
<div>
<div
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-undefined"
class="ant-pro-field-select-light-select ant-pro-field-select-light-select-container-bottomLeft"
>
<div
class="ant-select ant-select-in-form-item ant-select-single ant-select-allow-clear ant-select-show-arrow"
Expand Down

0 comments on commit a27d453

Please sign in to comment.