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

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 +11 -13
  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 +10 -12
  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
@@ -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 {
@@ -59,7 +59,7 @@ var useControlled = exports.useControlled = function useControlled(props) {
59
59
  var isSelect = exports.isSelect = function isSelect(props) {
60
60
  var dataSource = props.dataSource,
61
61
  type = props.type;
62
- return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || ['Select', 'ProSelect', 'ProEnum', 'DatePicker', 'RangePicker', 'ProAddressBar', 'ProTimeLimit', 'ProModalSelect', 'ProTreeModal', 'ProUpload', 'TimePicker'].includes(type);
62
+ return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || ['Select', 'ProSelect', 'ProEnum', 'DatePicker', 'RangePicker', 'ProCascader', 'ProTimeLimit', 'ProModalSelect', 'ProTreeModal', 'ProUpload', 'TimePicker'].includes(type);
63
63
  };
64
64
  /**
65
65
  * Input TextArea 移除前后空格
@@ -143,6 +143,9 @@ var filterInternalFields = exports.filterInternalFields = function filterInterna
143
143
  if ((values === null || values === void 0 ? void 0 : values._immutable) || _moment.default.isMoment(values)) {
144
144
  return nextValues;
145
145
  }
146
+ if (values instanceof File) {
147
+ return nextValues;
148
+ }
146
149
  if (Array.isArray(nextValues)) {
147
150
  return nextValues.map(function (item) {
148
151
  return filterInternalFields(item);
@@ -18,9 +18,8 @@ var useChanged = exports.useChanged = function useChanged(_ref) {
18
18
  return (0, _lodash.get)(originalValues, name);
19
19
  }) : (0, _lodash.get)(originalValues, name);
20
20
  var notWatch = !equalWith && (!originalValues || originalValue === undefined);
21
- if (notWatch) form = [];
22
- var value = _antd.Form.useWatch(namesStr || name, form);
23
21
  if (notWatch) return [false];
22
+ var value = _antd.Form.useWatch(namesStr || name, form);
24
23
  var changed = (0, _diffOriginal.diffOriginal)({
25
24
  originalValue: originalValue,
26
25
  value: value,
@@ -32,30 +32,42 @@ var useForm = exports.useForm = function useForm(originForm) {
32
32
  _key,
33
33
  values,
34
34
  _values,
35
+ _error$errorFields,
36
+ _error$errorFields$,
35
37
  _args = arguments;
36
38
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
37
39
  while (1) switch (_context.prev = _context.next) {
38
40
  case 0:
41
+ _context.prev = 0;
39
42
  for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
40
43
  rest[_key - 1] = _args[_key];
41
44
  }
42
- _context.next = 3;
45
+ _context.next = 4;
43
46
  return validateFields.apply(void 0, [nameList].concat(rest));
44
- case 3:
47
+ case 4:
45
48
  values = _context.sent;
46
49
  if (!nameList) {
47
- _context.next = 6;
50
+ _context.next = 7;
48
51
  break;
49
52
  }
50
53
  return _context.abrupt("return", values);
51
- case 6:
54
+ case 7:
52
55
  _values = _getFieldsValue();
53
56
  return _context.abrupt("return", _values);
54
- case 8:
57
+ case 11:
58
+ _context.prev = 11;
59
+ _context.t0 = _context["catch"](0);
60
+ if (_context.t0 && (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields)) {
61
+ 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, {
62
+ block: 'center',
63
+ behavior: 'smooth'
64
+ });
65
+ }
66
+ case 14:
55
67
  case "end":
56
68
  return _context.stop();
57
69
  }
58
- }, _callee);
70
+ }, _callee, null, [[0, 11]]);
59
71
  }));
60
72
  return function _validateFields(_x) {
61
73
  return _ref.apply(this, arguments);
@@ -85,10 +85,8 @@ var useListChanged = exports.useListChanged = function useListChanged(params) {
85
85
  }) : undefined;
86
86
  var noChange = !equalWith && (!originalValues || originalValue === undefined);
87
87
  var _form = form;
88
- // @ts-ignore
89
- if (notWatch) _form = [];
90
- var value = _antd.Form.useWatch(namePath, _form);
91
88
  if (notWatch || noChange) return [false];
89
+ var value = _antd.Form.useWatch(namePath, _form);
92
90
  var changed = (0, _diffOriginal.diffOriginal)({
93
91
  value: value,
94
92
  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
  };
@@ -266,12 +266,14 @@ var themeMap = exports.themeMap = {
266
266
  '#006AFF': ['#ADDDFF', '#5FB3D8', '#4181FF'],
267
267
  '#00BC70': ['#FFFFFF', '#54DFA7', '#00BC70'],
268
268
  '#FF8C16': ['#FFFFFF', '#FFA74E', '#FF8C17'],
269
- '#A00F20': ['#FFFFFF', '#E47B7B', '#A00E20']
269
+ '#A00F20': ['#FFFFFF', '#E47B7B', '#A00E20'],
270
+ '#31AF96': ['#5FD8C7', '#5FD8C7', '#31AF96']
270
271
  };
271
272
  // 双色icon预设
272
273
  var themeFillMap = exports.themeFillMap = {
273
274
  '#006AFF': ['none', '#87F1FC', 'black', '#4181FF'],
274
275
  '#00BC70': ['none', '#05FFEC', 'black', '#00BC70'],
275
276
  '#FF8C16': ['none', '#FED736', 'black', '#FF8C17'],
276
- '#A00F20': ['none', '#FD8357', 'black', '#A00E20']
277
+ '#A00F20': ['none', '#FD8357', 'black', '#A00E20'],
278
+ '#31AF96': ['none', '#BBF392', 'black', '#31AF96']
277
279
  };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
11
  var _jsxRuntime = require("react/jsx-runtime");
@@ -13,14 +14,17 @@ var _antd = require("antd");
13
14
  var _classnames = _interopRequireDefault(require("classnames"));
14
15
  var _lodash = require("lodash");
15
16
  var _reactSvg = require("react-svg");
17
+ var _react = require("react");
16
18
  var _ProConfigProvider = require("../ProConfigProvider");
17
19
  var _config2 = require("./config");
18
20
  var _utils = require("./utils");
19
21
  var _locale = _interopRequireDefault(require("../locale"));
20
- var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap"];
22
+ var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip"];
21
23
  var ProIcon = function ProIcon(props) {
24
+ var _window, _window2;
22
25
  var _useProConfig = (0, _ProConfigProvider.useProConfig)(),
23
- state = _useProConfig.state;
26
+ state = _useProConfig.state,
27
+ dispatch = _useProConfig.dispatch;
24
28
  var config = state.ProIcon,
25
29
  antdTheme = state.theme;
26
30
  var _config = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), props !== null && props !== void 0 ? props : {});
@@ -48,11 +52,28 @@ var ProIcon = function ProIcon(props) {
48
52
  mapList = _config$mapList === void 0 ? [] : _config$mapList,
49
53
  src = _config.src,
50
54
  actionMap = _config.actionMap,
55
+ tooltip = _config.tooltip,
51
56
  reset = (0, _objectWithoutProperties2.default)(_config, _excluded);
52
- // 主题色
57
+ var _useSetState = (0, _ahooks.useSetState)({
58
+ IconInstance: (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {})
59
+ }),
60
+ _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
61
+ IconInstance = _useSetState2[0].IconInstance,
62
+ setState = _useSetState2[1];
63
+ // 主题色 primaryColor 用于单应用或处于组件库文档内 qiankunPrimaryColor用于主子应用
53
64
  var _ref = antdTheme !== null && antdTheme !== void 0 ? antdTheme : {},
54
65
  _ref$primaryColor = _ref.primaryColor,
55
- primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor;
66
+ primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor,
67
+ _ref$qiankunPrimaryCo = _ref.qiankunPrimaryColor,
68
+ qiankunPrimaryColor = _ref$qiankunPrimaryCo === void 0 ? '#006AFF' : _ref$qiankunPrimaryCo;
69
+ // 本地存储初始化主题
70
+ var _useLocalStorageState = (0, _ahooks.useLocalStorageState)('themeConfig'),
71
+ _useLocalStorageState2 = (0, _slicedToArray2.default)(_useLocalStorageState, 1),
72
+ themeConfig = _useLocalStorageState2[0];
73
+ // 文档内部就不用判断window.top !== window.self了
74
+ var isQiankun =
75
+ // @ts-ignore
76
+ ((_window = window) === null || _window === void 0 ? void 0 : _window.__POWERED_BY_QIANKUN__) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.isMicroApp);
56
77
  // 语言
57
78
  var language = _locale.default.ProIcon.language;
58
79
  // 加载内部icon
@@ -68,6 +89,8 @@ var ProIcon = function ProIcon(props) {
68
89
  'pro-icon-btn': disabled
69
90
  });
70
91
  var _mode = mode || 'icon';
92
+ // 观察者实例
93
+ var observer;
71
94
  // 特殊情况,如果指定了type,并且没有接收到组件内的mode,那模式就是icon
72
95
  if (type && !props.mode) {
73
96
  _mode = 'icon';
@@ -79,7 +102,7 @@ var ProIcon = function ProIcon(props) {
79
102
  var _type = type;
80
103
  var _text = children;
81
104
  // svg图标对应文本
82
- var iconText = '';
105
+ var iconText = tooltip || '';
83
106
  var typeIsExistAndIncludeEnglish = _type && /[a-zA-Z]/.test(_type);
84
107
  // 模式为icon下,对传入的text进行指定语言-icon 映射
85
108
  if (isIconMode && !type) {
@@ -120,82 +143,126 @@ var ProIcon = function ProIcon(props) {
120
143
  }, reset), {}, {
121
144
  children: (0, _jsxRuntime.jsx)(_antd.Tooltip, {
122
145
  title: iconText,
123
- children: !src ? (0, _jsxRuntime.jsx)("svg", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
124
- onClick: onClick,
125
- "aria-hidden": "true",
126
- children: (0, _jsxRuntime.jsx)("use", {
127
- xlinkHref: "#icon-".concat(_type)
128
- })
129
- })) : (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
130
- // @ts-ignore
131
- onClick: onClick,
132
- "aria-hidden": "true",
133
- src: src,
134
- beforeInjection: function beforeInjection(svg) {
135
- if (actionMap && svg) {
136
- var _actionMap$themeMap, _actionMap$themeFillM, _actionMap$gradation, _actionMap$fill;
137
- // 项目内置的四种主题匹配渐变色
138
- var mergeThemeMap = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _config2.themeMap), (_actionMap$themeMap = actionMap.themeMap) !== null && _actionMap$themeMap !== void 0 ? _actionMap$themeMap : {});
139
- // 项目内置的四种双色匹配fill
140
- var mergeFillThemeMap = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _config2.themeFillMap), (_actionMap$themeFillM = actionMap.themeFillMap) !== null && _actionMap$themeFillM !== void 0 ? _actionMap$themeFillM : {});
141
- var _gradList = mergeThemeMap[primaryColor];
142
- var _fillList = mergeFillThemeMap[primaryColor];
143
- // 渐变操作序列
144
- var gradList = (_actionMap$gradation = actionMap === null || actionMap === void 0 ? void 0 : actionMap.gradation) !== null && _actionMap$gradation !== void 0 ? _actionMap$gradation : _gradList;
145
- // 填充操作序列
146
- var fillList = (_actionMap$fill = actionMap === null || actionMap === void 0 ? void 0 : actionMap.fill) !== null && _actionMap$fill !== void 0 ? _actionMap$fill : _fillList;
147
- // 节点收集
148
- var nodeMap = {
149
- // 渐变色节点收集
150
- gradation: [],
151
- // 具有fill属性的节点收集
152
- fill: []
153
- };
154
- // 目前只支持处理渐变及fill填充
155
- var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
156
- types.forEach(function (typeKey) {
157
- (0, _utils.recurseGetNodes)(typeKey, svg, nodeMap[typeKey]);
146
+ children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)({
147
+ style: {
148
+ width: size,
149
+ height: size,
150
+ border: 'none',
151
+ borderRadius: 0,
152
+ padding: 0,
153
+ verticalAlign: 'baseline'
154
+ },
155
+ type: "text",
156
+ icon: !src ? (0, _jsxRuntime.jsx)("svg", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
157
+ onClick: onClick,
158
+ "aria-hidden": "true",
159
+ children: (0, _jsxRuntime.jsx)("use", {
160
+ xlinkHref: "#icon-".concat(_type)
161
+ })
162
+ })) : (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
163
+ // @ts-ignore
164
+ onClick: onClick,
165
+ "aria-hidden": "true",
166
+ src: src,
167
+ beforeInjection: function beforeInjection(svg) {
168
+ (0, _utils.onBeforeInjection)({
169
+ svg: svg,
170
+ actionMap: actionMap,
171
+ primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
158
172
  });
159
- if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
160
- nodeMap.gradation.forEach(function (item, index) {
161
- // 下一步准备替换的
162
- var nextStr = gradList[index];
163
- // 属性原本的值
164
- var originStr = item.getAttribute('stop-color');
165
- if (nextStr && originStr !== nextStr) {
166
- item.setAttribute('stop-color', nextStr);
167
- }
168
- });
169
- }
170
- if ((fillList === null || fillList === void 0 ? void 0 : fillList.length) > 0) {
171
- nodeMap.fill.forEach(function (item, index) {
172
- // 默认接收的
173
- var receiveStr = fillList[index];
174
- // 下一步准备替换的
175
- var nextFillStr = receiveStr === 'theme' ? primaryColor : receiveStr;
176
- // 属性原本的值
177
- var originFill = item.getAttribute('fill');
178
- // 如果包含url(则是内链,不作替换处理
179
- if (!(originFill && originFill.includes('url(')) && nextFillStr) {
180
- // 不同才替换
181
- if (originFill !== nextFillStr) {
182
- item.setAttribute('fill', nextFillStr);
173
+ }
174
+ }))
175
+ }, buttonProps))
176
+ })
177
+ }));
178
+ (0, _react.useEffect)(function () {
179
+ // 处于主子应用情况下才会执行下方逻辑,主题色的变更以主框架的为准
180
+ if (actionMap && isQiankun) {
181
+ var _themeConfig$data;
182
+ observer = new MutationObserver(function (mutationsList) {
183
+ var targetEntries = mutationsList[0];
184
+ if (targetEntries) {
185
+ if (targetEntries && targetEntries.target) {
186
+ var _Object$values, _Object$values$find, _Object$values$find$v3, _targetEntries$target, _targetEntries$target2;
187
+ var _Object$values$find$v = // @ts-ignore
188
+ (_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) {
189
+ return item.nodeName === 'style';
190
+ })
191
+ // @ts-ignore
192
+ ) === 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:(.*?);/),
193
+ _Object$values$find$v2 = (0, _slicedToArray2.default)(_Object$values$find$v, 2),
194
+ label = _Object$values$find$v2[0],
195
+ value = _Object$values$find$v2[1];
196
+ if (label && value) {
197
+ if (qiankunPrimaryColor !== value) {
198
+ dispatch({
199
+ type: 'set',
200
+ payload: {
201
+ theme: {
202
+ primaryColor: primaryColor,
203
+ qiankunPrimaryColor: value === null || value === void 0 ? void 0 : value.trim()
204
+ }
183
205
  }
184
- }
185
- });
206
+ });
207
+ }
186
208
  }
187
209
  }
188
210
  }
189
- }))
190
- })
191
- }));
192
- return !isExtendButtonMode ? RenderIcon : (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
193
- type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
194
- className: proIconClassNames,
195
- disabled: disabled,
196
- icon: isIconMode ? RenderIcon : null
197
- }, reset), buttonProps), {}, {
198
- children: _text
199
- }));
211
+ });
212
+ var zaAccessibilityTarget = document.documentElement;
213
+ if (window.parent === window) {
214
+ // 在最顶层的window环境中,可以直接使用document
215
+ zaAccessibilityTarget = document.documentElement;
216
+ } else {
217
+ // 向上遍历直到找到主应用的window
218
+ var currentWindow = window;
219
+ while (currentWindow.parent !== currentWindow) {
220
+ // @ts-ignore
221
+ currentWindow = currentWindow.parent;
222
+ }
223
+ zaAccessibilityTarget = currentWindow.document.documentElement;
224
+ }
225
+ observer.observe(zaAccessibilityTarget, {
226
+ attributes: true,
227
+ attributeFilter: ['style']
228
+ });
229
+ // 未变更时及初始化时
230
+ var extendFromMainColor = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiBrand;
231
+ if (extendFromMainColor && qiankunPrimaryColor !== extendFromMainColor) {
232
+ dispatch({
233
+ type: 'set',
234
+ payload: {
235
+ theme: {
236
+ primaryColor: primaryColor,
237
+ qiankunPrimaryColor: extendFromMainColor
238
+ }
239
+ }
240
+ });
241
+ }
242
+ }
243
+ }, []);
244
+ (0, _react.useEffect)(function () {
245
+ return function () {
246
+ if (observer) {
247
+ observer.disconnect();
248
+ }
249
+ };
250
+ }, []);
251
+ (0, _ahooks.useDeepCompareLayoutEffect)(function () {
252
+ setState({
253
+ IconInstance: RenderIcon
254
+ });
255
+ }, [_config, primaryColor, qiankunPrimaryColor, language, svgProps]);
256
+ return !isExtendButtonMode ? IconInstance : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
257
+ title: tooltip,
258
+ children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
259
+ type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
260
+ className: proIconClassNames,
261
+ disabled: disabled,
262
+ icon: isIconMode ? RenderIcon : null
263
+ }, reset), buttonProps), {}, {
264
+ children: _text
265
+ }))
266
+ });
200
267
  };
201
268
  var _default = exports.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,9 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.recurseGetNodes = void 0;
7
+ exports.recurseGetNodes = exports.onBeforeInjection = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _config = require("../config");
7
10
  var recurseGetNodes = exports.recurseGetNodes = function recurseGetNodes(type, node, queue) {
8
11
  switch (type) {
9
12
  // 渐变
@@ -26,4 +29,62 @@ var recurseGetNodes = exports.recurseGetNodes = function recurseGetNodes(type, n
26
29
  recurseGetNodes(type, node.childNodes[i], queue);
27
30
  }
28
31
  }
32
+ };
33
+ var onBeforeInjection = exports.onBeforeInjection = function onBeforeInjection(_ref) {
34
+ var svg = _ref.svg,
35
+ actionMap = _ref.actionMap,
36
+ primaryColor = _ref.primaryColor;
37
+ if (actionMap && svg) {
38
+ var _actionMap$themeMap, _actionMap$themeFillM, _actionMap$gradation, _actionMap$fill;
39
+ // 项目内置的四种主题匹配渐变色
40
+ var mergeThemeMap = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _config.themeMap), (_actionMap$themeMap = actionMap.themeMap) !== null && _actionMap$themeMap !== void 0 ? _actionMap$themeMap : {});
41
+ // 项目内置的四种双色匹配fill
42
+ var mergeFillThemeMap = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _config.themeFillMap), (_actionMap$themeFillM = actionMap.themeFillMap) !== null && _actionMap$themeFillM !== void 0 ? _actionMap$themeFillM : {});
43
+ var _gradList = mergeThemeMap[primaryColor];
44
+ var _fillList = mergeFillThemeMap[primaryColor];
45
+ // 渐变操作序列
46
+ var gradList = (_actionMap$gradation = actionMap === null || actionMap === void 0 ? void 0 : actionMap.gradation) !== null && _actionMap$gradation !== void 0 ? _actionMap$gradation : _gradList;
47
+ // 填充操作序列
48
+ var fillList = (_actionMap$fill = actionMap === null || actionMap === void 0 ? void 0 : actionMap.fill) !== null && _actionMap$fill !== void 0 ? _actionMap$fill : _fillList;
49
+ // 节点收集
50
+ var nodeMap = {
51
+ // 渐变色节点收集
52
+ gradation: [],
53
+ // 具有fill属性的节点收集
54
+ fill: []
55
+ };
56
+ // 目前只支持处理渐变及fill填充
57
+ var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
58
+ types.forEach(function (typeKey) {
59
+ recurseGetNodes(typeKey, svg, nodeMap[typeKey]);
60
+ });
61
+ if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
62
+ nodeMap.gradation.forEach(function (item, index) {
63
+ // 下一步准备替换的
64
+ var nextStr = gradList[index];
65
+ // 属性原本的值
66
+ var originStr = item.getAttribute('stop-color');
67
+ if (nextStr && originStr !== nextStr) {
68
+ item.setAttribute('stop-color', nextStr);
69
+ }
70
+ });
71
+ }
72
+ if ((fillList === null || fillList === void 0 ? void 0 : fillList.length) > 0) {
73
+ nodeMap.fill.forEach(function (item, index) {
74
+ // 默认接收的
75
+ var receiveStr = fillList[index];
76
+ // 下一步准备替换的
77
+ var nextFillStr = receiveStr === 'theme' ? primaryColor : receiveStr;
78
+ // 属性原本的值
79
+ var originFill = item.getAttribute('fill');
80
+ // 如果包含url(则是内链,不作替换处理
81
+ if (!(originFill && originFill.includes('url(')) && nextFillStr) {
82
+ // 不同才替换
83
+ if (originFill !== nextFillStr) {
84
+ item.setAttribute('fill', nextFillStr);
85
+ }
86
+ }
87
+ });
88
+ }
89
+ }
29
90
  };
@@ -12,9 +12,9 @@ var _react = require("react");
12
12
  var _antd = require("antd");
13
13
  var _icons = require("@ant-design/icons");
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
- var _reactSvg = require("react-svg");
16
15
  var _lodash = require("lodash");
17
16
  var _fold = _interopRequireDefault(require("../../../assets/fold.svg"));
17
+ var _index = _interopRequireDefault(require("../../../ProIcon/index"));
18
18
  var Panel = _antd.Collapse.Panel;
19
19
  var ProCollapse = function ProCollapse(props) {
20
20
  var title = props.title,
@@ -79,8 +79,11 @@ var ProCollapse = function ProCollapse(props) {
79
79
  align: "center",
80
80
  children: [(0, _jsxRuntime.jsx)("div", {
81
81
  className: "pro-collapse-icon",
82
- children: (0, _lodash.isBoolean)(icon) ? (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
83
- src: _fold.default
82
+ children: (0, _lodash.isBoolean)(icon) ? (0, _jsxRuntime.jsx)(_index.default, {
83
+ src: _fold.default,
84
+ actionMap: {
85
+ fill: []
86
+ }
84
87
  }) : icon
85
88
  }), title]
86
89
  });
@@ -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
  }
@@ -240,7 +240,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
240
240
  if (!(0, _lodash.isObject)(value)) {
241
241
  return undefined;
242
242
  }
243
- return value === null || value === void 0 ? void 0 : value[code];
243
+ return (value === null || value === void 0 ? void 0 : value[code]) || (value === null || value === void 0 ? void 0 : value.value);
244
244
  }
245
245
  if (labelInValue && selectProps.mode) {
246
246
  // 对传入的值做一些基础判断
@@ -11,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _lodash = require("lodash");
14
- var _reactSvg = require("react-svg");
14
+ var _index = _interopRequireDefault(require("../../../ProIcon/index"));
15
15
  var _catalog = _interopRequireDefault(require("../../../assets/catalog.svg"));
16
16
  var _Anchor = _interopRequireDefault(require("../Anchor"));
17
17
  var _locale = _interopRequireDefault(require("../../../locale"));
@@ -67,9 +67,10 @@ var Step = exports.Step = function Step(_ref) {
67
67
  onMouseLeave: handleMouseLeave,
68
68
  children: [(0, _jsxRuntime.jsxs)("div", {
69
69
  className: "step-menu",
70
- children: [(0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
70
+ children: [(0, _jsxRuntime.jsx)(_index.default, {
71
+ src: _catalog.default,
71
72
  className: "menu-icon",
72
- src: _catalog.default
73
+ actionMap: {}
73
74
  }), onOff && (0, _jsxRuntime.jsx)("div", {
74
75
  children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProStep = _locale.default.ProStep) === null || _locale$ProStep === void 0 ? void 0 : _locale$ProStep.catalogue
75
76
  })]
@@ -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);