@zat-design/sisyphus-react 3.6.1 → 3.6.2-beta.10
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 +0 -6
- package/dist/less.esm.css +0 -6
- package/es/ProConfigProvider/index.d.ts +1 -0
- package/es/ProConfigProvider/index.js +6 -1
- package/es/ProEditTable/components/RenderField/index.js +1 -3
- package/es/ProEditTable/index.js +2 -1
- package/es/ProEditTable/utils/tools.js +1 -4
- package/es/ProEnum/hooks/useEnumRequest.d.ts +1 -1
- package/es/ProEnum/hooks/useEnumRequest.js +113 -113
- package/es/ProForm/components/combination/FormList/index.js +5 -0
- package/es/ProForm/components/combination/ProCascader/index.js +43 -15
- package/es/ProForm/components/render/Render.js +7 -1
- package/es/ProForm/components/render/propsType.d.ts +4 -0
- 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/es/ProTooltip/style/index.less +0 -8
- package/es/ProTree/components/ProTree.js +2 -1
- package/lib/ProConfigProvider/index.d.ts +1 -0
- package/lib/ProConfigProvider/index.js +6 -1
- package/lib/ProEditTable/components/RenderField/index.js +1 -3
- package/lib/ProEditTable/index.js +2 -1
- package/lib/ProEditTable/utils/tools.js +1 -4
- package/lib/ProEnum/hooks/useEnumRequest.d.ts +1 -1
- package/lib/ProEnum/hooks/useEnumRequest.js +113 -113
- package/lib/ProForm/components/combination/FormList/index.js +5 -0
- package/lib/ProForm/components/combination/ProCascader/index.js +42 -14
- package/lib/ProForm/components/render/Render.js +7 -1
- package/lib/ProForm/components/render/propsType.d.ts +4 -0
- 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/lib/ProTooltip/style/index.less +0 -8
- package/lib/ProTree/components/ProTree.js +2 -1
- 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
|
@@ -2141,12 +2141,6 @@
|
|
|
2141
2141
|
.pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
|
|
2142
2142
|
text-align: right;
|
|
2143
2143
|
}
|
|
2144
|
-
.ant-table-cell-fix-right {
|
|
2145
|
-
z-index: 999 !important;
|
|
2146
|
-
}
|
|
2147
|
-
.ant-table-cell-fix-left {
|
|
2148
|
-
z-index: 999 !important;
|
|
2149
|
-
}
|
|
2150
2144
|
.pro-tooltip {
|
|
2151
2145
|
cursor: pointer;
|
|
2152
2146
|
}
|
package/dist/less.esm.css
CHANGED
|
@@ -2141,12 +2141,6 @@
|
|
|
2141
2141
|
.pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
|
|
2142
2142
|
text-align: right;
|
|
2143
2143
|
}
|
|
2144
|
-
.ant-table-cell-fix-right {
|
|
2145
|
-
z-index: 999 !important;
|
|
2146
|
-
}
|
|
2147
|
-
.ant-table-cell-fix-left {
|
|
2148
|
-
z-index: 999 !important;
|
|
2149
|
-
}
|
|
2150
2144
|
.pro-tooltip {
|
|
2151
2145
|
cursor: pointer;
|
|
2152
2146
|
}
|
|
@@ -75,7 +75,7 @@ export var ProConfigProvider = function ProConfigProvider(props) {
|
|
|
75
75
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
76
76
|
state = _useReducer2[0],
|
|
77
77
|
dispatch = _useReducer2[1];
|
|
78
|
-
useEnumRequest(_objectSpread(_objectSpread(_objectSpread({}, state.ProEnum), props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
|
|
78
|
+
var enumRes = useEnumRequest(_objectSpread(_objectSpread(_objectSpread({}, state.ProEnum), props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
|
|
79
79
|
useEffect(function () {
|
|
80
80
|
// 本地配置取出
|
|
81
81
|
var localConfigStr = localStorage.getItem('localConfig');
|
|
@@ -93,6 +93,11 @@ export var ProConfigProvider = function ProConfigProvider(props) {
|
|
|
93
93
|
// 设置默认语言
|
|
94
94
|
setLanguage(props === null || props === void 0 ? void 0 : props.locale);
|
|
95
95
|
}
|
|
96
|
+
useEffect(function () {
|
|
97
|
+
if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
|
|
98
|
+
(props === null || props === void 0 ? void 0 : props.onSuccess) && (props === null || props === void 0 ? void 0 : props.onSuccess(enumRes === null || enumRes === void 0 ? void 0 : enumRes.data, enumRes === null || enumRes === void 0 ? void 0 : enumRes.params));
|
|
99
|
+
}
|
|
100
|
+
}, [enumRes === null || enumRes === void 0 ? void 0 : enumRes.loading]);
|
|
96
101
|
return _jsx(ProConfigContext.Provider, {
|
|
97
102
|
value: {
|
|
98
103
|
state: merge(state, props.value),
|
|
@@ -414,7 +414,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
414
414
|
}
|
|
415
415
|
_args = formatArgs([].concat(args));
|
|
416
416
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
417
|
-
row = form.getFieldValue(rowPath, true);
|
|
417
|
+
row = form.getFieldValue(rowPath, true);
|
|
418
418
|
orgRow = cloneDeep(row);
|
|
419
419
|
_args[1] = row;
|
|
420
420
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
@@ -443,8 +443,6 @@ var RenderField = function RenderField(_ref) {
|
|
|
443
443
|
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
444
444
|
debounceValidate(validateFieldKeys);
|
|
445
445
|
}
|
|
446
|
-
} else {
|
|
447
|
-
debounceValidate();
|
|
448
446
|
}
|
|
449
447
|
if (!isCell) {
|
|
450
448
|
_context2.next = 20;
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -276,7 +276,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
276
276
|
return transformColumns(columns, config);
|
|
277
277
|
}, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
|
|
278
278
|
useEffect(function () {
|
|
279
|
-
var
|
|
279
|
+
var _value$every;
|
|
280
|
+
var isAllHasKey = value === null || value === void 0 ? void 0 : (_value$every = value.every) === null || _value$every === void 0 ? void 0 : _value$every.call(value, function (item) {
|
|
280
281
|
return item.rowKey;
|
|
281
282
|
});
|
|
282
283
|
// 初始化默认生成row-key
|
|
@@ -7,10 +7,7 @@ export var getRandom = function getRandom() {
|
|
|
7
7
|
export var difference = function difference(object, base) {
|
|
8
8
|
var changes = function changes(object, base) {
|
|
9
9
|
return transform(object, function (result, value, key) {
|
|
10
|
-
|
|
11
|
-
if ((key === null || key === void 0 ? void 0 : (_key$indexOf = key.indexOf) === null || _key$indexOf === void 0 ? void 0 : _key$indexOf.call(key, '-')) > -1) {
|
|
12
|
-
result[key] = true;
|
|
13
|
-
} else if (!isEqual(value, base[key])) {
|
|
10
|
+
if (!isEqual(value, base[key])) {
|
|
14
11
|
result[key] = isObject(value) && isObject(base[key]) ? changes(value, base[key]) : value;
|
|
15
12
|
}
|
|
16
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ProEnumConfig } from '../propsType';
|
|
2
2
|
import '../utils/eventCenter';
|
|
3
|
-
declare const useEnumRequest: (props: ProEnumConfig, dispatch: any) =>
|
|
3
|
+
declare const useEnumRequest: (props: ProEnumConfig, dispatch: any) => import("ahooks/lib/useRequest/src/types").Result<any, any>;
|
|
4
4
|
export default useEnumRequest;
|
|
@@ -45,120 +45,119 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
45
45
|
console.info('proEnum:', msg);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
res.data = response;
|
|
104
|
-
}
|
|
105
|
-
cacheData = getEnumData(storage, cacheKey, baseEnumStorage) || {
|
|
106
|
-
data: {}
|
|
107
|
-
}; // 合并缓存数据
|
|
108
|
-
res.data = _objectSpread(_objectSpread({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
|
|
109
|
-
setEnumData(storage, cacheKey, res);
|
|
110
|
-
// 同步数据到全局
|
|
111
|
-
dispatch({
|
|
112
|
-
type: 'setProEnumDic',
|
|
113
|
-
payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res.data)
|
|
48
|
+
var enumRes = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
|
|
49
|
+
manual: true,
|
|
50
|
+
cacheKey: cacheKey,
|
|
51
|
+
cacheTime: -1,
|
|
52
|
+
staleTime: 6e4 * 60
|
|
53
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
|
54
|
+
setCache: function () {
|
|
55
|
+
var _setCache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
56
|
+
var response, _locale$ProEnum2, _useRequest$options, ignoreCodes, cacheData;
|
|
57
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
58
|
+
while (1) switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
response = res.data;
|
|
61
|
+
if (!(transformResponse && typeof transformResponse === 'function')) {
|
|
62
|
+
_context.next = 10;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_context.next = 4;
|
|
66
|
+
return transformResponse(res.data);
|
|
67
|
+
case 4:
|
|
68
|
+
response = _context.sent;
|
|
69
|
+
if (!(_typeof(response) !== 'object' || response == null)) {
|
|
70
|
+
_context.next = 9;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum2 = locale.ProEnum) === null || _locale$ProEnum2 === void 0 ? void 0 : _locale$ProEnum2.errorMessage);
|
|
74
|
+
case 9:
|
|
75
|
+
res.data = response;
|
|
76
|
+
case 10:
|
|
77
|
+
if (!(_typeof(response) !== 'object' || response === null)) {
|
|
78
|
+
_context.next = 12;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
throw Error('response enum data must be object');
|
|
82
|
+
case 12:
|
|
83
|
+
if (!(Object.keys(response).length === 0)) {
|
|
84
|
+
_context.next = 14;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
throw Error('Please return valid enumeration data');
|
|
88
|
+
case 14:
|
|
89
|
+
// 只返回fieldNames对象的key
|
|
90
|
+
if (clear) {
|
|
91
|
+
// 忽略清洗的 codes
|
|
92
|
+
ignoreCodes = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.ignoreCodes) || [];
|
|
93
|
+
Object.keys(response).forEach(function (key) {
|
|
94
|
+
var options = _toConsumableArray(response[key]) || [];
|
|
95
|
+
if (ignoreCodes.includes(key)) {
|
|
96
|
+
response[key] = options;
|
|
97
|
+
} else {
|
|
98
|
+
response[key] = options.map(function (item) {
|
|
99
|
+
return cacheFieldNames(fieldNames, item);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
114
102
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
setTimeout(function () {
|
|
144
|
-
var _locale$ProEnum4;
|
|
145
|
-
window.eventCenter.publish('zat-design-pro-component-event', res.data);
|
|
146
|
-
logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.mainInitByCache);
|
|
147
|
-
}, 10000);
|
|
148
|
-
}
|
|
149
|
-
return res;
|
|
150
|
-
},
|
|
151
|
-
onSuccess: function onSuccess(res) {
|
|
152
|
-
var _res$status = res.status,
|
|
153
|
-
status = _res$status === void 0 ? 200 : _res$status,
|
|
154
|
-
msg = res.message;
|
|
155
|
-
if (status !== 200) {
|
|
156
|
-
var _locale$ProEnum5;
|
|
157
|
-
throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum5 = locale.ProEnum) === null || _locale$ProEnum5 === void 0 ? void 0 : _locale$ProEnum5.requestError);
|
|
158
|
-
}
|
|
103
|
+
res.data = response;
|
|
104
|
+
}
|
|
105
|
+
cacheData = getEnumData(storage, cacheKey, baseEnumStorage) || {
|
|
106
|
+
data: {}
|
|
107
|
+
}; // 合并缓存数据
|
|
108
|
+
res.data = _objectSpread(_objectSpread({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
|
|
109
|
+
setEnumData(storage, cacheKey, res);
|
|
110
|
+
// 同步数据到全局
|
|
111
|
+
dispatch({
|
|
112
|
+
type: 'setProEnumDic',
|
|
113
|
+
payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res.data)
|
|
114
|
+
});
|
|
115
|
+
if (main) {
|
|
116
|
+
setTimeout(function () {
|
|
117
|
+
var _locale$ProEnum3;
|
|
118
|
+
window.eventCenter.publish('zat-design-pro-component-event', res.data);
|
|
119
|
+
logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum3 = locale.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.mainInitByRequest);
|
|
120
|
+
}, 10000);
|
|
121
|
+
}
|
|
122
|
+
return _context.abrupt("return", res);
|
|
123
|
+
case 21:
|
|
124
|
+
case "end":
|
|
125
|
+
return _context.stop();
|
|
126
|
+
}
|
|
127
|
+
}, _callee);
|
|
128
|
+
}));
|
|
129
|
+
function setCache(_x) {
|
|
130
|
+
return _setCache.apply(this, arguments);
|
|
159
131
|
}
|
|
160
|
-
|
|
161
|
-
|
|
132
|
+
return setCache;
|
|
133
|
+
}(),
|
|
134
|
+
getCache: function getCache() {
|
|
135
|
+
var res = getEnumData(storage, cacheKey, baseEnumStorage) || {
|
|
136
|
+
data: {}
|
|
137
|
+
};
|
|
138
|
+
dispatch({
|
|
139
|
+
type: 'setProEnumDic',
|
|
140
|
+
payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res === null || res === void 0 ? void 0 : res.data)
|
|
141
|
+
});
|
|
142
|
+
if (main) {
|
|
143
|
+
setTimeout(function () {
|
|
144
|
+
var _locale$ProEnum4;
|
|
145
|
+
window.eventCenter.publish('zat-design-pro-component-event', res.data);
|
|
146
|
+
logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.mainInitByCache);
|
|
147
|
+
}, 10000);
|
|
148
|
+
}
|
|
149
|
+
return res;
|
|
150
|
+
},
|
|
151
|
+
onSuccess: function onSuccess(res) {
|
|
152
|
+
var _res$status = res.status,
|
|
153
|
+
status = _res$status === void 0 ? 200 : _res$status,
|
|
154
|
+
msg = res.message;
|
|
155
|
+
if (status !== 200) {
|
|
156
|
+
var _locale$ProEnum5;
|
|
157
|
+
throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum5 = locale.ProEnum) === null || _locale$ProEnum5 === void 0 ? void 0 : _locale$ProEnum5.requestError);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
162
161
|
var mergeData = /*#__PURE__*/function () {
|
|
163
162
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
164
163
|
var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
|
|
@@ -258,7 +257,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
258
257
|
window.localStorage.removeItem(cacheKey);
|
|
259
258
|
window.sessionStorage.removeItem(cacheKey);
|
|
260
259
|
}
|
|
261
|
-
run(defaultParams);
|
|
260
|
+
enumRes.run(defaultParams);
|
|
262
261
|
// TODO 这段代码目前看起来是没啥用的、没起到作用
|
|
263
262
|
mergeData();
|
|
264
263
|
} else if (Object.keys(dataSource)) {
|
|
@@ -304,5 +303,6 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
304
303
|
window.eventCenter.unsubscribe('zat-design-pro-component-event', shareProEnumDic);
|
|
305
304
|
};
|
|
306
305
|
}, []);
|
|
306
|
+
return enumRes;
|
|
307
307
|
};
|
|
308
308
|
export default useEnumRequest;
|
|
@@ -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,
|
|
@@ -353,7 +353,13 @@ var Render = function Render(props) {
|
|
|
353
353
|
mark: 'pro_table_render',
|
|
354
354
|
render: function render(inputProps, doms) {
|
|
355
355
|
return _jsxs(_Fragment, {
|
|
356
|
-
children: [
|
|
356
|
+
children: [_jsx(_Space, {
|
|
357
|
+
size: 0,
|
|
358
|
+
style: {
|
|
359
|
+
marginTop: 8
|
|
360
|
+
},
|
|
361
|
+
children: formItemProps.above
|
|
362
|
+
}), _jsxs("div", {
|
|
357
363
|
style: {
|
|
358
364
|
display: 'flex',
|
|
359
365
|
alignItems: 'center'
|
|
@@ -214,6 +214,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
214
214
|
before?: string | React.ReactNode;
|
|
215
215
|
/** 表单后缀信息 */
|
|
216
216
|
after?: string | React.ReactNode;
|
|
217
|
+
/** 表单上方辅助信息 */
|
|
218
|
+
above?: string | React.ReactNode;
|
|
217
219
|
/** 表单下方辅助信息 */
|
|
218
220
|
extra?: string | React.ReactNode;
|
|
219
221
|
/** 是否固定字段, 不隐藏 */
|
|
@@ -244,6 +246,8 @@ export interface RenderProps<Values = any> {
|
|
|
244
246
|
before?: string | React.ReactNode;
|
|
245
247
|
/** 表单后缀信息 */
|
|
246
248
|
after?: string | React.ReactNode;
|
|
249
|
+
/** 表单上方辅助信息 */
|
|
250
|
+
above?: string | React.ReactNode;
|
|
247
251
|
/** 表单下方辅助信息 */
|
|
248
252
|
extra?: string | React.ReactNode;
|
|
249
253
|
parentNames?: string;
|
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:
|