@ant-design/pro-components 3.0.2-0 → 3.1.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es-PR.md +1 -3
- package/README.md +8 -10
- package/README.zh-CN.md +11 -11
- package/dist/pro-components.min.js +1 -1
- package/es/card/ProCard.js +7 -7
- package/es/card/components/Actions/index.js +25 -25
- package/es/card/components/Actions/style.d.ts +1 -1
- package/es/card/components/Actions/style.js +79 -71
- package/es/card/components/Card/index.js +160 -141
- package/es/card/components/Card/style.d.ts +1 -1
- package/es/card/components/Card/style.js +249 -192
- package/es/card/components/CheckCard/Group.js +94 -115
- package/es/card/components/CheckCard/index.d.ts +6 -0
- package/es/card/components/CheckCard/index.js +85 -78
- package/es/card/components/CheckCard/style.d.ts +1 -1
- package/es/card/components/CheckCard/style.js +184 -168
- package/es/card/components/Divider/index.js +19 -15
- package/es/card/components/Divider/style.d.ts +1 -1
- package/es/card/components/Divider/style.js +32 -29
- package/es/card/components/Loading/index.js +19 -16
- package/es/card/components/Loading/style.d.ts +1 -1
- package/es/card/components/Loading/style.js +34 -31
- package/es/card/components/Operation/index.js +16 -13
- package/es/card/components/Operation/style.d.ts +1 -1
- package/es/card/components/Operation/style.js +19 -18
- package/es/card/components/Statistic/index.js +46 -41
- package/es/card/components/Statistic/style.d.ts +1 -1
- package/es/card/components/Statistic/style.js +89 -70
- package/es/card/components/StatisticCard/index.js +45 -38
- package/es/card/components/StatisticCard/style.d.ts +1 -1
- package/es/card/components/StatisticCard/style.js +37 -35
- package/es/card/typing.d.ts +5 -0
- package/es/descriptions/index.js +214 -225
- package/es/descriptions/useFetchData.js +53 -91
- package/es/field/AllProField.js +265 -216
- package/es/field/FieldHOC/index.js +9 -14
- package/es/field/PureProField.js +82 -80
- package/es/field/ValueTypeToComponent.js +517 -618
- package/es/field/components/Cascader/index.d.ts +2 -3
- package/es/field/components/Cascader/index.js +65 -84
- package/es/field/components/Checkbox/index.d.ts +2 -3
- package/es/field/components/Checkbox/index.js +75 -72
- package/es/field/components/Code/index.js +40 -39
- package/es/field/components/ColorPicker/index.d.ts +1 -1
- package/es/field/components/ColorPicker/index.js +38 -32
- package/es/field/components/DatePicker/index.d.ts +2 -2
- package/es/field/components/DatePicker/index.js +49 -53
- package/es/field/components/Digit/index.js +41 -42
- package/es/field/components/DigitRange/index.js +71 -77
- package/es/field/components/FromNow/index.js +27 -25
- package/es/field/components/Image/index.js +28 -24
- package/es/field/components/IndexColumn/index.js +22 -16
- package/es/field/components/Money/index.js +107 -116
- package/es/field/components/Options/index.js +34 -33
- package/es/field/components/Password/index.js +35 -38
- package/es/field/components/Percent/index.js +40 -44
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/Percent/util.js +3 -5
- package/es/field/components/Progress/index.js +29 -27
- package/es/field/components/Radio/index.d.ts +1 -2
- package/es/field/components/Radio/index.js +61 -62
- package/es/field/components/RangePicker/index.d.ts +2 -2
- package/es/field/components/RangePicker/index.js +52 -63
- package/es/field/components/Rate/index.js +24 -21
- package/es/field/components/Second/index.js +36 -33
- package/es/field/components/Segmented/index.d.ts +1 -2
- package/es/field/components/Segmented/index.js +37 -46
- package/es/field/components/Select/LightSelect/index.d.ts +1 -1
- package/es/field/components/Select/LightSelect/index.js +102 -110
- package/es/field/components/Select/SearchSelect/index.d.ts +6 -1
- package/es/field/components/Select/SearchSelect/index.js +189 -129
- package/es/field/components/Select/index.d.ts +2 -5
- package/es/field/components/Select/index.js +197 -221
- package/es/field/components/Slider/index.js +25 -22
- package/es/field/components/Status/index.js +67 -78
- package/es/field/components/Switch/index.d.ts +1 -1
- package/es/field/components/Switch/index.js +32 -30
- package/es/field/components/Text/index.js +34 -37
- package/es/field/components/TextArea/index.js +26 -21
- package/es/field/components/TextArea/readonly.js +24 -21
- package/es/field/components/TimePicker/index.js +96 -105
- package/es/field/components/TreeSelect/index.d.ts +2 -3
- package/es/field/components/TreeSelect/index.js +107 -125
- package/es/form/BaseForm/BaseForm.d.ts +3 -0
- package/es/form/BaseForm/BaseForm.js +418 -498
- package/es/form/BaseForm/EditOrReadOnlyContext.js +1 -1
- package/es/form/BaseForm/LightWrapper/index.js +56 -65
- package/es/form/BaseForm/LightWrapper/style.d.ts +1 -1
- package/es/form/BaseForm/LightWrapper/style.js +17 -13
- package/es/form/BaseForm/Submitter/index.js +44 -43
- package/es/form/FieldContext.js +1 -1
- package/es/form/components/Captcha/index.d.ts +8 -2
- package/es/form/components/Captcha/index.js +76 -128
- package/es/form/components/Cascader/index.js +26 -28
- package/es/form/components/Checkbox/index.js +60 -61
- package/es/form/components/ColorPicker/index.js +24 -26
- package/es/form/components/DatePicker/BaseDatePicker.js +33 -31
- package/es/form/components/DatePicker/DatePicker.js +14 -13
- package/es/form/components/DatePicker/DateTimePicker.js +11 -12
- package/es/form/components/DatePicker/MonthPicker.js +14 -13
- package/es/form/components/DatePicker/QuarterPicker.js +14 -13
- package/es/form/components/DatePicker/TimePicker.js +26 -27
- package/es/form/components/DatePicker/WeekPicker.js +14 -13
- package/es/form/components/DatePicker/YearPicker.js +14 -13
- package/es/form/components/DatePicker/index.js +1 -1
- package/es/form/components/DateRangePicker/BaseDateRanger.js +35 -35
- package/es/form/components/DateRangePicker/DateMonthRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateQuarterRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateTimeRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateWeekRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateYearRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/TimeRangePicker.js +26 -29
- package/es/form/components/DateRangePicker/index.js +15 -16
- package/es/form/components/Dependency/index.js +31 -34
- package/es/form/components/Digit/DigitRange.js +23 -24
- package/es/form/components/Digit/index.js +27 -29
- package/es/form/components/Field/index.js +55 -63
- package/es/form/components/FieldSet/index.js +68 -76
- package/es/form/components/FormItem/FormItemRender/index.js +58 -48
- package/es/form/components/FormItem/Group/index.js +95 -95
- package/es/form/components/FormItem/Group/style.d.ts +1 -1
- package/es/form/components/FormItem/Group/style.js +46 -40
- package/es/form/components/FormItem/index.js +135 -141
- package/es/form/components/FormItem/warpField.js +165 -149
- package/es/form/components/List/ListContainer.js +98 -189
- package/es/form/components/List/ListItem.js +151 -198
- package/es/form/components/List/index.d.ts +1 -1
- package/es/form/components/List/index.js +97 -107
- package/es/form/components/List/style.d.ts +1 -1
- package/es/form/components/List/style.js +71 -47
- package/es/form/components/Money/index.js +28 -30
- package/es/form/components/Radio/index.js +45 -49
- package/es/form/components/Rate/index.js +17 -20
- package/es/form/components/SchemaForm/index.js +58 -72
- package/es/form/components/SchemaForm/layoutType/Embed.js +5 -6
- package/es/form/components/SchemaForm/layoutType/StepsForm.js +22 -26
- package/es/form/components/SchemaForm/valueType/dependency.js +11 -11
- package/es/form/components/SchemaForm/valueType/divider.js +4 -5
- package/es/form/components/SchemaForm/valueType/field.js +45 -44
- package/es/form/components/SchemaForm/valueType/formList.js +8 -7
- package/es/form/components/SchemaForm/valueType/formSet.js +8 -7
- package/es/form/components/SchemaForm/valueType/group.js +7 -8
- package/es/form/components/SchemaForm/valueType/ignore.js +2 -2
- package/es/form/components/SchemaForm/valueType/index.js +5 -5
- package/es/form/components/Segmented/index.js +20 -23
- package/es/form/components/Select/index.js +69 -73
- package/es/form/components/Slider/index.js +33 -35
- package/es/form/components/Switch/index.js +24 -26
- package/es/form/components/Text/index.js +79 -88
- package/es/form/components/TextArea/index.js +17 -20
- package/es/form/components/TreeSelect/index.js +20 -23
- package/es/form/components/UploadButton/index.js +56 -103
- package/es/form/components/UploadDragger/index.js +37 -44
- package/es/form/helpers/grid.js +65 -67
- package/es/form/index.d.ts +1 -0
- package/es/form/layouts/DrawerForm/index.d.ts +1 -1
- package/es/form/layouts/DrawerForm/index.js +152 -242
- package/es/form/layouts/DrawerForm/style.d.ts +1 -1
- package/es/form/layouts/DrawerForm/style.js +26 -25
- package/es/form/layouts/LightFilter/index.d.ts +12 -1
- package/es/form/layouts/LightFilter/index.js +158 -140
- package/es/form/layouts/LightFilter/style.d.ts +1 -1
- package/es/form/layouts/LightFilter/style.js +52 -48
- package/es/form/layouts/LoginForm/index.d.ts +1 -1
- package/es/form/layouts/LoginForm/index.js +44 -47
- package/es/form/layouts/LoginForm/style.d.ts +1 -1
- package/es/form/layouts/LoginForm/style.js +71 -67
- package/es/form/layouts/LoginFormPage/index.d.ts +1 -1
- package/es/form/layouts/LoginFormPage/index.js +45 -48
- package/es/form/layouts/LoginFormPage/style.d.ts +1 -1
- package/es/form/layouts/LoginFormPage/style.js +136 -126
- package/es/form/layouts/ModalForm/index.js +120 -203
- package/es/form/layouts/ProForm/index.d.ts +2 -2
- package/es/form/layouts/ProForm/index.js +5 -5
- package/es/form/layouts/QueryFilter/Actions.js +23 -22
- package/es/form/layouts/QueryFilter/index.d.ts +2 -1
- package/es/form/layouts/QueryFilter/index.js +178 -203
- package/es/form/layouts/QueryFilter/style.d.ts +1 -1
- package/es/form/layouts/QueryFilter/style.js +45 -37
- package/es/form/layouts/StepsForm/StepForm.d.ts +2 -3
- package/es/form/layouts/StepsForm/StepForm.js +50 -71
- package/es/form/layouts/StepsForm/index.js +187 -216
- package/es/form/layouts/StepsForm/style.d.ts +1 -1
- package/es/form/layouts/StepsForm/style.js +30 -28
- package/es/form/layouts/index.js +1 -1
- package/es/layout/ProLayout.js +281 -292
- package/es/layout/WrapContent.js +16 -12
- package/es/layout/assert/Logo.js +95 -97
- package/es/layout/components/AppsLogoComponents/AppsLogo.js +10 -12
- package/es/layout/components/AppsLogoComponents/DefaultContent.js +17 -16
- package/es/layout/components/AppsLogoComponents/SimpleContent.js +19 -18
- package/es/layout/components/AppsLogoComponents/index.js +34 -37
- package/es/layout/components/AppsLogoComponents/style/default.js +2 -2
- package/es/layout/components/AppsLogoComponents/style/index.d.ts +1 -1
- package/es/layout/components/AppsLogoComponents/style/index.js +52 -50
- package/es/layout/components/AppsLogoComponents/style/simple.js +1 -1
- package/es/layout/components/CollapsedIcon/index.js +18 -15
- package/es/layout/components/CollapsedIcon/style.d.ts +1 -1
- package/es/layout/components/CollapsedIcon/style.js +40 -40
- package/es/layout/components/Footer.js +22 -21
- package/es/layout/components/FooterToolbar/index.js +58 -52
- package/es/layout/components/FooterToolbar/style/index.d.ts +1 -1
- package/es/layout/components/FooterToolbar/style/index.js +38 -37
- package/es/layout/components/FooterToolbar/style/stylish.d.ts +1 -1
- package/es/layout/components/FooterToolbar/style/stylish.js +11 -9
- package/es/layout/components/GlobalFooter/index.d.ts +1 -1
- package/es/layout/components/GlobalFooter/index.js +25 -25
- package/es/layout/components/GlobalFooter/style.d.ts +1 -1
- package/es/layout/components/GlobalFooter/style.js +31 -30
- package/es/layout/components/GlobalHeader/ActionsContent.js +62 -78
- package/es/layout/components/GlobalHeader/index.js +59 -47
- package/es/layout/components/GlobalHeader/rightContentStyle.d.ts +1 -1
- package/es/layout/components/GlobalHeader/rightContentStyle.js +49 -49
- package/es/layout/components/GlobalHeader/style.d.ts +1 -1
- package/es/layout/components/GlobalHeader/style.js +58 -54
- package/es/layout/components/GridContent/index.js +24 -19
- package/es/layout/components/GridContent/style.d.ts +1 -1
- package/es/layout/components/GridContent/style.js +14 -13
- package/es/layout/components/Header/index.js +63 -57
- package/es/layout/components/Header/style/header.d.ts +1 -1
- package/es/layout/components/Header/style/header.js +49 -47
- package/es/layout/components/Header/style/stylish.d.ts +1 -1
- package/es/layout/components/Header/style/stylish.js +15 -11
- package/es/layout/components/Help/AsyncContentPanel.js +13 -18
- package/es/layout/components/Help/HelpProvide.js +1 -1
- package/es/layout/components/Help/ProHelpContentPanel.js +64 -83
- package/es/layout/components/Help/ProHelpDrawer.d.ts +1 -1
- package/es/layout/components/Help/ProHelpDrawer.js +25 -29
- package/es/layout/components/Help/ProHelpModal.d.ts +1 -1
- package/es/layout/components/Help/ProHelpModal.js +24 -27
- package/es/layout/components/Help/ProHelpPanel.js +86 -94
- package/es/layout/components/Help/ProHelpPopover.js +19 -17
- package/es/layout/components/Help/RenderContentPanel.js +34 -24
- package/es/layout/components/Help/Search.js +52 -78
- package/es/layout/components/Help/index.js +9 -11
- package/es/layout/components/Help/style.d.ts +1 -1
- package/es/layout/components/Help/style.js +82 -75
- package/es/layout/components/PageContainer/index.js +168 -149
- package/es/layout/components/PageContainer/style/index.d.ts +1 -1
- package/es/layout/components/PageContainer/style/index.js +95 -78
- package/es/layout/components/PageContainer/style/stylish.d.ts +1 -1
- package/es/layout/components/PageContainer/style/stylish.js +11 -9
- package/es/layout/components/PageHeader/index.js +96 -97
- package/es/layout/components/PageHeader/style/index.d.ts +1 -1
- package/es/layout/components/PageHeader/style/index.js +142 -122
- package/es/layout/components/PageLoading/index.js +17 -20
- package/es/layout/components/SettingDrawer/BlockCheckbox.js +29 -32
- package/es/layout/components/SettingDrawer/LayoutChange.js +22 -22
- package/es/layout/components/SettingDrawer/RegionalChange.js +14 -15
- package/es/layout/components/SettingDrawer/ThemeColor.js +32 -35
- package/es/layout/components/SettingDrawer/index.js +139 -170
- package/es/layout/components/SettingDrawer/style/index.d.ts +1 -1
- package/es/layout/components/SettingDrawer/style/index.js +141 -137
- package/es/layout/components/SiderMenu/BaseMenu.d.ts +1 -1
- package/es/layout/components/SiderMenu/BaseMenu.js +236 -222
- package/es/layout/components/SiderMenu/SiderMenu.js +127 -117
- package/es/layout/components/SiderMenu/index.js +51 -43
- package/es/layout/components/SiderMenu/style/index.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/index.js +179 -161
- package/es/layout/components/SiderMenu/style/menu.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/menu.js +148 -110
- package/es/layout/components/SiderMenu/style/stylish.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/stylish.js +15 -11
- package/es/layout/components/TopNavHeader/index.js +71 -60
- package/es/layout/components/TopNavHeader/style.d.ts +1 -1
- package/es/layout/components/TopNavHeader/style.js +64 -63
- package/es/layout/context/RouteContext.js +1 -1
- package/es/layout/defaultSettings.d.ts +6 -0
- package/es/layout/defaultSettings.js +1 -1
- package/es/layout/getPageTitle.js +23 -24
- package/es/layout/locales/en-US.js +3 -2
- package/es/layout/locales/index.js +5 -5
- package/es/layout/locales/it-IT.js +3 -2
- package/es/layout/locales/ko-KR.js +3 -2
- package/es/layout/locales/zh-CN.js +3 -2
- package/es/layout/locales/zh-TW.js +3 -2
- package/es/layout/style/index.d.ts +1 -1
- package/es/layout/style/index.js +48 -42
- package/es/layout/utils/getBreadcrumbProps.js +60 -60
- package/es/layout/utils/getMenuData.js +7 -11
- package/es/layout/utils/pathTools.js +2 -6
- package/es/layout/utils/useCurrentMenuLayoutProps.js +4 -9
- package/es/layout/utils/utils.js +15 -17
- package/es/list/Item.js +157 -137
- package/es/list/ListView.js +106 -115
- package/es/list/constants.js +2 -2
- package/es/list/index.js +72 -70
- package/es/list/style/index.d.ts +1 -1
- package/es/list/style/index.js +281 -213
- package/es/provider/index.d.ts +1 -0
- package/es/provider/index.js +126 -114
- package/es/provider/intl.js +53 -55
- package/es/provider/typing/layoutToken.js +26 -23
- package/es/provider/useStyle/index.d.ts +2 -1
- package/es/provider/useStyle/index.js +60 -60
- package/es/provider/utils/merge.js +10 -12
- package/es/skeleton/components/Descriptions/index.js +211 -229
- package/es/skeleton/components/List/index.js +208 -223
- package/es/skeleton/components/Result/index.js +45 -47
- package/es/skeleton/index.js +13 -10
- package/es/table/Store/Provide.d.ts +4 -4
- package/es/table/Store/Provide.js +102 -117
- package/es/table/Table.d.ts +5 -2
- package/es/table/Table.js +593 -603
- package/es/table/TableSearch.d.ts +24 -0
- package/es/table/TableSearch.js +54 -0
- package/es/table/TableToolbar.d.ts +22 -0
- package/es/table/TableToolbar.js +47 -0
- package/es/table/components/Alert/index.d.ts +1 -1
- package/es/table/components/Alert/index.js +41 -40
- package/es/table/components/Alert/style.d.ts +1 -1
- package/es/table/components/Alert/style.js +28 -27
- package/es/table/components/ColumnSetting/index.d.ts +1 -1
- package/es/table/components/ColumnSetting/index.js +230 -223
- package/es/table/components/ColumnSetting/style.d.ts +1 -1
- package/es/table/components/ColumnSetting/style.js +86 -71
- package/es/table/components/DragSortTable/index.d.ts +1 -1
- package/es/table/components/DragSortTable/index.js +65 -79
- package/es/table/components/DragSortTable/style.d.ts +1 -1
- package/es/table/components/DragSortTable/style.js +20 -19
- package/es/table/components/Dropdown/index.js +42 -47
- package/es/table/components/EditableTable/CellEditorTable.js +24 -32
- package/es/table/components/EditableTable/RowEditorTable.js +23 -28
- package/es/table/components/EditableTable/index.js +601 -302
- package/es/table/components/Form/FormRender.js +99 -103
- package/es/table/components/Form/index.d.ts +4 -19
- package/es/table/components/Form/index.js +112 -159
- package/es/table/components/ListToolBar/HeaderMenu.js +44 -52
- package/es/table/components/ListToolBar/index.js +122 -147
- package/es/table/components/ListToolBar/style.d.ts +1 -1
- package/es/table/components/ListToolBar/style.js +127 -117
- package/es/table/components/ToolBar/DensityIcon.js +10 -9
- package/es/table/components/ToolBar/FullscreenIcon.js +5 -9
- package/es/table/components/ToolBar/index.d.ts +2 -8
- package/es/table/components/ToolBar/index.js +155 -195
- package/es/table/style/index.d.ts +1 -1
- package/es/table/style/index.js +144 -112
- package/es/table/typing.d.ts +13 -6
- package/es/table/useFetchData.js +204 -348
- package/es/table/utils/cellRenderToFromItem.js +105 -119
- package/es/table/utils/columnRender.js +63 -54
- package/es/table/utils/columnSort.js +22 -22
- package/es/table/utils/genProColumnToColumn.d.ts +13 -9
- package/es/table/utils/genProColumnToColumn.js +121 -98
- package/es/table/utils/index.d.ts +12 -0
- package/es/table/utils/index.js +114 -178
- package/es/table/utils/useDragSort.d.ts +1 -1
- package/es/table/utils/useDragSort.js +99 -92
- package/es/table/utils/usePageInfo.d.ts +6 -0
- package/es/table/utils/usePageInfo.js +55 -0
- package/es/utils/components/DropdownFooter/index.js +23 -21
- package/es/utils/components/DropdownFooter/style.d.ts +1 -1
- package/es/utils/components/DropdownFooter/style.js +16 -15
- package/es/utils/components/ErrorBoundary/index.js +27 -50
- package/es/utils/components/FieldLabel/index.js +70 -70
- package/es/utils/components/FieldLabel/style.d.ts +1 -1
- package/es/utils/components/FieldLabel/style.js +104 -81
- package/es/utils/components/FilterDropdown/index.d.ts +11 -0
- package/es/utils/components/FilterDropdown/index.js +43 -32
- package/es/utils/components/FilterDropdown/style.d.ts +1 -1
- package/es/utils/components/FilterDropdown/style.js +19 -16
- package/es/utils/components/InlineErrorFormItem/index.js +78 -78
- package/es/utils/components/InlineErrorFormItem/style.d.ts +1 -1
- package/es/utils/components/InlineErrorFormItem/style.js +56 -49
- package/es/utils/components/LabelIconTip/index.js +30 -31
- package/es/utils/components/LabelIconTip/style.d.ts +1 -1
- package/es/utils/components/LabelIconTip/style.js +36 -35
- package/es/utils/components/ProFormContext/index.js +1 -1
- package/es/utils/conversionMomentValue/index.js +19 -22
- package/es/utils/dateArrayFormatter/index.js +9 -14
- package/es/utils/genCopyable/index.js +74 -32
- package/es/utils/getFieldPropsOrFormItemProps/index.js +1 -1
- package/es/utils/hooks/useDebounceFn/index.js +18 -51
- package/es/utils/hooks/useDebounceValue/index.js +7 -16
- package/es/utils/hooks/useDeepCompareEffect/index.js +6 -18
- package/es/utils/hooks/useDocumentTitle/index.js +2 -2
- package/es/utils/hooks/useFetchData/index.js +36 -65
- package/es/utils/hooks/useForceRender/index.js +2 -9
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/usePrevious/index.js +3 -3
- package/es/utils/hooks/useReactiveRef/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +3 -3
- package/es/utils/hooks/useRefFunction/index.js +4 -9
- package/es/utils/index.d.ts +1 -2
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +2 -2
- package/es/utils/isDeepEqualReact/index.js +9 -44
- package/es/utils/isDropdownValueType/index.js +2 -2
- package/es/utils/isNil/index.js +1 -3
- package/es/utils/isUrl/index.js +2 -2
- package/es/utils/merge/index.js +10 -12
- package/es/utils/nanoid/index.js +5 -6
- package/es/utils/omitBoolean/index.js +1 -1
- package/es/utils/omitUndefined/index.js +3 -3
- package/es/utils/omitUndefinedAndEmptyArr/index.js +4 -5
- package/es/utils/parseValueToMoment/index.js +3 -7
- package/es/utils/pickProFormItemProps/index.js +3 -3
- package/es/utils/pickProProps/index.js +6 -7
- package/es/utils/proFieldParsingText/index.js +86 -99
- package/es/utils/runFunction/index.js +2 -5
- package/es/utils/stringify/index.js +1 -1
- package/es/utils/transformKeySubmitValue/index.js +99 -116
- package/es/utils/typing.d.ts +1 -1
- package/es/utils/useEditableArray/index.d.ts +9 -7
- package/es/utils/useEditableArray/index.js +788 -700
- package/es/utils/useEditableMap/index.d.ts +1 -1
- package/es/utils/useEditableMap/index.js +148 -137
- package/es/utils/useMediaQuery/index.js +16 -18
- package/es/utils/useMediaQuery/query.js +15 -19
- package/es/version.js +1 -1
- package/lib/card/ProCard.js +7 -7
- package/lib/card/components/Actions/index.js +25 -25
- package/lib/card/components/Actions/style.d.ts +1 -1
- package/lib/card/components/Actions/style.js +79 -72
- package/lib/card/components/Card/index.js +157 -138
- package/lib/card/components/Card/style.d.ts +1 -1
- package/lib/card/components/Card/style.js +249 -193
- package/lib/card/components/CheckCard/Group.js +97 -115
- package/lib/card/components/CheckCard/index.d.ts +6 -0
- package/lib/card/components/CheckCard/index.js +85 -77
- package/lib/card/components/CheckCard/style.d.ts +1 -1
- package/lib/card/components/CheckCard/style.js +184 -169
- package/lib/card/components/Divider/index.js +20 -16
- package/lib/card/components/Divider/style.d.ts +1 -1
- package/lib/card/components/Divider/style.js +32 -30
- package/lib/card/components/Loading/index.js +19 -16
- package/lib/card/components/Loading/style.d.ts +1 -1
- package/lib/card/components/Loading/style.js +34 -32
- package/lib/card/components/Operation/index.js +16 -14
- package/lib/card/components/Operation/style.d.ts +1 -1
- package/lib/card/components/Operation/style.js +19 -19
- package/lib/card/components/Statistic/index.js +46 -42
- package/lib/card/components/Statistic/style.d.ts +1 -1
- package/lib/card/components/Statistic/style.js +89 -71
- package/lib/card/components/StatisticCard/index.js +45 -38
- package/lib/card/components/StatisticCard/style.d.ts +1 -1
- package/lib/card/components/StatisticCard/style.js +37 -36
- package/lib/card/index.js +4 -4
- package/lib/card/typing.d.ts +5 -0
- package/lib/descriptions/index.js +219 -225
- package/lib/descriptions/useFetchData.js +51 -90
- package/lib/field/AllProField.js +267 -217
- package/lib/field/FieldHOC/index.js +9 -15
- package/lib/field/PureProField.js +84 -82
- package/lib/field/ValueTypeToComponent.js +517 -618
- package/lib/field/components/Cascader/index.d.ts +2 -3
- package/lib/field/components/Cascader/index.js +65 -85
- package/lib/field/components/Checkbox/index.d.ts +1 -2
- package/lib/field/components/Checkbox/index.js +75 -73
- package/lib/field/components/Code/index.js +40 -39
- package/lib/field/components/ColorPicker/index.js +38 -33
- package/lib/field/components/DatePicker/index.d.ts +1 -1
- package/lib/field/components/DatePicker/index.js +49 -53
- package/lib/field/components/Digit/index.js +41 -43
- package/lib/field/components/DigitRange/index.js +69 -76
- package/lib/field/components/FromNow/index.js +27 -25
- package/lib/field/components/Image/index.js +28 -24
- package/lib/field/components/IndexColumn/index.js +22 -17
- package/lib/field/components/Money/index.js +106 -116
- package/lib/field/components/Options/index.js +34 -34
- package/lib/field/components/Password/index.js +35 -38
- package/lib/field/components/Percent/index.js +40 -45
- package/lib/field/components/Percent/util.js +3 -6
- package/lib/field/components/Progress/index.js +29 -28
- package/lib/field/components/Radio/index.d.ts +1 -2
- package/lib/field/components/Radio/index.js +61 -63
- package/lib/field/components/RangePicker/index.d.ts +1 -1
- package/lib/field/components/RangePicker/index.js +52 -63
- package/lib/field/components/Rate/index.js +24 -21
- package/lib/field/components/Second/index.js +36 -33
- package/lib/field/components/Segmented/index.d.ts +1 -2
- package/lib/field/components/Segmented/index.js +37 -48
- package/lib/field/components/Select/LightSelect/index.d.ts +1 -1
- package/lib/field/components/Select/LightSelect/index.js +103 -111
- package/lib/field/components/Select/SearchSelect/index.d.ts +6 -1
- package/lib/field/components/Select/SearchSelect/index.js +193 -130
- package/lib/field/components/Select/index.d.ts +1 -4
- package/lib/field/components/Select/index.js +198 -220
- package/lib/field/components/Slider/index.js +25 -22
- package/lib/field/components/Status/index.js +69 -79
- package/lib/field/components/Switch/index.d.ts +1 -1
- package/lib/field/components/Switch/index.js +32 -31
- package/lib/field/components/Text/index.js +34 -38
- package/lib/field/components/TextArea/index.js +26 -21
- package/lib/field/components/TextArea/readonly.js +24 -22
- package/lib/field/components/TimePicker/index.js +96 -105
- package/lib/field/components/TreeSelect/index.d.ts +2 -3
- package/lib/field/components/TreeSelect/index.js +105 -124
- package/lib/field/index.js +34 -34
- package/lib/form/BaseForm/BaseForm.d.ts +3 -0
- package/lib/form/BaseForm/BaseForm.js +415 -495
- package/lib/form/BaseForm/EditOrReadOnlyContext.js +1 -1
- package/lib/form/BaseForm/LightWrapper/index.js +57 -66
- package/lib/form/BaseForm/LightWrapper/style.d.ts +1 -1
- package/lib/form/BaseForm/LightWrapper/style.js +17 -14
- package/lib/form/BaseForm/Submitter/index.js +44 -44
- package/lib/form/BaseForm/index.js +3 -3
- package/lib/form/FieldContext.js +1 -1
- package/lib/form/components/Captcha/index.d.ts +8 -2
- package/lib/form/components/Captcha/index.js +76 -129
- package/lib/form/components/Cascader/index.js +26 -29
- package/lib/form/components/Checkbox/index.js +60 -61
- package/lib/form/components/ColorPicker/index.js +24 -26
- package/lib/form/components/DatePicker/BaseDatePicker.js +32 -30
- package/lib/form/components/DatePicker/DatePicker.js +14 -13
- package/lib/form/components/DatePicker/DateTimePicker.js +11 -12
- package/lib/form/components/DatePicker/MonthPicker.js +14 -13
- package/lib/form/components/DatePicker/QuarterPicker.js +14 -13
- package/lib/form/components/DatePicker/TimePicker.js +26 -27
- package/lib/form/components/DatePicker/WeekPicker.js +14 -13
- package/lib/form/components/DatePicker/YearPicker.js +14 -13
- package/lib/form/components/DatePicker/index.js +1 -1
- package/lib/form/components/DateRangePicker/BaseDateRanger.js +34 -34
- package/lib/form/components/DateRangePicker/DateMonthRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateQuarterRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateTimeRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateWeekRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateYearRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/TimeRangePicker.js +26 -29
- package/lib/form/components/DateRangePicker/index.js +15 -16
- package/lib/form/components/Dependency/index.js +31 -35
- package/lib/form/components/Digit/DigitRange.js +23 -24
- package/lib/form/components/Digit/index.js +27 -29
- package/lib/form/components/Field/index.js +55 -63
- package/lib/form/components/FieldSet/index.js +68 -76
- package/lib/form/components/FormItem/FormItemRender/index.js +58 -48
- package/lib/form/components/FormItem/Group/index.js +95 -95
- package/lib/form/components/FormItem/Group/style.d.ts +1 -1
- package/lib/form/components/FormItem/Group/style.js +46 -41
- package/lib/form/components/FormItem/index.js +135 -141
- package/lib/form/components/FormItem/warpField.js +165 -149
- package/lib/form/components/List/ListContainer.js +100 -191
- package/lib/form/components/List/ListItem.js +153 -200
- package/lib/form/components/List/index.d.ts +1 -1
- package/lib/form/components/List/index.js +97 -107
- package/lib/form/components/List/style.d.ts +1 -1
- package/lib/form/components/List/style.js +71 -48
- package/lib/form/components/Money/index.js +28 -30
- package/lib/form/components/Radio/index.js +45 -49
- package/lib/form/components/Rate/index.js +17 -21
- package/lib/form/components/SchemaForm/index.js +54 -68
- package/lib/form/components/SchemaForm/layoutType/Embed.js +5 -6
- package/lib/form/components/SchemaForm/layoutType/StepsForm.js +22 -26
- package/lib/form/components/SchemaForm/layoutType/index.js +2 -2
- package/lib/form/components/SchemaForm/valueType/dependency.js +13 -12
- package/lib/form/components/SchemaForm/valueType/divider.js +6 -7
- package/lib/form/components/SchemaForm/valueType/field.js +47 -45
- package/lib/form/components/SchemaForm/valueType/formList.js +10 -9
- package/lib/form/components/SchemaForm/valueType/formSet.js +10 -8
- package/lib/form/components/SchemaForm/valueType/group.js +9 -10
- package/lib/form/components/SchemaForm/valueType/ignore.js +4 -3
- package/lib/form/components/SchemaForm/valueType/index.js +7 -6
- package/lib/form/components/Segmented/index.js +20 -24
- package/lib/form/components/Select/index.js +69 -73
- package/lib/form/components/Slider/index.js +33 -35
- package/lib/form/components/Switch/index.js +24 -26
- package/lib/form/components/Text/index.js +77 -86
- package/lib/form/components/TextArea/index.js +17 -21
- package/lib/form/components/TreeSelect/index.js +20 -23
- package/lib/form/components/UploadButton/index.js +56 -103
- package/lib/form/components/UploadDragger/index.js +37 -44
- package/lib/form/components/index.js +42 -42
- package/lib/form/helpers/grid.js +68 -69
- package/lib/form/helpers/index.js +1 -1
- package/lib/form/index.d.ts +1 -0
- package/lib/form/index.js +8 -8
- package/lib/form/layouts/DrawerForm/index.d.ts +1 -1
- package/lib/form/layouts/DrawerForm/index.js +151 -242
- package/lib/form/layouts/DrawerForm/style.d.ts +1 -1
- package/lib/form/layouts/DrawerForm/style.js +26 -26
- package/lib/form/layouts/LightFilter/index.d.ts +12 -1
- package/lib/form/layouts/LightFilter/index.js +158 -141
- package/lib/form/layouts/LightFilter/style.d.ts +1 -1
- package/lib/form/layouts/LightFilter/style.js +52 -49
- package/lib/form/layouts/LoginForm/index.d.ts +1 -1
- package/lib/form/layouts/LoginForm/index.js +44 -48
- package/lib/form/layouts/LoginForm/style.d.ts +1 -1
- package/lib/form/layouts/LoginForm/style.js +71 -68
- package/lib/form/layouts/LoginFormPage/index.d.ts +1 -1
- package/lib/form/layouts/LoginFormPage/index.js +45 -49
- package/lib/form/layouts/LoginFormPage/style.d.ts +1 -1
- package/lib/form/layouts/LoginFormPage/style.js +136 -127
- package/lib/form/layouts/ModalForm/index.js +119 -203
- package/lib/form/layouts/ProForm/index.d.ts +1 -1
- package/lib/form/layouts/ProForm/index.js +5 -5
- package/lib/form/layouts/QueryFilter/Actions.js +23 -22
- package/lib/form/layouts/QueryFilter/index.d.ts +2 -1
- package/lib/form/layouts/QueryFilter/index.js +177 -202
- package/lib/form/layouts/QueryFilter/style.d.ts +1 -1
- package/lib/form/layouts/QueryFilter/style.js +45 -38
- package/lib/form/layouts/StepsForm/StepForm.d.ts +2 -3
- package/lib/form/layouts/StepsForm/StepForm.js +50 -72
- package/lib/form/layouts/StepsForm/index.js +186 -215
- package/lib/form/layouts/StepsForm/style.d.ts +1 -1
- package/lib/form/layouts/StepsForm/style.js +30 -29
- package/lib/form/layouts/index.js +9 -9
- package/lib/index.js +11 -11
- package/lib/layout/ProLayout.js +281 -292
- package/lib/layout/WrapContent.js +18 -14
- package/lib/layout/assert/Logo.js +96 -97
- package/lib/layout/components/AppsLogoComponents/AppsLogo.js +11 -12
- package/lib/layout/components/AppsLogoComponents/DefaultContent.js +19 -17
- package/lib/layout/components/AppsLogoComponents/SimpleContent.js +22 -19
- package/lib/layout/components/AppsLogoComponents/index.js +37 -39
- package/lib/layout/components/AppsLogoComponents/style/default.js +4 -3
- package/lib/layout/components/AppsLogoComponents/style/index.d.ts +1 -1
- package/lib/layout/components/AppsLogoComponents/style/index.js +52 -51
- package/lib/layout/components/AppsLogoComponents/style/simple.js +3 -2
- package/lib/layout/components/CollapsedIcon/index.js +20 -17
- package/lib/layout/components/CollapsedIcon/style.d.ts +1 -1
- package/lib/layout/components/CollapsedIcon/style.js +40 -41
- package/lib/layout/components/Footer.js +23 -22
- package/lib/layout/components/FooterToolbar/index.js +59 -53
- package/lib/layout/components/FooterToolbar/style/index.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/style/index.js +38 -38
- package/lib/layout/components/FooterToolbar/style/stylish.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/style/stylish.js +11 -10
- package/lib/layout/components/GlobalFooter/index.d.ts +1 -1
- package/lib/layout/components/GlobalFooter/index.js +27 -27
- package/lib/layout/components/GlobalFooter/style.d.ts +1 -1
- package/lib/layout/components/GlobalFooter/style.js +31 -31
- package/lib/layout/components/GlobalHeader/ActionsContent.js +65 -81
- package/lib/layout/components/GlobalHeader/index.js +61 -49
- package/lib/layout/components/GlobalHeader/rightContentStyle.d.ts +1 -1
- package/lib/layout/components/GlobalHeader/rightContentStyle.js +49 -50
- package/lib/layout/components/GlobalHeader/style.d.ts +1 -1
- package/lib/layout/components/GlobalHeader/style.js +58 -55
- package/lib/layout/components/GridContent/index.js +26 -21
- package/lib/layout/components/GridContent/style.d.ts +1 -1
- package/lib/layout/components/GridContent/style.js +14 -14
- package/lib/layout/components/Header/index.js +65 -59
- package/lib/layout/components/Header/style/header.d.ts +1 -1
- package/lib/layout/components/Header/style/header.js +49 -48
- package/lib/layout/components/Header/style/stylish.d.ts +1 -1
- package/lib/layout/components/Header/style/stylish.js +15 -12
- package/lib/layout/components/Help/AsyncContentPanel.js +15 -20
- package/lib/layout/components/Help/HelpProvide.js +1 -1
- package/lib/layout/components/Help/ProHelpContentPanel.js +66 -85
- package/lib/layout/components/Help/ProHelpDrawer.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpDrawer.js +27 -30
- package/lib/layout/components/Help/ProHelpModal.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpModal.js +26 -28
- package/lib/layout/components/Help/ProHelpPanel.js +86 -94
- package/lib/layout/components/Help/ProHelpPopover.js +21 -19
- package/lib/layout/components/Help/RenderContentPanel.js +36 -26
- package/lib/layout/components/Help/Search.js +55 -80
- package/lib/layout/components/Help/index.js +19 -20
- package/lib/layout/components/Help/style.d.ts +1 -1
- package/lib/layout/components/Help/style.js +82 -76
- package/lib/layout/components/PageContainer/index.js +172 -151
- package/lib/layout/components/PageContainer/style/index.d.ts +1 -1
- package/lib/layout/components/PageContainer/style/index.js +95 -79
- package/lib/layout/components/PageContainer/style/stylish.d.ts +1 -1
- package/lib/layout/components/PageContainer/style/stylish.js +11 -10
- package/lib/layout/components/PageHeader/index.js +99 -99
- package/lib/layout/components/PageHeader/style/index.d.ts +1 -1
- package/lib/layout/components/PageHeader/style/index.js +142 -123
- package/lib/layout/components/PageLoading/index.js +18 -20
- package/lib/layout/components/SettingDrawer/BlockCheckbox.js +31 -34
- package/lib/layout/components/SettingDrawer/LayoutChange.js +25 -23
- package/lib/layout/components/SettingDrawer/RegionalChange.js +16 -16
- package/lib/layout/components/SettingDrawer/ThemeColor.js +34 -36
- package/lib/layout/components/SettingDrawer/index.js +140 -170
- package/lib/layout/components/SettingDrawer/style/index.d.ts +1 -1
- package/lib/layout/components/SettingDrawer/style/index.js +141 -138
- package/lib/layout/components/SiderMenu/BaseMenu.d.ts +1 -1
- package/lib/layout/components/SiderMenu/BaseMenu.js +236 -222
- package/lib/layout/components/SiderMenu/SiderMenu.js +130 -119
- package/lib/layout/components/SiderMenu/index.js +53 -45
- package/lib/layout/components/SiderMenu/style/index.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/index.js +179 -162
- package/lib/layout/components/SiderMenu/style/menu.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/menu.js +148 -111
- package/lib/layout/components/SiderMenu/style/stylish.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/stylish.js +15 -12
- package/lib/layout/components/TopNavHeader/index.js +73 -62
- package/lib/layout/components/TopNavHeader/style.d.ts +1 -1
- package/lib/layout/components/TopNavHeader/style.js +64 -64
- package/lib/layout/context/RouteContext.js +1 -1
- package/lib/layout/defaultSettings.d.ts +6 -0
- package/lib/layout/defaultSettings.js +1 -1
- package/lib/layout/getPageTitle.js +27 -26
- package/lib/layout/index.js +16 -16
- package/lib/layout/locales/en-US.js +3 -2
- package/lib/layout/locales/index.js +8 -6
- package/lib/layout/locales/it-IT.js +3 -2
- package/lib/layout/locales/ko-KR.js +3 -2
- package/lib/layout/locales/zh-CN.js +3 -2
- package/lib/layout/locales/zh-TW.js +3 -2
- package/lib/layout/style/index.d.ts +1 -1
- package/lib/layout/style/index.js +48 -43
- package/lib/layout/utils/getBreadcrumbProps.js +65 -62
- package/lib/layout/utils/getMenuData.js +9 -13
- package/lib/layout/utils/pathTools.js +2 -6
- package/lib/layout/utils/useCurrentMenuLayoutProps.js +6 -11
- package/lib/layout/utils/utils.js +16 -18
- package/lib/list/Item.js +155 -136
- package/lib/list/ListView.js +110 -119
- package/lib/list/constants.js +2 -2
- package/lib/list/index.js +72 -70
- package/lib/list/style/index.d.ts +1 -1
- package/lib/list/style/index.js +281 -214
- package/lib/provider/index.d.ts +1 -0
- package/lib/provider/index.js +132 -117
- package/lib/provider/intl.js +56 -56
- package/lib/provider/typing/layoutToken.js +28 -25
- package/lib/provider/useStyle/index.d.ts +2 -1
- package/lib/provider/useStyle/index.js +64 -61
- package/lib/provider/utils/merge.js +12 -14
- package/lib/skeleton/components/Descriptions/index.js +213 -229
- package/lib/skeleton/components/List/index.js +211 -221
- package/lib/skeleton/components/Result/index.js +45 -47
- package/lib/skeleton/index.js +23 -19
- package/lib/table/Store/Provide.d.ts +4 -4
- package/lib/table/Store/Provide.js +103 -117
- package/lib/table/Table.d.ts +5 -2
- package/lib/table/Table.js +592 -602
- package/lib/table/TableSearch.d.ts +24 -0
- package/lib/table/TableSearch.js +61 -0
- package/lib/table/TableToolbar.d.ts +22 -0
- package/lib/table/TableToolbar.js +55 -0
- package/lib/table/components/Alert/index.d.ts +1 -1
- package/lib/table/components/Alert/index.js +41 -40
- package/lib/table/components/Alert/style.d.ts +1 -1
- package/lib/table/components/Alert/style.js +28 -28
- package/lib/table/components/ColumnSetting/index.d.ts +1 -1
- package/lib/table/components/ColumnSetting/index.js +230 -224
- package/lib/table/components/ColumnSetting/style.d.ts +1 -1
- package/lib/table/components/ColumnSetting/style.js +86 -72
- package/lib/table/components/DragSortTable/index.d.ts +1 -1
- package/lib/table/components/DragSortTable/index.js +64 -78
- package/lib/table/components/DragSortTable/style.d.ts +1 -1
- package/lib/table/components/DragSortTable/style.js +20 -20
- package/lib/table/components/Dropdown/index.js +42 -48
- package/lib/table/components/EditableTable/CellEditorTable.js +24 -32
- package/lib/table/components/EditableTable/RowEditorTable.js +23 -28
- package/lib/table/components/EditableTable/index.js +598 -299
- package/lib/table/components/Form/FormRender.js +99 -104
- package/lib/table/components/Form/index.d.ts +4 -19
- package/lib/table/components/Form/index.js +113 -159
- package/lib/table/components/ListToolBar/HeaderMenu.js +42 -51
- package/lib/table/components/ListToolBar/index.js +123 -148
- package/lib/table/components/ListToolBar/style.d.ts +1 -1
- package/lib/table/components/ListToolBar/style.js +127 -118
- package/lib/table/components/ToolBar/DensityIcon.js +10 -9
- package/lib/table/components/ToolBar/FullscreenIcon.js +5 -10
- package/lib/table/components/ToolBar/index.d.ts +2 -8
- package/lib/table/components/ToolBar/index.js +154 -194
- package/lib/table/index.js +27 -27
- package/lib/table/style/index.d.ts +1 -1
- package/lib/table/style/index.js +144 -113
- package/lib/table/typing.d.ts +13 -6
- package/lib/table/useFetchData.js +202 -347
- package/lib/table/utils/cellRenderToFromItem.js +106 -120
- package/lib/table/utils/columnRender.js +65 -54
- package/lib/table/utils/columnSort.js +24 -23
- package/lib/table/utils/genProColumnToColumn.d.ts +13 -9
- package/lib/table/utils/genProColumnToColumn.js +121 -99
- package/lib/table/utils/index.d.ts +12 -0
- package/lib/table/utils/index.js +129 -181
- package/lib/table/utils/useDragSort.d.ts +1 -1
- package/lib/table/utils/useDragSort.js +99 -93
- package/lib/table/utils/usePageInfo.d.ts +6 -0
- package/lib/table/utils/usePageInfo.js +61 -0
- package/lib/utils/components/DropdownFooter/index.js +25 -23
- package/lib/utils/components/DropdownFooter/style.d.ts +1 -1
- package/lib/utils/components/DropdownFooter/style.js +16 -16
- package/lib/utils/components/ErrorBoundary/index.js +28 -50
- package/lib/utils/components/FieldLabel/index.js +70 -71
- package/lib/utils/components/FieldLabel/style.d.ts +1 -1
- package/lib/utils/components/FieldLabel/style.js +104 -82
- package/lib/utils/components/FilterDropdown/index.d.ts +11 -0
- package/lib/utils/components/FilterDropdown/index.js +44 -33
- package/lib/utils/components/FilterDropdown/style.d.ts +1 -1
- package/lib/utils/components/FilterDropdown/style.js +19 -17
- package/lib/utils/components/InlineErrorFormItem/index.js +80 -80
- package/lib/utils/components/InlineErrorFormItem/style.d.ts +1 -1
- package/lib/utils/components/InlineErrorFormItem/style.js +56 -50
- package/lib/utils/components/LabelIconTip/index.js +30 -32
- package/lib/utils/components/LabelIconTip/style.d.ts +1 -1
- package/lib/utils/components/LabelIconTip/style.js +36 -36
- package/lib/utils/components/ProFormContext/index.js +1 -1
- package/lib/utils/conversionMomentValue/index.js +22 -23
- package/lib/utils/dateArrayFormatter/index.js +11 -15
- package/lib/utils/genCopyable/index.js +75 -33
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +3 -2
- package/lib/utils/hooks/useDebounceFn/index.js +18 -52
- package/lib/utils/hooks/useDebounceValue/index.js +7 -17
- package/lib/utils/hooks/useDeepCompareEffect/index.js +7 -19
- package/lib/utils/hooks/useDocumentTitle/index.js +2 -2
- package/lib/utils/hooks/useFetchData/index.js +36 -65
- package/lib/utils/hooks/useForceRender/index.js +2 -10
- package/lib/utils/hooks/useLatest/index.js +4 -3
- package/lib/utils/hooks/usePrevious/index.js +5 -4
- package/lib/utils/hooks/useReactiveRef/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +3 -3
- package/lib/utils/hooks/useRefFunction/index.js +6 -11
- package/lib/utils/index.d.ts +1 -2
- package/lib/utils/index.js +57 -65
- package/lib/utils/isBrowser/index.js +4 -3
- package/lib/utils/isDeepEqualReact/index.js +9 -45
- package/lib/utils/isDropdownValueType/index.js +4 -3
- package/lib/utils/isNil/index.js +2 -3
- package/lib/utils/isUrl/index.js +4 -3
- package/lib/utils/merge/index.js +12 -14
- package/lib/utils/nanoid/index.js +7 -7
- package/lib/utils/omitBoolean/index.js +3 -2
- package/lib/utils/omitUndefined/index.js +5 -4
- package/lib/utils/omitUndefinedAndEmptyArr/index.js +6 -6
- package/lib/utils/parseValueToMoment/index.js +5 -8
- package/lib/utils/pickProFormItemProps/index.js +3 -3
- package/lib/utils/pickProProps/index.js +6 -7
- package/lib/utils/proFieldParsingText/index.js +90 -100
- package/lib/utils/runFunction/index.js +2 -5
- package/lib/utils/stringify/index.js +2 -2
- package/lib/utils/transformKeySubmitValue/index.js +101 -117
- package/lib/utils/typing.d.ts +1 -1
- package/lib/utils/useEditableArray/index.d.ts +9 -7
- package/lib/utils/useEditableArray/index.js +791 -700
- package/lib/utils/useEditableMap/index.d.ts +1 -1
- package/lib/utils/useEditableMap/index.js +147 -137
- package/lib/utils/useMediaQuery/index.js +19 -19
- package/lib/utils/useMediaQuery/query.js +14 -19
- package/lib/version.js +1 -1
- package/package.json +34 -45
- package/es/utils/useMountMergeState/index.d.ts +0 -2
- package/es/utils/useMountMergeState/index.js +0 -2
- package/lib/utils/useMountMergeState/index.d.ts +0 -2
- package/lib/utils/useMountMergeState/index.js +0 -12
|
@@ -6,12 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
13
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
15
9
|
var _icons = require("@ant-design/icons");
|
|
16
10
|
var _util = require("@rc-component/util");
|
|
17
11
|
var _antd = require("antd");
|
|
@@ -19,55 +13,221 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
13
|
var _form = _interopRequireWildcard(require("../../../form"));
|
|
20
14
|
var _provider = require("../../../provider");
|
|
21
15
|
var _utils = require("../../../utils");
|
|
16
|
+
var _useEditableArray = require("../../../utils/useEditableArray");
|
|
22
17
|
var _Table = _interopRequireDefault(require("../../Table"));
|
|
23
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
|
|
25
|
-
_excluded2 = ["record", "position", "creatorButtonText", "newRecordType", "parentKey", "style"];
|
|
26
|
-
var EditableTableActionContext = /*#__PURE__*/_react.default.createContext(undefined);
|
|
19
|
+
const EditableTableActionContext = /*#__PURE__*/_react.default.createContext(undefined);
|
|
27
20
|
|
|
28
21
|
/** 可编辑表格的按钮 */
|
|
29
22
|
function RecordCreator(props) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
return _context.abrupt("return");
|
|
53
|
-
case 5:
|
|
54
|
-
actionRef === null || actionRef === void 0 || (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 || _actionRef$current.addEditRecord(record, {
|
|
55
|
-
position: position,
|
|
56
|
-
newRecordType: newRecordType,
|
|
57
|
-
parentKey: parentKey
|
|
58
|
-
});
|
|
59
|
-
case 6:
|
|
60
|
-
case "end":
|
|
61
|
-
return _context.stop();
|
|
62
|
-
}
|
|
63
|
-
}, _callee);
|
|
64
|
-
}));
|
|
65
|
-
function onClick(_x) {
|
|
66
|
-
return _onClick.apply(this, arguments);
|
|
23
|
+
const {
|
|
24
|
+
children,
|
|
25
|
+
record,
|
|
26
|
+
position,
|
|
27
|
+
newRecordType,
|
|
28
|
+
parentKey
|
|
29
|
+
} = props;
|
|
30
|
+
const actionRef = (0, _react.useContext)(EditableTableActionContext);
|
|
31
|
+
return /*#__PURE__*/_react.default.cloneElement(children, {
|
|
32
|
+
...children.props,
|
|
33
|
+
onClick: async e => {
|
|
34
|
+
// 如果返回了false,接触掉默认行为
|
|
35
|
+
const isOk = await children.props.onClick?.(e);
|
|
36
|
+
if (isOk === false) return;
|
|
37
|
+
if (actionRef?.current) {
|
|
38
|
+
actionRef.current.addEditRecord(record, {
|
|
39
|
+
position,
|
|
40
|
+
newRecordType,
|
|
41
|
+
parentKey: parentKey
|
|
42
|
+
});
|
|
67
43
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 处理嵌套行的新增
|
|
50
|
+
*/
|
|
51
|
+
function handleNestedRowInsert(baseData, defaultValue, newLineOptions, getRowKey, childrenColumnName) {
|
|
52
|
+
if (!newLineOptions.recordKey) {
|
|
53
|
+
return baseData;
|
|
54
|
+
}
|
|
55
|
+
const actionProps = {
|
|
56
|
+
data: baseData,
|
|
57
|
+
getRowKey,
|
|
58
|
+
row: {
|
|
59
|
+
...defaultValue,
|
|
60
|
+
map_row_parentKey: (0, _useEditableArray.recordKeyToString)(newLineOptions.parentKey)?.toString()
|
|
61
|
+
},
|
|
62
|
+
key: newLineOptions.recordKey,
|
|
63
|
+
childrenColumnName
|
|
64
|
+
};
|
|
65
|
+
return (0, _useEditableArray.editableRowByKey)(actionProps, newLineOptions.position === 'top' ? 'top' : 'update');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 处理分页场景下的新增
|
|
70
|
+
*/
|
|
71
|
+
function handlePaginationInsert(baseData, defaultValue, pageConfig) {
|
|
72
|
+
if (pageConfig.pageSize > baseData.length) {
|
|
73
|
+
return [...baseData, defaultValue];
|
|
74
|
+
}
|
|
75
|
+
const insertIndex = pageConfig.current * pageConfig.pageSize - 1;
|
|
76
|
+
const result = [...baseData];
|
|
77
|
+
result.splice(insertIndex, 0, defaultValue);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
function useEditableDataSource({
|
|
81
|
+
actionDataSource,
|
|
82
|
+
editableUtils,
|
|
83
|
+
pagination,
|
|
84
|
+
getRowKey,
|
|
85
|
+
childrenColumnName
|
|
86
|
+
}) {
|
|
87
|
+
return (0, _react.useMemo)(() => {
|
|
88
|
+
const newLineConfig = editableUtils?.newLineRecord;
|
|
89
|
+
const baseData = Array.isArray(actionDataSource) ? [...actionDataSource] : [];
|
|
90
|
+
if (!newLineConfig?.defaultValue) {
|
|
91
|
+
return baseData;
|
|
92
|
+
}
|
|
93
|
+
const {
|
|
94
|
+
options: newLineOptions,
|
|
95
|
+
defaultValue
|
|
96
|
+
} = newLineConfig;
|
|
97
|
+
if (newLineOptions?.parentKey) {
|
|
98
|
+
return handleNestedRowInsert(baseData, defaultValue, newLineOptions, getRowKey, childrenColumnName || 'children');
|
|
99
|
+
}
|
|
100
|
+
if (newLineOptions?.position === 'top') {
|
|
101
|
+
return [defaultValue, ...baseData];
|
|
102
|
+
}
|
|
103
|
+
const pageConfig = pagination && typeof pagination === 'object' ? pagination : undefined;
|
|
104
|
+
if (pageConfig?.current && pageConfig?.pageSize) {
|
|
105
|
+
return handlePaginationInsert(baseData, defaultValue, pageConfig);
|
|
106
|
+
}
|
|
107
|
+
return [...baseData, defaultValue];
|
|
108
|
+
}, [actionDataSource, childrenColumnName, editableUtils?.newLineRecord, getRowKey, pagination]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 检查是否应该显示创建按钮
|
|
113
|
+
*/
|
|
114
|
+
function shouldShowCreatorButton(maxLength, valueLength, recordCreatorProps) {
|
|
115
|
+
if (typeof maxLength === 'number' && maxLength <= valueLength) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return recordCreatorProps !== false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 创建按钮 DOM
|
|
123
|
+
*/
|
|
124
|
+
function createButtonDom(recordCreatorProps, value, intl) {
|
|
125
|
+
const {
|
|
126
|
+
record,
|
|
127
|
+
position,
|
|
128
|
+
creatorButtonText,
|
|
129
|
+
newRecordType,
|
|
130
|
+
parentKey,
|
|
131
|
+
style,
|
|
132
|
+
...restButtonProps
|
|
133
|
+
} = recordCreatorProps;
|
|
134
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RecordCreator, {
|
|
135
|
+
record: (0, _utils.runFunction)(record, value?.length, value) || {},
|
|
136
|
+
position: position,
|
|
137
|
+
parentKey: (0, _utils.runFunction)(parentKey, value?.length, value),
|
|
138
|
+
newRecordType: newRecordType,
|
|
139
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
140
|
+
type: "dashed",
|
|
141
|
+
style: {
|
|
142
|
+
display: 'block',
|
|
143
|
+
margin: '10px 0',
|
|
144
|
+
width: '100%',
|
|
145
|
+
...style
|
|
146
|
+
},
|
|
147
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlusOutlined, {}),
|
|
148
|
+
...restButtonProps,
|
|
149
|
+
children: creatorButtonText || intl.getMessage('editableTable.action.add', '添加一行数据')
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 创建顶部按钮的渲染属性
|
|
156
|
+
*/
|
|
157
|
+
function createTopButtonProps(creatorButtonDom, columnsLength) {
|
|
158
|
+
return {
|
|
159
|
+
components: {
|
|
160
|
+
header: {
|
|
161
|
+
wrapper: ({
|
|
162
|
+
className,
|
|
163
|
+
children
|
|
164
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("thead", {
|
|
165
|
+
className: className,
|
|
166
|
+
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
|
|
167
|
+
style: {
|
|
168
|
+
position: 'relative'
|
|
169
|
+
},
|
|
170
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
171
|
+
colSpan: 0,
|
|
172
|
+
style: {
|
|
173
|
+
visibility: 'hidden'
|
|
174
|
+
},
|
|
175
|
+
children: creatorButtonDom
|
|
176
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
177
|
+
style: {
|
|
178
|
+
position: 'absolute',
|
|
179
|
+
left: 0,
|
|
180
|
+
width: '100%'
|
|
181
|
+
},
|
|
182
|
+
colSpan: columnsLength,
|
|
183
|
+
children: creatorButtonDom
|
|
184
|
+
})]
|
|
185
|
+
})]
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 创建底部按钮的渲染属性
|
|
194
|
+
*/
|
|
195
|
+
function createBottomButtonProps(creatorButtonDom, tableViewRender) {
|
|
196
|
+
return {
|
|
197
|
+
tableViewRender: (_, dom) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
198
|
+
children: [tableViewRender?.(_, dom) ?? dom, creatorButtonDom]
|
|
199
|
+
})
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function useCreatorButton({
|
|
203
|
+
recordCreatorProps,
|
|
204
|
+
maxLength,
|
|
205
|
+
value,
|
|
206
|
+
intl,
|
|
207
|
+
isTop,
|
|
208
|
+
columnsLength,
|
|
209
|
+
tableViewRender
|
|
210
|
+
}) {
|
|
211
|
+
const creatorButtonDom = (0, _react.useMemo)(() => {
|
|
212
|
+
if (!shouldShowCreatorButton(maxLength, value?.length || 0, recordCreatorProps)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
if (!recordCreatorProps) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
return createButtonDom(recordCreatorProps, value, intl);
|
|
219
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
220
|
+
}, [maxLength, recordCreatorProps, value?.length, intl]);
|
|
221
|
+
const buttonRenderProps = (0, _react.useMemo)(() => {
|
|
222
|
+
if (!creatorButtonDom) {
|
|
223
|
+
return {};
|
|
224
|
+
}
|
|
225
|
+
return isTop ? createTopButtonProps(creatorButtonDom, columnsLength) : createBottomButtonProps(creatorButtonDom, tableViewRender);
|
|
226
|
+
}, [columnsLength, creatorButtonDom, isTop, tableViewRender]);
|
|
227
|
+
return {
|
|
228
|
+
creatorButtonDom,
|
|
229
|
+
buttonRenderProps
|
|
230
|
+
};
|
|
71
231
|
}
|
|
72
232
|
|
|
73
233
|
/**
|
|
@@ -76,294 +236,431 @@ function RecordCreator(props) {
|
|
|
76
236
|
* @param props
|
|
77
237
|
*/
|
|
78
238
|
function EditableTable(props) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
maxLength
|
|
83
|
-
formItemProps
|
|
84
|
-
recordCreatorProps
|
|
85
|
-
rowKey
|
|
86
|
-
controlled
|
|
87
|
-
defaultValue
|
|
88
|
-
onChange
|
|
89
|
-
editableFormRef
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
239
|
+
const intl = (0, _provider.useIntl)();
|
|
240
|
+
const {
|
|
241
|
+
onTableChange,
|
|
242
|
+
maxLength,
|
|
243
|
+
formItemProps,
|
|
244
|
+
recordCreatorProps,
|
|
245
|
+
rowKey,
|
|
246
|
+
controlled,
|
|
247
|
+
defaultValue,
|
|
248
|
+
onChange,
|
|
249
|
+
editableFormRef,
|
|
250
|
+
// @ts-ignore
|
|
251
|
+
autoFocus,
|
|
252
|
+
...rest
|
|
253
|
+
} = props;
|
|
254
|
+
const preData = (0, _react.useRef)(undefined);
|
|
255
|
+
const actionRef = (0, _react.useRef)();
|
|
256
|
+
const formRef = (0, _react.useRef)();
|
|
257
|
+
const form = _antd.Form.useFormInstance();
|
|
94
258
|
|
|
95
259
|
// 设置 ref
|
|
96
|
-
(0, _react.useImperativeHandle)(rest.actionRef,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
260
|
+
(0, _react.useImperativeHandle)(rest.actionRef, () => actionRef.current, [actionRef.current]);
|
|
261
|
+
|
|
262
|
+
// 在 name 模式下,如果没有传递 value prop,尝试从表单值中获取初始值
|
|
263
|
+
const getInitialValue = () => {
|
|
264
|
+
if (props.value) {
|
|
265
|
+
return props.value;
|
|
266
|
+
}
|
|
267
|
+
if (defaultValue) {
|
|
268
|
+
return defaultValue;
|
|
269
|
+
}
|
|
270
|
+
// 如果使用了 name 且没有 value,尝试从表单获取初始值
|
|
271
|
+
if (props.name && form) {
|
|
272
|
+
const namePath = [props.name].flat(1).filter(Boolean);
|
|
273
|
+
const formValue = form.getFieldValue(namePath);
|
|
274
|
+
if (Array.isArray(formValue)) {
|
|
275
|
+
return formValue;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return [];
|
|
279
|
+
};
|
|
280
|
+
const [value, setValueInner] = (0, _util.useControlledState)(getInitialValue, props.value);
|
|
281
|
+
const onChangeFn = props.controlled ? props.onChange : undefined;
|
|
282
|
+
const setValue = (0, _react.useCallback)(updater => {
|
|
283
|
+
setValueInner(prev => {
|
|
284
|
+
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
285
|
+
// 在非受控模式下,onChange 应该在 onDataSourceChange 中触发
|
|
286
|
+
onChangeFn?.(next);
|
|
287
|
+
return next;
|
|
288
|
+
});
|
|
289
|
+
}, [onChangeFn]);
|
|
290
|
+
const getRowKey = _react.default.useMemo(() => {
|
|
109
291
|
if (typeof rowKey === 'function') {
|
|
110
292
|
return rowKey;
|
|
111
293
|
}
|
|
112
|
-
return
|
|
113
|
-
return record[rowKey] || index;
|
|
114
|
-
};
|
|
294
|
+
return (record, index) => record[rowKey] || index;
|
|
115
295
|
}, [rowKey]);
|
|
116
296
|
|
|
117
297
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @param finlayRowKey
|
|
120
|
-
* @returns string | number
|
|
298
|
+
* 创建编辑 keys 的 Set,用于快速查找
|
|
121
299
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
300
|
+
const createEditingKeysSet = (0, _utils.useRefFunction)(editingKeys => {
|
|
301
|
+
return new Set((editingKeys || []).map(key => String(key)));
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 同步表单值,排除正在编辑的行
|
|
306
|
+
*/
|
|
307
|
+
const syncFormValuesExcludingEditing = (0, _utils.useRefFunction)((dataSource, editingKeysSet, namePath) => {
|
|
308
|
+
if (!formRef.current) return;
|
|
309
|
+
try {
|
|
310
|
+
if (namePath && namePath.length > 0) {
|
|
311
|
+
// name 模式:需要保留正在编辑的行
|
|
312
|
+
const currentFormValues = formRef.current.getFieldsValue() || {};
|
|
313
|
+
const currentList = (0, _util.get)(currentFormValues, namePath);
|
|
314
|
+
if (currentList && Array.isArray(currentList)) {
|
|
315
|
+
// 构建新的表单值,保留正在编辑的行
|
|
316
|
+
// 使用 Map 优化查找性能,将 O(n²) 降低到 O(n)
|
|
317
|
+
const currentListMap = new Map();
|
|
318
|
+
currentList.forEach((item, idx) => {
|
|
319
|
+
const key = getRowKey(item, idx);
|
|
320
|
+
currentListMap.set(String(key), item);
|
|
321
|
+
});
|
|
322
|
+
const newList = dataSource.map((item, index) => {
|
|
323
|
+
const key = getRowKey(item, index);
|
|
324
|
+
const keyStr = String(key);
|
|
325
|
+
|
|
326
|
+
// 如果该行正在编辑,保留表单中的值
|
|
327
|
+
if (editingKeysSet.has(keyStr)) {
|
|
328
|
+
return currentListMap.get(keyStr) || item;
|
|
329
|
+
}
|
|
330
|
+
return item;
|
|
331
|
+
});
|
|
332
|
+
const newValue = (0, _util.set)({}, namePath, newList);
|
|
333
|
+
formRef.current.setFieldsValue(newValue);
|
|
334
|
+
} else {
|
|
335
|
+
const newValue = (0, _util.set)({}, namePath, dataSource);
|
|
336
|
+
formRef.current.setFieldsValue(newValue);
|
|
337
|
+
}
|
|
338
|
+
} else {
|
|
339
|
+
// 非 name 模式:直接设置值
|
|
340
|
+
const formValues = {};
|
|
341
|
+
dataSource.forEach((current, index) => {
|
|
342
|
+
const key = getRowKey(current, index);
|
|
343
|
+
const keyStr = String(key);
|
|
344
|
+
if (!editingKeysSet.has(keyStr)) {
|
|
345
|
+
formValues[keyStr] = current;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
if (Object.keys(formValues).length > 0) {
|
|
349
|
+
formRef.current.setFieldsValue(formValues);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
} catch (error) {
|
|
353
|
+
console.warn('Failed to sync form values:', error);
|
|
130
354
|
}
|
|
355
|
+
});
|
|
131
356
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
357
|
+
/**
|
|
358
|
+
* 将数字索引转换为实际的 rowKey(非 name 模式)
|
|
359
|
+
*/
|
|
360
|
+
const convertIndexToRowKey = (0, _utils.useRefFunction)(index => {
|
|
361
|
+
const dataLength = value?.length ?? 0;
|
|
362
|
+
if (index >= dataLength) return index;
|
|
363
|
+
const rowData = value?.[index];
|
|
364
|
+
return getRowKey?.(rowData, index);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* 将 rowKey 转换为数字索引(name 模式)
|
|
369
|
+
*/
|
|
370
|
+
const convertRowKeyToIndex = (0, _utils.useRefFunction)(rowKey => {
|
|
371
|
+
const dataLength = value?.length ?? 0;
|
|
372
|
+
if (typeof rowKey === 'string' || rowKey >= dataLength) {
|
|
373
|
+
const rowIndex = value.findIndex((item, index) => {
|
|
374
|
+
return getRowKey?.(item, index)?.toString() === rowKey?.toString();
|
|
139
375
|
});
|
|
140
|
-
if (
|
|
376
|
+
if (rowIndex !== -1) return rowIndex;
|
|
377
|
+
}
|
|
378
|
+
return rowKey;
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* 根据不同的情况返回不同的 rowKey
|
|
383
|
+
*/
|
|
384
|
+
const coverRowKey = (0, _utils.useRefFunction)(finlayRowKey => {
|
|
385
|
+
if (typeof finlayRowKey === 'number' && !props.name) {
|
|
386
|
+
return convertIndexToRowKey(finlayRowKey);
|
|
387
|
+
}
|
|
388
|
+
if (props.name) {
|
|
389
|
+
return convertRowKeyToIndex(finlayRowKey);
|
|
141
390
|
}
|
|
142
391
|
return finlayRowKey;
|
|
143
392
|
});
|
|
144
393
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
*/
|
|
152
|
-
var getRowData = function getRowData(rowIndex) {
|
|
153
|
-
var _finlayRowKey$toStrin, _formRef$current;
|
|
154
|
-
if (rowIndex == undefined) {
|
|
155
|
-
throw new Error('rowIndex is required');
|
|
156
|
-
}
|
|
157
|
-
var finlayRowKey = coverRowKey(rowIndex);
|
|
158
|
-
var rowKeyName = [props.name, (_finlayRowKey$toStrin = finlayRowKey === null || finlayRowKey === void 0 ? void 0 : finlayRowKey.toString()) !== null && _finlayRowKey$toStrin !== void 0 ? _finlayRowKey$toStrin : ''].flat(1).filter(Boolean);
|
|
159
|
-
return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldValue(rowKeyName);
|
|
160
|
-
};
|
|
394
|
+
/**
|
|
395
|
+
* 构建表单字段路径
|
|
396
|
+
*/
|
|
397
|
+
const buildFormFieldPath = (0, _utils.useRefFunction)(rowKey => {
|
|
398
|
+
return [props.name, rowKey?.toString() ?? ''].flat(1).filter(Boolean);
|
|
399
|
+
});
|
|
161
400
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
var rowKeyName = [props.name].flat(1).filter(Boolean);
|
|
169
|
-
if (Array.isArray(rowKeyName) && rowKeyName.length === 0) {
|
|
170
|
-
var _formRef$current2;
|
|
171
|
-
var rowData = (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
|
|
172
|
-
if (Array.isArray(rowData)) return rowData;
|
|
173
|
-
return Object.keys(rowData).map(function (key) {
|
|
174
|
-
return rowData[key];
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
return (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.getFieldValue(rowKeyName);
|
|
178
|
-
};
|
|
179
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, formRef.current), {}, {
|
|
180
|
-
getRowData: getRowData,
|
|
181
|
-
getRowsData: getRowsData,
|
|
182
|
-
/**
|
|
183
|
-
* 设置一行的数据,会将数据进行简单的 merge
|
|
184
|
-
* @param rowIndex
|
|
185
|
-
* @param data
|
|
186
|
-
* @returns void
|
|
187
|
-
*/
|
|
188
|
-
setRowData: function setRowData(rowIndex, data) {
|
|
189
|
-
var _finlayRowKey$toStrin2, _formRef$current4;
|
|
190
|
-
if (rowIndex == undefined) {
|
|
191
|
-
throw new Error('rowIndex is required');
|
|
192
|
-
}
|
|
193
|
-
var finlayRowKey = coverRowKey(rowIndex);
|
|
194
|
-
var rowKeyName = [props.name, (_finlayRowKey$toStrin2 = finlayRowKey === null || finlayRowKey === void 0 ? void 0 : finlayRowKey.toString()) !== null && _finlayRowKey$toStrin2 !== void 0 ? _finlayRowKey$toStrin2 : ''].flat(1).filter(Boolean);
|
|
195
|
-
var newRowData = Object.assign({}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRowData(rowIndex)), data || {}));
|
|
196
|
-
var updateValues = (0, _util.set)({}, rowKeyName, newRowData);
|
|
197
|
-
(_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 || _formRef$current4.setFieldsValue(updateValues);
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}, [coverRowKey, props.name, formRef.current]);
|
|
202
|
-
(0, _react.useEffect)(function () {
|
|
203
|
-
if (!props.controlled) return;
|
|
204
|
-
(value || []).forEach(function (current, index) {
|
|
205
|
-
var _formRef$current5;
|
|
206
|
-
(_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 || _formRef$current5.setFieldsValue((0, _defineProperty2.default)({}, "".concat(getRowKey(current, index)), current));
|
|
207
|
-
}, {});
|
|
208
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
209
|
-
}, [(0, _utils.stringify)(value), props.controlled]);
|
|
210
|
-
(0, _react.useEffect)(function () {
|
|
211
|
-
if (props.name) {
|
|
212
|
-
var _props$editable;
|
|
213
|
-
formRef.current = props === null || props === void 0 || (_props$editable = props.editable) === null || _props$editable === void 0 ? void 0 : _props$editable.form;
|
|
401
|
+
/**
|
|
402
|
+
* 获取一行数据
|
|
403
|
+
*/
|
|
404
|
+
const getRowData = (0, _utils.useRefFunction)(rowIndex => {
|
|
405
|
+
if (rowIndex == null) {
|
|
406
|
+
throw new Error('rowIndex is required');
|
|
214
407
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return
|
|
408
|
+
const finlayRowKey = coverRowKey(rowIndex);
|
|
409
|
+
const rowKeyName = buildFormFieldPath(finlayRowKey);
|
|
410
|
+
return formRef.current?.getFieldValue(rowKeyName);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* 获取整个表格的数据
|
|
415
|
+
*/
|
|
416
|
+
const getRowsData = (0, _utils.useRefFunction)(() => {
|
|
417
|
+
const rowKeyName = [props.name].flat(1).filter(Boolean);
|
|
418
|
+
if (Array.isArray(rowKeyName) && rowKeyName.length === 0) {
|
|
419
|
+
const rowData = formRef.current?.getFieldsValue();
|
|
420
|
+
if (Array.isArray(rowData)) return rowData;
|
|
421
|
+
return Object.keys(rowData).map(key => rowData[key]);
|
|
228
422
|
}
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
margin: '10px 0',
|
|
239
|
-
width: '100%'
|
|
240
|
-
}, style),
|
|
241
|
-
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlusOutlined, {})
|
|
242
|
-
}, restButtonProps), {}, {
|
|
243
|
-
children: creatorButtonText || intl.getMessage('editableTable.action.add', '添加一行数据')
|
|
244
|
-
}))
|
|
245
|
-
});
|
|
246
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
247
|
-
}, [recordCreatorProps, maxLength, value === null || value === void 0 ? void 0 : value.length]);
|
|
248
|
-
var buttonRenderProps = (0, _react.useMemo)(function () {
|
|
249
|
-
if (!creatorButtonDom) {
|
|
250
|
-
return {};
|
|
423
|
+
return formRef.current?.getFieldValue(rowKeyName);
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* 设置一行数据
|
|
428
|
+
*/
|
|
429
|
+
const setRowData = (0, _utils.useRefFunction)((rowIndex, data) => {
|
|
430
|
+
if (rowIndex == null) {
|
|
431
|
+
throw new Error('rowIndex is required');
|
|
251
432
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
433
|
+
const finlayRowKey = coverRowKey(rowIndex);
|
|
434
|
+
const rowKeyName = buildFormFieldPath(finlayRowKey);
|
|
435
|
+
const currentRowData = getRowData(rowIndex);
|
|
436
|
+
const newRowData = {
|
|
437
|
+
...currentRowData,
|
|
438
|
+
...(data || {})
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// 在 name 模式下,需要更新整个数组
|
|
442
|
+
if (props.name) {
|
|
443
|
+
const tableName = [props.name].flat(1).filter(Boolean);
|
|
444
|
+
// 优先从 value prop 获取数据(受控模式),否则从表单值获取
|
|
445
|
+
let currentTableData = props.value || formRef.current?.getFieldValue(tableName);
|
|
446
|
+
if (Array.isArray(currentTableData)) {
|
|
447
|
+
// 找到要更新的行的索引
|
|
448
|
+
const rowIndexToUpdate = typeof finlayRowKey === 'number' ? finlayRowKey : currentTableData.findIndex((row, index) => {
|
|
449
|
+
const rowKey = getRowKey?.(row, index);
|
|
450
|
+
return rowKey === finlayRowKey || rowKey?.toString() === finlayRowKey?.toString();
|
|
451
|
+
});
|
|
452
|
+
if (rowIndexToUpdate >= 0 && rowIndexToUpdate < currentTableData.length) {
|
|
453
|
+
// 更新数组中的对应行
|
|
454
|
+
const updatedTableData = [...currentTableData];
|
|
455
|
+
updatedTableData[rowIndexToUpdate] = newRowData;
|
|
456
|
+
|
|
457
|
+
// 设置整个数组,使用 set 来构建正确的路径
|
|
458
|
+
// 使用与 syncFormValuesExcludingEditing 相同的路径格式(数组路径)
|
|
459
|
+
// 这样可以确保 getFieldValue 能正确获取值
|
|
460
|
+
const updateValues = (0, _util.set)({}, tableName, updatedTableData);
|
|
461
|
+
formRef.current?.setFieldsValue(updateValues);
|
|
462
|
+
|
|
463
|
+
// 在受控模式下,触发 onChange
|
|
464
|
+
if (props.controlled && props.onChange) {
|
|
465
|
+
props.onChange(updatedTableData);
|
|
284
466
|
}
|
|
285
467
|
}
|
|
286
|
-
}
|
|
468
|
+
} else {
|
|
469
|
+
// 如果当前没有数据,直接设置单个字段
|
|
470
|
+
const updateValues = (0, _util.set)({}, rowKeyName, newRowData);
|
|
471
|
+
formRef.current?.setFieldsValue(updateValues);
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
// 非 name 模式下,直接设置单个字段
|
|
475
|
+
const updateValues = (0, _util.set)({}, rowKeyName, newRowData);
|
|
476
|
+
formRef.current?.setFieldsValue(updateValues);
|
|
287
477
|
}
|
|
478
|
+
return true;
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
// 设置 editableFormRef
|
|
482
|
+
(0, _react.useImperativeHandle)(editableFormRef, () => {
|
|
288
483
|
return {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
484
|
+
...formRef.current,
|
|
485
|
+
getRowData,
|
|
486
|
+
getRowsData,
|
|
487
|
+
setRowData
|
|
488
|
+
};
|
|
489
|
+
}, [coverRowKey, props.name, getRowData, getRowsData, setRowData]);
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* 受控模式下同步表单值
|
|
493
|
+
* 在受控模式下,即使正在编辑的行也要同步更新,因为数据由外部完全控制
|
|
494
|
+
* 使用深度比较优化性能,避免频繁的序列化操作
|
|
495
|
+
* 注意:只有当 value 明确传递时才同步,避免覆盖表单中的初始值
|
|
496
|
+
*/
|
|
497
|
+
(0, _utils.useDeepCompareEffect)(() => {
|
|
498
|
+
if (!props.controlled || !formRef.current) return;
|
|
499
|
+
|
|
500
|
+
// 在受控模式下,只有当 value 明确传递时才同步
|
|
501
|
+
// 避免在 value 为 undefined 时覆盖表单中的初始值
|
|
502
|
+
if (value === undefined) return;
|
|
503
|
+
|
|
504
|
+
// 在受控模式下,同步所有值(包括正在编辑的行)
|
|
505
|
+
// 因为数据由外部完全控制,应该同步更新
|
|
506
|
+
try {
|
|
507
|
+
if (props.name) {
|
|
508
|
+
// name 模式:直接设置整个数组
|
|
509
|
+
const namePath = [props.name].flat(1);
|
|
510
|
+
const newValue = (0, _util.set)({}, namePath, value);
|
|
511
|
+
formRef.current.setFieldsValue(newValue);
|
|
512
|
+
} else {
|
|
513
|
+
// 非 name 模式:直接设置值
|
|
514
|
+
const formValues = {};
|
|
515
|
+
value.forEach((item, index) => {
|
|
516
|
+
const key = getRowKey(item, index);
|
|
517
|
+
const keyStr = String(key);
|
|
518
|
+
formValues[keyStr] = item;
|
|
293
519
|
});
|
|
520
|
+
if (Object.keys(formValues).length > 0) {
|
|
521
|
+
formRef.current.setFieldsValue(formValues);
|
|
522
|
+
}
|
|
294
523
|
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
524
|
+
} catch (error) {
|
|
525
|
+
console.warn('Failed to sync form values in controlled mode:', error);
|
|
526
|
+
}
|
|
527
|
+
}, [value, props.controlled, props.name, getRowKey]);
|
|
299
528
|
|
|
300
529
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* >>>>>>为了性能好辛苦
|
|
530
|
+
* 同步表单实例引用
|
|
531
|
+
* 只在 name 模式下且 form 存在时更新
|
|
304
532
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
(_props$onValuesChange = props.onValuesChange) === null || _props$onValuesChange === void 0 || _props$onValuesChange.call(props, dataSource, r);
|
|
309
|
-
if (props.controlled) {
|
|
310
|
-
var _props$onChange;
|
|
311
|
-
props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, dataSource);
|
|
533
|
+
(0, _react.useEffect)(() => {
|
|
534
|
+
if (props.name && props?.editable?.form) {
|
|
535
|
+
formRef.current = props.editable.form;
|
|
312
536
|
}
|
|
537
|
+
}, [props.editable?.form, props.name]);
|
|
538
|
+
const {
|
|
539
|
+
position
|
|
540
|
+
} = recordCreatorProps || {};
|
|
541
|
+
const isTop = position === 'top';
|
|
542
|
+
const {
|
|
543
|
+
creatorButtonDom,
|
|
544
|
+
buttonRenderProps
|
|
545
|
+
} = useCreatorButton({
|
|
546
|
+
recordCreatorProps,
|
|
547
|
+
maxLength,
|
|
548
|
+
value,
|
|
549
|
+
intl,
|
|
550
|
+
isTop,
|
|
551
|
+
columnsLength: rest.columns?.length,
|
|
552
|
+
tableViewRender: props.tableViewRender
|
|
313
553
|
});
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* 处理值变化回调
|
|
557
|
+
* 注意:受控模式下不调用 onChange,避免循环更新
|
|
558
|
+
* onChange 应该由外部控制,而不是在内部触发
|
|
559
|
+
*/
|
|
560
|
+
const handleValuesChange = (0, _utils.useRefFunction)((r, dataSource) => {
|
|
561
|
+
props.editable?.onValuesChange?.(r, dataSource);
|
|
562
|
+
props.onValuesChange?.(dataSource, r);
|
|
563
|
+
|
|
564
|
+
// 在受控模式下,当表单值变化时也应该触发 onChange
|
|
565
|
+
// 这样外部可以同步更新 value,实现真正的受控
|
|
566
|
+
if (props.controlled && props?.onChange) {
|
|
567
|
+
props.onChange(dataSource);
|
|
568
|
+
}
|
|
569
|
+
// 非受控模式下,onChange 应该在 onDataSourceChange 中触发
|
|
570
|
+
// 这样可以确保数据已经正确更新
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* 构建可编辑属性
|
|
575
|
+
* 使用 useMemo 优化性能,避免不必要的重新创建
|
|
576
|
+
*/
|
|
577
|
+
const editableProps = (0, _react.useMemo)(() => {
|
|
578
|
+
const baseProps = {
|
|
579
|
+
...props.editable
|
|
580
|
+
};
|
|
581
|
+
const hasOnValuesChange = Boolean(props?.onValuesChange) || Boolean(props.editable?.onValuesChange) || Boolean(props.controlled && props?.onChange);
|
|
582
|
+
if (hasOnValuesChange) {
|
|
583
|
+
baseProps.onValuesChange = handleValuesChange;
|
|
584
|
+
}
|
|
585
|
+
return baseProps;
|
|
586
|
+
}, [props.editable, props.onValuesChange, props.controlled, props.onChange, handleValuesChange]);
|
|
319
587
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
320
588
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(EditableTableActionContext.Provider, {
|
|
321
589
|
value: actionRef,
|
|
322
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Table.default,
|
|
590
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Table.default, {
|
|
323
591
|
search: false,
|
|
324
592
|
options: false,
|
|
325
593
|
pagination: false,
|
|
326
594
|
rowKey: rowKey,
|
|
327
|
-
revalidateOnFocus: false
|
|
328
|
-
|
|
595
|
+
revalidateOnFocus: false,
|
|
596
|
+
...rest,
|
|
597
|
+
...buttonRenderProps,
|
|
329
598
|
tableLayout: "fixed",
|
|
330
599
|
actionRef: actionRef,
|
|
331
600
|
onChange: onTableChange,
|
|
332
|
-
editable:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
601
|
+
editable: {
|
|
602
|
+
...editableProps,
|
|
603
|
+
formProps: {
|
|
604
|
+
formRef,
|
|
605
|
+
...editableProps.formProps
|
|
606
|
+
}
|
|
607
|
+
},
|
|
337
608
|
dataSource: value,
|
|
338
|
-
onDataSourceChange:
|
|
609
|
+
onDataSourceChange: dataSource => {
|
|
610
|
+
// setValue 会触发 onChange,但我们需要确保数据已经正确更新
|
|
611
|
+
// 所以先设置数据,然后手动触发 onChange
|
|
339
612
|
setValue(dataSource);
|
|
613
|
+
|
|
340
614
|
/**
|
|
341
|
-
* 如果是
|
|
615
|
+
* 如果是 name 模式,需要同步表单值
|
|
616
|
+
* 避免表单值和数据源不一致
|
|
617
|
+
* 注意:不会覆盖正在编辑的行
|
|
342
618
|
*/
|
|
343
|
-
if (props.name &&
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
619
|
+
if (props.name && formRef.current) {
|
|
620
|
+
const editingKeys = props.editable?.editableKeys;
|
|
621
|
+
const editingKeysSet = createEditingKeysSet(editingKeys);
|
|
622
|
+
const namePath = [props.name].flat(1).filter(Boolean);
|
|
623
|
+
syncFormValuesExcludingEditing(dataSource, editingKeysSet, namePath);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// 在非受控模式下,通过 onDataSourceChange 触发 onChange
|
|
627
|
+
// 这样可以确保数据已经正确更新
|
|
628
|
+
if (!props.controlled && props.onChange) {
|
|
629
|
+
props.onChange(dataSource);
|
|
347
630
|
}
|
|
348
631
|
}
|
|
349
|
-
})
|
|
632
|
+
})
|
|
350
633
|
}), props.name ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.ProFormDependency, {
|
|
351
634
|
name: [props.name],
|
|
352
|
-
children:
|
|
353
|
-
|
|
635
|
+
children: changeValue => {
|
|
636
|
+
// 初始化 preData
|
|
354
637
|
if (!preData.current) {
|
|
355
638
|
preData.current = value;
|
|
356
639
|
return null;
|
|
357
640
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
641
|
+
const namePath = [props.name].flat(1);
|
|
642
|
+
const list = (0, _util.get)(changeValue, namePath);
|
|
643
|
+
|
|
644
|
+
// 添加空值检查,避免后续操作出错
|
|
645
|
+
if (!list || !Array.isArray(list)) {
|
|
646
|
+
preData.current = value;
|
|
647
|
+
return null;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// 在更新 preData 之前找到变化的项
|
|
651
|
+
// 使用 findIndex 可以同时获取变化的项和索引
|
|
652
|
+
const changeIndex = list.findIndex((item, index) => {
|
|
653
|
+
return !(0, _utils.isDeepEqualReact)(item, preData.current?.[index]);
|
|
362
654
|
});
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
655
|
+
|
|
656
|
+
// 只有在找到变化项时才触发回调
|
|
657
|
+
if (changeIndex !== -1) {
|
|
658
|
+
const changeItem = list[changeIndex];
|
|
659
|
+
props?.editable?.onValuesChange?.(changeItem, list);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// 在找到 changeItem 之后再更新 preData,确保后续比较正确
|
|
663
|
+
preData.current = list;
|
|
367
664
|
return null;
|
|
368
665
|
}
|
|
369
666
|
}) : null]
|
|
@@ -376,38 +673,40 @@ function EditableTable(props) {
|
|
|
376
673
|
* @param props
|
|
377
674
|
*/
|
|
378
675
|
function FieldEditableTable(props) {
|
|
379
|
-
|
|
380
|
-
if (!props.name) return /*#__PURE__*/(0, _jsxRuntime.jsx)(EditableTable,
|
|
676
|
+
const form = _form.default.useFormInstance();
|
|
677
|
+
if (!props.name) return /*#__PURE__*/(0, _jsxRuntime.jsx)(EditableTable, {
|
|
381
678
|
tableLayout: "fixed",
|
|
382
679
|
scroll: {
|
|
383
680
|
x: 'max-content'
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
681
|
+
},
|
|
682
|
+
...props
|
|
683
|
+
});
|
|
684
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
387
685
|
style: {
|
|
388
686
|
maxWidth: '100%'
|
|
389
687
|
},
|
|
390
|
-
shouldUpdate:
|
|
391
|
-
|
|
688
|
+
shouldUpdate: (prev, next) => {
|
|
689
|
+
const name = [props.name].flat(1);
|
|
392
690
|
try {
|
|
393
691
|
return JSON.stringify((0, _util.get)(prev, name)) !== JSON.stringify((0, _util.get)(next, name));
|
|
394
692
|
} catch (error) {
|
|
395
693
|
return true;
|
|
396
694
|
}
|
|
397
|
-
}
|
|
398
|
-
|
|
695
|
+
},
|
|
696
|
+
...props?.formItemProps,
|
|
399
697
|
name: props.name,
|
|
400
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(EditableTable,
|
|
698
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(EditableTable, {
|
|
401
699
|
tableLayout: "fixed",
|
|
402
700
|
scroll: {
|
|
403
701
|
x: 'max-content'
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
editable:
|
|
702
|
+
},
|
|
703
|
+
...props,
|
|
704
|
+
editable: {
|
|
705
|
+
...props.editable,
|
|
407
706
|
form: form
|
|
408
|
-
}
|
|
409
|
-
})
|
|
410
|
-
})
|
|
707
|
+
}
|
|
708
|
+
})
|
|
709
|
+
});
|
|
411
710
|
}
|
|
412
711
|
FieldEditableTable.RecordCreator = RecordCreator;
|
|
413
712
|
var _default = exports.default = FieldEditableTable;
|