@zat-design/sisyphus-react 4.5.1 → 4.5.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 (276) hide show
  1. package/es/ProEditTable/components/Summary/index.js +3 -2
  2. package/es/ProEditTable/utils/tools.js +1 -1
  3. package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
  4. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -3
  5. package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
  6. package/es/ProForm/components/render/RenderFields.js +3 -1
  7. package/es/ProForm/hooks/useWatch.js +8 -10
  8. package/es/ProLayout/components/ProHeader/index.js +28 -15
  9. package/es/ProSelect/index.js +74 -187
  10. package/es/ProSelect/utils/index.js +174 -0
  11. package/es/ProTree/components/ProTreeSelect/index.js +17 -3
  12. package/es/ProUpload/components/DragRender.js +2 -1
  13. package/es/ProUpload/index.js +1 -1
  14. package/package.json +1 -1
  15. package/es/FormsProvider/index.d.ts +0 -18
  16. package/es/ProAction/components/CheckModalContent/index.d.ts +0 -8
  17. package/es/ProAction/index.d.ts +0 -7
  18. package/es/ProAction/propsType.d.ts +0 -45
  19. package/es/ProConfigProvider/index.d.ts +0 -9
  20. package/es/ProConfigProvider/propsType.d.ts +0 -78
  21. package/es/ProDownload/index.d.ts +0 -6
  22. package/es/ProDownload/propsType.d.ts +0 -71
  23. package/es/ProDownload/utils.d.ts +0 -60
  24. package/es/ProDrawerForm/components/ProDrawer/index.d.ts +0 -7
  25. package/es/ProDrawerForm/components/ProModal/index.d.ts +0 -7
  26. package/es/ProDrawerForm/components/index.d.ts +0 -2
  27. package/es/ProDrawerForm/hooks/useConfirmClose.d.ts +0 -25
  28. package/es/ProDrawerForm/index.d.ts +0 -6
  29. package/es/ProDrawerForm/propsType.d.ts +0 -111
  30. package/es/ProDrawerForm/utils/index.d.ts +0 -25
  31. package/es/ProEditLabel/components/RenderProForm.d.ts +0 -4
  32. package/es/ProEditLabel/index.d.ts +0 -4
  33. package/es/ProEditLabel/propsType.d.ts +0 -163
  34. package/es/ProEditLabel/utils/index.d.ts +0 -7
  35. package/es/ProEditTable/components/ActionButton/index.d.ts +0 -2
  36. package/es/ProEditTable/components/RcTable/BaseTable.d.ts +0 -6
  37. package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +0 -7
  38. package/es/ProEditTable/components/RcTable/index.d.ts +0 -4
  39. package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +0 -4
  40. package/es/ProEditTable/components/RenderField/index.d.ts +0 -3
  41. package/es/ProEditTable/components/RenderField/propsType.d.ts +0 -30
  42. package/es/ProEditTable/components/RenderField/tools.d.ts +0 -22
  43. package/es/ProEditTable/components/RenderToolbar/index.d.ts +0 -2
  44. package/es/ProEditTable/components/Summary/index.d.ts +0 -12
  45. package/es/ProEditTable/components/Validator/index.d.ts +0 -19
  46. package/es/ProEditTable/components/index.d.ts +0 -5
  47. package/es/ProEditTable/index.d.ts +0 -4
  48. package/es/ProEditTable/propsType.d.ts +0 -437
  49. package/es/ProEditTable/utils/config.d.ts +0 -25
  50. package/es/ProEditTable/utils/diffOriginal.d.ts +0 -22
  51. package/es/ProEditTable/utils/getDefaultProps.d.ts +0 -1
  52. package/es/ProEditTable/utils/index.d.ts +0 -23
  53. package/es/ProEditTable/utils/tools.d.ts +0 -128
  54. package/es/ProEditTable/utils/transform.d.ts +0 -13
  55. package/es/ProEditTable/utils/useEditTableError.d.ts +0 -7
  56. package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +0 -16
  57. package/es/ProEditTable/utils/validateAll.d.ts +0 -89
  58. package/es/ProEnum/components/Group.d.ts +0 -10
  59. package/es/ProEnum/components/Tag.d.ts +0 -7
  60. package/es/ProEnum/hooks/useEnum.d.ts +0 -29
  61. package/es/ProEnum/hooks/useEnumRequest.d.ts +0 -4
  62. package/es/ProEnum/hooks/useFrequentEnumRequest.d.ts +0 -14
  63. package/es/ProEnum/index.d.ts +0 -10
  64. package/es/ProEnum/propsType.d.ts +0 -310
  65. package/es/ProEnum/utils/eventCenter.d.ts +0 -1
  66. package/es/ProEnum/utils/frequentEnum.d.ts +0 -39
  67. package/es/ProEnum/utils/getEnum.d.ts +0 -47
  68. package/es/ProEnum/utils/getEnumLabel.d.ts +0 -2
  69. package/es/ProEnum/utils/index.d.ts +0 -84
  70. package/es/ProForm/components/Container.d.ts +0 -9
  71. package/es/ProForm/components/FormFooter/index.d.ts +0 -5
  72. package/es/ProForm/components/FormFooter/propsType.d.ts +0 -22
  73. package/es/ProForm/components/base/Checkbox/index.d.ts +0 -14
  74. package/es/ProForm/components/base/DatePicker/index.d.ts +0 -11
  75. package/es/ProForm/components/base/Input/index.d.ts +0 -3
  76. package/es/ProForm/components/base/Input/propsType.d.ts +0 -21
  77. package/es/ProForm/components/base/InputNumber/index.d.ts +0 -11
  78. package/es/ProForm/components/base/Radio/index.d.ts +0 -15
  79. package/es/ProForm/components/base/RangePicker/index.d.ts +0 -19
  80. package/es/ProForm/components/base/RangePicker/useDateRange.d.ts +0 -15
  81. package/es/ProForm/components/base/Select/index.d.ts +0 -11
  82. package/es/ProForm/components/base/Switch/index.d.ts +0 -10
  83. package/es/ProForm/components/base/SwitchCheckbox/index.d.ts +0 -10
  84. package/es/ProForm/components/base/TextArea/index.d.ts +0 -11
  85. package/es/ProForm/components/base/TimePicker/index.d.ts +0 -13
  86. package/es/ProForm/components/combination/Container/index.d.ts +0 -4
  87. package/es/ProForm/components/combination/Container/propsType.d.ts +0 -13
  88. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +0 -24
  89. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +0 -23
  90. package/es/ProForm/components/combination/FormList/components/Empty.d.ts +0 -13
  91. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +0 -20
  92. package/es/ProForm/components/combination/FormList/components/ToolbarButton.d.ts +0 -12
  93. package/es/ProForm/components/combination/FormList/index.d.ts +0 -4
  94. package/es/ProForm/components/combination/FormList/propsType.d.ts +0 -69
  95. package/es/ProForm/components/combination/FormList/utils.d.ts +0 -18
  96. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +0 -9
  97. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +0 -28
  98. package/es/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +0 -10
  99. package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -34
  100. package/es/ProForm/components/combination/Group/index.d.ts +0 -9
  101. package/es/ProForm/components/combination/Group/propsType.d.ts +0 -99
  102. package/es/ProForm/components/combination/Group/utils/index.d.ts +0 -154
  103. package/es/ProForm/components/combination/ProCascader/index.d.ts +0 -4
  104. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +0 -48
  105. package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +0 -14
  106. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.d.ts +0 -33
  107. package/es/ProForm/components/combination/ProModalSelect/index.d.ts +0 -4
  108. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +0 -106
  109. package/es/ProForm/components/combination/ProModalSelect/utils/index.d.ts +0 -1
  110. package/es/ProForm/components/combination/ProModalSelect/utils/mergeSelectedRows.d.ts +0 -14
  111. package/es/ProForm/components/combination/ProNumberRange/index.d.ts +0 -4
  112. package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +0 -85
  113. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +0 -4
  114. package/es/ProForm/components/combination/ProRangeLimit/propsType.d.ts +0 -23
  115. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +0 -9
  116. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +0 -33
  117. package/es/ProForm/components/index.d.ts +0 -29
  118. package/es/ProForm/components/render/ChangedWrapper.d.ts +0 -17
  119. package/es/ProForm/components/render/ConfirmWrapper.d.ts +0 -10
  120. package/es/ProForm/components/render/CustomComponentViewWrapper.d.ts +0 -30
  121. package/es/ProForm/components/render/Render.d.ts +0 -4
  122. package/es/ProForm/components/render/RenderFields.d.ts +0 -26
  123. package/es/ProForm/components/render/propsType.d.ts +0 -279
  124. package/es/ProForm/hooks/useControlled.d.ts +0 -1
  125. package/es/ProForm/hooks/useDeepCompareMemo.d.ts +0 -2
  126. package/es/ProForm/hooks/useFieldProps.d.ts +0 -4
  127. package/es/ProForm/hooks/useForm.d.ts +0 -8
  128. package/es/ProForm/hooks/useRules.d.ts +0 -16
  129. package/es/ProForm/hooks/useShouldUpdate.d.ts +0 -31
  130. package/es/ProForm/hooks/useWatch.d.ts +0 -22
  131. package/es/ProForm/index.d.ts +0 -6
  132. package/es/ProForm/propsType.d.ts +0 -143
  133. package/es/ProForm/utils/buildFormItemProps.d.ts +0 -25
  134. package/es/ProForm/utils/diffOriginal.d.ts +0 -10
  135. package/es/ProForm/utils/getDefaultProps.d.ts +0 -1
  136. package/es/ProForm/utils/index.d.ts +0 -109
  137. package/es/ProForm/utils/processDependencies.d.ts +0 -29
  138. package/es/ProForm/utils/reactiveValues.d.ts +0 -34
  139. package/es/ProForm/utils/rulesCreator.d.ts +0 -7
  140. package/es/ProForm/utils/transformNames.d.ts +0 -10
  141. package/es/ProForm/utils/transformValue.d.ts +0 -6
  142. package/es/ProForm/utils/valueType.d.ts +0 -70
  143. package/es/ProIcon/config/index.d.ts +0 -19
  144. package/es/ProIcon/index.d.ts +0 -4
  145. package/es/ProIcon/propsTypes.d.ts +0 -175
  146. package/es/ProIcon/utils/index.d.ts +0 -6
  147. package/es/ProLayout/components/Layout/Header/index.d.ts +0 -4
  148. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.d.ts +0 -3
  149. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +0 -3
  150. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.d.ts +0 -15
  151. package/es/ProLayout/components/Layout/Menu/SideMenu/index.d.ts +0 -3
  152. package/es/ProLayout/components/Layout/Menu/index.d.ts +0 -4
  153. package/es/ProLayout/components/Layout/Notice/index.d.ts +0 -4
  154. package/es/ProLayout/components/Layout/index.d.ts +0 -3
  155. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +0 -98
  156. package/es/ProLayout/components/ProCollapse/index.d.ts +0 -3
  157. package/es/ProLayout/components/ProFooter/PropTypes.d.ts +0 -27
  158. package/es/ProLayout/components/ProFooter/index.d.ts +0 -4
  159. package/es/ProLayout/components/ProHeader/PropTypes.d.ts +0 -206
  160. package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +0 -4
  161. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.d.ts +0 -9
  162. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.d.ts +0 -4
  163. package/es/ProLayout/components/ProHeader/components/index.d.ts +0 -2
  164. package/es/ProLayout/components/ProHeader/index.d.ts +0 -4
  165. package/es/ProLayout/components/ProHeader/utils/index.d.ts +0 -5
  166. package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +0 -7
  167. package/es/ProLayout/components/TabsManager/components/TabItem.d.ts +0 -26
  168. package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +0 -6
  169. package/es/ProLayout/components/TabsManager/components/TabsHeader.d.ts +0 -10
  170. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +0 -6
  171. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.d.ts +0 -25
  172. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +0 -18
  173. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +0 -31
  174. package/es/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +0 -5
  175. package/es/ProLayout/components/TabsManager/index.d.ts +0 -7
  176. package/es/ProLayout/components/TabsManager/propTypes.d.ts +0 -89
  177. package/es/ProLayout/components/TabsManager/utils/index.d.ts +0 -47
  178. package/es/ProLayout/components/index.d.ts +0 -3
  179. package/es/ProLayout/index.d.ts +0 -20
  180. package/es/ProLayout/propTypes.d.ts +0 -533
  181. package/es/ProLayout/utils/index.d.ts +0 -43
  182. package/es/ProSelect/components/AdaptiveTooltip.d.ts +0 -4
  183. package/es/ProSelect/index.d.ts +0 -5
  184. package/es/ProSelect/propsType.d.ts +0 -162
  185. package/es/ProSelect/utils/index.d.ts +0 -4
  186. package/es/ProStep/components/Anchor/index.d.ts +0 -4
  187. package/es/ProStep/components/Item/index.d.ts +0 -3
  188. package/es/ProStep/components/LazyLoad/index.d.ts +0 -19
  189. package/es/ProStep/components/Listener/index.d.ts +0 -4
  190. package/es/ProStep/components/Step/index.d.ts +0 -5
  191. package/es/ProStep/index.d.ts +0 -11
  192. package/es/ProStep/propsType.d.ts +0 -224
  193. package/es/ProStep/utils/index.d.ts +0 -22
  194. package/es/ProStepTab/index.d.ts +0 -22
  195. package/es/ProStepTab/propsType.d.ts +0 -114
  196. package/es/ProTable/components/EditableCell/EditIcon.d.ts +0 -6
  197. package/es/ProTable/components/EditableCell/index.d.ts +0 -4
  198. package/es/ProTable/components/EditableCell/propsType.d.ts +0 -24
  199. package/es/ProTable/components/FormatColumn/index.d.ts +0 -22
  200. package/es/ProTable/components/FormatColumn/propsType.d.ts +0 -29
  201. package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +0 -3
  202. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +0 -18
  203. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.d.ts +0 -8
  204. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.d.ts +0 -61
  205. package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +0 -3
  206. package/es/ProTable/components/RcTable/index.d.ts +0 -4
  207. package/es/ProTable/components/RenderColumn/index.d.ts +0 -22
  208. package/es/ProTable/components/RenderEmptyText/index.d.ts +0 -3
  209. package/es/ProTable/components/RenderFooter/index.d.ts +0 -2
  210. package/es/ProTable/components/RenderSummary/index.d.ts +0 -3
  211. package/es/ProTable/components/RenderTableHeader/index.d.ts +0 -2
  212. package/es/ProTable/components/RenderTabs/index.d.ts +0 -4
  213. package/es/ProTable/components/TableResizable/index.d.ts +0 -13
  214. package/es/ProTable/components/TooltipTitle/index.d.ts +0 -11
  215. package/es/ProTable/components/index.d.ts +0 -31
  216. package/es/ProTable/hooks/useAntdTable.d.ts +0 -7
  217. package/es/ProTable/index.d.ts +0 -17
  218. package/es/ProTable/propsType.d.ts +0 -792
  219. package/es/ProTable/utils/columnStorage.d.ts +0 -35
  220. package/es/ProTable/utils/index.d.ts +0 -52
  221. package/es/ProTabs/components/Card/index.d.ts +0 -3
  222. package/es/ProTabs/components/index.d.ts +0 -1
  223. package/es/ProTabs/index.d.ts +0 -4
  224. package/es/ProTabs/propType.d.ts +0 -94
  225. package/es/ProThemeTools/component/ProTools/index.d.ts +0 -3
  226. package/es/ProThemeTools/component/index.d.ts +0 -1
  227. package/es/ProThemeTools/context/ThemeContext.d.ts +0 -43
  228. package/es/ProThemeTools/index.d.ts +0 -9
  229. package/es/ProThemeTools/propsType.d.ts +0 -170
  230. package/es/ProThemeTools/utils/index.d.ts +0 -51
  231. package/es/ProTooltip/index.d.ts +0 -3
  232. package/es/ProTooltip/propsType.d.ts +0 -57
  233. package/es/ProTree/components/AdaptiveTooltip.d.ts +0 -4
  234. package/es/ProTree/components/CloseIcon.d.ts +0 -2
  235. package/es/ProTree/components/List.d.ts +0 -17
  236. package/es/ProTree/components/ProTree.d.ts +0 -3
  237. package/es/ProTree/components/ProTreeSelect/index.d.ts +0 -5
  238. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +0 -445
  239. package/es/ProTree/components/SearchTitle.d.ts +0 -11
  240. package/es/ProTree/components/Tree.d.ts +0 -27
  241. package/es/ProTree/components/index.d.ts +0 -4
  242. package/es/ProTree/index.d.ts +0 -3
  243. package/es/ProTree/propsType.d.ts +0 -818
  244. package/es/ProTree/utils.d.ts +0 -62
  245. package/es/ProTreeModal/components/Cascader.d.ts +0 -14
  246. package/es/ProTreeModal/components/CloseIcon.d.ts +0 -2
  247. package/es/ProTreeModal/components/List.d.ts +0 -21
  248. package/es/ProTreeModal/components/SearchTitle.d.ts +0 -7
  249. package/es/ProTreeModal/components/SortableItem.d.ts +0 -12
  250. package/es/ProTreeModal/components/Tree.d.ts +0 -25
  251. package/es/ProTreeModal/components/Trigger.d.ts +0 -21
  252. package/es/ProTreeModal/components/index.d.ts +0 -6
  253. package/es/ProTreeModal/index.d.ts +0 -4
  254. package/es/ProTreeModal/propsType.d.ts +0 -298
  255. package/es/ProTreeModal/utils.d.ts +0 -39
  256. package/es/ProUpload/components/ButtonRender.d.ts +0 -20
  257. package/es/ProUpload/components/DragRender.d.ts +0 -21
  258. package/es/ProUpload/components/DraggableUploadListItem.d.ts +0 -2
  259. package/es/ProUpload/components/Example.d.ts +0 -10
  260. package/es/ProUpload/components/FileItem.d.ts +0 -33
  261. package/es/ProUpload/components/ImageRender.d.ts +0 -19
  262. package/es/ProUpload/index.d.ts +0 -4
  263. package/es/ProUpload/propsType.d.ts +0 -264
  264. package/es/ProUpload/uitls.d.ts +0 -3
  265. package/es/ProUtils/utils/index.d.ts +0 -6
  266. package/es/ProViewer/index.d.ts +0 -4
  267. package/es/ProViewer/propsType.d.ts +0 -37
  268. package/es/ProWaterMark/index.d.ts +0 -4
  269. package/es/ProWaterMark/propsType.d.ts +0 -6
  270. package/es/hooks/useDraggableRow.d.ts +0 -34
  271. package/es/index.d.ts +0 -58
  272. package/es/locale/en_US.d.ts +0 -176
  273. package/es/locale/index.d.ts +0 -15
  274. package/es/locale/zh_CN.d.ts +0 -176
  275. package/es/tokens.d.ts +0 -83
  276. package/es/utils/index.d.ts +0 -20
@@ -1,4 +1,6 @@
1
1
  import _difference from "lodash/difference";
2
+ import _isString from "lodash/isString";
3
+ import _isObject from "lodash/isObject";
2
4
  import _isNumber from "lodash/isNumber";
3
5
  /* eslint-disable no-restricted-syntax */
4
6
  /**
@@ -109,4 +111,176 @@ export const getSelectList = ({
109
111
  fieldNames,
110
112
  mode
111
113
  });
114
+ };
115
+
116
+ /** 将 selectList(扁平或分组)转为扁平选项列表,用于查找、回显、defaultOne */
117
+ export const flattenOptions = list => {
118
+ if (!Array.isArray(list) || !list.length) return [];
119
+ const out = [];
120
+ list.forEach(item => {
121
+ if (Array.isArray(item.options)) {
122
+ out.push(...item.options);
123
+ } else {
124
+ out.push(item);
125
+ }
126
+ });
127
+ return out;
128
+ };
129
+
130
+ /**
131
+ * 根据 code 在扁平选项中查找对应的数据对象
132
+ * @param flatOptions 扁平选项列表
133
+ * @param code 值字段名
134
+ * @param input 单个值或值数组
135
+ */
136
+ export const findValueObject = (flatOptions, code, input) => {
137
+ if (Array.isArray(input) && input.length) {
138
+ return input.map(i => flatOptions.find(item => item[code] === i)).filter(item => !!item);
139
+ }
140
+ return flatOptions.find(item => item[code] === input);
141
+ };
142
+
143
+ /** 默认搜索过滤:在 searchText/title/label 中做大小写不敏感的包含匹配 */
144
+ export const defaultFilterOption = (input, option) => {
145
+ if (option?.value == null) return false;
146
+ const optionLabel = option?.searchText ?? option?.title ?? option?.label;
147
+ return String(optionLabel ?? '').toLowerCase().includes(input.toLowerCase());
148
+ };
149
+
150
+ /** 取选项上挂载的原始 record(兼容 option.record / option.data.record) */
151
+ export const getInnerRecord = option => {
152
+ if (!option) return undefined;
153
+ if (option.record) return option.record;
154
+ if (option.data?.record) return option.data.record;
155
+ return undefined;
156
+ };
157
+
158
+ /**
159
+ * 计算单个选项的展示文本
160
+ * @param optionRender 自定义渲染函数,返回字符串时直接使用
161
+ * @param showCodeName 是否以 code-label 形式展示
162
+ */
163
+ export const getOptionText = ({
164
+ item,
165
+ optionRender,
166
+ showCodeName,
167
+ code,
168
+ label
169
+ }) => {
170
+ if (optionRender) {
171
+ const rendered = optionRender(item);
172
+ return _isString(rendered) ? rendered : String(item[label] ?? '');
173
+ }
174
+ const text = showCodeName ? `${item[code]}-${item[label]}` : item[label];
175
+ return _isString(text) ? text : String(text ?? '');
176
+ };
177
+
178
+ /** 构建单个 antd Select option 对象 */
179
+ export const buildOptionItem = (item, index, config) => {
180
+ const text = getOptionText({
181
+ item,
182
+ ...config
183
+ });
184
+ return {
185
+ key: item[config.code] != null ? `${item[config.code]}-${index}` : `option-${index}`,
186
+ label: text,
187
+ value: item[config.code] != null ? item[config.code] : undefined,
188
+ disabled: !!item.disabled,
189
+ title: text,
190
+ searchText: text,
191
+ record: item
192
+ };
193
+ };
194
+
195
+ /**
196
+ * 构建 antd Select 的 options(支持分组)
197
+ * @param list 当前数据源(可能含 options 分组项)
198
+ */
199
+ export const buildSelectOptions = (list, config) => {
200
+ if (!Array.isArray(list)) {
201
+ return [];
202
+ }
203
+ return list.map((item, index) => {
204
+ const groupOptions = item.options;
205
+ if (Array.isArray(groupOptions)) {
206
+ return {
207
+ key: item[config.label] ?? `group-${index}`,
208
+ label: item[config.label],
209
+ options: groupOptions.map((opt, optIndex) => buildOptionItem(opt, optIndex, config))
210
+ };
211
+ }
212
+ return buildOptionItem(item, index, config);
213
+ });
214
+ };
215
+
216
+ /**
217
+ * labelInValue 模式下解析 onChange 回调拿到的 option:
218
+ * 多选模式下将 record 合并进每项并清理临时字段,单选直接透传
219
+ */
220
+ export const resolveChangeOption = (rawOption, {
221
+ mode,
222
+ isReactNode
223
+ }) => {
224
+ let option = rawOption;
225
+ if (isReactNode) {
226
+ option = getInnerRecord(rawOption);
227
+ }
228
+ if (mode === 'multiple' && Array.isArray(option)) {
229
+ option.forEach(item => {
230
+ const currentRecord = getInnerRecord(item);
231
+ if (currentRecord) {
232
+ Object.assign(item, currentRecord);
233
+ }
234
+ delete item.record;
235
+ delete item.children;
236
+ });
237
+ }
238
+ return option;
239
+ };
240
+
241
+ /**
242
+ * 计算 onChange 第一个参数(值):根据 labelInValue/getChangeValue 决定透传原始值还是值对象
243
+ */
244
+ export const computeChangeValue = (value, {
245
+ labelInValue,
246
+ mode,
247
+ getChangeValue,
248
+ flatOptions,
249
+ code
250
+ }) => {
251
+ const useValueObject = labelInValue && (mode === 'multiple' || !mode);
252
+ const resolved = useValueObject ? findValueObject(flatOptions, code, value) : value;
253
+ return getChangeValue ? getChangeValue(resolved) : resolved;
254
+ };
255
+
256
+ /**
257
+ * 处理 labelInValue 模式及 defaultOne 下值的回填(只返回值,不触发状态更新)
258
+ */
259
+ export const computeTransformValue = ({
260
+ value,
261
+ labelInValue,
262
+ mode,
263
+ defaultOne,
264
+ isDefaultOne,
265
+ selectList,
266
+ flatOptions,
267
+ code
268
+ }) => {
269
+ if (labelInValue && !mode) {
270
+ if (!_isObject(value)) return undefined;
271
+ return value?.[code] || value?.value;
272
+ }
273
+ if (labelInValue && mode) {
274
+ if (!Array.isArray(value)) return [];
275
+ return value.map(item => item?.[code]);
276
+ }
277
+ // 兼容多选下显式传 null 的极端场景
278
+ if (mode && value === null) return undefined;
279
+ // 仅当 dataSource 只有一项时默认回填
280
+ if (defaultOne && !value && !isDefaultOne && selectList?.length === 1) {
281
+ return flatOptions[0]?.[code];
282
+ }
283
+ // 修复空字符 placeholder 不显示
284
+ if (value === '') return undefined;
285
+ return value;
112
286
  };
@@ -441,6 +441,22 @@ export const ProTreeSelect = (props, ref) => {
441
441
  });
442
442
  };
443
443
 
444
+ // 把 filterTree 写入的高亮标记(纯文本分隔)转成安全的 React 节点,避免 dangerouslySetInnerHTML
445
+ const renderHighlightLabel = text => {
446
+ if (!text || !text.includes('highlight-search-text')) return text;
447
+ const parts = text.split(/(<span class="highlight-search-text">.*?<\/span>)/g);
448
+ return parts.map((part, i) => {
449
+ const match = part.match(/^<span class="highlight-search-text">(.*?)<\/span>$/);
450
+ if (match) {
451
+ return /*#__PURE__*/_jsx("span", {
452
+ className: "highlight-search-text",
453
+ children: match[1]
454
+ }, i);
455
+ }
456
+ return part;
457
+ });
458
+ };
459
+
444
460
  /**
445
461
  * 自定义渲染子树
446
462
  * 注意:此时数据已经是标准格式(label, value, children)
@@ -472,9 +488,7 @@ export const ProTreeSelect = (props, ref) => {
472
488
  key = node?.value;
473
489
  }
474
490
  const titleHtml = /*#__PURE__*/_jsx("span", {
475
- dangerouslySetInnerHTML: {
476
- __html: labelText
477
- }
491
+ children: renderHighlightLabel(labelText)
478
492
  });
479
493
  let searchKey = '';
480
494
  if (showCodeName) {
@@ -86,7 +86,8 @@ const DragRender = props => {
86
86
  children: [/*#__PURE__*/_jsx("div", {
87
87
  className: "file-type-icon",
88
88
  children: /*#__PURE__*/_jsx("img", {
89
- src: _fileIcon
89
+ src: _fileIcon,
90
+ alt: ""
90
91
  })
91
92
  }), /*#__PURE__*/_jsx(DragSingleFileItem, {
92
93
  file: file,
@@ -271,7 +271,7 @@ const ProUpload = /*#__PURE__*/React.forwardRef((props, ref) => {
271
271
  }
272
272
  });
273
273
  if (!file.uid) {
274
- file.uid = `${Math.ceil(Math.random() * 10000)}`;
274
+ file.uid = crypto.randomUUID();
275
275
  }
276
276
  if (!file.status) {
277
277
  file.status = 'done';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "es",
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import type { ModifiedFormInstanceType } from '../ProForm/propsType';
3
- type Forms = Record<string, ModifiedFormInstanceType<any>>;
4
- export declare const FormsContext: React.Context<Forms>;
5
- /**
6
- * @param formKey 表单实例key
7
- * @param formIst form实例, 如果传了会把传入的实例存入全局
8
- * @returns 没有入参: 返回表单实例但是不存入全局
9
- * 有formKey: 取全局中的表单实例返回, 如果不存在则创建后返回
10
- */
11
- export declare const useForms: () => Forms;
12
- /** 获取所有表单实例 */
13
- export declare const useContextForms: () => Forms;
14
- interface FormsProviderProps {
15
- children?: React.ReactNode;
16
- }
17
- declare const FormsProvider: React.FC<FormsProviderProps>;
18
- export default FormsProvider;
@@ -1,8 +0,0 @@
1
- import './index.less';
2
- interface propsWithCheckModal {
3
- errorTitle?: string;
4
- list?: string[];
5
- [key: string]: any;
6
- }
7
- declare const CheckModalContent: (props: propsWithCheckModal) => import("react/jsx-runtime").JSX.Element;
8
- export default CheckModalContent;
@@ -1,7 +0,0 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import type { ProActionType } from './propsType';
3
- import './index.less';
4
- declare const ProAction: React.FC<PropsWithChildren<{
5
- config?: ProActionType[];
6
- }>>;
7
- export default ProAction;
@@ -1,45 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { Service, Options } from 'ahooks/lib/useRequest/src/types';
3
- export interface ProActionType {
4
- /**
5
- * @description 模式类型:check执行校验并解析错误信息展示,confirm确认提示
6
- * @default -
7
- */
8
- mode?: 'check' | 'confirm';
9
- /**
10
- * @description 标题
11
- * @default -
12
- */
13
- title?: string | ReactNode;
14
- /**
15
- * @description 操作回调函数
16
- * @param previousData 接上一个 useRequest 返回的值
17
- * @param args 接所有链式 useRequest 返回的值
18
- * @param index 当前操作的索引
19
- * @returns void或Promise<void>
20
- * @default -
21
- */
22
- onAction?: (previousData?: any, args?: any[], index?: number) => void | Promise<void>;
23
- /**
24
- * @description 自定义请求
25
- * @param previousData 接上一个 useRequest 返回的值
26
- * @param args 接所有链式 useRequest 返回的值
27
- * @returns 包含service、options和transformResponse的对象
28
- * @default -
29
- */
30
- useRequest?: (previousData: any, args: any) => {
31
- service?: Service<any, any>;
32
- options?: Options<any, any>;
33
- transformResponse?: (data: any) => any;
34
- };
35
- /**
36
- * @description 是否中断链式操作
37
- * @param previousData 上一个操作的返回数据
38
- * @param args 所有链式的数据合集
39
- * @returns 布尔值,返回true继续执行,返回false中断操作
40
- * @default -
41
- */
42
- continue?: (previousData: any, args: any[]) => boolean;
43
- /** 自定义错误弹窗内容视图渲染 */
44
- contextRender?: (data: any) => string | ReactNode;
45
- }
@@ -1,9 +0,0 @@
1
- import React, { FC } from 'react';
2
- import 'dayjs/locale/zh-cn';
3
- import type { ProConfigProviderProps, ConfigContext } from './propsType';
4
- export declare const ProConfigContext: React.Context<ConfigContext>;
5
- export declare function useProConfig(): ConfigContext;
6
- export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
7
- export declare const ProConfigProvider: FC<ProConfigProviderProps>;
8
- export type { ProConfigProviderType, ProConfigProviderProps, GlobalConfig, ProTableGlobalConfig, StorageType, } from './propsType';
9
- export default ProConfigProvider;
@@ -1,78 +0,0 @@
1
- import type React from 'react';
2
- import type { FormInstance } from 'antd';
3
- import type { PropSelectType } from '../ProSelect/propsType';
4
- import type { ProModalSelectType } from '../ProForm/components/combination/ProModalSelect/propsType';
5
- import type { ProCascaderType } from '../ProForm/components/combination/ProCascader/propsType';
6
- import type { ProEnumConfigType } from '../ProEnum/propsType';
7
- /** 浏览器缓存类型,与 ProEnum / ProTable 的 StorageType 定义一致 */
8
- export type StorageType = 'localStorage' | 'sessionStorage' | 'indexedDB';
9
- /** 项目级全局配置(一处配置,全局生效) */
10
- export interface GlobalConfig {
11
- /** 缓存存储位置,影响 ProTable 列配置缓存与 ProEnum 枚举缓存,默认由各组件自身决定 */
12
- storage?: StorageType;
13
- }
14
- /** ProTable 组件全局默认配置,通过 ProConfigProvider 统一设置,无需每个实例单独声明 */
15
- export interface ProTableGlobalConfig {
16
- /** 是否开启可伸缩列功能,默认 false */
17
- resizeColumn?: boolean;
18
- /** 是否开启列配置功能,开启时默认同步开启缓存,默认 false */
19
- columnConfig?: boolean | {
20
- onColumnOk?: (catchColumns: any, columns: any[]) => Promise<void>;
21
- };
22
- /** 是否开启列配置缓存,单位为天,true 时缓存一天,默认 false */
23
- cacheTime?: number | boolean;
24
- }
25
- /** 对外配置项类型(value、内部 state 均为此类型,字段均可选) */
26
- export interface ProConfigProviderType {
27
- locale?: string;
28
- /** 项目级全局配置:缓存位置等跨组件通用配置 */
29
- globalConfig?: GlobalConfig;
30
- /** ProTable 组件全局默认配置 */
31
- ProTable?: ProTableGlobalConfig;
32
- ProEnum?: Partial<ProEnumConfigType>;
33
- ProSelect?: Partial<PropSelectType> & Record<string, any>;
34
- ProModalSelect?: Partial<ProModalSelectType> & Record<string, any>;
35
- ProAddressBar?: Partial<ProCascaderType> & Record<string, any>;
36
- ProCascader?: Partial<ProCascaderType> & Record<string, any>;
37
- forms?: Record<string, FormInstance | undefined>;
38
- [key: string]: any;
39
- }
40
- /** ProConfigProvider 组件 Props(内部使用) */
41
- export interface ProConfigProviderProps {
42
- value?: ProConfigProviderType;
43
- locale?: string;
44
- onSuccess?: (data: any, params: any) => void;
45
- children?: React.ReactNode;
46
- }
47
- /** Config 上下文 */
48
- export interface ConfigContext {
49
- state: ProConfigProviderType;
50
- dispatch: React.Dispatch<ProConfigActions>;
51
- }
52
- /** ThemeAwareConfigProvider 内部组件 Props */
53
- export interface ThemeAwareConfigProviderProps {
54
- locale: any;
55
- children: React.ReactNode;
56
- }
57
- /** Reducer Actions */
58
- export type ProConfigActions = {
59
- type: 'setFormRef';
60
- name: string;
61
- value: FormInstance;
62
- } | {
63
- type: 'deleteFormRef';
64
- name: string;
65
- } | {
66
- type: 'set';
67
- payload: ProConfigProviderType;
68
- } | {
69
- type: 'setProEnum';
70
- payload: Record<string, any>;
71
- } | {
72
- type: 'setProEnumDic';
73
- key: string;
74
- payload: any;
75
- } | {
76
- type: 'setWithLocal';
77
- payload: ProConfigProviderType;
78
- };
@@ -1,6 +0,0 @@
1
- import type { ProDownloadType } from './propsType';
2
- declare const ProDownload: {
3
- (props: ProDownloadType): import("react/jsx-runtime").JSX.Element;
4
- downLoadRequest: import("./utils").DownloadRequestProps;
5
- };
6
- export default ProDownload;
@@ -1,71 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { ButtonProps } from 'antd';
3
- import type { DownloadRequestProps, PropsWithMakeFilePropsType } from './utils';
4
- export interface ProDownloadType extends ButtonProps {
5
- /**
6
- * @description 下载资源获取来源:api:通过接口获取,url:通过静态资源链接获取
7
- * @default api
8
- */
9
- source?: string;
10
- /**
11
- * @description 下载请求的地址
12
- * @default (必选)
13
- */
14
- url: string;
15
- /**
16
- * @description 下载请求的地址
17
- * @deprecated 弃用,请使用url进行替换
18
- * @default (非必选)
19
- */
20
- action?: string;
21
- /**
22
- * @description 下载请求的类型
23
- * @default post
24
- */
25
- method?: 'post' | 'get';
26
- /**
27
- * @description 下载所需额外参数或返回上传额外参数的方法
28
- * @default -
29
- */
30
- params?: any;
31
- /**
32
- * @description 下载保存的文件名
33
- * @default (必选)
34
- */
35
- fileName?: string;
36
- /**
37
- * @description 设置上传的请求头部,IE10 以上有效
38
- * @default -
39
- */
40
- headers?: object;
41
- /**
42
- * @description 禁用状态
43
- * @default false
44
- */
45
- disabled?: boolean;
46
- /** 格式化数据 */
47
- transformResponse?: (data: any) => any;
48
- /**
49
- * @description 上传文件之前的钩子,若返回 false 则停止下载。支持返回一个 Promise 对象,Promise 对象 reject 时则停止下载
50
- * @default -
51
- */
52
- beforeDownload?: () => boolean | Promise<any>;
53
- /**
54
- * @description service 执行完成时触发
55
- * @default -
56
- */
57
- /**
58
- * @description 下载出错的回调
59
- * @default -
60
- */
61
- onError?: (response: object) => void;
62
- onFinish?: () => void;
63
- /**
64
- * @description 下载按钮的填充内容
65
- * @default -
66
- */
67
- downLoadRequest?: DownloadRequestProps;
68
- downLoadBlobUrl?: PropsWithMakeFilePropsType;
69
- children?: string | ReactNode;
70
- [key: string]: any;
71
- }
@@ -1,60 +0,0 @@
1
- export interface PropsWithMakeFilePropsType {
2
- blob?: Blob;
3
- fileName: string;
4
- url?: string;
5
- }
6
- export interface IDownloadRequestPropsType {
7
- /**
8
- * @description 下载请求的地址
9
- * @default (必选)
10
- */
11
- url: string;
12
- /**
13
- * @description 下载请求的类型
14
- * @default post
15
- */
16
- method?: 'post' | 'get';
17
- /**
18
- * @description 下载所需额外参数或返回上传额外参数的方法
19
- * @default -
20
- */
21
- params?: any;
22
- headers?: any;
23
- /** 格式化数据 */
24
- transformResponse?: (data: any) => any;
25
- /**
26
- * @description service 执行完成时触发
27
- * @default -
28
- */
29
- onFinish?: (response: object, params: object) => void;
30
- /**
31
- * @description 下载保存的文件名
32
- * @default (必选)
33
- */
34
- fileName?: string;
35
- /**
36
- * @description 下载出错的回调
37
- * @default -
38
- */
39
- onError?: (response: object) => void;
40
- }
41
- /**
42
- * 下载Blob
43
- *
44
- * @param response
45
- * @param fileName
46
- * @param extendName
47
- * @constructor
48
- */
49
- export declare function BlobMakeFile({ blob, fileName, url }: PropsWithMakeFilePropsType): void;
50
- export type DownloadRequestProps = (props: IDownloadRequestPropsType) => Promise<Response>;
51
- type convertBase64ToBlobType = (base64: string, fileType?: string, slice?: number) => Blob;
52
- export declare const convertBase64ToBlob: convertBase64ToBlobType;
53
- /**
54
- * 从Content-Disposition获取filename
55
- * @param contentDisposition string
56
- * @returns string
57
- */
58
- export declare function getFilenameFromContentDisposition(contentDisposition: any): string;
59
- export declare const DownloadRequest: DownloadRequestProps;
60
- export {};
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { ProDrawerFormType } from '../../propsType';
3
- /**
4
- * 抽屉组件
5
- */
6
- declare const ProDrawer: FC<ProDrawerFormType>;
7
- export default ProDrawer;
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { ProDrawerFormType } from '../../propsType';
3
- /**
4
- * 弹窗组件
5
- */
6
- declare const ProModal: FC<ProDrawerFormType>;
7
- export default ProModal;
@@ -1,2 +0,0 @@
1
- export { default as ProDrawer } from './ProDrawer';
2
- export { default as ProModal } from './ProModal';
@@ -1,25 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ProDrawerFormType } from '../propsType';
3
- interface UseConfirmCloseParams {
4
- open?: boolean;
5
- isView?: boolean;
6
- isConfirmClose?: boolean;
7
- isConfirmCloseModalProps?: ProDrawerFormType['isConfirmCloseModalProps'];
8
- onCancel?: ProDrawerFormType['onCancel'];
9
- }
10
- /**
11
- * 关闭抽屉/弹窗时的二次确认逻辑
12
- *
13
- * - markInteracted:绑定到内容容器的 input / change 事件,标记用户真实交互过。
14
- * setFieldsValue 等程序回填不会派发用户输入事件,因此异步回填不会误触发二次确认。
15
- * - onConfirm:组件自带关闭入口(右上角 × / 遮罩)的关闭处理。未交互、查看模式或
16
- * 未开启二次确认时直接关闭;否则弹出二次确认。底部取消按钮不走此逻辑。
17
- * - contextHolder:Modal.useModal 的上下文占位,需渲染进组件,使二次确认弹框能继承
18
- * ConfigProvider 的主题 / 国际化(替代静态 Modal.confirm,消除上下文告警)。
19
- */
20
- export declare const useConfirmClose: ({ open, isView, isConfirmClose, isConfirmCloseModalProps, onCancel, }: UseConfirmCloseParams) => {
21
- markInteracted: () => void;
22
- onConfirm: () => void;
23
- contextHolder: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
24
- };
25
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { FormInstance } from 'antd/es/form/Form';
3
- import { ProDrawerFormType } from './propsType';
4
- export declare const useProDrawerFormContext: () => any;
5
- declare const ProDrawerForm: React.ForwardRefExoticComponent<ProDrawerFormType & React.RefAttributes<FormInstance<any>>>;
6
- export default ProDrawerForm;