Skip to content

Commit

Permalink
fix: change rest to style and classname
Browse files Browse the repository at this point in the history
  • Loading branch information
ONLY-yours committed Oct 9, 2023
1 parent 4e55a13 commit 8caa239
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions packages/form/src/BaseForm/createField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,6 @@ function createField<P extends ProFormFieldItemProps = any>(
const formItem = useDeepCompareMemo(() => {
return (
<ProFormItem
// 透传 rest 中要给 ProFormItem 的内容,例如 Style
{...rest}
// 全局的提供一个 tip 功能,可以减少代码量
// 轻量模式下不通过 FormItem 显示 label
label={label && proFieldProps?.light !== true ? label : undefined}
Expand Down
2 changes: 2 additions & 0 deletions packages/utils/src/pickProFormItemProps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const antdFormItemPropsList = [
// 我自定义的
'addonBefore',
'addonAfter',
'style',
'className',
];

// eslint-disable-next-line @typescript-eslint/ban-types
Expand Down
4 changes: 4 additions & 0 deletions tests/form/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12838,6 +12838,7 @@ exports[`form demos > 📸 renders ./packages/form/src/components/Group/demos/ho
>
<div
class="ant-form-item"
style="padding: 0px;"
>
<div
class="ant-row ant-form-item-row"
Expand Down Expand Up @@ -45061,6 +45062,7 @@ exports[`form demos > 📸 renders ./packages/form/src/demos/form-layout.tsx cor
/>
<div
class="ant-form-item"
style="margin: 16px;"
>
<div
class="ant-row ant-form-item-row"
Expand Down Expand Up @@ -47095,6 +47097,7 @@ exports[`form demos > 📸 renders ./packages/form/src/demos/layout-change.tsx c
</div>
<div
class="ant-form-item"
style="margin: 16px;"
>
<div
class="ant-row ant-form-item-row"
Expand Down Expand Up @@ -51075,6 +51078,7 @@ exports[`form demos > 📸 renders ./packages/form/src/demos/modalform-test.tsx
>
<div
class="ant-form-item"
style="padding: 0px;"
>
<div
class="ant-row ant-form-item-row"
Expand Down
2 changes: 1 addition & 1 deletion tests/form/__snapshots__/upload.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ProFormUpload > 🏐 ProFormUploadButton support disable 1`] = `"<span class=\\"ant-upload ant-upload-disabled\\" role=\\"button\\"><input disabled=\\"\\" type=\\"file\\" style=\\"display: none;\\" accept=\\"\\"><button type=\\"button\\" class=\\"ant-btn ant-btn-default\\" disabled=\\"\\"><span role=\\"img\\" aria-label=\\"upload\\" class=\\"anticon anticon-upload\\"><svg viewBox=\\"64 64 896 896\\" focusable=\\"false\\" data-icon=\\"upload\\" width=\\"1em\\" height=\\"1em\\" fill=\\"currentColor\\" aria-hidden=\\"true\\"><path d=\\"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z\\"></path></svg></span><span>单击上传</span></button></span>"`;
exports[`ProFormUpload > 🏐 ProFormUploadButton support disable 1`] = `"<span class=\\"ant-upload ant-upload-disabled\\" role=\\"button\\"><input type=\\"file\\" style=\\"display: none;\\" accept=\\"\\"><button type=\\"button\\" class=\\"ant-btn ant-btn-default\\" disabled=\\"\\"><span role=\\"img\\" aria-label=\\"upload\\" class=\\"anticon anticon-upload\\"><svg viewBox=\\"64 64 896 896\\" focusable=\\"false\\" data-icon=\\"upload\\" width=\\"1em\\" height=\\"1em\\" fill=\\"currentColor\\" aria-hidden=\\"true\\"><path d=\\"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z\\"></path></svg></span><span>单击上传</span></button></span>"`;
2 changes: 2 additions & 0 deletions tests/list/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ exports[`list demos > 📸 renders ./packages/list/src/demos/base.tsx correctly
/>
<div
class="ant-form-item"
style="padding: 0px;"
>
<div
class="ant-row ant-form-item-row"
Expand Down Expand Up @@ -637,6 +638,7 @@ exports[`list demos > 📸 renders ./packages/list/src/demos/base.tsx correctly
>
<div
class="ant-form-item"
style="padding: 0px;"
>
<div
class="ant-row ant-form-item-row"
Expand Down
6 changes: 3 additions & 3 deletions tests/table/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`table demos > 📸 renders ./packages/table/src/components/DragSortTabl
style="padding-left: 12px; padding-right: 12px;"
>
<div
class="ant-form-item"
class="ant-form-item drag-visible"
style="flex-wrap: nowrap;"
>
<div
Expand Down Expand Up @@ -112,7 +112,7 @@ exports[`table demos > 📸 renders ./packages/table/src/components/DragSortTabl
style="padding-left: 12px; padding-right: 12px;"
>
<div
class="ant-form-item"
class="ant-form-item drag-visible"
style="flex-wrap: nowrap;"
>
<div
Expand Down Expand Up @@ -933,7 +933,7 @@ exports[`table demos > 📸 renders ./packages/table/src/components/DragSortTabl
style="padding-left: 12px; padding-right: 12px;"
>
<div
class="ant-form-item"
class="ant-form-item drag-visible"
style="flex-wrap: nowrap;"
>
<div
Expand Down

0 comments on commit 8caa239

Please sign in to comment.