@zat-design/sisyphus-react 4.0.0-beta.3 → 4.0.0-beta.4

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 (243) hide show
  1. package/babel.config.js +7 -30
  2. package/dist/esm/index.d.ts +5 -0
  3. package/dist/esm/index.js +5 -0
  4. package/dist/esm/regExp/index.d.ts +19 -0
  5. package/dist/esm/regExp/index.js +73 -0
  6. package/dist/esm/tools/calc/index.d.ts +4 -0
  7. package/dist/esm/tools/calc/index.js +67 -0
  8. package/dist/esm/tools/dateUtils.d.ts +7 -0
  9. package/dist/esm/tools/dateUtils.js +23 -0
  10. package/dist/esm/tools/disableDate/index.d.ts +9 -0
  11. package/dist/esm/tools/disableDate/index.js +43 -0
  12. package/dist/esm/tools/disableTimeRange/index.d.ts +9 -0
  13. package/dist/esm/tools/disableTimeRange/index.js +121 -0
  14. package/dist/esm/tools/formatAmount/index.d.ts +7 -0
  15. package/dist/esm/tools/formatAmount/index.js +14 -0
  16. package/dist/esm/tools/formatPerMill/index.d.ts +7 -0
  17. package/dist/esm/tools/formatPerMill/index.js +11 -0
  18. package/dist/esm/tools/formatPercent/index.d.ts +7 -0
  19. package/dist/esm/tools/formatPercent/index.js +11 -0
  20. package/dist/esm/tools/getDataByIdCard/index.d.ts +16 -0
  21. package/dist/esm/tools/getDataByIdCard/index.js +65 -0
  22. package/dist/esm/tools/index.d.ts +12 -0
  23. package/dist/esm/tools/index.js +14 -0
  24. package/dist/esm/tools/sumAmount/index.d.ts +16 -0
  25. package/dist/esm/tools/sumAmount/index.js +40 -0
  26. package/dist/esm/tools/toChineseNum/index.d.ts +7 -0
  27. package/dist/esm/tools/toChineseNum/index.js +103 -0
  28. package/dist/esm/tools/toFixed/index.d.ts +2 -0
  29. package/dist/esm/tools/toFixed/index.js +5 -0
  30. package/dist/esm/tools/transformDataName/index.d.ts +12 -0
  31. package/dist/esm/tools/transformDataName/index.js +37 -0
  32. package/dist/esm/transforms/dateTransformer/index.d.ts +24 -0
  33. package/dist/esm/transforms/dateTransformer/index.js +67 -0
  34. package/dist/esm/transforms/index.d.ts +6 -0
  35. package/dist/esm/transforms/index.js +6 -0
  36. package/dist/esm/transforms/propTypes.d.ts +7 -0
  37. package/dist/esm/transforms/propTypes.js +1 -0
  38. package/dist/esm/transforms/transformDate/index.d.ts +21 -0
  39. package/dist/esm/transforms/transformDate/index.js +141 -0
  40. package/dist/esm/transforms/transformDatePicker/index.d.ts +12 -0
  41. package/dist/esm/transforms/transformDatePicker/index.js +24 -0
  42. package/dist/esm/transforms/transformRangePicker/index.d.ts +29 -0
  43. package/dist/esm/transforms/transformRangePicker/index.js +61 -0
  44. package/dist/esm/transforms/transformSwitch/index.d.ts +13 -0
  45. package/dist/esm/transforms/transformSwitch/index.js +35 -0
  46. package/dist/esm/transforms/utils.d.ts +2 -0
  47. package/dist/esm/transforms/utils.js +8 -0
  48. package/dist/esm/validate/index.d.ts +107 -0
  49. package/dist/esm/validate/index.js +284 -0
  50. package/es/ProAction/index.less +0 -2
  51. package/es/ProConfigProvider/index.d.ts +1 -0
  52. package/es/ProConfigProvider/index.js +4 -5
  53. package/es/ProDownload/style/index.less +0 -2
  54. package/es/ProDrawerForm/index.js +33 -29
  55. package/es/ProDrawerForm/style/index.less +0 -2
  56. package/es/ProEditLabel/style/index.less +0 -2
  57. package/es/ProEditTable/components/RcTable/DraggableTable.js +1 -1
  58. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -2
  59. package/es/ProEditTable/propsType.d.ts +1 -1
  60. package/es/ProEditTable/style/index.less +2 -4
  61. package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
  62. package/es/ProEditTable/utils/diffOriginal.js +68 -1
  63. package/es/ProEnum/hooks/useEnum.js +5 -0
  64. package/es/ProEnum/style/index.less +0 -2
  65. package/es/ProForm/components/FormFooter/index.js +6 -6
  66. package/es/ProForm/components/base/DatePicker/index.js +19 -34
  67. package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  68. package/es/ProForm/components/base/TextArea/index.less +0 -2
  69. package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
  70. package/es/ProForm/components/combination/Container/style/index.less +0 -2
  71. package/es/ProForm/components/combination/FormList/style/index.less +0 -2
  72. package/es/ProForm/components/combination/Group/component/ComRender.js +9 -8
  73. package/es/ProForm/components/combination/Group/hooks/index.js +17 -4
  74. package/es/ProForm/components/combination/Group/index.d.ts +8 -2
  75. package/es/ProForm/components/combination/Group/index.js +10 -16
  76. package/es/ProForm/components/combination/ProCascader/index.js +106 -52
  77. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
  78. package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
  79. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
  80. package/es/ProForm/components/combination/ProModalSelect/index.js +38 -64
  81. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  82. package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
  83. package/es/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
  84. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
  85. package/es/ProForm/components/render/ChangedWrapper.js +2 -2
  86. package/es/ProForm/components/render/Render.js +17 -5
  87. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  88. package/es/ProForm/components/render/RenderFields.js +4 -2
  89. package/es/ProForm/components/render/propsType.d.ts +1 -0
  90. package/es/ProForm/index.d.ts +2 -2
  91. package/es/ProForm/index.js +5 -2
  92. package/es/ProForm/propsType.d.ts +2 -0
  93. package/es/ProForm/style/index.less +0 -2
  94. package/es/ProForm/utils/diffOriginal.d.ts +1 -0
  95. package/es/ProForm/utils/diffOriginal.js +66 -1
  96. package/es/ProForm/utils/index.js +1 -1
  97. package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
  98. package/es/ProForm/utils/useShouldUpdate.js +89 -3
  99. package/es/ProIcon/style/index.less +0 -2
  100. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +60 -8
  101. package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
  102. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +25 -3
  103. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
  104. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
  105. package/es/ProLayout/components/Layout/Menu/index.js +4 -1
  106. package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
  107. package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
  108. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
  109. package/es/ProLayout/components/ProCollapse/index.js +27 -3
  110. package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
  111. package/es/ProLayout/components/ProFooter/style/index.less +0 -2
  112. package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
  113. package/es/ProLayout/components/ProHeader/style/index.less +0 -2
  114. package/es/ProLayout/index.d.ts +0 -11
  115. package/es/ProLayout/index.js +60 -32
  116. package/es/ProLayout/propTypes.d.ts +9 -0
  117. package/es/ProLayout/style/index.less +0 -2
  118. package/es/ProLayout/utils/index.d.ts +7 -0
  119. package/es/ProLayout/utils/index.js +30 -0
  120. package/es/ProSelect/index.less +0 -2
  121. package/es/ProSelect/utils/index.js +62 -1
  122. package/es/ProStep/components/Item/index.js +1 -2
  123. package/es/ProStep/style/index.less +0 -2
  124. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
  125. package/es/ProTable/hooks/useAntdTable.d.ts +3 -0
  126. package/es/ProTable/hooks/useAntdTable.js +92 -64
  127. package/es/ProTable/index.d.ts +3 -7
  128. package/es/ProTable/index.js +14 -14
  129. package/es/ProTable/propsType.d.ts +3 -2
  130. package/es/ProTable/style/index.less +4 -6
  131. package/es/ProTabs/style/index.less +0 -2
  132. package/es/ProThemeTools/index.d.ts +0 -7
  133. package/es/ProThemeTools/index.js +10 -12
  134. package/es/ProThemeTools/style/index.less +0 -2
  135. package/es/ProTooltip/style/index.less +0 -2
  136. package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
  137. package/es/ProTree/style/index.less +0 -2
  138. package/es/ProTreeModal/style/index.less +0 -2
  139. package/es/ProUpload/style/index.less +0 -2
  140. package/es/ProViewer/style/index.less +0 -2
  141. package/es/style/theme/antd.less +0 -2
  142. package/jest.config.js +46 -4
  143. package/lib/ProAction/index.less +0 -2
  144. package/lib/ProConfigProvider/index.d.ts +1 -0
  145. package/lib/ProConfigProvider/index.js +4 -3
  146. package/lib/ProDownload/style/index.less +0 -2
  147. package/lib/ProDrawerForm/index.js +25 -28
  148. package/lib/ProDrawerForm/style/index.less +0 -2
  149. package/lib/ProEditLabel/style/index.less +0 -2
  150. package/lib/ProEditTable/components/RcTable/DraggableTable.js +1 -1
  151. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -2
  152. package/lib/ProEditTable/propsType.d.ts +1 -1
  153. package/lib/ProEditTable/style/index.less +2 -4
  154. package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
  155. package/lib/ProEditTable/utils/diffOriginal.js +48 -1
  156. package/lib/ProEnum/hooks/useEnum.js +3 -0
  157. package/lib/ProEnum/style/index.less +0 -2
  158. package/lib/ProForm/components/FormFooter/index.js +6 -5
  159. package/lib/ProForm/components/base/DatePicker/index.js +21 -33
  160. package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  161. package/lib/ProForm/components/base/TextArea/index.less +0 -2
  162. package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
  163. package/lib/ProForm/components/combination/Container/style/index.less +0 -2
  164. package/lib/ProForm/components/combination/FormList/style/index.less +0 -2
  165. package/lib/ProForm/components/combination/Group/component/ComRender.js +8 -7
  166. package/lib/ProForm/components/combination/Group/hooks/index.js +8 -2
  167. package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
  168. package/lib/ProForm/components/combination/Group/index.js +8 -13
  169. package/lib/ProForm/components/combination/ProCascader/index.js +73 -16
  170. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
  171. package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
  172. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -2
  173. package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -52
  174. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  175. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
  176. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
  177. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
  178. package/lib/ProForm/components/render/ChangedWrapper.js +2 -2
  179. package/lib/ProForm/components/render/Render.js +11 -3
  180. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  181. package/lib/ProForm/components/render/RenderFields.js +4 -2
  182. package/lib/ProForm/components/render/propsType.d.ts +1 -0
  183. package/lib/ProForm/index.d.ts +2 -2
  184. package/lib/ProForm/index.js +3 -1
  185. package/lib/ProForm/propsType.d.ts +2 -0
  186. package/lib/ProForm/style/index.less +0 -2
  187. package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
  188. package/lib/ProForm/utils/diffOriginal.js +48 -1
  189. package/lib/ProForm/utils/index.js +1 -1
  190. package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
  191. package/lib/ProForm/utils/useShouldUpdate.js +50 -1
  192. package/lib/ProIcon/style/index.less +0 -2
  193. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +33 -4
  194. package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
  195. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +7 -2
  196. package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +2 -1
  197. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
  198. package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
  199. package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
  200. package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
  201. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
  202. package/lib/ProLayout/components/ProCollapse/index.js +27 -3
  203. package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
  204. package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
  205. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
  206. package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
  207. package/lib/ProLayout/index.d.ts +0 -11
  208. package/lib/ProLayout/index.js +51 -32
  209. package/lib/ProLayout/propTypes.d.ts +9 -0
  210. package/lib/ProLayout/style/index.less +0 -2
  211. package/lib/ProLayout/utils/index.d.ts +7 -0
  212. package/lib/ProLayout/utils/index.js +15 -0
  213. package/lib/ProSelect/index.less +0 -2
  214. package/lib/ProSelect/utils/index.js +34 -5
  215. package/lib/ProStep/components/Item/index.js +1 -2
  216. package/lib/ProStep/style/index.less +0 -2
  217. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
  218. package/lib/ProTable/hooks/useAntdTable.d.ts +3 -0
  219. package/lib/ProTable/hooks/useAntdTable.js +71 -36
  220. package/lib/ProTable/index.d.ts +3 -7
  221. package/lib/ProTable/index.js +8 -13
  222. package/lib/ProTable/propsType.d.ts +3 -2
  223. package/lib/ProTable/style/index.less +4 -6
  224. package/lib/ProTabs/style/index.less +0 -2
  225. package/lib/ProThemeTools/index.d.ts +0 -7
  226. package/lib/ProThemeTools/index.js +5 -12
  227. package/lib/ProThemeTools/style/index.less +0 -2
  228. package/lib/ProTooltip/style/index.less +0 -2
  229. package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
  230. package/lib/ProTree/style/index.less +0 -2
  231. package/lib/ProTreeModal/style/index.less +0 -2
  232. package/lib/ProUpload/style/index.less +0 -2
  233. package/lib/ProViewer/style/index.less +0 -2
  234. package/lib/style/theme/antd.less +0 -2
  235. package/package.json +7 -6
  236. package/tests/__mocks__/fileMock.js +1 -0
  237. package/tests/__mocks__/zatUtils.js +27 -0
  238. package/tests/setup.ts +484 -0
  239. package/tests/test-utils.tsx +81 -0
  240. package/dist/index.esm.css +0 -6445
  241. package/dist/index.esm.js +0 -3
  242. package/dist/less.esm.css +0 -5871
  243. package/dist/less.esm.js +0 -3
@@ -54,6 +54,7 @@ var ProModalSelect = (props, ref) => {
54
54
  labelInValue = false,
55
55
  fieldNames,
56
56
  readOnly = true,
57
+ mode = "select",
57
58
  addonAfter,
58
59
  configOption,
59
60
  title,
@@ -66,12 +67,20 @@ var ProModalSelect = (props, ref) => {
66
67
  beforeOpen,
67
68
  afterOpen,
68
69
  isTooltip,
70
+ tooltip,
69
71
  searchForm,
70
72
  searchKey,
71
73
  defaultOne,
72
74
  otherProps,
73
75
  ...restProps
74
76
  } = props;
77
+ const _tooltip = tooltip ?? isTooltip;
78
+ const nextMode = (0, import_react.useMemo)(() => {
79
+ if ((0, import_lodash.isBoolean)(readOnly) && readOnly === false) {
80
+ return "input";
81
+ }
82
+ return mode;
83
+ }, [mode, readOnly]);
75
84
  const contentForm = import_antd.Form.useFormInstance();
76
85
  if (!configOption || Object.prototype.toString.call(configOption) !== "[object Object]") {
77
86
  throw new Error("error: 请检查枚举选择弹框的配置项【configOption】");
@@ -165,8 +174,7 @@ var ProModalSelect = (props, ref) => {
165
174
  transformResponse
166
175
  },
167
176
  {
168
- manual: true,
169
- ready: (initParams || defaultOne) && !readOnly || open,
177
+ ready: (initParams || defaultOne) && nextMode === "input" || open,
170
178
  ...useRequest == null ? void 0 : useRequest.options
171
179
  }
172
180
  );
@@ -180,7 +188,7 @@ var ProModalSelect = (props, ref) => {
180
188
  if (typeof data2 === "string" || typeof data2 === "number") {
181
189
  return data2;
182
190
  }
183
- if (Object.prototype.toString.call(data2) === "[object Object]") {
191
+ if ((0, import_lodash.isObject)(data2)) {
184
192
  return handleFormat({
185
193
  ...data2,
186
194
  value: data2[valueKey],
@@ -211,7 +219,7 @@ var ProModalSelect = (props, ref) => {
211
219
  return formatValue(nextValue);
212
220
  }, [value, _value, options]);
213
221
  const getRowKey = (record) => {
214
- if (typeof rowKey === "function") {
222
+ if ((0, import_lodash.isFunction)(rowKey)) {
215
223
  return rowKey(record);
216
224
  }
217
225
  return record[rowKey];
@@ -225,7 +233,7 @@ var ProModalSelect = (props, ref) => {
225
233
  const handleChangeValue = (e) => {
226
234
  onChange(e.target.value);
227
235
  preValue.current = e.target.value;
228
- if (!readOnly) {
236
+ if (nextMode === "input") {
229
237
  setState({
230
238
  _value: e.target.value
231
239
  });
@@ -385,7 +393,7 @@ var ProModalSelect = (props, ref) => {
385
393
  selectedRows: list,
386
394
  selectedRowKeys: nextSelectRowKeys
387
395
  });
388
- } else if (!readOnly) {
396
+ } else if (nextMode === "input") {
389
397
  setState({
390
398
  _value: value,
391
399
  isInit: false
@@ -443,13 +451,13 @@ var ProModalSelect = (props, ref) => {
443
451
  selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || [],
444
452
  _value: void 0
445
453
  });
446
- } else if (Object.prototype.toString.call(value) === "[object Array]") {
454
+ } else if ((0, import_lodash.isArray)(value)) {
447
455
  setState({
448
456
  selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || value,
449
457
  selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || value,
450
458
  _value: value
451
459
  });
452
- } else if (Object.prototype.toString.call(value) === "[object Object]") {
460
+ } else if ((0, import_lodash.isObject)(value)) {
453
461
  const initialValue = { [valueKey]: value[valueKey], [labelKey]: value[labelKey] };
454
462
  setState({
455
463
  selectedRowKeys: [value],
@@ -472,7 +480,7 @@ var ProModalSelect = (props, ref) => {
472
480
  nextState.selectedRowKeys = [];
473
481
  nextState.selectedRows = [];
474
482
  }
475
- if (Object.prototype.toString.call(value) === "[object Object]") {
483
+ if ((0, import_lodash.isObject)(value)) {
476
484
  nextState.selectedRowKeys = [getRowKey(value)];
477
485
  nextState.selectedRows = [value];
478
486
  }
@@ -495,13 +503,13 @@ var ProModalSelect = (props, ref) => {
495
503
  (0, import_utils.hideTooltipIfOpen)(fieldRef.current, open);
496
504
  }, [open]);
497
505
  (0, import_react.useEffect)(() => {
498
- if (value && !open && isInit && !readOnly) {
506
+ if (value && !open && isInit && nextMode === "input") {
499
507
  getInitValues();
500
508
  }
501
509
  }, [JSON.stringify(value), open, isInit]);
502
510
  (0, import_ahooks.useDebounceEffect)(() => {
503
511
  var _a2;
504
- if (value && !open && readOnly && (!(0, import_lodash.isEqual)(value, preValue.current) || (options == null ? void 0 : options.length) === 0)) {
512
+ if (value && !open && nextMode === "select" && (!(0, import_lodash.isEqual)(value, preValue.current) || (options == null ? void 0 : options.length) === 0)) {
505
513
  preValue.current = value;
506
514
  const data2 = labelInValue ? value[valueKey] : value;
507
515
  const isHasValue = (_a2 = options == null ? void 0 : options.some) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === data2);
@@ -580,7 +588,7 @@ var ProModalSelect = (props, ref) => {
580
588
  });
581
589
  }
582
590
  }
583
- if (!readOnly) {
591
+ if (nextMode === "input") {
584
592
  if (labelInValue && _value && !(0, import_lodash.isEqual)(value, _value)) {
585
593
  setState({
586
594
  _value: value,
@@ -597,7 +605,7 @@ var ProModalSelect = (props, ref) => {
597
605
  }
598
606
  }
599
607
  }, [value, _value]);
600
- let initRender = /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { style: { width: "100%" }, block: true }, readOnly ? /* @__PURE__ */ import_react.default.createElement(
608
+ let initRender = /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { style: { width: "100%" }, block: true }, nextMode === "select" ? /* @__PURE__ */ import_react.default.createElement(
601
609
  import__.ProSelect,
602
610
  {
603
611
  value,
@@ -613,10 +621,11 @@ var ProModalSelect = (props, ref) => {
613
621
  notFoundContent: selectLoading ? /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { size: "small" }) : null,
614
622
  onFocus: handleSelectFocus,
615
623
  onSearch: handleSelectSearch,
624
+ tooltip: _tooltip,
616
625
  style: { width: isView || disabled ? "100%" : "calc(100% - 30px)" },
617
626
  ...restProps
618
627
  }
619
- ) : /* @__PURE__ */ import_react.default.createElement(
628
+ ) : /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: _tooltip ? viewText : null, placement: "topLeft" }, /* @__PURE__ */ import_react.default.createElement(
620
629
  import_antd.Input,
621
630
  {
622
631
  value: viewText,
@@ -626,45 +635,10 @@ var ProModalSelect = (props, ref) => {
626
635
  allowClear: true,
627
636
  ...restProps
628
637
  }
629
- ), isView || disabled ? null : /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleClick, icon: /* @__PURE__ */ import_react.default.createElement(import_react_svg.ReactSVG, { className: "viewSvg", src: import_view.default }) }));
638
+ )), isView || disabled ? null : /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleClick, icon: /* @__PURE__ */ import_react.default.createElement(import_react_svg.ReactSVG, { className: "viewSvg", src: import_view.default }) }));
630
639
  if (customRender && import_react.default.isValidElement(customRender)) {
631
640
  initRender = /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-modal-select-init", onClick: handleClick }, customRender);
632
641
  }
633
- (0, import_ahooks.useDeepCompareEffect)(() => {
634
- if (isTooltip && value) {
635
- const dom = document.getElementById(uuid);
636
- dom.addEventListener("mouseover", (e) => {
637
- if (value && e.target.tagName === "INPUT") {
638
- setState({
639
- open: true
640
- });
641
- }
642
- });
643
- dom.addEventListener("mouseout", (e) => {
644
- if (e.target.tagName === "INPUT") {
645
- setState({
646
- open: false
647
- });
648
- }
649
- });
650
- return () => {
651
- dom.removeEventListener("mouseover", (e) => {
652
- if (value && e.target.tagName === "INPUT") {
653
- setState({
654
- open: true
655
- });
656
- }
657
- });
658
- dom.removeEventListener("mouseout", (e) => {
659
- if (e.target.tagName === "INPUT") {
660
- setState({
661
- open: false
662
- });
663
- }
664
- });
665
- };
666
- }
667
- }, [value, isTooltip]);
668
642
  (0, import_ahooks.useDeepCompareEffect)(() => {
669
643
  setState({
670
644
  options: (tableProps == null ? void 0 : tableProps.dataSource) || []
@@ -689,10 +663,10 @@ var ProModalSelect = (props, ref) => {
689
663
  [props.className]: props.className,
690
664
  "pro-modal-select-open": open
691
665
  });
692
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { id: uuid, className: _className, style, ref: fieldRef }, isTooltip && viewText ? /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { placement: "topLeft", open, title: viewText }, initRender) : initRender), /* @__PURE__ */ import_react.default.createElement(
666
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { id: uuid, className: _className, style, ref: fieldRef }, initRender), /* @__PURE__ */ import_react.default.createElement(
693
667
  import__.ProDrawerForm,
694
668
  {
695
- showType: "Modal",
669
+ mode: "Modal",
696
670
  title,
697
671
  onOk: handleFinish,
698
672
  onCancel: handleClose,
@@ -80,17 +80,21 @@ interface ProModalPropsType {
80
80
  beforeOpen?: any;
81
81
  /** 打开弹框后的回调函数 */
82
82
  afterOpen?: any;
83
- /** 是否启用tooltip提示 */
83
+ /** 废弃 是否启用tooltip提示 */
84
84
  isTooltip?: boolean;
85
+ /** 是否启用tooltip提示 */
86
+ tooltip?: boolean;
85
87
  /** 是否以"值-名称"形式展示 */
86
88
  showCodeName?: boolean;
87
89
  /** 查询表单实例,用于获取查询表单数据 */
88
90
  searchForm?: FormInstance;
89
91
  /** 模糊查询的字段名 */
90
92
  searchKey?: string;
93
+ /** 展示形式 */
94
+ mode?: 'input' | 'select';
91
95
  }
92
96
  /** 模态框选择器属性类型(结合Select和Input属性) */
93
- export declare type ProModalSelectPropsType = SelectProps & InputProps & ProModalPropsType;
97
+ export declare type ProModalSelectPropsType = Omit<SelectProps & InputProps, 'mode'> & ProModalPropsType;
94
98
  /** 配置选项类型 */
95
99
  export type ProModalSelectConfigType = ConfigOption;
96
100
  /** 模态框属性类型 */
@@ -98,5 +102,5 @@ export type ProModalType = Omit<ProModalPropsType, 'configOption'> & {
98
102
  configOption: ProModalSelectConfigType;
99
103
  };
100
104
  /** 模态框选择器类型(结合Select和Input属性) */
101
- export type ProModalSelectType = SelectProps & InputProps & ProModalType;
105
+ export type ProModalSelectType = Omit<SelectProps & InputProps, 'mode'> & ProModalType;
102
106
  export {};
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-modal-select,
5
3
  .pro-tree-modal {
@@ -53,7 +51,7 @@
53
51
  }
54
52
  }
55
53
 
56
- // 新加适用于 readonly false
54
+ // 新加适用于 _readOnly false
57
55
  .@{ant-prefix}-input-affix-wrapper {
58
56
  border-top-right-radius: 0;
59
57
  border-bottom-right-radius: 0;
@@ -102,7 +100,6 @@
102
100
  }
103
101
  }
104
102
 
105
-
106
103
  .@{ant-prefix}-input-group-wrapper-status-error {
107
104
  &:hover {
108
105
  .@{ant-prefix}-input,
@@ -1,7 +1,8 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
-
4
1
  .pro-number-range {
2
+ display: block;
3
+ .@{ant-prefix}-space-compact {
4
+ display: block;
5
+ }
5
6
  .range-split {
6
7
  min-width: 32px;
7
8
  max-width: 32px;
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .@{ant-prefix}-form-item-has-error {
5
3
  .@{ant-prefix}-picker-status-error
@@ -85,8 +85,8 @@ var ChangedWrapper = (props) => {
85
85
  value: _value,
86
86
  originalValue: _originalValue,
87
87
  form,
88
- onDiff
89
- // name: namesStr || name,
88
+ onDiff,
89
+ type: props.type
90
90
  });
91
91
  }, [isWatch, noChange, props[valuePropName], originalValue, typeof onDiff]);
92
92
  const isAdd = diffType === "add";
@@ -67,7 +67,8 @@ var Render = (props) => {
67
67
  globalControl,
68
68
  diffConfig,
69
69
  viewRender,
70
- desensitization
70
+ desensitization,
71
+ shouldUpdateDebounce
71
72
  } = props;
72
73
  let { colProps } = props;
73
74
  const {
@@ -103,7 +104,8 @@ var Render = (props) => {
103
104
  component,
104
105
  originComponent,
105
106
  type,
106
- desensitization
107
+ desensitization,
108
+ shouldUpdateDebounce
107
109
  });
108
110
  otherFormItemProps.shouldUpdate = shouldUpdate;
109
111
  const namesStr = (0, import_react.useMemo)(() => {
@@ -295,6 +297,7 @@ var Render = (props) => {
295
297
  (lastComponentProps == null ? void 0 : lastComponentProps.onBlur) && await (lastComponentProps == null ? void 0 : lastComponentProps.onBlur(..._args));
296
298
  };
297
299
  const renderItem = () => {
300
+ var _a2, _b, _c;
298
301
  const lastComponentPropsFilter = ["onFieldChange", "disabledStrictly"];
299
302
  const childProps = {
300
303
  ...AutoComponent == null ? void 0 : AutoComponent.props,
@@ -390,11 +393,16 @@ var Render = (props) => {
390
393
  };
391
394
  }
392
395
  if (diffConfig == null ? void 0 : diffConfig.originalValues) {
396
+ let nextNames = otherProps.names;
397
+ if (((_a2 = otherProps == null ? void 0 : otherProps.namePath) == null ? void 0 : _a2.length) && ((_b = otherProps.names) == null ? void 0 : _b.length)) {
398
+ const prefixLength = ((_c = otherProps == null ? void 0 : otherProps.namePath) == null ? void 0 : _c.length) - 1;
399
+ nextNames = otherProps.names.map((name) => name.slice(prefixLength));
400
+ }
393
401
  child = /* @__PURE__ */ import_react.default.createElement(
394
402
  import_ChangedWrapper.default,
395
403
  {
396
404
  name: formItemProps.name,
397
- names: otherProps.names,
405
+ names: nextNames,
398
406
  namesStr,
399
407
  diffConfig,
400
408
  form,
@@ -21,6 +21,7 @@ interface Props<T = any> {
21
21
  required?: boolean | boolean[] | (() => boolean | boolean[]);
22
22
  globalControl?: boolean;
23
23
  desensitizationKey?: string;
24
+ shouldUpdateDebounce?: number;
24
25
  }
25
26
  declare const RenderFields: React.FC<Props>;
26
27
  export default RenderFields;
@@ -58,7 +58,8 @@ var RenderFields = (props) => {
58
58
  required,
59
59
  diffConfig,
60
60
  globalControl,
61
- desensitizationKey
61
+ desensitizationKey,
62
+ shouldUpdateDebounce
62
63
  } = props;
63
64
  const hiddenData = columns.filter((item) => {
64
65
  return Array.isArray(item.hiddenNames);
@@ -232,7 +233,8 @@ var RenderFields = (props) => {
232
233
  requiredOnView,
233
234
  globalControl,
234
235
  viewRender,
235
- desensitization
236
+ desensitization,
237
+ shouldUpdateDebounce
236
238
  }
237
239
  )
238
240
  );
@@ -280,6 +280,7 @@ export interface RenderType<Values = any> {
280
280
  requiredOnView?: boolean;
281
281
  confirm?: ProFormColumnType['confirm'];
282
282
  globalControl?: boolean;
283
+ shouldUpdateDebounce?: number;
283
284
  [name: string]: any;
284
285
  }
285
286
  /**
@@ -1,11 +1,11 @@
1
1
  import { FormInstance } from 'antd';
2
- import React, { ForwardRefRenderFunction } from 'react';
2
+ import React from 'react';
3
3
  import { FormProviderProps } from 'antd/es/form/context';
4
4
  import type { ProFormType } from './propsType';
5
5
  import { useForm } from './utils/useForm';
6
6
  import useWatch from './utils/useWatch';
7
7
  import { useForms } from '../FormsProvider';
8
- interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormType<T>> {
8
+ interface IProForm<T = any> extends React.ForwardRefExoticComponent<ProFormType<T> & React.RefAttributes<FormInstance<T>>> {
9
9
  useForm: typeof useForm;
10
10
  useWatch: typeof useWatch;
11
11
  useFormInstances: typeof useForms;
@@ -87,6 +87,7 @@ var ProForm = (props, ref) => {
87
87
  optimize = false,
88
88
  desensitizationKey = "zat-design-pro-component-desensitization",
89
89
  stopOnFirstError = false,
90
+ shouldUpdateDebounce = 500,
90
91
  ...otherProps
91
92
  } = props;
92
93
  const config = (0, import_ProConfigProvider.useProConfig)("ProForm");
@@ -225,7 +226,8 @@ var ProForm = (props, ref) => {
225
226
  requiredOnView,
226
227
  required,
227
228
  globalControl,
228
- desensitizationKey
229
+ desensitizationKey,
230
+ shouldUpdateDebounce
229
231
  }
230
232
  ), footerRender()),
231
233
  children
@@ -103,6 +103,8 @@ export interface ProFormType<Values = any> extends FormProps<Values> {
103
103
  desensitizationKey?: string;
104
104
  /** 是否在遇到第一个错误时停止验证 */
105
105
  stopOnFirstError?: boolean;
106
+ /** shouldUpdate防抖延迟时间,默认500ms,设置为0则不防抖 */
107
+ shouldUpdateDebounce?: number;
106
108
  }
107
109
  export interface TransformType<T = any> {
108
110
  normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
  @import '../components/base/SwitchCheckbox/style/index.less';
4
2
  @import '../components/base/TimePicker/style/index.less';
5
3
  @import '../components/base/TextArea/index.less';
@@ -3,6 +3,7 @@ export interface DiffOriginalParams {
3
3
  originalValue: any;
4
4
  value: any;
5
5
  form: FormInstance;
6
+ type?: string;
6
7
  onDiff?: (originalValue: any, currentValue: any) => DiffType | boolean | undefined;
7
8
  }
8
9
  export type DiffType = 'same' | 'add' | 'changed';
@@ -24,6 +24,50 @@ __export(diffOriginal_exports, {
24
24
  module.exports = __toCommonJS(diffOriginal_exports);
25
25
  var import_lodash = require("lodash");
26
26
  var import_utils = require("../../utils");
27
+ var normalizeNumberValue = (value) => {
28
+ if (value === null || value === void 0 || value === "")
29
+ return null;
30
+ const num = Number(value);
31
+ return Number.isNaN(num) ? null : num;
32
+ };
33
+ var inputNumberStrategy = {
34
+ compare: (val1, val2) => {
35
+ const num1 = normalizeNumberValue(val1);
36
+ const num2 = normalizeNumberValue(val2);
37
+ return num1 === num2;
38
+ }
39
+ };
40
+ var proNumberRangeStrategy = {
41
+ compare: (val1, val2) => {
42
+ if (!Array.isArray(val1) || !Array.isArray(val2))
43
+ return false;
44
+ if (val1.length !== val2.length)
45
+ return false;
46
+ return val1.every((item, index) => {
47
+ const num1 = normalizeNumberValue(item);
48
+ const num2 = normalizeNumberValue(val2[index]);
49
+ return num1 === num2;
50
+ });
51
+ }
52
+ };
53
+ var handleNumberTypeDiff = (params) => {
54
+ const { originalValue, value, type } = params;
55
+ const isEmptyVal = (0, import_utils.isEmpty)(value);
56
+ const isEmptyOrg = (0, import_utils.isEmpty)(originalValue);
57
+ if (isEmptyOrg && isEmptyVal)
58
+ return "same";
59
+ if (isEmptyOrg && !isEmptyVal)
60
+ return "add";
61
+ let compareStrategy;
62
+ if (type === "InputNumber") {
63
+ compareStrategy = inputNumberStrategy;
64
+ } else if (type === "ProNumberRange") {
65
+ compareStrategy = proNumberRangeStrategy;
66
+ } else {
67
+ return "changed";
68
+ }
69
+ return compareStrategy.compare(value, originalValue) ? "same" : "changed";
70
+ };
27
71
  var filterObject = (data) => {
28
72
  if (!(0, import_lodash.isObject)(data) || data === null)
29
73
  return data;
@@ -49,7 +93,7 @@ var filterObject = (data) => {
49
93
  return resData;
50
94
  };
51
95
  var diffOriginal = (params) => {
52
- const { originalValue, value, onDiff } = params;
96
+ const { originalValue, value, onDiff, type } = params;
53
97
  if ((0, import_lodash.isFunction)(onDiff)) {
54
98
  const diffRes = onDiff(originalValue, value);
55
99
  if (diffRes !== void 0) {
@@ -59,6 +103,9 @@ var diffOriginal = (params) => {
59
103
  return diffRes;
60
104
  }
61
105
  }
106
+ if (["InputNumber", "ProNumberRange"].includes(type)) {
107
+ return handleNumberTypeDiff(params);
108
+ }
62
109
  const _value = filterObject(value);
63
110
  const _originalValue = filterObject(originalValue);
64
111
  const isEmptyVal = (0, import_utils.isEmpty)(_value);
@@ -176,7 +176,7 @@ var filterInternalFields = (values, optimize) => {
176
176
  if ((0, import_lodash.isObject)(nextValues)) {
177
177
  const result = {};
178
178
  Object.keys(nextValues).forEach((key) => {
179
- if (key.includes("-"))
179
+ if (key.includes("-") || key.startsWith("__"))
180
180
  return;
181
181
  result[key] = filterInternalFields(nextValues[key]);
182
182
  });
@@ -19,6 +19,7 @@ interface UseShouldUpdateProps<Values> {
19
19
  rules?: ProRule[];
20
20
  required?: boolean;
21
21
  type: string;
22
+ shouldUpdateDebounce?: number;
22
23
  [key: string]: any;
23
24
  }
24
25
  type HookShouldUpdate<Values = any> = (props: UseShouldUpdateProps<Values>) => Result<Values>;
@@ -44,10 +44,13 @@ var useShouldUpdate = (props) => {
44
44
  component,
45
45
  originComponent,
46
46
  type,
47
- desensitization
47
+ desensitization,
48
+ shouldUpdateDebounce = 500
48
49
  } = props;
49
50
  const { shouldUpdate, name, clearNotShow, index, namePath, names, dependNames } = formItemProps;
50
51
  const timerRef = (0, import_react.useRef)(null);
52
+ const debouncedShouldUpdateRef = (0, import_react.useRef)(null);
53
+ const pendingValuesRef = (0, import_react.useRef)(null);
51
54
  const needClear = (0, import_react.useRef)(false);
52
55
  const showRef = (0, import_react.useRef)(false);
53
56
  const disabledRef = (0, import_react.useRef)(false);
@@ -60,6 +63,47 @@ var useShouldUpdate = (props) => {
60
63
  const newComponent = originComponent || component;
61
64
  const [, reRender] = (0, import_react.useState)({});
62
65
  let values = {};
66
+ const processValuesUpdate = (currentValues) => {
67
+ let _currentValues;
68
+ if (namePath) {
69
+ _currentValues = form.getFieldValue(namePath) || {};
70
+ } else {
71
+ _currentValues = currentValues;
72
+ }
73
+ const _show = (0, import_lodash.isFunction)(show) ? Boolean(show(_currentValues, { form, index, namePath })) : show;
74
+ const _disabled = (0, import_lodash.isFunction)(disabled) ? disabled(_currentValues, { form, index, namePath }) : disabled;
75
+ const _required = (0, import_lodash.isFunction)(required) ? required(_currentValues, { form, index, namePath }) : required;
76
+ const _rules = (0, import_lodash.isFunction)(rules) ? rules(_currentValues, { form, index, namePath }) : rules;
77
+ const _fieldProps = (0, import_lodash.isFunction)(fieldProps) ? fieldProps(_currentValues, { form, index, namePath }) : fieldProps;
78
+ const _desensitization = (0, import_lodash.isFunction)(desensitization) ? desensitization(_currentValues, { form, index, namePath }) : desensitization;
79
+ const equalRes = (0, import_lodash.isEqualWith)(rulesRef.current, _rules, import_utils.customEqualForFunction);
80
+ const proEqualRes = (0, import_lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, import_utils.customEqualForFunction);
81
+ const desensitizationRes = (0, import_lodash.isEqualWith)(desensitizationRef.current, _desensitization);
82
+ if (_show !== showRef.current || !(0, import_lodash.isEqualWith)(disabledRef.current, _disabled, import_utils.customEqualForFunction) || _required !== requiredRef.current || !equalRes || !proEqualRes || !desensitizationRes || (_fieldProps == null ? void 0 : _fieldProps.transformResponse)) {
83
+ showRef.current = _show;
84
+ disabledRef.current = _disabled;
85
+ requiredRef.current = _required;
86
+ rulesRef.current = _rules;
87
+ fieldPropsRef.current = _fieldProps;
88
+ desensitizationRef.current = _desensitization;
89
+ reRender({});
90
+ }
91
+ };
92
+ (0, import_react.useEffect)(() => {
93
+ if (shouldUpdateDebounce > 0 && ((dependNames == null ? void 0 : dependNames.length) || (0, import_lodash.isFunction)(show) || (0, import_lodash.isFunction)(disabled) || (0, import_lodash.isFunction)(required) || (0, import_lodash.isFunction)(rules) || (0, import_lodash.isFunction)(fieldProps) || (0, import_lodash.isFunction)(originComponent) || (0, import_lodash.isFunction)(desensitization))) {
94
+ debouncedShouldUpdateRef.current = (0, import_lodash.debounce)(() => {
95
+ if (pendingValuesRef.current) {
96
+ const currentValues = pendingValuesRef.current;
97
+ pendingValuesRef.current = null;
98
+ processValuesUpdate(currentValues);
99
+ }
100
+ }, shouldUpdateDebounce);
101
+ }
102
+ return () => {
103
+ var _a;
104
+ (_a = debouncedShouldUpdateRef.current) == null ? void 0 : _a.cancel();
105
+ };
106
+ }, [shouldUpdateDebounce, dependNames == null ? void 0 : dependNames.length, show, disabled, required, rules, fieldProps, originComponent, desensitization]);
63
107
  if (!(dependNames == null ? void 0 : dependNames.length) && !(0, import_lodash.isFunction)(show) && !(0, import_lodash.isFunction)(disabled) && !(0, import_lodash.isFunction)(required) && !(0, import_lodash.isFunction)(rules) && !(0, import_lodash.isFunction)(fieldProps) && !(0, import_lodash.isFunction)(originComponent) && !(0, import_lodash.isFunction)(desensitization)) {
64
108
  return { shouldUpdate, show, disabled, required, rules, fieldProps, component: newComponent, desensitization };
65
109
  }
@@ -123,6 +167,11 @@ var useShouldUpdate = (props) => {
123
167
  if (!dependNamesChanged)
124
168
  return false;
125
169
  }
170
+ if (shouldUpdateDebounce > 0 && debouncedShouldUpdateRef.current) {
171
+ pendingValuesRef.current = currentValues;
172
+ debouncedShouldUpdateRef.current();
173
+ return false;
174
+ }
126
175
  let _currentValues;
127
176
  if (namePath) {
128
177
  _currentValues = form.getFieldValue(namePath) || {};
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-icon {
5
3
  cursor: pointer;