@zat-design/sisyphus-react 3.6.2 → 3.6.3
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 +3 -3
- package/dist/less.esm.css +3 -3
- package/es/ProEditTable/components/ActionButton/index.js +4 -4
- package/es/ProEditTable/components/RenderToolbar/index.js +12 -22
- package/es/ProEditTable/utils/index.js +14 -23
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -4
- package/es/ProForm/components/combination/FormList/index.js +5 -0
- package/es/ProForm/components/combination/ProCascader/index.js +43 -15
- package/es/ProForm/components/combination/ProCascader/style/index.less +3 -3
- package/es/ProForm/components/render/Render.js +1 -1
- package/es/ProLayout/index.js +5 -2
- package/es/ProLayout/propTypes.d.ts +4 -0
- package/es/ProLayout/utils/index.d.ts +2 -2
- package/es/ProLayout/utils/index.js +6 -4
- package/es/ProSelect/utils/index.js +3 -2
- package/es/ProStep/components/Listener/index.js +3 -8
- package/es/ProStep/index.js +48 -73
- package/lib/ProEditTable/components/ActionButton/index.js +4 -4
- package/lib/ProEditTable/components/RenderToolbar/index.js +12 -22
- package/lib/ProEditTable/utils/index.js +14 -23
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -4
- package/lib/ProForm/components/combination/FormList/index.js +5 -0
- package/lib/ProForm/components/combination/ProCascader/index.js +42 -14
- package/lib/ProForm/components/combination/ProCascader/style/index.less +3 -3
- package/lib/ProForm/components/render/Render.js +1 -1
- package/lib/ProLayout/index.js +5 -2
- package/lib/ProLayout/propTypes.d.ts +4 -0
- package/lib/ProLayout/utils/index.d.ts +2 -2
- package/lib/ProLayout/utils/index.js +6 -4
- package/lib/ProSelect/utils/index.js +3 -2
- package/lib/ProStep/components/Listener/index.js +3 -8
- package/lib/ProStep/index.js +46 -71
- package/package.json +1 -1
- package/es/ProWaterMark/__snapshots__/index.test.tsx.snap +0 -7
- package/lib/ProWaterMark/__snapshots__/index.test.tsx.snap +0 -7
package/dist/index.esm.css
CHANGED
|
@@ -2316,20 +2316,20 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2316
2316
|
width: 100%;
|
|
2317
2317
|
}
|
|
2318
2318
|
.pro-address .ant-cascader {
|
|
2319
|
-
width:
|
|
2319
|
+
width: 45% !important;
|
|
2320
2320
|
}
|
|
2321
2321
|
.pro-address .ant-cascader.no-detail {
|
|
2322
2322
|
width: 100% !important;
|
|
2323
2323
|
}
|
|
2324
2324
|
.pro-address .pro-address-detail {
|
|
2325
|
-
width:
|
|
2325
|
+
width: 55%;
|
|
2326
2326
|
margin-left: 2px;
|
|
2327
2327
|
}
|
|
2328
2328
|
.pro-address .pro-address-detail .ant-input-affix-wrapper {
|
|
2329
2329
|
width: 100%;
|
|
2330
2330
|
}
|
|
2331
2331
|
.pro-address .ant-input-affix-wrapper {
|
|
2332
|
-
width:
|
|
2332
|
+
width: 55%;
|
|
2333
2333
|
margin-left: 2px;
|
|
2334
2334
|
}
|
|
2335
2335
|
.pro-number-range .range-split {
|
package/dist/less.esm.css
CHANGED
|
@@ -2316,20 +2316,20 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2316
2316
|
width: 100%;
|
|
2317
2317
|
}
|
|
2318
2318
|
.pro-address .ant-cascader {
|
|
2319
|
-
width:
|
|
2319
|
+
width: 45% !important;
|
|
2320
2320
|
}
|
|
2321
2321
|
.pro-address .ant-cascader.no-detail {
|
|
2322
2322
|
width: 100% !important;
|
|
2323
2323
|
}
|
|
2324
2324
|
.pro-address .pro-address-detail {
|
|
2325
|
-
width:
|
|
2325
|
+
width: 55%;
|
|
2326
2326
|
margin-left: 2px;
|
|
2327
2327
|
}
|
|
2328
2328
|
.pro-address .pro-address-detail .ant-input-affix-wrapper {
|
|
2329
2329
|
width: 100%;
|
|
2330
2330
|
}
|
|
2331
2331
|
.pro-address .ant-input-affix-wrapper {
|
|
2332
|
-
width:
|
|
2332
|
+
width: 55%;
|
|
2333
2333
|
margin-left: 2px;
|
|
2334
2334
|
}
|
|
2335
2335
|
.pro-number-range .range-split {
|
|
@@ -60,7 +60,7 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
60
60
|
// 其他操作按钮Props
|
|
61
61
|
var actionBtnProps = _objectSpread(_objectSpread({}, btnConfig.buttonProps), {}, {
|
|
62
62
|
onClick: function onClick() {
|
|
63
|
-
btnConfig.onEvent(record, index);
|
|
63
|
+
btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
|
|
64
64
|
},
|
|
65
65
|
disabled: getDisabled((_btnConfig$buttonProp3 = btnConfig.buttonProps) === null || _btnConfig$buttonProp3 === void 0 ? void 0 : _btnConfig$buttonProp3.disabled)
|
|
66
66
|
});
|
|
@@ -77,7 +77,7 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
77
77
|
placement: "topRight",
|
|
78
78
|
title: deleteMsgMap[btnConfig.type],
|
|
79
79
|
onConfirm: function onConfirm() {
|
|
80
|
-
btnConfig.onEvent(record, index);
|
|
80
|
+
btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
|
|
81
81
|
},
|
|
82
82
|
disabled: isDisabled,
|
|
83
83
|
okText: locale.ProEditTable.confirm,
|
|
@@ -97,13 +97,13 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
97
97
|
index: index,
|
|
98
98
|
disabled: isDisabled,
|
|
99
99
|
onClick: function onClick() {
|
|
100
|
-
btnConfig.onEvent(record, index);
|
|
100
|
+
btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
|
|
101
101
|
}
|
|
102
102
|
}))) : _jsx(_Button, _objectSpread(_objectSpread({}, omit(delBtnProps, ['buttonProps', 'isEditable'])), {}, {
|
|
103
103
|
disabled: isDisabled,
|
|
104
104
|
type: "link",
|
|
105
105
|
onClick: function onClick() {
|
|
106
|
-
btnConfig.onEvent(record, index);
|
|
106
|
+
btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
|
|
107
107
|
},
|
|
108
108
|
children: btnConfig.label
|
|
109
109
|
}))
|
|
@@ -73,37 +73,27 @@ var RenderToolbar = function RenderToolbar(config) {
|
|
|
73
73
|
toolbar.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
|
|
74
74
|
toolbar.onEvent = /*#__PURE__*/function () {
|
|
75
75
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, index) {
|
|
76
|
-
var _yield$onEvent;
|
|
77
76
|
var onEvent, result;
|
|
78
77
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
79
78
|
while (1) switch (_context.prev = _context.next) {
|
|
80
79
|
case 0:
|
|
81
80
|
onEvent = onClick || onHandle;
|
|
82
|
-
|
|
81
|
+
if (onEvent) {
|
|
82
|
+
_context.next = 5;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
result = true;
|
|
86
|
+
_context.next = 8;
|
|
87
|
+
break;
|
|
88
|
+
case 5:
|
|
89
|
+
_context.next = 7;
|
|
83
90
|
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(selectedRows, dataSource, {
|
|
84
91
|
form: form,
|
|
85
92
|
namePath: virtualName
|
|
86
93
|
});
|
|
87
|
-
case 3:
|
|
88
|
-
_context.t1 = _yield$onEvent = _context.sent;
|
|
89
|
-
_context.t0 = _context.t1 !== null;
|
|
90
|
-
if (!_context.t0) {
|
|
91
|
-
_context.next = 7;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
_context.t0 = _yield$onEvent !== void 0;
|
|
95
94
|
case 7:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
_context.t2 = _yield$onEvent;
|
|
101
|
-
_context.next = 12;
|
|
102
|
-
break;
|
|
103
|
-
case 11:
|
|
104
|
-
_context.t2 = true;
|
|
105
|
-
case 12:
|
|
106
|
-
result = _context.t2;
|
|
95
|
+
result = _context.sent;
|
|
96
|
+
case 8:
|
|
107
97
|
if (result && type !== 'custom') {
|
|
108
98
|
actions[type](_objectSpread(_objectSpread({}, config), {}, {
|
|
109
99
|
index: index,
|
|
@@ -113,7 +103,7 @@ var RenderToolbar = function RenderToolbar(config) {
|
|
|
113
103
|
virtualName: virtualName
|
|
114
104
|
}));
|
|
115
105
|
}
|
|
116
|
-
case
|
|
106
|
+
case 9:
|
|
117
107
|
case "end":
|
|
118
108
|
return _context.stop();
|
|
119
109
|
}
|
|
@@ -79,7 +79,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
79
79
|
action.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
|
|
80
80
|
action.onEvent = /*#__PURE__*/function () {
|
|
81
81
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, index) {
|
|
82
|
-
var _form$getFieldValue
|
|
82
|
+
var _form$getFieldValue;
|
|
83
83
|
var rowName, _record, onEvent, result;
|
|
84
84
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
85
85
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -105,31 +105,22 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
105
105
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
|
106
106
|
_record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
|
|
107
107
|
onEvent = onClick || onHandle;
|
|
108
|
-
|
|
108
|
+
if (onEvent) {
|
|
109
|
+
_context.next = 18;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
result = true;
|
|
113
|
+
_context.next = 21;
|
|
114
|
+
break;
|
|
115
|
+
case 18:
|
|
116
|
+
_context.next = 20;
|
|
109
117
|
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
|
|
110
118
|
form: form,
|
|
111
119
|
namePath: virtualRowName
|
|
112
120
|
});
|
|
113
|
-
case 16:
|
|
114
|
-
_context.t2 = _yield$onEvent = _context.sent;
|
|
115
|
-
_context.t1 = _context.t2 !== null;
|
|
116
|
-
if (!_context.t1) {
|
|
117
|
-
_context.next = 20;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
_context.t1 = _yield$onEvent !== void 0;
|
|
121
121
|
case 20:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
_context.t3 = _yield$onEvent;
|
|
127
|
-
_context.next = 25;
|
|
128
|
-
break;
|
|
129
|
-
case 24:
|
|
130
|
-
_context.t3 = true;
|
|
131
|
-
case 25:
|
|
132
|
-
result = _context.t3;
|
|
122
|
+
result = _context.sent;
|
|
123
|
+
case 21:
|
|
133
124
|
if (result && type !== 'custom') {
|
|
134
125
|
actions[type](_objectSpread(_objectSpread({}, config), {}, {
|
|
135
126
|
rowName: [].concat(_toConsumableArray(name), [index]),
|
|
@@ -139,7 +130,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
139
130
|
validateKeys: validateKeys
|
|
140
131
|
}));
|
|
141
132
|
}
|
|
142
|
-
case
|
|
133
|
+
case 22:
|
|
143
134
|
case "end":
|
|
144
135
|
return _context.stop();
|
|
145
136
|
}
|
|
@@ -204,7 +195,7 @@ export var transformColumns = function transformColumns() {
|
|
|
204
195
|
setState = config.setState,
|
|
205
196
|
page = config.page;
|
|
206
197
|
var isCell = mode === 'cell';
|
|
207
|
-
var _columns =
|
|
198
|
+
var _columns = cloneDeep(columns);
|
|
208
199
|
var _cacheMap = _objectSpread({}, cacheMap.current);
|
|
209
200
|
var pageNum = tools.calc(page.pageNum, '-', 1);
|
|
210
201
|
var firstIndex = tools.calc(pageNum, '*', page.pageSize);
|
|
@@ -17,10 +17,8 @@ import locale from '../../../../../locale';
|
|
|
17
17
|
var actions = {
|
|
18
18
|
add: {
|
|
19
19
|
onClick: function onClick(value, _ref) {
|
|
20
|
-
var operation = _ref.operation
|
|
21
|
-
|
|
22
|
-
namePath = _ref.namePath;
|
|
23
|
-
operation.add();
|
|
20
|
+
var operation = _ref.operation;
|
|
21
|
+
operation.add({});
|
|
24
22
|
},
|
|
25
23
|
label: "".concat(locale.ProForm.formListActions[5]),
|
|
26
24
|
icon: _jsx(PlusOutlined, {})
|
|
@@ -5,6 +5,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef, useCallback, useImperativeHandle } from 'react';
|
|
7
7
|
import { DndContext } from '@dnd-kit/core';
|
|
8
|
+
import { cloneDeep, isFunction } from 'lodash';
|
|
8
9
|
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
9
10
|
import { toArray } from '../../../utils';
|
|
10
11
|
import { namesPathTransform } from './utils';
|
|
@@ -55,6 +56,10 @@ var FormList = function FormList(props, ref) {
|
|
|
55
56
|
listName: [].concat(_toConsumableArray(namePath), [item.name]),
|
|
56
57
|
label: mode === 'less' ? undefined : item.label
|
|
57
58
|
});
|
|
59
|
+
// 可编辑表格的columns需要消除引用关系,防止串数据
|
|
60
|
+
if (column.type === 'ProEditTable' && !isFunction(column.fieldProps)) {
|
|
61
|
+
column.fieldProps.columns = cloneDeep(column.fieldProps.columns);
|
|
62
|
+
}
|
|
58
63
|
return column;
|
|
59
64
|
});
|
|
60
65
|
}, [columns]);
|
|
@@ -16,7 +16,7 @@ import _Typography from "antd/es/typography";
|
|
|
16
16
|
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator", "detailPlaceholder"];
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
import { useEffect, useState, memo, useMemo } from 'react';
|
|
19
|
-
import { omit } from 'lodash';
|
|
19
|
+
import { omit, find as _find } from 'lodash';
|
|
20
20
|
import { transformDataName } from './utils/index';
|
|
21
21
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
22
22
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
|
@@ -181,20 +181,6 @@ var ProCascader = function ProCascader(props) {
|
|
|
181
181
|
return option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
|
-
var handleAddressChange = function handleAddressChange(e) {
|
|
185
|
-
var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
|
|
186
|
-
if (onChange) {
|
|
187
|
-
if (!e.target.value && (cascaderValue === null || cascaderValue === void 0 ? void 0 : cascaderValue.every(function (item) {
|
|
188
|
-
return !item;
|
|
189
|
-
}))) {
|
|
190
|
-
onChange(undefined);
|
|
191
|
-
} else {
|
|
192
|
-
var realValue = value ? _toConsumableArray(value) : [];
|
|
193
|
-
realValue[realLevel] = e.target.value;
|
|
194
|
-
onChange(realValue);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
184
|
var displayRender = function displayRender(label) {
|
|
199
185
|
return label === null || label === void 0 ? void 0 : label.filter(function (item) {
|
|
200
186
|
return !!item;
|
|
@@ -208,6 +194,48 @@ var ProCascader = function ProCascader(props) {
|
|
|
208
194
|
})) === null || _ref7$filter === void 0 ? void 0 : _ref7$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
|
209
195
|
return !!item;
|
|
210
196
|
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
|
197
|
+
var findSelectedOptions = function findSelectedOptions(options, value) {
|
|
198
|
+
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
199
|
+
var _value = value !== null && value !== void 0 ? value : [];
|
|
200
|
+
// 基准情况:如果 value 数组为空,且 path 不为空,说明找到了完整的路径
|
|
201
|
+
if ((_value === null || _value === void 0 ? void 0 : _value.length) === 0 && (path === null || path === void 0 ? void 0 : path.length) > 0) {
|
|
202
|
+
return path;
|
|
203
|
+
}
|
|
204
|
+
// 如果没有更多的 _value 需要匹配,或者当前选项没有 children,返回 null
|
|
205
|
+
if ((_value === null || _value === void 0 ? void 0 : _value.length) === 0 || !options || options.length === 0) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
// 尝试在当前层级的选项中查找匹配的 _value
|
|
209
|
+
var currentValue = _value[0];
|
|
210
|
+
var foundOption = _find(options, {
|
|
211
|
+
value: currentValue
|
|
212
|
+
});
|
|
213
|
+
if (foundOption) {
|
|
214
|
+
// 如果找到了匹配的选项,并且还有更多的 value 需要匹配,递归地在子选项中查找
|
|
215
|
+
if (_value.length > 1 && foundOption.children) {
|
|
216
|
+
return findSelectedOptions(foundOption.children, _value.slice(1), [].concat(_toConsumableArray(path), [foundOption]));
|
|
217
|
+
}
|
|
218
|
+
// 如果没有更多的 value 需要匹配,返回当前选项(以及之前的路径)
|
|
219
|
+
return [].concat(_toConsumableArray(path), [foundOption]);
|
|
220
|
+
}
|
|
221
|
+
// 如果没有在当前层级的选项中找到匹配的 value,返回 null
|
|
222
|
+
return null;
|
|
223
|
+
};
|
|
224
|
+
var _selectedOptions = findSelectedOptions(service ? serviceData : realDataSource, addressValue);
|
|
225
|
+
var handleAddressChange = function handleAddressChange(e) {
|
|
226
|
+
var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
|
|
227
|
+
if (onChange) {
|
|
228
|
+
if (!e.target.value && (cascaderValue === null || cascaderValue === void 0 ? void 0 : cascaderValue.every(function (item) {
|
|
229
|
+
return !item;
|
|
230
|
+
}))) {
|
|
231
|
+
onChange(undefined);
|
|
232
|
+
} else {
|
|
233
|
+
var realValue = value ? _toConsumableArray(value) : [];
|
|
234
|
+
realValue[realLevel] = e.target.value;
|
|
235
|
+
onChange(realValue, _selectedOptions);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
211
239
|
return realIsView ? tooltip ? _jsx(_Tooltip, {
|
|
212
240
|
className: className,
|
|
213
241
|
title: tooltip === true ? viewValue : tooltip,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
width: 100%;
|
|
7
7
|
|
|
8
8
|
.@{ant-prefix}-cascader {
|
|
9
|
-
width:
|
|
9
|
+
width: 45% !important;
|
|
10
10
|
|
|
11
11
|
&.no-detail {
|
|
12
12
|
width: 100% !important;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.pro-address-detail {
|
|
17
|
-
width:
|
|
17
|
+
width: 55%;
|
|
18
18
|
margin-left: 2px;
|
|
19
19
|
|
|
20
20
|
.@{ant-prefix}-input-affix-wrapper {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.@{ant-prefix}-input-affix-wrapper {
|
|
26
|
-
width:
|
|
26
|
+
width: 55%;
|
|
27
27
|
margin-left: 2px;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -416,7 +416,7 @@ var Render = function Render(props) {
|
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
418
|
// 需要过滤掉的form_item的key
|
|
419
|
-
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl'];
|
|
419
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl', 'listName'];
|
|
420
420
|
if (type === 'FormList') {
|
|
421
421
|
lastComponentProps.disabled = lastDisabled;
|
|
422
422
|
var lessMode = lastComponentProps.mode === 'less';
|
package/es/ProLayout/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { transformMenus } from './utils';
|
|
|
14
14
|
// 全局上下文
|
|
15
15
|
export var LayoutContext = /*#__PURE__*/createContext(undefined);
|
|
16
16
|
var ProLayout = function ProLayout(props) {
|
|
17
|
+
var _Object$keys;
|
|
17
18
|
var children = props.children,
|
|
18
19
|
_props$className = props.className,
|
|
19
20
|
className = _props$className === void 0 ? '' : _props$className,
|
|
@@ -25,6 +26,8 @@ var ProLayout = function ProLayout(props) {
|
|
|
25
26
|
headerNotice = props.headerNotice,
|
|
26
27
|
noticeIn = props.notice,
|
|
27
28
|
dataSource = props.dataSource,
|
|
29
|
+
_props$pathPrefix = props.pathPrefix,
|
|
30
|
+
pathPrefix = _props$pathPrefix === void 0 ? '' : _props$pathPrefix,
|
|
28
31
|
theme = props.theme,
|
|
29
32
|
onCollapsedChange = props.onCollapsedChange;
|
|
30
33
|
var _useSetState = useSetState({
|
|
@@ -51,7 +54,7 @@ var ProLayout = function ProLayout(props) {
|
|
|
51
54
|
if (Array.isArray(dataSource) && !dataSource.length) {
|
|
52
55
|
return _message.warning('Warning: Missing menu data source, or menu data source is not an array');
|
|
53
56
|
}
|
|
54
|
-
var userData = transformMenus(dataSource);
|
|
57
|
+
var userData = transformMenus(dataSource, pathPrefix);
|
|
55
58
|
setState({
|
|
56
59
|
menus: userData
|
|
57
60
|
});
|
|
@@ -107,7 +110,7 @@ var ProLayout = function ProLayout(props) {
|
|
|
107
110
|
selectedPath: selectedPath,
|
|
108
111
|
onSelected: setState
|
|
109
112
|
},
|
|
110
|
-
children: !waterMarkProps ? layoutDom : _jsx(ProWaterMark, _objectSpread(_objectSpread({}, waterMarkProps), {}, {
|
|
113
|
+
children: !((_Object$keys = Object.keys(waterMarkProps)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) ? layoutDom : _jsx(ProWaterMark, _objectSpread(_objectSpread({}, waterMarkProps), {}, {
|
|
111
114
|
children: layoutDom
|
|
112
115
|
}))
|
|
113
116
|
});
|
|
@@ -11,13 +11,13 @@ export declare const getIdsByPathName: (menus: any[], activeMenu?: string) => nu
|
|
|
11
11
|
* @param menuData 菜单数据源
|
|
12
12
|
* @returns []
|
|
13
13
|
*/
|
|
14
|
-
export declare const transformMenu: (menuData: any[]) => any[];
|
|
14
|
+
export declare const transformMenu: (menuData: any[], pathPrefix: string) => any[];
|
|
15
15
|
/**
|
|
16
16
|
* 转换菜单数据源评价keyUrlPath与keyIdPath
|
|
17
17
|
* @param data 菜单数据源
|
|
18
18
|
* @returns []
|
|
19
19
|
*/
|
|
20
|
-
export declare const transformMenus: (data: MenusProps) => any[] | MenusProps;
|
|
20
|
+
export declare const transformMenus: (data: MenusProps, pathPrefix: string) => any[] | MenusProps;
|
|
21
21
|
/**
|
|
22
22
|
* 获取URL中的search参数
|
|
23
23
|
* @param name 参数key
|
|
@@ -40,7 +40,7 @@ export var getIdsByPathName = function getIdsByPathName(menus, activeMenu) {
|
|
|
40
40
|
* @param menuData 菜单数据源
|
|
41
41
|
* @returns []
|
|
42
42
|
*/
|
|
43
|
-
export var transformMenu = function transformMenu(menuData) {
|
|
43
|
+
export var transformMenu = function transformMenu(menuData, pathPrefix) {
|
|
44
44
|
var data = _toConsumableArray(menuData);
|
|
45
45
|
var menuDeep = function menuDeep(menuDeepItem) {
|
|
46
46
|
if (!Array.isArray(menuDeepItem) || !menuDeepItem.length) {
|
|
@@ -49,6 +49,8 @@ export var transformMenu = function transformMenu(menuData) {
|
|
|
49
49
|
menuDeepItem.forEach(function (item, index) {
|
|
50
50
|
var _item$keyUrlPath, _item$keyIdPath, _item$children;
|
|
51
51
|
item.code = item.code || item.id;
|
|
52
|
+
item.url = "".concat(pathPrefix).concat(item.url);
|
|
53
|
+
item.redirectUrl = (item === null || item === void 0 ? void 0 : item.redirectUrl) ? "".concat(pathPrefix).concat(item.redirectUrl) : '';
|
|
52
54
|
// 拼接父级url与id数据
|
|
53
55
|
if (item === null || item === void 0 ? void 0 : (_item$keyUrlPath = item.keyUrlPath) === null || _item$keyUrlPath === void 0 ? void 0 : _item$keyUrlPath.length) {
|
|
54
56
|
item.keyUrlPath.push(item.redirectUrl || item.url);
|
|
@@ -85,18 +87,18 @@ export var transformMenu = function transformMenu(menuData) {
|
|
|
85
87
|
* @param data 菜单数据源
|
|
86
88
|
* @returns []
|
|
87
89
|
*/
|
|
88
|
-
export var transformMenus = function transformMenus(data) {
|
|
90
|
+
export var transformMenus = function transformMenus(data, pathPrefix) {
|
|
89
91
|
if (isPlainObject(data)) {
|
|
90
92
|
// @ts-ignore
|
|
91
93
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.menus)) {
|
|
92
94
|
return [];
|
|
93
95
|
}
|
|
94
96
|
// @ts-ignore
|
|
95
|
-
data.menus = transformMenu(data.menus);
|
|
97
|
+
data.menus = transformMenu(data.menus, pathPrefix);
|
|
96
98
|
return data;
|
|
97
99
|
}
|
|
98
100
|
if (Array.isArray(data)) {
|
|
99
|
-
return transformMenu(data);
|
|
101
|
+
return transformMenu(data, pathPrefix);
|
|
100
102
|
}
|
|
101
103
|
return data;
|
|
102
104
|
};
|
|
@@ -2,7 +2,8 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIt
|
|
|
2
2
|
/* eslint-disable no-restricted-syntax */
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
5
|
-
var list = _ref.list,
|
|
5
|
+
var _ref$list = _ref.list,
|
|
6
|
+
list = _ref$list === void 0 ? [] : _ref$list,
|
|
6
7
|
selectName = _ref.selectName,
|
|
7
8
|
value = _ref.value,
|
|
8
9
|
dataSource = _ref.dataSource,
|
|
@@ -53,7 +54,7 @@ export var getSelectList = function getSelectList(_ref2) {
|
|
|
53
54
|
var fatherName = listName.slice(0, firstNumberIndex);
|
|
54
55
|
var selectName = listName.slice(firstNumberIndex + 1);
|
|
55
56
|
return findSelectNameValues({
|
|
56
|
-
list: form.getFieldValue(fatherName),
|
|
57
|
+
list: form.getFieldValue(fatherName) || [],
|
|
57
58
|
selectName: selectName,
|
|
58
59
|
value: value,
|
|
59
60
|
dataSource: dataSource,
|
|
@@ -7,16 +7,12 @@ import { throttle } from 'lodash';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useStep } from '../../index';
|
|
9
9
|
export default (function (_ref) {
|
|
10
|
-
var _children$props;
|
|
11
10
|
var children = _ref.children,
|
|
12
11
|
delayTime = _ref.delayTime,
|
|
13
12
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
13
|
var _useStep = useStep(),
|
|
15
|
-
notify = _useStep.notify
|
|
16
|
-
loading = _useStep.loading,
|
|
17
|
-
setLoading = _useStep.setLoading;
|
|
14
|
+
notify = _useStep.notify;
|
|
18
15
|
return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
19
|
-
loading: loading || (children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.loading),
|
|
20
16
|
onClick: throttle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
21
17
|
var values;
|
|
22
18
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -28,11 +24,10 @@ export default (function (_ref) {
|
|
|
28
24
|
case 3:
|
|
29
25
|
values = _context.sent;
|
|
30
26
|
setTimeout(function () {
|
|
31
|
-
setLoading(false);
|
|
32
27
|
var localData = localStorage.getItem('cache-pro-step');
|
|
33
28
|
if (localData !== 'false') {
|
|
34
|
-
var _children$
|
|
35
|
-
children === null || children === void 0 ? void 0 : (_children$
|
|
29
|
+
var _children$props, _children$props$onCli;
|
|
30
|
+
children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values);
|
|
36
31
|
}
|
|
37
32
|
}, delayTime !== null && delayTime !== void 0 ? delayTime : 0);
|
|
38
33
|
case 5:
|