@ant-design/pro-components 3.1.3-1 → 3.1.5-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/dist/pro-components.min.js +1 -1
- package/es/card/ProCard.js +15 -7
- package/es/card/components/Actions/index.js +1 -4
- package/es/card/components/Card/index.js +60 -28
- package/es/card/components/Card/style.js +46 -9
- package/es/card/components/CheckCard/Group.js +1 -3
- package/es/card/components/CheckCard/index.js +0 -1
- package/es/card/components/Divider/index.d.ts +1 -1
- package/es/card/components/Divider/index.js +2 -2
- package/es/card/components/Divider/style.d.ts +4 -1
- package/es/card/components/Divider/style.js +6 -39
- package/es/card/components/Statistic/index.js +3 -3
- package/es/card/components/StatisticCard/index.js +1 -1
- package/es/card/typing.d.ts +29 -14
- package/es/descriptions/index.d.ts +3 -5
- package/es/descriptions/index.js +6 -6
- package/es/descriptions/useFetchData.js +0 -1
- package/es/field/AllProField.d.ts +2 -0
- package/es/field/AllProField.js +3 -4
- package/es/field/PureProField.d.ts +2 -0
- package/es/field/PureProField.js +2 -5
- package/es/field/components/Cascader/index.js +8 -1
- package/es/field/components/Checkbox/index.js +7 -6
- package/es/field/components/DatePicker/index.d.ts +1 -1
- package/es/field/components/DatePicker/index.js +13 -1
- package/es/field/components/Digit/index.js +20 -3
- package/es/field/components/DigitRange/index.js +1 -0
- package/es/field/components/Money/index.js +51 -3
- package/es/field/components/Options/index.js +0 -3
- package/es/field/components/Password/index.js +12 -11
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/Radio/index.js +5 -1
- package/es/field/components/RangePicker/index.d.ts +1 -1
- package/es/field/components/Segmented/index.js +2 -1
- package/es/field/components/Select/SearchSelect/index.js +0 -1
- package/es/field/components/Select/index.d.ts +1 -1
- package/es/field/components/Select/index.js +1 -1
- package/es/field/components/Switch/index.js +10 -3
- package/es/field/components/Text/index.js +11 -2
- package/es/field/components/TextArea/index.js +6 -3
- package/es/field/components/TimePicker/index.js +10 -1
- package/es/field/components/TreeSelect/index.d.ts +2 -12
- package/es/field/components/TreeSelect/index.js +31 -17
- package/es/form/BaseForm/BaseForm.js +4 -6
- package/es/form/BaseForm/LightWrapper/index.d.ts +2 -1
- package/es/form/BaseForm/Submitter/index.d.ts +1 -1
- package/es/form/components/Captcha/index.js +0 -3
- package/es/form/components/Checkbox/index.js +5 -1
- package/es/form/components/DatePicker/index.js +0 -2
- package/es/form/components/Digit/DigitRange.js +5 -2
- package/es/form/components/Digit/index.js +7 -2
- package/es/form/components/FieldSet/index.js +16 -6
- package/es/form/components/FormItem/FormItemRender/index.d.ts +1 -1
- package/es/form/components/FormItem/FormItemRender/index.js +10 -2
- package/es/form/components/FormItem/Group/index.js +1 -1
- package/es/form/components/FormItem/index.js +9 -7
- package/es/form/components/FormItem/warpField.js +3 -15
- package/es/form/components/List/ListContainer.js +2 -1
- package/es/form/components/List/index.d.ts +1 -1
- package/es/form/components/List/index.js +0 -2
- package/es/form/components/Radio/index.js +5 -4
- package/es/form/components/SchemaForm/index.js +0 -1
- package/es/form/components/SchemaForm/layoutType/StepsForm.js +0 -1
- package/es/form/components/Select/index.js +11 -2
- package/es/form/components/Text/index.js +0 -3
- package/es/form/components/UploadButton/index.js +4 -2
- package/es/form/components/UploadDragger/index.js +0 -1
- package/es/form/helpers/grid.js +1 -5
- package/es/form/layouts/DrawerForm/index.d.ts +4 -4
- package/es/form/layouts/DrawerForm/index.js +2 -6
- package/es/form/layouts/LightFilter/index.js +5 -6
- package/es/form/layouts/LoginForm/index.js +8 -8
- package/es/form/layouts/LoginFormPage/index.js +15 -15
- package/es/form/layouts/ModalForm/index.d.ts +2 -2
- package/es/form/layouts/ModalForm/index.js +1 -4
- package/es/form/layouts/QueryFilter/Actions.js +2 -1
- package/es/form/layouts/QueryFilter/index.js +40 -24
- package/es/form/layouts/StepsForm/StepForm.js +0 -1
- package/es/form/layouts/StepsForm/index.js +5 -14
- package/es/layout/ProLayout.d.ts +1 -1
- package/es/layout/ProLayout.js +2 -7
- package/es/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
- package/es/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
- package/es/layout/components/AppsLogoComponents/style/index.js +4 -0
- package/es/layout/components/FooterToolbar/index.d.ts +1 -1
- package/es/layout/components/FooterToolbar/index.js +2 -5
- package/es/layout/components/GlobalFooter/index.js +3 -3
- package/es/layout/components/GlobalHeader/ActionsContent.js +6 -7
- package/es/layout/components/GlobalHeader/index.js +1 -1
- package/es/layout/components/GridContent/index.js +1 -1
- package/es/layout/components/Header/index.js +1 -3
- package/es/layout/components/Help/ProHelpPanel.js +11 -10
- package/es/layout/components/PageContainer/index.js +9 -10
- package/es/layout/components/PageContainer/style/index.js +4 -0
- package/es/layout/components/PageHeader/index.js +10 -10
- package/es/layout/components/SettingDrawer/BlockCheckbox.js +2 -3
- package/es/layout/components/SettingDrawer/LayoutChange.js +3 -2
- package/es/layout/components/SettingDrawer/RegionalChange.js +3 -2
- package/es/layout/components/SettingDrawer/ThemeColor.js +3 -2
- package/es/layout/components/SettingDrawer/index.js +5 -5
- package/es/layout/components/SettingDrawer/style/index.js +4 -0
- package/es/layout/components/SiderMenu/BaseMenu.js +5 -9
- package/es/layout/components/SiderMenu/SiderMenu.js +6 -8
- package/es/layout/components/SiderMenu/index.js +0 -1
- package/es/layout/components/TopNavHeader/index.js +4 -5
- package/es/layout/style/index.js +4 -0
- package/es/layout/utils/getBreadcrumbProps.js +1 -1
- package/es/layout/utils/getMenuData.js +0 -1
- package/es/list/Item.d.ts +4 -7
- package/es/list/Item.js +82 -104
- package/es/list/ListView.d.ts +6 -4
- package/es/list/ListView.js +42 -55
- package/es/list/ProListBase.d.ts +74 -0
- package/es/list/ProListBase.js +358 -0
- package/es/list/constants.d.ts +2 -2
- package/es/list/constants.js +2 -5
- package/es/list/index.d.ts +23 -13
- package/es/list/index.js +78 -41
- package/es/list/style/index.d.ts +0 -1
- package/es/list/style/index.js +228 -86
- package/es/provider/index.d.ts +2 -2
- package/es/provider/index.js +0 -3
- package/es/provider/useStyle/index.d.ts +1 -21
- package/es/provider/useStyle/index.js +6 -3
- package/es/skeleton/components/Descriptions/index.js +1 -4
- package/es/skeleton/components/List/index.js +1 -4
- package/es/table/Store/Provide.js +0 -2
- package/es/table/Table.js +17 -17
- package/es/table/components/Alert/index.js +6 -5
- package/es/table/components/ColumnSetting/index.js +9 -10
- package/es/table/components/DragSortTable/index.js +8 -4
- package/es/table/components/EditableTable/index.d.ts +1 -1
- package/es/table/components/EditableTable/index.js +6 -8
- package/es/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
- package/es/table/components/ListToolBar/HeaderMenu.js +4 -3
- package/es/table/components/ListToolBar/index.d.ts +1 -1
- package/es/table/components/ListToolBar/index.js +18 -21
- package/es/table/components/ListToolBar/style.js +3 -3
- package/es/table/components/ToolBar/index.d.ts +1 -1
- package/es/table/style/index.js +4 -0
- package/es/table/typing.d.ts +10 -5
- package/es/table/useFetchData.js +4 -4
- package/es/table/utils/cellRenderToFromItem.js +2 -4
- package/es/table/utils/index.js +0 -1
- package/es/table/utils/useDragSort.js +1 -1
- package/es/utils/components/DropdownFooter/index.d.ts +1 -1
- package/es/utils/components/FieldLabel/index.js +1 -1
- package/es/utils/components/FilterDropdown/index.d.ts +1 -1
- package/es/utils/components/FilterDropdown/index.js +1 -1
- package/es/utils/components/InlineErrorFormItem/index.js +5 -4
- package/es/utils/components/LabelIconTip/index.d.ts +3 -4
- package/es/utils/components/LabelIconTip/index.js +2 -2
- package/es/utils/genCopyable/index.d.ts +6 -0
- package/es/utils/genCopyable/index.js +28 -8
- package/es/utils/hooks/useDebounceValue/index.js +1 -3
- package/es/utils/hooks/useDeepCompareEffect/index.js +0 -2
- package/es/utils/hooks/useFetchData/index.js +0 -2
- package/es/utils/index.d.ts +2 -1
- package/es/utils/isDeepEqualReact/index.js +0 -8
- package/es/utils/isUrl/index.js +1 -1
- package/es/utils/merge/index.js +0 -3
- package/es/utils/nanoid/index.d.ts +1 -3
- package/es/utils/nanoid/index.js +2 -10
- package/es/utils/proFieldParsingText/index.d.ts +2 -2
- package/es/utils/proFieldParsingText/index.js +3 -5
- package/es/utils/typing.d.ts +2 -1
- package/es/utils/useEditableArray/index.js +1 -1
- package/es/utils/useEditableMap/index.js +1 -1
- package/guidelines/components/pro-card.md +5 -4
- package/guidelines/overview-components.md +1 -1
- package/lib/card/ProCard.js +15 -7
- package/lib/card/components/Actions/index.js +1 -4
- package/lib/card/components/Card/index.js +60 -28
- package/lib/card/components/Card/style.js +46 -9
- package/lib/card/components/CheckCard/Group.js +1 -3
- package/lib/card/components/CheckCard/index.js +0 -1
- package/lib/card/components/Divider/index.d.ts +1 -1
- package/lib/card/components/Divider/index.js +2 -2
- package/lib/card/components/Divider/style.d.ts +4 -1
- package/lib/card/components/Divider/style.js +5 -39
- package/lib/card/components/Statistic/index.js +3 -3
- package/lib/card/components/StatisticCard/index.js +1 -1
- package/lib/card/typing.d.ts +29 -14
- package/lib/descriptions/index.d.ts +3 -5
- package/lib/descriptions/index.js +6 -6
- package/lib/descriptions/useFetchData.js +0 -1
- package/lib/field/AllProField.d.ts +2 -0
- package/lib/field/AllProField.js +3 -4
- package/lib/field/PureProField.d.ts +2 -0
- package/lib/field/PureProField.js +2 -5
- package/lib/field/components/Cascader/index.js +8 -1
- package/lib/field/components/Checkbox/index.js +7 -6
- package/lib/field/components/DatePicker/index.d.ts +1 -1
- package/lib/field/components/DatePicker/index.js +13 -1
- package/lib/field/components/Digit/index.js +20 -3
- package/lib/field/components/DigitRange/index.js +1 -0
- package/lib/field/components/Money/index.js +50 -2
- package/lib/field/components/Options/index.js +0 -3
- package/lib/field/components/Password/index.js +11 -10
- package/lib/field/components/Percent/util.d.ts +1 -1
- package/lib/field/components/Radio/index.js +5 -1
- package/lib/field/components/RangePicker/index.d.ts +1 -1
- package/lib/field/components/Segmented/index.js +2 -1
- package/lib/field/components/Select/SearchSelect/index.js +0 -1
- package/lib/field/components/Select/index.d.ts +1 -1
- package/lib/field/components/Select/index.js +1 -1
- package/lib/field/components/Switch/index.js +10 -3
- package/lib/field/components/Text/index.js +11 -2
- package/lib/field/components/TextArea/index.js +6 -3
- package/lib/field/components/TimePicker/index.js +10 -1
- package/lib/field/components/TreeSelect/index.d.ts +2 -12
- package/lib/field/components/TreeSelect/index.js +30 -16
- package/lib/form/BaseForm/BaseForm.js +4 -7
- package/lib/form/BaseForm/LightWrapper/index.d.ts +2 -1
- package/lib/form/BaseForm/Submitter/index.d.ts +1 -1
- package/lib/form/components/Captcha/index.js +0 -3
- package/lib/form/components/Checkbox/index.js +5 -1
- package/lib/form/components/DatePicker/index.js +0 -2
- package/lib/form/components/Digit/DigitRange.js +5 -2
- package/lib/form/components/Digit/index.js +7 -2
- package/lib/form/components/FieldSet/index.js +16 -6
- package/lib/form/components/FormItem/FormItemRender/index.d.ts +1 -1
- package/lib/form/components/FormItem/FormItemRender/index.js +10 -2
- package/lib/form/components/FormItem/Group/index.js +1 -1
- package/lib/form/components/FormItem/index.js +9 -7
- package/lib/form/components/FormItem/warpField.js +3 -15
- package/lib/form/components/List/ListContainer.js +2 -1
- package/lib/form/components/List/index.d.ts +1 -1
- package/lib/form/components/List/index.js +0 -2
- package/lib/form/components/Radio/index.js +5 -4
- package/lib/form/components/SchemaForm/index.js +0 -1
- package/lib/form/components/SchemaForm/layoutType/StepsForm.js +0 -1
- package/lib/form/components/Select/index.js +11 -2
- package/lib/form/components/Text/index.js +0 -3
- package/lib/form/components/UploadButton/index.js +4 -2
- package/lib/form/components/UploadDragger/index.js +0 -1
- package/lib/form/helpers/grid.js +1 -5
- package/lib/form/layouts/DrawerForm/index.d.ts +4 -4
- package/lib/form/layouts/DrawerForm/index.js +2 -6
- package/lib/form/layouts/LightFilter/index.js +5 -6
- package/lib/form/layouts/LoginForm/index.js +8 -8
- package/lib/form/layouts/LoginFormPage/index.js +15 -15
- package/lib/form/layouts/ModalForm/index.d.ts +2 -2
- package/lib/form/layouts/ModalForm/index.js +1 -4
- package/lib/form/layouts/QueryFilter/Actions.js +2 -1
- package/lib/form/layouts/QueryFilter/index.js +39 -24
- package/lib/form/layouts/StepsForm/StepForm.js +0 -1
- package/lib/form/layouts/StepsForm/index.js +5 -14
- package/lib/layout/ProLayout.d.ts +1 -1
- package/lib/layout/ProLayout.js +2 -7
- package/lib/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
- package/lib/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
- package/lib/layout/components/AppsLogoComponents/style/index.js +4 -0
- package/lib/layout/components/FooterToolbar/index.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/index.js +2 -6
- package/lib/layout/components/GlobalFooter/index.js +3 -3
- package/lib/layout/components/GlobalHeader/ActionsContent.js +6 -7
- package/lib/layout/components/GlobalHeader/index.js +1 -1
- package/lib/layout/components/GridContent/index.js +1 -1
- package/lib/layout/components/Header/index.js +1 -3
- package/lib/layout/components/Help/ProHelpPanel.js +11 -10
- package/lib/layout/components/PageContainer/index.js +9 -10
- package/lib/layout/components/PageContainer/style/index.js +4 -0
- package/lib/layout/components/PageHeader/index.js +10 -10
- package/lib/layout/components/SettingDrawer/BlockCheckbox.js +2 -3
- package/lib/layout/components/SettingDrawer/LayoutChange.js +3 -2
- package/lib/layout/components/SettingDrawer/RegionalChange.js +3 -2
- package/lib/layout/components/SettingDrawer/ThemeColor.js +3 -2
- package/lib/layout/components/SettingDrawer/index.js +5 -5
- package/lib/layout/components/SettingDrawer/style/index.js +4 -0
- package/lib/layout/components/SiderMenu/BaseMenu.js +5 -9
- package/lib/layout/components/SiderMenu/SiderMenu.js +6 -8
- package/lib/layout/components/SiderMenu/index.js +0 -1
- package/lib/layout/components/TopNavHeader/index.js +4 -5
- package/lib/layout/style/index.js +4 -0
- package/lib/layout/utils/getBreadcrumbProps.js +1 -1
- package/lib/layout/utils/getMenuData.js +0 -1
- package/lib/list/Item.d.ts +4 -7
- package/lib/list/Item.js +81 -103
- package/lib/list/ListView.d.ts +6 -4
- package/lib/list/ListView.js +41 -54
- package/lib/list/ProListBase.d.ts +74 -0
- package/lib/list/ProListBase.js +365 -0
- package/lib/list/constants.d.ts +2 -2
- package/lib/list/constants.js +2 -5
- package/lib/list/index.d.ts +23 -13
- package/lib/list/index.js +77 -40
- package/lib/list/style/index.d.ts +0 -1
- package/lib/list/style/index.js +227 -86
- package/lib/provider/index.d.ts +2 -2
- package/lib/provider/index.js +0 -3
- package/lib/provider/useStyle/index.d.ts +1 -21
- package/lib/provider/useStyle/index.js +6 -3
- package/lib/skeleton/components/Descriptions/index.js +1 -4
- package/lib/skeleton/components/List/index.js +1 -4
- package/lib/table/Store/Provide.js +0 -2
- package/lib/table/Table.js +17 -17
- package/lib/table/components/Alert/index.js +6 -5
- package/lib/table/components/ColumnSetting/index.js +9 -10
- package/lib/table/components/DragSortTable/index.js +8 -4
- package/lib/table/components/EditableTable/index.d.ts +1 -1
- package/lib/table/components/EditableTable/index.js +6 -8
- package/lib/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
- package/lib/table/components/ListToolBar/HeaderMenu.js +4 -3
- package/lib/table/components/ListToolBar/index.d.ts +1 -1
- package/lib/table/components/ListToolBar/index.js +18 -21
- package/lib/table/components/ListToolBar/style.js +3 -3
- package/lib/table/components/ToolBar/index.d.ts +1 -1
- package/lib/table/style/index.js +4 -0
- package/lib/table/typing.d.ts +10 -5
- package/lib/table/useFetchData.js +4 -4
- package/lib/table/utils/cellRenderToFromItem.js +2 -4
- package/lib/table/utils/index.js +0 -1
- package/lib/table/utils/useDragSort.js +1 -1
- package/lib/utils/components/DropdownFooter/index.d.ts +1 -1
- package/lib/utils/components/FieldLabel/index.js +1 -1
- package/lib/utils/components/FilterDropdown/index.d.ts +1 -1
- package/lib/utils/components/FilterDropdown/index.js +1 -1
- package/lib/utils/components/InlineErrorFormItem/index.js +5 -4
- package/lib/utils/components/LabelIconTip/index.d.ts +3 -4
- package/lib/utils/components/LabelIconTip/index.js +2 -2
- package/lib/utils/genCopyable/index.d.ts +6 -0
- package/lib/utils/genCopyable/index.js +28 -8
- package/lib/utils/hooks/useDebounceValue/index.js +1 -3
- package/lib/utils/hooks/useDeepCompareEffect/index.js +0 -2
- package/lib/utils/hooks/useFetchData/index.js +0 -2
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/isDeepEqualReact/index.js +0 -8
- package/lib/utils/isUrl/index.js +1 -1
- package/lib/utils/merge/index.js +0 -3
- package/lib/utils/nanoid/index.d.ts +1 -3
- package/lib/utils/nanoid/index.js +2 -10
- package/lib/utils/proFieldParsingText/index.d.ts +2 -2
- package/lib/utils/proFieldParsingText/index.js +3 -5
- package/lib/utils/typing.d.ts +2 -1
- package/lib/utils/useEditableArray/index.js +0 -2
- package/lib/utils/useEditableMap/index.js +0 -2
- package/package.json +32 -32
|
@@ -19,6 +19,9 @@ const genProCardStyle = token => {
|
|
|
19
19
|
display: 'flex',
|
|
20
20
|
flexDirection: 'column',
|
|
21
21
|
boxSizing: 'border-box',
|
|
22
|
+
'*, *::before, *::after': {
|
|
23
|
+
boxSizing: 'border-box'
|
|
24
|
+
},
|
|
22
25
|
width: '100%',
|
|
23
26
|
marginBlock: 0,
|
|
24
27
|
marginInline: 0,
|
|
@@ -35,6 +38,29 @@ const genProCardStyle = token => {
|
|
|
35
38
|
'&-col': {
|
|
36
39
|
width: '100%'
|
|
37
40
|
},
|
|
41
|
+
// 分割线样式:col 之间的分割线
|
|
42
|
+
[` ${componentCls}-col${componentCls}-split-vertical`]: {
|
|
43
|
+
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
|
|
44
|
+
},
|
|
45
|
+
[` ${componentCls}-col${componentCls}-split-horizontal`]: {
|
|
46
|
+
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
|
|
47
|
+
},
|
|
48
|
+
// Divider 分割线组件样式
|
|
49
|
+
[`${componentCls}-divider`]: {
|
|
50
|
+
flex: 'none',
|
|
51
|
+
alignSelf: 'stretch',
|
|
52
|
+
width: token.lineWidth,
|
|
53
|
+
marginInline: token.marginXS,
|
|
54
|
+
marginBlock: token.marginLG,
|
|
55
|
+
backgroundColor: token.colorSplit,
|
|
56
|
+
[`&${componentCls}-divider-horizontal`]: {
|
|
57
|
+
width: 'auto',
|
|
58
|
+
alignSelf: 'auto',
|
|
59
|
+
height: token.lineWidth,
|
|
60
|
+
marginInline: token.marginLG,
|
|
61
|
+
marginBlock: token.marginXS
|
|
62
|
+
}
|
|
63
|
+
},
|
|
38
64
|
'&-border': {
|
|
39
65
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
|
|
40
66
|
},
|
|
@@ -127,7 +153,7 @@ const genProCardStyle = token => {
|
|
|
127
153
|
},
|
|
128
154
|
[`${componentCls}-title`]: {
|
|
129
155
|
color: token.colorText,
|
|
130
|
-
fontWeight:
|
|
156
|
+
fontWeight: token.fontWeightStrong,
|
|
131
157
|
fontSize: token.fontSizeLG,
|
|
132
158
|
lineHeight: token.lineHeight
|
|
133
159
|
},
|
|
@@ -149,6 +175,17 @@ const genProCardStyle = token => {
|
|
|
149
175
|
transition: `transform ${token.motionDurationMid}`
|
|
150
176
|
}
|
|
151
177
|
},
|
|
178
|
+
[`${componentCls}-cover`]: {
|
|
179
|
+
overflow: 'hidden',
|
|
180
|
+
borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`,
|
|
181
|
+
'& > *': {
|
|
182
|
+
width: '100%',
|
|
183
|
+
display: 'block'
|
|
184
|
+
},
|
|
185
|
+
'& img': {
|
|
186
|
+
verticalAlign: 'middle'
|
|
187
|
+
}
|
|
188
|
+
},
|
|
152
189
|
[`${componentCls}-body`]: {
|
|
153
190
|
display: 'block',
|
|
154
191
|
boxSizing: 'border-box',
|
|
@@ -179,19 +216,19 @@ const genProCardStyle = token => {
|
|
|
179
216
|
paddingBlock: token.paddingSM
|
|
180
217
|
}
|
|
181
218
|
},
|
|
219
|
+
[` ${componentCls}-divider`]: {
|
|
220
|
+
marginBlock: token.marginLG,
|
|
221
|
+
marginInline: token.marginXS,
|
|
222
|
+
[`&${componentCls}-divider-horizontal`]: {
|
|
223
|
+
marginBlock: token.marginXS,
|
|
224
|
+
marginInline: token.marginLG
|
|
225
|
+
}
|
|
226
|
+
},
|
|
182
227
|
[`${componentCls}-header${componentCls}-header-collapsible`]: {
|
|
183
228
|
paddingBlock: token.paddingXS
|
|
184
229
|
}
|
|
185
230
|
}
|
|
186
231
|
},
|
|
187
|
-
[`${componentCls}-col`]: {
|
|
188
|
-
[`&${componentCls}-split-vertical`]: {
|
|
189
|
-
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
|
|
190
|
-
},
|
|
191
|
-
[`&${componentCls}-split-horizontal`]: {
|
|
192
|
-
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
232
|
[`${componentCls}-tabs`]: {
|
|
196
233
|
[`${token.antCls}-tabs-top > ${token.antCls}-tabs-nav`]: {
|
|
197
234
|
marginBlockEnd: 0,
|
|
@@ -167,9 +167,7 @@ const CheckCardGroup = props => {
|
|
|
167
167
|
};
|
|
168
168
|
const children = (0, _react.useMemo)(() => {
|
|
169
169
|
if (loading) {
|
|
170
|
-
return new Array(options.length || _react.default.Children.toArray(props.children).length || 1).fill(0)
|
|
171
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
172
|
-
.map((_, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {
|
|
170
|
+
return new Array(options.length || _react.default.Children.toArray(props.children).length || 1).fill(0).map((_, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {
|
|
173
171
|
loading: true
|
|
174
172
|
}, index));
|
|
175
173
|
}
|
|
@@ -49,7 +49,6 @@ const CheckCard = props => {
|
|
|
49
49
|
(0, _react.useEffect)(() => {
|
|
50
50
|
checkCardGroup?.registerValue?.(props.value);
|
|
51
51
|
return () => checkCardGroup?.cancelValue?.(props.value);
|
|
52
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
52
|
}, [props.value]);
|
|
54
53
|
const {
|
|
55
54
|
prefixCls: customizePrefixCls,
|
|
@@ -24,10 +24,10 @@ const ProCardDivider = props => {
|
|
|
24
24
|
const {
|
|
25
25
|
className,
|
|
26
26
|
style = {},
|
|
27
|
-
|
|
27
|
+
orientation = 'vertical'
|
|
28
28
|
} = props;
|
|
29
29
|
const classString = (0, _clsx.clsx)(prefixCls, className, hashId, {
|
|
30
|
-
[`${prefixCls}-${
|
|
30
|
+
[`${prefixCls}-${orientation}`]: orientation
|
|
31
31
|
});
|
|
32
32
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
33
33
|
className: classString,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Divider 样式已合并至 ProCard style.ts,此 hook 仅用于获取 hashId 和 wrapSSR
|
|
4
|
+
*/
|
|
5
|
+
export default function useStyle(_prefixCls: string): {
|
|
3
6
|
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
4
7
|
hashId: string;
|
|
5
8
|
};
|
|
@@ -5,43 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useStyle;
|
|
7
7
|
var _provider = require("../../../provider");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
[componentCls]: {
|
|
14
|
-
boxSizing: 'border-box',
|
|
15
|
-
'&-divider': {
|
|
16
|
-
flex: 'none',
|
|
17
|
-
width: token.lineWidth,
|
|
18
|
-
marginInline: token.marginXS,
|
|
19
|
-
marginBlock: token.marginLG,
|
|
20
|
-
backgroundColor: token.colorSplit,
|
|
21
|
-
'&-horizontal': {
|
|
22
|
-
width: 'initial',
|
|
23
|
-
height: token.lineWidth,
|
|
24
|
-
marginInline: token.marginLG,
|
|
25
|
-
marginBlock: token.marginXS
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
'&&-size-small &-divider': {
|
|
29
|
-
marginBlock: token.marginLG,
|
|
30
|
-
marginInline: token.marginXS,
|
|
31
|
-
'&-horizontal': {
|
|
32
|
-
marginBlock: token.marginXS,
|
|
33
|
-
marginInline: token.marginLG
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
function useStyle(prefixCls) {
|
|
40
|
-
return (0, _provider.useStyle)('ProCardDivider', token => {
|
|
41
|
-
const proCardDividerToken = {
|
|
42
|
-
...token,
|
|
43
|
-
componentCls: `.${prefixCls}`
|
|
44
|
-
};
|
|
45
|
-
return [genDividerStyle(proCardDividerToken)];
|
|
46
|
-
});
|
|
8
|
+
/**
|
|
9
|
+
* Divider 样式已合并至 ProCard style.ts,此 hook 仅用于获取 hashId 和 wrapSSR
|
|
10
|
+
*/
|
|
11
|
+
function useStyle(_prefixCls) {
|
|
12
|
+
return (0, _provider.useStyle)('ProCardDivider', () => ({}));
|
|
47
13
|
}
|
|
@@ -17,7 +17,7 @@ const Statistic = props => {
|
|
|
17
17
|
layout = 'inline',
|
|
18
18
|
style,
|
|
19
19
|
description,
|
|
20
|
-
children,
|
|
20
|
+
children: _children,
|
|
21
21
|
title,
|
|
22
22
|
tip,
|
|
23
23
|
status,
|
|
@@ -46,7 +46,7 @@ const Statistic = props => {
|
|
|
46
46
|
const tipDom = tip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
47
47
|
title: tip,
|
|
48
48
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.QuestionCircleOutlined, {
|
|
49
|
-
className: `${prefixCls}-tip
|
|
49
|
+
className: (0, _clsx.clsx)(`${prefixCls}-tip`, hashId)
|
|
50
50
|
})
|
|
51
51
|
});
|
|
52
52
|
const trendIconClassName = (0, _clsx.clsx)(`${prefixCls}-trend-icon`, hashId, {
|
|
@@ -83,7 +83,7 @@ const Statistic = props => {
|
|
|
83
83
|
className: statisticClassName,
|
|
84
84
|
...others
|
|
85
85
|
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
86
|
-
className: `${prefixCls}-description
|
|
86
|
+
className: (0, _clsx.clsx)(`${prefixCls}-description`, hashId),
|
|
87
87
|
children: description
|
|
88
88
|
})]
|
|
89
89
|
})]
|
|
@@ -61,7 +61,7 @@ const StatisticCard = props => {
|
|
|
61
61
|
children: [statisticDom, chartDom]
|
|
62
62
|
}));
|
|
63
63
|
const footerDom = footer && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
64
|
-
className: `${prefixCls}-footer
|
|
64
|
+
className: (0, _clsx.clsx)(`${prefixCls}-footer`, hashId),
|
|
65
65
|
children: footer
|
|
66
66
|
});
|
|
67
67
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Card.default, {
|
package/lib/card/typing.d.ts
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import type { TabPaneProps, TabsProps } from 'antd';
|
|
2
|
-
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
|
|
1
|
+
import type { CardProps as AntdCardProps, TabPaneProps, TabsProps } from 'antd';
|
|
3
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { LabelTooltipType } from '../utils';
|
|
4
|
+
export type { LabelTooltipType };
|
|
4
5
|
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
5
6
|
export type Gutter = number | Partial<Record<Breakpoint, number>>;
|
|
6
7
|
export type ColSpanType = number | string;
|
|
7
8
|
type CollapsibleType = 'icon' | 'header' | boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
/** 与 antd Card 一致的 styles 结构 */
|
|
10
|
+
export interface ProCardStyles {
|
|
11
|
+
root?: React.CSSProperties;
|
|
12
|
+
header?: React.CSSProperties;
|
|
13
|
+
body?: React.CSSProperties;
|
|
14
|
+
extra?: React.CSSProperties;
|
|
15
|
+
title?: React.CSSProperties;
|
|
16
|
+
actions?: React.CSSProperties;
|
|
17
|
+
cover?: React.CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
/** 与 antd Card 一致的 classNames 结构 */
|
|
20
|
+
export interface ProCardClassNames {
|
|
21
|
+
root?: string;
|
|
22
|
+
header?: string;
|
|
23
|
+
body?: string;
|
|
24
|
+
extra?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
actions?: string;
|
|
27
|
+
cover?: string;
|
|
28
|
+
}
|
|
29
|
+
type CardPropsBase = Pick<AntdCardProps, 'rootClassName' | 'cover'> & {
|
|
30
|
+
/** 样式配置,与 antd Card styles 结构一致 */
|
|
31
|
+
styles?: ProCardStyles;
|
|
32
|
+
/** 语义化 classNames,与 antd Card classNames 结构一致 */
|
|
33
|
+
classNames?: ProCardClassNames;
|
|
18
34
|
/** 页头是否有分割线 */
|
|
19
35
|
headerBordered?: boolean;
|
|
20
36
|
/** 卡片标题 */
|
|
@@ -46,7 +62,7 @@ type CardPropsBase = {
|
|
|
46
62
|
actions?: React.ReactNode[] | React.ReactNode;
|
|
47
63
|
/** 拆分卡片方式 */
|
|
48
64
|
split?: 'vertical' | 'horizontal';
|
|
49
|
-
/** Card
|
|
65
|
+
/** 卡片变体,与 antd Card variant 一致 */
|
|
50
66
|
variant?: 'outlined' | 'borderless';
|
|
51
67
|
/**
|
|
52
68
|
* 鼠标移过时可浮起
|
|
@@ -93,4 +109,3 @@ export type ProCardTabPaneProps = {
|
|
|
93
109
|
cardProps?: CardProps;
|
|
94
110
|
} & TabPaneProps;
|
|
95
111
|
export type CardType = React.ForwardRefExoticComponent<CardProps>;
|
|
96
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DescriptionsProps, FormProps } from 'antd';
|
|
2
|
-
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import type { ProFieldFCMode } from '../provider';
|
|
5
|
-
import type { ProCoreActionType, ProFieldValueType, ProSchema, ProSchemaComponentTypes, RowEditableConfig, UseEditableMapUtilType } from '../utils';
|
|
4
|
+
import type { ProCoreActionType, ProEllipsis, ProFieldValueType, ProSchema, ProSchemaComponentTypes, RowEditableConfig, UseEditableMapUtilType } from '../utils';
|
|
5
|
+
import { LabelTooltipType } from '../utils';
|
|
6
6
|
import type { RequestData } from './useFetchData';
|
|
7
7
|
export interface DescriptionsItemProps {
|
|
8
8
|
prefixCls?: string;
|
|
@@ -31,9 +31,7 @@ export type ProDescriptionsItemProps<T = Record<string, any>, ValueType = 'text'
|
|
|
31
31
|
hide?: boolean;
|
|
32
32
|
plain?: boolean;
|
|
33
33
|
copyable?: boolean;
|
|
34
|
-
ellipsis?:
|
|
35
|
-
showTitle?: boolean;
|
|
36
|
-
};
|
|
34
|
+
ellipsis?: ProEllipsis;
|
|
37
35
|
mode?: ProFieldFCMode;
|
|
38
36
|
children?: React.ReactNode;
|
|
39
37
|
/**
|
|
@@ -194,14 +194,14 @@ const schemaToDescriptionsItem = (items, entity, action, editableUtils, emptyTex
|
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
const {
|
|
197
|
-
valueEnum,
|
|
198
|
-
render,
|
|
197
|
+
valueEnum: _valueEnum,
|
|
198
|
+
render: _render,
|
|
199
199
|
renderText,
|
|
200
200
|
mode,
|
|
201
|
-
plain,
|
|
201
|
+
plain: _plain,
|
|
202
202
|
dataIndex,
|
|
203
|
-
request,
|
|
204
|
-
params,
|
|
203
|
+
request: _request,
|
|
204
|
+
params: _params,
|
|
205
205
|
editable,
|
|
206
206
|
...restItem
|
|
207
207
|
} = item;
|
|
@@ -301,7 +301,7 @@ const ProDescriptions = props => {
|
|
|
301
301
|
onLoadingChange,
|
|
302
302
|
actionRef,
|
|
303
303
|
onRequestError,
|
|
304
|
-
emptyText,
|
|
304
|
+
emptyText: _emptyText,
|
|
305
305
|
...rest
|
|
306
306
|
} = props;
|
|
307
307
|
const proContext = (0, _react.useContext)(_provider.default);
|
|
@@ -27,6 +27,8 @@ type RenderProps = Omit<ProFieldFCRenderProps, 'text' | 'placeholder'> & ProRend
|
|
|
27
27
|
*
|
|
28
28
|
* @param dataValue
|
|
29
29
|
* @param valueType
|
|
30
|
+
* @param props
|
|
31
|
+
* @param valueTypeMap
|
|
30
32
|
*/
|
|
31
33
|
export declare const defaultRenderText: (dataValue: ProFieldTextType, valueType: ProFieldValueType | ProFieldValueObjectType, props: RenderProps, valueTypeMap: Record<string, ProRenderFieldPropsType>) => React.ReactNode;
|
|
32
34
|
export declare const ProField: React.ForwardRefRenderFunction<any, ProFieldPropsType>;
|
package/lib/field/AllProField.js
CHANGED
|
@@ -62,6 +62,7 @@ _dayjs.default.extend(_weekday.default);
|
|
|
62
62
|
*
|
|
63
63
|
* @param text String | number
|
|
64
64
|
* @param valueType ProColumnsValueObjectType
|
|
65
|
+
* @param props
|
|
65
66
|
*/
|
|
66
67
|
const defaultRenderTextByObject = (text, valueType, props) => {
|
|
67
68
|
const pickFormItemProps = (0, _utils.pickProProps)(props.fieldProps);
|
|
@@ -109,6 +110,8 @@ const defaultRenderTextByObject = (text, valueType, props) => {
|
|
|
109
110
|
*
|
|
110
111
|
* @param dataValue
|
|
111
112
|
* @param valueType
|
|
113
|
+
* @param props
|
|
114
|
+
* @param valueTypeMap
|
|
112
115
|
*/
|
|
113
116
|
const defaultRenderText = (dataValue, valueType, props, valueTypeMap) => {
|
|
114
117
|
const {
|
|
@@ -134,15 +137,12 @@ const defaultRenderText = (dataValue, valueType, props, valueTypeMap) => {
|
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
|
-
|
|
138
|
-
// eslint-disable-next-line no-param-reassign
|
|
139
140
|
delete props.emptyText;
|
|
140
141
|
if (typeof valueType === 'object') {
|
|
141
142
|
return defaultRenderTextByObject(dataValue, valueType, props);
|
|
142
143
|
}
|
|
143
144
|
const customValueTypeConfig = valueTypeMap && valueTypeMap[valueType];
|
|
144
145
|
if (customValueTypeConfig) {
|
|
145
|
-
// eslint-disable-next-line no-param-reassign
|
|
146
146
|
delete props.ref;
|
|
147
147
|
if (mode === 'read') {
|
|
148
148
|
return customValueTypeConfig.render?.(dataValue, {
|
|
@@ -569,7 +569,6 @@ const ProFieldComponent = ({
|
|
|
569
569
|
...(0, _utils.omitUndefined)(restFieldProps),
|
|
570
570
|
onChange: onChangeCallBack
|
|
571
571
|
};
|
|
572
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
573
572
|
}, [value, restFieldProps, onChangeCallBack]);
|
|
574
573
|
const renderedDom = defaultRenderText(mode === 'edit' ? fieldProps?.value ?? text ?? '' : text ?? fieldProps?.value ?? '', valueType || 'text', (0, _utils.omitUndefined)({
|
|
575
574
|
ref,
|
|
@@ -29,6 +29,8 @@ type RenderProps = Omit<ProFieldFCRenderProps, 'text' | 'placeholder'> & ProRend
|
|
|
29
29
|
*
|
|
30
30
|
* @param dataValue
|
|
31
31
|
* @param valueType
|
|
32
|
+
* @param props
|
|
33
|
+
* @param valueTypeMap
|
|
32
34
|
*/
|
|
33
35
|
export declare const pureRenderText: (dataValue: ProFieldTextType, valueType: ProFieldValueType | ProFieldValueObjectType, props: RenderProps, valueTypeMap: Record<string, ProRenderFieldPropsType>) => React.ReactNode;
|
|
34
36
|
/** ProField 的类型 */
|
|
@@ -34,6 +34,8 @@ _dayjs.default.extend(_weekday.default);
|
|
|
34
34
|
*
|
|
35
35
|
* @param dataValue
|
|
36
36
|
* @param valueType
|
|
37
|
+
* @param props
|
|
38
|
+
* @param valueTypeMap
|
|
37
39
|
*/
|
|
38
40
|
const pureRenderText = (dataValue, valueType, props, valueTypeMap) => {
|
|
39
41
|
const {
|
|
@@ -59,11 +61,8 @@ const pureRenderText = (dataValue, valueType, props, valueTypeMap) => {
|
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
|
|
63
|
-
// eslint-disable-next-line no-param-reassign
|
|
64
64
|
delete props.emptyText;
|
|
65
65
|
if (typeof valueType === 'object') {
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
67
66
|
return pureRenderText(dataValue, valueType.type, {
|
|
68
67
|
...valueType,
|
|
69
68
|
...props
|
|
@@ -71,7 +70,6 @@ const pureRenderText = (dataValue, valueType, props, valueTypeMap) => {
|
|
|
71
70
|
}
|
|
72
71
|
const customValueTypeConfig = valueTypeMap && valueTypeMap[valueType];
|
|
73
72
|
if (customValueTypeConfig) {
|
|
74
|
-
// eslint-disable-next-line no-param-reassign
|
|
75
73
|
delete props.ref;
|
|
76
74
|
if (mode === 'read') {
|
|
77
75
|
const readDom = customValueTypeConfig.render?.(dataValue, {
|
|
@@ -136,7 +134,6 @@ const ProFieldComponent = ({
|
|
|
136
134
|
...(0, _utils.omitUndefined)(restFieldProps),
|
|
137
135
|
onChange: onChangeCallBack
|
|
138
136
|
};
|
|
139
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
140
137
|
}, [value, restFieldProps, onChangeCallBack]);
|
|
141
138
|
const renderedDom = pureRenderText(mode === 'edit' ? fieldProps?.value ?? text ?? '' : text ?? fieldProps?.value ?? '', valueType || 'text', (0, _utils.omitUndefined)({
|
|
142
139
|
ref,
|
|
@@ -16,7 +16,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
16
16
|
/**
|
|
17
17
|
* 级联选择组件
|
|
18
18
|
*
|
|
19
|
-
* @param
|
|
19
|
+
* @param placeholder
|
|
20
|
+
* @param formItemRender
|
|
21
|
+
* @param mode
|
|
22
|
+
* @param render
|
|
23
|
+
* @param label
|
|
24
|
+
* @param light
|
|
25
|
+
* @param variant
|
|
26
|
+
* @param rest
|
|
20
27
|
* @param ref
|
|
21
28
|
*/
|
|
22
29
|
const FieldCascader = ({
|
|
@@ -14,7 +14,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
14
14
|
/**
|
|
15
15
|
* 多选组件
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param layout
|
|
18
|
+
* @param formItemRender
|
|
19
|
+
* @param mode
|
|
20
|
+
* @param render
|
|
21
|
+
* @param rest
|
|
18
22
|
* @param ref
|
|
19
23
|
*/
|
|
20
24
|
const FieldCheckbox = ({
|
|
@@ -106,14 +110,11 @@ const FieldCheckbox = ({
|
|
|
106
110
|
}
|
|
107
111
|
if (mode === 'edit') {
|
|
108
112
|
const {
|
|
109
|
-
fieldNames,
|
|
113
|
+
fieldNames: _fieldNames,
|
|
110
114
|
variant,
|
|
111
115
|
...restFieldProps
|
|
112
116
|
} = rest.fieldProps || {};
|
|
113
|
-
const dom = wrapSSR(
|
|
114
|
-
/*#__PURE__*/
|
|
115
|
-
//@ts-ignore
|
|
116
|
-
(0, _jsxRuntime.jsx)(_antd.Checkbox.Group, {
|
|
117
|
+
const dom = wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox.Group, {
|
|
117
118
|
...restFieldProps,
|
|
118
119
|
variant: variant,
|
|
119
120
|
className: (0, _clsx.clsx)(rest.fieldProps?.className, hashId, `${layoutClassName}-${layout}`, {
|
|
@@ -5,6 +5,6 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
|
|
|
5
5
|
format?: string | undefined;
|
|
6
6
|
showTime?: boolean | undefined;
|
|
7
7
|
variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
|
|
8
|
-
picker?: "time" | "date" | "month" | "week" | "
|
|
8
|
+
picker?: "time" | "date" | "month" | "week" | "quarter" | "year" | undefined;
|
|
9
9
|
} & ProFieldLightProps & React.RefAttributes<any>>;
|
|
10
10
|
export default _default;
|
|
@@ -26,7 +26,19 @@ const formatDate = (text, format) => {
|
|
|
26
26
|
/**
|
|
27
27
|
* 日期选择组件
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
29
|
+
* @param text
|
|
30
|
+
* @param mode
|
|
31
|
+
* @param format
|
|
32
|
+
* @param label
|
|
33
|
+
* @param light
|
|
34
|
+
* @param render
|
|
35
|
+
* @param formItemRender
|
|
36
|
+
* @param showTime
|
|
37
|
+
* @param fieldProps
|
|
38
|
+
* @param picker
|
|
39
|
+
* @param lightLabel
|
|
40
|
+
* @param variant
|
|
41
|
+
* @param ref
|
|
30
42
|
*/
|
|
31
43
|
const FieldDatePicker = ({
|
|
32
44
|
text,
|
|
@@ -11,12 +11,25 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _provider = require("../../../provider");
|
|
12
12
|
var _utils = require("../../../utils");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* 判断字符串是否为空或仅包含空白字符
|
|
16
|
+
* @param {string} str - 要检查的字符串
|
|
17
|
+
* @returns {boolean} - 如果为空或仅包含空白字符返回 true,否则返回 false
|
|
18
|
+
*/
|
|
19
|
+
function isEmptyOrWhitespace(str) {
|
|
20
|
+
return (0, _utils.isNil)(str) || str === '' || str?.trim() === '';
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
* 数字组件
|
|
16
25
|
*
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
19
|
-
*
|
|
26
|
+
* @param text
|
|
27
|
+
* @param type
|
|
28
|
+
* @param render
|
|
29
|
+
* @param placeholder
|
|
30
|
+
* @param formItemRender
|
|
31
|
+
* @param fieldProps
|
|
32
|
+
* @param ref
|
|
20
33
|
*/
|
|
21
34
|
const FieldDigit = ({
|
|
22
35
|
text,
|
|
@@ -87,6 +100,10 @@ const FieldDigit = ({
|
|
|
87
100
|
onChange: e => fieldProps?.onChange?.(proxyChange(e)),
|
|
88
101
|
onBlur: e => {
|
|
89
102
|
const value = e.target.value;
|
|
103
|
+
if (isEmptyOrWhitespace(value)) {
|
|
104
|
+
fieldProps?.onBlur?.(e);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
90
107
|
const processedValue = proxyChange(value);
|
|
91
108
|
// 更新输入框的值
|
|
92
109
|
if (e.target && typeof processedValue === 'number') {
|
|
@@ -88,6 +88,7 @@ const FieldDigitRange = ({
|
|
|
88
88
|
const placeholderValue = fieldProps?.placeholder || placeholder || [intl.getMessage('tableForm.inputPlaceholder', '请输入'), intl.getMessage('tableForm.inputPlaceholder', '请输入')];
|
|
89
89
|
const getInputNumberPlaceholder = index => Array.isArray(placeholderValue) ? placeholderValue[index] : placeholderValue;
|
|
90
90
|
const dom = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
|
|
91
|
+
block: true,
|
|
91
92
|
onBlur: handleGroupBlur,
|
|
92
93
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.InputNumber, {
|
|
93
94
|
...fieldProps,
|
|
@@ -123,16 +123,53 @@ const InputNumberPopover = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
123
123
|
numberFormatOptions,
|
|
124
124
|
numberPopoverRender,
|
|
125
125
|
open,
|
|
126
|
+
onOpenChange,
|
|
126
127
|
...rest
|
|
127
128
|
}, ref) => {
|
|
128
129
|
const [value, setValueInner] = (0, _util.useControlledState)(() => rest.defaultValue, rest.value);
|
|
130
|
+
|
|
131
|
+
// 使用本地状态管理 Popover 显示,同时支持受控模式
|
|
132
|
+
const [localOpen, setLocalOpen] = (0, _react.useState)(open ?? false);
|
|
133
|
+
|
|
134
|
+
// 跟踪组件挂载状态,防止在卸载后执行状态更新
|
|
135
|
+
const mountedRef = (0, _react.useRef)(true);
|
|
136
|
+
(0, _react.useEffect)(() => {
|
|
137
|
+
mountedRef.current = true;
|
|
138
|
+
return () => {
|
|
139
|
+
mountedRef.current = false;
|
|
140
|
+
};
|
|
141
|
+
}, []);
|
|
142
|
+
|
|
143
|
+
// 同步外部 open 属性到本地状态,支持受控模式
|
|
144
|
+
(0, _react.useEffect)(() => {
|
|
145
|
+
if (open !== undefined) {
|
|
146
|
+
setLocalOpen(open);
|
|
147
|
+
}
|
|
148
|
+
}, [open]);
|
|
129
149
|
const onChange = (0, _react.useCallback)(updater => {
|
|
130
150
|
setValueInner(prev => {
|
|
131
151
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
132
152
|
rest.onChange?.(next);
|
|
133
153
|
return next;
|
|
134
154
|
});
|
|
135
|
-
}, [rest.onChange]);
|
|
155
|
+
}, [rest.onChange, setValueInner]);
|
|
156
|
+
|
|
157
|
+
// 优化的 onOpenChange 处理器
|
|
158
|
+
const handleOpenChange = (0, _react.useCallback)(visible => {
|
|
159
|
+
// 通知父组件状态变化
|
|
160
|
+
onOpenChange?.(visible);
|
|
161
|
+
|
|
162
|
+
// 如果是受控模式(传入了 open prop),不更新本地状态
|
|
163
|
+
if (open === undefined) {
|
|
164
|
+
// 使用 queueMicrotask 延迟状态更新,避免在渲染期间触发 flushSync
|
|
165
|
+
queueMicrotask(() => {
|
|
166
|
+
// 检查组件是否仍然挂载,避免在卸载后更新状态
|
|
167
|
+
if (mountedRef.current) {
|
|
168
|
+
setLocalOpen(visible);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}, [open, onOpenChange]);
|
|
136
173
|
|
|
137
174
|
/**
|
|
138
175
|
* 如果content 存在要根据 content 渲染一下
|
|
@@ -141,9 +178,20 @@ const InputNumberPopover = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
141
178
|
...rest,
|
|
142
179
|
value
|
|
143
180
|
});
|
|
181
|
+
|
|
182
|
+
// 没有 dom 时不显示 Popover
|
|
183
|
+
if (!dom) {
|
|
184
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.InputNumber, {
|
|
185
|
+
ref: ref,
|
|
186
|
+
...rest,
|
|
187
|
+
value: value,
|
|
188
|
+
onChange: onChange
|
|
189
|
+
});
|
|
190
|
+
}
|
|
144
191
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popover, {
|
|
145
192
|
placement: "topLeft",
|
|
146
|
-
open:
|
|
193
|
+
open: localOpen,
|
|
194
|
+
onOpenChange: handleOpenChange,
|
|
147
195
|
trigger: ['focus', 'click'],
|
|
148
196
|
content: dom,
|
|
149
197
|
getPopupContainer: triggerNode => {
|