@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,25 +1,23 @@
1
- import _isString from "lodash/isString";
2
- import _isNumber from "lodash/isNumber";
3
- import _isEmpty from "lodash/isEmpty";
4
- import _isFunction from "lodash/isFunction";
5
- import { Space, Divider, Breadcrumb, Tooltip, Modal } from 'antd';
6
- import React, { memo, useEffect, useState, useRef } from 'react';
7
- import { tools } from '@zat-design/utils';
8
- import classnames from 'classnames';
9
- import dayjs from 'dayjs';
10
- import { useToggle } from 'ahooks';
11
- import { ReactSVG } from 'react-svg';
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Space, Divider, Breadcrumb, Tooltip, Modal } from "antd";
3
+ import React, { memo, useEffect, useState, useRef } from "react";
4
+ import { tools } from "@zat-design/utils";
5
+ import classnames from "classnames";
6
+ import dayjs from "dayjs";
7
+ import { useToggle } from "ahooks";
8
+ import isFunction from "lodash/isFunction";
9
+ import isEmpty from "lodash/isEmpty";
10
+ import isNumber from "lodash/isNumber";
11
+ import isString from "lodash/isString";
12
+ import { ReactSVG } from "react-svg";
12
13
  import foldSvg from "../../../assets/arrow.svg";
13
14
  import { Copy, ProBackBtn } from "./components";
14
15
  import { DescribeItems, DescribeValue } from "./components/Describe";
15
16
  import getEnumLabel from "../../../ProEnum/utils/getEnumLabel";
16
17
  import locale from "../../../locale";
17
18
  import { toKeyPart, getDescribeColumnKey, getTagKey, getSubDescribeKey } from "./utils";
18
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
- const {
20
- formatAmount
21
- } = tools;
22
- const ProHeader = props => {
19
+ const { formatAmount } = tools;
20
+ const ProHeader = (props) => {
23
21
  const {
24
22
  breadcrumbColumns,
25
23
  actionRender,
@@ -38,360 +36,241 @@ const ProHeader = props => {
38
36
  isConfirmBack = false,
39
37
  isConfirmBackModalProps = {}
40
38
  } = props;
41
-
42
- // 返回按钮是否显示。
43
- // 显式意图优先于 autoBack 启发式:
44
- // 1) 用户显式传了 showBack → 完全尊重该值;
45
- // 2) 传了 onBack(返回不依赖浏览器历史,如 tab 内返回 / 自定义跳转)→ 显示;
46
- // 3) 都没传(纯默认,返回兜底走 window.history.back)→ 由 autoBack 按历史长度智能判断:
47
- // 新开页面(history.length <= autoBack)无处可返回,则隐藏。
48
39
  const computeBackState = () => {
49
- if (props.showBack !== undefined) return props.showBack;
50
- if (onBack) return true;
40
+ if (props.showBack !== void 0)
41
+ return props.showBack;
42
+ if (onBack)
43
+ return true;
51
44
  return window.history.length > autoBack;
52
45
  };
53
46
  const [backState, setBackState] = useState(computeBackState);
54
- const [fold, {
55
- toggle
56
- }] = useToggle(collapsed);
47
+ const [fold, { toggle }] = useToggle(collapsed);
57
48
  const ref = useRef(null);
58
-
59
- // 最终用于渲染的标题(title + showBack 时会被转成面包屑,此处置空)
60
49
  let finalTitle = title;
61
-
62
- // 面包屑配置数据源
63
50
  const finalBreadcrumbColumns = breadcrumbColumns || [];
64
-
65
- // 次级配置数据源
66
51
  const finalSubDescribeColumns = subDescribeColumns || [];
67
52
  useEffect(() => {
68
53
  if (bodyOverFlowHidden) {
69
- const bodyElement = document.querySelector('body');
70
- bodyElement.style.overflow = 'hidden';
54
+ const bodyElement = document.querySelector("body");
55
+ bodyElement.style.overflow = "hidden";
71
56
  }
72
57
  return () => {
73
- const bodyElement = document.querySelector('body');
74
- bodyElement.style.overflow = '';
58
+ const bodyElement = document.querySelector("body");
59
+ bodyElement.style.overflow = "";
75
60
  };
76
61
  }, [bodyOverFlowHidden]);
77
-
78
- // showBack / onBack / autoBack 变化时同步 backState(避免 props 更新后按钮显隐不同步)
79
62
  useEffect(() => {
80
63
  setBackState(computeBackState());
81
64
  }, [props.showBack, onBack, autoBack]);
82
-
83
- /**
84
- * 主级描述数据渲染
85
- */
86
- const describeRender = describeData => {
65
+ const describeRender = (describeData) => {
87
66
  if (!Array.isArray(describeData)) {
88
67
  return null;
89
68
  }
90
- return /*#__PURE__*/_jsx("ul", {
91
- className: classnames({
92
- 'pro-header-describe': true,
93
- 'pro-header-describe-open': fold,
94
- 'pro-header-describe-hidden': !fold
95
- }),
96
- children: describeData.map((item, index) => {
97
- const {
98
- value,
99
- copyable,
100
- show = true,
101
- tag,
102
- label,
103
- link,
104
- items = [],
105
- width
106
- } = item;
107
- const describeItemKey = getDescribeColumnKey(item, index);
108
- // show为false直接隐藏¸
109
- if (show === false || !show) {
110
- return null;
111
- }
112
- const onlyTag = tag && !label && !value;
113
- const tagCls = classnames({
114
- 'pro-header-only-tag': onlyTag,
115
- 'pro-header-describe-items-calc': _isString(width) ? width.includes('calc') : false
116
- });
117
- return /*#__PURE__*/_jsx("li", {
118
- className: tagCls,
119
- style: {
120
- width
121
- },
122
- children: /*#__PURE__*/_jsxs(Space, {
123
- size: 4,
124
- children: [label ? /*#__PURE__*/_jsx("span", {
125
- className: "pro-header-describe-label",
126
- children: label
127
- }) : null, /*#__PURE__*/_jsx("span", {
128
- className: "pro-header-describe-value",
129
- children: items?.length ? /*#__PURE__*/_jsx(DescribeItems, {
130
- items: items,
131
- parentKey: describeItemKey,
132
- containerRef: ref
133
- }) : /*#__PURE__*/_jsx("span", {
134
- children: /*#__PURE__*/_jsx(DescribeValue, {
135
- value: value,
136
- copyable: copyable,
137
- tag: tag,
138
- link: link,
139
- parentKey: describeItemKey
140
- })
141
- })
142
- })]
143
- })
144
- }, describeItemKey);
145
- })
146
- });
69
+ return /* @__PURE__ */ jsx(
70
+ "ul",
71
+ {
72
+ className: classnames({
73
+ "pro-header-describe": true,
74
+ "pro-header-describe-open": fold,
75
+ "pro-header-describe-hidden": !fold
76
+ }),
77
+ children: describeData.map((item, index) => {
78
+ const { value, copyable, show = true, tag, label, link, items = [], width } = item;
79
+ const describeItemKey = getDescribeColumnKey(item, index);
80
+ if (show === false || !show) {
81
+ return null;
82
+ }
83
+ const onlyTag = tag && !label && !value;
84
+ const tagCls = classnames({
85
+ "pro-header-only-tag": onlyTag,
86
+ "pro-header-describe-items-calc": isString(width) ? width.includes("calc") : false
87
+ });
88
+ return /* @__PURE__ */ jsx("li", { className: tagCls, style: { width }, children: /* @__PURE__ */ jsxs(Space, { size: 4, children: [
89
+ label ? /* @__PURE__ */ jsx("span", { className: "pro-header-describe-label", children: label }) : null,
90
+ /* @__PURE__ */ jsx("span", { className: "pro-header-describe-value", children: (items == null ? void 0 : items.length) ? /* @__PURE__ */ jsx(DescribeItems, { items, parentKey: describeItemKey, containerRef: ref }) : /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
91
+ DescribeValue,
92
+ {
93
+ value,
94
+ copyable,
95
+ tag,
96
+ link,
97
+ parentKey: describeItemKey
98
+ }
99
+ ) }) })
100
+ ] }) }, describeItemKey);
101
+ })
102
+ }
103
+ );
147
104
  };
148
-
149
- /**
150
- * 次级描述数据渲染
151
- */
152
- const subDescribeRender = describeData => {
153
- const {
154
- value,
155
- type,
156
- valueType,
157
- label,
158
- show = true,
159
- precision = 2,
160
- code
161
- } = describeData;
162
- // show为false直接隐藏
105
+ const subDescribeRender = (describeData) => {
106
+ var _a, _b;
107
+ const { value, type, valueType, label, show = true, precision = 2, code } = describeData;
163
108
  if (!show) {
164
- return '';
109
+ return "";
165
110
  }
166
111
  let result;
167
112
  switch (valueType || type) {
168
- case 'thousandth':
169
- case 'money':
170
- // 千分位
171
- result = value || _isNumber(value) ? formatAmount(value, precision) : '-';
113
+ case "thousandth":
114
+ case "money":
115
+ result = value || isNumber(value) ? formatAmount(value, precision) : "-";
172
116
  break;
173
- case 'enumName':
174
- // 枚举-展示name
117
+ case "enumName":
175
118
  result = getEnumLabel(code, value);
176
119
  break;
177
- case 'enumCodeName':
178
- // 枚举-展示code-name
120
+ case "enumCodeName":
179
121
  result = getEnumLabel(code, value, true);
180
122
  break;
181
- case 'date':
182
- // 年月日
183
- result = value ? dayjs(value)?.format('YYYY-MM-DD') : '-';
123
+ case "date":
124
+ result = value ? (_a = dayjs(value)) == null ? void 0 : _a.format("YYYY-MM-DD") : "-";
184
125
  break;
185
- case 'dateTime':
186
- // 年月日 时分秒
187
- result = value ? dayjs(value)?.format('YYYY-MM-DD HH:mm:ss') : '-';
126
+ case "dateTime":
127
+ result = value ? (_b = dayjs(value)) == null ? void 0 : _b.format("YYYY-MM-DD HH:mm:ss") : "-";
188
128
  break;
189
129
  default:
190
- result = String(value).includes('undefined') || !value ? '-' : value;
130
+ result = String(value).includes("undefined") || !value ? "-" : value;
191
131
  break;
192
132
  }
193
- return /*#__PURE__*/_jsxs(_Fragment, {
194
- children: [/*#__PURE__*/_jsx("span", {
195
- children: label
196
- }), /*#__PURE__*/_jsx("span", {
197
- className: "describe-value",
198
- children: result
199
- })]
200
- });
133
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
134
+ /* @__PURE__ */ jsx("span", { children: label }),
135
+ /* @__PURE__ */ jsx("span", { className: "describe-value", children: result })
136
+ ] });
201
137
  };
202
-
203
- /**
204
- * 头部右侧按钮面板渲染
205
- */
206
138
  const actionsRender = () => {
207
139
  if (Array.isArray(actionRender) && actionRender.length) {
208
- return /*#__PURE__*/_jsx(Space, {
209
- separator: /*#__PURE__*/_jsx(Divider, {
210
- orientation: "vertical"
211
- }),
212
- children: actionRender.map((item, index) => {
213
- const actionKey = ( /*#__PURE__*/React.isValidElement(item) && item.key != null ? String(item.key) : undefined) ?? toKeyPart(item?.type) ?? `action-${index}`;
214
- if (_isFunction(item?.type)) {
215
- return /*#__PURE__*/_jsx("div", {
216
- children: item
217
- }, actionKey);
218
- }
219
- // 判断第一层dom节点为空
220
- if (item?.type && !item?.props?.children) {
221
- return null;
222
- }
223
- return /*#__PURE__*/_jsx("div", {
224
- children: item
225
- }, actionKey);
226
- })
227
- });
140
+ return /* @__PURE__ */ jsx(Space, { separator: /* @__PURE__ */ jsx(Divider, { orientation: "vertical" }), children: actionRender.map((item, index) => {
141
+ var _a;
142
+ const actionKey = (React.isValidElement(item) && item.key != null ? String(item.key) : void 0) ?? toKeyPart(item == null ? void 0 : item.type) ?? `action-${index}`;
143
+ if (isFunction(item == null ? void 0 : item.type)) {
144
+ return /* @__PURE__ */ jsx("div", { children: item }, actionKey);
145
+ }
146
+ if ((item == null ? void 0 : item.type) && !((_a = item == null ? void 0 : item.props) == null ? void 0 : _a.children)) {
147
+ return null;
148
+ }
149
+ return /* @__PURE__ */ jsx("div", { children: item }, actionKey);
150
+ }) });
228
151
  }
229
152
  return actionRender;
230
153
  };
231
-
232
- /**
233
- * 总结信息面板渲染
234
- */
235
154
  const breadcrumbRender = () => {
236
155
  if (Array.isArray(finalBreadcrumbColumns) && !finalBreadcrumbColumns.length) {
237
156
  return [];
238
157
  }
239
- const list = finalBreadcrumbColumns?.filter(item => {
240
- return item.type === 'breadcrumb';
158
+ const list = finalBreadcrumbColumns == null ? void 0 : finalBreadcrumbColumns.filter((item) => {
159
+ return item.type === "breadcrumb";
241
160
  });
242
161
  return list.map((item, index) => {
243
- const {
244
- value,
245
- show = true,
246
- tag
247
- } = item;
162
+ var _a;
163
+ const { value, show = true, tag } = item;
248
164
  const breadcrumbItemKey = toKeyPart(value) ?? `breadcrumb-${index}`;
249
165
  const tagRender = () => {
250
166
  if (Array.isArray(tag) && tag.length) {
251
- return /*#__PURE__*/_jsx(Space, {
252
- size: 8,
253
- children: tag.map((tagItem, tagIndex) => {
254
- return /*#__PURE__*/_jsx("div", {
167
+ return /* @__PURE__ */ jsx(Space, { size: 8, children: tag.map((tagItem, tagIndex) => {
168
+ return /* @__PURE__ */ jsx(
169
+ "div",
170
+ {
255
171
  className: "pro-header-tag",
256
172
  children: tagItem
257
- }, getTagKey(tagItem, breadcrumbItemKey, tagIndex));
258
- })
259
- });
173
+ },
174
+ getTagKey(tagItem, breadcrumbItemKey, tagIndex)
175
+ );
176
+ }) });
260
177
  }
261
- return tag ? /*#__PURE__*/_jsx("div", {
262
- className: "pro-header-tag",
263
- children: tag
264
- }) : null;
178
+ return tag ? /* @__PURE__ */ jsx("div", { className: "pro-header-tag", children: tag }) : null;
265
179
  };
266
-
267
- // show或者值不存在为false直接隐藏¸
268
180
  if (!show || !value) {
269
181
  return null;
270
182
  }
271
- // 判断第一层dom节点为空
272
- if (value?.type && !value?.props?.children) {
183
+ if ((value == null ? void 0 : value.type) && !((_a = value == null ? void 0 : value.props) == null ? void 0 : _a.children)) {
273
184
  return null;
274
185
  }
275
186
  return {
276
187
  key: breadcrumbItemKey,
277
- title: /*#__PURE__*/_jsxs(Space, {
278
- size: 4,
279
- children: [value, " ", tagRender()]
280
- })
188
+ title: /* @__PURE__ */ jsxs(Space, { size: 4, children: [
189
+ value,
190
+ " ",
191
+ tagRender()
192
+ ] })
281
193
  };
282
- }).filter(Boolean); // 过滤掉null值
194
+ }).filter(Boolean);
283
195
  };
284
-
285
- /**
286
- * 头部左侧导航栏后业务信息
287
- */
288
196
  const infoRender = () => {
289
197
  if (!Array.isArray(finalBreadcrumbColumns)) {
290
- return '';
198
+ return "";
291
199
  }
292
- const list = finalBreadcrumbColumns?.filter(item => {
293
- return item.type !== 'breadcrumb';
200
+ const list = finalBreadcrumbColumns == null ? void 0 : finalBreadcrumbColumns.filter((item) => {
201
+ return item.type !== "breadcrumb";
294
202
  });
295
203
  if (!list.length) {
296
204
  return null;
297
205
  }
298
- return /*#__PURE__*/_jsx("ul", {
299
- className: "pro-header-info",
300
- children: list.map((item, index) => {
301
- const {
302
- value,
303
- type = 'info',
304
- show = true,
305
- width,
306
- tag
307
- } = item;
308
- const infoItemKey = (type && toKeyPart(value) ? `${type}-${toKeyPart(value)}` : undefined) ?? toKeyPart(value) ?? `info-${index}`;
309
- // show或者值不存在为false直接隐藏¸
310
- if (!show || !value) {
311
- return '';
312
- }
313
- // 判断第一层dom节点为空
314
- if (value?.type && !value?.props?.children) {
315
- return '';
206
+ return /* @__PURE__ */ jsx("ul", { className: "pro-header-info", children: list.map((item, index) => {
207
+ var _a;
208
+ const { value, type = "info", show = true, width, tag } = item;
209
+ const infoItemKey = (type && toKeyPart(value) ? `${type}-${toKeyPart(value)}` : void 0) ?? toKeyPart(value) ?? `info-${index}`;
210
+ if (!show || !value) {
211
+ return "";
212
+ }
213
+ if ((value == null ? void 0 : value.type) && !((_a = value == null ? void 0 : value.props) == null ? void 0 : _a.children)) {
214
+ return "";
215
+ }
216
+ let val = String(value).includes("undefined") || !value ? "-" : value;
217
+ if (type === "version" && val) {
218
+ val = `${locale.ProHeader.versionTitle}${val}`;
219
+ }
220
+ const breadcrumbCls = classnames({
221
+ "breadcrumb-value": true,
222
+ omit: width
223
+ });
224
+ const valueRender = (type2) => {
225
+ let valRender = /* @__PURE__ */ jsx("div", { className: breadcrumbCls, style: { width }, children: /* @__PURE__ */ jsxs(Space, { size: 4, children: [
226
+ val,
227
+ " ",
228
+ tag ? /* @__PURE__ */ jsx("div", { className: "pro-header-tag", children: tag }) : null
229
+ ] }) });
230
+ if (type2 === "copy") {
231
+ return valRender = /* @__PURE__ */ jsxs(Fragment, { children: [
232
+ width ? /* @__PURE__ */ jsx(Tooltip, { title: val, children: valRender }) : valRender,
233
+ /* @__PURE__ */ jsx(Copy, { text: val })
234
+ ] });
316
235
  }
317
- // value为null或者undefined返回'-'
318
- let val = String(value).includes('undefined') || !value ? '-' : value;
319
- if (type === 'version' && val) {
320
- val = `${locale.ProHeader.versionTitle}${val}`;
236
+ if (width) {
237
+ return /* @__PURE__ */ jsx(Tooltip, { title: val, children: valRender });
321
238
  }
322
-
323
- // 面包屑样式
324
- const breadcrumbCls = classnames({
325
- 'breadcrumb-value': true,
326
- omit: width
327
- });
328
- const valueRender = type => {
329
- let valRender = /*#__PURE__*/_jsx("div", {
330
- className: breadcrumbCls,
331
- style: {
332
- width
333
- },
334
- children: /*#__PURE__*/_jsxs(Space, {
335
- size: 4,
336
- children: [val, " ", tag ? /*#__PURE__*/_jsx("div", {
337
- className: "pro-header-tag",
338
- children: tag
339
- }) : null]
340
- })
341
- });
342
- if (type === 'copy') {
343
- return valRender = /*#__PURE__*/_jsxs(_Fragment, {
344
- children: [width ? /*#__PURE__*/_jsx(Tooltip, {
345
- title: val,
346
- children: valRender
347
- }) : valRender, /*#__PURE__*/_jsx(Copy, {
348
- text: val
349
- })]
350
- });
351
- }
352
- if (width) {
353
- return /*#__PURE__*/_jsx(Tooltip, {
354
- title: val,
355
- children: valRender
356
- });
357
- }
358
- return valRender;
359
- };
360
- return /*#__PURE__*/_jsx("li", {
239
+ return valRender;
240
+ };
241
+ return /* @__PURE__ */ jsx(
242
+ "li",
243
+ {
361
244
  className: classnames({
362
- version: ['version', 'tag'].includes(type),
363
- hidden: ['version', 'tag'].includes(type) && !val
245
+ version: ["version", "tag"].includes(type),
246
+ hidden: ["version", "tag"].includes(type) && !val
364
247
  }),
365
- children: type === 'copy' ? valueRender('copy') : valueRender()
366
- }, infoItemKey);
367
- })
368
- });
248
+ children: type === "copy" ? valueRender("copy") : valueRender()
249
+ },
250
+ infoItemKey
251
+ );
252
+ }) });
369
253
  };
370
-
371
- // 说明:以下两个 class 的判断沿用原有等价逻辑(去掉了原表达式里对 describeColumns 的重复判断)。
372
- // has = 有次级描述 有主级描述;no = 无主级描述。二者非严格互斥(原实现即如此,未改动其行为)。
373
- const noDescribe = _isEmpty(describeColumns);
374
- const hasDescribe = !_isEmpty(finalSubDescribeColumns) || !noDescribe;
375
- const hasFixedTop = fixedTop !== undefined && fixedTop !== null;
254
+ const noDescribe = isEmpty(describeColumns);
255
+ const hasDescribe = !isEmpty(finalSubDescribeColumns) || !noDescribe;
256
+ const hasFixedTop = fixedTop !== void 0 && fixedTop !== null;
376
257
  const cls = classnames({
377
- 'pro-header': true,
378
- 'pro-header-fixed': hasFixedTop,
379
- 'pro-header-shadow': showShadow,
258
+ "pro-header": true,
259
+ "pro-header-fixed": hasFixedTop,
260
+ "pro-header-shadow": showShadow,
380
261
  // 内部窗口滚动自带阴影场景
381
- 'pro-header-no-back': !backState,
382
- 'pro-header-has-describe': hasDescribe,
383
- 'pro-header-no-describe': noDescribe,
262
+ "pro-header-no-back": !backState,
263
+ "pro-header-has-describe": hasDescribe,
264
+ "pro-header-no-describe": noDescribe,
384
265
  [`${className}`]: className
385
266
  });
386
- if (title && !_isEmpty(finalBreadcrumbColumns)) {
387
- console.error('warning: The title and the breadcrumbList cannot be used together');
267
+ if (title && !isEmpty(finalBreadcrumbColumns)) {
268
+ console.error("warning: The title and the breadcrumbList cannot be used together");
388
269
  }
389
-
390
- // title默认不显示返回按钮,只有showBack设置为true时才显示
391
270
  if (title && props.showBack) {
392
271
  finalTitle = null;
393
272
  finalBreadcrumbColumns.push({
394
- type: 'breadcrumb',
273
+ type: "breadcrumb",
395
274
  value: title
396
275
  });
397
276
  }
@@ -403,11 +282,7 @@ const ProHeader = props => {
403
282
  }
404
283
  return false;
405
284
  }
406
- // 处理 Modal.confirm width 类型兼容性问题
407
- const {
408
- width,
409
- ...restModalProps
410
- } = isConfirmBackModalProps || {};
285
+ const { width, ...restModalProps } = isConfirmBackModalProps || {};
411
286
  Modal.confirm({
412
287
  title: `${locale.ProHeader.confirmTitle}`,
413
288
  okText: `${locale.ProHeader.confirm}`,
@@ -416,71 +291,56 @@ const ProHeader = props => {
416
291
  onBack && onBack();
417
292
  },
418
293
  // 仅当 width 是 string 或 number 时才传递
419
- ...(width && (typeof width === 'string' || typeof width === 'number') ? {
420
- width
421
- } : {}),
294
+ ...width && (typeof width === "string" || typeof width === "number") ? { width } : {},
422
295
  ...restModalProps
423
296
  });
424
297
  };
425
- return /*#__PURE__*/_jsx("div", {
426
- className: cls,
427
- style: {
428
- ...style,
429
- ...(hasFixedTop ? {
430
- top: fixedTop
431
- } : {}),
432
- zIndex
433
- },
434
- "data-pro-step-sticky-header": hasFixedTop ? 'true' : undefined,
435
- children: finalTitle ? /*#__PURE__*/_jsx("div", {
436
- className: "pro-header-title",
437
- children: finalTitle
438
- }) : /*#__PURE__*/_jsxs(_Fragment, {
439
- children: [/*#__PURE__*/_jsxs("div", {
440
- className: "pro-header-top",
441
- children: [/*#__PURE__*/_jsx("div", {
442
- className: classnames({
443
- 'pro-header-left': true,
444
- 'pro-header-left-space': !backState
445
- }),
446
- children: /*#__PURE__*/_jsxs(Space, {
447
- size: backState ? 4 : 0,
448
- children: [backState ? /*#__PURE__*/_jsx(ProBackBtn, {
449
- onBack: onConfirm
450
- }) : null, /*#__PURE__*/_jsx(Breadcrumb, {
451
- separator: ">",
452
- items: breadcrumbRender()
453
- }), infoRender()]
454
- })
455
- }), /*#__PURE__*/_jsx("div", {
456
- className: "pro-header-right",
457
- children: actionsRender()
458
- })]
459
- }), describeRender(describeColumns), !_isEmpty(finalSubDescribeColumns) ? /*#__PURE__*/_jsxs("div", {
460
- className: classnames({
461
- 'pro-header-nav': true,
462
- 'pro-header-nav-open': fold,
463
- 'pro-header-nav-hidden': !fold
464
- }),
465
- children: [/*#__PURE__*/_jsx("ul", {
466
- children: finalSubDescribeColumns.map((item, index) => {
467
- return /*#__PURE__*/_jsx("li", {
468
- children: subDescribeRender(item)
469
- }, getSubDescribeKey(item, index));
470
- })
471
- }), /*#__PURE__*/_jsx("div", {
472
- className: "pro-header-fold",
473
- children: /*#__PURE__*/_jsx("div", {
474
- className: "pro-header-fold-bg",
475
- onClick: toggle,
476
- children: /*#__PURE__*/_jsx(ReactSVG, {
477
- className: "fold-icon",
478
- src: foldSvg
479
- }, "copy-icon")
480
- })
481
- })]
482
- }) : null]
483
- })
484
- });
298
+ return /* @__PURE__ */ jsx(
299
+ "div",
300
+ {
301
+ className: cls,
302
+ style: { ...style, ...hasFixedTop ? { top: fixedTop } : {}, zIndex },
303
+ "data-pro-step-sticky-header": hasFixedTop ? "true" : void 0,
304
+ children: finalTitle ? /* @__PURE__ */ jsx("div", { className: "pro-header-title", children: finalTitle }) : /* @__PURE__ */ jsxs(Fragment, { children: [
305
+ /* @__PURE__ */ jsxs("div", { className: "pro-header-top", children: [
306
+ /* @__PURE__ */ jsx(
307
+ "div",
308
+ {
309
+ className: classnames({
310
+ "pro-header-left": true,
311
+ "pro-header-left-space": !backState
312
+ }),
313
+ children: /* @__PURE__ */ jsxs(Space, { size: backState ? 4 : 0, children: [
314
+ backState ? /* @__PURE__ */ jsx(ProBackBtn, { onBack: onConfirm }) : null,
315
+ /* @__PURE__ */ jsx(Breadcrumb, { separator: ">", items: breadcrumbRender() }),
316
+ infoRender()
317
+ ] })
318
+ }
319
+ ),
320
+ /* @__PURE__ */ jsx("div", { className: "pro-header-right", children: actionsRender() })
321
+ ] }),
322
+ describeRender(describeColumns),
323
+ !isEmpty(finalSubDescribeColumns) ? /* @__PURE__ */ jsxs(
324
+ "div",
325
+ {
326
+ className: classnames({
327
+ "pro-header-nav": true,
328
+ "pro-header-nav-open": fold,
329
+ "pro-header-nav-hidden": !fold
330
+ }),
331
+ children: [
332
+ /* @__PURE__ */ jsx("ul", { children: finalSubDescribeColumns.map((item, index) => {
333
+ return /* @__PURE__ */ jsx("li", { children: subDescribeRender(item) }, getSubDescribeKey(item, index));
334
+ }) }),
335
+ /* @__PURE__ */ jsx("div", { className: "pro-header-fold", children: /* @__PURE__ */ jsx("div", { className: "pro-header-fold-bg", onClick: toggle, children: /* @__PURE__ */ jsx(ReactSVG, { className: "fold-icon", src: foldSvg }, "copy-icon") }) })
336
+ ]
337
+ }
338
+ ) : null
339
+ ] })
340
+ }
341
+ );
342
+ };
343
+ var ProHeader_default = memo(ProHeader);
344
+ export {
345
+ ProHeader_default as default
485
346
  };
486
- export default /*#__PURE__*/memo(ProHeader);