@zat-design/sisyphus-react 3.4.4 → 3.4.5
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/babel.config.js +3 -0
- package/es/ProEditTable/components/RenderField/index.js +3 -2
- package/es/ProEditTable/index.js +13 -2
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/utils/index.js +7 -1
- package/es/ProEnum/components/Group.js +7 -1
- package/es/ProEnum/style/index.less +3 -2
- package/es/ProForm/components/combination/FormList/index.js +5 -5
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.js +36 -0
- package/es/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
- package/es/ProForm/components/combination/GroupCopy/index.js +84 -0
- package/es/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
- package/es/ProForm/components/combination/GroupCopy/propsType.js +1 -0
- package/es/ProForm/components/combination/GroupCopy/style/index.less +131 -0
- package/es/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
- package/es/ProForm/components/combination/GroupCopy/utils.js +180 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +22 -18
- package/es/ProForm/components/index.js +1 -0
- package/es/ProForm/components/render/Render.js +2 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -1
- package/es/ProIcon/config/index.d.ts +12 -0
- package/es/ProIcon/config/index.js +15 -1
- package/es/ProIcon/index.js +97 -19
- package/es/ProIcon/propsTypes.d.ts +19 -0
- package/es/ProIcon/utils/index.d.ts +1 -0
- package/es/ProIcon/utils/index.js +23 -0
- package/es/ProThemeTools/component/PrdTools/index.js +16 -0
- package/es/ProTreeModal/index.js +11 -15
- package/es/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/es/global.less +38 -2
- package/jest.config.js +8 -0
- package/lib/ProEditTable/components/RenderField/index.js +3 -2
- package/lib/ProEditTable/index.js +13 -2
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/utils/index.js +7 -1
- package/lib/ProEnum/components/Group.js +6 -0
- package/lib/ProEnum/style/index.less +3 -2
- package/lib/ProForm/components/combination/FormList/index.js +5 -5
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.js +44 -0
- package/lib/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
- package/lib/ProForm/components/combination/GroupCopy/index.js +91 -0
- package/lib/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
- package/lib/ProForm/components/combination/GroupCopy/propsType.js +5 -0
- package/lib/ProForm/components/combination/GroupCopy/style/index.less +131 -0
- package/lib/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
- package/lib/ProForm/components/combination/GroupCopy/utils.js +187 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +23 -19
- package/lib/ProForm/components/render/Render.js +2 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -1
- package/lib/ProIcon/config/index.d.ts +12 -0
- package/lib/ProIcon/config/index.js +16 -2
- package/lib/ProIcon/index.js +94 -18
- package/lib/ProIcon/propsTypes.d.ts +19 -0
- package/lib/ProIcon/utils/index.d.ts +1 -0
- package/lib/ProIcon/utils/index.js +29 -0
- package/lib/ProThemeTools/component/PrdTools/index.js +16 -0
- package/lib/ProTreeModal/index.js +11 -15
- package/lib/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/lib/global.less +38 -2
- package/package.json +6 -2
- package/test/__mocks__/fileMock.js +0 -0
- package/test/__mocks__/styleMock.js +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.defaultGetValueFromEvent = defaultGetValueFromEvent;
|
|
8
|
+
exports.transformNamesString = exports.transformColumns = exports.insertSeparator = exports.getValueTypeTrans = exports.getReactiveProps = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _valueType = _interopRequireDefault(require("../../../utils/valueType"));
|
|
15
|
+
/**
|
|
16
|
+
* 插入间隔符
|
|
17
|
+
* @param columns 表单配置数组
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
var insertSeparator = exports.insertSeparator = function insertSeparator(columns, space) {
|
|
21
|
+
if (!(space === null || space === void 0 ? void 0 : space.separator)) {
|
|
22
|
+
return columns;
|
|
23
|
+
}
|
|
24
|
+
return columns.reduce(function (result, current, index, array) {
|
|
25
|
+
// 将当前元素添加到结果数组中
|
|
26
|
+
result.push(current);
|
|
27
|
+
// 如果当前元素不是最后一个元素,则添加间隔符
|
|
28
|
+
if (index < array.length - 1) {
|
|
29
|
+
result.push({
|
|
30
|
+
component: (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
31
|
+
className: "group-separator",
|
|
32
|
+
children: space.separator
|
|
33
|
+
}),
|
|
34
|
+
fieldProps: {
|
|
35
|
+
disabled: true
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}, []);
|
|
41
|
+
};
|
|
42
|
+
/** 带出event的组件默认取值方法 */
|
|
43
|
+
function defaultGetValueFromEvent(valuePropName) {
|
|
44
|
+
var event = arguments.length <= 1 ? undefined : arguments[1];
|
|
45
|
+
if (event && event.target && (0, _typeof2.default)(event.target) === 'object' && valuePropName in event.target) {
|
|
46
|
+
return event.target[valuePropName];
|
|
47
|
+
}
|
|
48
|
+
return event;
|
|
49
|
+
}
|
|
50
|
+
/** 转换names */
|
|
51
|
+
var transformNamesString = exports.transformNamesString = function transformNamesString(arr) {
|
|
52
|
+
var result = arr.map(function (subArr) {
|
|
53
|
+
if (Array.isArray(subArr)) {
|
|
54
|
+
return subArr.join('_');
|
|
55
|
+
}
|
|
56
|
+
return subArr;
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
/** 计算响应式参数的值 */
|
|
61
|
+
var getReactiveProps = exports.getReactiveProps = function getReactiveProps(params) {
|
|
62
|
+
var form = params.form,
|
|
63
|
+
index = params.index,
|
|
64
|
+
namePath = params.namePath,
|
|
65
|
+
disabled = params.disabled,
|
|
66
|
+
show = params.show,
|
|
67
|
+
component = params.component,
|
|
68
|
+
fieldProps = params.fieldProps,
|
|
69
|
+
name = params.name;
|
|
70
|
+
var values = form.getFieldsValue(namePath || undefined);
|
|
71
|
+
var _disabled = (0, _lodash.isFunction)(disabled) ? disabled(values, {
|
|
72
|
+
form: form,
|
|
73
|
+
index: index,
|
|
74
|
+
namePath: namePath
|
|
75
|
+
}) : disabled;
|
|
76
|
+
var _show = (0, _lodash.isFunction)(show) ? show(values, {
|
|
77
|
+
form: form,
|
|
78
|
+
index: index,
|
|
79
|
+
namePath: namePath
|
|
80
|
+
}) : show;
|
|
81
|
+
var _component = (0, _lodash.isFunction)(component) ? component(values, {
|
|
82
|
+
form: form,
|
|
83
|
+
index: index,
|
|
84
|
+
namePath: namePath
|
|
85
|
+
}) : component;
|
|
86
|
+
var _fieldProps = (0, _lodash.isFunction)(fieldProps) ? fieldProps(values, {
|
|
87
|
+
form: form,
|
|
88
|
+
index: index,
|
|
89
|
+
namePath: namePath
|
|
90
|
+
}) : fieldProps;
|
|
91
|
+
return {
|
|
92
|
+
disabled: _disabled,
|
|
93
|
+
show: _show,
|
|
94
|
+
component: _component,
|
|
95
|
+
fieldProps: _fieldProps
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/** 获取当前字段的转换函数 */
|
|
99
|
+
var getValueTypeTrans = exports.getValueTypeTrans = function getValueTypeTrans(params) {
|
|
100
|
+
var _valueTypeMap$valueTy;
|
|
101
|
+
var valueType = params.valueType;
|
|
102
|
+
var transform = (_valueTypeMap$valueTy = _valueType.default[valueType]) === null || _valueTypeMap$valueTy === void 0 ? void 0 : _valueTypeMap$valueTy.call(_valueType.default, params);
|
|
103
|
+
return transform;
|
|
104
|
+
};
|
|
105
|
+
/** 转换columns */
|
|
106
|
+
var transformColumns = exports.transformColumns = function transformColumns(params) {
|
|
107
|
+
var form = params.form,
|
|
108
|
+
columns = params.columns,
|
|
109
|
+
name = params.name,
|
|
110
|
+
names = params.names,
|
|
111
|
+
outerIndex = params.index,
|
|
112
|
+
namePath = params.namePath,
|
|
113
|
+
value = params.value,
|
|
114
|
+
internalChange = params.onChange;
|
|
115
|
+
return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
|
|
116
|
+
var type = column.type,
|
|
117
|
+
valueType = column.valueType,
|
|
118
|
+
switchValue = column.switchValue,
|
|
119
|
+
toISOString = column.toISOString,
|
|
120
|
+
fieldProps = column.fieldProps,
|
|
121
|
+
getValueFromEvent = column.getValueFromEvent,
|
|
122
|
+
_column$valuePropName = column.valuePropName,
|
|
123
|
+
valuePropName = _column$valuePropName === void 0 ? 'value' : _column$valuePropName,
|
|
124
|
+
normalize = column.normalize,
|
|
125
|
+
disabled = column.disabled,
|
|
126
|
+
show = column.show,
|
|
127
|
+
component = column.component;
|
|
128
|
+
var _ref = fieldProps || {},
|
|
129
|
+
mode = _ref.mode,
|
|
130
|
+
onChange = _ref.onChange,
|
|
131
|
+
onFieldChange = _ref.onFieldChange,
|
|
132
|
+
comDisabled = _ref.disabled;
|
|
133
|
+
var _disabled = disabled !== null && disabled !== void 0 ? disabled : comDisabled;
|
|
134
|
+
var columnName = names ? names[index] : [].concat(name, index);
|
|
135
|
+
// 响应式字段
|
|
136
|
+
var reactiveProps = getReactiveProps({
|
|
137
|
+
form: form,
|
|
138
|
+
index: index,
|
|
139
|
+
type: type,
|
|
140
|
+
namePath: namePath,
|
|
141
|
+
disabled: _disabled,
|
|
142
|
+
show: show,
|
|
143
|
+
component: component,
|
|
144
|
+
fieldProps: fieldProps,
|
|
145
|
+
name: columnName
|
|
146
|
+
});
|
|
147
|
+
if (reactiveProps.show === false) return [];
|
|
148
|
+
var transform = getValueTypeTrans({
|
|
149
|
+
type: type,
|
|
150
|
+
valueType: valueType,
|
|
151
|
+
switchValue: switchValue,
|
|
152
|
+
toISOString: toISOString,
|
|
153
|
+
mode: mode
|
|
154
|
+
});
|
|
155
|
+
var newValue;
|
|
156
|
+
var handleChange = function handleChange() {
|
|
157
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
158
|
+
args[_key] = arguments[_key];
|
|
159
|
+
}
|
|
160
|
+
if (getValueFromEvent) {
|
|
161
|
+
newValue = getValueFromEvent.apply(void 0, args);
|
|
162
|
+
} else {
|
|
163
|
+
newValue = defaultGetValueFromEvent.apply(void 0, [valuePropName].concat(args));
|
|
164
|
+
}
|
|
165
|
+
if ((transform === null || transform === void 0 ? void 0 : transform.normalize) || normalize) {
|
|
166
|
+
var _transform$normalize;
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
newValue = ((_transform$normalize = transform.normalize) === null || _transform$normalize === void 0 ? void 0 : _transform$normalize.call(transform, newValue)) || (normalize === null || normalize === void 0 ? void 0 : normalize(newValue));
|
|
169
|
+
}
|
|
170
|
+
internalChange === null || internalChange === void 0 ? void 0 : internalChange(newValue, args[1], index);
|
|
171
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, args);
|
|
172
|
+
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, form.getFieldValue(namePath), {
|
|
173
|
+
index: outerIndex,
|
|
174
|
+
namePath: namePath,
|
|
175
|
+
form: form
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, column), {}, {
|
|
179
|
+
name: columnName
|
|
180
|
+
}, reactiveProps), {}, {
|
|
181
|
+
fieldProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, column === null || column === void 0 ? void 0 : column.fieldProps), {}, {
|
|
182
|
+
onChange: handleChange,
|
|
183
|
+
value: value === null || value === void 0 ? void 0 : value[index]
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
@@ -15,7 +15,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
var _icons = require("@ant-design/icons");
|
|
17
17
|
var _ahooks = require("ahooks");
|
|
18
|
-
var _umi = require("umi");
|
|
19
18
|
var _antd = require("antd");
|
|
20
19
|
var _lodash = require("lodash");
|
|
21
20
|
var _reactSvg = require("react-svg");
|
|
@@ -23,7 +22,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
23
22
|
var _index = require("../../../../index");
|
|
24
23
|
var _Container = _interopRequireDefault(require("../../Container"));
|
|
25
24
|
var _view = _interopRequireDefault(require("../../../../assets/view.svg"));
|
|
26
|
-
var
|
|
25
|
+
var _useRequestList3 = _interopRequireDefault(require("./hooks/useRequestList"));
|
|
27
26
|
var _locale = _interopRequireDefault(require("../../../../locale"));
|
|
28
27
|
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "isTooltip", "searchForm", "defaultOne"],
|
|
29
28
|
_excluded2 = ["onOk"],
|
|
@@ -124,17 +123,22 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
124
123
|
form = _Form$useForm2[0];
|
|
125
124
|
var selectedRows = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || _selectedRows;
|
|
126
125
|
var selectedRowKeys = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
|
|
127
|
-
var
|
|
126
|
+
var _useRequestList = (0, _useRequestList3.default)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
|
|
127
|
+
withPagination: withPagination,
|
|
128
|
+
transformParams: transformParams,
|
|
129
|
+
transformResponse: transformResponse
|
|
130
|
+
}, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
|
128
131
|
manual: true,
|
|
129
|
-
onSuccess: function onSuccess(
|
|
130
|
-
var
|
|
132
|
+
onSuccess: function onSuccess(res) {
|
|
133
|
+
var _res$data;
|
|
134
|
+
var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
|
|
131
135
|
setState({
|
|
132
136
|
options: list
|
|
133
137
|
});
|
|
134
138
|
}
|
|
135
139
|
})),
|
|
136
|
-
run =
|
|
137
|
-
var
|
|
140
|
+
run = _useRequestList.run;
|
|
141
|
+
var _useRequestList2 = (0, _useRequestList3.default)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
|
|
138
142
|
withPagination: withPagination,
|
|
139
143
|
transformParams: transformParams,
|
|
140
144
|
transformResponse: transformResponse
|
|
@@ -142,13 +146,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
142
146
|
manual: true,
|
|
143
147
|
ready: ((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne) && !readOnly || visible
|
|
144
148
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
|
|
145
|
-
data =
|
|
146
|
-
loading =
|
|
147
|
-
pagination =
|
|
148
|
-
onSearch =
|
|
149
|
-
onReset =
|
|
150
|
-
runAsync =
|
|
151
|
-
mutate =
|
|
149
|
+
data = _useRequestList2.data,
|
|
150
|
+
loading = _useRequestList2.loading,
|
|
151
|
+
pagination = _useRequestList2.pagination,
|
|
152
|
+
onSearch = _useRequestList2.onSearch,
|
|
153
|
+
onReset = _useRequestList2.onReset,
|
|
154
|
+
runAsync = _useRequestList2.runAsync,
|
|
155
|
+
mutate = _useRequestList2.mutate;
|
|
152
156
|
var defaultOptionRender = function defaultOptionRender(rowData) {
|
|
153
157
|
return rowData === null || rowData === void 0 ? void 0 : rowData[labelKey];
|
|
154
158
|
};
|
|
@@ -420,7 +424,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
420
424
|
// 初始化回显,当传入initParams时,前端用来回险
|
|
421
425
|
var getInitValues = /*#__PURE__*/function () {
|
|
422
426
|
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
|
423
|
-
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$
|
|
427
|
+
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data2, _data2, nextSelectRowKeys;
|
|
424
428
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
|
425
429
|
while (1) switch (_context4.prev = _context4.next) {
|
|
426
430
|
case 0:
|
|
@@ -449,7 +453,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
449
453
|
if (transformResponse) {
|
|
450
454
|
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
|
451
455
|
} else {
|
|
452
|
-
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$
|
|
456
|
+
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
|
453
457
|
}
|
|
454
458
|
_data2 = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
|
|
455
459
|
if (_data2) {
|
|
@@ -486,7 +490,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
486
490
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
|
487
491
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
|
|
488
492
|
var _useRequest$options4, _useRequest$options5;
|
|
489
|
-
var queryBean, page, params, res, _list2, list, _res$
|
|
493
|
+
var queryBean, page, params, res, _list2, list, _res$data3, _data3, nextSelectRowKeys;
|
|
490
494
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
|
|
491
495
|
while (1) switch (_context5.prev = _context5.next) {
|
|
492
496
|
case 0:
|
|
@@ -508,7 +512,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
508
512
|
if (transformResponse) {
|
|
509
513
|
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
|
510
514
|
} else {
|
|
511
|
-
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$
|
|
515
|
+
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
|
|
512
516
|
}
|
|
513
517
|
_data3 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
|
|
514
518
|
nextSelectRowKeys = isMultiple ? value : [value];
|
|
@@ -667,7 +671,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
667
671
|
// 没有值的时候,初始化点击默认查询前五十条
|
|
668
672
|
if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
|
|
669
673
|
var _useRequest$options9;
|
|
670
|
-
var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
|
|
674
|
+
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams) || {};
|
|
671
675
|
var params = withPagination ? {
|
|
672
676
|
pageNum: 1,
|
|
673
677
|
pageSize: 50,
|
|
@@ -153,9 +153,9 @@ var Render = function Render(props) {
|
|
|
153
153
|
Object.assign(otherFormItemProps, transforms, {
|
|
154
154
|
names: otherProps.names
|
|
155
155
|
}, internalRule, {
|
|
156
|
-
required: typeof labelRequired === 'boolean' ? labelRequired : _required || (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
|
|
156
|
+
required: typeof labelRequired === 'boolean' ? labelRequired : _required || Array.isArray(rules) && (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
|
|
157
157
|
return item === null || item === void 0 ? void 0 : item.required;
|
|
158
|
-
}))
|
|
158
|
+
})) || false
|
|
159
159
|
}, otherProps.isView && !requiredOnView ? {
|
|
160
160
|
required: false
|
|
161
161
|
} : null, (0, _objectSpread2.default)({}, (0, _index.isTrim)(type, trim, (0, _ProConfigProvider.useProConfig)())), // 优先取传进来的,其次取ProConfigProvider配置的
|
|
@@ -52,7 +52,7 @@ interface ControlProps {
|
|
|
52
52
|
/**
|
|
53
53
|
* 扩展函数的参数
|
|
54
54
|
*/
|
|
55
|
-
type FunctionArgs<Values, R = any> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
|
|
55
|
+
export type FunctionArgs<Values, R = any> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
|
|
56
56
|
form: FormInstance<Values>;
|
|
57
57
|
index?: number;
|
|
58
58
|
namePath?: NamePath;
|
|
@@ -3,3 +3,15 @@ export declare const iconMap: {
|
|
|
3
3
|
'text-cn': string;
|
|
4
4
|
'text-en': string;
|
|
5
5
|
}[];
|
|
6
|
+
export declare const themeMap: {
|
|
7
|
+
'#006AFF': string[];
|
|
8
|
+
'#00BC70': string[];
|
|
9
|
+
'#FF8C16': string[];
|
|
10
|
+
'#A00F20': string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const themeFillMap: {
|
|
13
|
+
'#006AFF': string[];
|
|
14
|
+
'#00BC70': string[];
|
|
15
|
+
'#FF8C16': string[];
|
|
16
|
+
'#A00F20': string[];
|
|
17
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.iconMap = void 0;
|
|
6
|
+
exports.themeMap = exports.themeFillMap = exports.iconMap = void 0;
|
|
7
7
|
var iconMap = exports.iconMap = [{
|
|
8
8
|
type: 'view',
|
|
9
9
|
'text-cn': '查看',
|
|
@@ -260,4 +260,18 @@ var iconMap = exports.iconMap = [{
|
|
|
260
260
|
type: 'tiaozhengxuhao',
|
|
261
261
|
'text-cn': '调整序号',
|
|
262
262
|
'text-en': 'adjust order'
|
|
263
|
-
}];
|
|
263
|
+
}];
|
|
264
|
+
// 渐变色icon预设
|
|
265
|
+
var themeMap = exports.themeMap = {
|
|
266
|
+
'#006AFF': ['#ADDDFF', '#5FB3D8', '#4181FF'],
|
|
267
|
+
'#00BC70': ['#FFFFFF', '#54DFA7', '#00BC70'],
|
|
268
|
+
'#FF8C16': ['#FFFFFF', '#FFA74E', '#FF8C17'],
|
|
269
|
+
'#A00F20': ['#FFFFFF', '#E47B7B', '#A00E20']
|
|
270
|
+
};
|
|
271
|
+
// 双色icon预设
|
|
272
|
+
var themeFillMap = exports.themeFillMap = {
|
|
273
|
+
'#006AFF': ['none', '#87F1FC', 'black', '#4181FF'],
|
|
274
|
+
'#00BC70': ['none', '#05FFEC', 'black', '#00BC70'],
|
|
275
|
+
'#FF8C16': ['none', '#FED736', 'black', '#FF8C17'],
|
|
276
|
+
'#A00F20': ['none', '#FD8357', 'black', '#A00E20']
|
|
277
|
+
};
|
package/lib/ProIcon/index.js
CHANGED
|
@@ -12,12 +12,17 @@ var _ahooks = require("ahooks");
|
|
|
12
12
|
var _antd = require("antd");
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _lodash = require("lodash");
|
|
15
|
+
var _reactSvg = require("react-svg");
|
|
15
16
|
var _ProConfigProvider = require("../ProConfigProvider");
|
|
16
17
|
var _config2 = require("./config");
|
|
18
|
+
var _utils = require("./utils");
|
|
17
19
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
18
|
-
var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList"];
|
|
20
|
+
var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap"];
|
|
19
21
|
var ProIcon = function ProIcon(props) {
|
|
20
|
-
var
|
|
22
|
+
var _useProConfig = (0, _ProConfigProvider.useProConfig)(),
|
|
23
|
+
state = _useProConfig.state;
|
|
24
|
+
var config = state.ProIcon,
|
|
25
|
+
antdTheme = state.theme;
|
|
21
26
|
var _config = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), props !== null && props !== void 0 ? props : {});
|
|
22
27
|
var _config$type = _config.type,
|
|
23
28
|
type = _config$type === void 0 ? null : _config$type,
|
|
@@ -41,14 +46,17 @@ var ProIcon = function ProIcon(props) {
|
|
|
41
46
|
children = _config.children,
|
|
42
47
|
_config$mapList = _config.mapList,
|
|
43
48
|
mapList = _config$mapList === void 0 ? [] : _config$mapList,
|
|
49
|
+
src = _config.src,
|
|
50
|
+
actionMap = _config.actionMap,
|
|
44
51
|
reset = (0, _objectWithoutProperties2.default)(_config, _excluded);
|
|
52
|
+
// 主题色
|
|
53
|
+
var _ref = antdTheme !== null && antdTheme !== void 0 ? antdTheme : {},
|
|
54
|
+
_ref$primaryColor = _ref.primaryColor,
|
|
55
|
+
primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor;
|
|
45
56
|
// 语言
|
|
46
57
|
var language = _locale.default.ProIcon.language;
|
|
47
58
|
// 加载内部icon
|
|
48
|
-
|
|
49
|
-
if (status !== 'ready') {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
59
|
+
(0, _ahooks.useExternal)('https://at.alicdn.com/t/c/font_4063056_jmnz9g5uycp.js');
|
|
52
60
|
var rotateStyle = rotate ? {
|
|
53
61
|
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
54
62
|
transform: "rotate(".concat(rotate, "deg)")
|
|
@@ -70,6 +78,8 @@ var ProIcon = function ProIcon(props) {
|
|
|
70
78
|
var mergedMapList = (0, _lodash.uniqBy)(mapList.concat(_config2.iconMap), targetTextFill);
|
|
71
79
|
var _type = type;
|
|
72
80
|
var _text = children;
|
|
81
|
+
// svg图标对应文本
|
|
82
|
+
var iconText = '';
|
|
73
83
|
var typeIsExistAndIncludeEnglish = _type && /[a-zA-Z]/.test(_type);
|
|
74
84
|
// 模式为icon下,对传入的text进行指定语言-icon 映射
|
|
75
85
|
if (isIconMode && !type) {
|
|
@@ -79,6 +89,7 @@ var ProIcon = function ProIcon(props) {
|
|
|
79
89
|
});
|
|
80
90
|
if (target) {
|
|
81
91
|
_type = target === null || target === void 0 ? void 0 : target.type;
|
|
92
|
+
iconText = target[targetTextFill];
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
95
|
}
|
|
@@ -93,24 +104,89 @@ var ProIcon = function ProIcon(props) {
|
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
106
|
}
|
|
107
|
+
var svgProps = {
|
|
108
|
+
className: proIconClassNames,
|
|
109
|
+
fill: 'currentColor',
|
|
110
|
+
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
111
|
+
width: size,
|
|
112
|
+
height: size
|
|
113
|
+
}, rotateStyle), style)
|
|
114
|
+
};
|
|
96
115
|
var RenderIcon = (0, _jsxRuntime.jsx)("span", (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
97
116
|
className: "anticon",
|
|
98
117
|
style: {
|
|
99
118
|
color: color
|
|
100
119
|
}
|
|
101
120
|
}, reset), {}, {
|
|
102
|
-
children: (0, _jsxRuntime.jsx)(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
121
|
+
children: (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
122
|
+
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]);
|
|
158
|
+
});
|
|
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);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}))
|
|
114
190
|
})
|
|
115
191
|
}));
|
|
116
192
|
return !isExtendButtonMode ? RenderIcon : (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
@@ -6,7 +6,21 @@ interface iconMap {
|
|
|
6
6
|
'text-cn'?: string;
|
|
7
7
|
'text-en'?: string;
|
|
8
8
|
}
|
|
9
|
+
interface themeMap {
|
|
10
|
+
[key: string]: string[];
|
|
11
|
+
}
|
|
12
|
+
interface actionMap {
|
|
13
|
+
themeMap?: themeMap;
|
|
14
|
+
themeFillMap?: themeMap;
|
|
15
|
+
gradation?: string[];
|
|
16
|
+
fill?: string[];
|
|
17
|
+
}
|
|
9
18
|
export interface ProIconProps {
|
|
19
|
+
/**
|
|
20
|
+
* @description 本地import引入
|
|
21
|
+
* @default ""
|
|
22
|
+
*/
|
|
23
|
+
src?: string;
|
|
10
24
|
/**
|
|
11
25
|
* @description 图标的名称
|
|
12
26
|
* @default -
|
|
@@ -75,5 +89,10 @@ export interface ProIconProps {
|
|
|
75
89
|
* @default 项目内认默映射
|
|
76
90
|
*/
|
|
77
91
|
mapList?: iconMap[];
|
|
92
|
+
/**
|
|
93
|
+
* @description svg变更操作表 请到 ProThemeTools 主题配置查看示例
|
|
94
|
+
* @default
|
|
95
|
+
*/
|
|
96
|
+
actionMap?: actionMap;
|
|
78
97
|
}
|
|
79
98
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const recurseGetNodes: (type: any, node: any, queue: any) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.recurseGetNodes = void 0;
|
|
7
|
+
var recurseGetNodes = exports.recurseGetNodes = function recurseGetNodes(type, node, queue) {
|
|
8
|
+
switch (type) {
|
|
9
|
+
// 渐变
|
|
10
|
+
case 'gradation':
|
|
11
|
+
if (node.nodeName === 'stop' && node.getAttribute('stop-color')) {
|
|
12
|
+
queue.push(node);
|
|
13
|
+
}
|
|
14
|
+
break;
|
|
15
|
+
// 填充
|
|
16
|
+
case 'fill':
|
|
17
|
+
if (node.getAttribute && node.getAttribute('fill')) {
|
|
18
|
+
queue.push(node);
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
default:
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
if (node.childNodes) {
|
|
25
|
+
for (var i = 0; i < node.childNodes.length; i++) {
|
|
26
|
+
recurseGetNodes(type, node.childNodes[i], queue);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -65,6 +65,14 @@ var PrdTools = function PrdTools(_ref) {
|
|
|
65
65
|
};
|
|
66
66
|
});
|
|
67
67
|
setActive(newArray);
|
|
68
|
+
dispatch({
|
|
69
|
+
type: 'set',
|
|
70
|
+
payload: {
|
|
71
|
+
theme: {
|
|
72
|
+
primaryColor: zauiBrand
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
68
76
|
}
|
|
69
77
|
}, []);
|
|
70
78
|
return (0, _jsxRuntime.jsxs)(NewDrawer, {
|
|
@@ -105,6 +113,14 @@ var PrdTools = function PrdTools(_ref) {
|
|
|
105
113
|
(0, _index.setThemes)({
|
|
106
114
|
'zaui-brand': item.color
|
|
107
115
|
});
|
|
116
|
+
dispatch({
|
|
117
|
+
type: 'set',
|
|
118
|
+
payload: {
|
|
119
|
+
theme: {
|
|
120
|
+
primaryColor: item.color
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
108
124
|
},
|
|
109
125
|
children: item.active ? (0, _jsxRuntime.jsx)(_icons.CheckOutlined, {}) : null
|
|
110
126
|
}, item.color);
|