@ant-design/pro-components 3.1.2-0 → 3.1.3-1
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/components/Actions/style.js +1 -0
- package/es/card/components/Card/index.js +17 -3
- package/es/card/components/CheckCard/style.js +1 -0
- package/es/card/components/Divider/style.js +1 -0
- package/es/card/components/Loading/style.js +1 -0
- package/es/card/components/Operation/style.js +1 -0
- package/es/card/components/Statistic/style.js +1 -0
- package/es/card/components/StatisticCard/style.js +1 -0
- package/es/descriptions/useFetchData.js +17 -2
- package/es/field/components/Cascader/index.js +0 -2
- package/es/field/components/Checkbox/index.js +2 -0
- package/es/field/components/Code/index.js +1 -8
- package/es/field/components/ColorPicker/index.d.ts +1 -1
- package/es/field/components/DatePicker/index.js +3 -5
- package/es/field/components/FromNow/index.d.ts +1 -0
- package/es/field/components/FromNow/index.js +2 -2
- package/es/field/components/Money/index.js +0 -1
- package/es/field/components/Progress/index.js +1 -2
- package/es/field/components/RangePicker/index.js +3 -11
- package/es/field/components/Select/LightSelect/index.d.ts +2 -0
- package/es/field/components/Select/LightSelect/index.js +3 -1
- package/es/field/components/Select/index.d.ts +1 -1
- package/es/field/components/Select/index.js +1 -2
- package/es/field/components/Switch/index.js +2 -1
- package/es/field/components/TimePicker/index.d.ts +2 -0
- package/es/field/components/TimePicker/index.js +9 -8
- package/es/field/components/TreeSelect/index.js +2 -2
- package/es/form/BaseForm/BaseForm.js +16 -2
- package/es/form/BaseForm/LightWrapper/index.js +7 -1
- package/es/form/BaseForm/LightWrapper/style.js +2 -0
- package/es/form/BaseForm/Submitter/index.js +2 -2
- package/es/form/components/DatePicker/DateTimePicker.js +1 -0
- package/es/form/components/DateRangePicker/DateTimeRangePicker.js +1 -3
- package/es/form/components/Digit/DigitRange.d.ts +1 -1
- package/es/form/components/Field/index.d.ts +0 -1
- package/es/form/components/Field/index.js +3 -5
- package/es/form/components/FormItem/FormItemRender/index.d.ts +1 -0
- package/es/form/components/FormItem/Group/index.js +17 -3
- package/es/form/components/FormItem/Group/style.js +1 -0
- package/es/form/components/FormItem/index.d.ts +1 -0
- package/es/form/components/FormItem/index.js +16 -31
- package/es/form/components/FormItem/warpField.js +1 -0
- package/es/form/components/List/style.js +1 -0
- package/es/form/helpers/grid.d.ts +7 -3
- package/es/form/helpers/grid.js +19 -4
- package/es/form/layouts/DrawerForm/index.js +16 -2
- package/es/form/layouts/DrawerForm/style.js +1 -0
- package/es/form/layouts/LightFilter/index.js +7 -4
- package/es/form/layouts/LightFilter/style.js +1 -0
- package/es/form/layouts/LoginForm/style.js +1 -0
- package/es/form/layouts/LoginFormPage/style.js +1 -0
- package/es/form/layouts/ModalForm/index.js +17 -2
- package/es/form/layouts/QueryFilter/index.js +17 -3
- package/es/form/layouts/QueryFilter/style.js +1 -0
- package/es/form/layouts/StepsForm/index.js +16 -2
- package/es/form/layouts/StepsForm/style.js +1 -0
- package/es/layout/ProLayout.js +33 -5
- package/es/layout/components/AppsLogoComponents/style/index.js +1 -0
- package/es/layout/components/CollapsedIcon/style.js +1 -0
- package/es/layout/components/GlobalFooter/style.js +1 -0
- package/es/layout/components/GridContent/style.js +1 -0
- package/es/layout/components/SettingDrawer/index.js +33 -5
- package/es/layout/components/TopNavHeader/style.js +1 -0
- package/es/list/ListView.js +3 -0
- package/es/provider/index.d.ts +0 -4
- package/es/provider/useStyle/index.js +1 -2
- package/es/table/components/Alert/style.js +1 -0
- package/es/table/components/ColumnSetting/style.js +1 -0
- package/es/table/components/DragSortTable/style.js +1 -0
- package/es/table/components/ListToolBar/style.js +1 -0
- package/es/table/useFetchData.js +16 -2
- package/es/utils/components/DropdownFooter/style.js +1 -0
- package/es/utils/components/FieldLabel/index.js +3 -3
- package/es/utils/components/FieldLabel/style.js +32 -4
- package/es/utils/components/FilterDropdown/index.js +1 -1
- package/es/utils/components/FilterDropdown/style.js +10 -0
- package/es/utils/components/InlineErrorFormItem/style.js +1 -0
- package/es/utils/components/LabelIconTip/style.js +1 -0
- package/es/utils/pickProProps/index.js +1 -1
- package/es/utils/useSelection.js +27 -2
- package/lib/card/components/Actions/style.js +1 -0
- package/lib/card/components/Card/index.js +16 -2
- package/lib/card/components/CheckCard/style.js +1 -0
- package/lib/card/components/Divider/style.js +1 -0
- package/lib/card/components/Loading/style.js +1 -0
- package/lib/card/components/Operation/style.js +1 -0
- package/lib/card/components/Statistic/style.js +1 -0
- package/lib/card/components/StatisticCard/style.js +1 -0
- package/lib/descriptions/useFetchData.js +17 -2
- package/lib/field/components/Cascader/index.js +0 -2
- package/lib/field/components/Checkbox/index.js +2 -0
- package/lib/field/components/Code/index.js +1 -8
- package/lib/field/components/DatePicker/index.js +3 -5
- package/lib/field/components/FromNow/index.d.ts +1 -0
- package/lib/field/components/FromNow/index.js +2 -2
- package/lib/field/components/Money/index.js +0 -1
- package/lib/field/components/Progress/index.js +1 -2
- package/lib/field/components/RangePicker/index.js +3 -11
- package/lib/field/components/Select/LightSelect/index.d.ts +2 -0
- package/lib/field/components/Select/LightSelect/index.js +3 -1
- package/lib/field/components/Select/index.js +1 -2
- package/lib/field/components/Switch/index.js +2 -1
- package/lib/field/components/TimePicker/index.d.ts +2 -0
- package/lib/field/components/TimePicker/index.js +9 -8
- package/lib/field/components/TreeSelect/index.js +2 -2
- package/lib/form/BaseForm/BaseForm.js +16 -2
- package/lib/form/BaseForm/LightWrapper/index.js +7 -1
- package/lib/form/BaseForm/LightWrapper/style.js +2 -0
- package/lib/form/BaseForm/Submitter/index.js +2 -2
- package/lib/form/components/DatePicker/DateTimePicker.js +1 -0
- package/lib/form/components/DateRangePicker/DateTimeRangePicker.js +1 -3
- package/lib/form/components/Field/index.d.ts +0 -1
- package/lib/form/components/Field/index.js +1 -3
- package/lib/form/components/FormItem/FormItemRender/index.d.ts +1 -0
- package/lib/form/components/FormItem/Group/index.js +16 -2
- package/lib/form/components/FormItem/Group/style.js +1 -0
- package/lib/form/components/FormItem/index.d.ts +1 -0
- package/lib/form/components/FormItem/index.js +16 -31
- package/lib/form/components/FormItem/warpField.js +1 -0
- package/lib/form/components/List/style.js +1 -0
- package/lib/form/helpers/grid.d.ts +7 -3
- package/lib/form/helpers/grid.js +20 -4
- package/lib/form/layouts/DrawerForm/index.js +16 -2
- package/lib/form/layouts/DrawerForm/style.js +1 -0
- package/lib/form/layouts/LightFilter/index.js +7 -4
- package/lib/form/layouts/LightFilter/style.js +1 -0
- package/lib/form/layouts/LoginForm/style.js +1 -0
- package/lib/form/layouts/LoginFormPage/style.js +1 -0
- package/lib/form/layouts/ModalForm/index.js +17 -2
- package/lib/form/layouts/QueryFilter/index.js +16 -2
- package/lib/form/layouts/QueryFilter/style.js +1 -0
- package/lib/form/layouts/StepsForm/index.js +16 -2
- package/lib/form/layouts/StepsForm/style.js +1 -0
- package/lib/layout/ProLayout.js +32 -4
- package/lib/layout/components/AppsLogoComponents/style/index.js +1 -0
- package/lib/layout/components/CollapsedIcon/style.js +1 -0
- package/lib/layout/components/GlobalFooter/style.js +1 -0
- package/lib/layout/components/GridContent/style.js +1 -0
- package/lib/layout/components/SettingDrawer/index.js +32 -4
- package/lib/layout/components/TopNavHeader/style.js +1 -0
- package/lib/list/ListView.js +3 -0
- package/lib/provider/index.d.ts +0 -4
- package/lib/provider/useStyle/index.js +1 -2
- package/lib/table/components/Alert/style.js +1 -0
- package/lib/table/components/ColumnSetting/style.js +1 -0
- package/lib/table/components/DragSortTable/style.js +1 -0
- package/lib/table/components/ListToolBar/style.js +1 -0
- package/lib/table/useFetchData.js +16 -2
- package/lib/utils/components/DropdownFooter/style.js +1 -0
- package/lib/utils/components/FieldLabel/index.js +3 -3
- package/lib/utils/components/FieldLabel/style.js +32 -4
- package/lib/utils/components/FilterDropdown/index.js +1 -1
- package/lib/utils/components/FilterDropdown/style.js +10 -0
- package/lib/utils/components/InlineErrorFormItem/style.js +1 -0
- package/lib/utils/components/LabelIconTip/style.js +1 -0
- package/lib/utils/pickProProps/index.js +1 -1
- package/lib/utils/useSelection.js +26 -1
- package/package.json +1 -1
|
@@ -33,7 +33,6 @@ const FieldProgress = ({
|
|
|
33
33
|
text,
|
|
34
34
|
mode,
|
|
35
35
|
render,
|
|
36
|
-
plain,
|
|
37
36
|
formItemRender,
|
|
38
37
|
fieldProps,
|
|
39
38
|
placeholder
|
|
@@ -50,7 +49,7 @@ const FieldProgress = ({
|
|
|
50
49
|
maxWidth: 320
|
|
51
50
|
},
|
|
52
51
|
percent: realValue,
|
|
53
|
-
steps:
|
|
52
|
+
steps: fieldProps?.steps,
|
|
54
53
|
status: getProgressStatus(realValue),
|
|
55
54
|
...fieldProps
|
|
56
55
|
});
|
|
@@ -26,10 +26,9 @@ const FieldRangePicker = ({
|
|
|
26
26
|
render,
|
|
27
27
|
picker,
|
|
28
28
|
formItemRender,
|
|
29
|
-
plain,
|
|
30
29
|
showTime,
|
|
31
30
|
lightLabel,
|
|
32
|
-
variant,
|
|
31
|
+
variant: propsVariant,
|
|
33
32
|
fieldProps
|
|
34
33
|
}, ref) => {
|
|
35
34
|
const intl = (0, _provider.useIntl)();
|
|
@@ -94,14 +93,8 @@ const FieldRangePicker = ({
|
|
|
94
93
|
picker: picker,
|
|
95
94
|
showTime: showTime,
|
|
96
95
|
format: format,
|
|
97
|
-
variant: "borderless",
|
|
98
96
|
...fieldProps,
|
|
99
|
-
placeholder: fieldProps.placeholder ?? [intl.getMessage('tableForm.selectPlaceholder', '请选择'), intl.getMessage('tableForm.selectPlaceholder', '请选择')]
|
|
100
|
-
// onClear={() => {
|
|
101
|
-
// setOpen(false);
|
|
102
|
-
// fieldProps?.onClear?.();
|
|
103
|
-
// }}
|
|
104
|
-
,
|
|
97
|
+
placeholder: fieldProps.placeholder ?? [intl.getMessage('tableForm.selectPlaceholder', '请选择'), intl.getMessage('tableForm.selectPlaceholder', '请选择')],
|
|
105
98
|
value: dayValue,
|
|
106
99
|
onOpenChange: isOpen => {
|
|
107
100
|
if (dayValue) setOpen(isOpen);
|
|
@@ -109,8 +102,8 @@ const FieldRangePicker = ({
|
|
|
109
102
|
},
|
|
110
103
|
onChange: handleRangeChange
|
|
111
104
|
}) : null,
|
|
105
|
+
variant: propsVariant,
|
|
112
106
|
allowClear: false,
|
|
113
|
-
variant: variant,
|
|
114
107
|
ref: lightLabel,
|
|
115
108
|
downIcon: dayValue || open ? false : undefined
|
|
116
109
|
});
|
|
@@ -120,7 +113,6 @@ const FieldRangePicker = ({
|
|
|
120
113
|
format: format,
|
|
121
114
|
showTime: showTime,
|
|
122
115
|
placeholder: [intl.getMessage('tableForm.selectPlaceholder', '请选择'), intl.getMessage('tableForm.selectPlaceholder', '请选择')],
|
|
123
|
-
variant: plain === undefined ? variant : plain ? 'borderless' : 'outlined',
|
|
124
116
|
...fieldProps,
|
|
125
117
|
value: dayValue
|
|
126
118
|
});
|
|
@@ -15,6 +15,7 @@ export type LightSelectProps = {
|
|
|
15
15
|
fetchDataOnSearch?: boolean;
|
|
16
16
|
/** 变体类型 */
|
|
17
17
|
variant?: 'outlined' | 'borderless' | 'filled' | 'underlined';
|
|
18
|
+
labelVariant?: 'outlined' | 'borderless' | 'filled' | 'underlined';
|
|
18
19
|
} & ProFieldLightProps & SelectProps;
|
|
19
20
|
export declare const LightSelect: React.ForwardRefRenderFunction<any, SelectProps<any> & LightSelectProps>;
|
|
20
21
|
declare const _default: React.ForwardRefExoticComponent<SelectProps<any, import("antd/es/select").DefaultOptionType> & {
|
|
@@ -31,5 +32,6 @@ declare const _default: React.ForwardRefExoticComponent<SelectProps<any, import(
|
|
|
31
32
|
fetchDataOnSearch?: boolean | undefined;
|
|
32
33
|
/** 变体类型 */
|
|
33
34
|
variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
|
|
35
|
+
labelVariant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
|
|
34
36
|
} & ProFieldLightProps & SelectProps<any, import("antd/es/select").DefaultOptionType> & React.RefAttributes<any>>;
|
|
35
37
|
export default _default;
|
|
@@ -32,6 +32,7 @@ const LightSelect = (props, ref) => {
|
|
|
32
32
|
value,
|
|
33
33
|
mode,
|
|
34
34
|
defaultValue,
|
|
35
|
+
labelVariant,
|
|
35
36
|
size,
|
|
36
37
|
showSearch,
|
|
37
38
|
disabled,
|
|
@@ -78,6 +79,7 @@ const LightSelect = (props, ref) => {
|
|
|
78
79
|
width: '153px',
|
|
79
80
|
height: '28px',
|
|
80
81
|
visibility: 'hidden',
|
|
82
|
+
opacity: 0,
|
|
81
83
|
'&-selector': {
|
|
82
84
|
height: 28
|
|
83
85
|
}
|
|
@@ -206,7 +208,7 @@ const LightSelect = (props, ref) => {
|
|
|
206
208
|
label: label,
|
|
207
209
|
placeholder: placeholder,
|
|
208
210
|
disabled: disabled,
|
|
209
|
-
variant:
|
|
211
|
+
variant: labelVariant,
|
|
210
212
|
allowClear: !!allowClear,
|
|
211
213
|
value: filterValue || value?.label || value,
|
|
212
214
|
onClear: () => {
|
|
@@ -315,7 +315,6 @@ const FieldSelect = (props, ref) => {
|
|
|
315
315
|
const renderDom = () => {
|
|
316
316
|
if (light) {
|
|
317
317
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LightSelect.default, {
|
|
318
|
-
variant: variant,
|
|
319
318
|
id: id,
|
|
320
319
|
loading: loading,
|
|
321
320
|
ref: inputRef,
|
|
@@ -323,6 +322,7 @@ const FieldSelect = (props, ref) => {
|
|
|
323
322
|
size: componentSize,
|
|
324
323
|
options: options,
|
|
325
324
|
label: label,
|
|
325
|
+
labelVariant: variant,
|
|
326
326
|
placeholder: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
|
|
327
327
|
lightLabel: lightLabel,
|
|
328
328
|
labelTrigger: labelTrigger,
|
|
@@ -336,7 +336,6 @@ const FieldSelect = (props, ref) => {
|
|
|
336
336
|
minWidth: 100,
|
|
337
337
|
...rest.style
|
|
338
338
|
},
|
|
339
|
-
variant: variant,
|
|
340
339
|
id: id,
|
|
341
340
|
loading: loading,
|
|
342
341
|
ref: inputRef,
|
|
@@ -24,9 +24,10 @@ const FieldSwitch = ({
|
|
|
24
24
|
label,
|
|
25
25
|
formItemRender,
|
|
26
26
|
fieldProps,
|
|
27
|
-
variant
|
|
27
|
+
variant: propsVariant
|
|
28
28
|
}, ref) => {
|
|
29
29
|
const intl = (0, _provider.useIntl)();
|
|
30
|
+
const variant = propsVariant ?? fieldProps?.variant;
|
|
30
31
|
const dom = (0, _react.useMemo)(() => {
|
|
31
32
|
if (text === undefined || text === null || `${text}`.length < 1) return '-';
|
|
32
33
|
return text ? fieldProps?.checkedChildren ?? intl.getMessage('switch.open', '打开') : fieldProps?.unCheckedChildren ?? intl.getMessage('switch.close', '关闭');
|
|
@@ -3,10 +3,12 @@ import type { ProFieldLightProps } from '../../PureProField';
|
|
|
3
3
|
declare const FieldTimeRangePicker: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
|
|
4
4
|
text: string[] | number[];
|
|
5
5
|
format?: string | undefined;
|
|
6
|
+
variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
|
|
6
7
|
} & ProFieldLightProps & React.RefAttributes<any>>;
|
|
7
8
|
export { FieldTimeRangePicker };
|
|
8
9
|
declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
|
|
9
10
|
text: string | number;
|
|
10
11
|
format?: string | undefined;
|
|
12
|
+
variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
|
|
11
13
|
} & ProFieldLightProps & React.RefAttributes<any>>;
|
|
12
14
|
export default _default;
|
|
@@ -25,9 +25,9 @@ const FieldTimePicker = ({
|
|
|
25
25
|
format = 'HH:mm:ss',
|
|
26
26
|
render,
|
|
27
27
|
formItemRender,
|
|
28
|
-
plain,
|
|
29
28
|
fieldProps,
|
|
30
|
-
lightLabel
|
|
29
|
+
lightLabel,
|
|
30
|
+
variant
|
|
31
31
|
}, ref) => {
|
|
32
32
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
33
33
|
const intl = (0, _provider.useIntl)();
|
|
@@ -66,8 +66,9 @@ const FieldTimePicker = ({
|
|
|
66
66
|
} : undefined,
|
|
67
67
|
label: label,
|
|
68
68
|
disabled: disabled,
|
|
69
|
+
variant: variant ?? fieldProps?.variant,
|
|
69
70
|
value: dayValue || open ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.TimePicker, {
|
|
70
|
-
variant:
|
|
71
|
+
variant: variant ?? fieldProps?.variant,
|
|
71
72
|
format: format,
|
|
72
73
|
ref: ref,
|
|
73
74
|
...fieldProps,
|
|
@@ -87,7 +88,6 @@ const FieldTimePicker = ({
|
|
|
87
88
|
dom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.DatePicker.TimePicker, {
|
|
88
89
|
ref: ref,
|
|
89
90
|
format: format,
|
|
90
|
-
variant: plain === undefined ? 'outlined' : plain ? 'borderless' : 'outlined',
|
|
91
91
|
...fieldProps,
|
|
92
92
|
value: dayValue
|
|
93
93
|
});
|
|
@@ -118,8 +118,8 @@ const FieldTimeRangePickerComponents = ({
|
|
|
118
118
|
format = 'HH:mm:ss',
|
|
119
119
|
render,
|
|
120
120
|
formItemRender,
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
fieldProps,
|
|
122
|
+
variant
|
|
123
123
|
}, ref) => {
|
|
124
124
|
const intl = (0, _provider.useIntl)();
|
|
125
125
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
@@ -166,9 +166,10 @@ const FieldTimeRangePickerComponents = ({
|
|
|
166
166
|
} : undefined,
|
|
167
167
|
label: label,
|
|
168
168
|
disabled: disabled,
|
|
169
|
+
variant: variant,
|
|
169
170
|
placeholder: placeholder,
|
|
170
171
|
value: dayValue || open ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.TimePicker.RangePicker, {
|
|
171
|
-
variant:
|
|
172
|
+
variant: variant ?? fieldProps?.variant,
|
|
172
173
|
format: format,
|
|
173
174
|
ref: ref,
|
|
174
175
|
...fieldProps,
|
|
@@ -188,7 +189,7 @@ const FieldTimeRangePickerComponents = ({
|
|
|
188
189
|
dom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.TimePicker.RangePicker, {
|
|
189
190
|
ref: ref,
|
|
190
191
|
format: format,
|
|
191
|
-
variant:
|
|
192
|
+
variant: variant,
|
|
192
193
|
...fieldProps,
|
|
193
194
|
value: dayValue
|
|
194
195
|
});
|
|
@@ -25,7 +25,7 @@ const FieldTreeSelect = ({
|
|
|
25
25
|
light,
|
|
26
26
|
label,
|
|
27
27
|
render,
|
|
28
|
-
variant,
|
|
28
|
+
variant: propsVariant,
|
|
29
29
|
...rest
|
|
30
30
|
}, ref) => {
|
|
31
31
|
const {
|
|
@@ -46,6 +46,7 @@ const FieldTreeSelect = ({
|
|
|
46
46
|
searchValue: propsSearchValue,
|
|
47
47
|
...fieldProps
|
|
48
48
|
} = rest.fieldProps;
|
|
49
|
+
const variant = propsVariant ?? fieldProps?.variant;
|
|
49
50
|
const intl = (0, _provider.useIntl)();
|
|
50
51
|
const [loading, options, fetchData] = (0, _Select.useFieldFetchData)({
|
|
51
52
|
...rest,
|
|
@@ -136,7 +137,6 @@ const FieldTreeSelect = ({
|
|
|
136
137
|
children: [item.label, " ", itemIndex < valuesLength - 1 ? ',' : '']
|
|
137
138
|
});
|
|
138
139
|
} : undefined,
|
|
139
|
-
variant: !light ? variant : 'borderless',
|
|
140
140
|
...fieldProps,
|
|
141
141
|
treeData: options,
|
|
142
142
|
showSearch: showSearch,
|
|
@@ -378,13 +378,27 @@ function BaseForm(props) {
|
|
|
378
378
|
} = props;
|
|
379
379
|
const formRef = (0, _react.useRef)({});
|
|
380
380
|
const [loading, setLoadingInner] = (0, _util.useControlledState)(false, propsLoading);
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
384
|
+
*/
|
|
385
|
+
const onLoadingChangeCallback = (0, _utils.useRefFunction)(l => {
|
|
386
|
+
onLoadingChange?.(l);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* 包装 setLoading,使用 queueMicrotask 延迟回调调用
|
|
391
|
+
* 避免在渲染阶段调用外部回调导致的 React 警告
|
|
392
|
+
*/
|
|
381
393
|
const setLoading = (0, _react.useCallback)(updater => {
|
|
382
394
|
setLoadingInner(prev => {
|
|
383
395
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
384
|
-
|
|
396
|
+
queueMicrotask(() => {
|
|
397
|
+
onLoadingChangeCallback(next);
|
|
398
|
+
});
|
|
385
399
|
return next;
|
|
386
400
|
});
|
|
387
|
-
}, [
|
|
401
|
+
}, [onLoadingChangeCallback]);
|
|
388
402
|
const [urlSearch, setUrlSearch] = (0, _useParams.useUrlSearchParams)({}, {
|
|
389
403
|
disabled: !syncToUrl
|
|
390
404
|
});
|
|
@@ -101,7 +101,13 @@ const LightWrapper = props => {
|
|
|
101
101
|
onChange: e => {
|
|
102
102
|
setTempValue(e?.target ? e.target.value : e);
|
|
103
103
|
},
|
|
104
|
-
...children.props
|
|
104
|
+
...children.props,
|
|
105
|
+
// light 模式下由外层 FilterDropdown 统一描边,内层 Select/TreeSelect/DatePicker 等统一使用 borderless,各 Field 组件无需再根据 light 判断
|
|
106
|
+
variant: 'borderless',
|
|
107
|
+
fieldProps: {
|
|
108
|
+
...children.props?.fieldProps,
|
|
109
|
+
variant: 'borderless'
|
|
110
|
+
}
|
|
105
111
|
})
|
|
106
112
|
})
|
|
107
113
|
}));
|
|
@@ -8,10 +8,12 @@ var _provider = require("../../../provider");
|
|
|
8
8
|
const genProStyle = token => {
|
|
9
9
|
return {
|
|
10
10
|
[`${token.componentCls}-collapse-label`]: {
|
|
11
|
+
boxSizing: 'border-box',
|
|
11
12
|
paddingInline: 1,
|
|
12
13
|
paddingBlock: 1
|
|
13
14
|
},
|
|
14
15
|
[`${token.componentCls}-container`]: {
|
|
16
|
+
boxSizing: 'border-box',
|
|
15
17
|
[`${token.antCls}-form-item`]: {
|
|
16
18
|
marginBlockEnd: 0
|
|
17
19
|
}
|
|
@@ -51,7 +51,7 @@ const Submitter = props => {
|
|
|
51
51
|
const dom = [];
|
|
52
52
|
if (resetButtonProps !== false) {
|
|
53
53
|
dom.push( /*#__PURE__*/(0, _react.createElement)(_antd.Button, {
|
|
54
|
-
...(0, _util.omit)(resetButtonProps ?? {}, ['preventDefault']),
|
|
54
|
+
...(0, _util.omit)(resetButtonProps ?? {}, ['preventDefault', 'fieldProps']),
|
|
55
55
|
key: "rest",
|
|
56
56
|
onClick: e => {
|
|
57
57
|
if (!resetButtonProps?.preventDefault) reset();
|
|
@@ -62,7 +62,7 @@ const Submitter = props => {
|
|
|
62
62
|
if (submitButtonProps !== false) {
|
|
63
63
|
dom.push( /*#__PURE__*/(0, _react.createElement)(_antd.Button, {
|
|
64
64
|
type: "primary",
|
|
65
|
-
...(0, _util.omit)(submitButtonProps || {}, ['preventDefault']),
|
|
65
|
+
...(0, _util.omit)(submitButtonProps || {}, ['preventDefault', 'fieldProps']),
|
|
66
66
|
key: "submit",
|
|
67
67
|
onClick: e => {
|
|
68
68
|
if (!submitButtonProps?.preventDefault) submit();
|
|
@@ -23,9 +23,7 @@ const ProFormDateTimeRangePicker = exports.ProFormDateTimeRangePicker = /*#__PUR
|
|
|
23
23
|
}, ref) => {
|
|
24
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseDateRanger.BaseDateRanger, {
|
|
25
25
|
ref: ref,
|
|
26
|
-
fieldProps:
|
|
27
|
-
...fieldProps
|
|
28
|
-
},
|
|
26
|
+
fieldProps: fieldProps,
|
|
29
27
|
valueType: valueType,
|
|
30
28
|
proFieldProps: proFieldProps,
|
|
31
29
|
fieldConfig: {
|
|
@@ -5,7 +5,6 @@ export type ProFormFieldProps<T = any, FiledProps = Record<string, any>> = ProSc
|
|
|
5
5
|
mode?: 'edit' | 'read' | 'update';
|
|
6
6
|
isDefaultDom?: boolean;
|
|
7
7
|
ref?: any;
|
|
8
|
-
plain?: boolean;
|
|
9
8
|
text?: any;
|
|
10
9
|
getFieldProps?: () => Record<string, any>;
|
|
11
10
|
getFormItemProps?: () => Record<string, any>;
|
|
@@ -93,7 +93,5 @@ const BaseProFormField = props => {
|
|
|
93
93
|
params: propsParams
|
|
94
94
|
});
|
|
95
95
|
};
|
|
96
|
-
const ProFormField = (0, _warpField.default)?.(
|
|
97
|
-
return (0, _utils.isDeepEqualReact)(nextProps, prevProps, ['onChange', 'onBlur']);
|
|
98
|
-
}));
|
|
96
|
+
const ProFormField = (0, _warpField.default)?.(BaseProFormField);
|
|
99
97
|
var _default = exports.default = ProFormField;
|
|
@@ -130,6 +130,7 @@ export declare const ProFormItemRender: React.FC<Omit<import("antd").FormItemPro
|
|
|
130
130
|
dataFormat?: string | undefined;
|
|
131
131
|
lightProps?: import("src/form").LightWrapperProps | undefined;
|
|
132
132
|
proFormFieldKey?: any;
|
|
133
|
+
fieldProps?: Record<string, any> | undefined;
|
|
133
134
|
} & {
|
|
134
135
|
addonBefore?: React.ReactNode;
|
|
135
136
|
addonAfter?: React.ReactNode;
|
|
@@ -41,13 +41,27 @@ const Group = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
41
41
|
...props
|
|
42
42
|
};
|
|
43
43
|
const [collapsed, setCollapsedInner] = (0, _util.useControlledState)(() => defaultCollapsed || false, props.collapsed);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
47
|
+
*/
|
|
48
|
+
const onCollapseCallback = (0, _utils.useRefFunction)(c => {
|
|
49
|
+
props.onCollapse?.(c);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 使用 queueMicrotask 延迟回调调用,避免在渲染阶段调用外部回调导致的 React 警告
|
|
54
|
+
* "Cannot update a component while rendering a different component"
|
|
55
|
+
*/
|
|
44
56
|
const setCollapsed = (0, _react.useCallback)(updater => {
|
|
45
57
|
setCollapsedInner(prev => {
|
|
46
58
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
47
|
-
|
|
59
|
+
queueMicrotask(() => {
|
|
60
|
+
onCollapseCallback(next);
|
|
61
|
+
});
|
|
48
62
|
return next;
|
|
49
63
|
});
|
|
50
|
-
}, [
|
|
64
|
+
}, [onCollapseCallback]);
|
|
51
65
|
const {
|
|
52
66
|
getPrefixCls
|
|
53
67
|
} = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext);
|
|
@@ -56,6 +56,7 @@ export type ProFormItemProps = FormItemProps & {
|
|
|
56
56
|
dataFormat?: string;
|
|
57
57
|
lightProps?: LightWrapperProps;
|
|
58
58
|
proFormFieldKey?: any;
|
|
59
|
+
fieldProps?: Record<string, any>;
|
|
59
60
|
} & WarpFormItemProps;
|
|
60
61
|
declare const ProFormItem: React.FC<ProFormItemProps>;
|
|
61
62
|
export { FormItemProvide };
|
|
@@ -81,12 +81,23 @@ const WithValueFomFiledProps = formFieldProps => {
|
|
|
81
81
|
if (! /*#__PURE__*/_react.default.isValidElement(filedChildren)) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
82
82
|
children: filedChildren
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
// restProps 可能来自 LightWrapper 的 cloneElement(light 模式下传入 variant/fieldProps),需保留以覆盖 filedChildren.props,避免内层控件线框双线
|
|
86
|
+
const variantFromRest = restProps.variant;
|
|
87
|
+
const fieldPropsFromRest = restProps.fieldProps;
|
|
84
88
|
return /*#__PURE__*/_react.default.cloneElement(filedChildren, (0, _utils.omitUndefined)({
|
|
85
89
|
...restProps,
|
|
86
90
|
[valuePropName]: formFieldProps[valuePropName],
|
|
87
91
|
...filedChildren.props,
|
|
88
92
|
onChange: finalChange,
|
|
89
|
-
fieldProps
|
|
93
|
+
fieldProps: {
|
|
94
|
+
...filedChildren.props?.fieldProps,
|
|
95
|
+
...fieldPropsFromRest,
|
|
96
|
+
...fieldProps
|
|
97
|
+
},
|
|
98
|
+
...(variantFromRest !== undefined && {
|
|
99
|
+
variant: variantFromRest
|
|
100
|
+
}),
|
|
90
101
|
onBlur: isProFormComponent && !isValidElementForFiledChildren && onBlur
|
|
91
102
|
}));
|
|
92
103
|
};
|
|
@@ -120,36 +131,8 @@ const WarpFormItem = ({
|
|
|
120
131
|
if (!addonAfter && !addonBefore) {
|
|
121
132
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
122
133
|
...props,
|
|
123
|
-
//help={typeof help !== 'function' ? help : undefined}
|
|
124
134
|
valuePropName: valuePropName,
|
|
125
|
-
getValueProps: getValuePropsFunc
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
// _internalItemRender={{
|
|
128
|
-
// mark: 'pro_table_render',
|
|
129
|
-
// render: (
|
|
130
|
-
// inputProps: FormItemProps & {
|
|
131
|
-
// errors: React.ReactNode[];
|
|
132
|
-
// warnings: React.ReactNode[];
|
|
133
|
-
// },
|
|
134
|
-
// doms: {
|
|
135
|
-
// input: JSX.Element;
|
|
136
|
-
// errorList: JSX.Element;
|
|
137
|
-
// extra: JSX.Element;
|
|
138
|
-
// },
|
|
139
|
-
// ) => (
|
|
140
|
-
// <>
|
|
141
|
-
// {doms.input}
|
|
142
|
-
// {typeof help === 'function'
|
|
143
|
-
// ? help({
|
|
144
|
-
// errors: inputProps.errors,
|
|
145
|
-
// warnings: inputProps.warnings,
|
|
146
|
-
// })
|
|
147
|
-
// : doms.errorList}
|
|
148
|
-
// {doms.extra}
|
|
149
|
-
// </>
|
|
150
|
-
// ),
|
|
151
|
-
// }}
|
|
152
|
-
,
|
|
135
|
+
getValueProps: getValuePropsFunc,
|
|
153
136
|
children: children
|
|
154
137
|
});
|
|
155
138
|
}
|
|
@@ -215,6 +198,7 @@ const ProFormItem = props => {
|
|
|
215
198
|
ignoreFormItem,
|
|
216
199
|
lightProps,
|
|
217
200
|
children: unusedChildren,
|
|
201
|
+
fieldProps,
|
|
218
202
|
...rest
|
|
219
203
|
} = props;
|
|
220
204
|
const formListField = (0, _react.useContext)(_List.FormListContext);
|
|
@@ -268,8 +252,9 @@ const ProFormItem = props => {
|
|
|
268
252
|
valuePropName: props.valuePropName,
|
|
269
253
|
children: props.children
|
|
270
254
|
}, rest.proFormFieldKey || rest.name?.toString());
|
|
255
|
+
const lightPropsForWrapper = (0, _utils.omitUndefined)(lightProps || {});
|
|
271
256
|
const lightDom = noLightFormItem ? children : /*#__PURE__*/(0, _react.createElement)(_BaseForm.LightWrapper, {
|
|
272
|
-
...
|
|
257
|
+
...lightPropsForWrapper,
|
|
273
258
|
key: rest.proFormFieldKey || rest.name?.toString(),
|
|
274
259
|
size: size
|
|
275
260
|
}, children);
|
|
@@ -234,6 +234,7 @@ function warpField(Field, config) {
|
|
|
234
234
|
convertValue: convertValue,
|
|
235
235
|
lightProps: (0, _utils.omitUndefined)({
|
|
236
236
|
...fieldProps,
|
|
237
|
+
variant: rest.variant ?? fieldProps?.variant,
|
|
237
238
|
valueType,
|
|
238
239
|
bordered,
|
|
239
240
|
allowClear: field?.props?.allowClear ?? allowClear,
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ColProps, RowProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import type { ProFormGridConfig } from '../typing';
|
|
4
|
-
export declare const GridContext:
|
|
4
|
+
export declare const GridContext: React.Context<ProFormGridConfig>;
|
|
5
5
|
interface CommonProps {
|
|
6
6
|
Wrapper?: React.FC<any>;
|
|
7
7
|
}
|
|
8
|
+
interface ColWrapperProps extends ColProps, CommonProps {
|
|
9
|
+
variant?: string;
|
|
10
|
+
fieldProps?: Record<string, any>;
|
|
11
|
+
}
|
|
8
12
|
export interface GridHelpers {
|
|
9
13
|
RowWrapper: React.FC<RowProps & CommonProps>;
|
|
10
|
-
ColWrapper: React.FC<
|
|
14
|
+
ColWrapper: React.FC<ColWrapperProps>;
|
|
11
15
|
grid: boolean;
|
|
12
16
|
}
|
|
13
17
|
export declare const gridHelpers: (config: ProFormGridConfig & CommonProps) => GridHelpers;
|
package/lib/form/helpers/grid.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.useGridHelpers = exports.gridHelpers = exports.GridContext = void 0;
|
|
7
8
|
var _antd = require("antd");
|
|
8
|
-
var _react = require("react");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
const GridContext = exports.GridContext = /*#__PURE__*/(0, _react.createContext)({
|
|
11
12
|
grid: false,
|
|
@@ -38,6 +39,8 @@ const gridHelpers = ({
|
|
|
38
39
|
ColWrapper({
|
|
39
40
|
children,
|
|
40
41
|
Wrapper,
|
|
42
|
+
variant,
|
|
43
|
+
fieldProps,
|
|
41
44
|
...rest
|
|
42
45
|
} = {}) {
|
|
43
46
|
const props = (0, _react.useMemo)(() => {
|
|
@@ -55,14 +58,27 @@ const gridHelpers = ({
|
|
|
55
58
|
}
|
|
56
59
|
return originProps;
|
|
57
60
|
}, [rest]);
|
|
61
|
+
|
|
62
|
+
// LightFilter clone 传入的 variant/fieldProps 需透传给 ProFormItem,否则 lightProps 无 variant
|
|
63
|
+
const childrenWithProps = (variant !== undefined || fieldProps !== undefined) && _react.default.Children.count(children) === 1 && /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, {
|
|
64
|
+
...(variant !== undefined && {
|
|
65
|
+
variant
|
|
66
|
+
}),
|
|
67
|
+
...(fieldProps && {
|
|
68
|
+
fieldProps: {
|
|
69
|
+
...children?.props?.fieldProps,
|
|
70
|
+
...fieldProps
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
}) : children;
|
|
58
74
|
if (!grid) {
|
|
59
75
|
return Wrapper ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
60
|
-
children:
|
|
61
|
-
}) :
|
|
76
|
+
children: childrenWithProps
|
|
77
|
+
}) : childrenWithProps;
|
|
62
78
|
}
|
|
63
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Col, {
|
|
64
80
|
...props,
|
|
65
|
-
children:
|
|
81
|
+
children: childrenWithProps
|
|
66
82
|
});
|
|
67
83
|
}
|
|
68
84
|
});
|
|
@@ -64,13 +64,27 @@ function DrawerForm({
|
|
|
64
64
|
const [resizableDrawer, setResizableDrawer] = (0, _react.useState)(false);
|
|
65
65
|
const [drawerWidth, setDrawerWidth] = (0, _react.useState)(width ? width : resize ? resizeInfo?.minWidth : 800);
|
|
66
66
|
const [open, setOpenInner] = (0, _util.useControlledState)(!!propsOpen, propsOpen);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
70
|
+
*/
|
|
71
|
+
const onOpenChangeCallback = (0, _utils.useRefFunction)(o => {
|
|
72
|
+
onOpenChange?.(o);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 使用 queueMicrotask 延迟回调调用,避免在渲染阶段调用外部回调导致的 React 警告
|
|
77
|
+
* "Cannot update a component while rendering a different component"
|
|
78
|
+
*/
|
|
67
79
|
const setOpen = (0, _react.useCallback)(updater => {
|
|
68
80
|
setOpenInner(prev => {
|
|
69
81
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
70
|
-
|
|
82
|
+
queueMicrotask(() => {
|
|
83
|
+
onOpenChangeCallback(next);
|
|
84
|
+
});
|
|
71
85
|
return next;
|
|
72
86
|
});
|
|
73
|
-
}, [
|
|
87
|
+
}, [onOpenChangeCallback]);
|
|
74
88
|
const footerRef = (0, _react.useRef)(null);
|
|
75
89
|
const footerDomRef = (0, _react.useCallback)(element => {
|
|
76
90
|
if (footerRef.current === null && element) {
|