@zat-design/sisyphus-react 3.4.5 → 3.4.6-beta.10

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 (137) hide show
  1. package/dist/index.esm.css +151 -35
  2. package/dist/less.esm.css +151 -35
  3. package/es/ProConfigProvider/index.d.ts +2 -2
  4. package/es/ProConfigProvider/index.js +0 -3
  5. package/es/ProEditTable/components/RenderField/index.js +56 -48
  6. package/es/ProEditTable/index.js +3 -3
  7. package/es/ProEditTable/style/index.less +5 -7
  8. package/es/ProEditTable/utils/tools.d.ts +12 -0
  9. package/es/ProEditTable/utils/tools.js +79 -2
  10. package/es/ProForm/components/base/RangePicker/index.js +9 -9
  11. package/es/ProForm/components/base/TextArea/index.d.ts +1 -0
  12. package/es/ProForm/components/base/TextArea/index.js +4 -2
  13. package/es/ProForm/components/combination/Container/index.js +3 -2
  14. package/es/ProForm/components/combination/Container/style/index.less +5 -1
  15. package/es/ProForm/components/combination/FormList/index.js +1 -0
  16. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  17. package/es/ProForm/components/combination/ProCascader/index.js +256 -0
  18. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  19. package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  20. package/es/ProForm/components/combination/ProCascader/utils/index.js +26 -0
  21. package/es/ProForm/components/combination/ProModalSelect/index.js +47 -33
  22. package/es/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  23. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  24. package/es/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  25. package/es/ProForm/components/index.d.ts +1 -2
  26. package/es/ProForm/components/index.js +1 -4
  27. package/es/ProForm/components/render/Render.js +25 -20
  28. package/es/ProForm/components/render/RenderFields.js +4 -1
  29. package/es/ProForm/components/render/propsType.d.ts +5 -8
  30. package/es/ProForm/index.js +6 -2
  31. package/es/ProForm/propsType.d.ts +3 -0
  32. package/es/ProForm/style/index.less +2 -1
  33. package/es/ProForm/utils/index.d.ts +6 -1
  34. package/es/ProForm/utils/index.js +9 -6
  35. package/es/ProForm/utils/useChanged.js +1 -2
  36. package/es/ProForm/utils/useForm.js +19 -6
  37. package/es/ProForm/utils/useListChanged.js +1 -3
  38. package/es/ProIcon/config/index.d.ts +2 -0
  39. package/es/ProIcon/config/index.js +4 -2
  40. package/es/ProIcon/index.js +148 -81
  41. package/es/ProIcon/propsTypes.d.ts +6 -1
  42. package/es/ProIcon/utils/index.d.ts +5 -0
  43. package/es/ProIcon/utils/index.js +60 -0
  44. package/es/ProLayout/components/ProCollapse/index.js +6 -3
  45. package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
  46. package/es/ProSelect/index.js +15 -3
  47. package/es/ProSelect/propsType.d.ts +2 -0
  48. package/es/ProSelect/utils/index.d.ts +9 -0
  49. package/es/ProSelect/utils/index.js +60 -0
  50. package/es/ProStep/components/Step/index.js +4 -3
  51. package/es/ProStep/style/index.less +37 -0
  52. package/es/ProTable/utils.js +6 -3
  53. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  54. package/es/ProThemeTools/component/PrdTools/index.js +16 -6
  55. package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
  56. package/es/ProTree/components/ProTree.js +96 -74
  57. package/es/ProTree/components/ProTreeSelect/index.js +5 -9
  58. package/es/ProTree/components/ProTreeSelect/style/index.less +6 -8
  59. package/es/ProTree/components/Tree.js +63 -41
  60. package/es/ProTree/style/index.less +38 -16
  61. package/es/ProUpload/index.js +11 -13
  62. package/es/ProUpload/propsType.d.ts +8 -3
  63. package/es/assets/view.svg +2 -2
  64. package/es/global.less +37 -28
  65. package/lib/ProConfigProvider/index.d.ts +2 -2
  66. package/lib/ProConfigProvider/index.js +0 -3
  67. package/lib/ProEditTable/components/RenderField/index.js +54 -46
  68. package/lib/ProEditTable/index.js +3 -3
  69. package/lib/ProEditTable/style/index.less +5 -7
  70. package/lib/ProEditTable/utils/tools.d.ts +12 -0
  71. package/lib/ProEditTable/utils/tools.js +80 -2
  72. package/lib/ProForm/components/base/RangePicker/index.js +9 -9
  73. package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
  74. package/lib/ProForm/components/base/TextArea/index.js +4 -2
  75. package/lib/ProForm/components/combination/Container/index.js +3 -2
  76. package/lib/ProForm/components/combination/Container/style/index.less +5 -1
  77. package/lib/ProForm/components/combination/FormList/index.js +1 -0
  78. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  79. package/lib/ProForm/components/combination/ProCascader/index.js +256 -0
  80. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  81. package/lib/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  82. package/lib/ProForm/components/combination/ProCascader/utils/index.js +33 -0
  83. package/lib/ProForm/components/combination/ProModalSelect/index.js +46 -32
  84. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  85. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  86. package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  87. package/lib/ProForm/components/index.d.ts +1 -2
  88. package/lib/ProForm/components/index.js +1 -8
  89. package/lib/ProForm/components/render/Render.js +25 -20
  90. package/lib/ProForm/components/render/RenderFields.js +4 -1
  91. package/lib/ProForm/components/render/propsType.d.ts +5 -8
  92. package/lib/ProForm/index.js +5 -1
  93. package/lib/ProForm/propsType.d.ts +3 -0
  94. package/lib/ProForm/style/index.less +2 -1
  95. package/lib/ProForm/utils/index.d.ts +6 -1
  96. package/lib/ProForm/utils/index.js +9 -6
  97. package/lib/ProForm/utils/useChanged.js +1 -2
  98. package/lib/ProForm/utils/useForm.js +19 -6
  99. package/lib/ProForm/utils/useListChanged.js +1 -3
  100. package/lib/ProIcon/config/index.d.ts +2 -0
  101. package/lib/ProIcon/config/index.js +4 -2
  102. package/lib/ProIcon/index.js +144 -77
  103. package/lib/ProIcon/propsTypes.d.ts +6 -1
  104. package/lib/ProIcon/utils/index.d.ts +5 -0
  105. package/lib/ProIcon/utils/index.js +62 -1
  106. package/lib/ProLayout/components/ProCollapse/index.js +6 -3
  107. package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
  108. package/lib/ProSelect/index.js +15 -3
  109. package/lib/ProSelect/propsType.d.ts +2 -0
  110. package/lib/ProSelect/utils/index.d.ts +9 -0
  111. package/lib/ProSelect/utils/index.js +68 -0
  112. package/lib/ProStep/components/Step/index.js +4 -3
  113. package/lib/ProStep/style/index.less +37 -0
  114. package/lib/ProTable/utils.js +6 -3
  115. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  116. package/lib/ProThemeTools/component/PrdTools/index.js +16 -6
  117. package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
  118. package/lib/ProTree/components/ProTree.js +96 -74
  119. package/lib/ProTree/components/ProTreeSelect/index.js +5 -9
  120. package/lib/ProTree/components/ProTreeSelect/style/index.less +6 -8
  121. package/lib/ProTree/components/Tree.js +63 -41
  122. package/lib/ProTree/style/index.less +38 -16
  123. package/lib/ProUpload/index.js +10 -12
  124. package/lib/ProUpload/propsType.d.ts +8 -3
  125. package/lib/assets/view.svg +2 -2
  126. package/lib/global.less +37 -28
  127. package/package.json +2 -2
  128. package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
  129. package/es/ProForm/components/base/ProCascader/index.js +0 -72
  130. package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
  131. package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
  132. package/lib/ProForm/components/base/ProCascader/index.js +0 -78
  133. package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
  134. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  135. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
  136. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  137. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
@@ -2,21 +2,25 @@ import "antd/es/button/style";
2
2
  import _Button from "antd/es/button";
3
3
  import "antd/es/tooltip/style";
4
4
  import _Tooltip from "antd/es/tooltip";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
7
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
- var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap"];
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- import { useExternal } from 'ahooks';
8
+ var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip"];
9
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
10
+ import { useExternal, useLocalStorageState, useSetState, useDeepCompareLayoutEffect } from 'ahooks';
10
11
  import classNames from 'classnames';
11
12
  import { uniqBy } from 'lodash';
12
13
  import { ReactSVG } from 'react-svg';
14
+ import { useEffect } from 'react';
13
15
  import { useProConfig } from '../ProConfigProvider';
14
- import { iconMap, themeMap, themeFillMap } from './config';
15
- import { recurseGetNodes } from './utils';
16
+ import { iconMap } from './config';
17
+ import { onBeforeInjection } from './utils';
16
18
  import locale from '../locale';
17
19
  var ProIcon = function ProIcon(props) {
20
+ var _window, _window2;
18
21
  var _useProConfig = useProConfig(),
19
- state = _useProConfig.state;
22
+ state = _useProConfig.state,
23
+ dispatch = _useProConfig.dispatch;
20
24
  var config = state.ProIcon,
21
25
  antdTheme = state.theme;
22
26
  var _config = _objectSpread(_objectSpread({}, config), props !== null && props !== void 0 ? props : {});
@@ -44,11 +48,28 @@ var ProIcon = function ProIcon(props) {
44
48
  mapList = _config$mapList === void 0 ? [] : _config$mapList,
45
49
  src = _config.src,
46
50
  actionMap = _config.actionMap,
51
+ tooltip = _config.tooltip,
47
52
  reset = _objectWithoutProperties(_config, _excluded);
48
- // 主题色
53
+ var _useSetState = useSetState({
54
+ IconInstance: _jsx(_Fragment, {})
55
+ }),
56
+ _useSetState2 = _slicedToArray(_useSetState, 2),
57
+ IconInstance = _useSetState2[0].IconInstance,
58
+ setState = _useSetState2[1];
59
+ // 主题色 primaryColor 用于单应用或处于组件库文档内 qiankunPrimaryColor用于主子应用
49
60
  var _ref = antdTheme !== null && antdTheme !== void 0 ? antdTheme : {},
50
61
  _ref$primaryColor = _ref.primaryColor,
51
- primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor;
62
+ primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor,
63
+ _ref$qiankunPrimaryCo = _ref.qiankunPrimaryColor,
64
+ qiankunPrimaryColor = _ref$qiankunPrimaryCo === void 0 ? '#006AFF' : _ref$qiankunPrimaryCo;
65
+ // 本地存储初始化主题
66
+ var _useLocalStorageState = useLocalStorageState('themeConfig'),
67
+ _useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
68
+ themeConfig = _useLocalStorageState2[0];
69
+ // 文档内部就不用判断window.top !== window.self了
70
+ var isQiankun =
71
+ // @ts-ignore
72
+ ((_window = window) === null || _window === void 0 ? void 0 : _window.__POWERED_BY_QIANKUN__) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.isMicroApp);
52
73
  // 语言
53
74
  var language = locale.ProIcon.language;
54
75
  // 加载内部icon
@@ -64,6 +85,8 @@ var ProIcon = function ProIcon(props) {
64
85
  'pro-icon-btn': disabled
65
86
  });
66
87
  var _mode = mode || 'icon';
88
+ // 观察者实例
89
+ var observer;
67
90
  // 特殊情况,如果指定了type,并且没有接收到组件内的mode,那模式就是icon
68
91
  if (type && !props.mode) {
69
92
  _mode = 'icon';
@@ -75,7 +98,7 @@ var ProIcon = function ProIcon(props) {
75
98
  var _type = type;
76
99
  var _text = children;
77
100
  // svg图标对应文本
78
- var iconText = '';
101
+ var iconText = tooltip || '';
79
102
  var typeIsExistAndIncludeEnglish = _type && /[a-zA-Z]/.test(_type);
80
103
  // 模式为icon下,对传入的text进行指定语言-icon 映射
81
104
  if (isIconMode && !type) {
@@ -116,82 +139,126 @@ var ProIcon = function ProIcon(props) {
116
139
  }, reset), {}, {
117
140
  children: _jsx(_Tooltip, {
118
141
  title: iconText,
119
- children: !src ? _jsx("svg", _objectSpread(_objectSpread({}, svgProps), {}, {
120
- onClick: onClick,
121
- "aria-hidden": "true",
122
- children: _jsx("use", {
123
- xlinkHref: "#icon-".concat(_type)
124
- })
125
- })) : _jsx(ReactSVG, _objectSpread(_objectSpread({}, svgProps), {}, {
126
- // @ts-ignore
127
- onClick: onClick,
128
- "aria-hidden": "true",
129
- src: src,
130
- beforeInjection: function beforeInjection(svg) {
131
- if (actionMap && svg) {
132
- var _actionMap$themeMap, _actionMap$themeFillM, _actionMap$gradation, _actionMap$fill;
133
- // 项目内置的四种主题匹配渐变色
134
- var mergeThemeMap = _objectSpread(_objectSpread({}, themeMap), (_actionMap$themeMap = actionMap.themeMap) !== null && _actionMap$themeMap !== void 0 ? _actionMap$themeMap : {});
135
- // 项目内置的四种双色匹配fill
136
- var mergeFillThemeMap = _objectSpread(_objectSpread({}, themeFillMap), (_actionMap$themeFillM = actionMap.themeFillMap) !== null && _actionMap$themeFillM !== void 0 ? _actionMap$themeFillM : {});
137
- var _gradList = mergeThemeMap[primaryColor];
138
- var _fillList = mergeFillThemeMap[primaryColor];
139
- // 渐变操作序列
140
- var gradList = (_actionMap$gradation = actionMap === null || actionMap === void 0 ? void 0 : actionMap.gradation) !== null && _actionMap$gradation !== void 0 ? _actionMap$gradation : _gradList;
141
- // 填充操作序列
142
- var fillList = (_actionMap$fill = actionMap === null || actionMap === void 0 ? void 0 : actionMap.fill) !== null && _actionMap$fill !== void 0 ? _actionMap$fill : _fillList;
143
- // 节点收集
144
- var nodeMap = {
145
- // 渐变色节点收集
146
- gradation: [],
147
- // 具有fill属性的节点收集
148
- fill: []
149
- };
150
- // 目前只支持处理渐变及fill填充
151
- var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
152
- types.forEach(function (typeKey) {
153
- recurseGetNodes(typeKey, svg, nodeMap[typeKey]);
142
+ children: _jsx(_Button, _objectSpread({
143
+ style: {
144
+ width: size,
145
+ height: size,
146
+ border: 'none',
147
+ borderRadius: 0,
148
+ padding: 0,
149
+ verticalAlign: 'baseline'
150
+ },
151
+ type: "text",
152
+ icon: !src ? _jsx("svg", _objectSpread(_objectSpread({}, svgProps), {}, {
153
+ onClick: onClick,
154
+ "aria-hidden": "true",
155
+ children: _jsx("use", {
156
+ xlinkHref: "#icon-".concat(_type)
157
+ })
158
+ })) : _jsx(ReactSVG, _objectSpread(_objectSpread({}, svgProps), {}, {
159
+ // @ts-ignore
160
+ onClick: onClick,
161
+ "aria-hidden": "true",
162
+ src: src,
163
+ beforeInjection: function beforeInjection(svg) {
164
+ onBeforeInjection({
165
+ svg: svg,
166
+ actionMap: actionMap,
167
+ primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
154
168
  });
155
- if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
156
- nodeMap.gradation.forEach(function (item, index) {
157
- // 下一步准备替换的
158
- var nextStr = gradList[index];
159
- // 属性原本的值
160
- var originStr = item.getAttribute('stop-color');
161
- if (nextStr && originStr !== nextStr) {
162
- item.setAttribute('stop-color', nextStr);
163
- }
164
- });
165
- }
166
- if ((fillList === null || fillList === void 0 ? void 0 : fillList.length) > 0) {
167
- nodeMap.fill.forEach(function (item, index) {
168
- // 默认接收的
169
- var receiveStr = fillList[index];
170
- // 下一步准备替换的
171
- var nextFillStr = receiveStr === 'theme' ? primaryColor : receiveStr;
172
- // 属性原本的值
173
- var originFill = item.getAttribute('fill');
174
- // 如果包含url(则是内链,不作替换处理
175
- if (!(originFill && originFill.includes('url(')) && nextFillStr) {
176
- // 不同才替换
177
- if (originFill !== nextFillStr) {
178
- item.setAttribute('fill', nextFillStr);
169
+ }
170
+ }))
171
+ }, buttonProps))
172
+ })
173
+ }));
174
+ useEffect(function () {
175
+ // 处于主子应用情况下才会执行下方逻辑,主题色的变更以主框架的为准
176
+ if (actionMap && isQiankun) {
177
+ var _themeConfig$data;
178
+ observer = new MutationObserver(function (mutationsList) {
179
+ var targetEntries = mutationsList[0];
180
+ if (targetEntries) {
181
+ if (targetEntries && targetEntries.target) {
182
+ var _Object$values, _Object$values$find, _Object$values$find$v3, _targetEntries$target, _targetEntries$target2;
183
+ var _Object$values$find$v = // @ts-ignore
184
+ (_Object$values = Object.values((_targetEntries$target = targetEntries === null || targetEntries === void 0 ? void 0 : (_targetEntries$target2 = targetEntries.target) === null || _targetEntries$target2 === void 0 ? void 0 : _targetEntries$target2.attributes) !== null && _targetEntries$target !== void 0 ? _targetEntries$target : {})) === null || _Object$values === void 0 ? void 0 : (_Object$values$find = _Object$values.find(function (item) {
185
+ return item.nodeName === 'style';
186
+ })
187
+ // @ts-ignore
188
+ ) === null || _Object$values$find === void 0 ? void 0 : (_Object$values$find$v3 = _Object$values$find.value) === null || _Object$values$find$v3 === void 0 ? void 0 : _Object$values$find$v3.match(/--zaui-brand:(.*?);/),
189
+ _Object$values$find$v2 = _slicedToArray(_Object$values$find$v, 2),
190
+ label = _Object$values$find$v2[0],
191
+ value = _Object$values$find$v2[1];
192
+ if (label && value) {
193
+ if (qiankunPrimaryColor !== value) {
194
+ dispatch({
195
+ type: 'set',
196
+ payload: {
197
+ theme: {
198
+ primaryColor: primaryColor,
199
+ qiankunPrimaryColor: value === null || value === void 0 ? void 0 : value.trim()
200
+ }
179
201
  }
180
- }
181
- });
202
+ });
203
+ }
182
204
  }
183
205
  }
184
206
  }
185
- }))
186
- })
187
- }));
188
- return !isExtendButtonMode ? RenderIcon : _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({
189
- type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
190
- className: proIconClassNames,
191
- disabled: disabled,
192
- icon: isIconMode ? RenderIcon : null
193
- }, reset), buttonProps), {}, {
194
- children: _text
195
- }));
207
+ });
208
+ var zaAccessibilityTarget = document.documentElement;
209
+ if (window.parent === window) {
210
+ // 在最顶层的window环境中,可以直接使用document
211
+ zaAccessibilityTarget = document.documentElement;
212
+ } else {
213
+ // 向上遍历直到找到主应用的window
214
+ var currentWindow = window;
215
+ while (currentWindow.parent !== currentWindow) {
216
+ // @ts-ignore
217
+ currentWindow = currentWindow.parent;
218
+ }
219
+ zaAccessibilityTarget = currentWindow.document.documentElement;
220
+ }
221
+ observer.observe(zaAccessibilityTarget, {
222
+ attributes: true,
223
+ attributeFilter: ['style']
224
+ });
225
+ // 未变更时及初始化时
226
+ var extendFromMainColor = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiBrand;
227
+ if (extendFromMainColor && qiankunPrimaryColor !== extendFromMainColor) {
228
+ dispatch({
229
+ type: 'set',
230
+ payload: {
231
+ theme: {
232
+ primaryColor: primaryColor,
233
+ qiankunPrimaryColor: extendFromMainColor
234
+ }
235
+ }
236
+ });
237
+ }
238
+ }
239
+ }, []);
240
+ useEffect(function () {
241
+ return function () {
242
+ if (observer) {
243
+ observer.disconnect();
244
+ }
245
+ };
246
+ }, []);
247
+ useDeepCompareLayoutEffect(function () {
248
+ setState({
249
+ IconInstance: RenderIcon
250
+ });
251
+ }, [_config, primaryColor, qiankunPrimaryColor, language, svgProps]);
252
+ return !isExtendButtonMode ? IconInstance : _jsx(_Tooltip, {
253
+ title: tooltip,
254
+ children: _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({
255
+ type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
256
+ className: proIconClassNames,
257
+ disabled: disabled,
258
+ icon: isIconMode ? RenderIcon : null
259
+ }, reset), buttonProps), {}, {
260
+ children: _text
261
+ }))
262
+ });
196
263
  };
197
264
  export default ProIcon;
@@ -54,6 +54,11 @@ export interface ProIconProps {
54
54
  * @default false
55
55
  */
56
56
  disabled?: boolean;
57
+ /**
58
+ * @description 提示
59
+ * @default -
60
+ */
61
+ tooltip?: string | React.ReactNode;
57
62
  /**
58
63
  * @description 是否跟随主题色
59
64
  * @default false
@@ -80,7 +85,7 @@ export interface ProIconProps {
80
85
  */
81
86
  mode?: ModeType;
82
87
  /**
83
- * @description mode button时 props
88
+ * @description mode button时 props 与antd Button接收props一致
84
89
  * @default 'link'
85
90
  */
86
91
  buttonProps?: ButtonProps;
@@ -1 +1,6 @@
1
1
  export declare const recurseGetNodes: (type: any, node: any, queue: any) => void;
2
+ export declare const onBeforeInjection: ({ svg, actionMap, primaryColor }: {
3
+ svg: any;
4
+ actionMap: any;
5
+ primaryColor: any;
6
+ }) => void;
@@ -1,3 +1,5 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { themeMap, themeFillMap } from '../config';
1
3
  export var recurseGetNodes = function recurseGetNodes(type, node, queue) {
2
4
  switch (type) {
3
5
  // 渐变
@@ -20,4 +22,62 @@ export var recurseGetNodes = function recurseGetNodes(type, node, queue) {
20
22
  recurseGetNodes(type, node.childNodes[i], queue);
21
23
  }
22
24
  }
25
+ };
26
+ export var onBeforeInjection = function onBeforeInjection(_ref) {
27
+ var svg = _ref.svg,
28
+ actionMap = _ref.actionMap,
29
+ primaryColor = _ref.primaryColor;
30
+ if (actionMap && svg) {
31
+ var _actionMap$themeMap, _actionMap$themeFillM, _actionMap$gradation, _actionMap$fill;
32
+ // 项目内置的四种主题匹配渐变色
33
+ var mergeThemeMap = _objectSpread(_objectSpread({}, themeMap), (_actionMap$themeMap = actionMap.themeMap) !== null && _actionMap$themeMap !== void 0 ? _actionMap$themeMap : {});
34
+ // 项目内置的四种双色匹配fill
35
+ var mergeFillThemeMap = _objectSpread(_objectSpread({}, themeFillMap), (_actionMap$themeFillM = actionMap.themeFillMap) !== null && _actionMap$themeFillM !== void 0 ? _actionMap$themeFillM : {});
36
+ var _gradList = mergeThemeMap[primaryColor];
37
+ var _fillList = mergeFillThemeMap[primaryColor];
38
+ // 渐变操作序列
39
+ var gradList = (_actionMap$gradation = actionMap === null || actionMap === void 0 ? void 0 : actionMap.gradation) !== null && _actionMap$gradation !== void 0 ? _actionMap$gradation : _gradList;
40
+ // 填充操作序列
41
+ var fillList = (_actionMap$fill = actionMap === null || actionMap === void 0 ? void 0 : actionMap.fill) !== null && _actionMap$fill !== void 0 ? _actionMap$fill : _fillList;
42
+ // 节点收集
43
+ var nodeMap = {
44
+ // 渐变色节点收集
45
+ gradation: [],
46
+ // 具有fill属性的节点收集
47
+ fill: []
48
+ };
49
+ // 目前只支持处理渐变及fill填充
50
+ var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
51
+ types.forEach(function (typeKey) {
52
+ recurseGetNodes(typeKey, svg, nodeMap[typeKey]);
53
+ });
54
+ if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
55
+ nodeMap.gradation.forEach(function (item, index) {
56
+ // 下一步准备替换的
57
+ var nextStr = gradList[index];
58
+ // 属性原本的值
59
+ var originStr = item.getAttribute('stop-color');
60
+ if (nextStr && originStr !== nextStr) {
61
+ item.setAttribute('stop-color', nextStr);
62
+ }
63
+ });
64
+ }
65
+ if ((fillList === null || fillList === void 0 ? void 0 : fillList.length) > 0) {
66
+ nodeMap.fill.forEach(function (item, index) {
67
+ // 默认接收的
68
+ var receiveStr = fillList[index];
69
+ // 下一步准备替换的
70
+ var nextFillStr = receiveStr === 'theme' ? primaryColor : receiveStr;
71
+ // 属性原本的值
72
+ var originFill = item.getAttribute('fill');
73
+ // 如果包含url(则是内链,不作替换处理
74
+ if (!(originFill && originFill.includes('url(')) && nextFillStr) {
75
+ // 不同才替换
76
+ if (originFill !== nextFillStr) {
77
+ item.setAttribute('fill', nextFillStr);
78
+ }
79
+ }
80
+ });
81
+ }
82
+ }
23
83
  };
@@ -10,9 +10,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  import { useLayoutEffect } from 'react';
11
11
  import { CaretRightOutlined } from '@ant-design/icons';
12
12
  import classNames from 'classnames';
13
- import { ReactSVG } from 'react-svg';
14
13
  import { isBoolean } from 'lodash';
15
14
  import foldSvg from '../../../assets/fold.svg';
15
+ import ProIcon from '../../../ProIcon/index';
16
16
  var Panel = _Collapse.Panel;
17
17
  var ProCollapse = function ProCollapse(props) {
18
18
  var title = props.title,
@@ -77,8 +77,11 @@ var ProCollapse = function ProCollapse(props) {
77
77
  align: "center",
78
78
  children: [_jsx("div", {
79
79
  className: "pro-collapse-icon",
80
- children: isBoolean(icon) ? _jsx(ReactSVG, {
81
- src: foldSvg
80
+ children: isBoolean(icon) ? _jsx(ProIcon, {
81
+ src: foldSvg,
82
+ actionMap: {
83
+ fill: []
84
+ }
82
85
  }) : icon
83
86
  }), title]
84
87
  });
@@ -16,7 +16,7 @@
16
16
  }
17
17
  .pro-collapse-level2{
18
18
  .@{ant-prefix}-collapse-header {
19
- display: block !important;
19
+ display: flex !important;
20
20
  }
21
21
  }
22
22
  }
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
9
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
10
10
  import "antd/es/select/style";
11
11
  import _Select from "antd/es/select";
12
- var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
12
+ var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
15
15
  import React, { useImperativeHandle, useState, forwardRef } from 'react';
@@ -19,6 +19,7 @@ import Container from '../ProForm/components/Container';
19
19
  import AdaptiveTooltip from './components/AdaptiveTooltip';
20
20
  import { ProForm } from '..';
21
21
  import locale from '../locale';
22
+ import { getSelectList } from './utils';
22
23
  import './index.less';
23
24
  var Option = _Select.Option;
24
25
  export var ProSelect = function ProSelect(props, ref) {
@@ -41,6 +42,8 @@ export var ProSelect = function ProSelect(props, ref) {
41
42
  tooltip = _props$tooltip === void 0 ? false : _props$tooltip,
42
43
  otherProps = props.otherProps,
43
44
  labelInValue = props.labelInValue,
45
+ _props$filterInList = props.filterInList,
46
+ filterInList = _props$filterInList === void 0 ? false : _props$filterInList,
44
47
  _props$scrollFollowPa = props.scrollFollowParent,
45
48
  scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa,
46
49
  defaultOne = props.defaultOne,
@@ -239,7 +242,7 @@ export var ProSelect = function ProSelect(props, ref) {
239
242
  if (!isObject(value)) {
240
243
  return undefined;
241
244
  }
242
- return value === null || value === void 0 ? void 0 : value[code];
245
+ return (value === null || value === void 0 ? void 0 : value[code]) || (value === null || value === void 0 ? void 0 : value.value);
243
246
  }
244
247
  if (labelInValue && selectProps.mode) {
245
248
  // 对传入的值做一些基础判断
@@ -265,6 +268,15 @@ export var ProSelect = function ProSelect(props, ref) {
265
268
  }
266
269
  return value;
267
270
  };
271
+ var newSelectList = selectList;
272
+ if ((otherProps === null || otherProps === void 0 ? void 0 : otherProps.listName) && filterInList) {
273
+ newSelectList = getSelectList({
274
+ otherProps: otherProps,
275
+ value: props.value,
276
+ dataSource: selectList,
277
+ labelInValue: labelInValue
278
+ });
279
+ }
268
280
  return _jsx(_Select, _objectSpread(_objectSpread({
269
281
  placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProSelect = locale.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
270
282
  allowClear: true,
@@ -287,7 +299,7 @@ export var ProSelect = function ProSelect(props, ref) {
287
299
  }
288
300
  }, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name'])), {}, {
289
301
  value: transformValue(),
290
- children: Array.isArray(selectList) && selectList.map(function (item) {
302
+ children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
291
303
  return _jsx(Option, {
292
304
  value: item[code],
293
305
  record: item,
@@ -14,6 +14,8 @@ export interface PropSelectProps extends Omit<SelectProps, 'onSearch'> {
14
14
  defaultOne?: boolean;
15
15
  /** 数据源 */
16
16
  dataSource?: DataOption[];
17
+ /** list场景中过滤掉已选择的值 */
18
+ filterInList?: boolean;
17
19
  /** @deprecated 兼容 2.0 版本、3.0 使用view 模式 */
18
20
  defaultDisableValue?: string;
19
21
  /** 是否展示 tooltip、当 label 特别长的时候使用 */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 返回当前组件可以显示的数据源
3
+ */
4
+ export declare const getSelectList: ({ otherProps, value, dataSource, labelInValue, }: {
5
+ otherProps: any;
6
+ value: any;
7
+ dataSource: any;
8
+ labelInValue: any;
9
+ }) => any;
@@ -0,0 +1,60 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ /* eslint-disable no-restricted-syntax */
3
+ import _ from 'lodash';
4
+ var findSelectNameValues = function findSelectNameValues(_ref) {
5
+ var list = _ref.list,
6
+ selectName = _ref.selectName,
7
+ value = _ref.value,
8
+ dataSource = _ref.dataSource,
9
+ labelInValue = _ref.labelInValue;
10
+ var selectValues = [];
11
+ list.forEach(function (item) {
12
+ var result = item;
13
+ if (!item || !Object.keys(item).length || Object.keys(item).length === 1 && 'rowKey' in item) {
14
+ return false;
15
+ }
16
+ var _iterator = _createForOfIteratorHelper(selectName),
17
+ _step;
18
+ try {
19
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
20
+ var key = _step.value;
21
+ result = result[key];
22
+ }
23
+ } catch (err) {
24
+ _iterator.e(err);
25
+ } finally {
26
+ _iterator.f();
27
+ }
28
+ selectValues.push(result);
29
+ });
30
+ var diffList = _.difference(selectValues, [value]);
31
+ return dataSource.filter(function (item) {
32
+ return !diffList.includes(labelInValue ? item : item.value);
33
+ });
34
+ };
35
+ /**
36
+ * 返回当前组件可以显示的数据源
37
+ */
38
+ export var getSelectList = function getSelectList(_ref2) {
39
+ var otherProps = _ref2.otherProps,
40
+ value = _ref2.value,
41
+ dataSource = _ref2.dataSource,
42
+ labelInValue = _ref2.labelInValue;
43
+ if (!otherProps) {
44
+ return null;
45
+ }
46
+ var listName = otherProps.listName,
47
+ form = otherProps.form;
48
+ var firstNumberIndex = listName.findIndex(function (item) {
49
+ return typeof item === 'number';
50
+ });
51
+ var fatherName = listName.slice(0, firstNumberIndex);
52
+ var selectName = listName.slice(firstNumberIndex + 1);
53
+ return findSelectNameValues({
54
+ list: form.getFieldValue(fatherName),
55
+ selectName: selectName,
56
+ value: value,
57
+ dataSource: dataSource,
58
+ labelInValue: labelInValue
59
+ });
60
+ };
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import React, { useMemo, useState } from 'react';
5
5
  import { cloneDeep } from 'lodash';
6
- import { ReactSVG } from 'react-svg';
6
+ import ProIcon from '../../../ProIcon/index';
7
7
  import catalogSvg from '../../../assets/catalog.svg';
8
8
  import Anchor from '../Anchor';
9
9
  import locale from '../../../locale';
@@ -59,9 +59,10 @@ export var Step = function Step(_ref) {
59
59
  onMouseLeave: handleMouseLeave,
60
60
  children: [_jsxs("div", {
61
61
  className: "step-menu",
62
- children: [_jsx(ReactSVG, {
62
+ children: [_jsx(ProIcon, {
63
+ src: catalogSvg,
63
64
  className: "menu-icon",
64
- src: catalogSvg
65
+ actionMap: {}
65
66
  }), onOff && _jsx("div", {
66
67
  children: locale === null || locale === void 0 ? void 0 : (_locale$ProStep = locale.ProStep) === null || _locale$ProStep === void 0 ? void 0 : _locale$ProStep.catalogue
67
68
  })]
@@ -27,6 +27,43 @@
27
27
  height: 48px;
28
28
  font-size: var(--zaui-font-size-lg, 16px);
29
29
  border-bottom: 1px solid var(--zaui-line, #dddddd);
30
+ > .anticon {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ width: 48px;
35
+ height: 24px;
36
+ > .menu-icon {
37
+ width: auto !important;
38
+ height: auto !important;
39
+ font-size: var(--zaui-font-size-lg-title, 24px);
40
+ fill: var(--zaui-brand, #006aff);
41
+ > div {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: 48px;
46
+ height: 24px;
47
+ }
48
+ }
49
+ > button {
50
+ width: auto !important;
51
+ height: auto !important;
52
+ > .menu-icon {
53
+ width: auto !important;
54
+ height: auto !important;
55
+ font-size: var(--zaui-font-size-lg-title, 24px);
56
+ fill: var(--zaui-brand, #006aff);
57
+ > div {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ width: 48px;
62
+ height: 24px;
63
+ }
64
+ }
65
+ }
66
+ }
30
67
 
31
68
  > .menu-icon {
32
69
  font-size: var(--zaui-font-size-lg-title, 24px);
@@ -269,19 +269,22 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
269
269
  'varied-cell': originalValue !== undefined,
270
270
  'empty-cell': isEmpty
271
271
  });
272
- var renderValue = _jsx(ProForm.ProAddressBar, {
272
+ var renderValue = _jsx(ProForm.ProCascader, {
273
273
  isView: true,
274
+ mode: "address",
274
275
  code: code,
275
276
  value: realValue
276
277
  });
277
- var originalRenderValue = _jsx(ProForm.ProAddressBar, {
278
+ var originalRenderValue = _jsx(ProForm.ProCascader, {
278
279
  isView: true,
280
+ mode: "address",
279
281
  code: code,
280
282
  value: originalRealValue
281
283
  });
282
- return _jsx(ProForm.ProAddressBar, {
284
+ return _jsx(ProForm.ProCascader, {
283
285
  className: className,
284
286
  isView: true,
287
+ mode: "address",
285
288
  code: code,
286
289
  value: realValue,
287
290
  tooltip: originalValue !== undefined ? _jsxs(_Fragment, {
@@ -1,3 +1,3 @@
1
1
  import type { DevToolsPropsType } from '../../propsType';
2
- declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, prefixCls, }: DevToolsPropsType) => JSX.Element;
2
+ declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, }: DevToolsPropsType) => JSX.Element;
3
3
  export default PrdTools;