@ant-design/pro-components 3.1.0-0 → 3.1.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es-PR.md +1 -3
- package/README.md +8 -10
- package/README.zh-CN.md +11 -11
- package/dist/pro-components.min.js +1 -1
- package/es/card/ProCard.js +8 -10
- package/es/card/components/Actions/index.js +25 -25
- package/es/card/components/Actions/style.js +79 -71
- package/es/card/components/Card/index.js +157 -142
- package/es/card/components/Card/style.js +249 -192
- package/es/card/components/CheckCard/Group.js +94 -115
- package/es/card/components/CheckCard/index.js +85 -79
- package/es/card/components/CheckCard/style.js +184 -168
- package/es/card/components/Divider/index.js +19 -15
- package/es/card/components/Divider/style.js +32 -29
- package/es/card/components/Loading/index.js +19 -16
- package/es/card/components/Loading/style.js +34 -31
- package/es/card/components/Operation/index.js +16 -13
- package/es/card/components/Operation/style.js +19 -18
- package/es/card/components/Statistic/index.js +46 -41
- package/es/card/components/Statistic/style.js +89 -70
- package/es/card/components/StatisticCard/index.js +46 -41
- package/es/card/components/StatisticCard/style.js +37 -35
- package/es/descriptions/index.js +214 -225
- package/es/descriptions/useFetchData.js +53 -91
- package/es/field/AllProField.js +265 -216
- package/es/field/FieldHOC/index.js +9 -14
- package/es/field/PureProField.js +82 -80
- package/es/field/ValueTypeToComponent.js +517 -618
- package/es/field/components/Cascader/index.d.ts +2 -2
- package/es/field/components/Cascader/index.js +65 -84
- package/es/field/components/Checkbox/index.d.ts +1 -1
- package/es/field/components/Checkbox/index.js +75 -72
- package/es/field/components/Code/index.js +40 -39
- package/es/field/components/ColorPicker/index.d.ts +2 -2
- package/es/field/components/ColorPicker/index.js +38 -32
- package/es/field/components/DatePicker/index.d.ts +2 -2
- package/es/field/components/DatePicker/index.js +49 -53
- package/es/field/components/Digit/index.js +41 -42
- package/es/field/components/DigitRange/index.js +71 -77
- package/es/field/components/FromNow/index.js +27 -25
- package/es/field/components/Image/index.js +28 -24
- package/es/field/components/IndexColumn/index.js +22 -16
- package/es/field/components/Money/index.js +107 -116
- package/es/field/components/Options/index.js +34 -33
- package/es/field/components/Password/index.js +35 -38
- package/es/field/components/Percent/index.js +40 -44
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/Percent/util.js +3 -5
- package/es/field/components/Progress/index.js +29 -27
- package/es/field/components/Radio/index.d.ts +1 -1
- package/es/field/components/Radio/index.js +61 -62
- package/es/field/components/RangePicker/index.d.ts +2 -2
- package/es/field/components/RangePicker/index.js +52 -63
- package/es/field/components/Rate/index.js +24 -21
- package/es/field/components/Second/index.js +36 -33
- package/es/field/components/Segmented/index.d.ts +1 -1
- package/es/field/components/Segmented/index.js +37 -46
- package/es/field/components/Select/LightSelect/index.d.ts +1 -1
- package/es/field/components/Select/LightSelect/index.js +102 -109
- package/es/field/components/Select/SearchSelect/index.js +129 -155
- package/es/field/components/Select/index.d.ts +1 -1
- package/es/field/components/Select/index.js +193 -219
- package/es/field/components/Slider/index.js +25 -22
- package/es/field/components/Status/index.js +67 -78
- package/es/field/components/Switch/index.d.ts +1 -1
- package/es/field/components/Switch/index.js +32 -30
- package/es/field/components/Text/index.js +34 -37
- package/es/field/components/TextArea/index.js +26 -21
- package/es/field/components/TextArea/readonly.js +24 -21
- package/es/field/components/TimePicker/index.js +96 -105
- package/es/field/components/TreeSelect/index.d.ts +2 -2
- package/es/field/components/TreeSelect/index.js +107 -125
- package/es/form/BaseForm/BaseForm.js +416 -502
- package/es/form/BaseForm/EditOrReadOnlyContext.js +1 -1
- package/es/form/BaseForm/LightWrapper/index.js +56 -65
- package/es/form/BaseForm/LightWrapper/style.js +17 -13
- package/es/form/BaseForm/Submitter/index.js +44 -43
- package/es/form/FieldContext.js +1 -1
- package/es/form/components/Captcha/index.js +74 -134
- package/es/form/components/Cascader/index.js +26 -28
- package/es/form/components/Checkbox/index.js +60 -61
- package/es/form/components/ColorPicker/index.js +24 -26
- package/es/form/components/DatePicker/BaseDatePicker.js +32 -30
- package/es/form/components/DatePicker/DatePicker.js +14 -13
- package/es/form/components/DatePicker/DateTimePicker.js +11 -12
- package/es/form/components/DatePicker/MonthPicker.js +14 -13
- package/es/form/components/DatePicker/QuarterPicker.js +14 -13
- package/es/form/components/DatePicker/TimePicker.js +26 -27
- package/es/form/components/DatePicker/WeekPicker.js +14 -13
- package/es/form/components/DatePicker/YearPicker.js +14 -13
- package/es/form/components/DatePicker/index.js +1 -1
- package/es/form/components/DateRangePicker/BaseDateRanger.js +34 -34
- package/es/form/components/DateRangePicker/DateMonthRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateQuarterRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateTimeRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateWeekRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/DateYearRangePicker.js +15 -16
- package/es/form/components/DateRangePicker/TimeRangePicker.js +26 -29
- package/es/form/components/DateRangePicker/index.js +15 -16
- package/es/form/components/Dependency/index.js +31 -34
- package/es/form/components/Digit/DigitRange.js +23 -24
- package/es/form/components/Digit/index.js +27 -29
- package/es/form/components/Field/index.js +55 -63
- package/es/form/components/FieldSet/index.js +68 -76
- package/es/form/components/FormItem/FormItemRender/index.js +58 -48
- package/es/form/components/FormItem/Group/index.js +95 -95
- package/es/form/components/FormItem/Group/style.js +46 -40
- package/es/form/components/FormItem/index.js +135 -141
- package/es/form/components/FormItem/warpField.js +165 -149
- package/es/form/components/List/ListContainer.js +98 -189
- package/es/form/components/List/ListItem.js +151 -198
- package/es/form/components/List/index.js +97 -107
- package/es/form/components/List/style.js +71 -47
- package/es/form/components/Money/index.js +28 -30
- package/es/form/components/Radio/index.js +45 -49
- package/es/form/components/Rate/index.js +17 -20
- package/es/form/components/SchemaForm/index.js +58 -72
- package/es/form/components/SchemaForm/layoutType/Embed.js +5 -6
- package/es/form/components/SchemaForm/layoutType/StepsForm.js +22 -26
- package/es/form/components/SchemaForm/valueType/dependency.js +11 -11
- package/es/form/components/SchemaForm/valueType/divider.js +4 -5
- package/es/form/components/SchemaForm/valueType/field.js +45 -44
- package/es/form/components/SchemaForm/valueType/formList.js +8 -7
- package/es/form/components/SchemaForm/valueType/formSet.js +8 -7
- package/es/form/components/SchemaForm/valueType/group.js +7 -8
- package/es/form/components/SchemaForm/valueType/ignore.js +2 -2
- package/es/form/components/SchemaForm/valueType/index.js +5 -5
- package/es/form/components/Segmented/index.js +20 -23
- package/es/form/components/Select/index.js +69 -73
- package/es/form/components/Slider/index.js +33 -35
- package/es/form/components/Switch/index.js +24 -26
- package/es/form/components/Text/index.js +75 -86
- package/es/form/components/TextArea/index.js +17 -20
- package/es/form/components/TreeSelect/index.js +20 -23
- package/es/form/components/UploadButton/index.js +56 -103
- package/es/form/components/UploadDragger/index.js +37 -44
- package/es/form/helpers/grid.js +65 -67
- package/es/form/layouts/DrawerForm/index.js +150 -241
- package/es/form/layouts/DrawerForm/style.js +26 -25
- package/es/form/layouts/LightFilter/index.d.ts +12 -1
- package/es/form/layouts/LightFilter/index.js +158 -140
- package/es/form/layouts/LightFilter/style.js +52 -48
- package/es/form/layouts/LoginForm/index.js +44 -47
- package/es/form/layouts/LoginForm/style.js +71 -67
- package/es/form/layouts/LoginFormPage/index.js +45 -48
- package/es/form/layouts/LoginFormPage/style.js +136 -126
- package/es/form/layouts/ModalForm/index.js +119 -203
- package/es/form/layouts/ProForm/index.d.ts +2 -2
- package/es/form/layouts/ProForm/index.js +5 -5
- package/es/form/layouts/QueryFilter/Actions.js +23 -22
- package/es/form/layouts/QueryFilter/index.js +178 -203
- package/es/form/layouts/QueryFilter/style.js +45 -37
- package/es/form/layouts/StepsForm/StepForm.d.ts +2 -3
- package/es/form/layouts/StepsForm/StepForm.js +50 -71
- package/es/form/layouts/StepsForm/index.js +175 -217
- package/es/form/layouts/StepsForm/style.js +30 -28
- package/es/form/layouts/index.js +1 -1
- package/es/layout/ProLayout.js +281 -292
- package/es/layout/WrapContent.js +16 -12
- package/es/layout/assert/Logo.js +95 -97
- package/es/layout/components/AppsLogoComponents/AppsLogo.js +10 -12
- package/es/layout/components/AppsLogoComponents/DefaultContent.js +17 -16
- package/es/layout/components/AppsLogoComponents/SimpleContent.js +19 -18
- package/es/layout/components/AppsLogoComponents/index.js +33 -38
- package/es/layout/components/AppsLogoComponents/style/default.js +2 -2
- package/es/layout/components/AppsLogoComponents/style/index.js +52 -50
- package/es/layout/components/AppsLogoComponents/style/simple.js +1 -1
- package/es/layout/components/CollapsedIcon/index.js +18 -15
- package/es/layout/components/CollapsedIcon/style.js +40 -40
- package/es/layout/components/Footer.js +22 -21
- package/es/layout/components/FooterToolbar/index.js +58 -52
- package/es/layout/components/FooterToolbar/style/index.js +38 -37
- package/es/layout/components/FooterToolbar/style/stylish.js +11 -9
- package/es/layout/components/GlobalFooter/index.js +25 -25
- package/es/layout/components/GlobalFooter/style.js +31 -30
- package/es/layout/components/GlobalHeader/ActionsContent.js +62 -78
- package/es/layout/components/GlobalHeader/index.js +59 -47
- package/es/layout/components/GlobalHeader/rightContentStyle.js +49 -49
- package/es/layout/components/GlobalHeader/style.js +58 -54
- package/es/layout/components/GridContent/index.js +24 -19
- package/es/layout/components/GridContent/style.js +14 -13
- package/es/layout/components/Header/index.js +63 -57
- package/es/layout/components/Header/style/header.js +49 -47
- package/es/layout/components/Header/style/stylish.js +15 -11
- package/es/layout/components/Help/AsyncContentPanel.js +13 -18
- package/es/layout/components/Help/HelpProvide.js +1 -1
- package/es/layout/components/Help/ProHelpContentPanel.js +64 -83
- package/es/layout/components/Help/ProHelpDrawer.js +25 -31
- package/es/layout/components/Help/ProHelpModal.d.ts +1 -1
- package/es/layout/components/Help/ProHelpModal.js +24 -27
- package/es/layout/components/Help/ProHelpPanel.js +86 -94
- package/es/layout/components/Help/ProHelpPopover.js +18 -16
- package/es/layout/components/Help/RenderContentPanel.js +34 -24
- package/es/layout/components/Help/Search.js +52 -78
- package/es/layout/components/Help/index.js +9 -11
- package/es/layout/components/Help/style.js +82 -75
- package/es/layout/components/PageContainer/index.js +168 -149
- package/es/layout/components/PageContainer/style/index.js +95 -78
- package/es/layout/components/PageContainer/style/stylish.js +11 -9
- package/es/layout/components/PageHeader/index.js +96 -97
- package/es/layout/components/PageHeader/style/index.js +142 -122
- package/es/layout/components/PageLoading/index.js +17 -20
- package/es/layout/components/SettingDrawer/BlockCheckbox.js +29 -32
- package/es/layout/components/SettingDrawer/LayoutChange.js +22 -22
- package/es/layout/components/SettingDrawer/RegionalChange.js +14 -15
- package/es/layout/components/SettingDrawer/ThemeColor.js +32 -35
- package/es/layout/components/SettingDrawer/index.js +137 -168
- package/es/layout/components/SettingDrawer/style/index.js +141 -137
- package/es/layout/components/SiderMenu/BaseMenu.js +235 -221
- package/es/layout/components/SiderMenu/SiderMenu.js +125 -115
- package/es/layout/components/SiderMenu/index.js +47 -42
- package/es/layout/components/SiderMenu/style/index.js +179 -161
- package/es/layout/components/SiderMenu/style/menu.js +148 -110
- package/es/layout/components/SiderMenu/style/stylish.js +15 -11
- package/es/layout/components/TopNavHeader/index.js +71 -60
- package/es/layout/components/TopNavHeader/style.js +64 -63
- package/es/layout/context/RouteContext.js +1 -1
- package/es/layout/defaultSettings.js +1 -1
- package/es/layout/getPageTitle.js +23 -24
- package/es/layout/locales/en-US.js +3 -2
- package/es/layout/locales/index.js +5 -5
- package/es/layout/locales/it-IT.js +3 -2
- package/es/layout/locales/ko-KR.js +3 -2
- package/es/layout/locales/zh-CN.js +3 -2
- package/es/layout/locales/zh-TW.js +3 -2
- package/es/layout/style/index.js +48 -42
- package/es/layout/utils/getBreadcrumbProps.js +60 -60
- package/es/layout/utils/getMenuData.js +7 -11
- package/es/layout/utils/pathTools.js +2 -6
- package/es/layout/utils/useCurrentMenuLayoutProps.js +4 -9
- package/es/layout/utils/utils.js +15 -17
- package/es/list/Item.js +157 -137
- package/es/list/ListView.js +106 -115
- package/es/list/constants.js +2 -2
- package/es/list/index.js +72 -70
- package/es/list/style/index.js +281 -213
- package/es/provider/index.js +122 -115
- package/es/provider/intl.js +53 -55
- package/es/provider/typing/layoutToken.js +26 -23
- package/es/provider/useStyle/index.js +51 -59
- package/es/provider/utils/merge.js +10 -12
- package/es/skeleton/components/Descriptions/index.js +211 -229
- package/es/skeleton/components/List/index.js +208 -223
- package/es/skeleton/components/Result/index.js +45 -47
- package/es/skeleton/index.js +13 -10
- package/es/table/Store/Provide.d.ts +4 -4
- package/es/table/Store/Provide.js +102 -117
- package/es/table/Table.d.ts +5 -2
- package/es/table/Table.js +526 -691
- package/es/table/TableSearch.d.ts +24 -0
- package/es/table/TableSearch.js +54 -0
- package/es/table/TableToolbar.d.ts +22 -0
- package/es/table/TableToolbar.js +47 -0
- package/es/table/components/Alert/index.js +41 -40
- package/es/table/components/Alert/style.js +28 -27
- package/es/table/components/ColumnSetting/index.js +228 -223
- package/es/table/components/ColumnSetting/style.js +86 -71
- package/es/table/components/DragSortTable/index.js +65 -79
- package/es/table/components/DragSortTable/style.js +20 -19
- package/es/table/components/Dropdown/index.js +42 -47
- package/es/table/components/EditableTable/CellEditorTable.js +24 -32
- package/es/table/components/EditableTable/RowEditorTable.js +23 -28
- package/es/table/components/EditableTable/index.js +295 -329
- package/es/table/components/Form/FormRender.js +99 -103
- package/es/table/components/Form/index.d.ts +4 -19
- package/es/table/components/Form/index.js +112 -159
- package/es/table/components/ListToolBar/HeaderMenu.js +44 -52
- package/es/table/components/ListToolBar/index.js +122 -147
- package/es/table/components/ListToolBar/style.js +127 -117
- package/es/table/components/ToolBar/DensityIcon.js +10 -9
- package/es/table/components/ToolBar/FullscreenIcon.js +5 -9
- package/es/table/components/ToolBar/index.d.ts +2 -8
- package/es/table/components/ToolBar/index.js +155 -195
- package/es/table/style/index.js +144 -112
- package/es/table/typing.d.ts +4 -0
- package/es/table/useFetchData.js +199 -338
- package/es/table/utils/cellRenderToFromItem.js +105 -119
- package/es/table/utils/columnRender.js +63 -54
- package/es/table/utils/columnSort.js +22 -22
- package/es/table/utils/genProColumnToColumn.d.ts +13 -9
- package/es/table/utils/genProColumnToColumn.js +121 -98
- package/es/table/utils/index.d.ts +10 -0
- package/es/table/utils/index.js +112 -178
- package/es/table/utils/useDragSort.d.ts +1 -1
- package/es/table/utils/useDragSort.js +99 -92
- package/es/table/utils/usePageInfo.d.ts +6 -0
- package/es/table/utils/usePageInfo.js +55 -0
- package/es/utils/components/DropdownFooter/index.js +23 -21
- package/es/utils/components/DropdownFooter/style.js +16 -15
- package/es/utils/components/ErrorBoundary/index.js +27 -50
- package/es/utils/components/FieldLabel/index.js +70 -70
- package/es/utils/components/FieldLabel/style.js +104 -81
- package/es/utils/components/FilterDropdown/index.d.ts +11 -0
- package/es/utils/components/FilterDropdown/index.js +43 -32
- package/es/utils/components/FilterDropdown/style.js +19 -16
- package/es/utils/components/InlineErrorFormItem/index.js +78 -78
- package/es/utils/components/InlineErrorFormItem/style.js +56 -49
- package/es/utils/components/LabelIconTip/index.js +30 -31
- package/es/utils/components/LabelIconTip/style.js +36 -35
- package/es/utils/components/ProFormContext/index.js +1 -1
- package/es/utils/conversionMomentValue/index.js +19 -22
- package/es/utils/dateArrayFormatter/index.js +9 -14
- package/es/utils/genCopyable/index.js +74 -32
- package/es/utils/getFieldPropsOrFormItemProps/index.js +1 -1
- package/es/utils/hooks/useDebounceFn/index.js +18 -51
- package/es/utils/hooks/useDebounceValue/index.js +7 -16
- package/es/utils/hooks/useDeepCompareEffect/index.js +6 -18
- package/es/utils/hooks/useDocumentTitle/index.js +2 -2
- package/es/utils/hooks/useFetchData/index.js +36 -65
- package/es/utils/hooks/useForceRender/index.js +2 -9
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/usePrevious/index.js +3 -3
- package/es/utils/hooks/useReactiveRef/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +3 -3
- package/es/utils/hooks/useRefFunction/index.js +4 -9
- package/es/utils/index.d.ts +1 -2
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +2 -2
- package/es/utils/isDeepEqualReact/index.js +9 -44
- package/es/utils/isDropdownValueType/index.js +2 -2
- package/es/utils/isNil/index.js +1 -3
- package/es/utils/isUrl/index.js +2 -2
- package/es/utils/merge/index.js +10 -12
- package/es/utils/nanoid/index.js +5 -6
- package/es/utils/omitBoolean/index.js +1 -1
- package/es/utils/omitUndefined/index.js +3 -3
- package/es/utils/omitUndefinedAndEmptyArr/index.js +4 -5
- package/es/utils/parseValueToMoment/index.js +3 -7
- package/es/utils/pickProFormItemProps/index.js +3 -3
- package/es/utils/pickProProps/index.js +6 -7
- package/es/utils/proFieldParsingText/index.js +85 -98
- package/es/utils/runFunction/index.js +2 -5
- package/es/utils/stringify/index.js +1 -1
- package/es/utils/transformKeySubmitValue/index.js +99 -116
- package/es/utils/useEditableArray/index.d.ts +6 -1
- package/es/utils/useEditableArray/index.js +579 -735
- package/es/utils/useEditableMap/index.d.ts +1 -1
- package/es/utils/useEditableMap/index.js +89 -135
- package/es/utils/useMediaQuery/index.js +16 -18
- package/es/utils/useMediaQuery/query.js +7 -17
- package/es/version.js +1 -1
- package/lib/card/ProCard.js +8 -10
- package/lib/card/components/Actions/index.js +25 -25
- package/lib/card/components/Actions/style.js +79 -72
- package/lib/card/components/Card/index.js +154 -139
- package/lib/card/components/Card/style.js +249 -193
- package/lib/card/components/CheckCard/Group.js +97 -115
- package/lib/card/components/CheckCard/index.js +85 -78
- package/lib/card/components/CheckCard/style.js +184 -169
- package/lib/card/components/Divider/index.js +20 -16
- package/lib/card/components/Divider/style.js +32 -30
- package/lib/card/components/Loading/index.js +19 -16
- package/lib/card/components/Loading/style.js +34 -32
- package/lib/card/components/Operation/index.js +16 -14
- package/lib/card/components/Operation/style.js +19 -19
- package/lib/card/components/Statistic/index.js +46 -42
- package/lib/card/components/Statistic/style.js +89 -71
- package/lib/card/components/StatisticCard/index.js +46 -41
- package/lib/card/components/StatisticCard/style.js +37 -36
- package/lib/card/index.js +4 -4
- package/lib/descriptions/index.js +219 -225
- package/lib/descriptions/useFetchData.js +51 -90
- package/lib/field/AllProField.js +267 -217
- package/lib/field/FieldHOC/index.js +9 -15
- package/lib/field/PureProField.js +84 -82
- package/lib/field/ValueTypeToComponent.js +517 -618
- package/lib/field/components/Cascader/index.d.ts +2 -2
- package/lib/field/components/Cascader/index.js +65 -85
- package/lib/field/components/Checkbox/index.d.ts +1 -1
- package/lib/field/components/Checkbox/index.js +75 -73
- package/lib/field/components/Code/index.js +40 -39
- package/lib/field/components/ColorPicker/index.js +38 -33
- package/lib/field/components/DatePicker/index.d.ts +1 -1
- package/lib/field/components/DatePicker/index.js +49 -53
- package/lib/field/components/Digit/index.js +41 -43
- package/lib/field/components/DigitRange/index.js +69 -76
- package/lib/field/components/FromNow/index.js +27 -25
- package/lib/field/components/Image/index.js +28 -24
- package/lib/field/components/IndexColumn/index.js +22 -17
- package/lib/field/components/Money/index.js +106 -116
- package/lib/field/components/Options/index.js +34 -34
- package/lib/field/components/Password/index.js +35 -38
- package/lib/field/components/Percent/index.js +40 -45
- package/lib/field/components/Percent/util.js +3 -6
- package/lib/field/components/Progress/index.js +29 -28
- package/lib/field/components/Radio/index.d.ts +1 -1
- package/lib/field/components/Radio/index.js +61 -63
- package/lib/field/components/RangePicker/index.d.ts +1 -1
- package/lib/field/components/RangePicker/index.js +52 -63
- package/lib/field/components/Rate/index.js +24 -21
- package/lib/field/components/Second/index.js +36 -33
- package/lib/field/components/Segmented/index.d.ts +1 -1
- package/lib/field/components/Segmented/index.js +37 -48
- package/lib/field/components/Select/LightSelect/index.d.ts +1 -1
- package/lib/field/components/Select/LightSelect/index.js +103 -110
- package/lib/field/components/Select/SearchSelect/index.js +133 -156
- package/lib/field/components/Select/index.d.ts +1 -1
- package/lib/field/components/Select/index.js +194 -218
- package/lib/field/components/Slider/index.js +25 -22
- package/lib/field/components/Status/index.js +69 -79
- package/lib/field/components/Switch/index.d.ts +1 -1
- package/lib/field/components/Switch/index.js +32 -31
- package/lib/field/components/Text/index.js +34 -38
- package/lib/field/components/TextArea/index.js +26 -21
- package/lib/field/components/TextArea/readonly.js +24 -22
- package/lib/field/components/TimePicker/index.js +96 -105
- package/lib/field/components/TreeSelect/index.d.ts +2 -2
- package/lib/field/components/TreeSelect/index.js +105 -124
- package/lib/field/index.js +34 -34
- package/lib/form/BaseForm/BaseForm.js +413 -499
- package/lib/form/BaseForm/EditOrReadOnlyContext.js +1 -1
- package/lib/form/BaseForm/LightWrapper/index.js +57 -66
- package/lib/form/BaseForm/LightWrapper/style.js +17 -14
- package/lib/form/BaseForm/Submitter/index.js +44 -44
- package/lib/form/BaseForm/index.js +3 -3
- package/lib/form/FieldContext.js +1 -1
- package/lib/form/components/Captcha/index.js +74 -135
- package/lib/form/components/Cascader/index.js +26 -29
- package/lib/form/components/Checkbox/index.js +60 -61
- package/lib/form/components/ColorPicker/index.js +24 -26
- package/lib/form/components/DatePicker/BaseDatePicker.js +32 -30
- package/lib/form/components/DatePicker/DatePicker.js +14 -13
- package/lib/form/components/DatePicker/DateTimePicker.js +11 -12
- package/lib/form/components/DatePicker/MonthPicker.js +14 -13
- package/lib/form/components/DatePicker/QuarterPicker.js +14 -13
- package/lib/form/components/DatePicker/TimePicker.js +26 -27
- package/lib/form/components/DatePicker/WeekPicker.js +14 -13
- package/lib/form/components/DatePicker/YearPicker.js +14 -13
- package/lib/form/components/DatePicker/index.js +1 -1
- package/lib/form/components/DateRangePicker/BaseDateRanger.js +34 -34
- package/lib/form/components/DateRangePicker/DateMonthRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateQuarterRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateTimeRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateWeekRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/DateYearRangePicker.js +15 -16
- package/lib/form/components/DateRangePicker/TimeRangePicker.js +26 -29
- package/lib/form/components/DateRangePicker/index.js +15 -16
- package/lib/form/components/Dependency/index.js +31 -35
- package/lib/form/components/Digit/DigitRange.js +23 -24
- package/lib/form/components/Digit/index.js +27 -29
- package/lib/form/components/Field/index.js +55 -63
- package/lib/form/components/FieldSet/index.js +68 -76
- package/lib/form/components/FormItem/FormItemRender/index.js +58 -48
- package/lib/form/components/FormItem/Group/index.js +95 -95
- package/lib/form/components/FormItem/Group/style.js +46 -41
- package/lib/form/components/FormItem/index.js +135 -141
- package/lib/form/components/FormItem/warpField.js +165 -149
- package/lib/form/components/List/ListContainer.js +100 -191
- package/lib/form/components/List/ListItem.js +153 -200
- package/lib/form/components/List/index.js +97 -107
- package/lib/form/components/List/style.js +71 -48
- package/lib/form/components/Money/index.js +28 -30
- package/lib/form/components/Radio/index.js +45 -49
- package/lib/form/components/Rate/index.js +17 -21
- package/lib/form/components/SchemaForm/index.js +54 -68
- package/lib/form/components/SchemaForm/layoutType/Embed.js +5 -6
- package/lib/form/components/SchemaForm/layoutType/StepsForm.js +22 -26
- package/lib/form/components/SchemaForm/layoutType/index.js +2 -2
- package/lib/form/components/SchemaForm/valueType/dependency.js +13 -12
- package/lib/form/components/SchemaForm/valueType/divider.js +6 -7
- package/lib/form/components/SchemaForm/valueType/field.js +47 -45
- package/lib/form/components/SchemaForm/valueType/formList.js +10 -9
- package/lib/form/components/SchemaForm/valueType/formSet.js +10 -8
- package/lib/form/components/SchemaForm/valueType/group.js +9 -10
- package/lib/form/components/SchemaForm/valueType/ignore.js +4 -3
- package/lib/form/components/SchemaForm/valueType/index.js +7 -6
- package/lib/form/components/Segmented/index.js +20 -24
- package/lib/form/components/Select/index.js +69 -73
- package/lib/form/components/Slider/index.js +33 -35
- package/lib/form/components/Switch/index.js +24 -26
- package/lib/form/components/Text/index.js +73 -84
- package/lib/form/components/TextArea/index.js +17 -21
- package/lib/form/components/TreeSelect/index.js +20 -23
- package/lib/form/components/UploadButton/index.js +56 -103
- package/lib/form/components/UploadDragger/index.js +37 -44
- package/lib/form/components/index.js +42 -42
- package/lib/form/helpers/grid.js +68 -69
- package/lib/form/helpers/index.js +1 -1
- package/lib/form/index.js +8 -8
- package/lib/form/layouts/DrawerForm/index.js +149 -241
- package/lib/form/layouts/DrawerForm/style.js +26 -26
- package/lib/form/layouts/LightFilter/index.d.ts +12 -1
- package/lib/form/layouts/LightFilter/index.js +158 -141
- package/lib/form/layouts/LightFilter/style.js +52 -49
- package/lib/form/layouts/LoginForm/index.js +44 -48
- package/lib/form/layouts/LoginForm/style.js +71 -68
- package/lib/form/layouts/LoginFormPage/index.js +45 -49
- package/lib/form/layouts/LoginFormPage/style.js +136 -127
- package/lib/form/layouts/ModalForm/index.js +118 -203
- package/lib/form/layouts/ProForm/index.d.ts +1 -1
- package/lib/form/layouts/ProForm/index.js +5 -5
- package/lib/form/layouts/QueryFilter/Actions.js +23 -22
- package/lib/form/layouts/QueryFilter/index.js +177 -202
- package/lib/form/layouts/QueryFilter/style.js +45 -38
- package/lib/form/layouts/StepsForm/StepForm.d.ts +2 -3
- package/lib/form/layouts/StepsForm/StepForm.js +50 -72
- package/lib/form/layouts/StepsForm/index.js +174 -216
- package/lib/form/layouts/StepsForm/style.js +30 -29
- package/lib/form/layouts/index.js +9 -9
- package/lib/index.js +11 -11
- package/lib/layout/ProLayout.js +281 -292
- package/lib/layout/WrapContent.js +18 -14
- package/lib/layout/assert/Logo.js +96 -97
- package/lib/layout/components/AppsLogoComponents/AppsLogo.js +11 -12
- package/lib/layout/components/AppsLogoComponents/DefaultContent.js +19 -17
- package/lib/layout/components/AppsLogoComponents/SimpleContent.js +22 -19
- package/lib/layout/components/AppsLogoComponents/index.js +36 -40
- package/lib/layout/components/AppsLogoComponents/style/default.js +4 -3
- package/lib/layout/components/AppsLogoComponents/style/index.js +52 -51
- package/lib/layout/components/AppsLogoComponents/style/simple.js +3 -2
- package/lib/layout/components/CollapsedIcon/index.js +20 -17
- package/lib/layout/components/CollapsedIcon/style.js +40 -41
- package/lib/layout/components/Footer.js +23 -22
- package/lib/layout/components/FooterToolbar/index.js +59 -53
- package/lib/layout/components/FooterToolbar/style/index.js +38 -38
- package/lib/layout/components/FooterToolbar/style/stylish.js +11 -10
- package/lib/layout/components/GlobalFooter/index.js +27 -27
- package/lib/layout/components/GlobalFooter/style.js +31 -31
- package/lib/layout/components/GlobalHeader/ActionsContent.js +65 -81
- package/lib/layout/components/GlobalHeader/index.js +61 -49
- package/lib/layout/components/GlobalHeader/rightContentStyle.js +49 -50
- package/lib/layout/components/GlobalHeader/style.js +58 -55
- package/lib/layout/components/GridContent/index.js +26 -21
- package/lib/layout/components/GridContent/style.js +14 -14
- package/lib/layout/components/Header/index.js +65 -59
- package/lib/layout/components/Header/style/header.js +49 -48
- package/lib/layout/components/Header/style/stylish.js +15 -12
- package/lib/layout/components/Help/AsyncContentPanel.js +15 -20
- package/lib/layout/components/Help/HelpProvide.js +1 -1
- package/lib/layout/components/Help/ProHelpContentPanel.js +66 -85
- package/lib/layout/components/Help/ProHelpDrawer.js +27 -32
- package/lib/layout/components/Help/ProHelpModal.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpModal.js +26 -28
- package/lib/layout/components/Help/ProHelpPanel.js +86 -94
- package/lib/layout/components/Help/ProHelpPopover.js +20 -18
- package/lib/layout/components/Help/RenderContentPanel.js +36 -26
- package/lib/layout/components/Help/Search.js +55 -80
- package/lib/layout/components/Help/index.js +19 -20
- package/lib/layout/components/Help/style.js +82 -76
- package/lib/layout/components/PageContainer/index.js +172 -151
- package/lib/layout/components/PageContainer/style/index.js +95 -79
- package/lib/layout/components/PageContainer/style/stylish.js +11 -10
- package/lib/layout/components/PageHeader/index.js +99 -99
- package/lib/layout/components/PageHeader/style/index.js +142 -123
- package/lib/layout/components/PageLoading/index.js +18 -20
- package/lib/layout/components/SettingDrawer/BlockCheckbox.js +31 -34
- package/lib/layout/components/SettingDrawer/LayoutChange.js +25 -23
- package/lib/layout/components/SettingDrawer/RegionalChange.js +16 -16
- package/lib/layout/components/SettingDrawer/ThemeColor.js +34 -36
- package/lib/layout/components/SettingDrawer/index.js +138 -168
- package/lib/layout/components/SettingDrawer/style/index.js +141 -138
- package/lib/layout/components/SiderMenu/BaseMenu.js +235 -221
- package/lib/layout/components/SiderMenu/SiderMenu.js +128 -117
- package/lib/layout/components/SiderMenu/index.js +49 -44
- package/lib/layout/components/SiderMenu/style/index.js +179 -162
- package/lib/layout/components/SiderMenu/style/menu.js +148 -111
- package/lib/layout/components/SiderMenu/style/stylish.js +15 -12
- package/lib/layout/components/TopNavHeader/index.js +73 -62
- package/lib/layout/components/TopNavHeader/style.js +64 -64
- package/lib/layout/context/RouteContext.js +1 -1
- package/lib/layout/defaultSettings.js +1 -1
- package/lib/layout/getPageTitle.js +27 -26
- package/lib/layout/index.js +16 -16
- package/lib/layout/locales/en-US.js +3 -2
- package/lib/layout/locales/index.js +8 -6
- package/lib/layout/locales/it-IT.js +3 -2
- package/lib/layout/locales/ko-KR.js +3 -2
- package/lib/layout/locales/zh-CN.js +3 -2
- package/lib/layout/locales/zh-TW.js +3 -2
- package/lib/layout/style/index.js +48 -43
- package/lib/layout/utils/getBreadcrumbProps.js +65 -62
- package/lib/layout/utils/getMenuData.js +9 -13
- package/lib/layout/utils/pathTools.js +2 -6
- package/lib/layout/utils/useCurrentMenuLayoutProps.js +6 -11
- package/lib/layout/utils/utils.js +16 -18
- package/lib/list/Item.js +155 -136
- package/lib/list/ListView.js +110 -119
- package/lib/list/constants.js +2 -2
- package/lib/list/index.js +72 -70
- package/lib/list/style/index.js +281 -214
- package/lib/provider/index.js +128 -118
- package/lib/provider/intl.js +56 -56
- package/lib/provider/typing/layoutToken.js +28 -25
- package/lib/provider/useStyle/index.js +55 -60
- package/lib/provider/utils/merge.js +12 -14
- package/lib/skeleton/components/Descriptions/index.js +213 -229
- package/lib/skeleton/components/List/index.js +211 -221
- package/lib/skeleton/components/Result/index.js +45 -47
- package/lib/skeleton/index.js +23 -19
- package/lib/table/Store/Provide.d.ts +4 -4
- package/lib/table/Store/Provide.js +103 -117
- package/lib/table/Table.d.ts +5 -2
- package/lib/table/Table.js +524 -689
- package/lib/table/TableSearch.d.ts +24 -0
- package/lib/table/TableSearch.js +61 -0
- package/lib/table/TableToolbar.d.ts +22 -0
- package/lib/table/TableToolbar.js +55 -0
- package/lib/table/components/Alert/index.js +41 -40
- package/lib/table/components/Alert/style.js +28 -28
- package/lib/table/components/ColumnSetting/index.js +228 -224
- package/lib/table/components/ColumnSetting/style.js +86 -72
- package/lib/table/components/DragSortTable/index.js +64 -78
- package/lib/table/components/DragSortTable/style.js +20 -20
- package/lib/table/components/Dropdown/index.js +42 -48
- package/lib/table/components/EditableTable/CellEditorTable.js +24 -32
- package/lib/table/components/EditableTable/RowEditorTable.js +23 -28
- package/lib/table/components/EditableTable/index.js +293 -327
- package/lib/table/components/Form/FormRender.js +99 -104
- package/lib/table/components/Form/index.d.ts +4 -19
- package/lib/table/components/Form/index.js +113 -159
- package/lib/table/components/ListToolBar/HeaderMenu.js +42 -51
- package/lib/table/components/ListToolBar/index.js +123 -148
- package/lib/table/components/ListToolBar/style.js +127 -118
- package/lib/table/components/ToolBar/DensityIcon.js +10 -9
- package/lib/table/components/ToolBar/FullscreenIcon.js +5 -10
- package/lib/table/components/ToolBar/index.d.ts +2 -8
- package/lib/table/components/ToolBar/index.js +154 -194
- package/lib/table/index.js +27 -27
- package/lib/table/style/index.js +144 -113
- package/lib/table/typing.d.ts +4 -0
- package/lib/table/useFetchData.js +197 -337
- package/lib/table/utils/cellRenderToFromItem.js +106 -120
- package/lib/table/utils/columnRender.js +65 -54
- package/lib/table/utils/columnSort.js +24 -23
- package/lib/table/utils/genProColumnToColumn.d.ts +13 -9
- package/lib/table/utils/genProColumnToColumn.js +121 -99
- package/lib/table/utils/index.d.ts +10 -0
- package/lib/table/utils/index.js +127 -181
- package/lib/table/utils/useDragSort.d.ts +1 -1
- package/lib/table/utils/useDragSort.js +99 -93
- package/lib/table/utils/usePageInfo.d.ts +6 -0
- package/lib/table/utils/usePageInfo.js +61 -0
- package/lib/utils/components/DropdownFooter/index.js +25 -23
- package/lib/utils/components/DropdownFooter/style.js +16 -16
- package/lib/utils/components/ErrorBoundary/index.js +28 -50
- package/lib/utils/components/FieldLabel/index.js +70 -71
- package/lib/utils/components/FieldLabel/style.js +104 -82
- package/lib/utils/components/FilterDropdown/index.d.ts +11 -0
- package/lib/utils/components/FilterDropdown/index.js +44 -33
- package/lib/utils/components/FilterDropdown/style.js +19 -17
- package/lib/utils/components/InlineErrorFormItem/index.js +80 -80
- package/lib/utils/components/InlineErrorFormItem/style.js +56 -50
- package/lib/utils/components/LabelIconTip/index.js +30 -32
- package/lib/utils/components/LabelIconTip/style.js +36 -36
- package/lib/utils/components/ProFormContext/index.js +1 -1
- package/lib/utils/conversionMomentValue/index.js +22 -23
- package/lib/utils/dateArrayFormatter/index.js +11 -15
- package/lib/utils/genCopyable/index.js +75 -33
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +3 -2
- package/lib/utils/hooks/useDebounceFn/index.js +18 -52
- package/lib/utils/hooks/useDebounceValue/index.js +7 -17
- package/lib/utils/hooks/useDeepCompareEffect/index.js +7 -19
- package/lib/utils/hooks/useDocumentTitle/index.js +2 -2
- package/lib/utils/hooks/useFetchData/index.js +36 -65
- package/lib/utils/hooks/useForceRender/index.js +2 -10
- package/lib/utils/hooks/useLatest/index.js +4 -3
- package/lib/utils/hooks/usePrevious/index.js +5 -4
- package/lib/utils/hooks/useReactiveRef/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +3 -3
- package/lib/utils/hooks/useRefFunction/index.js +6 -11
- package/lib/utils/index.d.ts +1 -2
- package/lib/utils/index.js +57 -65
- package/lib/utils/isBrowser/index.js +4 -3
- package/lib/utils/isDeepEqualReact/index.js +9 -45
- package/lib/utils/isDropdownValueType/index.js +4 -3
- package/lib/utils/isNil/index.js +2 -3
- package/lib/utils/isUrl/index.js +4 -3
- package/lib/utils/merge/index.js +12 -14
- package/lib/utils/nanoid/index.js +7 -7
- package/lib/utils/omitBoolean/index.js +3 -2
- package/lib/utils/omitUndefined/index.js +5 -4
- package/lib/utils/omitUndefinedAndEmptyArr/index.js +6 -6
- package/lib/utils/parseValueToMoment/index.js +5 -8
- package/lib/utils/pickProFormItemProps/index.js +3 -3
- package/lib/utils/pickProProps/index.js +6 -7
- package/lib/utils/proFieldParsingText/index.js +89 -99
- package/lib/utils/runFunction/index.js +2 -5
- package/lib/utils/stringify/index.js +2 -2
- package/lib/utils/transformKeySubmitValue/index.js +101 -117
- package/lib/utils/useEditableArray/index.d.ts +6 -1
- package/lib/utils/useEditableArray/index.js +582 -735
- package/lib/utils/useEditableMap/index.d.ts +1 -1
- package/lib/utils/useEditableMap/index.js +88 -135
- package/lib/utils/useMediaQuery/index.js +19 -19
- package/lib/utils/useMediaQuery/query.js +7 -18
- package/lib/version.js +1 -1
- package/package.json +17 -28
- package/es/utils/useMountMergeState/index.d.ts +0 -2
- package/es/utils/useMountMergeState/index.js +0 -2
- package/lib/utils/useMountMergeState/index.d.ts +0 -2
- package/lib/utils/useMountMergeState/index.js +0 -12
package/es/table/utils/index.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
7
1
|
/**
|
|
8
2
|
* 检查值是否存在 为了 避开 0 和 false
|
|
9
3
|
*
|
|
10
4
|
* @param value
|
|
11
5
|
*/
|
|
12
|
-
export
|
|
13
|
-
return value !== undefined && value !== null;
|
|
14
|
-
};
|
|
6
|
+
export const checkUndefinedOrNull = value => value !== undefined && value !== null;
|
|
15
7
|
|
|
16
8
|
/**
|
|
17
9
|
* 合并用户 props 和 预设的 props
|
|
@@ -21,27 +13,27 @@ export var checkUndefinedOrNull = function checkUndefinedOrNull(value) {
|
|
|
21
13
|
* @param intl
|
|
22
14
|
*/
|
|
23
15
|
export function mergePagination(pagination, pageInfo, intl) {
|
|
24
|
-
var _pagination$current, _pagination$pageSize;
|
|
25
16
|
if (pagination === false) {
|
|
26
17
|
return false;
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
total
|
|
38
|
-
|
|
39
|
-
current: pagination !== true && pagination ?
|
|
40
|
-
pageSize: pagination !== true && pagination ?
|
|
41
|
-
onChange:
|
|
42
|
-
|
|
43
|
-
onChange
|
|
44
|
-
|
|
19
|
+
const {
|
|
20
|
+
total,
|
|
21
|
+
current,
|
|
22
|
+
pageSize,
|
|
23
|
+
setPageInfo
|
|
24
|
+
} = pageInfo;
|
|
25
|
+
const defaultPagination = typeof pagination === 'object' ? pagination : {};
|
|
26
|
+
return {
|
|
27
|
+
showTotal: (all, range) => `${intl.getMessage('pagination.total.range', '第')} ${range[0]}-${range[1]} ${intl.getMessage('pagination.total.total', '条/总共')} ${all} ${intl.getMessage('pagination.total.item', '条')}`,
|
|
28
|
+
total,
|
|
29
|
+
...defaultPagination,
|
|
30
|
+
current: pagination !== true && pagination ? pagination.current ?? current : current,
|
|
31
|
+
pageSize: pagination !== true && pagination ? pagination.pageSize ?? pageSize : pageSize,
|
|
32
|
+
onChange: (page, newPageSize) => {
|
|
33
|
+
const {
|
|
34
|
+
onChange
|
|
35
|
+
} = pagination;
|
|
36
|
+
onChange?.(page, newPageSize || 20);
|
|
45
37
|
// pageSize 改变之后就没必要切换页码
|
|
46
38
|
if (newPageSize !== pageSize || current !== page) {
|
|
47
39
|
setPageInfo({
|
|
@@ -50,7 +42,7 @@ export function mergePagination(pagination, pageInfo, intl) {
|
|
|
50
42
|
});
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
|
-
}
|
|
45
|
+
};
|
|
54
46
|
}
|
|
55
47
|
|
|
56
48
|
/**
|
|
@@ -62,99 +54,39 @@ export function mergePagination(pagination, pageInfo, intl) {
|
|
|
62
54
|
*/
|
|
63
55
|
export function useActionType(ref, action, props) {
|
|
64
56
|
/** 这里生成action的映射,保证 action 总是使用的最新 只需要渲染一次即可 */
|
|
65
|
-
|
|
57
|
+
const userAction = {
|
|
58
|
+
...props.editableUtils,
|
|
66
59
|
pageInfo: action.pageInfo,
|
|
67
60
|
nativeElement: props.nativeElement,
|
|
68
61
|
focus: props.focus,
|
|
69
|
-
reload:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_context.next = 3;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
_context.next = 3;
|
|
79
|
-
return action.setPageInfo({
|
|
80
|
-
current: 1
|
|
81
|
-
});
|
|
82
|
-
case 3:
|
|
83
|
-
_context.next = 5;
|
|
84
|
-
return action === null || action === void 0 ? void 0 : action.reload();
|
|
85
|
-
case 5:
|
|
86
|
-
case "end":
|
|
87
|
-
return _context.stop();
|
|
88
|
-
}
|
|
89
|
-
}, _callee);
|
|
90
|
-
}));
|
|
91
|
-
function reload(_x) {
|
|
92
|
-
return _reload.apply(this, arguments);
|
|
93
|
-
}
|
|
94
|
-
return reload;
|
|
95
|
-
}(),
|
|
96
|
-
reloadAndRest: function () {
|
|
97
|
-
var _reloadAndRest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
98
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
99
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
100
|
-
case 0:
|
|
101
|
-
// reload 之后大概率会切换数据,清空一下选择。
|
|
102
|
-
props.onCleanSelected();
|
|
103
|
-
_context2.next = 3;
|
|
104
|
-
return action.setPageInfo({
|
|
105
|
-
current: 1
|
|
106
|
-
});
|
|
107
|
-
case 3:
|
|
108
|
-
_context2.next = 5;
|
|
109
|
-
return action === null || action === void 0 ? void 0 : action.reload();
|
|
110
|
-
case 5:
|
|
111
|
-
case "end":
|
|
112
|
-
return _context2.stop();
|
|
113
|
-
}
|
|
114
|
-
}, _callee2);
|
|
115
|
-
}));
|
|
116
|
-
function reloadAndRest() {
|
|
117
|
-
return _reloadAndRest.apply(this, arguments);
|
|
118
|
-
}
|
|
119
|
-
return reloadAndRest;
|
|
120
|
-
}(),
|
|
121
|
-
reset: function () {
|
|
122
|
-
var _reset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
123
|
-
var _action$reset;
|
|
124
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
125
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
126
|
-
case 0:
|
|
127
|
-
_context3.next = 2;
|
|
128
|
-
return props.resetAll();
|
|
129
|
-
case 2:
|
|
130
|
-
_context3.next = 4;
|
|
131
|
-
return action === null || action === void 0 || (_action$reset = action.reset) === null || _action$reset === void 0 ? void 0 : _action$reset.call(action);
|
|
132
|
-
case 4:
|
|
133
|
-
_context3.next = 6;
|
|
134
|
-
return action === null || action === void 0 ? void 0 : action.reload();
|
|
135
|
-
case 6:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
139
|
-
}, _callee3);
|
|
140
|
-
}));
|
|
141
|
-
function reset() {
|
|
142
|
-
return _reset.apply(this, arguments);
|
|
62
|
+
reload: async resetPageIndex => {
|
|
63
|
+
// 如果为 true,回到第一页
|
|
64
|
+
if (resetPageIndex) {
|
|
65
|
+
await action.setPageInfo({
|
|
66
|
+
current: 1
|
|
67
|
+
});
|
|
143
68
|
}
|
|
144
|
-
|
|
145
|
-
}(),
|
|
146
|
-
fullScreen: function fullScreen() {
|
|
147
|
-
return props.fullScreen();
|
|
69
|
+
await action?.reload();
|
|
148
70
|
},
|
|
149
|
-
|
|
150
|
-
|
|
71
|
+
reloadAndRest: async () => {
|
|
72
|
+
// reload 之后大概率会切换数据,清空一下选择。
|
|
73
|
+
props.onCleanSelected();
|
|
74
|
+
await action.setPageInfo({
|
|
75
|
+
current: 1
|
|
76
|
+
});
|
|
77
|
+
await action?.reload();
|
|
151
78
|
},
|
|
152
|
-
|
|
153
|
-
|
|
79
|
+
reset: async () => {
|
|
80
|
+
await props.resetAll();
|
|
81
|
+
await action?.reset?.();
|
|
82
|
+
await action?.reload();
|
|
154
83
|
},
|
|
84
|
+
fullScreen: () => props.fullScreen(),
|
|
85
|
+
clearSelected: () => props.onCleanSelected(),
|
|
86
|
+
setPageInfo: rest => action.setPageInfo(rest),
|
|
155
87
|
// 透出 scrollTo(如上层提供)
|
|
156
88
|
scrollTo: props.scrollTo
|
|
157
|
-
}
|
|
89
|
+
};
|
|
158
90
|
// eslint-disable-next-line no-param-reassign
|
|
159
91
|
ref.current = userAction;
|
|
160
92
|
}
|
|
@@ -165,16 +97,14 @@ export function useActionType(ref, action, props) {
|
|
|
165
97
|
* @param pipeline
|
|
166
98
|
*/
|
|
167
99
|
export function postDataPipeline(data, pipeline) {
|
|
168
|
-
if (pipeline.filter(
|
|
169
|
-
return item;
|
|
170
|
-
}).length < 1) {
|
|
100
|
+
if (pipeline.filter(item => item).length < 1) {
|
|
171
101
|
return data;
|
|
172
102
|
}
|
|
173
|
-
return pipeline.reduce(
|
|
103
|
+
return pipeline.reduce((pre, postData) => {
|
|
174
104
|
return postData(pre);
|
|
175
105
|
}, data);
|
|
176
106
|
}
|
|
177
|
-
export
|
|
107
|
+
export const isBordered = (borderType, border) => {
|
|
178
108
|
if (border === undefined) {
|
|
179
109
|
return false;
|
|
180
110
|
}
|
|
@@ -183,11 +113,8 @@ export var isBordered = function isBordered(borderType, border) {
|
|
|
183
113
|
}
|
|
184
114
|
return border[borderType];
|
|
185
115
|
};
|
|
186
|
-
export
|
|
187
|
-
)
|
|
188
|
-
var _dom$props;
|
|
189
|
-
return dom && _typeof(dom) === 'object' && (dom === null || dom === void 0 || (_dom$props = dom.props) === null || _dom$props === void 0 ? void 0 : _dom$props.colSpan);
|
|
190
|
-
};
|
|
116
|
+
export const isMergeCell = (dom // 如果是合并单元格的,直接返回对象
|
|
117
|
+
) => dom && typeof dom === 'object' && dom?.props?.colSpan;
|
|
191
118
|
|
|
192
119
|
/**
|
|
193
120
|
* 根据 key 和 dataIndex 生成唯一 id
|
|
@@ -196,11 +123,11 @@ export var isMergeCell = function isMergeCell(dom // 如果是合并单元格的
|
|
|
196
123
|
* @param dataIndex 在对象中的数据
|
|
197
124
|
* @param index 序列号,理论上唯一
|
|
198
125
|
*/
|
|
199
|
-
export
|
|
126
|
+
export const genColumnKey = (key, index) => {
|
|
200
127
|
if (key) {
|
|
201
128
|
return Array.isArray(key) ? key.join('-') : key.toString();
|
|
202
129
|
}
|
|
203
|
-
return
|
|
130
|
+
return `${index}`;
|
|
204
131
|
};
|
|
205
132
|
|
|
206
133
|
/**
|
|
@@ -208,11 +135,11 @@ export var genColumnKey = function genColumnKey(key, index) {
|
|
|
208
135
|
*
|
|
209
136
|
* @param dataIndex Column 中的 dataIndex
|
|
210
137
|
*/
|
|
211
|
-
export
|
|
138
|
+
export const parseDataIndex = dataIndex => {
|
|
212
139
|
if (Array.isArray(dataIndex)) {
|
|
213
140
|
return dataIndex.join(',');
|
|
214
141
|
}
|
|
215
|
-
return dataIndex
|
|
142
|
+
return dataIndex?.toString();
|
|
216
143
|
};
|
|
217
144
|
|
|
218
145
|
/**
|
|
@@ -220,12 +147,12 @@ export var parseDataIndex = function parseDataIndex(dataIndex) {
|
|
|
220
147
|
* @param data 列配置
|
|
221
148
|
* @returns 平铺后的列配置
|
|
222
149
|
*/
|
|
223
|
-
export
|
|
224
|
-
|
|
225
|
-
for (
|
|
226
|
-
|
|
150
|
+
export const flattenColumns = data => {
|
|
151
|
+
const _columns = [];
|
|
152
|
+
for (let i = 0; i < data.length; i++) {
|
|
153
|
+
const _curItem = data[i];
|
|
227
154
|
if (_curItem.children) {
|
|
228
|
-
_columns.push
|
|
155
|
+
_columns.push(...flattenColumns(_curItem.children));
|
|
229
156
|
} else {
|
|
230
157
|
_columns.push(_curItem);
|
|
231
158
|
}
|
|
@@ -239,35 +166,42 @@ export var flattenColumns = function flattenColumns(data) {
|
|
|
239
166
|
* @param onFilter 筛选函数
|
|
240
167
|
* @returns 是否为本地筛选
|
|
241
168
|
*/
|
|
242
|
-
export
|
|
169
|
+
export const isLocalFilter = (filters, onFilter) => {
|
|
243
170
|
return !!filters && !!onFilter;
|
|
244
171
|
};
|
|
245
172
|
|
|
173
|
+
/**
|
|
174
|
+
* @deprecated typo kept for backward compatibility
|
|
175
|
+
* use `isLocalFilter` instead
|
|
176
|
+
*/
|
|
177
|
+
export const isLocaleFilter = isLocalFilter;
|
|
178
|
+
|
|
246
179
|
/**
|
|
247
180
|
* 判断是否为本地排序
|
|
248
181
|
* @param sorter 排序配置
|
|
249
182
|
* @returns 是否为本地排序
|
|
250
183
|
*/
|
|
251
|
-
export
|
|
252
|
-
return typeof sorter === 'function' ||
|
|
184
|
+
export const isLocalSorter = sorter => {
|
|
185
|
+
return typeof sorter === 'function' || typeof sorter === 'object' && typeof sorter.compare === 'function';
|
|
253
186
|
};
|
|
254
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @deprecated typo kept for backward compatibility
|
|
190
|
+
* use `isLocalSorter` instead
|
|
191
|
+
*/
|
|
192
|
+
export const isLocaleSorter = isLocalSorter;
|
|
193
|
+
|
|
255
194
|
/**
|
|
256
195
|
* 获取服务端筛选数据
|
|
257
196
|
* @param filters 筛选数据
|
|
258
197
|
* @param columns 列配置
|
|
259
198
|
* @returns 服务端筛选数据
|
|
260
199
|
*/
|
|
261
|
-
export
|
|
200
|
+
export const getServerFilterResult = (filters, columns) => {
|
|
262
201
|
// 过滤掉本地筛选的列
|
|
263
|
-
return Object.entries(filters).reduce(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
value = _ref3[1];
|
|
267
|
-
var column = columns.find(function (column) {
|
|
268
|
-
return parseDataIndex(column.dataIndex) === key;
|
|
269
|
-
});
|
|
270
|
-
if (column != null && !isLocaleFilter(column.filters, column.onFilter)) acc[key] = value;
|
|
202
|
+
return Object.entries(filters).reduce((acc, [key, value]) => {
|
|
203
|
+
const column = columns.find(column => parseDataIndex(column.dataIndex) === key);
|
|
204
|
+
if (column != null && !isLocalFilter(column.filters, column.onFilter)) acc[key] = value;
|
|
271
205
|
return acc;
|
|
272
206
|
}, {});
|
|
273
207
|
};
|
|
@@ -277,13 +211,12 @@ export var getServerFilterResult = function getServerFilterResult(filters, colum
|
|
|
277
211
|
* @param sorterResult 排序数据
|
|
278
212
|
* @returns 服务端排序数据
|
|
279
213
|
*/
|
|
280
|
-
export
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
var sortKey = typeof sorter === 'string' ? sorter : parseDataIndex((_item$column2 = item.column) === null || _item$column2 === void 0 ? void 0 : _item$column2.dataIndex);
|
|
214
|
+
export const getServerSorterResult = sorterResult => {
|
|
215
|
+
const result = Array.isArray(sorterResult) ? sorterResult : [sorterResult];
|
|
216
|
+
const serverSorter = result.reduce((acc, item) => {
|
|
217
|
+
const sorter = item.column?.sorter;
|
|
218
|
+
if (sorter != null && isLocalSorter(sorter)) return acc;
|
|
219
|
+
const sortKey = typeof sorter === 'string' ? sorter : parseDataIndex(item.column?.dataIndex);
|
|
287
220
|
if (sortKey != null) acc[sortKey] = item.order;
|
|
288
221
|
return acc;
|
|
289
222
|
}, {});
|
|
@@ -294,34 +227,31 @@ export var getServerSorterResult = function getServerSorterResult(sorterResult)
|
|
|
294
227
|
* 从 ProColumns 数组中取出默认的服务端排序和筛选数据
|
|
295
228
|
* @param columns ProColumns
|
|
296
229
|
*/
|
|
297
|
-
export
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
columns.forEach(
|
|
230
|
+
export const parseServerDefaultColumnConfig = columns => {
|
|
231
|
+
const filter = {};
|
|
232
|
+
const sort = {};
|
|
233
|
+
columns.forEach(column => {
|
|
301
234
|
// 转换 dataIndex
|
|
302
|
-
|
|
235
|
+
const dataIndex = parseDataIndex(column.dataIndex);
|
|
303
236
|
if (!dataIndex) return; // 没有 dataIndex 的列不参与服务端排序/筛选
|
|
304
237
|
|
|
305
238
|
// 当 column 启用服务端 filters 功能时,取出默认的筛选值
|
|
306
|
-
if (column.filters && !
|
|
307
|
-
|
|
308
|
-
filter[dataIndex] = (_ref4 = column.defaultFilteredValue) !== null && _ref4 !== void 0 ? _ref4 : null;
|
|
239
|
+
if (column.filters && !isLocalFilter(column.filters, column.onFilter)) {
|
|
240
|
+
filter[dataIndex] = column.defaultFilteredValue ?? null;
|
|
309
241
|
}
|
|
310
242
|
|
|
311
243
|
// 当 column 启用服务端 sorter 功能时,取出默认的排序值
|
|
312
|
-
if (column.sorter && !
|
|
244
|
+
if (column.sorter && !isLocalSorter(column.sorter)) {
|
|
313
245
|
if (typeof column.sorter === 'string') {
|
|
314
|
-
|
|
315
|
-
sort[column.sorter] = (_column$defaultSortOr = column.defaultSortOrder) !== null && _column$defaultSortOr !== void 0 ? _column$defaultSortOr : null;
|
|
246
|
+
sort[column.sorter] = column.defaultSortOrder ?? null;
|
|
316
247
|
} else {
|
|
317
|
-
|
|
318
|
-
sort[dataIndex] = (_column$defaultSortOr2 = column.defaultSortOrder) !== null && _column$defaultSortOr2 !== void 0 ? _column$defaultSortOr2 : null;
|
|
248
|
+
sort[dataIndex] = column.defaultSortOrder ?? null;
|
|
319
249
|
}
|
|
320
250
|
}
|
|
321
251
|
});
|
|
322
252
|
return {
|
|
323
|
-
sort
|
|
324
|
-
filter
|
|
253
|
+
sort,
|
|
254
|
+
filter
|
|
325
255
|
};
|
|
326
256
|
};
|
|
327
257
|
|
|
@@ -331,10 +261,12 @@ export var parseServerDefaultColumnConfig = function parseServerDefaultColumnCon
|
|
|
331
261
|
* @param columnProps 列配置
|
|
332
262
|
* @returns 排序值
|
|
333
263
|
*/
|
|
334
|
-
export
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
264
|
+
export const parseProSortOrder = (proSort, columnProps) => {
|
|
265
|
+
const {
|
|
266
|
+
sorter,
|
|
267
|
+
sortOrder: columnSortOrder,
|
|
268
|
+
dataIndex
|
|
269
|
+
} = columnProps;
|
|
338
270
|
|
|
339
271
|
// 优先使用用户明确设置的 sortOrder
|
|
340
272
|
if (columnSortOrder !== undefined) return columnSortOrder;
|
|
@@ -343,10 +275,10 @@ export var parseProSortOrder = function parseProSortOrder(proSort, columnProps)
|
|
|
343
275
|
if (sorter == null) return undefined;
|
|
344
276
|
|
|
345
277
|
// 如果是本地排序,不使用 proSort 中的值
|
|
346
|
-
if (
|
|
278
|
+
if (isLocalSorter(sorter)) return undefined;
|
|
347
279
|
|
|
348
280
|
// 服务端排序:确定排序键
|
|
349
|
-
|
|
281
|
+
const sortKey = typeof sorter === 'string' ? sorter : parseDataIndex(dataIndex);
|
|
350
282
|
|
|
351
283
|
// 返回对应的排序值
|
|
352
284
|
return sortKey ? proSort[sortKey] : undefined;
|
|
@@ -358,11 +290,13 @@ export var parseProSortOrder = function parseProSortOrder(proSort, columnProps)
|
|
|
358
290
|
* @param columnProps 列配置
|
|
359
291
|
* @returns 筛选值
|
|
360
292
|
*/
|
|
361
|
-
export
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
293
|
+
export const parseProFilteredValue = (proFilter, columnProps) => {
|
|
294
|
+
const {
|
|
295
|
+
filters,
|
|
296
|
+
onFilter,
|
|
297
|
+
filteredValue: columnFilteredValue,
|
|
298
|
+
dataIndex
|
|
299
|
+
} = columnProps;
|
|
366
300
|
|
|
367
301
|
// 优先使用用户设置的 filteredValue
|
|
368
302
|
if (columnFilteredValue !== undefined) return columnFilteredValue;
|
|
@@ -371,10 +305,10 @@ export var parseProFilteredValue = function parseProFilteredValue(proFilter, col
|
|
|
371
305
|
if (filters == null) return undefined;
|
|
372
306
|
|
|
373
307
|
// 如果是本地筛选,不使用 proFilter 中的值
|
|
374
|
-
if (
|
|
308
|
+
if (isLocalFilter(filters, onFilter)) return undefined;
|
|
375
309
|
|
|
376
310
|
// 服务端排序:获取筛选键
|
|
377
|
-
|
|
311
|
+
const filterKey = parseDataIndex(dataIndex);
|
|
378
312
|
|
|
379
313
|
// 返回对应的筛选值
|
|
380
314
|
return filterKey ? proFilter[filterKey] : undefined;
|