@zat-design/sisyphus-react 4.5.9 → 4.5.10-beta.2

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 (280) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/FormsProvider/index.js +14 -21
  4. package/es/ProAction/components/CheckModalContent/index.js +12 -26
  5. package/es/ProAction/index.js +79 -83
  6. package/es/ProAction/propsType.js +0 -1
  7. package/es/ProConfigProvider/index.js +63 -110
  8. package/es/ProConfigProvider/propsType.js +0 -1
  9. package/es/ProDownload/index.d.ts +2 -1
  10. package/es/ProDownload/index.js +74 -69
  11. package/es/ProDownload/propsType.js +0 -1
  12. package/es/ProDownload/utils.d.ts +10 -5
  13. package/es/ProDownload/utils.js +63 -95
  14. package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
  15. package/es/ProDrawerForm/components/ProModal/index.js +77 -108
  16. package/es/ProDrawerForm/components/index.js +6 -2
  17. package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
  18. package/es/ProDrawerForm/index.js +29 -38
  19. package/es/ProDrawerForm/propsType.js +0 -1
  20. package/es/ProDrawerForm/utils/index.js +18 -36
  21. package/es/ProEditLabel/components/RenderProForm.js +45 -49
  22. package/es/ProEditLabel/index.js +126 -163
  23. package/es/ProEditLabel/propsType.js +0 -1
  24. package/es/ProEditLabel/utils/index.js +5 -8
  25. package/es/ProEditTable/components/ActionButton/index.js +111 -119
  26. package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
  27. package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
  28. package/es/ProEditTable/components/RcTable/index.js +6 -4
  29. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
  30. package/es/ProEditTable/components/RenderField/index.js +490 -587
  31. package/es/ProEditTable/components/RenderField/propsType.js +0 -1
  32. package/es/ProEditTable/components/RenderField/tools.js +115 -112
  33. package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
  34. package/es/ProEditTable/components/Summary/index.js +38 -64
  35. package/es/ProEditTable/components/Validator/index.js +46 -46
  36. package/es/ProEditTable/components/index.js +12 -5
  37. package/es/ProEditTable/index.js +456 -378
  38. package/es/ProEditTable/propsType.js +0 -1
  39. package/es/ProEditTable/utils/config.js +60 -122
  40. package/es/ProEditTable/utils/diffOriginal.js +45 -82
  41. package/es/ProEditTable/utils/getDefaultProps.js +19 -24
  42. package/es/ProEditTable/utils/index.js +154 -235
  43. package/es/ProEditTable/utils/tools.js +149 -286
  44. package/es/ProEditTable/utils/transform.js +25 -30
  45. package/es/ProEditTable/utils/useEditTableError.js +30 -43
  46. package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
  47. package/es/ProEditTable/utils/validateAll.js +87 -154
  48. package/es/ProEnum/components/Group.js +38 -30
  49. package/es/ProEnum/components/Tag.js +22 -26
  50. package/es/ProEnum/hooks/useEnum.js +48 -116
  51. package/es/ProEnum/hooks/useEnumRequest.js +182 -212
  52. package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
  53. package/es/ProEnum/index.js +162 -172
  54. package/es/ProEnum/propsType.js +0 -1
  55. package/es/ProEnum/utils/eventCenter.js +10 -12
  56. package/es/ProEnum/utils/frequentEnum.js +35 -92
  57. package/es/ProEnum/utils/getEnum.js +32 -90
  58. package/es/ProEnum/utils/getEnumLabel.js +44 -49
  59. package/es/ProEnum/utils/index.js +93 -207
  60. package/es/ProForm/components/Container.js +13 -28
  61. package/es/ProForm/components/FormFooter/index.js +36 -44
  62. package/es/ProForm/components/FormFooter/propsType.js +0 -1
  63. package/es/ProForm/components/base/Checkbox/index.js +32 -59
  64. package/es/ProForm/components/base/DatePicker/index.js +49 -71
  65. package/es/ProForm/components/base/Input/index.js +63 -97
  66. package/es/ProForm/components/base/Input/propsType.js +0 -1
  67. package/es/ProForm/components/base/InputNumber/index.js +118 -172
  68. package/es/ProForm/components/base/Radio/index.js +39 -52
  69. package/es/ProForm/components/base/RangePicker/index.js +109 -127
  70. package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
  71. package/es/ProForm/components/base/Select/index.js +63 -89
  72. package/es/ProForm/components/base/Switch/index.js +27 -35
  73. package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
  74. package/es/ProForm/components/base/TextArea/index.js +30 -41
  75. package/es/ProForm/components/base/TimePicker/index.js +27 -37
  76. package/es/ProForm/components/combination/Container/index.js +37 -47
  77. package/es/ProForm/components/combination/Container/propsType.js +0 -1
  78. package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
  79. package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
  80. package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
  81. package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
  82. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
  83. package/es/ProForm/components/combination/FormList/index.js +151 -161
  84. package/es/ProForm/components/combination/FormList/propsType.js +0 -1
  85. package/es/ProForm/components/combination/FormList/style/index.less +6 -0
  86. package/es/ProForm/components/combination/FormList/utils.js +22 -38
  87. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
  88. package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
  89. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
  90. package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
  91. package/es/ProForm/components/combination/Group/index.js +87 -126
  92. package/es/ProForm/components/combination/Group/propsType.js +0 -1
  93. package/es/ProForm/components/combination/Group/utils/index.js +124 -239
  94. package/es/ProForm/components/combination/ProCascader/index.js +156 -199
  95. package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
  96. package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
  97. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
  98. package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
  99. package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
  100. package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
  101. package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
  102. package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
  103. package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
  104. package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
  105. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
  106. package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
  107. package/es/ProForm/components/index.js +56 -34
  108. package/es/ProForm/components/render/ChangedWrapper.js +85 -94
  109. package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
  110. package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
  111. package/es/ProForm/components/render/Render.js +223 -329
  112. package/es/ProForm/components/render/RenderFields.js +76 -113
  113. package/es/ProForm/components/render/propsType.js +0 -1
  114. package/es/ProForm/hooks/useControlled.js +8 -10
  115. package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
  116. package/es/ProForm/hooks/useFieldProps.js +8 -4
  117. package/es/ProForm/hooks/useForm.js +50 -110
  118. package/es/ProForm/hooks/useRules.js +17 -33
  119. package/es/ProForm/hooks/useShouldUpdate.js +77 -152
  120. package/es/ProForm/hooks/useWatch.js +62 -134
  121. package/es/ProForm/index.js +157 -194
  122. package/es/ProForm/propsType.js +15 -7
  123. package/es/ProForm/utils/buildFormItemProps.js +51 -58
  124. package/es/ProForm/utils/diffOriginal.js +43 -73
  125. package/es/ProForm/utils/getDefaultProps.js +18 -24
  126. package/es/ProForm/utils/index.js +160 -235
  127. package/es/ProForm/utils/processDependencies.js +21 -60
  128. package/es/ProForm/utils/reactiveValues.js +20 -34
  129. package/es/ProForm/utils/rulesCreator.js +42 -40
  130. package/es/ProForm/utils/transformNames.js +10 -13
  131. package/es/ProForm/utils/transformValue.js +16 -29
  132. package/es/ProForm/utils/valueType.js +96 -178
  133. package/es/ProIcon/config/index.js +340 -274
  134. package/es/ProIcon/index.js +135 -209
  135. package/es/ProIcon/propsTypes.js +0 -1
  136. package/es/ProIcon/utils/index.js +24 -39
  137. package/es/ProLayout/components/Layout/Header/index.js +108 -141
  138. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
  139. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
  140. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
  141. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
  142. package/es/ProLayout/components/Layout/Menu/index.js +92 -89
  143. package/es/ProLayout/components/Layout/Notice/index.js +13 -27
  144. package/es/ProLayout/components/Layout/index.js +8 -3
  145. package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
  146. package/es/ProLayout/components/ProCollapse/index.js +89 -111
  147. package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
  148. package/es/ProLayout/components/ProFooter/index.js +27 -24
  149. package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
  150. package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
  151. package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
  152. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
  153. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
  154. package/es/ProLayout/components/ProHeader/components/index.js +6 -2
  155. package/es/ProLayout/components/ProHeader/index.js +216 -356
  156. package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
  157. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
  158. package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
  159. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
  160. package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
  161. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
  162. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
  163. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
  164. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
  165. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
  166. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
  167. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
  168. package/es/ProLayout/components/TabsManager/index.js +407 -351
  169. package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
  170. package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
  171. package/es/ProLayout/components/TabsManager/style/index.less +1 -1
  172. package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
  173. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
  174. package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
  175. package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
  176. package/es/ProLayout/components/index.js +8 -3
  177. package/es/ProLayout/index.js +173 -228
  178. package/es/ProLayout/propTypes.d.ts +28 -1
  179. package/es/ProLayout/propTypes.js +12 -52
  180. package/es/ProLayout/utils/index.js +48 -128
  181. package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
  182. package/es/ProSelect/index.js +187 -223
  183. package/es/ProSelect/propsType.js +0 -1
  184. package/es/ProSelect/style/index.less +13 -0
  185. package/es/ProSelect/utils/index.js +100 -146
  186. package/es/ProStep/components/Anchor/index.js +71 -82
  187. package/es/ProStep/components/Item/index.js +49 -56
  188. package/es/ProStep/components/LazyLoad/index.js +23 -29
  189. package/es/ProStep/components/Listener/index.js +20 -33
  190. package/es/ProStep/components/Step/index.js +31 -38
  191. package/es/ProStep/constants.js +4 -1
  192. package/es/ProStep/index.js +166 -153
  193. package/es/ProStep/propsType.js +0 -1
  194. package/es/ProStep/style/index.less +1 -1
  195. package/es/ProStep/utils/index.js +29 -55
  196. package/es/ProStepTab/index.js +83 -138
  197. package/es/ProStepTab/propsType.js +0 -1
  198. package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
  199. package/es/ProTable/components/EditableCell/index.js +37 -71
  200. package/es/ProTable/components/EditableCell/propsType.js +0 -1
  201. package/es/ProTable/components/FormatColumn/index.js +209 -340
  202. package/es/ProTable/components/FormatColumn/propsType.js +0 -1
  203. package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
  204. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
  205. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
  206. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
  207. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
  208. package/es/ProTable/components/RcTable/index.js +6 -4
  209. package/es/ProTable/components/RenderColumn/index.js +158 -186
  210. package/es/ProTable/components/RenderEmptyText/index.js +12 -21
  211. package/es/ProTable/components/RenderFooter/index.js +15 -15
  212. package/es/ProTable/components/RenderSummary/index.js +33 -50
  213. package/es/ProTable/components/RenderTableHeader/index.js +44 -46
  214. package/es/ProTable/components/RenderTabs/index.js +47 -51
  215. package/es/ProTable/components/TableResizable/index.js +56 -72
  216. package/es/ProTable/components/TooltipTitle/index.js +13 -21
  217. package/es/ProTable/components/index.js +16 -36
  218. package/es/ProTable/hooks/useAntdTable.js +191 -224
  219. package/es/ProTable/index.js +232 -249
  220. package/es/ProTable/propsType.js +0 -1
  221. package/es/ProTable/utils/columnStorage.js +63 -88
  222. package/es/ProTable/utils/index.js +57 -90
  223. package/es/ProTabs/components/Card/index.js +20 -48
  224. package/es/ProTabs/components/index.js +4 -1
  225. package/es/ProTabs/index.js +41 -58
  226. package/es/ProTabs/propType.js +0 -1
  227. package/es/ProThemeTools/component/ProTools/index.js +106 -158
  228. package/es/ProThemeTools/component/index.js +4 -1
  229. package/es/ProThemeTools/context/ThemeContext.js +67 -146
  230. package/es/ProThemeTools/index.js +103 -156
  231. package/es/ProThemeTools/propsType.js +0 -1
  232. package/es/ProThemeTools/utils/index.js +60 -109
  233. package/es/ProTooltip/index.js +132 -168
  234. package/es/ProTooltip/propsType.js +0 -1
  235. package/es/ProTree/components/AdaptiveTooltip.js +15 -17
  236. package/es/ProTree/components/CloseIcon.js +18 -26
  237. package/es/ProTree/components/List.js +28 -47
  238. package/es/ProTree/components/ProTree.js +152 -211
  239. package/es/ProTree/components/ProTreeSelect/index.js +255 -459
  240. package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
  241. package/es/ProTree/components/SearchTitle.js +23 -42
  242. package/es/ProTree/components/Tree.js +147 -195
  243. package/es/ProTree/components/index.js +10 -5
  244. package/es/ProTree/index.js +12 -16
  245. package/es/ProTree/propsType.js +0 -1
  246. package/es/ProTree/utils.js +46 -118
  247. package/es/ProTreeModal/components/Cascader.js +56 -64
  248. package/es/ProTreeModal/components/CloseIcon.js +18 -26
  249. package/es/ProTreeModal/components/List.js +114 -180
  250. package/es/ProTreeModal/components/SearchTitle.js +15 -18
  251. package/es/ProTreeModal/components/SortableItem.js +29 -58
  252. package/es/ProTreeModal/components/Tree.js +99 -113
  253. package/es/ProTreeModal/components/Trigger.js +87 -121
  254. package/es/ProTreeModal/components/index.js +14 -6
  255. package/es/ProTreeModal/index.js +397 -438
  256. package/es/ProTreeModal/propsType.js +0 -1
  257. package/es/ProTreeModal/utils.js +52 -95
  258. package/es/ProUpload/components/ButtonRender.js +44 -54
  259. package/es/ProUpload/components/DragRender.js +94 -148
  260. package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
  261. package/es/ProUpload/components/Example.js +27 -31
  262. package/es/ProUpload/components/FileItem.js +69 -163
  263. package/es/ProUpload/components/ImageRender.js +134 -170
  264. package/es/ProUpload/index.js +68 -100
  265. package/es/ProUpload/propsType.js +0 -1
  266. package/es/ProUpload/uitls.js +8 -4
  267. package/es/ProUtils/utils/index.js +17 -13
  268. package/es/ProViewer/index.js +154 -175
  269. package/es/ProViewer/propsType.js +0 -5
  270. package/es/ProWaterMark/index.js +9 -16
  271. package/es/ProWaterMark/propsType.js +0 -1
  272. package/es/hooks/useDraggableRow.js +25 -53
  273. package/es/index.js +57 -77
  274. package/es/locale/en_US.js +153 -142
  275. package/es/locale/index.js +23 -36
  276. package/es/locale/zh_CN.js +145 -142
  277. package/es/tokens.js +84 -83
  278. package/es/utils/index.js +24 -51
  279. package/package.json +4 -2
  280. package/es/ProConfigProvider/demo/locale.js +0 -58
@@ -1,52 +1,35 @@
1
- import { get, set, del } from 'idb-keyval';
2
- export const baseCacheKey = 'zat-design-pro-component-cacheKey';
3
-
4
- /** v4 默认存储类型 */
5
- export const baseStorage = 'indexedDB';
6
-
7
- /** 模块级内存缓存,key 为 cacheKey,替代原单例 baseEnumStorage 变量 */
8
- export const enumMemoryCache = new Map();
9
-
10
- // IndexedDB 可用性检测缓存
1
+ import { get, set, del } from "idb-keyval";
2
+ const baseCacheKey = "zat-design-pro-component-cacheKey";
3
+ const baseStorage = "indexedDB";
4
+ const enumMemoryCache = /* @__PURE__ */ new Map();
11
5
  let indexedDBAvailable = null;
12
-
13
- /**
14
- * 检测 IndexedDB 是否可用
15
- */
16
6
  async function checkIndexedDBSupport() {
17
7
  if (indexedDBAvailable !== null) {
18
8
  return indexedDBAvailable;
19
9
  }
20
10
  try {
21
- await set('__idb_test__', 1);
22
- await del('__idb_test__');
11
+ await set("__idb_test__", 1);
12
+ await del("__idb_test__");
23
13
  indexedDBAvailable = true;
24
14
  return true;
25
15
  } catch (error) {
26
- console.warn('ProEnum: IndexedDB is not available in this environment:', error);
27
- console.warn('ProEnum: Please use localStorage or sessionStorage instead');
16
+ console.warn("ProEnum: IndexedDB is not available in this environment:", error);
17
+ console.warn("ProEnum: Please use localStorage or sessionStorage instead");
28
18
  indexedDBAvailable = false;
29
19
  return false;
30
20
  }
31
21
  }
32
-
33
- /**
34
- * 从 IndexedDB 读取数据
35
- */
36
-
37
22
  function getEnumCodeLength(data) {
38
- if (!data || typeof data !== 'object' || Array.isArray(data)) {
23
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
39
24
  return 0;
40
25
  }
41
26
  return Object.keys(data).length;
42
27
  }
43
- export function normalizeEnumCacheData(cacheData) {
44
- const rawData = cacheData?.data && typeof cacheData.data === 'object' && !Array.isArray(cacheData.data) ? cacheData.data : {};
45
- const data = {
46
- ...rawData
47
- };
28
+ function normalizeEnumCacheData(cacheData) {
29
+ const rawData = (cacheData == null ? void 0 : cacheData.data) && typeof cacheData.data === "object" && !Array.isArray(cacheData.data) ? cacheData.data : {};
30
+ const data = { ...rawData };
48
31
  return {
49
- ...(cacheData || {}),
32
+ ...cacheData || {},
50
33
  data,
51
34
  dataLength: getEnumCodeLength(data)
52
35
  };
@@ -54,26 +37,16 @@ export function normalizeEnumCacheData(cacheData) {
54
37
  async function getFromIndexedDB(key) {
55
38
  const available = await checkIndexedDBSupport();
56
39
  if (!available) {
57
- return {
58
- data: {}
59
- };
40
+ return { data: {} };
60
41
  }
61
42
  try {
62
43
  const value = await get(key);
63
- return value || {
64
- data: {}
65
- };
44
+ return value || { data: {} };
66
45
  } catch (error) {
67
- console.warn('ProEnum: IndexedDB read failed:', error);
68
- return {
69
- data: {}
70
- };
46
+ console.warn("ProEnum: IndexedDB read failed:", error);
47
+ return { data: {} };
71
48
  }
72
49
  }
73
-
74
- /**
75
- * 写入数据到 IndexedDB
76
- */
77
50
  async function setToIndexedDB(key, value) {
78
51
  const available = await checkIndexedDBSupport();
79
52
  if (!available) {
@@ -84,93 +57,56 @@ async function setToIndexedDB(key, value) {
84
57
  return;
85
58
  }
86
59
  try {
87
- // 清理 params 字段(ahooks useRequest 缓存结构中的冗余字段)
88
- const {
89
- params,
90
- ...cleanValue
91
- } = normalizedValue;
60
+ const { params, ...cleanValue } = normalizedValue;
92
61
  await set(key, cleanValue);
93
62
  } catch (error) {
94
- console.warn('ProEnum: IndexedDB write failed:', error);
63
+ console.warn("ProEnum: IndexedDB write failed:", error);
95
64
  }
96
65
  }
97
-
98
- /**
99
- * 获取枚举数据
100
- * @param storage
101
- * @param cacheKey
102
- * @returns
103
- */
104
- export function getEnumData(storage, cacheKey) {
105
- // IndexedDB:先查内存缓存,命中则同步返回,避免实际 I/O
106
- if (storage === 'indexedDB') {
66
+ function getEnumData(storage, cacheKey) {
67
+ if (storage === "indexedDB") {
107
68
  if (enumMemoryCache.has(cacheKey)) {
108
69
  return Promise.resolve(enumMemoryCache.get(cacheKey));
109
70
  }
110
- return getFromIndexedDB(cacheKey).then(data => {
71
+ return getFromIndexedDB(cacheKey).then((data) => {
111
72
  enumMemoryCache.set(cacheKey, data);
112
73
  return data;
113
74
  });
114
75
  }
115
-
116
- // localStorage/sessionStorage 保持同步
117
- if (storage === 'localStorage') {
118
- const data = JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
119
- if (data && typeof data === 'object' && 'data' in data) {
76
+ if (storage === "localStorage") {
77
+ const data = JSON.parse(window.localStorage.getItem(cacheKey) || "{}");
78
+ if (data && typeof data === "object" && "data" in data) {
120
79
  return data;
121
80
  }
122
- return {
123
- data: {}
124
- };
81
+ return { data: {} };
125
82
  }
126
- if (storage === 'sessionStorage') {
127
- const data = JSON.parse(window.sessionStorage.getItem(cacheKey) || '{}');
128
- if (data && typeof data === 'object' && 'data' in data) {
83
+ if (storage === "sessionStorage") {
84
+ const data = JSON.parse(window.sessionStorage.getItem(cacheKey) || "{}");
85
+ if (data && typeof data === "object" && "data" in data) {
129
86
  return data;
130
87
  }
131
- return {
132
- data: {}
133
- };
88
+ return { data: {} };
134
89
  }
135
- return {
136
- data: {}
137
- };
90
+ return { data: {} };
138
91
  }
139
-
140
- /**
141
- * 设置枚举数据
142
- * @param storage
143
- * @param cacheKey
144
- * @param data
145
- */
146
- export function setEnumData(storage, cacheKey, data) {
92
+ function setEnumData(storage, cacheKey, data) {
147
93
  const normalizedData = normalizeEnumCacheData(data);
148
94
  if (!Object.keys(normalizedData.data || {}).length) {
149
95
  return;
150
96
  }
151
-
152
- // IndexedDB:同步写内存缓存,异步持久化到 IndexedDB
153
- if (storage === 'indexedDB') {
97
+ if (storage === "indexedDB") {
154
98
  enumMemoryCache.set(cacheKey, normalizedData);
155
99
  return setToIndexedDB(cacheKey, normalizedData);
156
100
  }
157
-
158
- // localStorage/sessionStorage 保持同步
159
- if (storage === 'localStorage') {
101
+ if (storage === "localStorage") {
160
102
  window.localStorage.setItem(cacheKey, JSON.stringify(normalizedData));
161
- } else if (storage === 'sessionStorage') {
103
+ } else if (storage === "sessionStorage") {
162
104
  window.sessionStorage.setItem(cacheKey, JSON.stringify(normalizedData));
163
105
  }
164
106
  }
165
-
166
- /**
167
- * 删除枚举缓存数据
168
- * @param storage
169
- * @param cacheKey
170
- */
171
- export async function removeEnumData(storage, cacheKey) {
107
+ async function removeEnumData(storage, cacheKey) {
172
108
  enumMemoryCache.delete(cacheKey);
173
- if (storage === 'indexedDB') {
109
+ if (storage === "indexedDB") {
174
110
  const available = await checkIndexedDBSupport();
175
111
  if (!available) {
176
112
  return;
@@ -178,105 +114,63 @@ export async function removeEnumData(storage, cacheKey) {
178
114
  try {
179
115
  await del(cacheKey);
180
116
  } catch (error) {
181
- console.warn('ProEnum: IndexedDB delete failed:', error);
117
+ console.warn("ProEnum: IndexedDB delete failed:", error);
182
118
  }
183
- } else if (storage === 'localStorage') {
119
+ } else if (storage === "localStorage") {
184
120
  window.localStorage.removeItem(cacheKey);
185
- } else if (storage === 'sessionStorage') {
121
+ } else if (storage === "sessionStorage") {
186
122
  window.sessionStorage.removeItem(cacheKey);
187
123
  }
188
124
  }
189
-
190
- /**
191
- * 从内存缓存或同步存储中同步读取枚举数据,不触发任何异步 I/O。
192
- * - 内存缓存命中时直接返回
193
- * - localStorage/sessionStorage 同步读取并预热内存缓存
194
- * - indexedDB 未命中时返回 undefined(需异步兜底)
195
- */
196
- export function getEnumDataSync(storage, cacheKey) {
197
- if (enumMemoryCache.has(cacheKey)) return enumMemoryCache.get(cacheKey);
198
- if (storage === 'localStorage') {
199
- const d = JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
200
- const res = d?.data ? d : {
201
- data: {}
202
- };
125
+ function getEnumDataSync(storage, cacheKey) {
126
+ if (enumMemoryCache.has(cacheKey))
127
+ return enumMemoryCache.get(cacheKey);
128
+ if (storage === "localStorage") {
129
+ const d = JSON.parse(window.localStorage.getItem(cacheKey) || "{}");
130
+ const res = (d == null ? void 0 : d.data) ? d : { data: {} };
203
131
  enumMemoryCache.set(cacheKey, res);
204
132
  return res;
205
133
  }
206
- if (storage === 'sessionStorage') {
207
- const d = JSON.parse(window.sessionStorage.getItem(cacheKey) || '{}');
208
- const res = d?.data ? d : {
209
- data: {}
210
- };
134
+ if (storage === "sessionStorage") {
135
+ const d = JSON.parse(window.sessionStorage.getItem(cacheKey) || "{}");
136
+ const res = (d == null ? void 0 : d.data) ? d : { data: {} };
211
137
  enumMemoryCache.set(cacheKey, res);
212
138
  return res;
213
139
  }
214
- return undefined;
140
+ return void 0;
215
141
  }
216
-
217
- /**
218
- * 判断枚举列表是否存在
219
- * @param storage
220
- * @param cacheKey
221
- * @param code
222
- * @returns
223
- */
224
- export function hasEnumList(storage, cacheKey, code) {
225
- // 对于 indexedDB,getEnumData 返回 Promise,但 hasEnumList 是同步函数
226
- // 这里只支持同步存储类型
227
- if (storage === 'indexedDB') {
228
- console.warn('ProEnum: hasEnumList does not support indexedDB, please use async version');
142
+ function hasEnumList(storage, cacheKey, code) {
143
+ if (storage === "indexedDB") {
144
+ console.warn("ProEnum: hasEnumList does not support indexedDB, please use async version");
229
145
  return false;
230
146
  }
231
147
  const res = getEnumData(storage, cacheKey);
232
- const enumList = res?.data || {};
233
- return enumList?.[code];
148
+ const enumList = (res == null ? void 0 : res.data) || {};
149
+ return enumList == null ? void 0 : enumList[code];
234
150
  }
235
-
236
- /**
237
- * 判断是否是对象
238
- * @param obj
239
- * @returns
240
- */
241
- export function isObject(obj) {
242
- return Object.prototype.toString.call(obj) === '[object Object]';
151
+ function isObject(obj) {
152
+ return Object.prototype.toString.call(obj) === "[object Object]";
243
153
  }
244
-
245
- /**
246
- * 合并枚举数据
247
- * @param storage
248
- * @param code
249
- * @param cacheKey
250
- * @param responseData
251
- */
252
- export async function mergeCacheData(storage, code, cacheKey, responseData) {
253
- const buildNextCacheData = cacheData => {
154
+ async function mergeCacheData(storage, code, cacheKey, responseData) {
155
+ var _a;
156
+ const buildNextCacheData = (cacheData) => {
254
157
  const normalizedCacheData = normalizeEnumCacheData(cacheData);
255
158
  normalizedCacheData.data[code] = responseData;
256
159
  return normalizeEnumCacheData(normalizedCacheData);
257
160
  };
258
- if (storage === 'indexedDB') {
161
+ if (storage === "indexedDB") {
259
162
  const cacheData = enumMemoryCache.has(cacheKey) ? enumMemoryCache.get(cacheKey) : await getFromIndexedDB(cacheKey);
260
- await Promise.resolve(setEnumData('indexedDB', cacheKey, buildNextCacheData(cacheData)));
163
+ await Promise.resolve(setEnumData("indexedDB", cacheKey, buildNextCacheData(cacheData)));
261
164
  } else {
262
- const cacheStorage = storage === 'localStorage' ? 'localStorage' : 'sessionStorage';
263
- const cacheData = JSON.parse(window?.[cacheStorage]?.getItem(cacheKey) || '{}');
165
+ const cacheStorage = storage === "localStorage" ? "localStorage" : "sessionStorage";
166
+ const cacheData = JSON.parse(((_a = window == null ? void 0 : window[cacheStorage]) == null ? void 0 : _a.getItem(cacheKey)) || "{}");
264
167
  await Promise.resolve(setEnumData(cacheStorage, cacheKey, buildNextCacheData(cacheData)));
265
168
  }
266
169
  }
267
-
268
- /**
269
- * diff code 差异
270
- * @param cacheCodes
271
- * @param codes
272
- * @returns
273
- */
274
- export function diffCode(cacheCodes, codes) {
170
+ function diffCode(cacheCodes, codes) {
275
171
  let diff = false;
276
- // 以后面传入的作计算
277
172
  for (let index = 0; index < codes.length; index++) {
278
173
  const clude = cacheCodes.includes(codes[index]);
279
- // 缓存中有不存在的 code
280
174
  if (!clude) {
281
175
  diff = true;
282
176
  return diff;
@@ -284,57 +178,33 @@ export function diffCode(cacheCodes, codes) {
284
178
  }
285
179
  return diff;
286
180
  }
287
-
288
- /**
289
- * 缓存fieldNames制定的值
290
- * @param fieldNames 保留映射值
291
- * @param dataSource 需要筛选的数据源
292
- * @returns {}
293
- */
294
- export function cacheFieldNames(fieldNames, dataSource) {
295
- const {
296
- children,
297
- ...restFieldNames
298
- } = fieldNames;
181
+ function cacheFieldNames(fieldNames, dataSource) {
182
+ const { children, ...restFieldNames } = fieldNames;
299
183
  const result = {};
300
- Object.keys(restFieldNames).forEach(key => {
184
+ Object.keys(restFieldNames).forEach((key) => {
301
185
  const sourceKey = restFieldNames[key];
302
186
  const sourceVal = dataSource[sourceKey];
303
187
  const fallbackVal = dataSource[key];
304
- const val = ![undefined, null, ''].includes(sourceVal) ? sourceVal : fallbackVal;
305
- if (![undefined, null, ''].includes(val)) {
188
+ const val = ![void 0, null, ""].includes(sourceVal) ? sourceVal : fallbackVal;
189
+ if (![void 0, null, ""].includes(val)) {
306
190
  result[key] = val;
307
191
  }
308
192
  });
309
- // 递归去对数据进行清洗
310
193
  if (children && Array.isArray(dataSource[children])) {
311
- result.children = dataSource[children].map(item => {
194
+ result.children = dataSource[children].map((item) => {
312
195
  return cacheFieldNames(fieldNames, item);
313
196
  });
314
197
  }
315
198
  return result;
316
199
  }
317
-
318
- /**
319
- * 对枚举请求返回的数据按 clear/fieldNames 进行清洗
320
- * @param response 枚举数据 { code: DataOption[] }
321
- * @param options clear 是否清洗、ignoreCodes 忽略清洗的 code、fieldNames 字段映射
322
- * @returns 清洗后的新对象(不修改入参)
323
- * @remark 某个 code 的值非数组时(脏缓存/异常返回)跳过清洗并原样透传,避免展开非可迭代值报错
324
- */
325
- export function cleanEnumResponse(response, options) {
326
- const {
327
- clear = true,
328
- ignoreCodes = [],
329
- fieldNames
330
- } = options;
331
- if (!clear || typeof response !== 'object' || response === null) {
200
+ function cleanEnumResponse(response, options) {
201
+ const { clear = true, ignoreCodes = [], fieldNames } = options;
202
+ if (!clear || typeof response !== "object" || response === null) {
332
203
  return response;
333
204
  }
334
205
  const result = {};
335
- Object.keys(response).forEach(key => {
206
+ Object.keys(response).forEach((key) => {
336
207
  const value = response[key];
337
- // 非数组值(脏缓存、异常返回等)无法展开清洗,原样透传,避免 not iterable 报错
338
208
  if (!Array.isArray(value)) {
339
209
  result[key] = value;
340
210
  return;
@@ -343,8 +213,24 @@ export function cleanEnumResponse(response, options) {
343
213
  if (ignoreCodes.includes(key)) {
344
214
  result[key] = list;
345
215
  } else {
346
- result[key] = list.map(item => cacheFieldNames(fieldNames, item));
216
+ result[key] = list.map((item) => cacheFieldNames(fieldNames, item));
347
217
  }
348
218
  });
349
219
  return result;
350
- }
220
+ }
221
+ export {
222
+ baseCacheKey,
223
+ baseStorage,
224
+ cacheFieldNames,
225
+ cleanEnumResponse,
226
+ diffCode,
227
+ enumMemoryCache,
228
+ getEnumData,
229
+ getEnumDataSync,
230
+ hasEnumList,
231
+ isObject,
232
+ mergeCacheData,
233
+ normalizeEnumCacheData,
234
+ removeEnumData,
235
+ setEnumData
236
+ };
@@ -1,35 +1,20 @@
1
- import React from 'react';
2
- import { Tooltip } from 'antd';
3
- import classNames from 'classnames';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Tooltip } from "antd";
3
+ import classNames from "classnames";
4
4
  import { isEmptyArray } from "../utils";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const Container = props => {
7
- const {
8
- children,
9
- tooltip,
10
- nowrap,
11
- viewEmpty
12
- } = props;
13
-
14
- // 值为false但不为0, 或者值为空数组
5
+ const Container = (props) => {
6
+ const { children, tooltip, nowrap, viewEmpty } = props;
15
7
  const nullValue = children !== 0 && !children || isEmptyArray(children);
16
8
  const _className = classNames({
17
- 'pro-form-view-container': true,
18
- 'pro-form-view-container-nowrap': nowrap ?? tooltip
9
+ "pro-form-view-container": true,
10
+ "pro-form-view-container-nowrap": nowrap ?? tooltip
19
11
  });
20
12
  if (tooltip && !nullValue) {
21
- return /*#__PURE__*/_jsx(Tooltip, {
22
- placement: "topLeft",
23
- title: children,
24
- children: /*#__PURE__*/_jsx("div", {
25
- className: _className,
26
- children: children
27
- })
28
- });
13
+ return /* @__PURE__ */ jsx(Tooltip, { placement: "topLeft", title: children, children: /* @__PURE__ */ jsx("div", { className: _className, children }) });
29
14
  }
30
- return /*#__PURE__*/_jsx("div", {
31
- className: _className,
32
- children: nullValue ? viewEmpty : children
33
- });
15
+ return /* @__PURE__ */ jsx("div", { className: _className, children: nullValue ? viewEmpty : children });
16
+ };
17
+ var Container_default = Container;
18
+ export {
19
+ Container_default as default
34
20
  };
35
- export default Container;
@@ -1,11 +1,11 @@
1
- import { Space, Button } from 'antd';
2
- import React, { useEffect, useMemo } from 'react';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Space, Button } from "antd";
3
+ import { useEffect, useMemo } from "react";
3
4
  import { useProConfig } from "../../../ProConfigProvider";
4
5
  import locale from "../../../locale";
5
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- export const PRO_FORM_CACHE = 'PRO_FORM_CACHE';
7
- const FormFooter = props => {
8
- const initialConfig = useProConfig('FormFooter');
6
+ const PRO_FORM_CACHE = "PRO_FORM_CACHE";
7
+ const FormFooter = (props) => {
8
+ const initialConfig = useProConfig("FormFooter");
9
9
  const {
10
10
  okText,
11
11
  cancelText,
@@ -16,23 +16,13 @@ const FormFooter = props => {
16
16
  confirmLoading,
17
17
  formId,
18
18
  form
19
- } = {
20
- ...initialConfig,
21
- ...props
22
- };
23
- const {
24
- okButtonProps = {},
25
- cancelButtonProps = {}
26
- } = footer || {};
27
- const {
28
- children: okChildren
29
- } = okButtonProps || {};
30
- const {
31
- children: cancelChildren
32
- } = cancelButtonProps || {};
19
+ } = { ...initialConfig, ...props };
20
+ const { okButtonProps = {}, cancelButtonProps = {} } = footer || {};
21
+ const { children: okChildren } = okButtonProps || {};
22
+ const { children: cancelChildren } = cancelButtonProps || {};
33
23
  const searchCache = useMemo(() => {
34
24
  const cacheStr = window.sessionStorage.getItem(PRO_FORM_CACHE);
35
- const cache = JSON.parse(cacheStr || '{}');
25
+ const cache = JSON.parse(cacheStr || "{}");
36
26
  return cache;
37
27
  }, [formId]);
38
28
  useEffect(() => {
@@ -41,21 +31,18 @@ const FormFooter = props => {
41
31
  }
42
32
  }, [formId]);
43
33
  const nextOnOk = () => {
34
+ var _a;
44
35
  if (formId) {
45
36
  const values = form.getFieldsValue();
46
37
  searchCache[formId] = values;
47
38
  window.sessionStorage.setItem(PRO_FORM_CACHE, JSON.stringify(searchCache));
48
39
  }
49
-
50
- // 支持 stopOnFirstError
51
- // @ts-ignore 使用类型断言处理自定义属性
52
40
  const modifiedForm = form;
53
- if (modifiedForm.__INTERNAL_CONFIG__?.stopOnFirstError) {
54
- // 使用自定义验证逻辑
41
+ if ((_a = modifiedForm.__INTERNAL_CONFIG__) == null ? void 0 : _a.stopOnFirstError) {
55
42
  form.validateFields().then(() => {
56
43
  onOk();
57
- }).catch(error => {
58
- console.warn('ProForm validateFields error', error);
44
+ }).catch((error) => {
45
+ console.warn("ProForm validateFields error", error);
59
46
  });
60
47
  } else {
61
48
  onOk();
@@ -68,20 +55,25 @@ const FormFooter = props => {
68
55
  }
69
56
  onCancel();
70
57
  };
71
- return /*#__PURE__*/_jsxs(Space, {
72
- children: [/*#__PURE__*/_jsx(Button, {
73
- type: "primary",
74
- htmlType: onOk ? 'button' : 'submit',
75
- onClick: nextOnOk,
76
- disabled: confirmLoading,
77
- loading: confirmLoading,
78
- ...okButtonProps,
79
- children: okChildren || okText || `${locale.ProForm.search}`
80
- }), /*#__PURE__*/_jsx(Button, {
81
- onClick: nextOnCancel,
82
- ...cancelButtonProps,
83
- children: cancelChildren || cancelText || `${locale.ProForm.reset}`
84
- }), children]
85
- });
58
+ return /* @__PURE__ */ jsxs(Space, { children: [
59
+ /* @__PURE__ */ jsx(
60
+ Button,
61
+ {
62
+ type: "primary",
63
+ htmlType: onOk ? "button" : "submit",
64
+ onClick: nextOnOk,
65
+ disabled: confirmLoading,
66
+ loading: confirmLoading,
67
+ ...okButtonProps,
68
+ children: okChildren || okText || `${locale.ProForm.search}`
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx(Button, { onClick: nextOnCancel, ...cancelButtonProps, children: cancelChildren || cancelText || `${locale.ProForm.reset}` }),
72
+ children
73
+ ] });
74
+ };
75
+ var FormFooter_default = FormFooter;
76
+ export {
77
+ PRO_FORM_CACHE,
78
+ FormFooter_default as default
86
79
  };
87
- export default FormFooter;
@@ -1 +0,0 @@
1
- export {};