@zat-design/sisyphus-react 4.5.9-beta.1 → 4.5.10-beta.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.
Files changed (55) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/ProAction/components/CheckModalContent/index.js +2 -2
  4. package/es/ProConfigProvider/index.js +12 -3
  5. package/es/ProDownload/index.d.ts +2 -1
  6. package/es/ProDownload/index.js +48 -35
  7. package/es/ProDownload/utils.d.ts +10 -5
  8. package/es/ProDownload/utils.js +28 -13
  9. package/es/ProEditTable/utils/index.js +6 -1
  10. package/es/ProEnum/hooks/useEnumRequest.js +98 -77
  11. package/es/ProEnum/index.js +3 -4
  12. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  13. package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
  14. package/es/ProForm/components/combination/FormList/components/BlockFields.js +1 -0
  15. package/es/ProForm/components/combination/FormList/components/Empty.js +1 -1
  16. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +3 -3
  17. package/es/ProForm/components/combination/FormList/style/index.less +6 -0
  18. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +5 -11
  19. package/es/ProForm/components/combination/Group/hooks/index.js +1 -1
  20. package/es/ProForm/components/combination/Group/index.js +1 -1
  21. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +22 -8
  22. package/es/ProForm/components/combination/ProModalSelect/index.js +32 -12
  23. package/es/ProForm/components/combination/ProRangeLimit/index.js +1 -1
  24. package/es/ProForm/components/render/Render.js +2 -2
  25. package/es/ProForm/hooks/useWatch.js +7 -8
  26. package/es/ProForm/utils/index.js +2 -2
  27. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +8 -8
  28. package/es/ProLayout/components/Layout/Menu/index.js +1 -1
  29. package/es/ProLayout/components/ProFooter/index.js +2 -1
  30. package/es/ProLayout/components/ProHeader/components/Describe/index.js +3 -1
  31. package/es/ProLayout/components/TabsManager/components/TabItem.js +6 -5
  32. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +104 -16
  33. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
  34. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +295 -0
  35. package/es/ProLayout/components/TabsManager/index.js +54 -14
  36. package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
  37. package/es/ProLayout/components/TabsManager/style/index.less +1 -1
  38. package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
  39. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +62 -0
  40. package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
  41. package/es/ProLayout/components/TabsManager/utils/index.js +63 -9
  42. package/es/ProLayout/images/logoImg.png +0 -0
  43. package/es/ProLayout/index.js +6 -3
  44. package/es/ProLayout/propTypes.d.ts +28 -1
  45. package/es/ProSelect/index.js +10 -1
  46. package/es/ProSelect/style/index.less +13 -0
  47. package/es/ProStep/style/index.less +1 -1
  48. package/es/ProTable/hooks/useAntdTable.js +11 -10
  49. package/es/ProTabs/index.js +3 -3
  50. package/es/ProTooltip/index.js +2 -5
  51. package/es/ProTree/components/ProTreeSelect/index.js +2 -2
  52. package/es/ProTreeModal/index.js +1 -4
  53. package/es/ProUpload/components/DragRender.js +0 -14
  54. package/package.json +5 -1
  55. package/es/ProConfigProvider/demo/locale.js +0 -58
@@ -17,10 +17,10 @@ const CheckModalContent = props => {
17
17
  children: list[0]
18
18
  }) : null, Array.isArray(list) && list.length > 1 ? /*#__PURE__*/_jsx("div", {
19
19
  className: "list-wrap",
20
- children: list.map(item => /*#__PURE__*/_jsx("div", {
20
+ children: list.map((item, index) => /*#__PURE__*/_jsx("div", {
21
21
  className: "err-item",
22
22
  children: item
23
- }))
23
+ }, `${item}-${index}`))
24
24
  }) : null]
25
25
  })
26
26
  });
@@ -129,10 +129,19 @@ export const ProConfigProvider = props => {
129
129
  const lang = state?.locale ?? cacheLang ?? props?.locale ?? 'zh-CN';
130
130
  useEffect(() => {
131
131
  const raw = localStorage.getItem('localConfig');
132
- const localConfig = JSON.parse(raw || '{}');
132
+ let localConfig;
133
+ try {
134
+ localConfig = JSON.parse(raw || '{}');
135
+ } catch {
136
+ localStorage.removeItem('localConfig');
137
+ if (process.env.NODE_ENV !== 'production') {
138
+ console.warn('ProConfigProvider: invalid localConfig cache has been removed.');
139
+ }
140
+ return;
141
+ }
133
142
  dispatch({
134
143
  type: 'set',
135
- payload: merge(initialState, localConfig)
144
+ payload: merge({}, initialState, localConfig)
136
145
  });
137
146
  }, []);
138
147
  useEffect(() => {
@@ -147,7 +156,7 @@ export const ProConfigProvider = props => {
147
156
  return /*#__PURE__*/_jsx(ThemeProvider, {
148
157
  children: /*#__PURE__*/_jsx(ProConfigContext.Provider, {
149
158
  value: {
150
- state: merge(state, props.value),
159
+ state: merge({}, state, props.value),
151
160
  dispatch
152
161
  },
153
162
  children: /*#__PURE__*/_jsx(ThemeAwareConfigProvider, {
@@ -1,6 +1,7 @@
1
+ import { DownloadRequest } from './utils';
1
2
  import type { ProDownloadType } from './propsType';
2
3
  declare const ProDownload: {
3
4
  (props: ProDownloadType): import("react/jsx-runtime").JSX.Element;
4
- downLoadRequest: import("./utils").DownloadRequestProps;
5
+ downLoadRequest: typeof DownloadRequest;
5
6
  };
6
7
  export default ProDownload;
@@ -6,6 +6,12 @@ import classNames from 'classnames';
6
6
  import { BlobMakeFile, DownloadRequest } from "./utils";
7
7
  import { useProConfig } from "../ProConfigProvider";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ const normalizeError = error => {
10
+ if (error !== null && typeof error === 'object') {
11
+ return error;
12
+ }
13
+ return new Error(error == null ? 'Download request failed' : String(error));
14
+ };
9
15
  const ProDownload = props => {
10
16
  const {
11
17
  source,
@@ -31,40 +37,42 @@ const ProDownload = props => {
31
37
  headers,
32
38
  onError: onErrorConfig
33
39
  } = useProConfig('ProDownload') || {};
40
+ const reportError = onError || onErrorConfig;
34
41
  defaultProps.headers = {
35
42
  ...headers,
36
43
  ...defaultProps.headers
37
44
  };
38
- const handDownload = async () => {
45
+ const handDownload = async (_params = params) => {
39
46
  if (source === 'url') {
40
- try {
41
- fetch(url || action).then(response => {
42
- if (response.status > 400) {
43
- return Promise.reject(new Error(`Service exception: ${response.status}`));
44
- }
45
- return response.blob();
46
- }).then(res => {
47
- const blob = new Blob([res]);
48
- BlobMakeFile({
49
- blob,
50
- fileName
51
- });
47
+ fetch(url || action).then(response => {
48
+ if (response.status > 400) {
49
+ return Promise.reject(new Error(`Service exception: ${response.status}`));
50
+ }
51
+ return response.blob();
52
+ }).then(res => {
53
+ const blob = new Blob([res]);
54
+ BlobMakeFile({
55
+ blob,
56
+ fileName
52
57
  });
53
- } catch (error) {
54
- Promise.reject(error);
55
- }
58
+ }).catch(error => {
59
+ reportError?.(normalizeError(error));
60
+ });
56
61
  return;
57
62
  }
58
63
  setState({
59
64
  loading: true
60
65
  });
61
- let _params = params;
62
- if (_isFunction(params)) {
63
- _params = params.constructor.name === 'AsyncFunction' ? await params() : params();
64
- }
65
-
66
- // 发起请求
66
+ let errorReported = false;
67
+ const requestOnError = error => {
68
+ if (errorReported) {
69
+ return;
70
+ }
71
+ errorReported = true;
72
+ reportError?.(normalizeError(error));
73
+ };
67
74
  try {
75
+ // 发起请求
68
76
  await DownloadRequest({
69
77
  url: url || action,
70
78
  method,
@@ -73,13 +81,10 @@ const ProDownload = props => {
73
81
  transformResponse,
74
82
  fileName,
75
83
  onFinish,
76
- onError: onError || onErrorConfig
84
+ onError: requestOnError
77
85
  });
78
86
  } catch (error) {
79
- setState({
80
- loading: false
81
- });
82
- return Promise.reject();
87
+ requestOnError(error);
83
88
  } finally {
84
89
  setState({
85
90
  loading: false
@@ -92,16 +97,24 @@ const ProDownload = props => {
92
97
  return /*#__PURE__*/_jsx(Button, {
93
98
  className: cls,
94
99
  onClick: async () => {
95
- if (_isBoolean(beforeDownload) && !beforeDownload) {
96
- return false;
97
- }
98
- if (beforeDownload) {
99
- const res = beforeDownload instanceof (async () => {}).constructor ? await beforeDownload() : beforeDownload();
100
- if (res === false) {
101
- return;
100
+ let resolvedParams = params;
101
+ try {
102
+ if (_isBoolean(beforeDownload) && !beforeDownload) {
103
+ return false;
102
104
  }
105
+ if (beforeDownload) {
106
+ const res = await Promise.resolve(beforeDownload());
107
+ if (res === false) {
108
+ return;
109
+ }
110
+ }
111
+ if (source !== 'url' && _isFunction(params)) {
112
+ resolvedParams = await Promise.resolve(params());
113
+ }
114
+ } catch {
115
+ return false;
103
116
  }
104
- handDownload();
117
+ return handDownload(resolvedParams);
105
118
  },
106
119
  ...defaultProps,
107
120
  loading: loading,
@@ -3,7 +3,7 @@ export interface PropsWithMakeFilePropsType {
3
3
  fileName: string;
4
4
  url?: string;
5
5
  }
6
- export interface IDownloadRequestPropsType {
6
+ export interface IDownloadRequestPropsType<TResult = Response> {
7
7
  /**
8
8
  * @description 下载请求的地址
9
9
  * @default (必选)
@@ -21,12 +21,12 @@ export interface IDownloadRequestPropsType {
21
21
  params?: any;
22
22
  headers?: any;
23
23
  /** 格式化数据 */
24
- transformResponse?: (data: any) => any;
24
+ transformResponse?: (data: any) => TResult | Promise<TResult>;
25
25
  /**
26
26
  * @description service 执行完成时触发
27
27
  * @default -
28
28
  */
29
- onFinish?: (response: object, params: object) => void;
29
+ onFinish?: (response: Awaited<TResult>, params: object) => void;
30
30
  /**
31
31
  * @description 下载保存的文件名
32
32
  * @default (必选)
@@ -47,7 +47,6 @@ export interface IDownloadRequestPropsType {
47
47
  * @constructor
48
48
  */
49
49
  export declare function BlobMakeFile({ blob, fileName, url }: PropsWithMakeFilePropsType): void;
50
- export type DownloadRequestProps = (props: IDownloadRequestPropsType) => Promise<Response>;
51
50
  type convertBase64ToBlobType = (base64: string, fileType?: string, slice?: number) => Blob;
52
51
  export declare const convertBase64ToBlob: convertBase64ToBlobType;
53
52
  /**
@@ -56,5 +55,11 @@ export declare const convertBase64ToBlob: convertBase64ToBlobType;
56
55
  * @returns string
57
56
  */
58
57
  export declare function getFilenameFromContentDisposition(contentDisposition: any): string;
59
- export declare const DownloadRequest: DownloadRequestProps;
58
+ export declare function DownloadRequest<TResult>(props: IDownloadRequestPropsType<TResult> & {
59
+ transformResponse: (data: any) => TResult | Promise<TResult>;
60
+ }): Promise<Awaited<TResult>>;
61
+ export declare function DownloadRequest(props: IDownloadRequestPropsType<Response> & {
62
+ transformResponse?: undefined;
63
+ }): Promise<Response>;
64
+ export type DownloadRequestProps = typeof DownloadRequest;
60
65
  export {};
@@ -71,7 +71,8 @@ export function getFilenameFromContentDisposition(contentDisposition) {
71
71
  }
72
72
 
73
73
  // 发起请求获取下载文件
74
- export const DownloadRequest = async ({
74
+
75
+ export async function DownloadRequest({
75
76
  url,
76
77
  method = 'post',
77
78
  params,
@@ -80,7 +81,7 @@ export const DownloadRequest = async ({
80
81
  fileName,
81
82
  onFinish,
82
83
  onError
83
- }) => {
84
+ }) {
84
85
  const config = {
85
86
  method,
86
87
  credentials: 'include',
@@ -105,7 +106,11 @@ export const DownloadRequest = async ({
105
106
  ...headers
106
107
  };
107
108
  }
108
- const res = await fetch(url, config).then(async response => {
109
+ const response = await fetch(url, config);
110
+ const {
111
+ res,
112
+ responseData
113
+ } = await (async () => {
109
114
  try {
110
115
  const data = await response.clone().json();
111
116
  if (!data) {
@@ -120,16 +125,25 @@ export const DownloadRequest = async ({
120
125
  return Promise.reject(errorMsg);
121
126
  }
122
127
  if (_isFunction(transformResponse)) {
123
- return Promise.resolve(transformResponse(data));
128
+ return Promise.resolve(transformResponse(data)).then(transformedData => ({
129
+ res: transformedData,
130
+ responseData: data
131
+ }));
124
132
  }
125
- Promise.resolve(data);
133
+ return Promise.resolve({
134
+ res: response,
135
+ responseData: data
136
+ });
126
137
  } catch (error) {
127
138
  if (response.ok) {
128
- return Promise.resolve(response);
139
+ return Promise.resolve({
140
+ res: response,
141
+ responseData: null
142
+ });
129
143
  }
130
144
  }
131
145
  return Promise.reject(`${locale.ProDownload.errorMessage}`);
132
- });
146
+ })();
133
147
  let fileBlob;
134
148
  let data = null;
135
149
  let contentFileName = '';
@@ -137,19 +151,20 @@ export const DownloadRequest = async ({
137
151
  data = res;
138
152
  } else {
139
153
  // 优先获取Content-Disposition中filename
140
- contentFileName = getFilenameFromContentDisposition(res.headers.get('Content-Disposition'));
141
- data = _get(res, 'data');
154
+ contentFileName = getFilenameFromContentDisposition(response.headers.get('Content-Disposition'));
155
+ data = _get(responseData, 'data');
142
156
  }
143
157
  if (data) {
144
158
  fileBlob = convertBase64ToBlob(data);
145
159
  } else {
146
- fileBlob = await res.blob();
160
+ fileBlob = await response.blob();
147
161
  }
148
162
  // 完成回调
149
- onFinish?.(res, params);
163
+ const result = _isFunction(transformResponse) ? res : response;
164
+ onFinish?.(result, params);
150
165
  BlobMakeFile({
151
166
  blob: fileBlob,
152
167
  fileName: fileName || contentFileName
153
168
  });
154
- return Promise.resolve(res);
155
- };
169
+ return result;
170
+ }
@@ -112,7 +112,12 @@ const getActionColumn = config => {
112
112
  }
113
113
  }
114
114
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
115
- const lastRecord = filterInternalFields(form.getFieldValue(rowName) ?? record);
115
+ const fieldRecord = filterInternalFields(form.getFieldValue(rowName));
116
+ const lastRecord = {
117
+ ...record,
118
+ ...(fieldRecord && typeof fieldRecord === 'object' ? fieldRecord : {}),
119
+ rowKey: record.rowKey
120
+ };
116
121
  // 新增事件可以设置初始默认值,当做函数的出参导出
117
122
  const onEvent = onClick || onHandle;
118
123
  let result;
@@ -34,6 +34,7 @@ const useEnumRequest = (props, dispatch) => {
34
34
  // 而非跳过 run()。这样 enumRes.data/loading 正常变更,
35
35
  // ProConfigProvider 的 onSuccess 回调能正常触发(修复白屏问题)。
36
36
  const fromCacheRef = useRef(null);
37
+ const errorReportedRef = useRef(false);
37
38
  const originalService = useRequest?.service;
38
39
  const serviceForRequest = useMemo(() => {
39
40
  if (!originalService || storage !== 'indexedDB') {
@@ -54,19 +55,102 @@ const useEnumRequest = (props, dispatch) => {
54
55
  return originalService(...args);
55
56
  };
56
57
  }, [originalService, storage, requestRefresh, cacheKey]);
58
+ const reportBackgroundError = (error, params = []) => {
59
+ if (errorReportedRef.current) {
60
+ return;
61
+ }
62
+ errorReportedRef.current = true;
63
+ const normalizedError = error instanceof Error ? error : new Error(String(error));
64
+ useRequest?.options?.onError?.(normalizedError, params);
65
+ };
57
66
  const enumRes = useRequestFunc(serviceForRequest, {
58
67
  manual: true,
59
68
  cacheKey,
60
69
  cacheTime: -1,
61
70
  staleTime: 6e4 * 60,
62
71
  ...useRequest?.options,
72
+ onBefore: params => {
73
+ errorReportedRef.current = false;
74
+ useRequest?.options?.onBefore?.(params);
75
+ },
76
+ onError: reportBackgroundError,
63
77
  setCache: async res => {
64
- // 缓存命中时跳过 transformResponse 和重复处理,直接 dispatch
65
- if (fromCacheRef.current) {
66
- const cachedData = fromCacheRef.current;
78
+ try {
79
+ // 缓存命中时跳过 transformResponse 和重复处理,直接 dispatch
80
+ if (fromCacheRef.current) {
81
+ const cachedData = fromCacheRef.current;
82
+ const mergedPayload = {
83
+ ...dics,
84
+ ...cachedData,
85
+ ...dataSource
86
+ };
87
+ dispatch({
88
+ type: 'setProEnumDic',
89
+ payload: mergedPayload
90
+ });
91
+ if (main) {
92
+ setTimeout(() => {
93
+ window?.eventCenter?.publish('pro-enum-event', cachedData);
94
+ logDebug(locale?.ProEnum?.mainInitByCache);
95
+ }, 10000);
96
+ }
97
+ fromCacheRef.current = null;
98
+ return res;
99
+ }
100
+ let response = res.data;
101
+ if (transformResponse && typeof transformResponse === 'function') {
102
+ response = await transformResponse(res.data);
103
+ if (typeof response !== 'object' || response == null) {
104
+ throw new Error(locale?.ProEnum?.errorMessage);
105
+ } else {
106
+ res.data = response;
107
+ }
108
+ }
109
+ if (typeof response !== 'object' || response === null) {
110
+ throw Error('response enum data must be object');
111
+ }
112
+ if (Object.keys(response).length === 0) {
113
+ throw Error('Please return valid enumeration data');
114
+ }
115
+
116
+ // 只返回fieldNames对象的key
117
+ if (clear) {
118
+ // 忽略清洗的 codes
119
+ const ignoreCodes = useRequest?.options?.ignoreCodes || [];
120
+ Object.keys(response).forEach(key => {
121
+ if (!response[key] || !Array.isArray(response[key])) {
122
+ return;
123
+ }
124
+ const options = [...response[key]];
125
+ if (ignoreCodes.includes(key)) {
126
+ response[key] = options;
127
+ } else {
128
+ response[key] = options.map(item => {
129
+ return cacheFieldNames(fieldNames, item);
130
+ });
131
+ }
132
+ });
133
+ res.data = response;
134
+ }
135
+
136
+ // 获取缓存数据(支持异步)
137
+ const cacheData = await Promise.resolve(getEnumData(storage, cacheKey) || {
138
+ data: {}
139
+ });
140
+
141
+ // 合并缓存数据
142
+ res.data = {
143
+ ...cacheData?.data,
144
+ ...res.data
145
+ };
146
+
147
+ // 设置缓存数据(支持异步)
148
+ await Promise.resolve(setEnumData(storage, cacheKey, res));
149
+
150
+ // 同步数据到全局
67
151
  const mergedPayload = {
68
152
  ...dics,
69
- ...cachedData,
153
+ ...res.data,
70
154
  ...dataSource
71
155
  };
72
156
  dispatch({
@@ -75,80 +159,15 @@ const useEnumRequest = (props, dispatch) => {
75
159
  });
76
160
  if (main) {
77
161
  setTimeout(() => {
78
- window?.eventCenter?.publish('pro-enum-event', cachedData);
79
- logDebug(locale?.ProEnum?.mainInitByCache);
162
+ window?.eventCenter?.publish('pro-enum-event', res.data);
163
+ logDebug(locale?.ProEnum?.mainInitByRequest);
80
164
  }, 10000);
81
165
  }
82
- fromCacheRef.current = null;
166
+ return res;
167
+ } catch (error) {
168
+ reportBackgroundError(error);
83
169
  return res;
84
170
  }
85
- let response = res.data;
86
- if (transformResponse && typeof transformResponse === 'function') {
87
- response = await transformResponse(res.data);
88
- if (typeof response !== 'object' || response == null) {
89
- throw new Error(locale?.ProEnum?.errorMessage);
90
- } else {
91
- res.data = response;
92
- }
93
- }
94
- if (typeof response !== 'object' || response === null) {
95
- throw Error('response enum data must be object');
96
- }
97
- if (Object.keys(response).length === 0) {
98
- throw Error('Please return valid enumeration data');
99
- }
100
-
101
- // 只返回fieldNames对象的key
102
- if (clear) {
103
- // 忽略清洗的 codes
104
- const ignoreCodes = useRequest?.options?.ignoreCodes || [];
105
- Object.keys(response).forEach(key => {
106
- if (!response[key] || !Array.isArray(response[key])) {
107
- return;
108
- }
109
- const options = [...response[key]];
110
- if (ignoreCodes.includes(key)) {
111
- response[key] = options;
112
- } else {
113
- response[key] = options.map(item => {
114
- return cacheFieldNames(fieldNames, item);
115
- });
116
- }
117
- });
118
- res.data = response;
119
- }
120
-
121
- // 获取缓存数据(支持异步)
122
- const cacheData = await Promise.resolve(getEnumData(storage, cacheKey) || {
123
- data: {}
124
- });
125
-
126
- // 合并缓存数据
127
- res.data = {
128
- ...cacheData?.data,
129
- ...res.data
130
- };
131
-
132
- // 设置缓存数据(支持异步)
133
- await Promise.resolve(setEnumData(storage, cacheKey, res));
134
-
135
- // 同步数据到全局
136
- const mergedPayload = {
137
- ...dics,
138
- ...res.data,
139
- ...dataSource
140
- };
141
- dispatch({
142
- type: 'setProEnumDic',
143
- payload: mergedPayload
144
- });
145
- if (main) {
146
- setTimeout(() => {
147
- window?.eventCenter?.publish('pro-enum-event', res.data);
148
- logDebug(locale?.ProEnum?.mainInitByRequest);
149
- }, 10000);
150
- }
151
- return res;
152
171
  },
153
172
  getCache: params => {
154
173
  if (storage === 'indexedDB') {
@@ -250,6 +269,7 @@ const useEnumRequest = (props, dispatch) => {
250
269
  }
251
270
  };
252
271
  useDeepCompareEffect(() => {
272
+ errorReportedRef.current = false;
253
273
  const executeAsync = async () => {
254
274
  if (useRequest && useRequest?.service) {
255
275
  const {
@@ -264,7 +284,7 @@ const useEnumRequest = (props, dispatch) => {
264
284
  }
265
285
  }
266
286
  enumRes.run(params);
267
- mergeData();
287
+ void mergeData().catch(reportBackgroundError);
268
288
  } else if (dataSource && Object.keys(dataSource).length > 0) {
269
289
  const res = await Promise.resolve(getEnumData(storage, cacheKey) || {
270
290
  data: {}
@@ -294,19 +314,20 @@ const useEnumRequest = (props, dispatch) => {
294
314
  });
295
315
  }
296
316
  };
297
- executeAsync();
317
+ void executeAsync().catch(reportBackgroundError);
298
318
  }, [useRequest?.options]);
299
319
  const shareProEnumDic = async cacheData => {
300
320
  logDebug(cacheData);
301
321
  const storageData = await Promise.resolve(getEnumData(storage, cacheKey) || {
302
322
  data: {}
303
323
  });
324
+ const storagePayload = typeof storageData?.data === 'object' && storageData.data !== null ? storageData.data : storageData;
304
325
  dispatch({
305
326
  type: 'setProEnumDic',
306
327
  payload: {
307
328
  ...dataSource,
308
329
  ...cacheData,
309
- ...storageData
330
+ ...storagePayload
310
331
  }
311
332
  });
312
333
  };
@@ -150,16 +150,15 @@ const ProEnum = props => {
150
150
  list = sourceList;
151
151
  }
152
152
  if ( /*#__PURE__*/React.isValidElement(component)) {
153
- const Component = component;
154
- return /*#__PURE__*/_jsx(Component, {
153
+ return /*#__PURE__*/React.cloneElement(component, {
155
154
  ...enumProps,
156
155
  dataSource: list,
157
156
  fieldNames: {
158
157
  label,
159
158
  value: fieldValue
160
159
  },
161
- value: value,
162
- onChange: onChange
160
+ value,
161
+ onChange
163
162
  });
164
163
  }
165
164
  switch (type) {
@@ -244,7 +244,7 @@ const InputNumber = props => {
244
244
  value = _min;
245
245
  }
246
246
  value = parser(String(value), props.precision ?? valueProps?.precision);
247
- rest?.onChange(value);
247
+ rest?.onChange?.(value);
248
248
  const limit = {
249
249
  min: Number(_min),
250
250
  max: Number(_max)
@@ -250,7 +250,7 @@ const ActionButton = props => {
250
250
  });
251
251
  if (!_onClick || data === true) {
252
252
  // 如果有 addIndex 配置,使用它计算插入位置
253
- if (item.addIndex) {
253
+ if (item.addIndex !== undefined) {
254
254
  const insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
255
255
  index,
256
256
  namePath,
@@ -265,7 +265,7 @@ const ActionButton = props => {
265
265
  }
266
266
  if (item?.type === 'add') {
267
267
  // 如果有 addIndex 配置,使用它计算插入位置
268
- if (item.addIndex) {
268
+ if (item.addIndex !== undefined) {
269
269
  const insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
270
270
  index,
271
271
  namePath,
@@ -58,6 +58,7 @@ const BlockFields = props => {
58
58
  }), /*#__PURE__*/_jsx("div", {
59
59
  className: "pro-form-list-left-content",
60
60
  children: /*#__PURE__*/_jsx(ProCollapse, {
61
+ className: "pro-form-list-left-action-right",
61
62
  title: _title,
62
63
  index: index,
63
64
  form: form,
@@ -36,7 +36,7 @@ const Empty = ({
36
36
  const getBtnText = () => {
37
37
  return emptyBtnText || addConfig?.label || locale.ProForm.formListActions[6];
38
38
  };
39
- let show = true;
39
+ let show = toolbarProps !== false;
40
40
  if (addConfig?.show !== undefined) {
41
41
  show = _isFunction(addConfig.show) ? addConfig.show(form.getFieldValue(namePath), {
42
42
  namePath,
@@ -20,7 +20,7 @@ const actions = {
20
20
  const defaultActionProps = [{
21
21
  type: 'add'
22
22
  }];
23
- const filterKeys = ['actionType', 'addIndex'];
23
+ const filterKeys = ['actionType', 'addIndex', 'show'];
24
24
  const ToolbarButton = props => {
25
25
  const {
26
26
  namePath,
@@ -59,7 +59,7 @@ const ToolbarButton = props => {
59
59
  if (!callback || data === true) {
60
60
  if (item?.type === 'add') {
61
61
  // 如果有 addIndex 配置,使用它计算插入位置
62
- if (item.addIndex) {
62
+ if (item.addIndex !== undefined) {
63
63
  const insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
64
64
  namePath,
65
65
  form,
@@ -82,7 +82,7 @@ const ToolbarButton = props => {
82
82
  }
83
83
  if (item?.type === 'add' && data) {
84
84
  // 如果有 addIndex 配置,使用它计算插入位置
85
- if (item.addIndex) {
85
+ if (item.addIndex !== undefined) {
86
86
  const insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
87
87
  namePath,
88
88
  form,
@@ -158,6 +158,12 @@
158
158
  }
159
159
  }
160
160
 
161
+ .pro-form-list-left-action-right {
162
+ .@{ant-prefix}-collapse-extra {
163
+ margin-inline-start: auto;
164
+ }
165
+ }
166
+
161
167
  // 移动端响应式
162
168
  @media (max-width: 768px) {
163
169
  .pro-form-list-left-title-wrapper {