@zat-design/sisyphus-react 3.4.5 → 3.4.6

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 (121) hide show
  1. package/dist/index.esm.css +140 -35
  2. package/dist/less.esm.css +140 -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 +55 -48
  6. package/es/ProEditTable/index.js +3 -3
  7. package/es/ProEditTable/style/index.less +0 -5
  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/combination/Container/index.js +3 -2
  12. package/es/ProForm/components/combination/Container/style/index.less +5 -1
  13. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  14. package/es/ProForm/components/combination/ProCascader/index.js +256 -0
  15. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  16. package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  17. package/es/ProForm/components/combination/ProCascader/utils/index.js +26 -0
  18. package/es/ProForm/components/combination/ProModalSelect/index.js +13 -5
  19. package/es/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  20. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  21. package/es/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  22. package/es/ProForm/components/index.d.ts +1 -2
  23. package/es/ProForm/components/index.js +1 -4
  24. package/es/ProForm/components/render/Render.js +18 -13
  25. package/es/ProForm/components/render/RenderFields.js +3 -1
  26. package/es/ProForm/components/render/propsType.d.ts +3 -7
  27. package/es/ProForm/index.js +6 -2
  28. package/es/ProForm/propsType.d.ts +2 -0
  29. package/es/ProForm/style/index.less +2 -1
  30. package/es/ProForm/utils/index.js +4 -1
  31. package/es/ProForm/utils/useChanged.js +1 -2
  32. package/es/ProForm/utils/useForm.js +18 -6
  33. package/es/ProForm/utils/useListChanged.js +1 -3
  34. package/es/ProIcon/config/index.d.ts +2 -0
  35. package/es/ProIcon/config/index.js +4 -2
  36. package/es/ProIcon/index.js +148 -81
  37. package/es/ProIcon/propsTypes.d.ts +6 -1
  38. package/es/ProIcon/utils/index.d.ts +5 -0
  39. package/es/ProIcon/utils/index.js +60 -0
  40. package/es/ProLayout/components/ProCollapse/index.js +6 -3
  41. package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
  42. package/es/ProSelect/index.js +1 -1
  43. package/es/ProStep/components/Step/index.js +4 -3
  44. package/es/ProStep/style/index.less +37 -0
  45. package/es/ProTable/utils.js +6 -3
  46. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  47. package/es/ProThemeTools/component/PrdTools/index.js +16 -6
  48. package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
  49. package/es/ProTree/components/ProTree.js +96 -74
  50. package/es/ProTree/components/ProTreeSelect/index.js +3 -7
  51. package/es/ProTree/components/Tree.js +63 -41
  52. package/es/ProTree/style/index.less +24 -17
  53. package/es/ProUpload/index.js +13 -14
  54. package/es/ProUpload/propsType.d.ts +8 -3
  55. package/es/assets/view.svg +2 -2
  56. package/es/global.less +6 -6
  57. package/lib/ProConfigProvider/index.d.ts +2 -2
  58. package/lib/ProConfigProvider/index.js +0 -3
  59. package/lib/ProEditTable/components/RenderField/index.js +53 -46
  60. package/lib/ProEditTable/index.js +3 -3
  61. package/lib/ProEditTable/style/index.less +0 -5
  62. package/lib/ProEditTable/utils/tools.d.ts +12 -0
  63. package/lib/ProEditTable/utils/tools.js +80 -2
  64. package/lib/ProForm/components/base/RangePicker/index.js +9 -9
  65. package/lib/ProForm/components/combination/Container/index.js +3 -2
  66. package/lib/ProForm/components/combination/Container/style/index.less +5 -1
  67. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  68. package/lib/ProForm/components/combination/ProCascader/index.js +256 -0
  69. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  70. package/lib/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  71. package/lib/ProForm/components/combination/ProCascader/utils/index.js +33 -0
  72. package/lib/ProForm/components/combination/ProModalSelect/index.js +12 -4
  73. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  74. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  75. package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  76. package/lib/ProForm/components/index.d.ts +1 -2
  77. package/lib/ProForm/components/index.js +1 -8
  78. package/lib/ProForm/components/render/Render.js +18 -13
  79. package/lib/ProForm/components/render/RenderFields.js +3 -1
  80. package/lib/ProForm/components/render/propsType.d.ts +3 -7
  81. package/lib/ProForm/index.js +5 -1
  82. package/lib/ProForm/propsType.d.ts +2 -0
  83. package/lib/ProForm/style/index.less +2 -1
  84. package/lib/ProForm/utils/index.js +4 -1
  85. package/lib/ProForm/utils/useChanged.js +1 -2
  86. package/lib/ProForm/utils/useForm.js +18 -6
  87. package/lib/ProForm/utils/useListChanged.js +1 -3
  88. package/lib/ProIcon/config/index.d.ts +2 -0
  89. package/lib/ProIcon/config/index.js +4 -2
  90. package/lib/ProIcon/index.js +144 -77
  91. package/lib/ProIcon/propsTypes.d.ts +6 -1
  92. package/lib/ProIcon/utils/index.d.ts +5 -0
  93. package/lib/ProIcon/utils/index.js +62 -1
  94. package/lib/ProLayout/components/ProCollapse/index.js +6 -3
  95. package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
  96. package/lib/ProSelect/index.js +1 -1
  97. package/lib/ProStep/components/Step/index.js +4 -3
  98. package/lib/ProStep/style/index.less +37 -0
  99. package/lib/ProTable/utils.js +6 -3
  100. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  101. package/lib/ProThemeTools/component/PrdTools/index.js +16 -6
  102. package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
  103. package/lib/ProTree/components/ProTree.js +96 -74
  104. package/lib/ProTree/components/ProTreeSelect/index.js +3 -7
  105. package/lib/ProTree/components/Tree.js +63 -41
  106. package/lib/ProTree/style/index.less +24 -17
  107. package/lib/ProUpload/index.js +12 -13
  108. package/lib/ProUpload/propsType.d.ts +8 -3
  109. package/lib/assets/view.svg +2 -2
  110. package/lib/global.less +6 -6
  111. package/package.json +2 -2
  112. package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
  113. package/es/ProForm/components/base/ProCascader/index.js +0 -72
  114. package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
  115. package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
  116. package/lib/ProForm/components/base/ProCascader/index.js +0 -78
  117. package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
  118. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  119. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
  120. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  121. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
@@ -41,6 +41,8 @@ export interface ProFormOtherProps {
41
41
  required?: boolean | boolean[] | (() => boolean | boolean[]);
42
42
  mode?: string;
43
43
  namePath?: any[] | string | number;
44
+ globalControl?: boolean;
45
+ formDisabled?: boolean;
44
46
  }
45
47
  export interface ProFormProps<Values = any> extends FormProps<Values> {
46
48
  disabled?: boolean;
@@ -4,7 +4,7 @@
4
4
  @import '../components/base/TextArea/index.less';
5
5
  @import '../components/combination/FormList/style/index.less';
6
6
  @import '../components/combination/ProTimeLimit/style/index.less';
7
- @import '../components/combination/ProAddressBar/style/index.less';
7
+ @import '../components/combination/ProCascader/style/index.less';
8
8
  @import '../components/combination/ProNumberRange/style/index.less';
9
9
  @import '../components/combination/ProModalSelect/style/index.less';
10
10
  @import '../components/combination/Group/style/index.less';
@@ -338,6 +338,7 @@
338
338
  overflow: hidden;
339
339
  white-space: nowrap;
340
340
  text-overflow: ellipsis;
341
+ width: 100%;
341
342
  }
342
343
 
343
344
  .full-form-item {
@@ -43,7 +43,7 @@ export var useControlled = function useControlled(props) {
43
43
  export var isSelect = function isSelect(props) {
44
44
  var dataSource = props.dataSource,
45
45
  type = props.type;
46
- return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || ['Select', 'ProSelect', 'ProEnum', 'DatePicker', 'RangePicker', 'ProAddressBar', 'ProTimeLimit', 'ProModalSelect', 'ProTreeModal', 'ProUpload', 'TimePicker'].includes(type);
46
+ return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || ['Select', 'ProSelect', 'ProEnum', 'DatePicker', 'RangePicker', 'ProCascader', 'ProTimeLimit', 'ProModalSelect', 'ProTreeModal', 'ProUpload', 'TimePicker'].includes(type);
47
47
  };
48
48
  /**
49
49
  * Input TextArea 移除前后空格
@@ -127,6 +127,9 @@ export var filterInternalFields = function filterInternalFields(values) {
127
127
  if ((values === null || values === void 0 ? void 0 : values._immutable) || moment.isMoment(values)) {
128
128
  return nextValues;
129
129
  }
130
+ if (values instanceof File) {
131
+ return nextValues;
132
+ }
130
133
  if (Array.isArray(nextValues)) {
131
134
  return nextValues.map(function (item) {
132
135
  return filterInternalFields(item);
@@ -13,9 +13,8 @@ export var useChanged = function useChanged(_ref) {
13
13
  return get(originalValues, name);
14
14
  }) : get(originalValues, name);
15
15
  var notWatch = !equalWith && (!originalValues || originalValue === undefined);
16
- if (notWatch) form = [];
17
- var value = _Form.useWatch(namesStr || name, form);
18
16
  if (notWatch) return [false];
17
+ var value = _Form.useWatch(namesStr || name, form);
19
18
  var changed = diffOriginal({
20
19
  originalValue: originalValue,
21
20
  value: value,
@@ -26,30 +26,42 @@ export var useForm = function useForm(originForm) {
26
26
  _key,
27
27
  values,
28
28
  _values,
29
+ _error$errorFields,
30
+ _error$errorFields$,
29
31
  _args = arguments;
30
32
  return _regeneratorRuntime().wrap(function _callee$(_context) {
31
33
  while (1) switch (_context.prev = _context.next) {
32
34
  case 0:
35
+ _context.prev = 0;
33
36
  for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
34
37
  rest[_key - 1] = _args[_key];
35
38
  }
36
- _context.next = 3;
39
+ _context.next = 4;
37
40
  return validateFields.apply(void 0, [nameList].concat(rest));
38
- case 3:
41
+ case 4:
39
42
  values = _context.sent;
40
43
  if (!nameList) {
41
- _context.next = 6;
44
+ _context.next = 7;
42
45
  break;
43
46
  }
44
47
  return _context.abrupt("return", values);
45
- case 6:
48
+ case 7:
46
49
  _values = _getFieldsValue();
47
50
  return _context.abrupt("return", _values);
48
- case 8:
51
+ case 11:
52
+ _context.prev = 11;
53
+ _context.t0 = _context["catch"](0);
54
+ if (_context.t0 && (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields)) {
55
+ form === null || form === void 0 ? void 0 : form.scrollToField(_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : (_error$errorFields$ = _error$errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
56
+ block: 'center',
57
+ behavior: 'smooth'
58
+ });
59
+ }
60
+ case 14:
49
61
  case "end":
50
62
  return _context.stop();
51
63
  }
52
- }, _callee);
64
+ }, _callee, null, [[0, 11]]);
53
65
  }));
54
66
  return function _validateFields(_x) {
55
67
  return _ref.apply(this, arguments);
@@ -80,10 +80,8 @@ export var useListChanged = function useListChanged(params) {
80
80
  }) : undefined;
81
81
  var noChange = !equalWith && (!originalValues || originalValue === undefined);
82
82
  var _form = form;
83
- // @ts-ignore
84
- if (notWatch) _form = [];
85
- var value = _Form.useWatch(namePath, _form);
86
83
  if (notWatch || noChange) return [false];
84
+ var value = _Form.useWatch(namePath, _form);
87
85
  var changed = diffOriginal({
88
86
  value: value,
89
87
  originalValue: originalValue,
@@ -8,10 +8,12 @@ export declare const themeMap: {
8
8
  '#00BC70': string[];
9
9
  '#FF8C16': string[];
10
10
  '#A00F20': string[];
11
+ '#31AF96': string[];
11
12
  };
12
13
  export declare const themeFillMap: {
13
14
  '#006AFF': string[];
14
15
  '#00BC70': string[];
15
16
  '#FF8C16': string[];
16
17
  '#A00F20': string[];
18
+ '#31AF96': string[];
17
19
  };
@@ -260,12 +260,14 @@ export var themeMap = {
260
260
  '#006AFF': ['#ADDDFF', '#5FB3D8', '#4181FF'],
261
261
  '#00BC70': ['#FFFFFF', '#54DFA7', '#00BC70'],
262
262
  '#FF8C16': ['#FFFFFF', '#FFA74E', '#FF8C17'],
263
- '#A00F20': ['#FFFFFF', '#E47B7B', '#A00E20']
263
+ '#A00F20': ['#FFFFFF', '#E47B7B', '#A00E20'],
264
+ '#31AF96': ['#5FD8C7', '#5FD8C7', '#31AF96']
264
265
  };
265
266
  // 双色icon预设
266
267
  export var themeFillMap = {
267
268
  '#006AFF': ['none', '#87F1FC', 'black', '#4181FF'],
268
269
  '#00BC70': ['none', '#05FFEC', 'black', '#00BC70'],
269
270
  '#FF8C16': ['none', '#FED736', 'black', '#FF8C17'],
270
- '#A00F20': ['none', '#FD8357', 'black', '#A00E20']
271
+ '#A00F20': ['none', '#FD8357', 'black', '#A00E20'],
272
+ '#31AF96': ['none', '#BBF392', 'black', '#31AF96']
271
273
  };
@@ -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
  }
@@ -239,7 +239,7 @@ export var ProSelect = function ProSelect(props, ref) {
239
239
  if (!isObject(value)) {
240
240
  return undefined;
241
241
  }
242
- return value === null || value === void 0 ? void 0 : value[code];
242
+ return (value === null || value === void 0 ? void 0 : value[code]) || (value === null || value === void 0 ? void 0 : value.value);
243
243
  }
244
244
  if (labelInValue && selectProps.mode) {
245
245
  // 对传入的值做一些基础判断
@@ -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);