@zat-design/sisyphus-react 4.5.0-beta.3 → 4.5.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/ProDrawerForm/components/ProDrawer/index.js +58 -86
- package/es/ProDrawerForm/components/ProModal/index.js +44 -20
- package/es/ProDrawerForm/hooks/useConfirmClose.d.ts +25 -0
- package/es/ProDrawerForm/hooks/useConfirmClose.js +70 -0
- package/es/ProDrawerForm/index.js +7 -11
- package/es/ProDrawerForm/propsType.d.ts +14 -3
- package/es/ProDrawerForm/utils/index.d.ts +19 -0
- package/es/ProDrawerForm/utils/index.js +36 -0
- package/es/ProEditTable/components/RcTable/BaseTable.js +10 -0
- package/es/ProEnum/index.js +6 -3
- package/es/ProForm/components/combination/Group/utils/index.d.ts +17 -17
- package/es/ProForm/components/combination/ProModalSelect/index.js +6 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/mergeSelectedRows.d.ts +14 -0
- package/es/ProForm/components/combination/ProModalSelect/utils/mergeSelectedRows.js +26 -0
- package/es/ProIcon/propsTypes.d.ts +2 -2
- package/es/ProSelect/index.js +23 -11
- package/es/ProSelect/propsType.d.ts +2 -0
- package/es/ProTable/propsType.d.ts +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +24 -11
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +6 -0
- package/es/ProTree/components/ProTreeSelect/style/index.less +13 -4
- package/es/ProTree/propsType.d.ts +6 -0
- package/es/ProTree/style/index.less +20 -9
- package/es/ProTree/utils.d.ts +10 -0
- package/es/ProTree/utils.js +26 -0
- package/es/ProTreeModal/style/index.less +1 -1
- package/es/ProViewer/propsType.d.ts +2 -0
- package/es/ProViewer/propsType.js +3 -1
- package/es/index.d.ts +17 -6
- package/es/index.js +10 -0
- package/package.json +7 -13
|
@@ -16,6 +16,7 @@ import viewSvg from "../../../../assets/view.svg";
|
|
|
16
16
|
import useRequestList from "./hooks/useRequestList";
|
|
17
17
|
import locale from "../../../../locale";
|
|
18
18
|
import { hideTooltipIfOpen } from "./utils";
|
|
19
|
+
import { mergeSelectedRows } from "./utils/mergeSelectedRows";
|
|
19
20
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
21
|
const ProModalSelect = (props, ref) => {
|
|
21
22
|
const {
|
|
@@ -335,10 +336,14 @@ const ProModalSelect = (props, ref) => {
|
|
|
335
336
|
};
|
|
336
337
|
const _rowSelection = {
|
|
337
338
|
type,
|
|
339
|
+
// 多选时开启,保证翻页/筛选后不丢弃不在当前页的已选 key
|
|
340
|
+
preserveSelectedRowKeys: isMultiple,
|
|
338
341
|
onChange: (rowKeys, rows) => {
|
|
342
|
+
// 多选时合并跨页已选行:antd 回传的 rows 中不在当前页的为 undefined,用历史 selectedRows 补全
|
|
343
|
+
const nextSelectedRows = isMultiple ? mergeSelectedRows(selectedRows, rowKeys, rows, getRowKey) : rows;
|
|
339
344
|
setState({
|
|
340
345
|
selectedRowKeys: rowKeys,
|
|
341
|
-
selectedRows:
|
|
346
|
+
selectedRows: nextSelectedRows
|
|
342
347
|
});
|
|
343
348
|
},
|
|
344
349
|
getCheckboxProps: record => ({
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合并跨页/筛选场景下的多选行数据
|
|
3
|
+
*
|
|
4
|
+
* antd Table 开启 preserveSelectedRowKeys 后,onChange 回传的 rowKeys 是全量(含不在当前页的 key),
|
|
5
|
+
* 但 rows 中不在当前 dataSource 的行对象会是 undefined。此函数用历史已选行(prevRows)补全这些缺失的行对象,
|
|
6
|
+
* 保证返回的 rows 与 rowKeys 全量对齐,从而避免翻页/精准筛选后丢失已选数据。
|
|
7
|
+
*
|
|
8
|
+
* @param prevRows 历史已选行(累积缓存)
|
|
9
|
+
* @param nextRowKeys antd 回传的全量选中 key
|
|
10
|
+
* @param nextRows antd 回传的行对象(不在当前页的为 undefined)
|
|
11
|
+
* @param getRowKey 取行 key 的方法
|
|
12
|
+
* @returns 与 nextRowKeys 对齐的全量行对象(无法找到行对象的 key 会被过滤)
|
|
13
|
+
*/
|
|
14
|
+
export declare const mergeSelectedRows: (prevRows: Record<string, any>[], nextRowKeys: any[], nextRows: (Record<string, any> | undefined)[], getRowKey: (record: Record<string, any>) => any) => Record<string, any>[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合并跨页/筛选场景下的多选行数据
|
|
3
|
+
*
|
|
4
|
+
* antd Table 开启 preserveSelectedRowKeys 后,onChange 回传的 rowKeys 是全量(含不在当前页的 key),
|
|
5
|
+
* 但 rows 中不在当前 dataSource 的行对象会是 undefined。此函数用历史已选行(prevRows)补全这些缺失的行对象,
|
|
6
|
+
* 保证返回的 rows 与 rowKeys 全量对齐,从而避免翻页/精准筛选后丢失已选数据。
|
|
7
|
+
*
|
|
8
|
+
* @param prevRows 历史已选行(累积缓存)
|
|
9
|
+
* @param nextRowKeys antd 回传的全量选中 key
|
|
10
|
+
* @param nextRows antd 回传的行对象(不在当前页的为 undefined)
|
|
11
|
+
* @param getRowKey 取行 key 的方法
|
|
12
|
+
* @returns 与 nextRowKeys 对齐的全量行对象(无法找到行对象的 key 会被过滤)
|
|
13
|
+
*/
|
|
14
|
+
export const mergeSelectedRows = (prevRows, nextRowKeys, nextRows, getRowKey) => {
|
|
15
|
+
// 用 key -> row 建立查找表:当前页最新行覆盖历史行
|
|
16
|
+
const rowMap = new Map();
|
|
17
|
+
prevRows?.forEach(row => {
|
|
18
|
+
if (row) rowMap.set(getRowKey(row), row);
|
|
19
|
+
});
|
|
20
|
+
nextRows?.forEach(row => {
|
|
21
|
+
if (row) rowMap.set(getRowKey(row), row);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// 按 nextRowKeys 顺序取行对象,取不到的(无缓存)过滤掉
|
|
25
|
+
return nextRowKeys.map(key => rowMap.get(key)).filter(Boolean);
|
|
26
|
+
};
|
|
@@ -8,7 +8,7 @@ export type ProIconModeType = 'icon' | 'button';
|
|
|
8
8
|
/**
|
|
9
9
|
* 图标映射对象
|
|
10
10
|
*/
|
|
11
|
-
interface ProIconMapType {
|
|
11
|
+
export interface ProIconMapType {
|
|
12
12
|
/**
|
|
13
13
|
* 图标类型
|
|
14
14
|
* @description 唯一标识图标的类型名称
|
|
@@ -42,7 +42,7 @@ interface ProIconThemeMapType {
|
|
|
42
42
|
/**
|
|
43
43
|
* 操作映射对象
|
|
44
44
|
*/
|
|
45
|
-
interface ProIconActionMapType {
|
|
45
|
+
export interface ProIconActionMapType {
|
|
46
46
|
/**
|
|
47
47
|
* 主题颜色映射
|
|
48
48
|
* @description 不同主题下的颜色映射
|
package/es/ProSelect/index.js
CHANGED
|
@@ -122,7 +122,9 @@ export const ProSelect = (props, ref) => {
|
|
|
122
122
|
fetchFunctionRef.current = fetchFunction;
|
|
123
123
|
}, [fetchFunction]);
|
|
124
124
|
const cacheList = useRequest?.options?.cacheKey ? successTransformDataHandle(fetchFunction?.data) : [];
|
|
125
|
-
|
|
125
|
+
|
|
126
|
+
// 展平结果仅随 selectList 变化;滚动重挂载/无关 rerender 时复用,避免重复展平
|
|
127
|
+
const flatOptions = useMemo(() => flattenOptions(selectList), [selectList]);
|
|
126
128
|
const getValueObject = input => {
|
|
127
129
|
if (Array.isArray(input) && input.length) {
|
|
128
130
|
const resArr = [];
|
|
@@ -457,17 +459,27 @@ export const ProSelect = (props, ref) => {
|
|
|
457
459
|
mode: selectProps.mode
|
|
458
460
|
});
|
|
459
461
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
462
|
+
|
|
463
|
+
// antd Select 的 options 仅随数据源/字段映射/展示配置变化;滚动重挂载与无关 rerender 时复用,
|
|
464
|
+
// 避免每次渲染全量重建 option 对象(落在虚拟表格挂载热路径上)。
|
|
465
|
+
// 依赖用 buildOptionItem 实际消费的原始值(code/label/showCodeName/OptionRender),
|
|
466
|
+
// 而非每次新建的 buildOptionItem 函数引用,避免缓存失效。
|
|
467
|
+
const selectOptions = useMemo(() => {
|
|
468
|
+
if (!Array.isArray(newSelectList)) {
|
|
469
|
+
return [];
|
|
468
470
|
}
|
|
469
|
-
return
|
|
470
|
-
|
|
471
|
+
return newSelectList.map((item, index) => {
|
|
472
|
+
const groupOptions = item.options;
|
|
473
|
+
if (Array.isArray(groupOptions)) {
|
|
474
|
+
return {
|
|
475
|
+
key: item[label] ?? `group-${index}`,
|
|
476
|
+
label: item[label],
|
|
477
|
+
options: groupOptions.map((opt, optIndex) => buildOptionItem(opt, optIndex))
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
return buildOptionItem(item, index);
|
|
481
|
+
});
|
|
482
|
+
}, [newSelectList, code, label, selectProps.showCodeName, OptionRender]);
|
|
471
483
|
return /*#__PURE__*/_jsx("div", {
|
|
472
484
|
style: props.style,
|
|
473
485
|
className: "pro-select",
|
|
@@ -115,6 +115,8 @@ export interface PropSelectType extends Omit<SelectProps, 'onSearch'> {
|
|
|
115
115
|
*/
|
|
116
116
|
getValueProps?: (value: DataOptionType) => any;
|
|
117
117
|
}
|
|
118
|
+
/** 对外公开类型别名(PropSelectType 为历史拼写,保留内部命名) */
|
|
119
|
+
export type ProSelectType = PropSelectType;
|
|
118
120
|
/**
|
|
119
121
|
* @description ProSelect操作接口类型
|
|
120
122
|
*/
|
|
@@ -10,7 +10,7 @@ import locale from "../../../locale";
|
|
|
10
10
|
import { useProConfig } from "../../../ProConfigProvider";
|
|
11
11
|
import Container from "../../../ProForm/components/Container";
|
|
12
12
|
import AdaptiveTooltip from "../AdaptiveTooltip";
|
|
13
|
-
import { getFlatTreeData, restoreCodeNameLabel } from "../../utils";
|
|
13
|
+
import { getFlatTreeData, restoreCodeNameLabel, applyCheckLeaf } from "../../utils";
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
15
|
const {
|
|
16
16
|
SHOW_PARENT
|
|
@@ -63,6 +63,8 @@ export const ProTreeSelect = (props, ref) => {
|
|
|
63
63
|
className,
|
|
64
64
|
checkStrictly,
|
|
65
65
|
checkable,
|
|
66
|
+
checkLeaf,
|
|
67
|
+
// 开启后只能选择叶子节点,非叶子节点置灰禁用
|
|
66
68
|
...selectProps
|
|
67
69
|
} = props;
|
|
68
70
|
const {
|
|
@@ -153,6 +155,17 @@ export const ProTreeSelect = (props, ref) => {
|
|
|
153
155
|
loop(copyData);
|
|
154
156
|
return copyData;
|
|
155
157
|
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 统一数据后处理:先处理 code-name 展示,再按 checkLeaf 标记非叶子节点禁用
|
|
161
|
+
* 数据已是标准格式(label, value, children)
|
|
162
|
+
* @param dataArr 标准格式数据
|
|
163
|
+
* @returns 后处理结果
|
|
164
|
+
*/
|
|
165
|
+
const processData = dataArr => {
|
|
166
|
+
const result = transferDataSource(dataArr, showCodeName);
|
|
167
|
+
return checkLeaf ? applyCheckLeaf(result) : result;
|
|
168
|
+
};
|
|
156
169
|
const defaultOnSuccessFun = res => {
|
|
157
170
|
const {
|
|
158
171
|
status = 200,
|
|
@@ -163,9 +176,9 @@ export const ProTreeSelect = (props, ref) => {
|
|
|
163
176
|
message.error(msg);
|
|
164
177
|
return;
|
|
165
178
|
}
|
|
166
|
-
// 先转换字段名,再处理 code-name
|
|
179
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
167
180
|
const transformedData = transformFieldNames(data || []);
|
|
168
|
-
const resultData =
|
|
181
|
+
const resultData = processData(transformedData);
|
|
169
182
|
setState({
|
|
170
183
|
selectList: resultData || [],
|
|
171
184
|
origDataSource: resultData || []
|
|
@@ -194,9 +207,9 @@ export const ProTreeSelect = (props, ref) => {
|
|
|
194
207
|
onSuccess: data => {
|
|
195
208
|
if (transformResponse && typeof transformResponse === 'function') {
|
|
196
209
|
const responseData = transformResponse(data);
|
|
197
|
-
// 先转换字段名,再处理 code-name
|
|
210
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
198
211
|
const transformedData = transformFieldNames(responseData);
|
|
199
|
-
const resultData =
|
|
212
|
+
const resultData = processData(transformedData);
|
|
200
213
|
setState({
|
|
201
214
|
selectList: countChild(resultData),
|
|
202
215
|
origDataSource: resultData
|
|
@@ -217,9 +230,9 @@ export const ProTreeSelect = (props, ref) => {
|
|
|
217
230
|
if (fetchFunction?.data, useRequest?.options?.cacheKey) {
|
|
218
231
|
if (transformResponse && typeof transformResponse === 'function') {
|
|
219
232
|
const responseData = transformResponse(fetchFunction.data);
|
|
220
|
-
// 先转换字段名,再处理 code-name
|
|
233
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
221
234
|
const transformedData = transformFieldNames(responseData);
|
|
222
|
-
const resultData =
|
|
235
|
+
const resultData = processData(transformedData);
|
|
223
236
|
setState({
|
|
224
237
|
selectList: countChild(resultData),
|
|
225
238
|
origDataSource: resultData
|
|
@@ -232,18 +245,18 @@ export const ProTreeSelect = (props, ref) => {
|
|
|
232
245
|
useDeepCompareEffect(() => {
|
|
233
246
|
if (enumCode) {
|
|
234
247
|
const dictEnum = dics[enumCode] || [];
|
|
235
|
-
// 先转换字段名,再处理 code-name
|
|
248
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
236
249
|
const transformedData = transformFieldNames(dictEnum);
|
|
237
|
-
const resultData =
|
|
250
|
+
const resultData = processData(transformedData);
|
|
238
251
|
const processedList = countChild(resultData);
|
|
239
252
|
setState({
|
|
240
253
|
selectList: processedList,
|
|
241
254
|
origDataSource: resultData
|
|
242
255
|
});
|
|
243
256
|
} else if (dataSource) {
|
|
244
|
-
// 先转换字段名,再处理 code-name
|
|
257
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
245
258
|
const transformedData = transformFieldNames(dataSource);
|
|
246
|
-
const resultData =
|
|
259
|
+
const resultData = processData(transformedData);
|
|
247
260
|
const processedList = countChild(resultData);
|
|
248
261
|
setState({
|
|
249
262
|
selectList: processedList,
|
|
@@ -304,6 +304,12 @@ export interface ProTreeSelectType extends Omit<TreeSelectProps, 'onSearch'> {
|
|
|
304
304
|
* @default false
|
|
305
305
|
*/
|
|
306
306
|
checkable?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* 只选叶子节点
|
|
309
|
+
* @description 开启后只能选择叶子节点,非叶子节点置灰禁用,仅 treeSelect 单选模式生效
|
|
310
|
+
* @default false
|
|
311
|
+
*/
|
|
312
|
+
checkLeaf?: boolean;
|
|
307
313
|
/**
|
|
308
314
|
* 显示省略号
|
|
309
315
|
* @description 是否单行省略
|
|
@@ -30,12 +30,21 @@
|
|
|
30
30
|
width: auto !important;
|
|
31
31
|
padding: 0px;
|
|
32
32
|
}
|
|
33
|
-
&.
|
|
33
|
+
&.signal-tree,
|
|
34
34
|
&.checkable-tree {
|
|
35
35
|
.@{ant-prefix}-select-tree {
|
|
36
36
|
.@{ant-prefix}-select-tree-treenode {
|
|
37
|
-
padding-top:
|
|
38
|
-
padding-bottom:
|
|
37
|
+
padding-top: 2px;
|
|
38
|
+
padding-bottom: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.@{ant-prefix}-select-tree-node-content-wrapper {
|
|
42
|
+
min-height: 20px;
|
|
43
|
+
line-height: 20px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.@{ant-prefix}-select-tree-switcher {
|
|
47
|
+
line-height: 24px;
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
.highlight {
|
|
@@ -101,7 +110,7 @@
|
|
|
101
110
|
background-color: transparent;
|
|
102
111
|
}
|
|
103
112
|
.@{ant-prefix}-select-tree-checkbox {
|
|
104
|
-
margin-top:
|
|
113
|
+
margin-top: 2px;
|
|
105
114
|
align-self: stretch;
|
|
106
115
|
}
|
|
107
116
|
}
|
|
@@ -298,6 +298,12 @@ export interface ProTreeType extends ProTreeSelectType {
|
|
|
298
298
|
* @default false
|
|
299
299
|
*/
|
|
300
300
|
checkable?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* 只选叶子节点
|
|
303
|
+
* @description 开启后只能选择叶子节点,非叶子节点置灰禁用,仅 treeSelect 单选模式生效
|
|
304
|
+
* @default false
|
|
305
|
+
*/
|
|
306
|
+
checkLeaf?: boolean;
|
|
301
307
|
/**
|
|
302
308
|
* 可勾选
|
|
303
309
|
* @description 是否显示 checkbox
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
background-color: transparent;
|
|
77
77
|
}
|
|
78
78
|
.@{ant-prefix}-tree-checkbox {
|
|
79
|
-
margin-top:
|
|
79
|
+
margin-top: 7px;
|
|
80
80
|
align-self: flex-start;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
.@{ant-prefix}-tree-switcher {
|
|
117
|
-
line-height:
|
|
117
|
+
line-height: 32px;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
.@{ant-prefix}-tree-switcher-leaf-line {
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
&-tree-node {
|
|
162
162
|
display: flex;
|
|
163
163
|
flex-direction: row;
|
|
164
|
-
padding:
|
|
164
|
+
padding: 6px var(--zaui-space-size-sm);
|
|
165
165
|
margin-left: -8px;
|
|
166
166
|
border-radius: var(--zaui-space-size-xs);
|
|
167
167
|
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
.@{ant-prefix}-tree-switcher {
|
|
270
270
|
width: 20px;
|
|
271
271
|
align-self: flex-start;
|
|
272
|
-
margin-top:
|
|
272
|
+
margin-top: 0;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
.@{ant-prefix}-tree-show-line .@{ant-prefix}-tree-indent-unit::before {
|
|
@@ -316,6 +316,9 @@
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
.pro-tree-operate-btn-popover {
|
|
319
|
+
overflow: hidden;
|
|
320
|
+
border-radius: var(--zaui-border-radius);
|
|
321
|
+
|
|
319
322
|
.icon-item {
|
|
320
323
|
position: relative;
|
|
321
324
|
z-index: 1;
|
|
@@ -330,14 +333,22 @@
|
|
|
330
333
|
&:after {
|
|
331
334
|
position: absolute;
|
|
332
335
|
display: block;
|
|
333
|
-
z-index:
|
|
334
|
-
|
|
335
|
-
top: 0;
|
|
336
|
+
z-index: -1;
|
|
337
|
+
inset: 0;
|
|
336
338
|
content: '';
|
|
337
|
-
width: 120px;
|
|
338
|
-
height: 32px;
|
|
339
339
|
background-color: var(--zaui-brand);
|
|
340
340
|
opacity: 0.08;
|
|
341
|
+
border-radius: var(--zaui-border-radius-card);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&:first-child:after {
|
|
345
|
+
border-top-left-radius: var(--zaui-border-radius);
|
|
346
|
+
border-top-right-radius: var(--zaui-border-radius);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
&:last-child:after {
|
|
350
|
+
border-bottom-left-radius: var(--zaui-border-radius);
|
|
351
|
+
border-bottom-right-radius: var(--zaui-border-radius);
|
|
341
352
|
}
|
|
342
353
|
}
|
|
343
354
|
}
|
package/es/ProTree/utils.d.ts
CHANGED
|
@@ -50,3 +50,13 @@ export declare function restoreCodeNameLabel<T extends Record<string, any>>(opti
|
|
|
50
50
|
* @param allkeys 所有key
|
|
51
51
|
*/
|
|
52
52
|
export declare function getDefaultExpandKeys(isExpand: any, allKeys: any): any;
|
|
53
|
+
/**
|
|
54
|
+
* checkLeaf 模式:只能选择叶子节点,非叶子节点设 disabled=true 整行置灰不可点
|
|
55
|
+
* 数据已是标准格式(label, value, children),仅单选 treeSelect 场景使用
|
|
56
|
+
* 不可变:返回全新数组,不修改入参
|
|
57
|
+
* @param data 标准格式树数据
|
|
58
|
+
* @returns 标记后的新树数据
|
|
59
|
+
*/
|
|
60
|
+
export declare function applyCheckLeaf<T extends {
|
|
61
|
+
children?: T[];
|
|
62
|
+
}>(data: T[]): T[];
|
package/es/ProTree/utils.js
CHANGED
|
@@ -201,4 +201,30 @@ export function getDefaultExpandKeys(isExpand, allKeys) {
|
|
|
201
201
|
return allKeys;
|
|
202
202
|
}
|
|
203
203
|
return [];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* checkLeaf 模式:只能选择叶子节点,非叶子节点设 disabled=true 整行置灰不可点
|
|
208
|
+
* 数据已是标准格式(label, value, children),仅单选 treeSelect 场景使用
|
|
209
|
+
* 不可变:返回全新数组,不修改入参
|
|
210
|
+
* @param data 标准格式树数据
|
|
211
|
+
* @returns 标记后的新树数据
|
|
212
|
+
*/
|
|
213
|
+
export function applyCheckLeaf(data) {
|
|
214
|
+
if (!Array.isArray(data)) {
|
|
215
|
+
return data;
|
|
216
|
+
}
|
|
217
|
+
return data.map(node => {
|
|
218
|
+
const hasChildren = Array.isArray(node.children) && node.children.length > 0;
|
|
219
|
+
if (!hasChildren) {
|
|
220
|
+
return {
|
|
221
|
+
...node
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
...node,
|
|
226
|
+
disabled: true,
|
|
227
|
+
children: applyCheckLeaf(node.children)
|
|
228
|
+
};
|
|
229
|
+
});
|
|
204
230
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -28,20 +28,31 @@ export * from './ProConfigProvider';
|
|
|
28
28
|
export * from './locale';
|
|
29
29
|
export { default as ProBackBtn } from './ProLayout/components/ProHeader/components/ProBackBtn';
|
|
30
30
|
export type { ProConfigProviderType } from './ProConfigProvider';
|
|
31
|
-
export type { ProFormType, ProFormColumnType } from './ProForm/propsType';
|
|
31
|
+
export type { ProFormType, ProFormColumnType, ProFormOtherType, DiffConfigType, } from './ProForm/propsType';
|
|
32
32
|
export type { ProFormComponentType } from './ProForm/components';
|
|
33
|
-
export type {
|
|
33
|
+
export type { FormListMode } from './ProForm/components/combination/FormList/propsType';
|
|
34
|
+
export type { ProTableType, ProTableColumnType, ProTableSummaryType, ProTableSummaryColumnType, ProTableUseAntdTableType, ProTableTabsType, ProTableRequestOptionsType, ProTableListResponseType, } from './ProTable/propsType';
|
|
35
|
+
export type { ProSelectType, ProSelectActionType } from './ProSelect/propsType';
|
|
34
36
|
export type { ProUploadType } from './ProUpload/propsType';
|
|
35
37
|
export type { ProTabsType, ProTabsItemType } from './ProTabs/propType';
|
|
36
38
|
export type { BreadcrumbColumnType, SubDescribeColumnType, DescribeColumnType, ProHeaderType, } from './ProLayout/components/ProHeader/PropTypes';
|
|
37
|
-
export type {
|
|
39
|
+
export type { ProCollapseType } from './ProLayout/components/ProCollapse/PropTypes';
|
|
40
|
+
export type { ProFooterType } from './ProLayout/components/ProFooter/PropTypes';
|
|
41
|
+
export type { ProLayoutType, MenusType, AppsOption, AppsGroup } from './ProLayout/propTypes';
|
|
38
42
|
export type { ProTooltipType } from './ProTooltip/propsType';
|
|
39
|
-
export type { ProIconType } from './ProIcon/propsTypes';
|
|
43
|
+
export type { ProIconType, ProIconModeType, ProIconMapType, ProIconActionMapType, } from './ProIcon/propsTypes';
|
|
40
44
|
export type { ProTreeType, ProTreeSelectType } from './ProTree/propsType';
|
|
41
|
-
export type { ProTreeModalType, ProTreeModalActionType } from './ProTreeModal/propsType';
|
|
45
|
+
export type { ProTreeModalType, ProTreeModalActionType, ProTreeModalAppointType, } from './ProTreeModal/propsType';
|
|
42
46
|
export type { ProEditTableType, ProEditTableColumnType, ProEditTableSummaryColumnType, ProEditTableSummaryConfigType, ProEditTableActionType, } from './ProEditTable/propsType';
|
|
43
47
|
export type { ProStepType, ProStepContextType, ProStepItemType } from './ProStep/propsType';
|
|
44
48
|
export type { ProDrawerFormType } from './ProDrawerForm/propsType';
|
|
49
|
+
export type { ProEditLabelType, PopupType } from './ProEditLabel/propsType';
|
|
45
50
|
export type { ProModalSelectType, ProModalSelectConfigType, } from './ProForm/components/combination/ProModalSelect/propsType';
|
|
46
|
-
export type { ProStepTabType, ProStepTabResultType } from './ProStepTab/propsType';
|
|
51
|
+
export type { ProStepTabType, ProStepTabResultType, HandleFunctionType, } from './ProStepTab/propsType';
|
|
52
|
+
export type { ProEnumType, DataOptionType } from './ProEnum/propsType';
|
|
53
|
+
export type { ProActionType } from './ProAction/propsType';
|
|
54
|
+
export type { ProDownloadType } from './ProDownload/propsType';
|
|
55
|
+
export type { ProViewerType } from './ProViewer/propsType';
|
|
56
|
+
export type { ProWaterMarkType } from './ProWaterMark/propsType';
|
|
57
|
+
export type { ProThemeToolsType, LocalThemeConfigType } from './ProThemeTools/propsType';
|
|
47
58
|
export * from './tokens';
|
package/es/index.js
CHANGED
|
@@ -45,6 +45,8 @@ export { default as ProBackBtn } from "./ProLayout/components/ProHeader/componen
|
|
|
45
45
|
|
|
46
46
|
// ProTable 相关类型
|
|
47
47
|
|
|
48
|
+
// ProSelect 类型
|
|
49
|
+
|
|
48
50
|
// ProUpload 类型
|
|
49
51
|
|
|
50
52
|
// ProTabs 类型
|
|
@@ -63,9 +65,17 @@ export { default as ProBackBtn } from "./ProLayout/components/ProHeader/componen
|
|
|
63
65
|
|
|
64
66
|
// ProDrawerForm 类型
|
|
65
67
|
|
|
68
|
+
// ProEditLabel 类型
|
|
69
|
+
|
|
66
70
|
// ProModalSelect 类型
|
|
67
71
|
|
|
68
72
|
// ProStepTab 类型
|
|
69
73
|
|
|
74
|
+
// ProEnum 类型
|
|
75
|
+
|
|
76
|
+
// ProAction / ProDownload / ProViewer 类型
|
|
77
|
+
|
|
78
|
+
// ProWaterMark / ProThemeTools 类型
|
|
79
|
+
|
|
70
80
|
// token导出
|
|
71
81
|
export * from "./tokens";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"es",
|
|
@@ -48,35 +48,29 @@
|
|
|
48
48
|
],
|
|
49
49
|
"scripts": {
|
|
50
50
|
"analyze": "ANALYZE=1 dumi build",
|
|
51
|
-
"build": "father build && mv dist/index.min.css dist/index.esm.css && mv dist/less.min.css dist/less.esm.css",
|
|
52
|
-
"build-
|
|
53
|
-
"build-lib": "father build --format cjs",
|
|
54
|
-
"build-dist": "father build --format umd",
|
|
51
|
+
"build": "father build && mv dist/index.min.css dist/index.esm.css && mv dist/less.min.css dist/less.esm.css && npm run build:ai-meta",
|
|
52
|
+
"build:ai-meta": "node ./scripts/build-ai-meta.mjs",
|
|
55
53
|
"docs": "cross-env NODE_OPTIONS=\"--openssl-legacy-provider\" dumi build",
|
|
56
54
|
"docs:deploy": "gh-pages -d docs-dist",
|
|
57
55
|
"lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
|
|
58
|
-
"lint-staged": "lint-staged",
|
|
59
56
|
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx --ignore-pattern '**/__tests__/**' --ignore-pattern '**/*.test.*' --ignore-pattern '**/*.spec.*'",
|
|
60
57
|
"code-standards:check": "node ./scripts/code-standards-check.mjs",
|
|
58
|
+
"check:types": "node ./scripts/check-public-types.mjs",
|
|
61
59
|
"commit-msg:format": "node ./scripts/format-commit-msg.mjs",
|
|
62
|
-
"git:pull:dev_4": "git pull --tags --no-rebase origin dev_4",
|
|
63
60
|
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
|
|
64
61
|
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
|
|
65
62
|
"lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
|
|
66
|
-
"lint:report": "eslint --ext .jsx,.js src -f checkstyle -o report_zacc_eslint_js.xml & exit 0; stylelint --custom-formatter node_modules/stylelint-checkstyle-formatter src/**/*.{css,scss,less} > report_zacc_stylelint_css.xml & exit 0",
|
|
67
63
|
"lint:style": "stylelint --fix \"src/**/*.less\"",
|
|
68
|
-
"precommit": "lint-staged",
|
|
69
64
|
"prepare": "husky && patch-package",
|
|
70
65
|
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
|
71
|
-
"
|
|
66
|
+
"pack:main": "npm pack --dry-run",
|
|
67
|
+
"pack:mcp": "npm run build:ai-meta && cd packages/sisyphus-react-mcp && npm pack --dry-run",
|
|
72
68
|
"release": "yarn build && npm publish",
|
|
69
|
+
"release:mcp": "npm run build:ai-meta && cd packages/sisyphus-react-mcp && npm publish",
|
|
73
70
|
"release:beta": "yarn build && npm publish --tag=beta",
|
|
74
71
|
"start": "cross-env NODE_OPTIONS=\"--openssl-legacy-provider\" dumi dev",
|
|
75
72
|
"test": "umi-test",
|
|
76
73
|
"test:coverage": "umi-test --coverage",
|
|
77
|
-
"test:react18": "REACT_VERSION=18 npm run test",
|
|
78
|
-
"test:react19": "npm run test",
|
|
79
|
-
"test:all-versions": "npm run test:react18 && npm run test:react19",
|
|
80
74
|
"tsc": "tsc --noEmit"
|
|
81
75
|
},
|
|
82
76
|
"lint-staged": {
|