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