@zat-design/sisyphus-react 4.0.12 → 4.0.14
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 +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProEditLabel/index.js +81 -31
- package/es/ProEditLabel/propsType.d.ts +4 -4
- package/es/ProEnum/hooks/useEnum.js +76 -16
- package/es/ProEnum/propsType.d.ts +6 -1
- package/es/ProEnum/utils/index.js +6 -4
- package/es/ProForm/components/combination/Group/utils/index.d.ts +17 -17
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +42 -9
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +9 -8
- package/es/ProLayout/components/TabsManager/components/TabItem.js +9 -1
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +52 -7
- package/es/ProLayout/components/TabsManager/index.js +52 -16
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +2 -0
- package/es/ProLayout/components/TabsManager/style/index.less +115 -3
- package/es/ProLayout/index.js +30 -16
- package/es/ProLayout/propTypes.d.ts +3 -3
- package/es/ProLayout/utils/index.js +85 -21
- package/es/ProTable/style/index.less +19 -3
- package/es/ProWaterMark/propsType.d.ts +3 -61
- package/es/locale/en_US.d.ts +1 -0
- package/es/locale/en_US.js +2 -1
- package/es/locale/zh_CN.d.ts +1 -0
- package/es/locale/zh_CN.js +2 -1
- package/lib/ProEditLabel/index.js +81 -31
- package/lib/ProEditLabel/propsType.d.ts +4 -4
- package/lib/ProEnum/hooks/useEnum.js +76 -16
- package/lib/ProEnum/propsType.d.ts +6 -1
- package/lib/ProEnum/utils/index.js +6 -4
- package/lib/ProForm/components/combination/Group/utils/index.d.ts +17 -17
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +42 -9
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +9 -8
- package/lib/ProLayout/components/TabsManager/components/TabItem.js +9 -1
- package/lib/ProLayout/components/TabsManager/hooks/useTabsState.js +54 -7
- package/lib/ProLayout/components/TabsManager/index.js +52 -16
- package/lib/ProLayout/components/TabsManager/propTypes.d.ts +2 -0
- package/lib/ProLayout/components/TabsManager/style/index.less +115 -3
- package/lib/ProLayout/index.js +30 -16
- package/lib/ProLayout/propTypes.d.ts +3 -3
- package/lib/ProLayout/utils/index.js +85 -21
- package/lib/ProTable/style/index.less +19 -3
- package/lib/ProWaterMark/propsType.d.ts +3 -61
- package/lib/locale/en_US.d.ts +1 -0
- package/lib/locale/en_US.js +2 -1
- package/lib/locale/zh_CN.d.ts +1 -0
- package/lib/locale/zh_CN.js +2 -1
- package/package.json +1 -1
package/es/ProEditLabel/index.js
CHANGED
|
@@ -67,6 +67,11 @@ var ProEditLabel = _ref => {
|
|
|
67
67
|
_Form$useForm4 = _slicedToArray(_Form$useForm3, 1),
|
|
68
68
|
viewForm = _Form$useForm4[0];
|
|
69
69
|
var inputRef = useRef(null);
|
|
70
|
+
|
|
71
|
+
// 类型断言:antd FormInstance 确实有这些方法(setFieldsValue, validateFields等)
|
|
72
|
+
// 使用类型断言解决 TypeScript 类型检查问题
|
|
73
|
+
var formInstance = form;
|
|
74
|
+
var viewFormInstance = viewForm;
|
|
70
75
|
var onPress = e => {
|
|
71
76
|
var element = e.target;
|
|
72
77
|
if (e.key === 'Enter') {
|
|
@@ -82,9 +87,16 @@ var ProEditLabel = _ref => {
|
|
|
82
87
|
if (mode === 'popup') {
|
|
83
88
|
// 兼容老写法
|
|
84
89
|
if (!popupProps.columns) {
|
|
85
|
-
|
|
90
|
+
if (!(popupProps !== null && popupProps !== void 0 && popupProps.type)) {
|
|
91
|
+
console.warn('ProEditLabel: popupProps.type is required when using old API (without columns)');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
formInstance.setFieldsValue({
|
|
95
|
+
[popupProps.type]: confirmValue
|
|
96
|
+
});
|
|
86
97
|
} else {
|
|
87
|
-
|
|
98
|
+
var matchedValue = matchFormValue(confirmValue, popupProps.columns);
|
|
99
|
+
formInstance.setFieldsValue(matchedValue || {});
|
|
88
100
|
}
|
|
89
101
|
// 弹窗同步最新value数据,解决Popconfirm空白处关闭数据不同步问题
|
|
90
102
|
setState({
|
|
@@ -112,13 +124,21 @@ var ProEditLabel = _ref => {
|
|
|
112
124
|
if (mode === 'popup' && props.value) {
|
|
113
125
|
// 兼容老写法
|
|
114
126
|
if (!popupProps.columns) {
|
|
115
|
-
|
|
127
|
+
if (!(popupProps !== null && popupProps !== void 0 && popupProps.type)) {
|
|
128
|
+
console.warn('ProEditLabel: popupProps.type is required when using old API (without columns)');
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
formInstance.setFieldsValue({
|
|
132
|
+
[popupProps.type]: props.value
|
|
133
|
+
});
|
|
116
134
|
// 文本模式初始化赋值
|
|
117
|
-
|
|
135
|
+
viewFormInstance.setFieldsValue({
|
|
136
|
+
[popupProps.type]: props.value
|
|
137
|
+
});
|
|
118
138
|
} else {
|
|
119
|
-
|
|
139
|
+
formInstance.setFieldsValue(matchFormValue(props.value, popupProps.columns) || {});
|
|
120
140
|
// 文本模式初始化赋值
|
|
121
|
-
|
|
141
|
+
viewFormInstance.setFieldsValue(matchFormValue(props.value, popupProps.columns) || {});
|
|
122
142
|
}
|
|
123
143
|
}
|
|
124
144
|
}, [props.value, mode]);
|
|
@@ -129,9 +149,15 @@ var ProEditLabel = _ref => {
|
|
|
129
149
|
if (mode === 'popup' && confirmValue !== props.value) {
|
|
130
150
|
// 兼容老写法
|
|
131
151
|
if (!popupProps.columns) {
|
|
132
|
-
|
|
152
|
+
if (!(popupProps !== null && popupProps !== void 0 && popupProps.type)) {
|
|
153
|
+
console.warn('ProEditLabel: popupProps.type is required when using old API (without columns)');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
viewFormInstance.setFieldsValue({
|
|
157
|
+
[popupProps.type]: confirmValue
|
|
158
|
+
});
|
|
133
159
|
} else {
|
|
134
|
-
|
|
160
|
+
viewFormInstance.setFieldsValue(matchFormValue(confirmValue, popupProps.columns) || {});
|
|
135
161
|
}
|
|
136
162
|
}
|
|
137
163
|
}, [confirmValue, mode]);
|
|
@@ -150,53 +176,71 @@ var ProEditLabel = _ref => {
|
|
|
150
176
|
*/
|
|
151
177
|
var onConfirmHandle = /*#__PURE__*/function () {
|
|
152
178
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
153
|
-
var res, value;
|
|
179
|
+
var res, value, fieldName;
|
|
154
180
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
155
181
|
while (1) switch (_context.prev = _context.next) {
|
|
156
182
|
case 0:
|
|
157
183
|
_context.next = 2;
|
|
158
|
-
return
|
|
184
|
+
return formInstance.validateFields();
|
|
159
185
|
case 2:
|
|
160
186
|
res = _context.sent;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
187
|
+
if (popupProps.columns) {
|
|
188
|
+
_context.next = 10;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (popupProps !== null && popupProps !== void 0 && popupProps.type) {
|
|
192
|
+
_context.next = 7;
|
|
193
|
+
break;
|
|
164
194
|
}
|
|
165
|
-
|
|
166
|
-
_context.
|
|
195
|
+
console.warn('ProEditLabel: popupProps.type is required when using old API (without columns)');
|
|
196
|
+
return _context.abrupt("return", Promise.reject(new Error('popupProps.type is required')));
|
|
197
|
+
case 7:
|
|
198
|
+
value = res[popupProps.type];
|
|
199
|
+
_context.next = 11;
|
|
200
|
+
break;
|
|
201
|
+
case 10:
|
|
202
|
+
// 新写法:如果只有一个字段,提取单个值;否则使用整个对象
|
|
203
|
+
if (popupProps.columns.length === 1) {
|
|
204
|
+
fieldName = popupProps.columns[0].name || popupProps.columns[0].type;
|
|
205
|
+
value = res[fieldName];
|
|
206
|
+
} else {
|
|
207
|
+
value = res;
|
|
208
|
+
}
|
|
209
|
+
case 11:
|
|
210
|
+
_context.prev = 11;
|
|
167
211
|
_context.t0 = onFinish;
|
|
168
212
|
if (!_context.t0) {
|
|
169
|
-
_context.next =
|
|
213
|
+
_context.next = 16;
|
|
170
214
|
break;
|
|
171
215
|
}
|
|
172
|
-
_context.next =
|
|
216
|
+
_context.next = 16;
|
|
173
217
|
return onFinish(value);
|
|
174
|
-
case
|
|
218
|
+
case 16:
|
|
175
219
|
_context.t1 = onConfirm;
|
|
176
220
|
if (!_context.t1) {
|
|
177
|
-
_context.next =
|
|
221
|
+
_context.next = 20;
|
|
178
222
|
break;
|
|
179
223
|
}
|
|
180
|
-
_context.next =
|
|
224
|
+
_context.next = 20;
|
|
181
225
|
return onConfirm(value);
|
|
182
|
-
case
|
|
183
|
-
_context.next =
|
|
226
|
+
case 20:
|
|
227
|
+
_context.next = 22;
|
|
184
228
|
return setState({
|
|
185
229
|
confirmValue: value,
|
|
186
230
|
popValue: value
|
|
187
231
|
});
|
|
188
|
-
case
|
|
189
|
-
_context.next =
|
|
232
|
+
case 22:
|
|
233
|
+
_context.next = 27;
|
|
190
234
|
break;
|
|
191
|
-
case
|
|
192
|
-
_context.prev =
|
|
193
|
-
_context.t2 = _context["catch"](
|
|
235
|
+
case 24:
|
|
236
|
+
_context.prev = 24;
|
|
237
|
+
_context.t2 = _context["catch"](11);
|
|
194
238
|
return _context.abrupt("return", Promise.reject());
|
|
195
|
-
case
|
|
239
|
+
case 27:
|
|
196
240
|
case "end":
|
|
197
241
|
return _context.stop();
|
|
198
242
|
}
|
|
199
|
-
}, _callee, null, [[
|
|
243
|
+
}, _callee, null, [[11, 24]]);
|
|
200
244
|
}));
|
|
201
245
|
return function onConfirmHandle() {
|
|
202
246
|
return _ref2.apply(this, arguments);
|
|
@@ -209,9 +253,15 @@ var ProEditLabel = _ref => {
|
|
|
209
253
|
var onCancelHandle = () => {
|
|
210
254
|
// 兼容老写法
|
|
211
255
|
if (!popupProps.columns) {
|
|
212
|
-
|
|
256
|
+
if (!(popupProps !== null && popupProps !== void 0 && popupProps.type)) {
|
|
257
|
+
console.warn('ProEditLabel: popupProps.type is required when using old API (without columns)');
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
formInstance.setFieldsValue({
|
|
261
|
+
[popupProps.type]: props.value
|
|
262
|
+
});
|
|
213
263
|
} else {
|
|
214
|
-
|
|
264
|
+
formInstance.setFieldsValue(matchFormValue(props.value, popupProps.columns) || {});
|
|
215
265
|
}
|
|
216
266
|
setState({
|
|
217
267
|
popValue: props.value
|
|
@@ -2,7 +2,7 @@ import { InputProps } from 'antd/es/input';
|
|
|
2
2
|
import { PopconfirmProps } from 'antd/es/popconfirm';
|
|
3
3
|
import { FormInstance } from 'antd/es/form';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import type { ProFormColumnType } from '../
|
|
5
|
+
import type { ProFormColumnType } from '../ProForm/propsType';
|
|
6
6
|
export interface ContainerType {
|
|
7
7
|
/**
|
|
8
8
|
* @description 触发方式
|
|
@@ -77,13 +77,13 @@ export interface PopupType {
|
|
|
77
77
|
* @description 列配置
|
|
78
78
|
* @default -
|
|
79
79
|
*/
|
|
80
|
-
columns?: ProFormColumnType;
|
|
80
|
+
columns?: ProFormColumnType[];
|
|
81
81
|
/**
|
|
82
82
|
* @description 允许扩展字段
|
|
83
83
|
*/
|
|
84
84
|
[key: string]: any;
|
|
85
85
|
}
|
|
86
|
-
export interface LabelType extends InputProps {
|
|
86
|
+
export interface LabelType extends Omit<InputProps, 'onChange'> {
|
|
87
87
|
/**
|
|
88
88
|
* @description 是否打开
|
|
89
89
|
* @default false
|
|
@@ -98,7 +98,7 @@ export interface LabelType extends InputProps {
|
|
|
98
98
|
* @description 值变化回调
|
|
99
99
|
* @default -
|
|
100
100
|
*/
|
|
101
|
-
onChange?: (value:
|
|
101
|
+
onChange?: (value: any) => void;
|
|
102
102
|
/**
|
|
103
103
|
* @description 是否可编辑
|
|
104
104
|
* @default false
|
|
@@ -15,6 +15,9 @@ import { useProConfig } from "../../ProConfigProvider";
|
|
|
15
15
|
import { getEnumData } from "../utils";
|
|
16
16
|
var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
|
|
17
17
|
|
|
18
|
+
// 模块级缓存,用于存储正在进行的 IndexedDB 读取 Promise,避免重复读取
|
|
19
|
+
var indexedDBLoadingCache = new Map();
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* input code output [DataOption[],getEnumLabel]
|
|
20
23
|
* @param code
|
|
@@ -59,7 +62,9 @@ function useEnum(codes, value, compose) {
|
|
|
59
62
|
_ref2$fieldNames = _ref2.fieldNames,
|
|
60
63
|
fieldNames = _ref2$fieldNames === void 0 ? {} : _ref2$fieldNames,
|
|
61
64
|
_ref2$clear = _ref2.clear,
|
|
62
|
-
clear = _ref2$clear === void 0 ? true : _ref2$clear
|
|
65
|
+
clear = _ref2$clear === void 0 ? true : _ref2$clear,
|
|
66
|
+
_ref2$dics = _ref2.dics,
|
|
67
|
+
dics = _ref2$dics === void 0 ? {} : _ref2$dics;
|
|
63
68
|
|
|
64
69
|
// 存在子应用自管理枚举时,需要根据其指定的cacheKey进行缓存
|
|
65
70
|
if (cacheKey !== 'zat-design-pro-component-cacheKey') {
|
|
@@ -68,6 +73,12 @@ function useEnum(codes, value, compose) {
|
|
|
68
73
|
|
|
69
74
|
// 使用 state 来存储异步加载的数据
|
|
70
75
|
var _useState = useState(() => {
|
|
76
|
+
// 优先使用全局状态中的 dics 数据(如果存在)
|
|
77
|
+
if (storage === 'indexedDB' && dics && Object.keys(dics).length > 0) {
|
|
78
|
+
return {
|
|
79
|
+
data: dics
|
|
80
|
+
};
|
|
81
|
+
}
|
|
71
82
|
// 初始化:对于同步存储,直接返回数据;对于 IndexedDB,返回空数据
|
|
72
83
|
if (storage === 'indexedDB') {
|
|
73
84
|
return {
|
|
@@ -82,27 +93,76 @@ function useEnum(codes, value, compose) {
|
|
|
82
93
|
enumData = _useState2[0],
|
|
83
94
|
setEnumData = _useState2[1];
|
|
84
95
|
|
|
96
|
+
// 监听全局状态中的 dics 变化,优先使用 dics 数据
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (storage === 'indexedDB' && dics && Object.keys(dics).length > 0) {
|
|
99
|
+
setEnumData(prevData => {
|
|
100
|
+
// 只有当 dics 有数据且与当前数据不同时才更新
|
|
101
|
+
if (JSON.stringify(dics) !== JSON.stringify(prevData === null || prevData === void 0 ? void 0 : prevData.data)) {
|
|
102
|
+
return {
|
|
103
|
+
data: dics
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return prevData;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, [storage, cacheKey, dics]);
|
|
110
|
+
|
|
85
111
|
// 异步加载 IndexedDB 数据
|
|
86
112
|
useEffect(() => {
|
|
87
113
|
if (storage === 'indexedDB') {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
// 使用模块级缓存避免重复读取
|
|
115
|
+
var loadPromise = indexedDBLoadingCache.get(cacheKey);
|
|
116
|
+
if (!loadPromise) {
|
|
117
|
+
loadPromise = Promise.resolve(getEnumData(storage, cacheKey, baseEnumStorage)).then(data => {
|
|
118
|
+
// 读取完成后,从缓存中移除
|
|
119
|
+
indexedDBLoadingCache.delete(cacheKey);
|
|
120
|
+
return data;
|
|
121
|
+
}).catch(error => {
|
|
122
|
+
// 读取失败后,从缓存中移除
|
|
123
|
+
indexedDBLoadingCache.delete(cacheKey);
|
|
124
|
+
// 错误已在 getEnumData 中处理,这里返回空数据
|
|
125
|
+
return {
|
|
126
|
+
data: {}
|
|
127
|
+
};
|
|
102
128
|
});
|
|
129
|
+
indexedDBLoadingCache.set(cacheKey, loadPromise);
|
|
130
|
+
}
|
|
131
|
+
loadPromise.then(data => {
|
|
132
|
+
// 如果数据为空或无效,且当前 enumData 也是空的,尝试重新读取
|
|
133
|
+
if ((!data || !data.data || Object.keys(data.data).length === 0) && (!enumData || !enumData.data || Object.keys(enumData.data).length === 0)) {
|
|
134
|
+
// 延迟重试,给 IndexedDB 一些时间
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
// 清除缓存,允许重新读取
|
|
137
|
+
indexedDBLoadingCache.delete(cacheKey);
|
|
138
|
+
Promise.resolve(getEnumData(storage, cacheKey, baseEnumStorage)).then(retryData => {
|
|
139
|
+
if (retryData && retryData.data && Object.keys(retryData.data).length > 0) {
|
|
140
|
+
setEnumData(prevData => {
|
|
141
|
+
if (retryData && JSON.stringify(retryData) !== JSON.stringify(prevData)) {
|
|
142
|
+
baseEnumStorage = retryData;
|
|
143
|
+
return retryData;
|
|
144
|
+
}
|
|
145
|
+
return prevData;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}).catch(() => {
|
|
149
|
+
// 重试失败,保持空数据
|
|
150
|
+
});
|
|
151
|
+
}, 100);
|
|
152
|
+
} else {
|
|
153
|
+
setEnumData(prevData => {
|
|
154
|
+
if (data && JSON.stringify(data) !== JSON.stringify(prevData)) {
|
|
155
|
+
baseEnumStorage = data;
|
|
156
|
+
return data || {
|
|
157
|
+
data: {}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return prevData;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
103
163
|
});
|
|
104
164
|
}
|
|
105
|
-
}, [storage, cacheKey]);
|
|
165
|
+
}, [storage, cacheKey, enumData]);
|
|
106
166
|
var catchData = storage === 'indexedDB' ? enumData : getEnumData(storage, cacheKey, baseEnumStorage);
|
|
107
167
|
|
|
108
168
|
// 默认枚举缓存数据(仅同步存储)
|
|
@@ -79,7 +79,12 @@ export interface ProEnumConfigType {
|
|
|
79
79
|
* @description 字段别名
|
|
80
80
|
* @default { label: 'label', value: 'value', children: 'children' }
|
|
81
81
|
*/
|
|
82
|
-
fieldNames?:
|
|
82
|
+
fieldNames?: {
|
|
83
|
+
label?: string;
|
|
84
|
+
value?: string;
|
|
85
|
+
children?: string;
|
|
86
|
+
[key: string]: string | undefined;
|
|
87
|
+
};
|
|
83
88
|
/**
|
|
84
89
|
* @description 缓存的key、默认 zat-design-pro-component-cacheKey
|
|
85
90
|
* @default "zat-design-pro-component-cacheKey"
|
|
@@ -376,10 +376,12 @@ export function cacheFieldNames(fieldNames, dataSource) {
|
|
|
376
376
|
restFieldNames = _objectWithoutProperties(fieldNames, _excluded);
|
|
377
377
|
var result = {};
|
|
378
378
|
Object.keys(restFieldNames).forEach(key => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
var sourceKey = restFieldNames[key];
|
|
380
|
+
var sourceVal = dataSource[sourceKey];
|
|
381
|
+
var fallbackVal = dataSource[key];
|
|
382
|
+
var val = ![undefined, null, ''].includes(sourceVal) ? sourceVal : fallbackVal;
|
|
383
|
+
if (![undefined, null, ''].includes(val)) {
|
|
384
|
+
result[key] = val;
|
|
383
385
|
}
|
|
384
386
|
});
|
|
385
387
|
// 递归去对数据进行清洗
|
|
@@ -76,34 +76,35 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
|
|
|
76
76
|
show?: boolean | ReactiveFunction<any, boolean>;
|
|
77
77
|
component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
|
|
78
78
|
children?: React.ReactNode | ((form: FormInstance<any>) => React.ReactNode);
|
|
79
|
-
id?: string;
|
|
80
|
-
prefixCls?: string;
|
|
81
|
-
className?: string;
|
|
82
79
|
style?: React.CSSProperties;
|
|
80
|
+
className?: string;
|
|
83
81
|
rootClassName?: string;
|
|
84
|
-
status?: "" | "warning" | "error" | "success" | "validating";
|
|
85
|
-
isView?: boolean;
|
|
86
|
-
getValueProps?: ((value: any) => Record<string, unknown>) & ((value: any) => Record<string, unknown>);
|
|
87
|
-
hidden?: boolean;
|
|
88
|
-
onReset?: () => void;
|
|
89
|
-
vertical?: boolean;
|
|
90
|
-
desensitization?: [number, number] | ReactiveFunction<any, [number, number]>;
|
|
91
82
|
trim?: boolean;
|
|
92
83
|
normalize?: (value: any, prevValue: any, allValues: import("@rc-component/form/lib/interface").Store) => any;
|
|
93
|
-
|
|
84
|
+
hidden?: boolean;
|
|
85
|
+
layout?: import("antd/es/form/Form").FormItemLayout;
|
|
86
|
+
help?: React.ReactNode;
|
|
87
|
+
vertical?: boolean;
|
|
88
|
+
preserve?: boolean;
|
|
89
|
+
id?: string;
|
|
90
|
+
onReset?: () => void;
|
|
91
|
+
prefixCls?: string;
|
|
94
92
|
htmlFor?: string;
|
|
93
|
+
trigger?: string;
|
|
94
|
+
status?: "" | "warning" | "error" | "success" | "validating";
|
|
95
|
+
isView?: boolean;
|
|
96
|
+
colon?: boolean;
|
|
95
97
|
labelAlign?: import("antd/es/form/interface").FormLabelAlign;
|
|
96
98
|
labelCol?: import("antd").ColProps;
|
|
97
99
|
getValueFromEvent?: (...args: import("@rc-component/form/lib/interface").EventArgs) => any;
|
|
98
100
|
shouldUpdate?: import("@rc-component/form/lib/Field").ShouldUpdate<any>;
|
|
99
|
-
trigger?: string;
|
|
100
101
|
validateTrigger?: string | false | string[];
|
|
101
102
|
validateDebounce?: number;
|
|
102
103
|
valuePropName?: string;
|
|
104
|
+
getValueProps?: ((value: any) => Record<string, unknown>) & ((value: any) => Record<string, unknown>);
|
|
103
105
|
messageVariables?: Record<string, string>;
|
|
104
106
|
initialValue?: any;
|
|
105
107
|
onMetaChange?: (meta: import("@rc-component/form/lib/Field").MetaEvent) => void;
|
|
106
|
-
preserve?: boolean;
|
|
107
108
|
isListField?: boolean;
|
|
108
109
|
isList?: boolean;
|
|
109
110
|
noStyle?: boolean;
|
|
@@ -111,11 +112,8 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
|
|
|
111
112
|
icons: import("antd/es/form/FormItem").FeedbackIcons;
|
|
112
113
|
};
|
|
113
114
|
validateStatus?: "" | "warning" | "error" | "success" | "validating";
|
|
114
|
-
layout?: import("antd/es/form/Form").FormItemLayout;
|
|
115
115
|
wrapperCol?: import("antd").ColProps;
|
|
116
|
-
help?: React.ReactNode;
|
|
117
116
|
fieldId?: string;
|
|
118
|
-
toCSTString?: boolean;
|
|
119
117
|
valueType?: import("../../../render/propsType").ProFormValueType;
|
|
120
118
|
switchValue?: [any, any];
|
|
121
119
|
viewRender?: (value: any, record: any, { form, index, namePath, }: {
|
|
@@ -126,7 +124,9 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
|
|
|
126
124
|
viewType?: import("../../../render/propsType").ViewType;
|
|
127
125
|
upperCase?: boolean;
|
|
128
126
|
toISOString?: boolean;
|
|
127
|
+
toCSTString?: boolean;
|
|
129
128
|
clearNotShow?: boolean;
|
|
129
|
+
desensitization?: [number, number] | ReactiveFunction<any, [number, number]>;
|
|
130
130
|
name: any;
|
|
131
131
|
dependencies: any[];
|
|
132
132
|
tooltip: string | {
|
|
@@ -141,7 +141,7 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
|
|
|
141
141
|
* 创建组件属性
|
|
142
142
|
*/
|
|
143
143
|
export declare const createComponentProps: (column: FlexibleGroupColumnType, formItemProps: any) => {
|
|
144
|
-
componentProps: import("lodash").Omit<any, "
|
|
144
|
+
componentProps: import("lodash").Omit<any, "format" | "valueType" | "switchValue" | "dependNames" | "toISOString" | "toCSTString" | "clearNotShow" | "precision">;
|
|
145
145
|
formItemTransform: {
|
|
146
146
|
getValueProps: any;
|
|
147
147
|
normalize: any;
|
|
@@ -108,13 +108,25 @@ var FoldMenu = props => {
|
|
|
108
108
|
var menuItem = findMenuItemByKey(menus, String(id));
|
|
109
109
|
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(id => String(id)) : [String(id)];
|
|
110
110
|
|
|
111
|
-
// 调用用户传入的onMenuClick
|
|
111
|
+
// 调用用户传入的onMenuClick回调,获取返回值(是否应该激活菜单)
|
|
112
|
+
var shouldActivate = true;
|
|
112
113
|
if (onMenuClick) {
|
|
113
|
-
onMenuClick({
|
|
114
|
+
var result = onMenuClick({
|
|
114
115
|
item: menuItem,
|
|
115
116
|
key: String(id),
|
|
116
117
|
keyPath: menuKeyPath
|
|
117
118
|
});
|
|
119
|
+
// 如果返回 false,表示不应该激活菜单
|
|
120
|
+
if (result === false) {
|
|
121
|
+
shouldActivate = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 只有在 shouldActivate 为 true 时才设置选中状态
|
|
126
|
+
if (shouldActivate) {
|
|
127
|
+
onSelected({
|
|
128
|
+
selectedPath: toPath
|
|
129
|
+
});
|
|
118
130
|
}
|
|
119
131
|
},
|
|
120
132
|
children: LiNode
|
|
@@ -128,17 +140,26 @@ var FoldMenu = props => {
|
|
|
128
140
|
var menuItem = findMenuItemByKey(menus, String(id));
|
|
129
141
|
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(id => String(id)) : [String(id)];
|
|
130
142
|
|
|
131
|
-
// 调用用户传入的onMenuClick
|
|
143
|
+
// 调用用户传入的onMenuClick回调,获取返回值(是否应该激活菜单)
|
|
144
|
+
var shouldActivate = true;
|
|
132
145
|
if (onMenuClick) {
|
|
133
|
-
onMenuClick({
|
|
146
|
+
var result = onMenuClick({
|
|
134
147
|
item: menuItem,
|
|
135
148
|
key: String(id),
|
|
136
149
|
keyPath: menuKeyPath
|
|
137
150
|
});
|
|
151
|
+
// 如果返回 false,表示不应该激活菜单
|
|
152
|
+
if (result === false) {
|
|
153
|
+
shouldActivate = false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 只有在 shouldActivate 为 true 时才设置选中状态
|
|
158
|
+
if (shouldActivate) {
|
|
159
|
+
onSelected({
|
|
160
|
+
selectedPath: toPath
|
|
161
|
+
});
|
|
138
162
|
}
|
|
139
|
-
onSelected({
|
|
140
|
-
selectedPath: toPath
|
|
141
|
-
});
|
|
142
163
|
},
|
|
143
164
|
children: /*#__PURE__*/_jsx(Link, {
|
|
144
165
|
to: toPath,
|
|
@@ -151,13 +172,25 @@ var FoldMenu = props => {
|
|
|
151
172
|
var menuItem = findMenuItemByKey(menus, String(id));
|
|
152
173
|
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(id => String(id)) : [String(id)];
|
|
153
174
|
|
|
154
|
-
// 调用用户传入的onMenuClick
|
|
175
|
+
// 调用用户传入的onMenuClick回调,获取返回值(是否应该激活菜单)
|
|
176
|
+
var shouldActivate = true;
|
|
155
177
|
if (onMenuClick) {
|
|
156
|
-
onMenuClick({
|
|
178
|
+
var result = onMenuClick({
|
|
157
179
|
item: menuItem,
|
|
158
180
|
key: String(id),
|
|
159
181
|
keyPath: menuKeyPath
|
|
160
182
|
});
|
|
183
|
+
// 如果返回 false,表示不应该激活菜单
|
|
184
|
+
if (result === false) {
|
|
185
|
+
shouldActivate = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// 只有在 shouldActivate 为 true 时才设置选中状态
|
|
190
|
+
if (shouldActivate) {
|
|
191
|
+
onSelected({
|
|
192
|
+
selectedPath: toPath
|
|
193
|
+
});
|
|
161
194
|
}
|
|
162
195
|
},
|
|
163
196
|
children: /*#__PURE__*/_jsx(Link, {
|
|
@@ -156,26 +156,27 @@ var OpenMenu = props => {
|
|
|
156
156
|
keyPath = _ref2.keyPath,
|
|
157
157
|
key = _ref2.key,
|
|
158
158
|
domEvent = _ref2.domEvent;
|
|
159
|
-
// console.log('item', item);
|
|
160
|
-
// console.log('keyPath', keyPath);
|
|
161
|
-
// console.log('key', key);
|
|
162
|
-
// console.log('domEvent', domEvent);
|
|
163
|
-
|
|
164
159
|
// 查找完整的菜单项数据
|
|
165
160
|
var menuItem = findMenuItemByKey(menus, key);
|
|
166
161
|
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(id => String(id)) : keyPath;
|
|
167
162
|
|
|
168
|
-
// 调用用户传入的onMenuClick
|
|
163
|
+
// 调用用户传入的onMenuClick回调,获取返回值(是否应该激活菜单)
|
|
164
|
+
var shouldActivate = true;
|
|
169
165
|
if (onMenuClick) {
|
|
170
|
-
onMenuClick({
|
|
166
|
+
var result = onMenuClick({
|
|
171
167
|
item: menuItem,
|
|
172
168
|
key,
|
|
173
169
|
keyPath: menuKeyPath
|
|
174
170
|
});
|
|
171
|
+
// 如果返回 false,表示不应该激活菜单
|
|
172
|
+
if (result === false) {
|
|
173
|
+
shouldActivate = false;
|
|
174
|
+
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// 只有最后一级菜单(叶子节点)才设置选中状态和路径
|
|
178
|
-
|
|
178
|
+
// 并且只有在 shouldActivate 为 true 时才设置
|
|
179
|
+
if (menuItem && isLeafMenuItem(menuItem) && shouldActivate) {
|
|
179
180
|
var _item$props, _item$props2;
|
|
180
181
|
setState({
|
|
181
182
|
selectedKeys: keyPath,
|
|
@@ -22,6 +22,14 @@ var TabItemComponent = _ref => {
|
|
|
22
22
|
e.stopPropagation();
|
|
23
23
|
_onClose();
|
|
24
24
|
};
|
|
25
|
+
|
|
26
|
+
// 作为 antd Tabs label 使用时,不需要阻止事件冒泡
|
|
27
|
+
// antd Tabs 会通过 onChange 处理切换,我们的 onClick 作为备用
|
|
28
|
+
var handleLabelClick = e => {
|
|
29
|
+
// 不阻止冒泡,让 antd Tabs 处理切换
|
|
30
|
+
// 但我们也调用 onClick 以确保状态同步
|
|
31
|
+
onClick();
|
|
32
|
+
};
|
|
25
33
|
return /*#__PURE__*/_jsx(TabContextMenu, {
|
|
26
34
|
tabId: tab.id,
|
|
27
35
|
closable: tab.closable,
|
|
@@ -35,7 +43,7 @@ var TabItemComponent = _ref => {
|
|
|
35
43
|
tabMenuClick: tabMenuClick,
|
|
36
44
|
children: /*#__PURE__*/_jsx("div", {
|
|
37
45
|
className: `pro-layout-tab-item ${active ? 'active' : ''} ${tab.closable ? 'closable' : ''}`,
|
|
38
|
-
onClick:
|
|
46
|
+
onClick: handleLabelClick,
|
|
39
47
|
"data-testid": `tab-${tab.id}`,
|
|
40
48
|
children: /*#__PURE__*/_jsxs("div", {
|
|
41
49
|
className: "pro-layout-tab-content",
|