@zat-design/sisyphus-react 4.5.9-beta.1 → 4.5.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProAction/components/CheckModalContent/index.js +2 -2
- package/es/ProConfigProvider/index.js +12 -3
- package/es/ProDownload/index.d.ts +2 -1
- package/es/ProDownload/index.js +48 -35
- package/es/ProDownload/utils.d.ts +10 -5
- package/es/ProDownload/utils.js +28 -13
- package/es/ProEditTable/utils/index.js +6 -1
- package/es/ProEnum/hooks/useEnumRequest.js +98 -77
- package/es/ProEnum/index.js +3 -4
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +1 -0
- package/es/ProForm/components/combination/FormList/components/Empty.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +3 -3
- package/es/ProForm/components/combination/FormList/style/index.less +6 -0
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +5 -11
- package/es/ProForm/components/combination/Group/hooks/index.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +1 -1
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +22 -8
- package/es/ProForm/components/combination/ProModalSelect/index.js +32 -12
- package/es/ProForm/components/combination/ProRangeLimit/index.js +1 -1
- package/es/ProForm/components/render/Render.js +2 -2
- package/es/ProForm/hooks/useWatch.js +7 -8
- package/es/ProForm/utils/index.js +2 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +8 -8
- package/es/ProLayout/components/Layout/Menu/index.js +1 -1
- package/es/ProLayout/components/ProFooter/index.js +2 -1
- package/es/ProLayout/components/ProHeader/components/Describe/index.js +3 -1
- package/es/ProLayout/components/TabsManager/components/TabItem.js +6 -5
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +104 -16
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +295 -0
- package/es/ProLayout/components/TabsManager/index.js +54 -14
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
- package/es/ProLayout/components/TabsManager/style/index.less +1 -1
- package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
- package/es/ProLayout/components/TabsManager/utils/historyObserver.js +62 -0
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
- package/es/ProLayout/components/TabsManager/utils/index.js +63 -9
- package/es/ProLayout/images/logoImg.png +0 -0
- package/es/ProLayout/index.js +6 -3
- package/es/ProLayout/propTypes.d.ts +28 -1
- package/es/ProSelect/index.js +10 -1
- package/es/ProSelect/style/index.less +13 -0
- package/es/ProStep/style/index.less +1 -1
- package/es/ProTable/hooks/useAntdTable.js +11 -10
- package/es/ProTabs/index.js +3 -3
- package/es/ProTooltip/index.js +2 -5
- package/es/ProTree/components/ProTreeSelect/index.js +2 -2
- package/es/ProTreeModal/index.js +1 -4
- package/es/ProUpload/components/DragRender.js +0 -14
- package/package.json +5 -1
- package/es/ProConfigProvider/demo/locale.js +0 -58
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _isFunction from "lodash/isFunction";
|
|
2
|
-
import _isEmpty from "lodash/isEmpty";
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { Space, Form } from 'antd';
|
|
5
4
|
import classnames from 'classnames';
|
|
@@ -219,7 +218,7 @@ const FlexibleGroupRender = props => {
|
|
|
219
218
|
requiredOnView: otherProps?.requiredOnView,
|
|
220
219
|
viewRender: child.viewRender
|
|
221
220
|
})
|
|
222
|
-
}, child.name
|
|
221
|
+
}, String(child.name ?? `item-${index}`));
|
|
223
222
|
};
|
|
224
223
|
|
|
225
224
|
// 非compact模式:正常的表单项渲染
|
|
@@ -248,13 +247,13 @@ const FlexibleGroupRender = props => {
|
|
|
248
247
|
// 添加分隔符(除最后一个元素外)
|
|
249
248
|
if (index < visibleChildren.length - 1 && space?.separator) {
|
|
250
249
|
// 检查是否在指定位置添加分隔符
|
|
251
|
-
const shouldAddSeparator = space.separatorIndex ? Array.isArray(space.separatorIndex) ? space.separatorIndex.includes(originalIndex) : space.separatorIndex === originalIndex : true; // 默认每个元素后都加分隔符
|
|
250
|
+
const shouldAddSeparator = space.separatorIndex != null ? Array.isArray(space.separatorIndex) ? space.separatorIndex.includes(originalIndex) : space.separatorIndex === originalIndex : true; // 默认每个元素后都加分隔符
|
|
252
251
|
|
|
253
252
|
if (shouldAddSeparator) {
|
|
254
253
|
elements.push( /*#__PURE__*/_jsx("span", {
|
|
255
254
|
className: "pro-group-separator-space",
|
|
256
255
|
children: space.separator
|
|
257
|
-
},
|
|
256
|
+
}, `separator-${String(child.name ?? originalIndex)}`));
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
259
|
});
|
|
@@ -288,14 +287,14 @@ const FlexibleGroupRender = props => {
|
|
|
288
287
|
// 查看模式下,如果没有配置separator,使用默认的 finalSeparator
|
|
289
288
|
const separatorToUse = isView ? space?.separator || finalSeparator : space?.separator;
|
|
290
289
|
if (index < visibleChildren.length - 1 && separatorToUse) {
|
|
291
|
-
const shouldAddSeparator = space.separatorIndex ? Array.isArray(space.separatorIndex) ? space.separatorIndex.includes(originalIndex) : space.separatorIndex === originalIndex : true;
|
|
290
|
+
const shouldAddSeparator = space.separatorIndex != null ? Array.isArray(space.separatorIndex) ? space.separatorIndex.includes(originalIndex) : space.separatorIndex === originalIndex : true;
|
|
292
291
|
if (shouldAddSeparator) {
|
|
293
292
|
// 查看模式下使用不同的className,避免显示边框
|
|
294
293
|
const separatorClassName = isView ? 'pro-group-separator-compact pro-group-separator-view' : 'pro-group-separator-compact';
|
|
295
294
|
elements.push( /*#__PURE__*/_jsx("span", {
|
|
296
295
|
className: separatorClassName,
|
|
297
296
|
children: separatorToUse
|
|
298
|
-
},
|
|
297
|
+
}, `separator-${String(child.name ?? originalIndex)}`));
|
|
299
298
|
}
|
|
300
299
|
}
|
|
301
300
|
});
|
|
@@ -316,11 +315,6 @@ const FlexibleGroupRender = props => {
|
|
|
316
315
|
// 检查是否有子项包含 show 函数,如果有则需要响应式更新
|
|
317
316
|
const hasShowFunction = children.some(child => _isFunction(child.show));
|
|
318
317
|
|
|
319
|
-
// 查看模式下空值处理
|
|
320
|
-
if (isView && _isEmpty(children)) {
|
|
321
|
-
return otherProps?.viewEmpty || '-';
|
|
322
|
-
}
|
|
323
|
-
|
|
324
318
|
// 查看模式下,检查所有children的值是否都为空
|
|
325
319
|
if (isView && form && children.length > 0) {
|
|
326
320
|
const allValuesEmpty = children.every(child => {
|
|
@@ -46,7 +46,7 @@ export const useTransformColumns = params => {
|
|
|
46
46
|
// 响应式字段改变后的回调
|
|
47
47
|
const changedCallback = (lastDependency, current) => {
|
|
48
48
|
// 清值防抖 多次刷新时以最后一次为准
|
|
49
|
-
if (clearNotShow !== false && names) {
|
|
49
|
+
if (clearNotShow !== false && (names || value)) {
|
|
50
50
|
if (current?.show === false) {
|
|
51
51
|
clearInterval(timerRef.current[index]);
|
|
52
52
|
timerRef.current[index] = setTimeout(() => {
|
|
@@ -134,7 +134,7 @@ const LegacyGroup = props => {
|
|
|
134
134
|
elements.push( /*#__PURE__*/_jsx("span", {
|
|
135
135
|
className: "pro-group-separator-compact",
|
|
136
136
|
children: newColumn.separator
|
|
137
|
-
}, `separator-${newColumn.name
|
|
137
|
+
}, `separator-${String(newColumn.name ?? index)}`));
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
2
|
import { useDebounceFn, usePrevious, useRequest } from 'ahooks';
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import locale, { formatMessage } from "../../../../../locale";
|
|
5
5
|
const defaultPage = {
|
|
6
6
|
pageNum: 1,
|
|
@@ -32,7 +32,7 @@ export function useRequestList(service, options, useRequestOptions) {
|
|
|
32
32
|
} = useRequestOptions || {};
|
|
33
33
|
const _defaultParams = Array.isArray(defaultParams) ? defaultParams?.[0] : defaultParams || {};
|
|
34
34
|
// 搜索表单里的值
|
|
35
|
-
const [searchValues, setSearchValues] = useState();
|
|
35
|
+
const [searchValues, setSearchValues] = useState({});
|
|
36
36
|
|
|
37
37
|
// 当次执行service的请求,包括page参数
|
|
38
38
|
const params = useMemo(() => {
|
|
@@ -60,18 +60,29 @@ export function useRequestList(service, options, useRequestOptions) {
|
|
|
60
60
|
|
|
61
61
|
// 搜索条件变化时触发
|
|
62
62
|
const prevParams = usePrevious(params);
|
|
63
|
+
const ready = useRequestOptions?.ready;
|
|
64
|
+
const prevReadyRef = useRef(ready);
|
|
63
65
|
const {
|
|
64
|
-
run: queryList
|
|
66
|
+
run: queryList,
|
|
67
|
+
cancel: cancelQueryList
|
|
65
68
|
} = useDebounceFn(() => {
|
|
66
69
|
run(params);
|
|
67
70
|
}, {
|
|
68
71
|
wait: 300
|
|
69
72
|
});
|
|
70
73
|
useEffect(() => {
|
|
74
|
+
const prevReady = prevReadyRef.current;
|
|
75
|
+
prevReadyRef.current = ready;
|
|
76
|
+
const isAutomaticReadyRun = useRequestOptions?.manual !== true && prevReady === false && ready === true;
|
|
77
|
+
if (ready === false || isAutomaticReadyRun) {
|
|
78
|
+
cancelQueryList();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
71
81
|
if (prevParams && !_isEqual(prevParams, params)) {
|
|
72
82
|
queryList();
|
|
73
83
|
}
|
|
74
|
-
}, [params, prevParams, queryList]);
|
|
84
|
+
}, [cancelQueryList, params, prevParams, queryList, ready, useRequestOptions?.manual]);
|
|
85
|
+
useEffect(() => cancelQueryList, [cancelQueryList]);
|
|
75
86
|
|
|
76
87
|
// 分页变更
|
|
77
88
|
const onChange = useCallback((current, pageSize) => {
|
|
@@ -80,15 +91,18 @@ export function useRequestList(service, options, useRequestOptions) {
|
|
|
80
91
|
pageSize
|
|
81
92
|
});
|
|
82
93
|
}, [onPageChange]);
|
|
83
|
-
const onSearch = useCallback(values => {
|
|
94
|
+
const onSearch = useCallback((values, force = false) => {
|
|
95
|
+
const normalizedValues = values && typeof values === 'object' && Object.values(values).every(value => value === undefined) ? {} : values;
|
|
84
96
|
if (page.pageNum !== 1) {
|
|
85
97
|
// 查询或重置都从第一页开始,保留当前每页条数
|
|
86
98
|
onChange(1, page.pageSize);
|
|
87
99
|
}
|
|
88
|
-
if (!_isEqual(searchValues,
|
|
89
|
-
setSearchValues(
|
|
100
|
+
if (!_isEqual(searchValues, normalizedValues)) {
|
|
101
|
+
setSearchValues(normalizedValues);
|
|
102
|
+
} else if (force && page.pageNum === 1) {
|
|
103
|
+
run(params);
|
|
90
104
|
}
|
|
91
|
-
}, [onChange,
|
|
105
|
+
}, [onChange, page, params, run, searchValues]);
|
|
92
106
|
|
|
93
107
|
// 重置查询条件
|
|
94
108
|
const onReset = useCallback(() => {
|
|
@@ -168,8 +168,9 @@ const ProModalSelect = (props, ref) => {
|
|
|
168
168
|
transformParams,
|
|
169
169
|
transformResponse
|
|
170
170
|
}, {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
...useRequest?.options,
|
|
172
|
+
ready: useRequest?.options?.ready ?? ((initParams || defaultOne) && nextMode === 'input' ? true : undefined),
|
|
173
|
+
manual: useRequest?.options?.manual ?? ((initParams || defaultOne) && nextMode === 'input' ? undefined : true)
|
|
173
174
|
});
|
|
174
175
|
const defaultOptionRender = rowData => rowData?.[labelKey];
|
|
175
176
|
let handleFormat = onFormat || defaultOptionRender;
|
|
@@ -190,6 +191,16 @@ const ProModalSelect = (props, ref) => {
|
|
|
190
191
|
if (typeof data === 'string' || typeof data === 'number') {
|
|
191
192
|
return data;
|
|
192
193
|
}
|
|
194
|
+
// lodash isObject 对数组也为 true,必须先判数组,否则多选展示永远走对象臂
|
|
195
|
+
if (_isArray(data)) {
|
|
196
|
+
return data.map(item => {
|
|
197
|
+
return handleFormat({
|
|
198
|
+
...item,
|
|
199
|
+
value: item[valueKey],
|
|
200
|
+
label: item[labelKey]
|
|
201
|
+
});
|
|
202
|
+
}).join('、');
|
|
203
|
+
}
|
|
193
204
|
if (_isObject(data)) {
|
|
194
205
|
return handleFormat({
|
|
195
206
|
...data,
|
|
@@ -197,13 +208,7 @@ const ProModalSelect = (props, ref) => {
|
|
|
197
208
|
label: data[labelKey]
|
|
198
209
|
});
|
|
199
210
|
}
|
|
200
|
-
return
|
|
201
|
-
return handleFormat({
|
|
202
|
-
...item,
|
|
203
|
-
value: item[valueKey],
|
|
204
|
-
label: item[labelKey]
|
|
205
|
-
});
|
|
206
|
-
})?.join('、') : '';
|
|
211
|
+
return '';
|
|
207
212
|
};
|
|
208
213
|
const viewText = useMemo(() => {
|
|
209
214
|
let nextValue = labelInValue ? value : _value;
|
|
@@ -334,6 +339,18 @@ const ProModalSelect = (props, ref) => {
|
|
|
334
339
|
d: Date.now()
|
|
335
340
|
});
|
|
336
341
|
};
|
|
342
|
+
const handleReset = () => {
|
|
343
|
+
form.resetFields();
|
|
344
|
+
formColumns?.forEach(column => {
|
|
345
|
+
if (column?.name !== undefined && Object.prototype.hasOwnProperty.call(column, 'initialValue')) {
|
|
346
|
+
form.setFieldValue(column.name, column.initialValue);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
onSearch({
|
|
350
|
+
...form.getFieldsValue(),
|
|
351
|
+
d: Date.now()
|
|
352
|
+
});
|
|
353
|
+
};
|
|
337
354
|
const _rowSelection = {
|
|
338
355
|
type,
|
|
339
356
|
// 多选时开启,保证翻页/筛选后不丢弃不在当前页的已选 key
|
|
@@ -501,9 +518,6 @@ const ProModalSelect = (props, ref) => {
|
|
|
501
518
|
});
|
|
502
519
|
useEffect(() => {
|
|
503
520
|
if (onOff && !open) {
|
|
504
|
-
if (useRequest?.options?.manual !== true) {
|
|
505
|
-
onReset();
|
|
506
|
-
}
|
|
507
521
|
const nextState = {
|
|
508
522
|
open: true
|
|
509
523
|
};
|
|
@@ -531,6 +545,11 @@ const ProModalSelect = (props, ref) => {
|
|
|
531
545
|
setState(nextState);
|
|
532
546
|
}
|
|
533
547
|
}, [onOff, open, JSON.stringify(value)]);
|
|
548
|
+
useEffect(() => {
|
|
549
|
+
if (open && useRequest?.options?.ready !== false && useRequest?.options?.manual === undefined) {
|
|
550
|
+
onSearch(form.getFieldsValue(), true);
|
|
551
|
+
}
|
|
552
|
+
}, [open, useRequest?.options?.manual, useRequest?.options?.ready]);
|
|
534
553
|
useEffect(() => {
|
|
535
554
|
hideTooltipIfOpen(fieldRef.current, open);
|
|
536
555
|
}, [open]);
|
|
@@ -741,6 +760,7 @@ const ProModalSelect = (props, ref) => {
|
|
|
741
760
|
form: form,
|
|
742
761
|
columns: formColumns,
|
|
743
762
|
onFinish: handleSearch,
|
|
763
|
+
onCancel: handleReset,
|
|
744
764
|
confirmLoading: loading,
|
|
745
765
|
footer: formColumns?.length > 1
|
|
746
766
|
}), /*#__PURE__*/_jsx(ProTable, {
|
|
@@ -18,7 +18,7 @@ const useControlled = props => {
|
|
|
18
18
|
const internalValue = [props.value?.[0] && dayjs(props.value[0], props.format), props.value?.[1] && dayjs(props.value[1], props.format)];
|
|
19
19
|
const handleChange = (value, other) => {
|
|
20
20
|
if (!value) {
|
|
21
|
-
props?.onChange(value, other);
|
|
21
|
+
props?.onChange?.(value, other);
|
|
22
22
|
} else {
|
|
23
23
|
const [start, end] = value;
|
|
24
24
|
if (props?.onChange) {
|
|
@@ -173,8 +173,8 @@ const Render = props => {
|
|
|
173
173
|
|
|
174
174
|
// 防抖记忆化:handlerRef 始终指向最新 handler,debounce 仅按 debounceWait 重建,避免每次渲染重置定时器导致防抖失效
|
|
175
175
|
const debounceWait = lastComponentProps?.debounceWait;
|
|
176
|
-
const handlerRef = useRef(
|
|
177
|
-
const debouncedHandleChange = useMemo(() => _debounce((...args) => handlerRef.current(...args), debounceWait), [debounceWait]);
|
|
176
|
+
const handlerRef = useRef(undefined);
|
|
177
|
+
const debouncedHandleChange = useMemo(() => _debounce((...args) => handlerRef.current?.(...args), debounceWait), [debounceWait]);
|
|
178
178
|
useEffect(() => () => debouncedHandleChange.cancel(), [debouncedHandleChange]);
|
|
179
179
|
const itemClassName = classNames({
|
|
180
180
|
[className]: className,
|
|
@@ -49,14 +49,15 @@ function setValueByPath(obj, path, value) {
|
|
|
49
49
|
|
|
50
50
|
// 创建之后namepath就不可变的警告
|
|
51
51
|
// selector 模式(dependencies 为函数)下跳过:函数引用每次渲染不同,无法稳定 stringify
|
|
52
|
-
|
|
52
|
+
// warning 在 production 下本身为空操作;始终走同一实现,避免 Jest 下 production 空函数不可达
|
|
53
|
+
const useWatchWarning = dependencies => {
|
|
53
54
|
const isSelector = typeof dependencies === 'function';
|
|
54
55
|
const depsStr = isSelector ? '__selector__' : JSON.stringify(dependencies);
|
|
55
56
|
const depsStrRef = useRef(depsStr);
|
|
56
57
|
if (!isSelector) {
|
|
57
58
|
warning(depsStrRef.current === depsStr, '`useWatch` is not support dynamic `namePath`. Please provide static instead.');
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
};
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* selector 函数:接收所有表单值,返回派生值
|
|
@@ -151,8 +152,8 @@ function useWatch(dependencies, form, wait) {
|
|
|
151
152
|
if (!formInstance) return undefined;
|
|
152
153
|
|
|
153
154
|
// 创建更新状态的函数
|
|
154
|
-
const updateState =
|
|
155
|
-
const values = formInstance.getFieldsValue(true);
|
|
155
|
+
const updateState = watchValues => {
|
|
156
|
+
const values = watchValues ?? formInstance.getFieldsValue(true);
|
|
156
157
|
|
|
157
158
|
// selector 模式:直接调用 selector 计算派生值
|
|
158
159
|
if (isSelector && selectorRef.current) {
|
|
@@ -190,10 +191,8 @@ function useWatch(dependencies, form, wait) {
|
|
|
190
191
|
const {
|
|
191
192
|
registerWatch
|
|
192
193
|
} = getInternalHooks('RC_FORM_INTERNAL_HOOKS');
|
|
193
|
-
const cancelWatch = registerWatch(values => {
|
|
194
|
-
|
|
195
|
-
updateState();
|
|
196
|
-
}
|
|
194
|
+
const cancelWatch = registerWatch((values, allValues) => {
|
|
195
|
+
updateState(allValues ?? values);
|
|
197
196
|
});
|
|
198
197
|
|
|
199
198
|
// 清理订阅
|
|
@@ -129,12 +129,12 @@ export const getAllNamePath = (object, currentPath = []) => {
|
|
|
129
129
|
|
|
130
130
|
// 拆开组合key (组合key只可能存在于最外层)
|
|
131
131
|
if (key.includes('-')) {
|
|
132
|
-
resultKeys.
|
|
132
|
+
resultKeys.push(...key.split('-').map(keyStr => keyStr.split('_')));
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// 深度获取对象key
|
|
136
136
|
if (_isObject(value)) {
|
|
137
|
-
resultKeys.
|
|
137
|
+
resultKeys.push(...getAllNamePath(value, [...currentPath, key]));
|
|
138
138
|
}
|
|
139
139
|
resultKeys.push([...currentPath, key]);
|
|
140
140
|
});
|
|
@@ -49,6 +49,7 @@ const OpenMenu = props => {
|
|
|
49
49
|
// 特殊处理:如果layoutSelectedPath是'##EMPTY##',表示有意清空选中状态
|
|
50
50
|
const preferredPath = query.get('activeMenu') || (layoutSelectedPath === '##EMPTY##' ? null : layoutSelectedPath) || window.location.pathname;
|
|
51
51
|
const selectKeyIdPath = preferredPath ? getIdsByPathName(menus, preferredPath)?.map(item => String(item)) || [] : [];
|
|
52
|
+
const selectedRootKey = selectKeyIdPath[0];
|
|
52
53
|
const itemsTransform = useMemo(() => {
|
|
53
54
|
const result = _cloneDeep(menus);
|
|
54
55
|
if (!Array.isArray(result) || !result.length) {
|
|
@@ -66,7 +67,7 @@ const OpenMenu = props => {
|
|
|
66
67
|
children: [/*#__PURE__*/_jsx(_Fragment, {
|
|
67
68
|
children: item.imgUrl && isFirstMenu ? /*#__PURE__*/_jsx("img", {
|
|
68
69
|
className: "pro-layout-icon",
|
|
69
|
-
src:
|
|
70
|
+
src: selectedRootKey === String(item.id) ? item.imgActiveUrl || item.imgUrl : item.imgUrl,
|
|
70
71
|
alt: "icon"
|
|
71
72
|
}) : item.icon && isFirstMenu ? /*#__PURE__*/_jsx(ProIcon, {
|
|
72
73
|
type: item.icon || '',
|
|
@@ -102,7 +103,7 @@ const OpenMenu = props => {
|
|
|
102
103
|
};
|
|
103
104
|
menuDeep(result);
|
|
104
105
|
return result;
|
|
105
|
-
}, [dataSource]);
|
|
106
|
+
}, [dataSource, selectedRootKey]);
|
|
106
107
|
useDeepCompareEffect(() => {
|
|
107
108
|
if (Array.isArray(selectKeyIdPath)) {
|
|
108
109
|
const newState = {
|
|
@@ -140,14 +141,13 @@ const OpenMenu = props => {
|
|
|
140
141
|
});
|
|
141
142
|
},
|
|
142
143
|
onClick: ({
|
|
143
|
-
item,
|
|
144
144
|
keyPath,
|
|
145
|
-
key
|
|
146
|
-
domEvent
|
|
145
|
+
key
|
|
147
146
|
}) => {
|
|
148
147
|
// 查找完整的菜单项数据
|
|
149
148
|
const menuItem = findMenuItemByKey(menus, key);
|
|
150
149
|
const menuKeyPath = menuItem?.keyIdPath ? menuItem.keyIdPath.map(id => String(id)) : keyPath;
|
|
150
|
+
const menuRouter = menuItem?.redirectUrl || menuItem?.router || menuItem?.url;
|
|
151
151
|
|
|
152
152
|
// 调用用户传入的onMenuClick回调,获取返回值(是否应该激活菜单)
|
|
153
153
|
let shouldActivate = true;
|
|
@@ -168,13 +168,13 @@ const OpenMenu = props => {
|
|
|
168
168
|
if (menuItem && canOpenAsTab(menuItem) && shouldActivate) {
|
|
169
169
|
setState({
|
|
170
170
|
selectedKeys: keyPath,
|
|
171
|
-
router:
|
|
171
|
+
router: menuRouter
|
|
172
172
|
});
|
|
173
173
|
layoutOnSelected?.({
|
|
174
|
-
selectedPath:
|
|
174
|
+
selectedPath: menuRouter
|
|
175
175
|
});
|
|
176
176
|
if (layoutTarget) {
|
|
177
|
-
window.open(
|
|
177
|
+
window.open(menuRouter, layoutTarget);
|
|
178
178
|
} else {
|
|
179
179
|
setTimeout(() => {
|
|
180
180
|
// 路由变更,且不再demo文档中
|
|
@@ -157,7 +157,7 @@ const Menu = props => {
|
|
|
157
157
|
onMenuClick: onMenuClick,
|
|
158
158
|
style: {
|
|
159
159
|
display: collapsed ? 'none' : 'block',
|
|
160
|
-
height: `calc(100vh - ${headerHeight + (notice ? 32 : 0) + 48
|
|
160
|
+
height: `calc(100vh - ${(headerHeight ?? 0) + (notice ? 32 : 0) + 48}px)`
|
|
161
161
|
}
|
|
162
162
|
}), sideMenuFooterRender || /*#__PURE__*/_jsx("div", {
|
|
163
163
|
className: "pro-layout-menu-collapsed",
|
|
@@ -31,11 +31,12 @@ const ProFooter = props => {
|
|
|
31
31
|
'pro-footer': true,
|
|
32
32
|
[`${className}`]: className
|
|
33
33
|
});
|
|
34
|
+
const sideWidth = size?.width ?? 0;
|
|
34
35
|
return /*#__PURE__*/_jsx("div", {
|
|
35
36
|
className: cls,
|
|
36
37
|
style: {
|
|
37
38
|
zIndex,
|
|
38
|
-
width: `calc(100% - ${
|
|
39
|
+
width: `calc(100% - ${sideWidth + 1}px)`,
|
|
39
40
|
...props.style
|
|
40
41
|
},
|
|
41
42
|
children: /*#__PURE__*/_jsx(Space, {
|
|
@@ -46,7 +46,9 @@ export const DescribeValue = ({
|
|
|
46
46
|
children: [link ? /*#__PURE__*/_jsx("a", {
|
|
47
47
|
onClick: () => {
|
|
48
48
|
const newWindow = window.open(link);
|
|
49
|
-
newWindow
|
|
49
|
+
if (newWindow) {
|
|
50
|
+
newWindow.opener = null;
|
|
51
|
+
}
|
|
50
52
|
},
|
|
51
53
|
children: value
|
|
52
54
|
}) : value, copyable && _isString(value) ? /*#__PURE__*/_jsx(Copy, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CloseOutlined } from '@ant-design/icons';
|
|
3
|
-
import
|
|
3
|
+
import { Tooltip } from 'antd';
|
|
4
4
|
import { TabContextMenu } from "./TabContextMenu";
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
const MAX_TAB_TITLE_LENGTH = 12;
|
|
@@ -70,12 +70,13 @@ const TabItemComponent = ({
|
|
|
70
70
|
}) : tab.icon
|
|
71
71
|
}), /*#__PURE__*/_jsx("div", {
|
|
72
72
|
className: "pro-layout-tab-title",
|
|
73
|
-
children: isTitleOverflow ? /*#__PURE__*/_jsx(
|
|
74
|
-
text: displayTitle,
|
|
73
|
+
children: isTitleOverflow ? /*#__PURE__*/_jsx(Tooltip, {
|
|
75
74
|
title: tabTitle,
|
|
76
|
-
line: 1,
|
|
77
75
|
placement: "top",
|
|
78
|
-
|
|
76
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
77
|
+
className: "pro-tooltip",
|
|
78
|
+
children: displayTitle
|
|
79
|
+
})
|
|
79
80
|
}) : tabTitle
|
|
80
81
|
}), tab.closable && /*#__PURE__*/_jsx("span", {
|
|
81
82
|
className: "pro-layout-tab-close",
|