@ant-design/pro-components 3.0.0-beta.1 → 3.0.0-beta.3
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/dist/pro-components.min.js +1 -1
- package/es/card/ProCard.d.ts +0 -1
- package/es/card/ProCard.js +11 -23
- package/es/card/components/Actions/index.js +33 -28
- package/es/card/components/Actions/style.js +72 -100
- package/es/card/components/Card/index.js +212 -258
- package/es/card/components/Card/style.js +192 -266
- package/es/card/components/CheckCard/Group.js +198 -208
- package/es/card/components/CheckCard/index.js +151 -160
- package/es/card/components/CheckCard/style.js +186 -212
- package/es/card/components/Divider/index.js +23 -18
- package/es/card/components/Divider/style.js +30 -54
- package/es/card/components/Loading/index.js +80 -13
- package/es/card/components/Loading/style.js +42 -63
- package/es/card/components/Operation/index.js +22 -17
- package/es/card/components/Operation/style.js +19 -43
- package/es/card/components/Statistic/index.js +79 -96
- package/es/card/components/Statistic/style.js +76 -115
- package/es/card/components/StatisticCard/index.d.ts +0 -2
- package/es/card/components/StatisticCard/index.js +59 -70
- package/es/card/components/StatisticCard/style.js +36 -55
- package/es/card/index.d.ts +2 -2
- package/es/card/index.js +2 -9
- package/es/card/typing.js +1 -0
- package/es/descriptions/index.js +363 -414
- package/es/descriptions/useFetchData.js +94 -73
- package/es/field/AllProField.js +438 -361
- package/es/field/FieldHOC/index.js +32 -28
- package/es/field/PureProField.js +129 -160
- package/es/field/ValueTypeToComponent.js +686 -396
- package/es/field/components/Cascader/index.d.ts +2 -2
- package/es/field/components/Cascader/index.js +124 -149
- package/es/field/components/Checkbox/index.d.ts +1 -1
- package/es/field/components/Checkbox/index.js +106 -128
- package/es/field/components/Code/index.js +67 -60
- package/es/field/components/ColorPicker/index.d.ts +1 -1
- package/es/field/components/ColorPicker/index.js +55 -78
- package/es/field/components/DatePicker/index.d.ts +2 -2
- package/es/field/components/DatePicker/index.js +100 -116
- package/es/field/components/Digit/index.js +84 -83
- package/es/field/components/DigitRange/index.js +102 -96
- package/es/field/components/FromNow/index.js +50 -62
- package/es/field/components/Image/index.js +46 -50
- package/es/field/components/IndexColumn/index.js +45 -43
- package/es/field/components/Money/index.js +244 -253
- package/es/field/components/Options/index.js +61 -71
- package/es/field/components/Password/index.js +62 -59
- package/es/field/components/Percent/index.js +74 -80
- package/es/field/components/Percent/util.js +23 -18
- package/es/field/components/Progress/index.js +53 -54
- package/es/field/components/Radio/index.d.ts +1 -1
- package/es/field/components/Radio/index.js +85 -107
- package/es/field/components/RangePicker/index.d.ts +2 -2
- package/es/field/components/RangePicker/index.js +122 -137
- package/es/field/components/Rate/index.js +39 -35
- package/es/field/components/Second/index.js +61 -59
- package/es/field/components/Segmented/index.d.ts +1 -1
- package/es/field/components/Segmented/index.js +68 -90
- package/es/field/components/Select/LightSelect/index.d.ts +1 -1
- package/es/field/components/Select/LightSelect/index.js +210 -256
- package/es/field/components/Select/SearchSelect/index.js +192 -225
- package/es/field/components/Select/index.d.ts +2 -2
- package/es/field/components/Select/index.js +299 -368
- package/es/field/components/Slider/index.js +39 -45
- package/es/field/components/Status/index.js +83 -23
- package/es/field/components/Switch/index.d.ts +1 -1
- package/es/field/components/Switch/index.js +60 -71
- package/es/field/components/Text/index.js +53 -48
- package/es/field/components/TextArea/index.js +39 -53
- package/es/field/components/TextArea/readonly.js +36 -50
- package/es/field/components/TimePicker/index.js +182 -190
- package/es/field/components/TreeSelect/index.d.ts +2 -2
- package/es/field/components/TreeSelect/index.js +178 -184
- package/es/field/index.js +3 -43
- package/es/form/BaseForm/BaseForm.js +581 -621
- package/es/form/BaseForm/EditOrReadOnlyContext.js +4 -8
- package/es/form/BaseForm/LightWrapper/index.js +104 -161
- package/es/form/BaseForm/LightWrapper/style.js +14 -41
- package/es/form/BaseForm/Submitter/index.js +69 -100
- package/es/form/BaseForm/index.js +1 -2
- package/es/form/FieldContext.js +4 -8
- package/es/form/components/Captcha/index.js +162 -169
- package/es/form/components/Cascader/index.js +46 -75
- package/es/form/components/Checkbox/index.js +73 -98
- package/es/form/components/ColorPicker/index.js +43 -64
- package/es/form/components/DatePicker/BaseDatePicker.js +45 -69
- package/es/form/components/DatePicker/DatePicker.js +26 -51
- package/es/form/components/DatePicker/DateTimePicker.js +26 -50
- package/es/form/components/DatePicker/MonthPicker.js +26 -51
- package/es/form/components/DatePicker/QuarterPicker.js +26 -51
- package/es/form/components/DatePicker/TimePicker.js +43 -72
- package/es/form/components/DatePicker/WeekPicker.js +26 -51
- package/es/form/components/DatePicker/YearPicker.js +26 -51
- package/es/form/components/DatePicker/index.js +4 -6
- package/es/form/components/DateRangePicker/BaseDateRanger.js +42 -70
- package/es/form/components/DateRangePicker/DateMonthRangePicker.js +29 -51
- package/es/form/components/DateRangePicker/DateQuarterRangePicker.js +29 -51
- package/es/form/components/DateRangePicker/DateTimeRangePicker.js +29 -51
- package/es/form/components/DateRangePicker/DateWeekRangePicker.js +29 -51
- package/es/form/components/DateRangePicker/DateYearRangePicker.js +29 -51
- package/es/form/components/DateRangePicker/TimeRangePicker.js +42 -67
- package/es/form/components/DateRangePicker/index.js +29 -51
- package/es/form/components/Dependency/index.js +56 -96
- package/es/form/components/Digit/DigitRange.d.ts +1 -1
- package/es/form/components/Digit/DigitRange.js +42 -75
- package/es/form/components/Digit/index.js +47 -78
- package/es/form/components/Field/index.js +80 -124
- package/es/form/components/FieldSet/index.js +95 -123
- package/es/form/components/FormItem/FormItemRender/index.js +135 -92
- package/es/form/components/FormItem/Group/index.js +134 -169
- package/es/form/components/FormItem/Group/style.js +41 -62
- package/es/form/components/FormItem/index.js +252 -293
- package/es/form/components/FormItem/warpField.js +218 -285
- package/es/form/components/List/ListContainer.js +221 -181
- package/es/form/components/List/ListItem.js +258 -350
- package/es/form/components/List/index.js +195 -252
- package/es/form/components/List/style.js +48 -95
- package/es/form/components/Money/index.js +50 -80
- package/es/form/components/Radio/index.js +52 -86
- package/es/form/components/Rate/index.js +37 -60
- package/es/form/components/SchemaForm/index.js +121 -167
- package/es/form/components/SchemaForm/layoutType/Embed.js +8 -5
- package/es/form/components/SchemaForm/layoutType/StepsForm.js +35 -68
- package/es/form/components/SchemaForm/layoutType/index.js +2 -7
- package/es/form/components/SchemaForm/typing.js +1 -0
- package/es/form/components/SchemaForm/valueType/dependency.js +19 -43
- package/es/form/components/SchemaForm/valueType/divider.js +11 -30
- package/es/form/components/SchemaForm/valueType/field.js +59 -100
- package/es/form/components/SchemaForm/valueType/formList.js +16 -42
- package/es/form/components/SchemaForm/valueType/formSet.js +16 -42
- package/es/form/components/SchemaForm/valueType/group.js +15 -37
- package/es/form/components/SchemaForm/valueType/ignore.js +4 -7
- package/es/form/components/SchemaForm/valueType/index.js +16 -17
- package/es/form/components/Segmented/index.js +43 -61
- package/es/form/components/Select/index.js +114 -151
- package/es/form/components/Slider/index.js +54 -91
- package/es/form/components/Switch/index.js +47 -71
- package/es/form/components/Text/index.js +132 -161
- package/es/form/components/TextArea/index.js +34 -57
- package/es/form/components/TreeSelect/index.js +42 -61
- package/es/form/components/UploadButton/index.js +125 -145
- package/es/form/components/UploadDragger/index.js +77 -92
- package/es/form/components/index.js +36 -88
- package/es/form/helpers/grid.js +77 -82
- package/es/form/helpers/index.js +1 -2
- package/es/form/index.js +6 -15
- package/es/form/layouts/DrawerForm/index.js +308 -315
- package/es/form/layouts/DrawerForm/style.js +26 -50
- package/es/form/layouts/LightFilter/index.js +208 -270
- package/es/form/layouts/LightFilter/style.js +49 -74
- package/es/form/layouts/LoginForm/index.js +85 -104
- package/es/form/layouts/LoginForm/style.js +68 -95
- package/es/form/layouts/LoginFormPage/index.js +141 -147
- package/es/form/layouts/LoginFormPage/style.js +129 -154
- package/es/form/layouts/ModalForm/index.js +247 -253
- package/es/form/layouts/ProForm/index.js +15 -32
- package/es/form/layouts/QueryFilter/Actions.js +52 -47
- package/es/form/layouts/QueryFilter/index.js +297 -359
- package/es/form/layouts/QueryFilter/style.js +38 -69
- package/es/form/layouts/StepsForm/StepForm.js +87 -119
- package/es/form/layouts/StepsForm/index.js +339 -353
- package/es/form/layouts/StepsForm/style.js +29 -50
- package/es/form/layouts/index.js +9 -20
- package/es/form/typing.js +1 -0
- package/es/index.js +1 -5
- package/es/layout/ProLayout.js +426 -497
- package/es/layout/WrapContent.js +26 -15
- package/es/layout/assert/Logo.js +107 -79
- package/es/layout/components/AppsLogoComponents/AppsLogo.js +13 -11
- package/es/layout/components/AppsLogoComponents/DefaultContent.js +50 -56
- package/es/layout/components/AppsLogoComponents/SimpleContent.js +73 -66
- package/es/layout/components/AppsLogoComponents/index.js +90 -73
- package/es/layout/components/AppsLogoComponents/style/default.js +31 -35
- package/es/layout/components/AppsLogoComponents/style/index.js +51 -77
- package/es/layout/components/AppsLogoComponents/style/simple.js +37 -40
- package/es/layout/components/CollapsedIcon/index.js +19 -55
- package/es/layout/components/CollapsedIcon/style.js +42 -66
- package/es/layout/components/Footer.js +27 -38
- package/es/layout/components/FooterToolbar/index.js +78 -102
- package/es/layout/components/FooterToolbar/style/index.js +38 -62
- package/es/layout/components/FooterToolbar/style/stylish.js +10 -38
- package/es/layout/components/GlobalFooter/index.js +37 -31
- package/es/layout/components/GlobalFooter/style.js +32 -53
- package/es/layout/components/GlobalHeader/ActionsContent.js +132 -181
- package/es/layout/components/GlobalHeader/index.d.ts +0 -5
- package/es/layout/components/GlobalHeader/index.js +76 -84
- package/es/layout/components/GlobalHeader/rightContentStyle.js +52 -76
- package/es/layout/components/GlobalHeader/style.js +57 -83
- package/es/layout/components/GridContent/index.js +35 -33
- package/es/layout/components/GridContent/style.js +14 -38
- package/es/layout/components/Header/index.js +95 -124
- package/es/layout/components/Header/style/header.js +48 -72
- package/es/layout/components/Header/style/stylish.js +12 -42
- package/es/layout/components/Help/AsyncContentPanel.js +53 -42
- package/es/layout/components/Help/HelpProvide.js +55 -6
- package/es/layout/components/Help/ProHelpContentPanel.js +128 -127
- package/es/layout/components/Help/ProHelpDrawer.js +48 -76
- package/es/layout/components/Help/ProHelpModal.js +47 -76
- package/es/layout/components/Help/ProHelpPanel.js +183 -224
- package/es/layout/components/Help/ProHelpPopover.js +37 -64
- package/es/layout/components/Help/RenderContentPanel.js +90 -103
- package/es/layout/components/Help/Search.js +124 -163
- package/es/layout/components/Help/index.js +19 -40
- package/es/layout/components/Help/style.js +90 -115
- package/es/layout/components/PageContainer/index.js +233 -280
- package/es/layout/components/PageContainer/style/index.js +78 -118
- package/es/layout/components/PageContainer/style/stylish.js +10 -38
- package/es/layout/components/PageHeader/index.js +144 -129
- package/es/layout/components/PageHeader/style/index.js +125 -172
- package/es/layout/components/PageLoading/index.js +23 -50
- package/es/layout/components/SettingDrawer/BlockCheckbox.js +42 -42
- package/es/layout/components/SettingDrawer/LayoutChange.js +108 -98
- package/es/layout/components/SettingDrawer/RegionalChange.js +31 -34
- package/es/layout/components/SettingDrawer/ThemeColor.js +50 -69
- package/es/layout/components/SettingDrawer/icon/group.js +109 -88
- package/es/layout/components/SettingDrawer/icon/sub.js +70 -116
- package/es/layout/components/SettingDrawer/index.js +405 -420
- package/es/layout/components/SettingDrawer/style/index.js +142 -146
- package/es/layout/components/SiderMenu/Arrow.js +12 -15
- package/es/layout/components/SiderMenu/BaseMenu.js +402 -451
- package/es/layout/components/SiderMenu/SiderMenu.js +246 -336
- package/es/layout/components/SiderMenu/index.js +72 -101
- package/es/layout/components/SiderMenu/style/index.js +171 -210
- package/es/layout/components/SiderMenu/style/menu.js +110 -173
- package/es/layout/components/SiderMenu/style/stylish.js +12 -42
- package/es/layout/components/TopNavHeader/index.js +106 -179
- package/es/layout/components/TopNavHeader/style.js +67 -95
- package/es/layout/context/RouteContext.js +2 -6
- package/es/layout/defaultSettings.js +6 -9
- package/es/layout/getPageTitle.js +46 -40
- package/es/layout/index.js +4 -27
- package/es/layout/locales/en-US/settingDrawer.js +43 -47
- package/es/layout/locales/en-US.js +2 -22
- package/es/layout/locales/index.js +13 -18
- package/es/layout/locales/it-IT/settingDrawer.js +34 -38
- package/es/layout/locales/it-IT.js +2 -22
- package/es/layout/locales/ko-KR/settingDrawer.js +39 -43
- package/es/layout/locales/ko-KR.js +2 -22
- package/es/layout/locales/zh-CN/settingDrawer.js +43 -47
- package/es/layout/locales/zh-CN.js +2 -22
- package/es/layout/locales/zh-TW/settingDrawer.js +35 -39
- package/es/layout/locales/zh-TW.js +2 -22
- package/es/layout/style/index.js +43 -73
- package/es/layout/typing.js +1 -0
- package/es/layout/utils/getBreadcrumbProps.js +111 -91
- package/es/layout/utils/getMenuData.js +18 -21
- package/es/layout/utils/pathTools.js +11 -12
- package/es/layout/utils/useCurrentMenuLayoutProps.js +21 -29
- package/es/layout/utils/utils.js +35 -51
- package/es/list/Item.js +222 -294
- package/es/list/ListView.js +188 -232
- package/es/list/constants.js +4 -17
- package/es/list/index.js +121 -178
- package/es/list/style/index.js +224 -287
- package/es/provider/index.js +228 -179
- package/es/provider/intl.js +100 -124
- package/es/provider/locale/ar_EG.js +47 -51
- package/es/provider/locale/ca_ES.js +45 -49
- package/es/provider/locale/cs_CZ.js +50 -54
- package/es/provider/locale/de_DE.js +47 -51
- package/es/provider/locale/en_GB.js +49 -53
- package/es/provider/locale/en_US.js +51 -55
- package/es/provider/locale/es_ES.js +47 -51
- package/es/provider/locale/fa_IR.js +47 -51
- package/es/provider/locale/fr_FR.js +47 -51
- package/es/provider/locale/he_IL.js +50 -54
- package/es/provider/locale/hr_HR.js +47 -51
- package/es/provider/locale/id_ID.js +47 -51
- package/es/provider/locale/it_IT.js +47 -51
- package/es/provider/locale/ja_JP.js +47 -51
- package/es/provider/locale/ko_KR.js +47 -51
- package/es/provider/locale/mn_MN.js +47 -51
- package/es/provider/locale/ms_MY.js +47 -51
- package/es/provider/locale/nl_NL.js +50 -54
- package/es/provider/locale/pl_PL.js +47 -51
- package/es/provider/locale/pt_BR.js +47 -51
- package/es/provider/locale/ro_RO.js +50 -54
- package/es/provider/locale/ru_RU.js +47 -51
- package/es/provider/locale/sk_SK.js +50 -54
- package/es/provider/locale/sr_RS.js +47 -51
- package/es/provider/locale/sv_SE.js +50 -54
- package/es/provider/locale/th_TH.js +50 -54
- package/es/provider/locale/tr_TR.js +47 -51
- package/es/provider/locale/uk_UA.js +50 -54
- package/es/provider/locale/uz_UZ.js +47 -51
- package/es/provider/locale/vi_VN.js +47 -51
- package/es/provider/locale/zh_CN.js +50 -54
- package/es/provider/locale/zh_HK.js +50 -54
- package/es/provider/locale/zh_TW.js +50 -54
- package/es/provider/typing/layoutToken.d.ts +0 -10
- package/es/provider/typing/layoutToken.js +19 -42
- package/es/provider/useStyle/index.d.ts +1 -1
- package/es/provider/useStyle/index.js +91 -78
- package/es/provider/utils/merge.js +13 -29
- package/es/skeleton/components/Descriptions/index.js +240 -252
- package/es/skeleton/components/List/index.js +217 -207
- package/es/skeleton/components/Result/index.js +57 -54
- package/es/skeleton/index.js +18 -62
- package/es/table/Store/Provide.d.ts +0 -1
- package/es/table/Store/Provide.js +141 -128
- package/es/table/Table.js +645 -698
- package/es/table/components/Alert/index.js +60 -37
- package/es/table/components/Alert/style.js +28 -52
- package/es/table/components/ColumnSetting/index.js +382 -387
- package/es/table/components/ColumnSetting/style.js +72 -108
- package/es/table/components/DragSortTable/index.js +101 -137
- package/es/table/components/DragSortTable/style.js +20 -44
- package/es/table/components/Dropdown/index.js +70 -83
- package/es/table/components/EditableTable/CellEditorTable.js +50 -65
- package/es/table/components/EditableTable/RowEditorTable.js +44 -62
- package/es/table/components/EditableTable/index.js +343 -347
- package/es/table/components/Form/FormRender.js +167 -173
- package/es/table/components/Form/index.js +123 -132
- package/es/table/components/ListToolBar/HeaderMenu.js +68 -102
- package/es/table/components/ListToolBar/index.js +254 -273
- package/es/table/components/ListToolBar/style.js +119 -134
- package/es/table/components/ToolBar/DensityIcon.js +36 -41
- package/es/table/components/ToolBar/FullscreenIcon.js +21 -14
- package/es/table/components/ToolBar/index.js +235 -267
- package/es/table/index.js +3 -50
- package/es/table/style/index.js +129 -175
- package/es/table/typing.d.ts +2 -2
- package/es/table/typing.js +1 -0
- package/es/table/useFetchData.js +432 -232
- package/es/table/utils/cellRenderToFromItem.js +186 -261
- package/es/table/utils/columnRender.js +116 -115
- package/es/table/utils/columnSort.js +23 -21
- package/es/table/utils/genProColumnToColumn.js +101 -129
- package/es/table/utils/index.js +197 -115
- package/es/table/utils/useDragSort.js +135 -174
- package/es/utils/components/DropdownFooter/index.js +48 -58
- package/es/utils/components/DropdownFooter/style.js +16 -40
- package/es/utils/components/ErrorBoundary/index.js +51 -25
- package/es/utils/components/FieldLabel/index.js +119 -146
- package/es/utils/components/FieldLabel/style.js +82 -128
- package/es/utils/components/FilterDropdown/index.js +54 -81
- package/es/utils/components/FilterDropdown/style.js +17 -38
- package/es/utils/components/InlineErrorFormItem/index.js +132 -167
- package/es/utils/components/InlineErrorFormItem/style.js +51 -79
- package/es/utils/components/LabelIconTip/index.js +58 -56
- package/es/utils/components/LabelIconTip/style.js +36 -57
- package/es/utils/components/ProFormContext/index.js +2 -6
- package/es/utils/conversionMomentValue/index.js +102 -83
- package/es/utils/dateArrayFormatter/index.js +31 -16
- package/es/utils/genCopyable/index.js +44 -38
- package/es/utils/getFieldPropsOrFormItemProps/index.js +10 -7
- package/es/utils/hooks/useDebounceFn/index.js +58 -48
- package/es/utils/hooks/useDebounceValue/index.js +29 -19
- package/es/utils/hooks/useDeepCompareEffect/index.js +29 -44
- package/es/utils/hooks/useDeepCompareMemo/index.js +12 -10
- package/es/utils/hooks/useDocumentTitle/index.js +5 -9
- package/es/utils/hooks/useFetchData/index.js +70 -63
- package/es/utils/hooks/useForceRender/index.js +12 -9
- package/es/utils/hooks/useLatest/index.js +8 -8
- package/es/utils/hooks/usePrevious/index.js +5 -9
- package/es/utils/hooks/useReactiveRef/index.js +4 -8
- package/es/utils/hooks/useRefCallback/index.js +6 -10
- package/es/utils/hooks/useRefFunction/index.js +11 -10
- package/es/utils/index.d.ts +1 -3
- package/es/utils/index.js +9 -84
- package/es/utils/isBrowser/index.js +14 -9
- package/es/utils/isDeepEqualReact/index.js +79 -53
- package/es/utils/isDropdownValueType/index.js +4 -8
- package/es/utils/isImg/index.js +3 -6
- package/es/utils/isNil/index.js +3 -5
- package/es/utils/isUrl/index.js +10 -10
- package/es/utils/merge/index.js +20 -27
- package/es/utils/nanoid/index.js +24 -18
- package/es/utils/omitBoolean/index.js +8 -7
- package/es/utils/omitUndefined/index.js +6 -10
- package/es/utils/omitUndefinedAndEmptyArr/index.js +7 -11
- package/es/utils/parseValueToMoment/index.js +16 -14
- package/es/utils/pickProFormItemProps/index.js +9 -42
- package/es/utils/pickProProps/index.js +9 -11
- package/es/utils/proFieldParsingText/index.js +141 -49
- package/es/utils/runFunction/index.js +8 -8
- package/es/utils/stringify/index.js +4 -9
- package/es/utils/transformKeySubmitValue/index.js +254 -130
- package/es/utils/typing.js +1 -0
- package/es/utils/useEditableArray/index.js +776 -611
- package/es/utils/useEditableMap/index.js +179 -161
- package/es/utils/useMediaQuery/index.js +47 -43
- package/es/utils/useMediaQuery/query.js +19 -15
- package/es/utils/useMountMergeState/index.d.ts +1 -1
- package/es/utils/useMountMergeState/index.js +2 -5
- package/es/version.js +3 -7
- package/lib/card/ProCard.d.ts +0 -1
- package/lib/card/ProCard.js +20 -52
- package/lib/card/components/Actions/index.js +39 -57
- package/lib/card/components/Actions/style.js +77 -115
- package/lib/card/components/Card/index.js +221 -287
- package/lib/card/components/Card/style.js +197 -281
- package/lib/card/components/CheckCard/Group.js +205 -230
- package/lib/card/components/CheckCard/index.js +160 -190
- package/lib/card/components/CheckCard/style.js +192 -227
- package/lib/card/components/Divider/index.js +30 -47
- package/lib/card/components/Divider/style.js +35 -69
- package/lib/card/components/Loading/index.js +85 -42
- package/lib/card/components/Loading/style.js +48 -78
- package/lib/card/components/Operation/index.js +29 -46
- package/lib/card/components/Operation/style.js +24 -58
- package/lib/card/components/Statistic/index.js +84 -117
- package/lib/card/components/Statistic/style.js +81 -130
- package/lib/card/components/StatisticCard/index.d.ts +0 -2
- package/lib/card/components/StatisticCard/index.js +72 -103
- package/lib/card/components/StatisticCard/style.js +41 -70
- package/lib/card/index.d.ts +2 -2
- package/lib/card/index.js +34 -41
- package/lib/card/typing.js +4 -16
- package/lib/descriptions/index.js +368 -436
- package/lib/descriptions/useFetchData.js +99 -100
- package/lib/field/AllProField.js +477 -415
- package/lib/field/FieldHOC/index.js +37 -56
- package/lib/field/PureProField.js +141 -187
- package/lib/field/ValueTypeToComponent.js +725 -454
- package/lib/field/components/Cascader/index.d.ts +2 -2
- package/lib/field/components/Cascader/index.js +132 -171
- package/lib/field/components/Checkbox/index.d.ts +1 -1
- package/lib/field/components/Checkbox/index.js +113 -155
- package/lib/field/components/Code/index.js +73 -86
- package/lib/field/components/ColorPicker/index.d.ts +1 -1
- package/lib/field/components/ColorPicker/index.js +61 -103
- package/lib/field/components/DatePicker/index.d.ts +2 -2
- package/lib/field/components/DatePicker/index.js +109 -145
- package/lib/field/components/Digit/index.js +92 -110
- package/lib/field/components/DigitRange/index.js +108 -122
- package/lib/field/components/FromNow/index.js +57 -90
- package/lib/field/components/Image/index.js +52 -76
- package/lib/field/components/IndexColumn/index.js +50 -72
- package/lib/field/components/Money/index.js +253 -281
- package/lib/field/components/Options/index.js +68 -98
- package/lib/field/components/Password/index.js +66 -85
- package/lib/field/components/Percent/index.js +80 -101
- package/lib/field/components/Percent/util.js +28 -33
- package/lib/field/components/Progress/index.js +61 -80
- package/lib/field/components/Radio/index.d.ts +1 -1
- package/lib/field/components/Radio/index.js +92 -134
- package/lib/field/components/RangePicker/index.d.ts +2 -2
- package/lib/field/components/RangePicker/index.js +129 -164
- package/lib/field/components/Rate/index.js +43 -60
- package/lib/field/components/Second/index.js +67 -84
- package/lib/field/components/Segmented/index.d.ts +1 -1
- package/lib/field/components/Segmented/index.js +74 -117
- package/lib/field/components/Select/LightSelect/index.d.ts +1 -1
- package/lib/field/components/Select/LightSelect/index.js +216 -282
- package/lib/field/components/Select/SearchSelect/index.js +195 -245
- package/lib/field/components/Select/index.d.ts +2 -2
- package/lib/field/components/Select/index.js +307 -379
- package/lib/field/components/Slider/index.js +43 -70
- package/lib/field/components/Status/index.js +89 -52
- package/lib/field/components/Switch/index.d.ts +1 -1
- package/lib/field/components/Switch/index.js +67 -98
- package/lib/field/components/Text/index.js +58 -74
- package/lib/field/components/TextArea/index.js +44 -80
- package/lib/field/components/TextArea/readonly.js +43 -76
- package/lib/field/components/TimePicker/index.js +188 -217
- package/lib/field/components/TreeSelect/index.d.ts +2 -2
- package/lib/field/components/TreeSelect/index.js +185 -206
- package/lib/field/index.js +240 -96
- package/lib/form/BaseForm/BaseForm.js +594 -634
- package/lib/form/BaseForm/EditOrReadOnlyContext.js +9 -36
- package/lib/form/BaseForm/LightWrapper/index.js +111 -182
- package/lib/form/BaseForm/LightWrapper/style.js +19 -56
- package/lib/form/BaseForm/Submitter/index.js +75 -126
- package/lib/form/BaseForm/index.js +37 -20
- package/lib/form/FieldContext.js +8 -36
- package/lib/form/components/Captcha/index.js +169 -196
- package/lib/form/components/Cascader/index.js +56 -104
- package/lib/form/components/Checkbox/index.js +83 -128
- package/lib/form/components/ColorPicker/index.js +51 -92
- package/lib/form/components/DatePicker/BaseDatePicker.js +54 -98
- package/lib/form/components/DatePicker/DatePicker.js +32 -77
- package/lib/form/components/DatePicker/DateTimePicker.js +32 -76
- package/lib/form/components/DatePicker/MonthPicker.js +32 -77
- package/lib/form/components/DatePicker/QuarterPicker.js +32 -77
- package/lib/form/components/DatePicker/TimePicker.js +55 -103
- package/lib/form/components/DatePicker/WeekPicker.js +32 -77
- package/lib/form/components/DatePicker/YearPicker.js +32 -77
- package/lib/form/components/DatePicker/index.js +19 -44
- package/lib/form/components/DateRangePicker/BaseDateRanger.js +53 -100
- package/lib/form/components/DateRangePicker/DateMonthRangePicker.js +36 -78
- package/lib/form/components/DateRangePicker/DateQuarterRangePicker.js +36 -78
- package/lib/form/components/DateRangePicker/DateTimeRangePicker.js +36 -78
- package/lib/form/components/DateRangePicker/DateWeekRangePicker.js +36 -78
- package/lib/form/components/DateRangePicker/DateYearRangePicker.js +36 -78
- package/lib/form/components/DateRangePicker/TimeRangePicker.js +53 -97
- package/lib/form/components/DateRangePicker/index.js +36 -78
- package/lib/form/components/Dependency/index.js +68 -127
- package/lib/form/components/Digit/DigitRange.d.ts +1 -1
- package/lib/form/components/Digit/DigitRange.js +50 -103
- package/lib/form/components/Digit/index.js +55 -106
- package/lib/form/components/Field/index.js +89 -153
- package/lib/form/components/FieldSet/index.js +107 -153
- package/lib/form/components/FormItem/FormItemRender/index.js +142 -114
- package/lib/form/components/FormItem/Group/index.js +143 -198
- package/lib/form/components/FormItem/Group/style.js +46 -77
- package/lib/form/components/FormItem/index.js +257 -316
- package/lib/form/components/FormItem/warpField.js +229 -308
- package/lib/form/components/List/ListContainer.js +227 -211
- package/lib/form/components/List/ListItem.js +267 -374
- package/lib/form/components/List/index.js +211 -277
- package/lib/form/components/List/style.js +53 -110
- package/lib/form/components/Money/index.js +58 -108
- package/lib/form/components/Radio/index.js +60 -114
- package/lib/form/components/Rate/index.js +45 -88
- package/lib/form/components/SchemaForm/index.js +154 -193
- package/lib/form/components/SchemaForm/layoutType/Embed.js +12 -24
- package/lib/form/components/SchemaForm/layoutType/StepsForm.js +43 -96
- package/lib/form/components/SchemaForm/layoutType/index.js +18 -35
- package/lib/form/components/SchemaForm/typing.js +4 -16
- package/lib/form/components/SchemaForm/valueType/dependency.js +25 -69
- package/lib/form/components/SchemaForm/valueType/divider.js +16 -45
- package/lib/form/components/SchemaForm/valueType/field.js +67 -128
- package/lib/form/components/SchemaForm/valueType/formList.js +22 -58
- package/lib/form/components/SchemaForm/valueType/formSet.js +22 -68
- package/lib/form/components/SchemaForm/valueType/group.js +21 -53
- package/lib/form/components/SchemaForm/valueType/ignore.js +8 -25
- package/lib/form/components/SchemaForm/valueType/index.js +27 -43
- package/lib/form/components/Segmented/index.js +50 -89
- package/lib/form/components/Select/index.js +125 -181
- package/lib/form/components/Slider/index.js +62 -119
- package/lib/form/components/Switch/index.js +55 -99
- package/lib/form/components/Text/index.js +141 -190
- package/lib/form/components/TextArea/index.js +42 -85
- package/lib/form/components/TreeSelect/index.js +50 -89
- package/lib/form/components/UploadButton/index.js +131 -172
- package/lib/form/components/UploadDragger/index.js +84 -119
- package/lib/form/components/index.js +294 -110
- package/lib/form/helpers/grid.js +82 -97
- package/lib/form/helpers/index.js +15 -18
- package/lib/form/index.js +78 -38
- package/lib/form/layouts/DrawerForm/index.js +317 -338
- package/lib/form/layouts/DrawerForm/style.js +31 -65
- package/lib/form/layouts/LightFilter/index.js +217 -293
- package/lib/form/layouts/LightFilter/style.js +54 -89
- package/lib/form/layouts/LoginForm/index.js +93 -133
- package/lib/form/layouts/LoginForm/style.js +73 -110
- package/lib/form/layouts/LoginFormPage/index.js +148 -174
- package/lib/form/layouts/LoginFormPage/style.js +133 -165
- package/lib/form/layouts/ModalForm/index.js +253 -273
- package/lib/form/layouts/ProForm/index.js +28 -68
- package/lib/form/layouts/QueryFilter/Actions.js +57 -77
- package/lib/form/layouts/QueryFilter/index.js +308 -390
- package/lib/form/layouts/QueryFilter/style.js +43 -84
- package/lib/form/layouts/StepsForm/StepForm.js +94 -146
- package/lib/form/layouts/StepsForm/index.js +351 -378
- package/lib/form/layouts/StepsForm/style.js +34 -65
- package/lib/form/layouts/index.js +62 -40
- package/lib/form/typing.js +4 -16
- package/lib/index.js +133 -34
- package/lib/layout/ProLayout.js +447 -528
- package/lib/layout/WrapContent.js +34 -46
- package/lib/layout/assert/Logo.js +110 -97
- package/lib/layout/components/AppsLogoComponents/AppsLogo.js +17 -29
- package/lib/layout/components/AppsLogoComponents/DefaultContent.js +55 -85
- package/lib/layout/components/AppsLogoComponents/SimpleContent.js +78 -95
- package/lib/layout/components/AppsLogoComponents/index.js +98 -105
- package/lib/layout/components/AppsLogoComponents/style/default.js +36 -55
- package/lib/layout/components/AppsLogoComponents/style/index.js +58 -94
- package/lib/layout/components/AppsLogoComponents/style/simple.js +41 -59
- package/lib/layout/components/CollapsedIcon/index.js +26 -82
- package/lib/layout/components/CollapsedIcon/style.js +47 -81
- package/lib/layout/components/Footer.js +33 -65
- package/lib/layout/components/FooterToolbar/index.js +87 -132
- package/lib/layout/components/FooterToolbar/style/index.js +43 -77
- package/lib/layout/components/FooterToolbar/style/stylish.js +16 -54
- package/lib/layout/components/GlobalFooter/index.js +43 -61
- package/lib/layout/components/GlobalFooter/style.js +37 -68
- package/lib/layout/components/GlobalHeader/ActionsContent.js +138 -208
- package/lib/layout/components/GlobalHeader/index.d.ts +0 -5
- package/lib/layout/components/GlobalHeader/index.js +86 -116
- package/lib/layout/components/GlobalHeader/rightContentStyle.js +57 -91
- package/lib/layout/components/GlobalHeader/style.js +62 -98
- package/lib/layout/components/GridContent/index.js +43 -64
- package/lib/layout/components/GridContent/style.js +19 -53
- package/lib/layout/components/Header/index.js +105 -156
- package/lib/layout/components/Header/style/header.js +53 -87
- package/lib/layout/components/Header/style/stylish.js +18 -58
- package/lib/layout/components/Help/AsyncContentPanel.js +59 -62
- package/lib/layout/components/Help/HelpProvide.js +59 -34
- package/lib/layout/components/Help/ProHelpContentPanel.js +139 -157
- package/lib/layout/components/Help/ProHelpDrawer.js +54 -102
- package/lib/layout/components/Help/ProHelpModal.js +53 -102
- package/lib/layout/components/Help/ProHelpPanel.js +192 -254
- package/lib/layout/components/Help/ProHelpPopover.js +46 -92
- package/lib/layout/components/Help/RenderContentPanel.js +97 -130
- package/lib/layout/components/Help/Search.js +130 -191
- package/lib/layout/components/Help/index.js +113 -74
- package/lib/layout/components/Help/style.js +96 -130
- package/lib/layout/components/PageContainer/index.js +245 -308
- package/lib/layout/components/PageContainer/style/index.js +83 -133
- package/lib/layout/components/PageContainer/style/stylish.js +16 -54
- package/lib/layout/components/PageHeader/index.js +149 -156
- package/lib/layout/components/PageHeader/style/index.js +129 -182
- package/lib/layout/components/PageLoading/index.js +28 -76
- package/lib/layout/components/SettingDrawer/BlockCheckbox.js +46 -71
- package/lib/layout/components/SettingDrawer/LayoutChange.js +114 -129
- package/lib/layout/components/SettingDrawer/RegionalChange.js +38 -65
- package/lib/layout/components/SettingDrawer/ThemeColor.js +55 -95
- package/lib/layout/components/SettingDrawer/icon/group.js +111 -105
- package/lib/layout/components/SettingDrawer/icon/sub.js +72 -133
- package/lib/layout/components/SettingDrawer/index.js +424 -447
- package/lib/layout/components/SettingDrawer/style/index.js +147 -161
- package/lib/layout/components/SiderMenu/Arrow.js +16 -34
- package/lib/layout/components/SiderMenu/BaseMenu.js +416 -487
- package/lib/layout/components/SiderMenu/SiderMenu.js +254 -367
- package/lib/layout/components/SiderMenu/index.js +81 -130
- package/lib/layout/components/SiderMenu/style/index.js +178 -226
- package/lib/layout/components/SiderMenu/style/menu.js +115 -188
- package/lib/layout/components/SiderMenu/style/stylish.js +18 -58
- package/lib/layout/components/TopNavHeader/index.js +117 -211
- package/lib/layout/components/TopNavHeader/style.js +72 -110
- package/lib/layout/context/RouteContext.js +6 -24
- package/lib/layout/defaultSettings.js +11 -29
- package/lib/layout/getPageTitle.js +53 -60
- package/lib/layout/index.js +145 -55
- package/lib/layout/locales/en-US/settingDrawer.js +47 -65
- package/lib/layout/locales/en-US.js +8 -48
- package/lib/layout/locales/index.js +24 -52
- package/lib/layout/locales/it-IT/settingDrawer.js +38 -56
- package/lib/layout/locales/it-IT.js +8 -48
- package/lib/layout/locales/ko-KR/settingDrawer.js +43 -61
- package/lib/layout/locales/ko-KR.js +8 -48
- package/lib/layout/locales/zh-CN/settingDrawer.js +47 -65
- package/lib/layout/locales/zh-CN.js +8 -48
- package/lib/layout/locales/zh-TW/settingDrawer.js +39 -57
- package/lib/layout/locales/zh-TW.js +8 -48
- package/lib/layout/style/index.js +48 -88
- package/lib/layout/typing.js +4 -16
- package/lib/layout/utils/getBreadcrumbProps.js +117 -107
- package/lib/layout/utils/getMenuData.js +23 -40
- package/lib/layout/utils/pathTools.js +14 -29
- package/lib/layout/utils/useCurrentMenuLayoutProps.js +27 -49
- package/lib/layout/utils/utils.js +40 -64
- package/lib/list/Item.js +229 -321
- package/lib/list/ListView.js +197 -260
- package/lib/list/constants.js +7 -35
- package/lib/list/index.js +132 -207
- package/lib/list/style/index.js +230 -302
- package/lib/provider/index.js +270 -215
- package/lib/provider/intl.js +140 -188
- package/lib/provider/locale/ar_EG.js +51 -69
- package/lib/provider/locale/ca_ES.js +49 -67
- package/lib/provider/locale/cs_CZ.js +54 -72
- package/lib/provider/locale/de_DE.js +51 -69
- package/lib/provider/locale/en_GB.js +53 -71
- package/lib/provider/locale/en_US.js +55 -73
- package/lib/provider/locale/es_ES.js +51 -69
- package/lib/provider/locale/fa_IR.js +51 -69
- package/lib/provider/locale/fr_FR.js +51 -69
- package/lib/provider/locale/he_IL.js +54 -72
- package/lib/provider/locale/hr_HR.js +51 -69
- package/lib/provider/locale/id_ID.js +51 -69
- package/lib/provider/locale/it_IT.js +51 -69
- package/lib/provider/locale/ja_JP.js +51 -69
- package/lib/provider/locale/ko_KR.js +51 -69
- package/lib/provider/locale/mn_MN.js +51 -69
- package/lib/provider/locale/ms_MY.js +51 -69
- package/lib/provider/locale/nl_NL.js +54 -72
- package/lib/provider/locale/pl_PL.js +51 -69
- package/lib/provider/locale/pt_BR.js +51 -69
- package/lib/provider/locale/ro_RO.js +54 -72
- package/lib/provider/locale/ru_RU.js +51 -69
- package/lib/provider/locale/sk_SK.js +54 -72
- package/lib/provider/locale/sr_RS.js +51 -69
- package/lib/provider/locale/sv_SE.js +54 -72
- package/lib/provider/locale/th_TH.js +54 -72
- package/lib/provider/locale/tr_TR.js +51 -69
- package/lib/provider/locale/uk_UA.js +54 -72
- package/lib/provider/locale/uz_UZ.js +51 -69
- package/lib/provider/locale/vi_VN.js +51 -69
- package/lib/provider/locale/zh_CN.js +54 -72
- package/lib/provider/locale/zh_HK.js +54 -72
- package/lib/provider/locale/zh_TW.js +54 -72
- package/lib/provider/typing/layoutToken.d.ts +0 -10
- package/lib/provider/typing/layoutToken.js +36 -69
- package/lib/provider/useStyle/index.d.ts +1 -1
- package/lib/provider/useStyle/index.js +98 -94
- package/lib/provider/utils/merge.js +18 -44
- package/lib/skeleton/components/Descriptions/index.js +246 -282
- package/lib/skeleton/components/List/index.js +221 -236
- package/lib/skeleton/components/Result/index.js +63 -84
- package/lib/skeleton/index.js +73 -79
- package/lib/table/Store/Provide.d.ts +0 -1
- package/lib/table/Store/Provide.js +147 -151
- package/lib/table/Table.js +664 -712
- package/lib/table/components/Alert/index.js +66 -67
- package/lib/table/components/Alert/style.js +33 -67
- package/lib/table/components/ColumnSetting/index.js +391 -404
- package/lib/table/components/ColumnSetting/style.js +77 -123
- package/lib/table/components/DragSortTable/index.js +110 -165
- package/lib/table/components/DragSortTable/style.js +25 -59
- package/lib/table/components/Dropdown/index.js +75 -108
- package/lib/table/components/EditableTable/CellEditorTable.js +55 -90
- package/lib/table/components/EditableTable/RowEditorTable.js +49 -87
- package/lib/table/components/EditableTable/index.js +351 -365
- package/lib/table/components/Form/FormRender.js +176 -201
- package/lib/table/components/Form/index.js +132 -161
- package/lib/table/components/ListToolBar/HeaderMenu.js +74 -128
- package/lib/table/components/ListToolBar/index.js +263 -302
- package/lib/table/components/ListToolBar/style.js +124 -149
- package/lib/table/components/ToolBar/DensityIcon.js +43 -71
- package/lib/table/components/ToolBar/FullscreenIcon.js +30 -45
- package/lib/table/components/ToolBar/index.js +247 -299
- package/lib/table/index.js +179 -71
- package/lib/table/style/index.js +135 -190
- package/lib/table/typing.d.ts +2 -2
- package/lib/table/typing.js +4 -16
- package/lib/table/useFetchData.js +437 -241
- package/lib/table/utils/cellRenderToFromItem.js +192 -277
- package/lib/table/utils/columnRender.js +126 -144
- package/lib/table/utils/columnSort.js +27 -39
- package/lib/table/utils/genProColumnToColumn.js +111 -141
- package/lib/table/utils/index.js +204 -128
- package/lib/table/utils/useDragSort.js +141 -188
- package/lib/utils/components/DropdownFooter/index.js +56 -89
- package/lib/utils/components/DropdownFooter/style.js +21 -55
- package/lib/utils/components/ErrorBoundary/index.js +55 -53
- package/lib/utils/components/FieldLabel/index.js +126 -176
- package/lib/utils/components/FieldLabel/style.js +87 -143
- package/lib/utils/components/FilterDropdown/index.js +61 -109
- package/lib/utils/components/FilterDropdown/style.js +22 -53
- package/lib/utils/components/InlineErrorFormItem/index.js +137 -193
- package/lib/utils/components/InlineErrorFormItem/style.js +56 -94
- package/lib/utils/components/LabelIconTip/index.js +62 -82
- package/lib/utils/components/LabelIconTip/style.js +41 -72
- package/lib/utils/components/ProFormContext/index.js +7 -34
- package/lib/utils/conversionMomentValue/index.js +112 -115
- package/lib/utils/dateArrayFormatter/index.js +38 -46
- package/lib/utils/genCopyable/index.js +49 -66
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +15 -27
- package/lib/utils/hooks/useDebounceFn/index.js +63 -65
- package/lib/utils/hooks/useDebounceValue/index.js +35 -38
- package/lib/utils/hooks/useDeepCompareEffect/index.js +37 -61
- package/lib/utils/hooks/useDeepCompareMemo/index.js +17 -39
- package/lib/utils/hooks/useDocumentTitle/index.js +10 -28
- package/lib/utils/hooks/useFetchData/index.js +74 -89
- package/lib/utils/hooks/useForceRender/index.js +16 -26
- package/lib/utils/hooks/useLatest/index.js +11 -26
- package/lib/utils/hooks/usePrevious/index.js +9 -27
- package/lib/utils/hooks/useReactiveRef/index.js +10 -37
- package/lib/utils/hooks/useRefCallback/index.js +9 -27
- package/lib/utils/hooks/useRefFunction/index.js +16 -29
- package/lib/utils/index.d.ts +1 -3
- package/lib/utils/index.js +455 -138
- package/lib/utils/isBrowser/index.js +18 -27
- package/lib/utils/isDeepEqualReact/index.js +83 -70
- package/lib/utils/isDropdownValueType/index.js +8 -26
- package/lib/utils/isImg/index.js +6 -23
- package/lib/utils/isNil/index.js +7 -23
- package/lib/utils/isUrl/index.js +14 -28
- package/lib/utils/merge/index.js +26 -44
- package/lib/utils/nanoid/index.js +28 -36
- package/lib/utils/omitBoolean/index.js +12 -25
- package/lib/utils/omitUndefined/index.js +10 -28
- package/lib/utils/omitUndefinedAndEmptyArr/index.js +11 -29
- package/lib/utils/parseValueToMoment/index.js +26 -47
- package/lib/utils/pickProFormItemProps/index.js +12 -59
- package/lib/utils/pickProProps/index.js +13 -29
- package/lib/utils/proFieldParsingText/index.js +146 -77
- package/lib/utils/runFunction/index.js +12 -26
- package/lib/utils/stringify/index.js +14 -28
- package/lib/utils/transformKeySubmitValue/index.js +262 -160
- package/lib/utils/typing.js +4 -16
- package/lib/utils/useEditableArray/index.js +790 -630
- package/lib/utils/useEditableMap/index.js +188 -179
- package/lib/utils/useMediaQuery/index.js +53 -73
- package/lib/utils/useMediaQuery/query.js +23 -32
- package/lib/utils/useMountMergeState/index.d.ts +1 -1
- package/lib/utils/useMountMergeState/index.js +10 -33
- package/lib/version.js +7 -25
- package/package.json +4 -3
- package/es/card/components/TabPane/index.d.ts +0 -26
- package/es/card/components/TabPane/index.js +0 -84
- package/es/utils/compareVersions/coverToNewToken.d.ts +0 -2
- package/es/utils/compareVersions/coverToNewToken.js +0 -56
- package/es/utils/compareVersions/index.d.ts +0 -8
- package/es/utils/compareVersions/index.js +0 -48
- package/lib/card/components/TabPane/index.d.ts +0 -26
- package/lib/card/components/TabPane/index.js +0 -111
- package/lib/utils/compareVersions/coverToNewToken.d.ts +0 -2
- package/lib/utils/compareVersions/coverToNewToken.js +0 -73
- package/lib/utils/compareVersions/index.d.ts +0 -8
- package/lib/utils/compareVersions/index.js +0 -68
package/es/table/Table.js
CHANGED
|
@@ -1,169 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/table/Table.tsx
|
|
54
|
-
import { ConfigProvider, Table } from "antd";
|
|
55
|
-
import classNames from "classnames";
|
|
56
|
-
import isEmpty from "lodash-es/isEmpty";
|
|
57
|
-
import isEqual from "lodash-es/isEqual";
|
|
58
|
-
import React, {
|
|
59
|
-
useCallback,
|
|
60
|
-
useContext,
|
|
61
|
-
useEffect,
|
|
62
|
-
useImperativeHandle,
|
|
63
|
-
useMemo,
|
|
64
|
-
useRef
|
|
65
|
-
} from "react";
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
7
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
8
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
9
|
+
var _excluded = ["rowKey", "tableClassName", "defaultClassName", "action", "tableColumn", "type", "pagination", "rowSelection", "size", "defaultSize", "tableStyle", "toolbarDom", "hideToolbar", "searchNode", "style", "cardProps", "alertDom", "name", "onSortChange", "onFilterChange", "options", "isLightFilter", "className", "cardBordered", "editableUtils", "getRowKey"],
|
|
10
|
+
_excluded2 = ["cardBordered", "request", "className", "params", "defaultData", "headerTitle", "postData", "ghost", "pagination", "actionRef", "columns", "toolBarRender", "optionsRender", "onLoad", "onRequestError", "style", "cardProps", "tableStyle", "tableClassName", "options", "search", "name", "onLoadingChange", "rowSelection", "beforeSearchSubmit", "tableAlertRender", "defaultClassName", "formRef", "type", "columnEmptyText", "toolbar", "rowKey", "manualRequest", "polling", "tooltip", "revalidateOnFocus", "searchFormRender"];
|
|
11
|
+
import { ConfigProvider, Table } from 'antd';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import isEmpty from 'lodash-es/isEmpty';
|
|
14
|
+
import isEqual from 'lodash-es/isEqual';
|
|
15
|
+
import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
66
16
|
import ProCard from "../card";
|
|
67
17
|
import ValueTypeToComponent from "../field/ValueTypeToComponent";
|
|
68
18
|
import ProForm, { GridContext } from "../form";
|
|
69
|
-
import ProConfigContext, {
|
|
70
|
-
|
|
71
|
-
proTheme,
|
|
72
|
-
useIntl
|
|
73
|
-
} from "../provider";
|
|
74
|
-
import {
|
|
75
|
-
ErrorBoundary,
|
|
76
|
-
editableRowByKey,
|
|
77
|
-
omitUndefined,
|
|
78
|
-
recordKeyToString,
|
|
79
|
-
stringify,
|
|
80
|
-
useDeepCompareEffect,
|
|
81
|
-
useDeepCompareEffectDebounce,
|
|
82
|
-
useEditableArray,
|
|
83
|
-
useMountMergeState
|
|
84
|
-
} from "../utils";
|
|
19
|
+
import ProConfigContext, { ProConfigProvider, proTheme, useIntl } from "../provider";
|
|
20
|
+
import { ErrorBoundary, editableRowByKey, omitUndefined, recordKeyToString, stringify, useDeepCompareEffect, useDeepCompareEffectDebounce, useEditableArray, useMountMergeState } from "../utils";
|
|
85
21
|
import Alert from "./components/Alert";
|
|
86
22
|
import FormRender from "./components/Form";
|
|
87
23
|
import Toolbar from "./components/ToolBar";
|
|
88
24
|
import { Container, TableContext } from "./Store/Provide";
|
|
89
25
|
import { useStyle } from "./style";
|
|
90
26
|
import useFetchData from "./useFetchData";
|
|
91
|
-
import {
|
|
92
|
-
genColumnKey,
|
|
93
|
-
isBordered,
|
|
94
|
-
mergePagination,
|
|
95
|
-
parseDefaultColumnConfig,
|
|
96
|
-
useActionType
|
|
97
|
-
} from "./utils";
|
|
27
|
+
import { genColumnKey, isBordered, mergePagination, parseDefaultColumnConfig, useActionType } from "./utils";
|
|
98
28
|
import { columnSort } from "./utils/columnSort";
|
|
99
29
|
import { genProColumnToColumn } from "./utils/genProColumnToColumn";
|
|
30
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
|
+
import { createElement as _createElement } from "react";
|
|
32
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
100
34
|
function TableRender(props) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
"size",
|
|
138
|
-
"defaultSize",
|
|
139
|
-
"tableStyle",
|
|
140
|
-
"toolbarDom",
|
|
141
|
-
"hideToolbar",
|
|
142
|
-
"searchNode",
|
|
143
|
-
"style",
|
|
144
|
-
"cardProps",
|
|
145
|
-
"alertDom",
|
|
146
|
-
"name",
|
|
147
|
-
"onSortChange",
|
|
148
|
-
"onFilterChange",
|
|
149
|
-
"options",
|
|
150
|
-
"isLightFilter",
|
|
151
|
-
"className",
|
|
152
|
-
"cardBordered",
|
|
153
|
-
"editableUtils",
|
|
154
|
-
"getRowKey"
|
|
155
|
-
]);
|
|
156
|
-
const counter = useContext(TableContext);
|
|
157
|
-
const columns = useMemo(() => {
|
|
158
|
-
const loopFilter = (column) => {
|
|
159
|
-
return column.map((item) => {
|
|
160
|
-
const columnKey = genColumnKey(item.key, item.index);
|
|
161
|
-
const config = counter.columnsMap[columnKey];
|
|
35
|
+
var rowKey = props.rowKey,
|
|
36
|
+
tableClassName = props.tableClassName,
|
|
37
|
+
defaultClassName = props.defaultClassName,
|
|
38
|
+
action = props.action,
|
|
39
|
+
tableColumns = props.tableColumn,
|
|
40
|
+
type = props.type,
|
|
41
|
+
pagination = props.pagination,
|
|
42
|
+
rowSelection = props.rowSelection,
|
|
43
|
+
size = props.size,
|
|
44
|
+
defaultSize = props.defaultSize,
|
|
45
|
+
tableStyle = props.tableStyle,
|
|
46
|
+
toolbarDom = props.toolbarDom,
|
|
47
|
+
hideToolbar = props.hideToolbar,
|
|
48
|
+
searchNode = props.searchNode,
|
|
49
|
+
style = props.style,
|
|
50
|
+
propsCardProps = props.cardProps,
|
|
51
|
+
alertDom = props.alertDom,
|
|
52
|
+
name = props.name,
|
|
53
|
+
onSortChange = props.onSortChange,
|
|
54
|
+
onFilterChange = props.onFilterChange,
|
|
55
|
+
options = props.options,
|
|
56
|
+
isLightFilter = props.isLightFilter,
|
|
57
|
+
className = props.className,
|
|
58
|
+
cardBordered = props.cardBordered,
|
|
59
|
+
editableUtils = props.editableUtils,
|
|
60
|
+
getRowKey = props.getRowKey,
|
|
61
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
62
|
+
var counter = useContext(TableContext);
|
|
63
|
+
|
|
64
|
+
/** 需要遍历一下,不然不支持嵌套表格 */
|
|
65
|
+
var columns = useMemo(function () {
|
|
66
|
+
var loopFilter = function loopFilter(column) {
|
|
67
|
+
return column.map(function (item) {
|
|
68
|
+
// 删掉不应该显示的
|
|
69
|
+
var columnKey = genColumnKey(item.key, item.index);
|
|
70
|
+
var config = counter.columnsMap[columnKey];
|
|
162
71
|
if (config && config.show === false) {
|
|
163
72
|
return false;
|
|
164
73
|
}
|
|
165
74
|
if (item.children) {
|
|
166
|
-
return
|
|
75
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
167
76
|
children: loopFilter(item.children)
|
|
168
77
|
});
|
|
169
78
|
}
|
|
@@ -172,123 +81,133 @@ function TableRender(props) {
|
|
|
172
81
|
};
|
|
173
82
|
return loopFilter(tableColumns);
|
|
174
83
|
}, [counter.columnsMap, tableColumns]);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 如果是分页的新增,总是加到最后一行
|
|
87
|
+
*
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
var editableDataSource = function editableDataSource(dataSource) {
|
|
91
|
+
var _ref = editableUtils.newLineRecord || {},
|
|
92
|
+
newLineOptions = _ref.options,
|
|
93
|
+
row = _ref.defaultValue;
|
|
94
|
+
var isNewLineRecordAtTop = (newLineOptions === null || newLineOptions === void 0 ? void 0 : newLineOptions.position) === 'top';
|
|
95
|
+
if (newLineOptions !== null && newLineOptions !== void 0 && newLineOptions.parentKey) {
|
|
96
|
+
var _recordKeyToString, _props$expandable;
|
|
97
|
+
var actionProps = {
|
|
181
98
|
data: dataSource,
|
|
182
|
-
getRowKey,
|
|
183
|
-
row:
|
|
184
|
-
map_row_parentKey: (
|
|
185
|
-
newLineOptions.parentKey
|
|
186
|
-
)) == null ? void 0 : _a2.toString()
|
|
99
|
+
getRowKey: getRowKey,
|
|
100
|
+
row: _objectSpread(_objectSpread({}, row), {}, {
|
|
101
|
+
map_row_parentKey: (_recordKeyToString = recordKeyToString(newLineOptions.parentKey)) === null || _recordKeyToString === void 0 ? void 0 : _recordKeyToString.toString()
|
|
187
102
|
}),
|
|
188
|
-
key: newLineOptions
|
|
189
|
-
childrenColumnName: ((
|
|
103
|
+
key: newLineOptions === null || newLineOptions === void 0 ? void 0 : newLineOptions.recordKey,
|
|
104
|
+
childrenColumnName: ((_props$expandable = props.expandable) === null || _props$expandable === void 0 ? void 0 : _props$expandable.childrenColumnName) || 'children'
|
|
190
105
|
};
|
|
191
|
-
return editableRowByKey(
|
|
192
|
-
actionProps,
|
|
193
|
-
isNewLineRecordAtTop ? "top" : "update"
|
|
194
|
-
);
|
|
106
|
+
return editableRowByKey(actionProps, isNewLineRecordAtTop ? 'top' : 'update');
|
|
195
107
|
}
|
|
196
108
|
if (isNewLineRecordAtTop) {
|
|
197
|
-
return [row
|
|
109
|
+
return [row].concat(_toConsumableArray(action.dataSource));
|
|
198
110
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
111
|
+
// 如果有分页的功能,我们加到这一页的末尾
|
|
112
|
+
if (pagination && pagination !== null && pagination !== void 0 && pagination.current && pagination !== null && pagination !== void 0 && pagination.pageSize) {
|
|
113
|
+
var newDataSource = _toConsumableArray(action.dataSource);
|
|
114
|
+
if ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) > newDataSource.length) {
|
|
202
115
|
newDataSource.push(row);
|
|
203
116
|
return newDataSource;
|
|
204
117
|
}
|
|
205
|
-
newDataSource.splice(
|
|
206
|
-
(pagination == null ? void 0 : pagination.current) * (pagination == null ? void 0 : pagination.pageSize) - 1,
|
|
207
|
-
0,
|
|
208
|
-
row
|
|
209
|
-
);
|
|
118
|
+
newDataSource.splice((pagination === null || pagination === void 0 ? void 0 : pagination.current) * (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) - 1, 0, row);
|
|
210
119
|
return newDataSource;
|
|
211
120
|
}
|
|
212
|
-
return [
|
|
121
|
+
return [].concat(_toConsumableArray(action.dataSource), [row]);
|
|
213
122
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
(
|
|
240
|
-
|
|
241
|
-
}))
|
|
242
|
-
|
|
123
|
+
var getTableProps = function getTableProps() {
|
|
124
|
+
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
125
|
+
size: size,
|
|
126
|
+
rowSelection: rowSelection === false ? undefined : rowSelection,
|
|
127
|
+
className: tableClassName,
|
|
128
|
+
style: tableStyle,
|
|
129
|
+
columns: columns,
|
|
130
|
+
loading: action.loading,
|
|
131
|
+
dataSource: editableUtils.newLineRecord ? editableDataSource(action.dataSource) : action.dataSource,
|
|
132
|
+
pagination: pagination,
|
|
133
|
+
onChange: function onChange(changePagination, filters, sorter, extra) {
|
|
134
|
+
var _rest$onChange;
|
|
135
|
+
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 || _rest$onChange.call(rest, changePagination, filters, sorter, extra);
|
|
136
|
+
onFilterChange(omitUndefined(filters));
|
|
137
|
+
|
|
138
|
+
// 制造筛选的数据
|
|
139
|
+
// 制造一个排序的数据
|
|
140
|
+
if (Array.isArray(sorter)) {
|
|
141
|
+
var _omitUndefined;
|
|
142
|
+
var data = sorter.reduce(function (pre, value) {
|
|
143
|
+
return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, "".concat(value.field), value.order));
|
|
144
|
+
}, {});
|
|
145
|
+
onSortChange((_omitUndefined = omitUndefined(data)) !== null && _omitUndefined !== void 0 ? _omitUndefined : {});
|
|
146
|
+
} else {
|
|
147
|
+
var _sorter$column, _omitUndefined2;
|
|
148
|
+
var sorterOfColumn = (_sorter$column = sorter.column) === null || _sorter$column === void 0 ? void 0 : _sorter$column.sorter;
|
|
149
|
+
var isSortByField = (sorterOfColumn === null || sorterOfColumn === void 0 ? void 0 : sorterOfColumn.toString()) === sorterOfColumn;
|
|
150
|
+
onSortChange((_omitUndefined2 = omitUndefined(_defineProperty({}, "".concat(isSortByField ? sorterOfColumn : sorter.field), sorter.order))) !== null && _omitUndefined2 !== void 0 ? _omitUndefined2 : {});
|
|
151
|
+
}
|
|
243
152
|
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 是否需要 card 来包裹
|
|
158
|
+
*/
|
|
159
|
+
var notNeedCardDom = useMemo(function () {
|
|
247
160
|
if (props.search === false && !props.headerTitle && props.toolBarRender === false) {
|
|
248
161
|
return true;
|
|
249
162
|
}
|
|
250
163
|
return false;
|
|
251
164
|
}, []);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
165
|
+
|
|
166
|
+
/** 默认的 table dom,如果是编辑模式,外面还要包个 form */
|
|
167
|
+
var baseTableDom = /*#__PURE__*/_jsx(GridContext.Provider, {
|
|
168
|
+
value: {
|
|
169
|
+
grid: false,
|
|
170
|
+
colProps: undefined,
|
|
171
|
+
rowProps: undefined
|
|
260
172
|
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
173
|
+
children: /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
174
|
+
rowKey: rowKey
|
|
175
|
+
}))
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
/** 自定义的 render */
|
|
179
|
+
var tableDom = props.tableViewRender ? props.tableViewRender(_objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
180
|
+
rowSelection: rowSelection !== false ? rowSelection : undefined
|
|
181
|
+
}), baseTableDom) : baseTableDom;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 这段代码使用了 useMemo 进行了性能优化,根据 props.editable 和 props.name 的不同情况,渲染不同的页面组件。
|
|
185
|
+
* 当 props.editable 为 true 并且 props.name 不存在时,渲染一个带有表单和工具栏的页面组件,否则只渲染工具栏和表格组件。
|
|
186
|
+
* renderContent 函数会在 alertDom、props.loading、props.editable、tableDom、toolbarDom 发生变化时重新执行。
|
|
187
|
+
* */
|
|
188
|
+
var tableContentDom = useMemo(function () {
|
|
271
189
|
if (props.editable && !props.name) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
formRef: (
|
|
190
|
+
var _props$editable, _props$editable2, _props$editable3;
|
|
191
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
192
|
+
children: [toolbarDom, alertDom, /*#__PURE__*/_createElement(ProForm, _objectSpread(_objectSpread({}, (_props$editable = props.editable) === null || _props$editable === void 0 ? void 0 : _props$editable.formProps), {}, {
|
|
193
|
+
formRef: (_props$editable2 = props.editable) === null || _props$editable2 === void 0 || (_props$editable2 = _props$editable2.formProps) === null || _props$editable2 === void 0 ? void 0 : _props$editable2.formRef,
|
|
276
194
|
component: false,
|
|
277
|
-
form: (
|
|
195
|
+
form: (_props$editable3 = props.editable) === null || _props$editable3 === void 0 ? void 0 : _props$editable3.form,
|
|
278
196
|
onValuesChange: editableUtils.onValuesChange,
|
|
279
197
|
key: "table",
|
|
280
198
|
submitter: false,
|
|
281
199
|
omitNil: false,
|
|
282
200
|
dateFormatter: props.dateFormatter
|
|
283
|
-
}),
|
|
284
|
-
|
|
285
|
-
));
|
|
201
|
+
}), tableDom)]
|
|
202
|
+
});
|
|
286
203
|
}
|
|
287
|
-
return
|
|
204
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
|
+
children: [toolbarDom, alertDom, tableDom]
|
|
206
|
+
});
|
|
207
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
288
208
|
}, [alertDom, props.loading, !!props.editable, tableDom, toolbarDom]);
|
|
289
|
-
|
|
290
|
-
if (propsCardProps === false || notNeedCardDom === true || !!props.name)
|
|
291
|
-
return {};
|
|
209
|
+
var cardBodyStyle = useMemo(function () {
|
|
210
|
+
if (propsCardProps === false || notNeedCardDom === true || !!props.name) return {};
|
|
292
211
|
if (hideToolbar) {
|
|
293
212
|
return {
|
|
294
213
|
padding: 0
|
|
@@ -304,171 +223,145 @@ function TableRender(props) {
|
|
|
304
223
|
paddingBlockStart: 0
|
|
305
224
|
};
|
|
306
225
|
}
|
|
226
|
+
// if (!toolbarDom)
|
|
307
227
|
return {
|
|
308
228
|
padding: 0
|
|
309
229
|
};
|
|
310
|
-
}, [
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
ghost: props.ghost,
|
|
324
|
-
variant: isBordered("table", cardBordered) ? "outlined" : "borderless",
|
|
325
|
-
bodyStyle: cardBodyStyle
|
|
326
|
-
}, propsCardProps),
|
|
327
|
-
tableContentDom
|
|
328
|
-
)
|
|
329
|
-
);
|
|
330
|
-
const renderTable = () => {
|
|
230
|
+
}, [notNeedCardDom, pagination, props.name, propsCardProps, toolbarDom, hideToolbar]);
|
|
231
|
+
|
|
232
|
+
/** Table 区域的 dom,为了方便 render */
|
|
233
|
+
var tableAreaDom =
|
|
234
|
+
// cardProps 或者 有了name 就不需要这个padding了,不然会导致不好对齐
|
|
235
|
+
propsCardProps === false || notNeedCardDom === true || !!props.name ? tableContentDom : /*#__PURE__*/_jsx(ProCard, _objectSpread(_objectSpread({
|
|
236
|
+
ghost: props.ghost,
|
|
237
|
+
variant: isBordered('table', cardBordered) ? 'outlined' : 'borderless',
|
|
238
|
+
bodyStyle: cardBodyStyle
|
|
239
|
+
}, propsCardProps), {}, {
|
|
240
|
+
children: tableContentDom
|
|
241
|
+
}));
|
|
242
|
+
var renderTable = function renderTable() {
|
|
331
243
|
if (props.tableRender) {
|
|
332
244
|
return props.tableRender(props, tableAreaDom, {
|
|
333
|
-
toolbar: toolbarDom ||
|
|
334
|
-
alert: alertDom ||
|
|
335
|
-
table: tableDom ||
|
|
245
|
+
toolbar: toolbarDom || undefined,
|
|
246
|
+
alert: alertDom || undefined,
|
|
247
|
+
table: tableDom || undefined
|
|
336
248
|
});
|
|
337
249
|
}
|
|
338
250
|
return tableAreaDom;
|
|
339
251
|
};
|
|
340
|
-
|
|
341
|
-
"
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
);
|
|
353
|
-
if (!options || !(options == null ? void 0 : options.fullScreen)) {
|
|
252
|
+
var proTableDom = /*#__PURE__*/_jsxs("div", {
|
|
253
|
+
className: classNames(className, _defineProperty({}, "".concat(defaultClassName, "-polling"), action.pollingLoading)),
|
|
254
|
+
style: style,
|
|
255
|
+
ref: counter.rootDomRef,
|
|
256
|
+
children: [isLightFilter ? null : searchNode, type !== 'form' && props.tableExtraRender && /*#__PURE__*/_jsx("div", {
|
|
257
|
+
className: classNames(className, "".concat(defaultClassName, "-extra")),
|
|
258
|
+
children: props.tableExtraRender(props, action.dataSource || [])
|
|
259
|
+
}), type !== 'form' && renderTable()]
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// 如果不需要的全屏,ConfigProvider 没有意义
|
|
263
|
+
if (!options || !(options !== null && options !== void 0 && options.fullScreen)) {
|
|
354
264
|
return proTableDom;
|
|
355
265
|
}
|
|
356
|
-
return
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
getPopupContainer: () => {
|
|
360
|
-
return counter.rootDomRef.current || document.body;
|
|
361
|
-
}
|
|
266
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
267
|
+
getPopupContainer: function getPopupContainer() {
|
|
268
|
+
return counter.rootDomRef.current || document.body;
|
|
362
269
|
},
|
|
363
|
-
proTableDom
|
|
364
|
-
);
|
|
270
|
+
children: proTableDom
|
|
271
|
+
});
|
|
365
272
|
}
|
|
366
273
|
var emptyObj = {};
|
|
367
|
-
var ProTable = (props)
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
params = emptyObj,
|
|
374
|
-
defaultData,
|
|
375
|
-
headerTitle,
|
|
376
|
-
postData,
|
|
377
|
-
ghost,
|
|
378
|
-
pagination
|
|
379
|
-
actionRef
|
|
380
|
-
columns
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
"cardProps",
|
|
425
|
-
"tableStyle",
|
|
426
|
-
"tableClassName",
|
|
427
|
-
"options",
|
|
428
|
-
"search",
|
|
429
|
-
"name",
|
|
430
|
-
"onLoadingChange",
|
|
431
|
-
"rowSelection",
|
|
432
|
-
"beforeSearchSubmit",
|
|
433
|
-
"tableAlertRender",
|
|
434
|
-
"defaultClassName",
|
|
435
|
-
"formRef",
|
|
436
|
-
"type",
|
|
437
|
-
"columnEmptyText",
|
|
438
|
-
"toolbar",
|
|
439
|
-
"rowKey",
|
|
440
|
-
"manualRequest",
|
|
441
|
-
"polling",
|
|
442
|
-
"tooltip",
|
|
443
|
-
"revalidateOnFocus",
|
|
444
|
-
"searchFormRender"
|
|
445
|
-
]);
|
|
446
|
-
const { wrapSSR, hashId } = useStyle(props.defaultClassName);
|
|
447
|
-
const className = classNames(defaultClassName, propsClassName, hashId);
|
|
448
|
-
const actionRef = useRef();
|
|
449
|
-
const defaultFormRef = useRef();
|
|
450
|
-
const formRef = propRef || defaultFormRef;
|
|
451
|
-
useImperativeHandle(propsActionRef, () => actionRef.current);
|
|
452
|
-
const [selectedRowKeys, setSelectedRowKeys] = useMountMergeState(
|
|
453
|
-
propsRowSelection ? (propsRowSelection == null ? void 0 : propsRowSelection.defaultSelectedRowKeys) || [] : void 0,
|
|
454
|
-
{
|
|
455
|
-
value: propsRowSelection ? propsRowSelection.selectedRowKeys : void 0
|
|
456
|
-
}
|
|
457
|
-
);
|
|
458
|
-
const [formSearch, setFormSearch] = useMountMergeState(() => {
|
|
459
|
-
if (manualRequest || search !== false) {
|
|
460
|
-
return void 0;
|
|
461
|
-
}
|
|
462
|
-
return {};
|
|
274
|
+
var ProTable = function ProTable(props) {
|
|
275
|
+
var _props$expandable2;
|
|
276
|
+
var cardBordered = props.cardBordered,
|
|
277
|
+
request = props.request,
|
|
278
|
+
propsClassName = props.className,
|
|
279
|
+
_props$params = props.params,
|
|
280
|
+
params = _props$params === void 0 ? emptyObj : _props$params,
|
|
281
|
+
defaultData = props.defaultData,
|
|
282
|
+
headerTitle = props.headerTitle,
|
|
283
|
+
postData = props.postData,
|
|
284
|
+
ghost = props.ghost,
|
|
285
|
+
propsPagination = props.pagination,
|
|
286
|
+
propsActionRef = props.actionRef,
|
|
287
|
+
_props$columns = props.columns,
|
|
288
|
+
propsColumns = _props$columns === void 0 ? [] : _props$columns,
|
|
289
|
+
toolBarRender = props.toolBarRender,
|
|
290
|
+
optionsRender = props.optionsRender,
|
|
291
|
+
onLoad = props.onLoad,
|
|
292
|
+
onRequestError = props.onRequestError,
|
|
293
|
+
style = props.style,
|
|
294
|
+
cardProps = props.cardProps,
|
|
295
|
+
tableStyle = props.tableStyle,
|
|
296
|
+
tableClassName = props.tableClassName,
|
|
297
|
+
options = props.options,
|
|
298
|
+
search = props.search,
|
|
299
|
+
isEditorTable = props.name,
|
|
300
|
+
onLoadingChange = props.onLoadingChange,
|
|
301
|
+
_props$rowSelection = props.rowSelection,
|
|
302
|
+
propsRowSelection = _props$rowSelection === void 0 ? false : _props$rowSelection,
|
|
303
|
+
beforeSearchSubmit = props.beforeSearchSubmit,
|
|
304
|
+
tableAlertRender = props.tableAlertRender,
|
|
305
|
+
defaultClassName = props.defaultClassName,
|
|
306
|
+
propRef = props.formRef,
|
|
307
|
+
_props$type = props.type,
|
|
308
|
+
type = _props$type === void 0 ? 'table' : _props$type,
|
|
309
|
+
_props$columnEmptyTex = props.columnEmptyText,
|
|
310
|
+
columnEmptyText = _props$columnEmptyTex === void 0 ? '-' : _props$columnEmptyTex,
|
|
311
|
+
toolbar = props.toolbar,
|
|
312
|
+
rowKey = props.rowKey,
|
|
313
|
+
manualRequest = props.manualRequest,
|
|
314
|
+
polling = props.polling,
|
|
315
|
+
tooltip = props.tooltip,
|
|
316
|
+
_props$revalidateOnFo = props.revalidateOnFocus,
|
|
317
|
+
revalidateOnFocus = _props$revalidateOnFo === void 0 ? false : _props$revalidateOnFo,
|
|
318
|
+
searchFormRender = props.searchFormRender,
|
|
319
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
320
|
+
var _useStyle = useStyle(props.defaultClassName),
|
|
321
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
322
|
+
hashId = _useStyle.hashId;
|
|
323
|
+
var className = classNames(defaultClassName, propsClassName, hashId);
|
|
324
|
+
|
|
325
|
+
/** 通用的来操作子节点的工具类 */
|
|
326
|
+
var actionRef = useRef();
|
|
327
|
+
var defaultFormRef = useRef();
|
|
328
|
+
var formRef = propRef || defaultFormRef;
|
|
329
|
+
useImperativeHandle(propsActionRef, function () {
|
|
330
|
+
return actionRef.current;
|
|
463
331
|
});
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
332
|
+
|
|
333
|
+
/** 单选多选的相关逻辑 */
|
|
334
|
+
var _useMountMergeState = useMountMergeState(propsRowSelection ? (propsRowSelection === null || propsRowSelection === void 0 ? void 0 : propsRowSelection.defaultSelectedRowKeys) || [] : undefined, {
|
|
335
|
+
value: propsRowSelection ? propsRowSelection.selectedRowKeys : undefined
|
|
336
|
+
}),
|
|
337
|
+
_useMountMergeState2 = _slicedToArray(_useMountMergeState, 2),
|
|
338
|
+
selectedRowKeys = _useMountMergeState2[0],
|
|
339
|
+
setSelectedRowKeys = _useMountMergeState2[1];
|
|
340
|
+
var _useMountMergeState3 = useMountMergeState(function () {
|
|
341
|
+
// 如果手动模式,或者 search 不存在的时候设置为 undefined
|
|
342
|
+
// undefined 就不会触发首次加载
|
|
343
|
+
if (manualRequest || search !== false) {
|
|
344
|
+
return undefined;
|
|
345
|
+
}
|
|
346
|
+
return {};
|
|
347
|
+
}),
|
|
348
|
+
_useMountMergeState4 = _slicedToArray(_useMountMergeState3, 2),
|
|
349
|
+
formSearch = _useMountMergeState4[0],
|
|
350
|
+
setFormSearch = _useMountMergeState4[1];
|
|
351
|
+
var _useMountMergeState5 = useMountMergeState({}),
|
|
352
|
+
_useMountMergeState6 = _slicedToArray(_useMountMergeState5, 2),
|
|
353
|
+
proFilter = _useMountMergeState6[0],
|
|
354
|
+
setProFilter = _useMountMergeState6[1];
|
|
355
|
+
var _useMountMergeState7 = useMountMergeState({}),
|
|
356
|
+
_useMountMergeState8 = _slicedToArray(_useMountMergeState7, 2),
|
|
357
|
+
proSort = _useMountMergeState8[0],
|
|
358
|
+
setProSort = _useMountMergeState8[1];
|
|
359
|
+
|
|
360
|
+
// 平铺所有columns, 用于判断是用的是本地筛选/排序
|
|
361
|
+
var loopColumns = useCallback(function (data) {
|
|
362
|
+
var _columns = [];
|
|
363
|
+
for (var i = 0; i < data.length; i++) {
|
|
364
|
+
var _curItem = data[i];
|
|
472
365
|
if (_curItem.children) {
|
|
473
366
|
loopColumns(_curItem.children);
|
|
474
367
|
} else {
|
|
@@ -477,100 +370,140 @@ var ProTable = (props) => {
|
|
|
477
370
|
}
|
|
478
371
|
return _columns;
|
|
479
372
|
}, []);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
373
|
+
|
|
374
|
+
/** 如果所有列中的 filters = true | undefined 说明是用的是本地筛选 任何一列配置 filters=false,就能绕过这个判断 */
|
|
375
|
+
var useLocaleFilter = useMemo(function () {
|
|
376
|
+
var _columns = loopColumns(propsColumns);
|
|
377
|
+
return _columns === null || _columns === void 0 ? void 0 : _columns.every(function (column) {
|
|
378
|
+
return !!column.filters && !!column.onFilter || column.filters === undefined && column.onFilter === undefined;
|
|
484
379
|
});
|
|
485
380
|
}, [loopColumns, propsColumns]);
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
381
|
+
|
|
382
|
+
/** 如果所有列中的 sorter != true 说明是用的是本地排序 任何一列配置 sorter=true,就能绕过这个判断 */
|
|
383
|
+
var useLocaleSorter = useMemo(function () {
|
|
384
|
+
var _columns = loopColumns(propsColumns);
|
|
385
|
+
return _columns === null || _columns === void 0 ? void 0 : _columns.every(function (column) {
|
|
386
|
+
return column.sorter !== true;
|
|
387
|
+
});
|
|
489
388
|
}, [loopColumns, propsColumns]);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
389
|
+
|
|
390
|
+
/** 设置默认的服務端排序和筛选值 */
|
|
391
|
+
useEffect(function () {
|
|
392
|
+
var _parseDefaultColumnCo = parseDefaultColumnConfig(propsColumns),
|
|
393
|
+
sort = _parseDefaultColumnCo.sort,
|
|
394
|
+
filter = _parseDefaultColumnCo.filter;
|
|
395
|
+
if (!useLocaleFilter) setProFilter(filter);
|
|
396
|
+
if (!useLocaleSorter) setProSort(sort);
|
|
397
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
496
398
|
}, []);
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
399
|
+
var intl = useIntl();
|
|
400
|
+
|
|
401
|
+
/** 需要初始化 不然默认可能报错 这里取了 defaultCurrent 和 current 为了保证不会重复刷新 */
|
|
402
|
+
var fetchPagination = _typeof(propsPagination) === 'object' ? propsPagination : {
|
|
403
|
+
defaultCurrent: 1,
|
|
404
|
+
defaultPageSize: 20,
|
|
405
|
+
pageSize: 20,
|
|
406
|
+
current: 1
|
|
407
|
+
};
|
|
408
|
+
var counter = useContext(TableContext);
|
|
409
|
+
|
|
410
|
+
// ============================ useFetchData ============================
|
|
411
|
+
var fetchData = useMemo(function () {
|
|
412
|
+
if (!request) return undefined;
|
|
413
|
+
return /*#__PURE__*/function () {
|
|
414
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pageParams) {
|
|
415
|
+
var actionParams, response;
|
|
416
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
417
|
+
while (1) switch (_context.prev = _context.next) {
|
|
418
|
+
case 0:
|
|
419
|
+
actionParams = _objectSpread(_objectSpread(_objectSpread({}, pageParams || {}), formSearch), params); // eslint-disable-next-line no-underscore-dangle
|
|
420
|
+
delete actionParams._timestamp;
|
|
421
|
+
_context.next = 4;
|
|
422
|
+
return request(actionParams, proSort, proFilter);
|
|
423
|
+
case 4:
|
|
424
|
+
response = _context.sent;
|
|
425
|
+
return _context.abrupt("return", response);
|
|
426
|
+
case 6:
|
|
427
|
+
case "end":
|
|
428
|
+
return _context.stop();
|
|
429
|
+
}
|
|
430
|
+
}, _callee);
|
|
431
|
+
}));
|
|
432
|
+
return function (_x) {
|
|
433
|
+
return _ref2.apply(this, arguments);
|
|
434
|
+
};
|
|
435
|
+
}();
|
|
513
436
|
}, [formSearch, params, proFilter, proSort, request]);
|
|
514
|
-
|
|
437
|
+
var action = useFetchData(fetchData, defaultData, {
|
|
515
438
|
pageInfo: propsPagination === false ? false : fetchPagination,
|
|
516
439
|
loading: props.loading,
|
|
517
440
|
dataSource: props.dataSource,
|
|
518
441
|
onDataSourceChange: props.onDataSourceChange,
|
|
519
|
-
onLoad,
|
|
520
|
-
onLoadingChange,
|
|
521
|
-
onRequestError,
|
|
522
|
-
postData,
|
|
523
|
-
revalidateOnFocus,
|
|
524
|
-
manual: formSearch ===
|
|
525
|
-
polling,
|
|
526
|
-
effects: [
|
|
527
|
-
stringify(params),
|
|
528
|
-
stringify(formSearch),
|
|
529
|
-
stringify(proFilter),
|
|
530
|
-
stringify(proSort)
|
|
531
|
-
],
|
|
442
|
+
onLoad: onLoad,
|
|
443
|
+
onLoadingChange: onLoadingChange,
|
|
444
|
+
onRequestError: onRequestError,
|
|
445
|
+
postData: postData,
|
|
446
|
+
revalidateOnFocus: revalidateOnFocus,
|
|
447
|
+
manual: formSearch === undefined,
|
|
448
|
+
polling: polling,
|
|
449
|
+
effects: [stringify(params), stringify(formSearch), stringify(proFilter), stringify(proSort)],
|
|
532
450
|
debounceTime: props.debounceTime,
|
|
533
|
-
onPageInfoChange: (pageInfo)
|
|
534
|
-
var
|
|
535
|
-
if (!propsPagination || !fetchData)
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
451
|
+
onPageInfoChange: function onPageInfoChange(pageInfo) {
|
|
452
|
+
var _propsPagination$onCh, _propsPagination$onSh;
|
|
453
|
+
if (!propsPagination || !fetchData) return;
|
|
454
|
+
|
|
455
|
+
// 总是触发一下 onChange 和 onShowSizeChange
|
|
456
|
+
// 目前只有 List 和 Table 支持分页, List 有分页的时候打断 Table 的分页
|
|
457
|
+
propsPagination === null || propsPagination === void 0 || (_propsPagination$onCh = propsPagination.onChange) === null || _propsPagination$onCh === void 0 || _propsPagination$onCh.call(propsPagination, pageInfo.current, pageInfo.pageSize);
|
|
458
|
+
propsPagination === null || propsPagination === void 0 || (_propsPagination$onSh = propsPagination.onShowSizeChange) === null || _propsPagination$onSh === void 0 || _propsPagination$onSh.call(propsPagination, pageInfo.current, pageInfo.pageSize);
|
|
539
459
|
}
|
|
540
460
|
});
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
461
|
+
// ============================ END ============================
|
|
462
|
+
|
|
463
|
+
/** 聚焦的时候重新请求数据,这样可以保证数据都是最新的。 */
|
|
464
|
+
useEffect(function () {
|
|
465
|
+
var _props$form;
|
|
466
|
+
// 手动模式和 request 为空都不生效
|
|
467
|
+
if (props.manualRequest || !props.request || !revalidateOnFocus || (_props$form = props.form) !== null && _props$form !== void 0 && _props$form.ignoreRules) return;
|
|
468
|
+
|
|
469
|
+
// 聚焦时重新请求事件
|
|
470
|
+
var visibilitychange = function visibilitychange() {
|
|
471
|
+
if (document.visibilityState === 'visible') {
|
|
547
472
|
action.reload();
|
|
548
473
|
}
|
|
549
474
|
};
|
|
550
|
-
document.addEventListener(
|
|
551
|
-
return ()
|
|
475
|
+
document.addEventListener('visibilitychange', visibilitychange);
|
|
476
|
+
return function () {
|
|
477
|
+
return document.removeEventListener('visibilitychange', visibilitychange);
|
|
478
|
+
};
|
|
479
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
552
480
|
}, []);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
481
|
+
|
|
482
|
+
/** SelectedRowKeys受控处理selectRows */
|
|
483
|
+
var preserveRecordsRef = React.useRef(new Map());
|
|
484
|
+
|
|
485
|
+
// ============================ RowKey ============================
|
|
486
|
+
var getRowKey = React.useMemo(function () {
|
|
487
|
+
if (typeof rowKey === 'function') {
|
|
556
488
|
return rowKey;
|
|
557
489
|
}
|
|
558
|
-
return (record, index)
|
|
559
|
-
var
|
|
490
|
+
return function (record, index) {
|
|
491
|
+
var _ref3;
|
|
560
492
|
if (index === -1) {
|
|
561
|
-
return record
|
|
493
|
+
return record === null || record === void 0 ? void 0 : record[rowKey];
|
|
562
494
|
}
|
|
495
|
+
// 如果 props 中有name 的话,用index 来做行号,这样方便转化为 index
|
|
563
496
|
if (props.name) {
|
|
564
|
-
return index
|
|
497
|
+
return index === null || index === void 0 ? void 0 : index.toString();
|
|
565
498
|
}
|
|
566
|
-
return (
|
|
499
|
+
return (_ref3 = record === null || record === void 0 ? void 0 : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : index === null || index === void 0 ? void 0 : index.toString();
|
|
567
500
|
};
|
|
568
501
|
}, [props.name, rowKey]);
|
|
569
|
-
useMemo(()
|
|
570
|
-
var
|
|
571
|
-
if ((
|
|
572
|
-
|
|
573
|
-
|
|
502
|
+
useMemo(function () {
|
|
503
|
+
var _action$dataSource;
|
|
504
|
+
if ((_action$dataSource = action.dataSource) !== null && _action$dataSource !== void 0 && _action$dataSource.length) {
|
|
505
|
+
var keys = action.dataSource.map(function (data) {
|
|
506
|
+
var dataRowKey = getRowKey(data, -1);
|
|
574
507
|
preserveRecordsRef.current.set(dataRowKey, data);
|
|
575
508
|
return dataRowKey;
|
|
576
509
|
});
|
|
@@ -578,21 +511,32 @@ var ProTable = (props) => {
|
|
|
578
511
|
}
|
|
579
512
|
return [];
|
|
580
513
|
}, [action.dataSource, getRowKey]);
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
514
|
+
|
|
515
|
+
/** 页面编辑的计算 */
|
|
516
|
+
var pagination = useMemo(function () {
|
|
517
|
+
var newPropsPagination = propsPagination === false ? false : _objectSpread({}, propsPagination);
|
|
518
|
+
var pageConfig = _objectSpread(_objectSpread({}, action.pageInfo), {}, {
|
|
519
|
+
setPageInfo: function setPageInfo(_ref4) {
|
|
520
|
+
var pageSize = _ref4.pageSize,
|
|
521
|
+
current = _ref4.current;
|
|
522
|
+
var pageInfo = action.pageInfo;
|
|
523
|
+
|
|
524
|
+
// pageSize 发生改变,并且你不是在第一页,切回到第一页
|
|
525
|
+
// 这样可以防止出现 跳转到一个空的数据页的问题
|
|
586
526
|
if (pageSize === pageInfo.pageSize || pageInfo.current === 1) {
|
|
587
|
-
action.setPageInfo({
|
|
527
|
+
action.setPageInfo({
|
|
528
|
+
pageSize: pageSize,
|
|
529
|
+
current: current
|
|
530
|
+
});
|
|
588
531
|
return;
|
|
589
532
|
}
|
|
590
|
-
|
|
591
|
-
|
|
533
|
+
|
|
534
|
+
// 通过request的时候清空数据,然后刷新不然可能会导致 pageSize 没有数据多
|
|
535
|
+
if (request) action.setDataSource([]);
|
|
592
536
|
action.setPageInfo({
|
|
593
|
-
pageSize,
|
|
537
|
+
pageSize: pageSize,
|
|
594
538
|
// 目前只有 List 和 Table 支持分页, List 有分页的时候 还是使用之前的当前页码
|
|
595
|
-
current: type ===
|
|
539
|
+
current: type === 'list' ? current : 1
|
|
596
540
|
});
|
|
597
541
|
}
|
|
598
542
|
});
|
|
@@ -601,296 +545,299 @@ var ProTable = (props) => {
|
|
|
601
545
|
delete newPropsPagination.onShowSizeChange;
|
|
602
546
|
}
|
|
603
547
|
return mergePagination(newPropsPagination, pageConfig, intl);
|
|
548
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
604
549
|
}, [propsPagination, action, intl]);
|
|
605
|
-
useDeepCompareEffect(()
|
|
606
|
-
var
|
|
607
|
-
|
|
550
|
+
useDeepCompareEffect(function () {
|
|
551
|
+
var _action$pageInfo;
|
|
552
|
+
// request 存在且params不为空,且已经请求过数据才需要设置。
|
|
553
|
+
if (props.request && !isEmpty(params) && action.dataSource && !isEqual(action.dataSource, defaultData) && (action === null || action === void 0 || (_action$pageInfo = action.pageInfo) === null || _action$pageInfo === void 0 ? void 0 : _action$pageInfo.current) !== 1) {
|
|
608
554
|
action.setPageInfo({
|
|
609
555
|
current: 1
|
|
610
556
|
});
|
|
611
557
|
}
|
|
558
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
612
559
|
}, [params]);
|
|
560
|
+
|
|
561
|
+
// 设置 name 到 store 中,里面用了 ref ,所以不用担心直接 set
|
|
613
562
|
counter.setPrefixName(props.name);
|
|
614
|
-
|
|
563
|
+
|
|
564
|
+
/** 清空所有的选中项 */
|
|
565
|
+
var _onCleanSelected = useCallback(function () {
|
|
615
566
|
if (propsRowSelection && propsRowSelection.onChange) {
|
|
616
567
|
propsRowSelection.onChange([], [], {
|
|
617
|
-
type:
|
|
568
|
+
type: 'none'
|
|
618
569
|
});
|
|
619
570
|
}
|
|
620
571
|
setSelectedRowKeys([]);
|
|
621
572
|
}, [propsRowSelection, setSelectedRowKeys]);
|
|
622
573
|
counter.propsRef.current = props;
|
|
623
|
-
|
|
574
|
+
|
|
575
|
+
/** 可编辑行的相关配置 */
|
|
576
|
+
var editableUtils = useEditableArray(_objectSpread(_objectSpread({}, props.editable), {}, {
|
|
624
577
|
tableName: props.name,
|
|
625
|
-
getRowKey,
|
|
626
|
-
childrenColumnName: ((
|
|
578
|
+
getRowKey: getRowKey,
|
|
579
|
+
childrenColumnName: ((_props$expandable2 = props.expandable) === null || _props$expandable2 === void 0 ? void 0 : _props$expandable2.childrenColumnName) || 'children',
|
|
627
580
|
dataSource: action.dataSource || [],
|
|
628
|
-
setDataSource: (data)
|
|
629
|
-
var
|
|
630
|
-
(
|
|
581
|
+
setDataSource: function setDataSource(data) {
|
|
582
|
+
var _props$editable4, _props$editable4$onVa;
|
|
583
|
+
(_props$editable4 = props.editable) === null || _props$editable4 === void 0 || (_props$editable4$onVa = _props$editable4.onValuesChange) === null || _props$editable4$onVa === void 0 || _props$editable4$onVa.call(_props$editable4, undefined, data);
|
|
631
584
|
action.setDataSource(data);
|
|
632
585
|
}
|
|
633
586
|
}));
|
|
634
|
-
|
|
587
|
+
|
|
588
|
+
// ============================ Render ============================
|
|
589
|
+
var _proTheme$useToken = proTheme === null || proTheme === void 0 ? void 0 : proTheme.useToken(),
|
|
590
|
+
token = _proTheme$useToken.token;
|
|
591
|
+
|
|
592
|
+
/** 绑定 action */
|
|
635
593
|
useActionType(actionRef, action, {
|
|
636
|
-
fullScreen: ()
|
|
637
|
-
var
|
|
638
|
-
if (!((
|
|
594
|
+
fullScreen: function fullScreen() {
|
|
595
|
+
var _counter$rootDomRef;
|
|
596
|
+
if (!((_counter$rootDomRef = counter.rootDomRef) !== null && _counter$rootDomRef !== void 0 && _counter$rootDomRef.current) || !document.fullscreenEnabled) {
|
|
639
597
|
return;
|
|
640
598
|
}
|
|
641
599
|
if (document.fullscreenElement) {
|
|
642
600
|
document.exitFullscreen();
|
|
643
601
|
} else {
|
|
644
|
-
|
|
602
|
+
var _counter$rootDomRef2;
|
|
603
|
+
(_counter$rootDomRef2 = counter.rootDomRef) === null || _counter$rootDomRef2 === void 0 || _counter$rootDomRef2.current.requestFullscreen();
|
|
645
604
|
}
|
|
646
605
|
},
|
|
647
|
-
onCleanSelected: ()
|
|
648
|
-
|
|
606
|
+
onCleanSelected: function onCleanSelected() {
|
|
607
|
+
// 清空选中行
|
|
608
|
+
_onCleanSelected();
|
|
649
609
|
},
|
|
650
|
-
resetAll: ()
|
|
651
|
-
var
|
|
652
|
-
|
|
653
|
-
|
|
610
|
+
resetAll: function resetAll() {
|
|
611
|
+
var _formRef$current;
|
|
612
|
+
// 清空选中行
|
|
613
|
+
_onCleanSelected();
|
|
614
|
+
var _parseDefaultColumnCo2 = parseDefaultColumnConfig(propsColumns),
|
|
615
|
+
sort = _parseDefaultColumnCo2.sort,
|
|
616
|
+
filter = _parseDefaultColumnCo2.filter;
|
|
617
|
+
// 清空筛选
|
|
654
618
|
setProFilter(filter);
|
|
619
|
+
// 清空排序
|
|
655
620
|
setProSort(sort);
|
|
656
|
-
|
|
621
|
+
|
|
622
|
+
// 清空 toolbar 搜索
|
|
623
|
+
counter.setKeyWords(undefined);
|
|
624
|
+
// 重置页码
|
|
657
625
|
action.setPageInfo({
|
|
658
626
|
current: 1
|
|
659
627
|
});
|
|
660
|
-
|
|
628
|
+
|
|
629
|
+
// 重置表单
|
|
630
|
+
formRef === null || formRef === void 0 || (_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.resetFields();
|
|
661
631
|
setFormSearch({});
|
|
662
632
|
},
|
|
663
|
-
editableUtils
|
|
633
|
+
editableUtils: editableUtils
|
|
664
634
|
});
|
|
635
|
+
|
|
636
|
+
/** 同步 action */
|
|
665
637
|
counter.setAction(actionRef.current);
|
|
666
|
-
|
|
667
|
-
|
|
638
|
+
|
|
639
|
+
// ---------- 列计算相关 start -----------------
|
|
640
|
+
var tableColumn = useMemo(function () {
|
|
641
|
+
var _props$expandable3;
|
|
668
642
|
return genProColumnToColumn({
|
|
669
643
|
columns: propsColumns,
|
|
670
|
-
counter,
|
|
671
|
-
columnEmptyText,
|
|
672
|
-
type,
|
|
644
|
+
counter: counter,
|
|
645
|
+
columnEmptyText: columnEmptyText,
|
|
646
|
+
type: type,
|
|
673
647
|
marginSM: token.marginSM,
|
|
674
|
-
editableUtils,
|
|
675
|
-
rowKey,
|
|
676
|
-
childrenColumnName: (
|
|
677
|
-
proFilter,
|
|
678
|
-
proSort
|
|
648
|
+
editableUtils: editableUtils,
|
|
649
|
+
rowKey: rowKey,
|
|
650
|
+
childrenColumnName: (_props$expandable3 = props.expandable) === null || _props$expandable3 === void 0 ? void 0 : _props$expandable3.childrenColumnName,
|
|
651
|
+
proFilter: proFilter,
|
|
652
|
+
proSort: proSort
|
|
679
653
|
}).sort(columnSort(counter.columnsMap));
|
|
680
|
-
}, [
|
|
681
|
-
propsColumns,
|
|
682
|
-
counter == null ? void 0 : counter.sortKeyColumns,
|
|
683
|
-
counter == null ? void 0 : counter.columnsMap,
|
|
684
|
-
columnEmptyText,
|
|
685
|
-
type,
|
|
686
654
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
);
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
)
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
655
|
+
}, [propsColumns, counter === null || counter === void 0 ? void 0 : counter.sortKeyColumns, counter === null || counter === void 0 ? void 0 : counter.columnsMap, columnEmptyText, type,
|
|
656
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
657
|
+
editableUtils.editableKeys && editableUtils.editableKeys.join(','), proFilter, proSort]);
|
|
658
|
+
|
|
659
|
+
/** Table Column 变化的时候更新一下,这个参数将会用于渲染 */
|
|
660
|
+
useDeepCompareEffectDebounce(function () {
|
|
661
|
+
if (tableColumn && tableColumn.length > 0) {
|
|
662
|
+
// 重新生成key的字符串用于排序
|
|
663
|
+
var columnKeys = tableColumn.map(function (item) {
|
|
664
|
+
return genColumnKey(item.key, item.index);
|
|
665
|
+
});
|
|
666
|
+
counter.setSortKeyColumns(columnKeys);
|
|
667
|
+
}
|
|
668
|
+
}, [tableColumn], ['render', 'formItemRender'], 100);
|
|
669
|
+
|
|
670
|
+
/** 同步 Pagination,支持受控的 页码 和 pageSize */
|
|
671
|
+
useDeepCompareEffect(function () {
|
|
672
|
+
var pageInfo = action.pageInfo;
|
|
673
|
+
var _ref5 = propsPagination || {},
|
|
674
|
+
_ref5$current = _ref5.current,
|
|
675
|
+
current = _ref5$current === void 0 ? pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.current : _ref5$current,
|
|
676
|
+
_ref5$pageSize = _ref5.pageSize,
|
|
677
|
+
pageSize = _ref5$pageSize === void 0 ? pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.pageSize : _ref5$pageSize;
|
|
678
|
+
if (propsPagination && (current || pageSize) && (pageSize !== (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.pageSize) || current !== (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.current))) {
|
|
708
679
|
action.setPageInfo({
|
|
709
680
|
pageSize: pageSize || pageInfo.pageSize,
|
|
710
681
|
current: current || pageInfo.current
|
|
711
682
|
});
|
|
712
683
|
}
|
|
713
|
-
}, [
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
onChange: (keys, rows, info) => {
|
|
684
|
+
}, [propsPagination && propsPagination.pageSize, propsPagination && propsPagination.current]);
|
|
685
|
+
|
|
686
|
+
/** 行选择相关的问题 */
|
|
687
|
+
var rowSelection = _objectSpread(_objectSpread({
|
|
688
|
+
selectedRowKeys: selectedRowKeys
|
|
689
|
+
}, propsRowSelection), {}, {
|
|
690
|
+
onChange: function onChange(keys, rows, info) {
|
|
721
691
|
if (propsRowSelection && propsRowSelection.onChange) {
|
|
722
692
|
propsRowSelection.onChange(keys, rows, info);
|
|
723
693
|
}
|
|
724
694
|
setSelectedRowKeys(keys);
|
|
725
695
|
}
|
|
726
696
|
});
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
697
|
+
|
|
698
|
+
/** 是不是 LightFilter, LightFilter 有一些特殊的处理 */
|
|
699
|
+
var isLightFilter = search !== false && (search === null || search === void 0 ? void 0 : search.filterType) === 'light';
|
|
700
|
+
var _onFormSearchSubmit = useCallback(function (values) {
|
|
701
|
+
// 判断search.onSearch返回值决定是否更新formSearch
|
|
702
|
+
if (options && options.search) {
|
|
703
|
+
var _options$search, _options$search$onSea;
|
|
704
|
+
var _ref6 = options.search === true ? {} : options.search,
|
|
705
|
+
_ref6$name = _ref6.name,
|
|
706
|
+
name = _ref6$name === void 0 ? 'keyword' : _ref6$name;
|
|
707
|
+
|
|
708
|
+
/** 如果传入的 onSearch 返回值为 false,则不要把options.search.name对应的值set到formSearch */
|
|
709
|
+
var success = (_options$search = options.search) === null || _options$search === void 0 || (_options$search$onSea = _options$search.onSearch) === null || _options$search$onSea === void 0 ? void 0 : _options$search$onSea.call(_options$search, counter.keyWords);
|
|
710
|
+
if (success !== false) {
|
|
711
|
+
setFormSearch(_objectSpread(_objectSpread({}, values), {}, _defineProperty({}, name, counter.keyWords)));
|
|
712
|
+
return;
|
|
743
713
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
)
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
return ((_a2 = action.loading) == null ? void 0 : _a2.spinning) || false;
|
|
714
|
+
}
|
|
715
|
+
setFormSearch(values);
|
|
716
|
+
}, [counter.keyWords, options, setFormSearch]);
|
|
717
|
+
var loading = useMemo(function () {
|
|
718
|
+
if (_typeof(action.loading) === 'object') {
|
|
719
|
+
var _action$loading;
|
|
720
|
+
return ((_action$loading = action.loading) === null || _action$loading === void 0 ? void 0 : _action$loading.spinning) || false;
|
|
752
721
|
}
|
|
753
722
|
return action.loading;
|
|
754
723
|
}, [action.loading]);
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
dateFormatter: props.dateFormatter
|
|
777
|
-
}
|
|
778
|
-
);
|
|
724
|
+
var searchNode = useMemo(function () {
|
|
725
|
+
var node = search === false && type !== 'form' ? null : /*#__PURE__*/_jsx(FormRender, {
|
|
726
|
+
pagination: pagination,
|
|
727
|
+
beforeSearchSubmit: beforeSearchSubmit,
|
|
728
|
+
action: actionRef,
|
|
729
|
+
columns: propsColumns,
|
|
730
|
+
onFormSearchSubmit: function onFormSearchSubmit(values) {
|
|
731
|
+
_onFormSearchSubmit(values);
|
|
732
|
+
},
|
|
733
|
+
ghost: ghost,
|
|
734
|
+
onReset: props.onReset,
|
|
735
|
+
onSubmit: props.onSubmit,
|
|
736
|
+
loading: !!loading,
|
|
737
|
+
manualRequest: manualRequest,
|
|
738
|
+
search: search,
|
|
739
|
+
form: props.form,
|
|
740
|
+
formRef: formRef,
|
|
741
|
+
type: props.type || 'table',
|
|
742
|
+
cardBordered: props.cardBordered,
|
|
743
|
+
dateFormatter: props.dateFormatter
|
|
744
|
+
});
|
|
779
745
|
if (searchFormRender && node) {
|
|
780
|
-
return
|
|
746
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
747
|
+
children: searchFormRender(props, node)
|
|
748
|
+
});
|
|
781
749
|
} else {
|
|
782
750
|
return node;
|
|
783
751
|
}
|
|
784
|
-
}, [
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
() => options === false && !headerTitle && !toolBarRender && !toolbar && !isLightFilter,
|
|
807
|
-
[options, headerTitle, toolBarRender, toolbar, isLightFilter]
|
|
808
|
-
);
|
|
809
|
-
const toolbarDom = toolBarRender === false ? null : /* @__PURE__ */ React.createElement(
|
|
810
|
-
Toolbar,
|
|
811
|
-
{
|
|
812
|
-
headerTitle,
|
|
813
|
-
hideToolbar,
|
|
814
|
-
selectedRows,
|
|
815
|
-
selectedRowKeys,
|
|
816
|
-
tableColumn,
|
|
817
|
-
tooltip,
|
|
818
|
-
toolbar,
|
|
819
|
-
onFormSearchSubmit: (newValues) => {
|
|
820
|
-
setFormSearch(__spreadValues(__spreadValues({}, formSearch), newValues));
|
|
821
|
-
},
|
|
822
|
-
searchNode: isLightFilter ? searchNode : null,
|
|
823
|
-
options,
|
|
824
|
-
optionsRender,
|
|
825
|
-
actionRef,
|
|
826
|
-
toolBarRender
|
|
827
|
-
}
|
|
828
|
-
);
|
|
829
|
-
const alertDom = propsRowSelection !== false ? /* @__PURE__ */ React.createElement(
|
|
830
|
-
Alert,
|
|
831
|
-
{
|
|
832
|
-
selectedRowKeys,
|
|
833
|
-
selectedRows,
|
|
834
|
-
onCleanSelected,
|
|
835
|
-
alertOptionRender: rest.tableAlertOptionRender,
|
|
836
|
-
alertInfoRender: tableAlertRender,
|
|
837
|
-
alwaysShowAlert: propsRowSelection == null ? void 0 : propsRowSelection.alwaysShowAlert
|
|
838
|
-
}
|
|
839
|
-
) : null;
|
|
840
|
-
return wrapSSR(
|
|
841
|
-
/* @__PURE__ */ React.createElement(
|
|
842
|
-
TableRender,
|
|
843
|
-
__spreadProps(__spreadValues({}, props), {
|
|
844
|
-
name: isEditorTable,
|
|
845
|
-
defaultClassName,
|
|
846
|
-
size: counter.tableSize,
|
|
847
|
-
onSizeChange: counter.setTableSize,
|
|
848
|
-
pagination,
|
|
849
|
-
searchNode,
|
|
850
|
-
rowSelection: propsRowSelection !== false ? rowSelection : void 0,
|
|
851
|
-
className,
|
|
852
|
-
tableColumn,
|
|
853
|
-
isLightFilter,
|
|
854
|
-
action,
|
|
855
|
-
alertDom,
|
|
856
|
-
toolbarDom,
|
|
857
|
-
hideToolbar,
|
|
858
|
-
onSortChange: (sortConfig) => {
|
|
859
|
-
if (useLocaleSorter || sortConfig === proSort)
|
|
860
|
-
return;
|
|
861
|
-
setProSort(sortConfig);
|
|
862
|
-
},
|
|
863
|
-
onFilterChange: (filterConfig) => {
|
|
864
|
-
if (useLocaleFilter || filterConfig === proFilter)
|
|
865
|
-
return;
|
|
866
|
-
setProFilter(filterConfig);
|
|
867
|
-
},
|
|
868
|
-
editableUtils,
|
|
869
|
-
getRowKey
|
|
870
|
-
})
|
|
871
|
-
)
|
|
872
|
-
);
|
|
873
|
-
};
|
|
874
|
-
var ProviderTableContainer = (props) => {
|
|
875
|
-
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
876
|
-
const ErrorComponent = props.ErrorBoundary === false ? React.Fragment : props.ErrorBoundary || ErrorBoundary;
|
|
877
|
-
const context = useContext(ProConfigContext);
|
|
878
|
-
return /* @__PURE__ */ React.createElement(Container, { initValue: props }, /* @__PURE__ */ React.createElement(
|
|
879
|
-
ProConfigProvider,
|
|
880
|
-
{
|
|
881
|
-
valueTypeMap: __spreadValues(__spreadValues({}, context.valueTypeMap), ValueTypeToComponent),
|
|
882
|
-
needDeps: true
|
|
752
|
+
}, [beforeSearchSubmit, formRef, ghost, loading, manualRequest, _onFormSearchSubmit, pagination, props, propsColumns, search, searchFormRender, type]);
|
|
753
|
+
var selectedRows = useMemo(function () {
|
|
754
|
+
return selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.map(function (key) {
|
|
755
|
+
var _preserveRecordsRef$c;
|
|
756
|
+
return (_preserveRecordsRef$c = preserveRecordsRef.current) === null || _preserveRecordsRef$c === void 0 ? void 0 : _preserveRecordsRef$c.get(key);
|
|
757
|
+
});
|
|
758
|
+
}, [action.dataSource, selectedRowKeys]);
|
|
759
|
+
var hideToolbar = useMemo(function () {
|
|
760
|
+
return options === false && !headerTitle && !toolBarRender && !toolbar && !isLightFilter;
|
|
761
|
+
}, [options, headerTitle, toolBarRender, toolbar, isLightFilter]);
|
|
762
|
+
|
|
763
|
+
/** 内置的工具栏 */
|
|
764
|
+
var toolbarDom = toolBarRender === false ? null : /*#__PURE__*/_jsx(Toolbar, {
|
|
765
|
+
headerTitle: headerTitle,
|
|
766
|
+
hideToolbar: hideToolbar,
|
|
767
|
+
selectedRows: selectedRows,
|
|
768
|
+
selectedRowKeys: selectedRowKeys,
|
|
769
|
+
tableColumn: tableColumn,
|
|
770
|
+
tooltip: tooltip,
|
|
771
|
+
toolbar: toolbar,
|
|
772
|
+
onFormSearchSubmit: function onFormSearchSubmit(newValues) {
|
|
773
|
+
setFormSearch(_objectSpread(_objectSpread({}, formSearch), newValues));
|
|
883
774
|
},
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
775
|
+
searchNode: isLightFilter ? searchNode : null,
|
|
776
|
+
options: options,
|
|
777
|
+
optionsRender: optionsRender,
|
|
778
|
+
actionRef: actionRef,
|
|
779
|
+
toolBarRender: toolBarRender
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
/** 内置的多选操作栏 */
|
|
783
|
+
var alertDom = propsRowSelection !== false ? /*#__PURE__*/_jsx(Alert, {
|
|
784
|
+
selectedRowKeys: selectedRowKeys,
|
|
785
|
+
selectedRows: selectedRows,
|
|
786
|
+
onCleanSelected: _onCleanSelected,
|
|
787
|
+
alertOptionRender: rest.tableAlertOptionRender,
|
|
788
|
+
alertInfoRender: tableAlertRender,
|
|
789
|
+
alwaysShowAlert: propsRowSelection === null || propsRowSelection === void 0 ? void 0 : propsRowSelection.alwaysShowAlert
|
|
790
|
+
}) : null;
|
|
791
|
+
return wrapSSR( /*#__PURE__*/_jsx(TableRender, _objectSpread(_objectSpread({}, props), {}, {
|
|
792
|
+
name: isEditorTable,
|
|
793
|
+
defaultClassName: defaultClassName,
|
|
794
|
+
size: counter.tableSize,
|
|
795
|
+
onSizeChange: counter.setTableSize,
|
|
796
|
+
pagination: pagination,
|
|
797
|
+
searchNode: searchNode,
|
|
798
|
+
rowSelection: propsRowSelection !== false ? rowSelection : undefined,
|
|
799
|
+
className: className,
|
|
800
|
+
tableColumn: tableColumn,
|
|
801
|
+
isLightFilter: isLightFilter,
|
|
802
|
+
action: action,
|
|
803
|
+
alertDom: alertDom,
|
|
804
|
+
toolbarDom: toolbarDom,
|
|
805
|
+
hideToolbar: hideToolbar,
|
|
806
|
+
onSortChange: function onSortChange(sortConfig) {
|
|
807
|
+
if (useLocaleSorter || sortConfig === proSort) return;
|
|
808
|
+
setProSort(sortConfig);
|
|
809
|
+
},
|
|
810
|
+
onFilterChange: function onFilterChange(filterConfig) {
|
|
811
|
+
if (useLocaleFilter || filterConfig === proFilter) return;
|
|
812
|
+
setProFilter(filterConfig);
|
|
813
|
+
},
|
|
814
|
+
editableUtils: editableUtils,
|
|
815
|
+
getRowKey: getRowKey
|
|
816
|
+
})));
|
|
891
817
|
};
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* 🏆 Use Ant Design Table like a Pro! 更快 更好 更方便
|
|
821
|
+
*
|
|
822
|
+
* @param props
|
|
823
|
+
*/
|
|
824
|
+
var ProviderTableContainer = function ProviderTableContainer(props) {
|
|
825
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
826
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
827
|
+
var ErrorComponent = props.ErrorBoundary === false ? React.Fragment : props.ErrorBoundary || ErrorBoundary;
|
|
828
|
+
var context = useContext(ProConfigContext);
|
|
829
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
830
|
+
initValue: props,
|
|
831
|
+
children: /*#__PURE__*/_jsx(ProConfigProvider, {
|
|
832
|
+
valueTypeMap: _objectSpread(_objectSpread({}, context.valueTypeMap), ValueTypeToComponent),
|
|
833
|
+
needDeps: true,
|
|
834
|
+
children: /*#__PURE__*/_jsx(ErrorComponent, {
|
|
835
|
+
children: /*#__PURE__*/_jsx(ProTable, _objectSpread({
|
|
836
|
+
defaultClassName: "".concat(getPrefixCls('pro-table'))
|
|
837
|
+
}, props))
|
|
838
|
+
})
|
|
839
|
+
})
|
|
840
|
+
});
|
|
896
841
|
};
|
|
842
|
+
ProviderTableContainer.Summary = Table.Summary;
|
|
843
|
+
export default ProviderTableContainer;
|