@ant-design/pro-components 3.1.2-0 → 3.1.3-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/components/Card/index.js +17 -3
- 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/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/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/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/LightFilter/index.js +7 -4
- package/es/form/layouts/ModalForm/index.js +17 -2
- package/es/form/layouts/QueryFilter/index.js +17 -3
- package/es/form/layouts/StepsForm/index.js +16 -2
- package/es/layout/ProLayout.js +33 -5
- package/es/layout/components/AppsLogoComponents/style/index.js +1 -0
- package/es/layout/components/SettingDrawer/index.js +33 -5
- package/es/list/ListView.js +3 -0
- package/es/provider/index.d.ts +0 -4
- package/es/table/useFetchData.js +16 -2
- package/es/utils/components/FieldLabel/index.js +3 -3
- package/es/utils/components/FieldLabel/style.js +23 -4
- package/es/utils/components/FilterDropdown/index.js +1 -1
- package/es/utils/components/FilterDropdown/style.js +10 -0
- package/es/utils/pickProProps/index.js +1 -1
- package/es/utils/useSelection.js +27 -2
- package/lib/card/components/Card/index.js +16 -2
- 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/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/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/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/LightFilter/index.js +7 -4
- package/lib/form/layouts/ModalForm/index.js +17 -2
- package/lib/form/layouts/QueryFilter/index.js +16 -2
- package/lib/form/layouts/StepsForm/index.js +16 -2
- package/lib/layout/ProLayout.js +32 -4
- package/lib/layout/components/AppsLogoComponents/style/index.js +1 -0
- package/lib/layout/components/SettingDrawer/index.js +32 -4
- package/lib/list/ListView.js +3 -0
- package/lib/provider/index.d.ts +0 -4
- package/lib/table/useFetchData.js +16 -2
- package/lib/utils/components/FieldLabel/index.js +3 -3
- package/lib/utils/components/FieldLabel/style.js +23 -4
- package/lib/utils/components/FilterDropdown/index.js +1 -1
- package/lib/utils/components/FilterDropdown/style.js +10 -0
- package/lib/utils/pickProProps/index.js +1 -1
- package/lib/utils/useSelection.js +26 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { omit, useControlledState } from '@rc-component/util';
|
|
|
3
3
|
import { ConfigProvider, Grid, Tabs } from 'antd';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import React, { useCallback, useContext } from 'react';
|
|
6
|
-
import { LabelIconTip } from "../../../utils";
|
|
6
|
+
import { LabelIconTip, useRefFunction } from "../../../utils";
|
|
7
7
|
import Actions from "../Actions";
|
|
8
8
|
import Loading from "../Loading";
|
|
9
9
|
import useStyle from "./style";
|
|
@@ -61,13 +61,27 @@ const Card = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
61
61
|
xxl: false
|
|
62
62
|
};
|
|
63
63
|
const [collapsed, setCollapsedInner] = useControlledState(defaultCollapsed, controlCollapsed);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
67
|
+
*/
|
|
68
|
+
const onCollapseCallback = useRefFunction(c => {
|
|
69
|
+
onCollapse?.(c);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 使用 queueMicrotask 延迟回调调用,避免在渲染阶段调用外部回调导致的 React 警告
|
|
74
|
+
* "Cannot update a component while rendering a different component"
|
|
75
|
+
*/
|
|
64
76
|
const setCollapsed = useCallback(updater => {
|
|
65
77
|
setCollapsedInner(prev => {
|
|
66
78
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
67
|
-
|
|
79
|
+
queueMicrotask(() => {
|
|
80
|
+
onCollapseCallback(next);
|
|
81
|
+
});
|
|
68
82
|
return next;
|
|
69
83
|
});
|
|
70
|
-
}, [
|
|
84
|
+
}, [onCollapseCallback]);
|
|
71
85
|
|
|
72
86
|
// 顺序决定如何进行响应式取值,按最大响应值依次取值,请勿修改。
|
|
73
87
|
const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useControlledState } from '@rc-component/util';
|
|
2
2
|
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { useRefFunction } from "../utils";
|
|
3
4
|
const useFetchData = (getData, options) => {
|
|
4
5
|
const {
|
|
5
6
|
onRequestError,
|
|
@@ -18,13 +19,27 @@ const useFetchData = (getData, options) => {
|
|
|
18
19
|
});
|
|
19
20
|
}, [onDataSourceChange]);
|
|
20
21
|
const [loading, setLoadingInner] = useControlledState(options?.loading, options?.loading);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
25
|
+
*/
|
|
26
|
+
const onLoadingChange = useRefFunction(l => {
|
|
27
|
+
options?.onLoadingChange?.(l);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 包装 setLoading,使用 queueMicrotask 延迟回调调用
|
|
32
|
+
* 避免在渲染阶段调用外部回调导致的 React 警告
|
|
33
|
+
*/
|
|
21
34
|
const setLoading = useCallback(updater => {
|
|
22
35
|
setLoadingInner(prev => {
|
|
23
36
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
24
|
-
|
|
37
|
+
queueMicrotask(() => {
|
|
38
|
+
onLoadingChange(next);
|
|
39
|
+
});
|
|
25
40
|
return next;
|
|
26
41
|
});
|
|
27
|
-
}, [
|
|
42
|
+
}, [onLoadingChange]);
|
|
28
43
|
const updateDataAndLoading = data => {
|
|
29
44
|
setEntity(data);
|
|
30
45
|
setLoading(false);
|
|
@@ -14,7 +14,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
* @param ref
|
|
15
15
|
*/
|
|
16
16
|
const FieldCascader = ({
|
|
17
|
-
radioType,
|
|
18
17
|
placeholder,
|
|
19
18
|
formItemRender,
|
|
20
19
|
mode,
|
|
@@ -79,7 +78,6 @@ const FieldCascader = ({
|
|
|
79
78
|
if (mode === 'edit') {
|
|
80
79
|
const fieldProps = rest.fieldProps || {};
|
|
81
80
|
let dom = /*#__PURE__*/_jsx(Cascader, {
|
|
82
|
-
variant: !light ? variant : 'borderless',
|
|
83
81
|
ref: cascaderRef,
|
|
84
82
|
open: open,
|
|
85
83
|
suffixIcon: loading ? /*#__PURE__*/_jsx(LoadingOutlined, {}) : undefined,
|
|
@@ -101,6 +101,7 @@ const FieldCheckbox = ({
|
|
|
101
101
|
if (mode === 'edit') {
|
|
102
102
|
const {
|
|
103
103
|
fieldNames,
|
|
104
|
+
variant,
|
|
104
105
|
...restFieldProps
|
|
105
106
|
} = rest.fieldProps || {};
|
|
106
107
|
const dom = wrapSSR(
|
|
@@ -108,6 +109,7 @@ const FieldCheckbox = ({
|
|
|
108
109
|
//@ts-ignore
|
|
109
110
|
_jsx(Checkbox.Group, {
|
|
110
111
|
...restFieldProps,
|
|
112
|
+
variant: variant,
|
|
111
113
|
className: clsx(rest.fieldProps?.className, hashId, `${layoutClassName}-${layout}`, {
|
|
112
114
|
[`${layoutClassName}-error`]: status?.status === 'error',
|
|
113
115
|
[`${layoutClassName}-warning`]: status?.status === 'warning'
|
|
@@ -27,7 +27,6 @@ const FieldCode = ({
|
|
|
27
27
|
render,
|
|
28
28
|
language = 'text',
|
|
29
29
|
formItemRender,
|
|
30
|
-
plain,
|
|
31
30
|
fieldProps
|
|
32
31
|
}, ref) => {
|
|
33
32
|
const code = languageFormat(text, language);
|
|
@@ -65,17 +64,11 @@ const FieldCode = ({
|
|
|
65
64
|
}
|
|
66
65
|
if (mode === 'edit' || mode === 'update') {
|
|
67
66
|
fieldProps.value = code;
|
|
68
|
-
|
|
67
|
+
const dom = /*#__PURE__*/_jsx(Input.TextArea, {
|
|
69
68
|
rows: 5,
|
|
70
69
|
...fieldProps,
|
|
71
70
|
ref: ref
|
|
72
71
|
});
|
|
73
|
-
if (plain) {
|
|
74
|
-
dom = /*#__PURE__*/_jsx(Input, {
|
|
75
|
-
...fieldProps,
|
|
76
|
-
ref: ref
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
72
|
if (formItemRender) {
|
|
80
73
|
return formItemRender(code, {
|
|
81
74
|
mode,
|
|
@@ -3,5 +3,5 @@ import React from 'react';
|
|
|
3
3
|
declare const _default: React.ForwardRefExoticComponent<import("src/provider").BaseProFieldFC & import("src/provider").ProRenderFieldPropsType & {
|
|
4
4
|
text: string;
|
|
5
5
|
mode?: "update" | "read" | "edit" | undefined;
|
|
6
|
-
} & Partial<Omit<ColorPickerProps, "
|
|
6
|
+
} & Partial<Omit<ColorPickerProps, "mode" | "value">> & React.RefAttributes<any>>;
|
|
7
7
|
export default _default;
|
|
@@ -29,12 +29,11 @@ const FieldDatePicker = ({
|
|
|
29
29
|
light,
|
|
30
30
|
render,
|
|
31
31
|
formItemRender,
|
|
32
|
-
plain,
|
|
33
32
|
showTime,
|
|
34
33
|
fieldProps,
|
|
35
34
|
picker,
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
lightLabel,
|
|
36
|
+
variant
|
|
38
37
|
}, ref) => {
|
|
39
38
|
const intl = useIntl();
|
|
40
39
|
const [open, setOpen] = useState(false);
|
|
@@ -82,7 +81,6 @@ const FieldDatePicker = ({
|
|
|
82
81
|
setOpen(isOpen);
|
|
83
82
|
fieldProps?.onOpenChange?.(isOpen);
|
|
84
83
|
},
|
|
85
|
-
variant: "borderless",
|
|
86
84
|
open: open
|
|
87
85
|
}) : undefined,
|
|
88
86
|
allowClear: false,
|
|
@@ -96,7 +94,7 @@ const FieldDatePicker = ({
|
|
|
96
94
|
showTime: showTime,
|
|
97
95
|
format: format,
|
|
98
96
|
placeholder: placeholder,
|
|
99
|
-
variant:
|
|
97
|
+
variant: variant,
|
|
100
98
|
ref: ref,
|
|
101
99
|
...fieldProps,
|
|
102
100
|
value: dayValue
|
|
@@ -2,5 +2,6 @@ import React from 'react';
|
|
|
2
2
|
declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
|
|
3
3
|
text: string;
|
|
4
4
|
format?: string | undefined;
|
|
5
|
+
variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
|
|
5
6
|
} & React.RefAttributes<any>>;
|
|
6
7
|
export default _default;
|
|
@@ -15,7 +15,7 @@ dayjs.extend(relativeTime);
|
|
|
15
15
|
const FieldFromNow = ({
|
|
16
16
|
text,
|
|
17
17
|
mode,
|
|
18
|
-
|
|
18
|
+
variant,
|
|
19
19
|
render,
|
|
20
20
|
formItemRender,
|
|
21
21
|
format,
|
|
@@ -46,7 +46,7 @@ const FieldFromNow = ({
|
|
|
46
46
|
ref: ref,
|
|
47
47
|
placeholder: placeholder,
|
|
48
48
|
showTime: true,
|
|
49
|
-
variant:
|
|
49
|
+
variant: variant ?? fieldProps?.variant ?? 'outlined',
|
|
50
50
|
...fieldProps,
|
|
51
51
|
value: momentValue
|
|
52
52
|
});
|
|
@@ -25,7 +25,6 @@ const FieldProgress = ({
|
|
|
25
25
|
text,
|
|
26
26
|
mode,
|
|
27
27
|
render,
|
|
28
|
-
plain,
|
|
29
28
|
formItemRender,
|
|
30
29
|
fieldProps,
|
|
31
30
|
placeholder
|
|
@@ -42,7 +41,7 @@ const FieldProgress = ({
|
|
|
42
41
|
maxWidth: 320
|
|
43
42
|
},
|
|
44
43
|
percent: realValue,
|
|
45
|
-
steps:
|
|
44
|
+
steps: fieldProps?.steps,
|
|
46
45
|
status: getProgressStatus(realValue),
|
|
47
46
|
...fieldProps
|
|
48
47
|
});
|
|
@@ -19,10 +19,9 @@ const FieldRangePicker = ({
|
|
|
19
19
|
render,
|
|
20
20
|
picker,
|
|
21
21
|
formItemRender,
|
|
22
|
-
plain,
|
|
23
22
|
showTime,
|
|
24
23
|
lightLabel,
|
|
25
|
-
variant,
|
|
24
|
+
variant: propsVariant,
|
|
26
25
|
fieldProps
|
|
27
26
|
}, ref) => {
|
|
28
27
|
const intl = useIntl();
|
|
@@ -87,14 +86,8 @@ const FieldRangePicker = ({
|
|
|
87
86
|
picker: picker,
|
|
88
87
|
showTime: showTime,
|
|
89
88
|
format: format,
|
|
90
|
-
variant: "borderless",
|
|
91
89
|
...fieldProps,
|
|
92
|
-
placeholder: fieldProps.placeholder ?? [intl.getMessage('tableForm.selectPlaceholder', '请选择'), intl.getMessage('tableForm.selectPlaceholder', '请选择')]
|
|
93
|
-
// onClear={() => {
|
|
94
|
-
// setOpen(false);
|
|
95
|
-
// fieldProps?.onClear?.();
|
|
96
|
-
// }}
|
|
97
|
-
,
|
|
90
|
+
placeholder: fieldProps.placeholder ?? [intl.getMessage('tableForm.selectPlaceholder', '请选择'), intl.getMessage('tableForm.selectPlaceholder', '请选择')],
|
|
98
91
|
value: dayValue,
|
|
99
92
|
onOpenChange: isOpen => {
|
|
100
93
|
if (dayValue) setOpen(isOpen);
|
|
@@ -102,8 +95,8 @@ const FieldRangePicker = ({
|
|
|
102
95
|
},
|
|
103
96
|
onChange: handleRangeChange
|
|
104
97
|
}) : null,
|
|
98
|
+
variant: propsVariant,
|
|
105
99
|
allowClear: false,
|
|
106
|
-
variant: variant,
|
|
107
100
|
ref: lightLabel,
|
|
108
101
|
downIcon: dayValue || open ? false : undefined
|
|
109
102
|
});
|
|
@@ -113,7 +106,6 @@ const FieldRangePicker = ({
|
|
|
113
106
|
format: format,
|
|
114
107
|
showTime: showTime,
|
|
115
108
|
placeholder: [intl.getMessage('tableForm.selectPlaceholder', '请选择'), intl.getMessage('tableForm.selectPlaceholder', '请选择')],
|
|
116
|
-
variant: plain === undefined ? variant : plain ? 'borderless' : 'outlined',
|
|
117
109
|
...fieldProps,
|
|
118
110
|
value: dayValue
|
|
119
111
|
});
|
|
@@ -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;
|
|
@@ -26,6 +26,7 @@ export const LightSelect = (props, ref) => {
|
|
|
26
26
|
value,
|
|
27
27
|
mode,
|
|
28
28
|
defaultValue,
|
|
29
|
+
labelVariant,
|
|
29
30
|
size,
|
|
30
31
|
showSearch,
|
|
31
32
|
disabled,
|
|
@@ -72,6 +73,7 @@ export const LightSelect = (props, ref) => {
|
|
|
72
73
|
width: '153px',
|
|
73
74
|
height: '28px',
|
|
74
75
|
visibility: 'hidden',
|
|
76
|
+
opacity: 0,
|
|
75
77
|
'&-selector': {
|
|
76
78
|
height: 28
|
|
77
79
|
}
|
|
@@ -200,7 +202,7 @@ export const LightSelect = (props, ref) => {
|
|
|
200
202
|
label: label,
|
|
201
203
|
placeholder: placeholder,
|
|
202
204
|
disabled: disabled,
|
|
203
|
-
variant:
|
|
205
|
+
variant: labelVariant,
|
|
204
206
|
allowClear: !!allowClear,
|
|
205
207
|
value: filterValue || value?.label || value,
|
|
206
208
|
onClear: () => {
|
|
@@ -47,5 +47,5 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
|
|
|
47
47
|
id?: string | undefined;
|
|
48
48
|
/** 默认搜素条件 */
|
|
49
49
|
defaultKeyWords?: string | undefined;
|
|
50
|
-
} & ProFieldLightProps & Pick<SelectProps<any, import("antd/es/select").DefaultOptionType>, "
|
|
50
|
+
} & ProFieldLightProps & Pick<SelectProps<any, import("antd/es/select").DefaultOptionType>, "style" | "className" | "fieldNames"> & React.RefAttributes<any>>;
|
|
51
51
|
export default _default;
|
|
@@ -306,7 +306,6 @@ const FieldSelect = (props, ref) => {
|
|
|
306
306
|
const renderDom = () => {
|
|
307
307
|
if (light) {
|
|
308
308
|
return /*#__PURE__*/_jsx(LightSelect, {
|
|
309
|
-
variant: variant,
|
|
310
309
|
id: id,
|
|
311
310
|
loading: loading,
|
|
312
311
|
ref: inputRef,
|
|
@@ -314,6 +313,7 @@ const FieldSelect = (props, ref) => {
|
|
|
314
313
|
size: componentSize,
|
|
315
314
|
options: options,
|
|
316
315
|
label: label,
|
|
316
|
+
labelVariant: variant,
|
|
317
317
|
placeholder: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
|
|
318
318
|
lightLabel: lightLabel,
|
|
319
319
|
labelTrigger: labelTrigger,
|
|
@@ -327,7 +327,6 @@ const FieldSelect = (props, ref) => {
|
|
|
327
327
|
minWidth: 100,
|
|
328
328
|
...rest.style
|
|
329
329
|
},
|
|
330
|
-
variant: variant,
|
|
331
330
|
id: id,
|
|
332
331
|
loading: loading,
|
|
333
332
|
ref: inputRef,
|
|
@@ -18,9 +18,10 @@ const FieldSwitch = ({
|
|
|
18
18
|
label,
|
|
19
19
|
formItemRender,
|
|
20
20
|
fieldProps,
|
|
21
|
-
variant
|
|
21
|
+
variant: propsVariant
|
|
22
22
|
}, ref) => {
|
|
23
23
|
const intl = useIntl();
|
|
24
|
+
const variant = propsVariant ?? fieldProps?.variant;
|
|
24
25
|
const dom = useMemo(() => {
|
|
25
26
|
if (text === undefined || text === null || `${text}`.length < 1) return '-';
|
|
26
27
|
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;
|
|
@@ -18,9 +18,9 @@ const FieldTimePicker = ({
|
|
|
18
18
|
format = 'HH:mm:ss',
|
|
19
19
|
render,
|
|
20
20
|
formItemRender,
|
|
21
|
-
plain,
|
|
22
21
|
fieldProps,
|
|
23
|
-
lightLabel
|
|
22
|
+
lightLabel,
|
|
23
|
+
variant
|
|
24
24
|
}, ref) => {
|
|
25
25
|
const [open, setOpen] = useState(false);
|
|
26
26
|
const intl = useIntl();
|
|
@@ -59,8 +59,9 @@ const FieldTimePicker = ({
|
|
|
59
59
|
} : undefined,
|
|
60
60
|
label: label,
|
|
61
61
|
disabled: disabled,
|
|
62
|
+
variant: variant ?? fieldProps?.variant,
|
|
62
63
|
value: dayValue || open ? /*#__PURE__*/_jsx(TimePicker, {
|
|
63
|
-
variant:
|
|
64
|
+
variant: variant ?? fieldProps?.variant,
|
|
64
65
|
format: format,
|
|
65
66
|
ref: ref,
|
|
66
67
|
...fieldProps,
|
|
@@ -80,7 +81,6 @@ const FieldTimePicker = ({
|
|
|
80
81
|
dom = /*#__PURE__*/_jsx(DatePicker.TimePicker, {
|
|
81
82
|
ref: ref,
|
|
82
83
|
format: format,
|
|
83
|
-
variant: plain === undefined ? 'outlined' : plain ? 'borderless' : 'outlined',
|
|
84
84
|
...fieldProps,
|
|
85
85
|
value: dayValue
|
|
86
86
|
});
|
|
@@ -111,8 +111,8 @@ const FieldTimeRangePickerComponents = ({
|
|
|
111
111
|
format = 'HH:mm:ss',
|
|
112
112
|
render,
|
|
113
113
|
formItemRender,
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
fieldProps,
|
|
115
|
+
variant
|
|
116
116
|
}, ref) => {
|
|
117
117
|
const intl = useIntl();
|
|
118
118
|
const [open, setOpen] = useState(false);
|
|
@@ -159,9 +159,10 @@ const FieldTimeRangePickerComponents = ({
|
|
|
159
159
|
} : undefined,
|
|
160
160
|
label: label,
|
|
161
161
|
disabled: disabled,
|
|
162
|
+
variant: variant,
|
|
162
163
|
placeholder: placeholder,
|
|
163
164
|
value: dayValue || open ? /*#__PURE__*/_jsx(TimePicker.RangePicker, {
|
|
164
|
-
variant:
|
|
165
|
+
variant: variant ?? fieldProps?.variant,
|
|
165
166
|
format: format,
|
|
166
167
|
ref: ref,
|
|
167
168
|
...fieldProps,
|
|
@@ -181,7 +182,7 @@ const FieldTimeRangePickerComponents = ({
|
|
|
181
182
|
dom = /*#__PURE__*/_jsx(TimePicker.RangePicker, {
|
|
182
183
|
ref: ref,
|
|
183
184
|
format: format,
|
|
184
|
-
variant:
|
|
185
|
+
variant: variant,
|
|
185
186
|
...fieldProps,
|
|
186
187
|
value: dayValue
|
|
187
188
|
});
|
|
@@ -20,7 +20,7 @@ const FieldTreeSelect = ({
|
|
|
20
20
|
light,
|
|
21
21
|
label,
|
|
22
22
|
render,
|
|
23
|
-
variant,
|
|
23
|
+
variant: propsVariant,
|
|
24
24
|
...rest
|
|
25
25
|
}, ref) => {
|
|
26
26
|
const {
|
|
@@ -41,6 +41,7 @@ const FieldTreeSelect = ({
|
|
|
41
41
|
searchValue: propsSearchValue,
|
|
42
42
|
...fieldProps
|
|
43
43
|
} = rest.fieldProps;
|
|
44
|
+
const variant = propsVariant ?? fieldProps?.variant;
|
|
44
45
|
const intl = useIntl();
|
|
45
46
|
const [loading, options, fetchData] = useFieldFetchData({
|
|
46
47
|
...rest,
|
|
@@ -131,7 +132,6 @@ const FieldTreeSelect = ({
|
|
|
131
132
|
children: [item.label, " ", itemIndex < valuesLength - 1 ? ',' : '']
|
|
132
133
|
});
|
|
133
134
|
} : undefined,
|
|
134
|
-
variant: !light ? variant : 'borderless',
|
|
135
135
|
...fieldProps,
|
|
136
136
|
treeData: options,
|
|
137
137
|
showSearch: showSearch,
|
|
@@ -370,13 +370,27 @@ export function BaseForm(props) {
|
|
|
370
370
|
} = props;
|
|
371
371
|
const formRef = useRef({});
|
|
372
372
|
const [loading, setLoadingInner] = useControlledState(false, propsLoading);
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
376
|
+
*/
|
|
377
|
+
const onLoadingChangeCallback = useRefFunction(l => {
|
|
378
|
+
onLoadingChange?.(l);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* 包装 setLoading,使用 queueMicrotask 延迟回调调用
|
|
383
|
+
* 避免在渲染阶段调用外部回调导致的 React 警告
|
|
384
|
+
*/
|
|
373
385
|
const setLoading = useCallback(updater => {
|
|
374
386
|
setLoadingInner(prev => {
|
|
375
387
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
376
|
-
|
|
388
|
+
queueMicrotask(() => {
|
|
389
|
+
onLoadingChangeCallback(next);
|
|
390
|
+
});
|
|
377
391
|
return next;
|
|
378
392
|
});
|
|
379
|
-
}, [
|
|
393
|
+
}, [onLoadingChangeCallback]);
|
|
380
394
|
const [urlSearch, setUrlSearch] = useUrlSearchParams({}, {
|
|
381
395
|
disabled: !syncToUrl
|
|
382
396
|
});
|
|
@@ -94,7 +94,13 @@ const LightWrapper = props => {
|
|
|
94
94
|
onChange: e => {
|
|
95
95
|
setTempValue(e?.target ? e.target.value : e);
|
|
96
96
|
},
|
|
97
|
-
...children.props
|
|
97
|
+
...children.props,
|
|
98
|
+
// light 模式下由外层 FilterDropdown 统一描边,内层 Select/TreeSelect/DatePicker 等统一使用 borderless,各 Field 组件无需再根据 light 判断
|
|
99
|
+
variant: 'borderless',
|
|
100
|
+
fieldProps: {
|
|
101
|
+
...children.props?.fieldProps,
|
|
102
|
+
variant: 'borderless'
|
|
103
|
+
}
|
|
98
104
|
})
|
|
99
105
|
})
|
|
100
106
|
}));
|
|
@@ -45,7 +45,7 @@ const Submitter = props => {
|
|
|
45
45
|
const dom = [];
|
|
46
46
|
if (resetButtonProps !== false) {
|
|
47
47
|
dom.push( /*#__PURE__*/_createElement(Button, {
|
|
48
|
-
...omit(resetButtonProps ?? {}, ['preventDefault']),
|
|
48
|
+
...omit(resetButtonProps ?? {}, ['preventDefault', 'fieldProps']),
|
|
49
49
|
key: "rest",
|
|
50
50
|
onClick: e => {
|
|
51
51
|
if (!resetButtonProps?.preventDefault) reset();
|
|
@@ -56,7 +56,7 @@ const Submitter = props => {
|
|
|
56
56
|
if (submitButtonProps !== false) {
|
|
57
57
|
dom.push( /*#__PURE__*/_createElement(Button, {
|
|
58
58
|
type: "primary",
|
|
59
|
-
...omit(submitButtonProps || {}, ['preventDefault']),
|
|
59
|
+
...omit(submitButtonProps || {}, ['preventDefault', 'fieldProps']),
|
|
60
60
|
key: "submit",
|
|
61
61
|
onClick: e => {
|
|
62
62
|
if (!submitButtonProps?.preventDefault) submit();
|
|
@@ -16,9 +16,7 @@ export const ProFormDateTimeRangePicker = /*#__PURE__*/React.forwardRef(({
|
|
|
16
16
|
}, ref) => {
|
|
17
17
|
return /*#__PURE__*/_jsx(BaseDateRanger, {
|
|
18
18
|
ref: ref,
|
|
19
|
-
fieldProps:
|
|
20
|
-
...fieldProps
|
|
21
|
-
},
|
|
19
|
+
fieldProps: fieldProps,
|
|
22
20
|
valueType: valueType,
|
|
23
21
|
proFieldProps: proFieldProps,
|
|
24
22
|
fieldConfig: {
|
|
@@ -13,7 +13,7 @@ export type ProFormDigitRangeProps = ProFormFieldItemProps<RangeInputNumberProps
|
|
|
13
13
|
separatorWidth?: number;
|
|
14
14
|
};
|
|
15
15
|
declare const ForwardRefProFormDigit: React.ForwardRefExoticComponent<{
|
|
16
|
-
fieldProps?: Partial<import("../../typing").FieldProps<any> & Omit<InputNumberProps<number>, "
|
|
16
|
+
fieldProps?: Partial<import("../../typing").FieldProps<any> & Omit<InputNumberProps<number>, "value" | "defaultValue" | "onChange" | "placeholder"> & {
|
|
17
17
|
value?: ValuePair | undefined;
|
|
18
18
|
defaultValue?: ValuePair | undefined;
|
|
19
19
|
onChange?: ((value?: ValuePair) => void) | undefined;
|
|
@@ -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>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
2
|
import { PureProField } from "../../../field";
|
|
3
|
-
import {
|
|
3
|
+
import { runFunction, useRefFunction } from "../../../utils";
|
|
4
4
|
import { EditOrReadOnlyContext } from "../../BaseForm/EditOrReadOnlyContext";
|
|
5
5
|
import warpField from "../FormItem/warpField";
|
|
6
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -86,7 +86,5 @@ const BaseProFormField = props => {
|
|
|
86
86
|
params: propsParams
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
const ProFormField = warpField?.(
|
|
90
|
-
return isDeepEqualReact(nextProps, prevProps, ['onChange', 'onBlur']);
|
|
91
|
-
}));
|
|
89
|
+
const ProFormField = warpField?.(BaseProFormField);
|
|
92
90
|
export 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;
|
|
@@ -3,7 +3,7 @@ import { useControlledState } from '@rc-component/util';
|
|
|
3
3
|
import { ConfigProvider, Space } from 'antd';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import React, { useCallback, useContext, useMemo } from 'react';
|
|
6
|
-
import { LabelIconTip } from "../../../../utils";
|
|
6
|
+
import { LabelIconTip, useRefFunction } from "../../../../utils";
|
|
7
7
|
import FieldContext from "../../../FieldContext";
|
|
8
8
|
import { useGridHelpers } from "../../../helpers/grid";
|
|
9
9
|
import { useStyle } from "./style";
|
|
@@ -34,13 +34,27 @@ const Group = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
34
34
|
...props
|
|
35
35
|
};
|
|
36
36
|
const [collapsed, setCollapsedInner] = useControlledState(() => defaultCollapsed || false, props.collapsed);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 使用 useRefFunction 包装回调,确保引用稳定
|
|
40
|
+
*/
|
|
41
|
+
const onCollapseCallback = useRefFunction(c => {
|
|
42
|
+
props.onCollapse?.(c);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 使用 queueMicrotask 延迟回调调用,避免在渲染阶段调用外部回调导致的 React 警告
|
|
47
|
+
* "Cannot update a component while rendering a different component"
|
|
48
|
+
*/
|
|
37
49
|
const setCollapsed = useCallback(updater => {
|
|
38
50
|
setCollapsedInner(prev => {
|
|
39
51
|
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
40
|
-
|
|
52
|
+
queueMicrotask(() => {
|
|
53
|
+
onCollapseCallback(next);
|
|
54
|
+
});
|
|
41
55
|
return next;
|
|
42
56
|
});
|
|
43
|
-
}, [
|
|
57
|
+
}, [onCollapseCallback]);
|
|
44
58
|
const {
|
|
45
59
|
getPrefixCls
|
|
46
60
|
} = useContext(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 };
|