@zat-design/sisyphus-react 4.5.10-beta.1 → 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 (266) hide show
  1. package/es/FormsProvider/index.js +14 -21
  2. package/es/ProAction/components/CheckModalContent/index.js +12 -26
  3. package/es/ProAction/index.js +79 -83
  4. package/es/ProAction/propsType.js +0 -1
  5. package/es/ProConfigProvider/index.js +63 -110
  6. package/es/ProConfigProvider/propsType.js +0 -1
  7. package/es/ProDownload/index.js +55 -65
  8. package/es/ProDownload/propsType.js +0 -1
  9. package/es/ProDownload/utils.js +61 -95
  10. package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
  11. package/es/ProDrawerForm/components/ProModal/index.js +77 -108
  12. package/es/ProDrawerForm/components/index.js +6 -2
  13. package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
  14. package/es/ProDrawerForm/index.js +29 -38
  15. package/es/ProDrawerForm/propsType.js +0 -1
  16. package/es/ProDrawerForm/utils/index.js +18 -36
  17. package/es/ProEditLabel/components/RenderProForm.js +45 -49
  18. package/es/ProEditLabel/index.js +126 -163
  19. package/es/ProEditLabel/propsType.js +0 -1
  20. package/es/ProEditLabel/utils/index.js +5 -8
  21. package/es/ProEditTable/components/ActionButton/index.js +111 -119
  22. package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
  23. package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
  24. package/es/ProEditTable/components/RcTable/index.js +6 -4
  25. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
  26. package/es/ProEditTable/components/RenderField/index.js +490 -587
  27. package/es/ProEditTable/components/RenderField/propsType.js +0 -1
  28. package/es/ProEditTable/components/RenderField/tools.js +115 -112
  29. package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
  30. package/es/ProEditTable/components/Summary/index.js +38 -64
  31. package/es/ProEditTable/components/Validator/index.js +46 -46
  32. package/es/ProEditTable/components/index.js +12 -5
  33. package/es/ProEditTable/index.js +456 -378
  34. package/es/ProEditTable/propsType.js +0 -1
  35. package/es/ProEditTable/utils/config.js +60 -122
  36. package/es/ProEditTable/utils/diffOriginal.js +45 -82
  37. package/es/ProEditTable/utils/getDefaultProps.js +19 -24
  38. package/es/ProEditTable/utils/index.js +150 -236
  39. package/es/ProEditTable/utils/tools.js +149 -286
  40. package/es/ProEditTable/utils/transform.js +25 -30
  41. package/es/ProEditTable/utils/useEditTableError.js +30 -43
  42. package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
  43. package/es/ProEditTable/utils/validateAll.js +87 -154
  44. package/es/ProEnum/components/Group.js +38 -30
  45. package/es/ProEnum/components/Tag.js +22 -26
  46. package/es/ProEnum/hooks/useEnum.js +48 -116
  47. package/es/ProEnum/hooks/useEnumRequest.js +128 -179
  48. package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
  49. package/es/ProEnum/index.js +162 -172
  50. package/es/ProEnum/propsType.js +0 -1
  51. package/es/ProEnum/utils/eventCenter.js +10 -12
  52. package/es/ProEnum/utils/frequentEnum.js +35 -92
  53. package/es/ProEnum/utils/getEnum.js +32 -90
  54. package/es/ProEnum/utils/getEnumLabel.js +44 -49
  55. package/es/ProEnum/utils/index.js +93 -207
  56. package/es/ProForm/components/Container.js +13 -28
  57. package/es/ProForm/components/FormFooter/index.js +36 -44
  58. package/es/ProForm/components/FormFooter/propsType.js +0 -1
  59. package/es/ProForm/components/base/Checkbox/index.js +32 -59
  60. package/es/ProForm/components/base/DatePicker/index.js +49 -71
  61. package/es/ProForm/components/base/Input/index.js +63 -97
  62. package/es/ProForm/components/base/Input/propsType.js +0 -1
  63. package/es/ProForm/components/base/InputNumber/index.js +118 -172
  64. package/es/ProForm/components/base/Radio/index.js +39 -52
  65. package/es/ProForm/components/base/RangePicker/index.js +109 -127
  66. package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
  67. package/es/ProForm/components/base/Select/index.js +63 -89
  68. package/es/ProForm/components/base/Switch/index.js +27 -35
  69. package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
  70. package/es/ProForm/components/base/TextArea/index.js +30 -41
  71. package/es/ProForm/components/base/TimePicker/index.js +27 -37
  72. package/es/ProForm/components/combination/Container/index.js +37 -47
  73. package/es/ProForm/components/combination/Container/propsType.js +0 -1
  74. package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
  75. package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -103
  76. package/es/ProForm/components/combination/FormList/components/Empty.js +27 -54
  77. package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
  78. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
  79. package/es/ProForm/components/combination/FormList/index.js +151 -161
  80. package/es/ProForm/components/combination/FormList/propsType.js +0 -1
  81. package/es/ProForm/components/combination/FormList/utils.js +22 -38
  82. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
  83. package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
  84. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +105 -206
  85. package/es/ProForm/components/combination/Group/hooks/index.js +68 -128
  86. package/es/ProForm/components/combination/Group/index.js +87 -126
  87. package/es/ProForm/components/combination/Group/propsType.js +0 -1
  88. package/es/ProForm/components/combination/Group/utils/index.js +124 -239
  89. package/es/ProForm/components/combination/ProCascader/index.js +156 -199
  90. package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
  91. package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
  92. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +63 -75
  93. package/es/ProForm/components/combination/ProModalSelect/index.js +290 -348
  94. package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
  95. package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
  96. package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
  97. package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
  98. package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
  99. package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
  100. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
  101. package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
  102. package/es/ProForm/components/index.js +56 -34
  103. package/es/ProForm/components/render/ChangedWrapper.js +85 -94
  104. package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
  105. package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
  106. package/es/ProForm/components/render/Render.js +223 -329
  107. package/es/ProForm/components/render/RenderFields.js +76 -113
  108. package/es/ProForm/components/render/propsType.js +0 -1
  109. package/es/ProForm/hooks/useControlled.js +8 -10
  110. package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
  111. package/es/ProForm/hooks/useFieldProps.js +8 -4
  112. package/es/ProForm/hooks/useForm.js +50 -110
  113. package/es/ProForm/hooks/useRules.js +17 -33
  114. package/es/ProForm/hooks/useShouldUpdate.js +77 -152
  115. package/es/ProForm/hooks/useWatch.js +58 -129
  116. package/es/ProForm/index.js +157 -194
  117. package/es/ProForm/propsType.js +15 -7
  118. package/es/ProForm/utils/buildFormItemProps.js +51 -58
  119. package/es/ProForm/utils/diffOriginal.js +43 -73
  120. package/es/ProForm/utils/getDefaultProps.js +18 -24
  121. package/es/ProForm/utils/index.js +159 -234
  122. package/es/ProForm/utils/processDependencies.js +21 -60
  123. package/es/ProForm/utils/reactiveValues.js +20 -34
  124. package/es/ProForm/utils/rulesCreator.js +42 -40
  125. package/es/ProForm/utils/transformNames.js +10 -13
  126. package/es/ProForm/utils/transformValue.js +16 -29
  127. package/es/ProForm/utils/valueType.js +96 -178
  128. package/es/ProIcon/config/index.js +340 -274
  129. package/es/ProIcon/index.js +135 -209
  130. package/es/ProIcon/propsTypes.js +0 -1
  131. package/es/ProIcon/utils/index.js +24 -39
  132. package/es/ProLayout/components/Layout/Header/index.js +108 -141
  133. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
  134. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +111 -137
  135. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
  136. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
  137. package/es/ProLayout/components/Layout/Menu/index.js +92 -89
  138. package/es/ProLayout/components/Layout/Notice/index.js +13 -27
  139. package/es/ProLayout/components/Layout/index.js +8 -3
  140. package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
  141. package/es/ProLayout/components/ProCollapse/index.js +89 -111
  142. package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
  143. package/es/ProLayout/components/ProFooter/index.js +27 -25
  144. package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
  145. package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
  146. package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -86
  147. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
  148. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
  149. package/es/ProLayout/components/ProHeader/components/index.js +6 -2
  150. package/es/ProLayout/components/ProHeader/index.js +216 -356
  151. package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
  152. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
  153. package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -64
  154. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
  155. package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
  156. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
  157. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
  158. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
  159. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
  160. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +290 -408
  161. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +132 -95
  162. package/es/ProLayout/components/TabsManager/index.js +406 -390
  163. package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
  164. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +26 -23
  165. package/es/ProLayout/components/TabsManager/utils/index.js +127 -184
  166. package/es/ProLayout/components/index.js +8 -3
  167. package/es/ProLayout/index.js +171 -229
  168. package/es/ProLayout/propTypes.js +12 -52
  169. package/es/ProLayout/utils/index.js +48 -128
  170. package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
  171. package/es/ProSelect/index.js +184 -229
  172. package/es/ProSelect/propsType.js +0 -1
  173. package/es/ProSelect/utils/index.js +100 -146
  174. package/es/ProStep/components/Anchor/index.js +71 -82
  175. package/es/ProStep/components/Item/index.js +49 -56
  176. package/es/ProStep/components/LazyLoad/index.js +23 -29
  177. package/es/ProStep/components/Listener/index.js +20 -33
  178. package/es/ProStep/components/Step/index.js +31 -38
  179. package/es/ProStep/constants.js +4 -1
  180. package/es/ProStep/index.js +166 -153
  181. package/es/ProStep/propsType.js +0 -1
  182. package/es/ProStep/utils/index.js +29 -55
  183. package/es/ProStepTab/index.js +83 -138
  184. package/es/ProStepTab/propsType.js +0 -1
  185. package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
  186. package/es/ProTable/components/EditableCell/index.js +37 -71
  187. package/es/ProTable/components/EditableCell/propsType.js +0 -1
  188. package/es/ProTable/components/FormatColumn/index.js +209 -340
  189. package/es/ProTable/components/FormatColumn/propsType.js +0 -1
  190. package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
  191. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
  192. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
  193. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
  194. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
  195. package/es/ProTable/components/RcTable/index.js +6 -4
  196. package/es/ProTable/components/RenderColumn/index.js +158 -186
  197. package/es/ProTable/components/RenderEmptyText/index.js +12 -21
  198. package/es/ProTable/components/RenderFooter/index.js +15 -15
  199. package/es/ProTable/components/RenderSummary/index.js +33 -50
  200. package/es/ProTable/components/RenderTableHeader/index.js +44 -46
  201. package/es/ProTable/components/RenderTabs/index.js +47 -51
  202. package/es/ProTable/components/TableResizable/index.js +56 -72
  203. package/es/ProTable/components/TooltipTitle/index.js +13 -21
  204. package/es/ProTable/components/index.js +16 -36
  205. package/es/ProTable/hooks/useAntdTable.js +185 -219
  206. package/es/ProTable/index.js +232 -249
  207. package/es/ProTable/propsType.js +0 -1
  208. package/es/ProTable/utils/columnStorage.js +63 -88
  209. package/es/ProTable/utils/index.js +57 -90
  210. package/es/ProTabs/components/Card/index.js +20 -48
  211. package/es/ProTabs/components/index.js +4 -1
  212. package/es/ProTabs/index.js +39 -56
  213. package/es/ProTabs/propType.js +0 -1
  214. package/es/ProThemeTools/component/ProTools/index.js +106 -158
  215. package/es/ProThemeTools/component/index.js +4 -1
  216. package/es/ProThemeTools/context/ThemeContext.js +67 -146
  217. package/es/ProThemeTools/index.js +103 -156
  218. package/es/ProThemeTools/propsType.js +0 -1
  219. package/es/ProThemeTools/utils/index.js +60 -109
  220. package/es/ProTooltip/index.js +132 -165
  221. package/es/ProTooltip/propsType.js +0 -1
  222. package/es/ProTree/components/AdaptiveTooltip.js +15 -17
  223. package/es/ProTree/components/CloseIcon.js +18 -26
  224. package/es/ProTree/components/List.js +28 -47
  225. package/es/ProTree/components/ProTree.js +152 -211
  226. package/es/ProTree/components/ProTreeSelect/index.js +254 -458
  227. package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
  228. package/es/ProTree/components/SearchTitle.js +23 -42
  229. package/es/ProTree/components/Tree.js +147 -195
  230. package/es/ProTree/components/index.js +10 -5
  231. package/es/ProTree/index.js +12 -16
  232. package/es/ProTree/propsType.js +0 -1
  233. package/es/ProTree/utils.js +46 -118
  234. package/es/ProTreeModal/components/Cascader.js +56 -64
  235. package/es/ProTreeModal/components/CloseIcon.js +18 -26
  236. package/es/ProTreeModal/components/List.js +114 -180
  237. package/es/ProTreeModal/components/SearchTitle.js +15 -18
  238. package/es/ProTreeModal/components/SortableItem.js +29 -58
  239. package/es/ProTreeModal/components/Tree.js +99 -113
  240. package/es/ProTreeModal/components/Trigger.js +87 -121
  241. package/es/ProTreeModal/components/index.js +14 -6
  242. package/es/ProTreeModal/index.js +397 -435
  243. package/es/ProTreeModal/propsType.js +0 -1
  244. package/es/ProTreeModal/utils.js +52 -95
  245. package/es/ProUpload/components/ButtonRender.js +44 -54
  246. package/es/ProUpload/components/DragRender.js +94 -134
  247. package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
  248. package/es/ProUpload/components/Example.js +27 -31
  249. package/es/ProUpload/components/FileItem.js +69 -163
  250. package/es/ProUpload/components/ImageRender.js +134 -170
  251. package/es/ProUpload/index.js +68 -100
  252. package/es/ProUpload/propsType.js +0 -1
  253. package/es/ProUpload/uitls.js +8 -4
  254. package/es/ProUtils/utils/index.js +17 -13
  255. package/es/ProViewer/index.js +154 -175
  256. package/es/ProViewer/propsType.js +0 -5
  257. package/es/ProWaterMark/index.js +9 -16
  258. package/es/ProWaterMark/propsType.js +0 -1
  259. package/es/hooks/useDraggableRow.js +25 -53
  260. package/es/index.js +57 -77
  261. package/es/locale/en_US.js +153 -142
  262. package/es/locale/index.js +23 -36
  263. package/es/locale/zh_CN.js +145 -142
  264. package/es/tokens.js +84 -83
  265. package/es/utils/index.js +24 -51
  266. package/package.json +4 -3
@@ -1 +0,0 @@
1
- export {};
@@ -1,44 +1,26 @@
1
- /* eslint-disable no-restricted-syntax */
2
- import { CASCADER } from '.';
3
- /**
4
- * 树转成铺平的数组
5
- * @param originalTreeData
6
- * @returns
7
- */
8
- export function getFlatTreeData(originalTreeData, fieldNames, modeType = '') {
1
+ import { CASCADER } from ".";
2
+ function getFlatTreeData(originalTreeData, fieldNames, modeType = "") {
9
3
  const dataList = [];
10
4
  const isCASCADER = modeType === CASCADER;
11
- function loop(data, parTitle = '') {
12
- data.forEach(item => {
13
- const node = {
14
- ...item
15
- };
5
+ function loop(data, parTitle = "") {
6
+ data.forEach((item) => {
7
+ const node = { ...item };
16
8
  delete node[fieldNames.children];
17
- const title = isCASCADER ? `${parTitle ? `${parTitle}-` : ''}${node[fieldNames.label]}` : node[fieldNames.label];
18
- dataList.push({
19
- ...node,
20
- title
21
- });
9
+ const title = isCASCADER ? `${parTitle ? `${parTitle}-` : ""}${node[fieldNames.label]}` : node[fieldNames.label];
10
+ dataList.push({ ...node, title });
22
11
  if (item[fieldNames.children]) {
23
12
  loop(item[fieldNames.children], title);
24
13
  }
25
14
  });
26
15
  }
27
- loop(originalTreeData, '');
16
+ loop(originalTreeData, "");
28
17
  return dataList;
29
18
  }
30
-
31
- /**
32
- * 获取 tree 所有的 keys 集合
33
- * @param data
34
- * @param fieldNames
35
- * @returns
36
- */
37
- export function getAllKeys(data, fieldNames) {
19
+ function getAllKeys(data, fieldNames) {
38
20
  const keys = [];
39
- function loop(data) {
40
- for (let i = 0; i < data.length; i++) {
41
- const node = data[i];
21
+ function loop(data2) {
22
+ for (let i = 0; i < data2.length; i++) {
23
+ const node = data2[i];
42
24
  keys.push(node[fieldNames.value]);
43
25
  if (node[fieldNames.children]) {
44
26
  loop(node[fieldNames.children]);
@@ -48,20 +30,12 @@ export function getAllKeys(data, fieldNames) {
48
30
  loop(data);
49
31
  return keys;
50
32
  }
51
-
52
- /**
53
- * 获取展开的key
54
- * @param key
55
- * @param tree
56
- * @param fieldNames
57
- * @returns
58
- */
59
- export const getParentKey = (key, tree, fieldNames) => {
33
+ const getParentKey = (key, tree, fieldNames) => {
60
34
  let parentKey;
61
35
  for (let i = 0; i < tree.length; i++) {
62
36
  const node = tree[i];
63
37
  if (node[fieldNames.children]) {
64
- if (node[fieldNames.children].some(item => item[fieldNames.value] === key)) {
38
+ if (node[fieldNames.children].some((item) => item[fieldNames.value] === key)) {
65
39
  parentKey = node[fieldNames.value];
66
40
  } else if (getParentKey(key, node[fieldNames.children], fieldNames)) {
67
41
  parentKey = getParentKey(key, node[fieldNames.children], fieldNames);
@@ -70,7 +44,7 @@ export const getParentKey = (key, tree, fieldNames) => {
70
44
  }
71
45
  return parentKey;
72
46
  };
73
- export function findTreeNodeByKey(treeData, key, fieldNames) {
47
+ function findTreeNodeByKey(treeData, key, fieldNames) {
74
48
  const result = [];
75
49
  const traverse = (node, parents) => {
76
50
  if (node[fieldNames.value] === key) {
@@ -90,43 +64,26 @@ export function findTreeNodeByKey(treeData, key, fieldNames) {
90
64
  }
91
65
  return result;
92
66
  }
93
-
94
- /**
95
- * 根据所选的 checkedKeys 筛选出展示的 treeData
96
- * @param data
97
- * @param checkedKeys
98
- * @returns
99
- */
100
- export function filterCheckedNodes(data, checkedKeys, searchStr = '', fieldNames) {
67
+ function filterCheckedNodes(data, checkedKeys, searchStr = "", fieldNames) {
101
68
  const result = [];
102
- const traverse = node => {
69
+ const traverse = (node) => {
70
+ var _a, _b, _c;
103
71
  const title = node[fieldNames.value] + node[fieldNames.label];
104
72
  if (!searchStr) {
105
73
  if (checkedKeys.includes(node[fieldNames.value])) {
106
- const children = node?.[fieldNames.children]?.map(traverse).filter(Boolean) || [];
107
- return {
108
- ...node,
109
- [fieldNames.children]: children
110
- };
74
+ const children2 = ((_a = node == null ? void 0 : node[fieldNames.children]) == null ? void 0 : _a.map(traverse).filter(Boolean)) || [];
75
+ return { ...node, [fieldNames.children]: children2 };
111
76
  }
112
77
  } else if (title.indexOf(searchStr) > -1) {
113
- const children = node[fieldNames.children]?.map(traverse).filter(Boolean) || [];
114
- return {
115
- ...node,
116
- children
117
- };
78
+ const children2 = ((_b = node[fieldNames.children]) == null ? void 0 : _b.map(traverse).filter(Boolean)) || [];
79
+ return { ...node, children: children2 };
118
80
  }
119
- const children = node[fieldNames.children]?.map(traverse).filter(Boolean);
81
+ const children = (_c = node[fieldNames.children]) == null ? void 0 : _c.map(traverse).filter(Boolean);
120
82
  if (children && children.length > 0) {
121
- return {
122
- ...node,
123
- [fieldNames.children]: children
124
- };
83
+ return { ...node, [fieldNames.children]: children };
125
84
  }
126
85
  return null;
127
86
  };
128
-
129
- // eslint-disable-next-line no-restricted-syntax
130
87
  for (const node of data) {
131
88
  const filtered = traverse(node);
132
89
  if (filtered) {
@@ -135,25 +92,17 @@ export function filterCheckedNodes(data, checkedKeys, searchStr = '', fieldNames
135
92
  }
136
93
  return result;
137
94
  }
138
-
139
- /**
140
- * 获取 tree 当前选中节点下的所有子节点的 keys
141
- * @param node
142
- * @param childrenKeys
143
- * @returns
144
- */
145
- export function getChildrenKeys(node, childrenKeys, fieldNames, type) {
146
- // 当为 tree 触发 onChck 此时就是 key 为 children
147
- if (type === 'treeCheck') {
148
- node?.children?.forEach(item => {
95
+ function getChildrenKeys(node, childrenKeys, fieldNames, type) {
96
+ var _a, _b;
97
+ if (type === "treeCheck") {
98
+ (_a = node == null ? void 0 : node.children) == null ? void 0 : _a.forEach((item) => {
149
99
  childrenKeys.push(item.key);
150
100
  if (item.children && item.children.length > 0) {
151
101
  getChildrenKeys(item, childrenKeys, fieldNames, type);
152
102
  }
153
103
  });
154
104
  } else {
155
- // 这个时候的值为我们的值
156
- node?.[fieldNames.children]?.forEach(item => {
105
+ (_b = node == null ? void 0 : node[fieldNames.children]) == null ? void 0 : _b.forEach((item) => {
157
106
  childrenKeys.push(item[fieldNames.value]);
158
107
  if (item[fieldNames.children] && item[fieldNames.children].length > 0) {
159
108
  getChildrenKeys(item, childrenKeys, fieldNames, type);
@@ -161,30 +110,38 @@ export function getChildrenKeys(node, childrenKeys, fieldNames, type) {
161
110
  });
162
111
  }
163
112
  }
164
-
165
- // 提示信息替换
166
- export const transformMessage = (obj, message) => {
113
+ const transformMessage = (obj, message) => {
167
114
  const keys = Object.keys(obj);
168
115
  let _message = message;
169
- keys.forEach(key => {
116
+ keys.forEach((key) => {
170
117
  _message = message.replaceAll(`{${key}}`, obj[key]);
171
118
  });
172
119
  return _message;
173
120
  };
174
- export const addLevelAndParentId = (tree = [], fieldNames, currentLevel = 0, currentParentId = null) => {
175
- const {
176
- children = 'children',
177
- value = 'value'
178
- } = fieldNames;
179
- return tree.map(node => {
180
- const newNode = {
181
- ...node
182
- };
121
+ const addLevelAndParentId = (tree = [], fieldNames, currentLevel = 0, currentParentId = null) => {
122
+ const { children = "children", value = "value" } = fieldNames;
123
+ return tree.map((node) => {
124
+ const newNode = { ...node };
183
125
  newNode.level = currentLevel;
184
126
  newNode.parentId = currentParentId;
185
127
  if (node[children]) {
186
- newNode[children] = addLevelAndParentId(node[children], fieldNames, currentLevel + 1, newNode[value]);
128
+ newNode[children] = addLevelAndParentId(
129
+ node[children],
130
+ fieldNames,
131
+ currentLevel + 1,
132
+ newNode[value]
133
+ );
187
134
  }
188
135
  return newNode;
189
136
  });
190
- };
137
+ };
138
+ export {
139
+ addLevelAndParentId,
140
+ filterCheckedNodes,
141
+ findTreeNodeByKey,
142
+ getAllKeys,
143
+ getChildrenKeys,
144
+ getFlatTreeData,
145
+ getParentKey,
146
+ transformMessage
147
+ };
@@ -1,13 +1,13 @@
1
- import { Button, Upload } from 'antd';
2
- import { DndContext } from '@dnd-kit/core';
3
- import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
4
- import { CloudUploadOutlined } from '@ant-design/icons';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Upload } from "antd";
3
+ import { DndContext } from "@dnd-kit/core";
4
+ import { SortableContext, rectSortingStrategy } from "@dnd-kit/sortable";
5
+ import { CloudUploadOutlined } from "@ant-design/icons";
5
6
  import { FileItem } from "./FileItem";
6
7
  import { DraggableUploadListItem } from "./DraggableUploadListItem";
7
8
  import locale from "../../locale";
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- /* 按钮类型 */
10
- const ButtonRender = props => {
9
+ const ButtonRender = (props) => {
10
+ var _a, _b;
11
11
  const {
12
12
  isView,
13
13
  disabled,
@@ -20,61 +20,51 @@ const ButtonRender = props => {
20
20
  buttonProps,
21
21
  extraTipText,
22
22
  afterRender,
23
- buttonText = locale?.ProUpload?.buttonText,
23
+ buttonText = (_b = (_a = locale) == null ? void 0 : _a.ProUpload) == null ? void 0 : _b.buttonText,
24
24
  isConfirmDelete,
25
25
  onRemove
26
26
  } = props;
27
-
28
- // 按钮类型的props
29
27
  const buttonUploadProps = {
30
28
  ...baseUploadProps,
31
29
  fileList,
32
- itemRender: (originNode, file, fileList, actions) => {
33
- return /*#__PURE__*/_jsx(DraggableUploadListItem, {
34
- file: file,
35
- children: /*#__PURE__*/_jsx(FileItem, {
30
+ itemRender: (originNode, file, fileList2, actions) => {
31
+ return /* @__PURE__ */ jsx(DraggableUploadListItem, { file, children: /* @__PURE__ */ jsx(
32
+ FileItem,
33
+ {
36
34
  disabled: disabled || isView,
37
- file: file,
38
- isConfirmDelete: isConfirmDelete,
39
- onPreview: onPreview,
40
- onRemove: async file => {
41
- const res = await onRemove?.(file);
42
- if (res === false) return;
43
- actions.remove(file);
35
+ file,
36
+ isConfirmDelete,
37
+ onPreview,
38
+ onRemove: async (file2) => {
39
+ const res = await (onRemove == null ? void 0 : onRemove(file2));
40
+ if (res === false)
41
+ return;
42
+ actions.remove(file2);
44
43
  },
45
- onDownload: onDownload
46
- })
47
- });
44
+ onDownload
45
+ }
46
+ ) });
48
47
  }
49
48
  };
50
- return /*#__PURE__*/_jsxs("div", {
51
- className: "pro-upload-button",
52
- children: [/*#__PURE__*/_jsx(DndContext, {
53
- sensors: [sensor],
54
- onDragEnd: onDragEnd,
55
- children: /*#__PURE__*/_jsx(SortableContext, {
56
- items: fileList.map(i => i.uid),
57
- strategy: rectSortingStrategy,
58
- children: /*#__PURE__*/_jsx(Upload, {
59
- ...buttonUploadProps,
60
- children: !isView && /*#__PURE__*/_jsxs("div", {
61
- className: "pro-upload-button-inner",
62
- children: [/*#__PURE__*/_jsxs(Button, {
63
- ...buttonProps,
64
- disabled: disabled || isView,
65
- children: [/*#__PURE__*/_jsx(CloudUploadOutlined, {}), buttonText]
66
- }), afterRender ? /*#__PURE__*/_jsx("div", {
67
- className: "pro-upload-button-inner-right",
68
- onClick: e => e.stopPropagation(),
69
- children: afterRender
70
- }) : null]
71
- })
72
- })
73
- })
74
- }), extraTipText && /*#__PURE__*/_jsx("div", {
75
- className: "upload-tip-txt",
76
- children: typeof extraTipText === 'function' ? extraTipText() : extraTipText
77
- })]
78
- });
49
+ return /* @__PURE__ */ jsxs("div", { className: "pro-upload-button", children: [
50
+ /* @__PURE__ */ jsx(DndContext, { sensors: [sensor], onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: fileList.map((i) => i.uid), strategy: rectSortingStrategy, children: /* @__PURE__ */ jsx(Upload, { ...buttonUploadProps, children: !isView && /* @__PURE__ */ jsxs("div", { className: "pro-upload-button-inner", children: [
51
+ /* @__PURE__ */ jsxs(Button, { ...buttonProps, disabled: disabled || isView, children: [
52
+ /* @__PURE__ */ jsx(CloudUploadOutlined, {}),
53
+ buttonText
54
+ ] }),
55
+ afterRender ? /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ className: "pro-upload-button-inner-right",
59
+ onClick: (e) => e.stopPropagation(),
60
+ children: afterRender
61
+ }
62
+ ) : null
63
+ ] }) }) }) }),
64
+ extraTipText && /* @__PURE__ */ jsx("div", { className: "upload-tip-txt", children: typeof extraTipText === "function" ? extraTipText() : extraTipText })
65
+ ] });
66
+ };
67
+ var ButtonRender_default = ButtonRender;
68
+ export {
69
+ ButtonRender_default as default
79
70
  };
80
- export default ButtonRender;
@@ -1,16 +1,15 @@
1
- import { useRef } from 'react';
2
- import { Upload } from 'antd';
3
- import { DndContext } from '@dnd-kit/core';
4
- import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
5
- import { CloudUploadOutlined } from '@ant-design/icons';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { Upload } from "antd";
4
+ import { DndContext } from "@dnd-kit/core";
5
+ import { SortableContext, rectSortingStrategy } from "@dnd-kit/sortable";
6
+ import { CloudUploadOutlined } from "@ant-design/icons";
6
7
  import { DragSingleFileItem, FileItem, getFileExt, getFileIcon } from "./FileItem";
7
8
  import { DraggableUploadListItem } from "./DraggableUploadListItem";
8
9
  import locale from "../../locale";
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- const {
11
- Dragger
12
- } = Upload;
13
- const DragRender = props => {
10
+ const { Dragger } = Upload;
11
+ const DragRender = (props) => {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h;
14
13
  const {
15
14
  isView,
16
15
  baseUploadProps,
@@ -29,74 +28,58 @@ const DragRender = props => {
29
28
  customTextRender
30
29
  } = props;
31
30
  const refReSelect = useRef(null);
32
-
33
- // if (isView) return <>-</>;
34
-
35
- // 拖拽模式下单个文件可用
36
31
  const showDraggerSingleRender = maxCount === 1 && fileList[0];
37
-
38
- /**
39
- * @description: 文件删除
40
- * @param {UploadFile} file
41
- * @return {*}
42
- */
43
- const handleDelFile = file => {
44
- if (disabled) return;
45
- const _List = fileList.filter(i => i.uid !== file.uid);
32
+ const handleDelFile = (file) => {
33
+ if (disabled)
34
+ return;
35
+ const _List = fileList.filter((i) => i.uid !== file.uid);
46
36
  setFileList(_List);
47
37
  onChange && onChange(_List);
48
38
  };
49
-
50
- /**
51
- * @description: 重新选择 拖拽模式下单个文件可用
52
- * @param {UploadFile} file
53
- * @return {*}
54
- */
55
- const handleReSelect = file => {
39
+ const handleReSelect = (file) => {
56
40
  handleDelFile(file);
57
41
  setTimeout(() => {
58
42
  refReSelect.current.click();
59
43
  }, 1);
60
44
  };
61
-
62
- /**
63
- * @description: 单个拖拽上传界面
64
- * @param {UploadFile} file
65
- * @return {*}
66
- */
67
- const draggerSingleRender = file => {
45
+ const draggerSingleRender = (file) => {
46
+ var _a2, _b2, _c2, _d2;
68
47
  const _fileExt = getFileExt(file.name);
69
48
  const _fileIcon = getFileIcon(_fileExt);
70
- return /*#__PURE__*/_jsxs("div", {
71
- className: "dragger-single-file",
72
- children: [/*#__PURE__*/_jsx("div", {
73
- className: "file-type-icon",
74
- children: /*#__PURE__*/_jsx("img", {
75
- src: _fileIcon,
76
- alt: ""
77
- })
78
- }), /*#__PURE__*/_jsx(DragSingleFileItem, {
79
- file: file,
80
- disabled: disabled,
81
- onDownload: onDownload,
82
- onPreview: onPreview
83
- }), file.status !== 'uploading' && /*#__PURE__*/_jsxs("div", {
84
- className: "file-action-box",
85
- children: [!isView && !disabled && /*#__PURE__*/_jsx("div", {
86
- className: "file-name",
87
- onClick: () => {
88
- handleReSelect(file);
89
- },
90
- children: locale?.ProUpload?.draggerSelect
91
- }), !isView && !disabled && /*#__PURE__*/_jsx("div", {
92
- className: "file-del",
93
- onClick: () => {
94
- handleDelFile(file);
95
- },
96
- children: locale?.ProUpload?.draggerDelete
97
- })]
98
- })]
99
- });
49
+ return /* @__PURE__ */ jsxs("div", { className: "dragger-single-file", children: [
50
+ /* @__PURE__ */ jsx("div", { className: "file-type-icon", children: /* @__PURE__ */ jsx("img", { src: _fileIcon, alt: "" }) }),
51
+ /* @__PURE__ */ jsx(
52
+ DragSingleFileItem,
53
+ {
54
+ file,
55
+ disabled,
56
+ onDownload,
57
+ onPreview
58
+ }
59
+ ),
60
+ file.status !== "uploading" && /* @__PURE__ */ jsxs("div", { className: "file-action-box", children: [
61
+ !isView && !disabled && /* @__PURE__ */ jsx(
62
+ "div",
63
+ {
64
+ className: "file-name",
65
+ onClick: () => {
66
+ handleReSelect(file);
67
+ },
68
+ children: (_b2 = (_a2 = locale) == null ? void 0 : _a2.ProUpload) == null ? void 0 : _b2.draggerSelect
69
+ }
70
+ ),
71
+ !isView && !disabled && /* @__PURE__ */ jsx(
72
+ "div",
73
+ {
74
+ className: "file-del",
75
+ onClick: () => {
76
+ handleDelFile(file);
77
+ },
78
+ children: (_d2 = (_c2 = locale) == null ? void 0 : _c2.ProUpload) == null ? void 0 : _d2.draggerDelete
79
+ }
80
+ )
81
+ ] })
82
+ ] });
100
83
  };
101
84
  const dragUploadProps = {
102
85
  ...baseUploadProps,
@@ -105,71 +88,48 @@ const DragRender = props => {
105
88
  disabled,
106
89
  openFileDialogOnClick: !showDraggerSingleRender
107
90
  };
108
- return /*#__PURE__*/_jsxs("div", {
109
- className: "pro-upload-dragger",
110
- children: [/*#__PURE__*/_jsxs("div", {
111
- className: "pro-upload-handle-box",
112
- children: [/*#__PURE__*/_jsx("div", {
113
- className: "pro-upload-dragger-header",
114
- children: headerRender()
115
- }), /*#__PURE__*/_jsx(Dragger, {
116
- ...dragUploadProps,
117
- children: /*#__PURE__*/_jsxs("div", {
118
- className: "drag-upload-inner",
119
- ref: refReSelect,
120
- children: [!showDraggerSingleRender && /*#__PURE__*/_jsxs("div", {
121
- className: "upload-dragger-control",
122
- children: [/*#__PURE__*/_jsxs("div", {
123
- className: "dragger-txt-line1",
124
- children: [/*#__PURE__*/_jsx("i", {
125
- className: "icon-upload",
126
- children: /*#__PURE__*/_jsx(CloudUploadOutlined, {})
127
- }), /*#__PURE__*/_jsxs("p", {
128
- className: "dragger-txt",
129
- children: [locale?.ProUpload?.draggerTips, /*#__PURE__*/_jsxs("span", {
130
- className: "click-txt",
131
- children: [locale?.ProUpload?.draggerBtnTxt, " "]
132
- })]
133
- })]
134
- }), /*#__PURE__*/_jsxs("p", {
135
- className: "file-ext",
136
- children: [locale?.ProUpload?.draggerFileExt, "\uFF1A", extExt.length > 0 ? extExt.join('、') : `${locale?.ProUpload?.draggerLimitless}`]
137
- }), customTextRender && /*#__PURE__*/_jsx("p", {
138
- className: "file-ext",
139
- children: customTextRender
140
- })]
141
- }), /*#__PURE__*/_jsx("div", {
142
- className: "dragger-file-show",
143
- children: showDraggerSingleRender && draggerSingleRender(fileList[0])
144
- })]
145
- })
146
- }), /*#__PURE__*/_jsx("div", {
147
- className: "pro-upload-dragger-footer",
148
- children: footerRender()
149
- })]
150
- }), /*#__PURE__*/_jsx("div", {
151
- className: "pro-upload-file-list",
152
- children: /*#__PURE__*/_jsx(DndContext, {
153
- sensors: [sensor],
154
- onDragEnd: onDragEnd,
155
- children: /*#__PURE__*/_jsx(SortableContext, {
156
- items: fileList.map(i => i.uid),
157
- strategy: rectSortingStrategy,
158
- children: maxCount > 1 && fileList.map(file => {
159
- return /*#__PURE__*/_jsx(DraggableUploadListItem, {
160
- file: file,
161
- children: /*#__PURE__*/_jsx(FileItem, {
162
- file: file,
163
- disabled: disabled || isView,
164
- onPreview: onPreview,
165
- onRemove: handleDelFile,
166
- onDownload: onDownload
167
- }, file.uid)
168
- });
169
- })
170
- })
171
- })
172
- })]
173
- });
91
+ return /* @__PURE__ */ jsxs("div", { className: "pro-upload-dragger", children: [
92
+ /* @__PURE__ */ jsxs("div", { className: "pro-upload-handle-box", children: [
93
+ /* @__PURE__ */ jsx("div", { className: "pro-upload-dragger-header", children: headerRender() }),
94
+ /* @__PURE__ */ jsx(Dragger, { ...dragUploadProps, children: /* @__PURE__ */ jsxs("div", { className: "drag-upload-inner", ref: refReSelect, children: [
95
+ !showDraggerSingleRender && /* @__PURE__ */ jsxs("div", { className: "upload-dragger-control", children: [
96
+ /* @__PURE__ */ jsxs("div", { className: "dragger-txt-line1", children: [
97
+ /* @__PURE__ */ jsx("i", { className: "icon-upload", children: /* @__PURE__ */ jsx(CloudUploadOutlined, {}) }),
98
+ /* @__PURE__ */ jsxs("p", { className: "dragger-txt", children: [
99
+ (_b = (_a = locale) == null ? void 0 : _a.ProUpload) == null ? void 0 : _b.draggerTips,
100
+ /* @__PURE__ */ jsxs("span", { className: "click-txt", children: [
101
+ (_d = (_c = locale) == null ? void 0 : _c.ProUpload) == null ? void 0 : _d.draggerBtnTxt,
102
+ " "
103
+ ] })
104
+ ] })
105
+ ] }),
106
+ /* @__PURE__ */ jsxs("p", { className: "file-ext", children: [
107
+ (_f = (_e = locale) == null ? void 0 : _e.ProUpload) == null ? void 0 : _f.draggerFileExt,
108
+ ":",
109
+ extExt.length > 0 ? extExt.join("、") : `${(_h = (_g = locale) == null ? void 0 : _g.ProUpload) == null ? void 0 : _h.draggerLimitless}`
110
+ ] }),
111
+ customTextRender && /* @__PURE__ */ jsx("p", { className: "file-ext", children: customTextRender })
112
+ ] }),
113
+ /* @__PURE__ */ jsx("div", { className: "dragger-file-show", children: showDraggerSingleRender && draggerSingleRender(fileList[0]) })
114
+ ] }) }),
115
+ /* @__PURE__ */ jsx("div", { className: "pro-upload-dragger-footer", children: footerRender() })
116
+ ] }),
117
+ /* @__PURE__ */ jsx("div", { className: "pro-upload-file-list", children: /* @__PURE__ */ jsx(DndContext, { sensors: [sensor], onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: fileList.map((i) => i.uid), strategy: rectSortingStrategy, children: maxCount > 1 && fileList.map((file) => {
118
+ return /* @__PURE__ */ jsx(DraggableUploadListItem, { file, children: /* @__PURE__ */ jsx(
119
+ FileItem,
120
+ {
121
+ file,
122
+ disabled: disabled || isView,
123
+ onPreview,
124
+ onRemove: handleDelFile,
125
+ onDownload
126
+ },
127
+ file.uid
128
+ ) });
129
+ }) }) }) })
130
+ ] });
131
+ };
132
+ var DragRender_default = DragRender;
133
+ export {
134
+ DragRender_default as default
174
135
  };
175
- export default DragRender;
@@ -1,32 +1,19 @@
1
- import React from 'react';
2
- import { CSS } from '@dnd-kit/utilities';
3
- import { useSortable } from '@dnd-kit/sortable';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- export const DraggableUploadListItem = ({
6
- file,
7
- children
8
- }) => {
9
- const {
10
- attributes,
11
- listeners,
12
- setNodeRef,
13
- transform,
14
- transition
15
- } = useSortable({
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { CSS } from "@dnd-kit/utilities";
3
+ import { useSortable } from "@dnd-kit/sortable";
4
+ const DraggableUploadListItem = ({ file, children }) => {
5
+ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
16
6
  id: file.uid
17
7
  });
18
8
  const style = {
19
9
  transform: CSS.Transform.toString(transform),
20
10
  transition,
21
- cursor: 'move',
11
+ cursor: "move",
22
12
  zIndex: 10,
23
- position: 'relative'
13
+ position: "relative"
24
14
  };
25
- return /*#__PURE__*/_jsx("div", {
26
- ref: setNodeRef,
27
- style: style,
28
- ...attributes,
29
- ...listeners,
30
- children: children
31
- });
32
- };
15
+ return /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children });
16
+ };
17
+ export {
18
+ DraggableUploadListItem
19
+ };