@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.
- package/dist/index.esm.css +140 -35
- package/dist/less.esm.css +140 -35
- package/es/ProConfigProvider/index.d.ts +2 -2
- package/es/ProConfigProvider/index.js +0 -3
- package/es/ProEditTable/components/RenderField/index.js +55 -48
- package/es/ProEditTable/index.js +3 -3
- package/es/ProEditTable/style/index.less +0 -5
- package/es/ProEditTable/utils/tools.d.ts +12 -0
- package/es/ProEditTable/utils/tools.js +79 -2
- package/es/ProForm/components/base/RangePicker/index.js +9 -9
- package/es/ProForm/components/combination/Container/index.js +3 -2
- package/es/ProForm/components/combination/Container/style/index.less +5 -1
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProCascader/index.js +256 -0
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
- package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
- package/es/ProForm/components/combination/ProCascader/utils/index.js +26 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +13 -5
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProRangeLimit/index.js +17 -10
- package/es/ProForm/components/index.d.ts +1 -2
- package/es/ProForm/components/index.js +1 -4
- package/es/ProForm/components/render/Render.js +18 -13
- package/es/ProForm/components/render/RenderFields.js +3 -1
- package/es/ProForm/components/render/propsType.d.ts +3 -7
- package/es/ProForm/index.js +6 -2
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProForm/style/index.less +2 -1
- package/es/ProForm/utils/index.js +4 -1
- package/es/ProForm/utils/useChanged.js +1 -2
- package/es/ProForm/utils/useForm.js +18 -6
- package/es/ProForm/utils/useListChanged.js +1 -3
- package/es/ProIcon/config/index.d.ts +2 -0
- package/es/ProIcon/config/index.js +4 -2
- package/es/ProIcon/index.js +148 -81
- package/es/ProIcon/propsTypes.d.ts +6 -1
- package/es/ProIcon/utils/index.d.ts +5 -0
- package/es/ProIcon/utils/index.js +60 -0
- package/es/ProLayout/components/ProCollapse/index.js +6 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProSelect/index.js +1 -1
- package/es/ProStep/components/Step/index.js +4 -3
- package/es/ProStep/style/index.less +37 -0
- package/es/ProTable/utils.js +6 -3
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +16 -6
- package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
- package/es/ProTree/components/ProTree.js +96 -74
- package/es/ProTree/components/ProTreeSelect/index.js +3 -7
- package/es/ProTree/components/Tree.js +63 -41
- package/es/ProTree/style/index.less +24 -17
- package/es/ProUpload/index.js +11 -13
- package/es/ProUpload/propsType.d.ts +8 -3
- package/es/assets/view.svg +2 -2
- package/es/global.less +6 -6
- package/lib/ProConfigProvider/index.d.ts +2 -2
- package/lib/ProConfigProvider/index.js +0 -3
- package/lib/ProEditTable/components/RenderField/index.js +53 -46
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/style/index.less +0 -5
- package/lib/ProEditTable/utils/tools.d.ts +12 -0
- package/lib/ProEditTable/utils/tools.js +80 -2
- package/lib/ProForm/components/base/RangePicker/index.js +9 -9
- package/lib/ProForm/components/combination/Container/index.js +3 -2
- package/lib/ProForm/components/combination/Container/style/index.less +5 -1
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProCascader/index.js +256 -0
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
- package/lib/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +33 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +12 -4
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -10
- package/lib/ProForm/components/index.d.ts +1 -2
- package/lib/ProForm/components/index.js +1 -8
- package/lib/ProForm/components/render/Render.js +18 -13
- package/lib/ProForm/components/render/RenderFields.js +3 -1
- package/lib/ProForm/components/render/propsType.d.ts +3 -7
- package/lib/ProForm/index.js +5 -1
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProForm/style/index.less +2 -1
- package/lib/ProForm/utils/index.js +4 -1
- package/lib/ProForm/utils/useChanged.js +1 -2
- package/lib/ProForm/utils/useForm.js +18 -6
- package/lib/ProForm/utils/useListChanged.js +1 -3
- package/lib/ProIcon/config/index.d.ts +2 -0
- package/lib/ProIcon/config/index.js +4 -2
- package/lib/ProIcon/index.js +144 -77
- package/lib/ProIcon/propsTypes.d.ts +6 -1
- package/lib/ProIcon/utils/index.d.ts +5 -0
- package/lib/ProIcon/utils/index.js +62 -1
- package/lib/ProLayout/components/ProCollapse/index.js +6 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProSelect/index.js +1 -1
- package/lib/ProStep/components/Step/index.js +4 -3
- package/lib/ProStep/style/index.less +37 -0
- package/lib/ProTable/utils.js +6 -3
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +16 -6
- package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
- package/lib/ProTree/components/ProTree.js +96 -74
- package/lib/ProTree/components/ProTreeSelect/index.js +3 -7
- package/lib/ProTree/components/Tree.js +63 -41
- package/lib/ProTree/style/index.less +24 -17
- package/lib/ProUpload/index.js +10 -12
- package/lib/ProUpload/propsType.d.ts +8 -3
- package/lib/assets/view.svg +2 -2
- package/lib/global.less +6 -6
- package/package.json +2 -2
- package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/es/ProForm/components/base/ProCascader/index.js +0 -72
- package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
- package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/lib/ProForm/components/base/ProCascader/index.js +0 -78
- package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
- /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/
|
|
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', '
|
|
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 =
|
|
45
|
+
_context.next = 4;
|
|
43
46
|
return validateFields.apply(void 0, [nameList].concat(rest));
|
|
44
|
-
case
|
|
47
|
+
case 4:
|
|
45
48
|
values = _context.sent;
|
|
46
49
|
if (!nameList) {
|
|
47
|
-
_context.next =
|
|
50
|
+
_context.next = 7;
|
|
48
51
|
break;
|
|
49
52
|
}
|
|
50
53
|
return _context.abrupt("return", values);
|
|
51
|
-
case
|
|
54
|
+
case 7:
|
|
52
55
|
_values = _getFieldsValue();
|
|
53
56
|
return _context.abrupt("return", _values);
|
|
54
|
-
case
|
|
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
|
};
|
package/lib/ProIcon/index.js
CHANGED
|
@@ -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:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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,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)(
|
|
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
|
});
|
package/lib/ProSelect/index.js
CHANGED
|
@@ -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
|
|
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)(
|
|
70
|
+
children: [(0, _jsxRuntime.jsx)(_index.default, {
|
|
71
|
+
src: _catalog.default,
|
|
71
72
|
className: "menu-icon",
|
|
72
|
-
|
|
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);
|