@zat-design/sisyphus-react 3.14.10-beta.6 → 3.14.10-beta.9
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/es/ProTree/components/ProTree.js +3 -1
- package/es/ProTree/components/ProTreeSelect/index.js +24 -12
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +6 -0
- package/es/ProTree/propsType.d.ts +6 -0
- package/es/ProTree/utils.d.ts +10 -0
- package/es/ProTree/utils.js +23 -0
- package/lib/ProTree/components/ProTree.js +3 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +23 -11
- package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +6 -0
- package/lib/ProTree/propsType.d.ts +6 -0
- package/lib/ProTree/utils.d.ts +10 -0
- package/lib/ProTree/utils.js +24 -0
- package/package.json +1 -1
- package/.gitnexus/lbug +0 -0
- package/.gitnexus/meta.json +0 -14
|
@@ -134,7 +134,9 @@ var ProTree = props => {
|
|
|
134
134
|
debounceWait: 300
|
|
135
135
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
|
136
136
|
useDeepCompareEffect(() => {
|
|
137
|
-
|
|
137
|
+
// 显式传入数组(含空数组 [])时都同步到内部 state,
|
|
138
|
+
// 否则删除最后一个节点后 dataSource 变为 [] 时树数据不会被清空。
|
|
139
|
+
if (Array.isArray(dataSource)) {
|
|
138
140
|
var allKey = getAllKeys(dataSource, fieldNames);
|
|
139
141
|
setState({
|
|
140
142
|
treeData: dataSource,
|
|
@@ -11,7 +11,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
11
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
12
|
import "antd/es/tree-select/style";
|
|
13
13
|
import _TreeSelect from "antd/es/tree-select";
|
|
14
|
-
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "placeholder", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"];
|
|
14
|
+
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "placeholder", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable", "checkLeaf"];
|
|
15
15
|
/* eslint-disable react/no-danger */
|
|
16
16
|
/* eslint-disable react/jsx-closing-tag-location */
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
@@ -24,7 +24,7 @@ import locale from "../../../locale";
|
|
|
24
24
|
import { useProConfig } from "../../../ProConfigProvider";
|
|
25
25
|
import Container from "../../../ProForm/components/Container";
|
|
26
26
|
import AdaptiveTooltip from "../AdaptiveTooltip";
|
|
27
|
-
import { getFlatTreeData } from "../../utils";
|
|
27
|
+
import { getFlatTreeData, applyCheckLeaf } from "../../utils";
|
|
28
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
29
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
30
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -73,6 +73,7 @@ export var ProTreeSelect = (props, ref) => {
|
|
|
73
73
|
className = props.className,
|
|
74
74
|
checkStrictly = props.checkStrictly,
|
|
75
75
|
checkable = props.checkable,
|
|
76
|
+
checkLeaf = props.checkLeaf,
|
|
76
77
|
selectProps = _objectWithoutProperties(props, _excluded);
|
|
77
78
|
var _props$value = props.value,
|
|
78
79
|
value = _props$value === void 0 ? undefined : _props$value;
|
|
@@ -159,6 +160,17 @@ export var ProTreeSelect = (props, ref) => {
|
|
|
159
160
|
loop(copyData);
|
|
160
161
|
return copyData;
|
|
161
162
|
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 统一数据后处理:先处理 code-name 展示,再按 checkLeaf 标记非叶子节点禁用
|
|
166
|
+
* 数据已是标准格式(label, value, children)
|
|
167
|
+
* @param dataArr 标准格式数据
|
|
168
|
+
* @returns 后处理结果
|
|
169
|
+
*/
|
|
170
|
+
var processData = dataArr => {
|
|
171
|
+
var result = transferDataSource(dataArr, showCodeName);
|
|
172
|
+
return checkLeaf ? applyCheckLeaf(result) : result;
|
|
173
|
+
};
|
|
162
174
|
var defaultOnSuccessFun = res => {
|
|
163
175
|
var _res$status = res.status,
|
|
164
176
|
status = _res$status === void 0 ? 200 : _res$status,
|
|
@@ -168,9 +180,9 @@ export var ProTreeSelect = (props, ref) => {
|
|
|
168
180
|
_message.error(msg);
|
|
169
181
|
return;
|
|
170
182
|
}
|
|
171
|
-
// 先转换字段名,再处理 code-name
|
|
183
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
172
184
|
var transformedData = transformFieldNames(data || []);
|
|
173
|
-
var resultData =
|
|
185
|
+
var resultData = processData(transformedData);
|
|
174
186
|
setState({
|
|
175
187
|
selectList: resultData || [],
|
|
176
188
|
origDataSource: resultData || []
|
|
@@ -199,9 +211,9 @@ export var ProTreeSelect = (props, ref) => {
|
|
|
199
211
|
onSuccess: data => {
|
|
200
212
|
if (transformResponse && typeof transformResponse === 'function') {
|
|
201
213
|
var responseData = transformResponse(data);
|
|
202
|
-
// 先转换字段名,再处理 code-name
|
|
214
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
203
215
|
var transformedData = transformFieldNames(responseData);
|
|
204
|
-
var resultData =
|
|
216
|
+
var resultData = processData(transformedData);
|
|
205
217
|
setState({
|
|
206
218
|
selectList: countChild(resultData),
|
|
207
219
|
origDataSource: resultData
|
|
@@ -222,9 +234,9 @@ export var ProTreeSelect = (props, ref) => {
|
|
|
222
234
|
if (fetchFunction !== null && fetchFunction !== void 0 && fetchFunction.data, useRequest !== null && useRequest !== void 0 && (_useRequest$options2 = useRequest.options) !== null && _useRequest$options2 !== void 0 && _useRequest$options2.cacheKey) {
|
|
223
235
|
if (transformResponse && typeof transformResponse === 'function') {
|
|
224
236
|
var responseData = transformResponse(fetchFunction.data);
|
|
225
|
-
// 先转换字段名,再处理 code-name
|
|
237
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
226
238
|
var transformedData = transformFieldNames(responseData);
|
|
227
|
-
var resultData =
|
|
239
|
+
var resultData = processData(transformedData);
|
|
228
240
|
setState({
|
|
229
241
|
selectList: countChild(resultData),
|
|
230
242
|
origDataSource: resultData
|
|
@@ -238,18 +250,18 @@ export var ProTreeSelect = (props, ref) => {
|
|
|
238
250
|
useDeepCompareEffect(() => {
|
|
239
251
|
if (enumCode) {
|
|
240
252
|
var dictEnum = dics[enumCode] || [];
|
|
241
|
-
// 先转换字段名,再处理 code-name
|
|
253
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
242
254
|
var transformedData = transformFieldNames(dictEnum);
|
|
243
|
-
var resultData =
|
|
255
|
+
var resultData = processData(transformedData);
|
|
244
256
|
var processedList = countChild(resultData);
|
|
245
257
|
setState({
|
|
246
258
|
selectList: processedList,
|
|
247
259
|
origDataSource: resultData
|
|
248
260
|
});
|
|
249
261
|
} else if (dataSource) {
|
|
250
|
-
// 先转换字段名,再处理 code-name
|
|
262
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
251
263
|
var _transformedData = transformFieldNames(dataSource);
|
|
252
|
-
var _resultData =
|
|
264
|
+
var _resultData = processData(_transformedData);
|
|
253
265
|
var _processedList = countChild(_resultData);
|
|
254
266
|
setState({
|
|
255
267
|
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 是否单行省略
|
|
@@ -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
|
package/es/ProTree/utils.d.ts
CHANGED
|
@@ -41,3 +41,13 @@ export declare function getChildrenKeys(node: ProTreeDataType, childrenKeys: str
|
|
|
41
41
|
* @param allkeys 所有key
|
|
42
42
|
*/
|
|
43
43
|
export declare function getDefaultExpandKeys(isExpand: any, allKeys: any): any;
|
|
44
|
+
/**
|
|
45
|
+
* checkLeaf 模式:只能选择叶子节点,非叶子节点设 disabled=true 整行置灰不可点
|
|
46
|
+
* 数据已是标准格式(label, value, children),仅单选 treeSelect 场景使用
|
|
47
|
+
* 不可变:返回全新数组,不修改入参
|
|
48
|
+
* @param data 标准格式树数据
|
|
49
|
+
* @returns 标记后的新树数据
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyCheckLeaf<T extends {
|
|
52
|
+
children?: T[];
|
|
53
|
+
}>(data: T[]): T[];
|
package/es/ProTree/utils.js
CHANGED
|
@@ -199,4 +199,27 @@ export function getDefaultExpandKeys(isExpand, allKeys) {
|
|
|
199
199
|
return allKeys;
|
|
200
200
|
}
|
|
201
201
|
return [];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* checkLeaf 模式:只能选择叶子节点,非叶子节点设 disabled=true 整行置灰不可点
|
|
206
|
+
* 数据已是标准格式(label, value, children),仅单选 treeSelect 场景使用
|
|
207
|
+
* 不可变:返回全新数组,不修改入参
|
|
208
|
+
* @param data 标准格式树数据
|
|
209
|
+
* @returns 标记后的新树数据
|
|
210
|
+
*/
|
|
211
|
+
export function applyCheckLeaf(data) {
|
|
212
|
+
if (!Array.isArray(data)) {
|
|
213
|
+
return data;
|
|
214
|
+
}
|
|
215
|
+
return data.map(node => {
|
|
216
|
+
var hasChildren = Array.isArray(node.children) && node.children.length > 0;
|
|
217
|
+
if (!hasChildren) {
|
|
218
|
+
return _objectSpread({}, node);
|
|
219
|
+
}
|
|
220
|
+
return _objectSpread(_objectSpread({}, node), {}, {
|
|
221
|
+
disabled: true,
|
|
222
|
+
children: applyCheckLeaf(node.children)
|
|
223
|
+
});
|
|
224
|
+
});
|
|
202
225
|
}
|
|
@@ -140,7 +140,9 @@ var ProTree = props => {
|
|
|
140
140
|
debounceWait: 300
|
|
141
141
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
|
142
142
|
(0, _ahooks.useDeepCompareEffect)(() => {
|
|
143
|
-
|
|
143
|
+
// 显式传入数组(含空数组 [])时都同步到内部 state,
|
|
144
|
+
// 否则删除最后一个节点后 dataSource 变为 [] 时树数据不会被清空。
|
|
145
|
+
if (Array.isArray(dataSource)) {
|
|
144
146
|
var allKey = (0, _utils.getAllKeys)(dataSource, fieldNames);
|
|
145
147
|
setState({
|
|
146
148
|
treeData: dataSource,
|
|
@@ -30,7 +30,7 @@ var _Container = _interopRequireDefault(require("../../../ProForm/components/Con
|
|
|
30
30
|
var _AdaptiveTooltip = _interopRequireDefault(require("../AdaptiveTooltip"));
|
|
31
31
|
var _utils2 = require("../../utils");
|
|
32
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
-
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "placeholder", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"];
|
|
33
|
+
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "placeholder", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable", "checkLeaf"];
|
|
34
34
|
/* eslint-disable react/no-danger */
|
|
35
35
|
/* eslint-disable react/jsx-closing-tag-location */
|
|
36
36
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
@@ -79,6 +79,7 @@ var ProTreeSelect = (props, ref) => {
|
|
|
79
79
|
className = props.className,
|
|
80
80
|
checkStrictly = props.checkStrictly,
|
|
81
81
|
checkable = props.checkable,
|
|
82
|
+
checkLeaf = props.checkLeaf,
|
|
82
83
|
selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
83
84
|
var _props$value = props.value,
|
|
84
85
|
value = _props$value === void 0 ? undefined : _props$value;
|
|
@@ -165,6 +166,17 @@ var ProTreeSelect = (props, ref) => {
|
|
|
165
166
|
loop(copyData);
|
|
166
167
|
return copyData;
|
|
167
168
|
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 统一数据后处理:先处理 code-name 展示,再按 checkLeaf 标记非叶子节点禁用
|
|
172
|
+
* 数据已是标准格式(label, value, children)
|
|
173
|
+
* @param dataArr 标准格式数据
|
|
174
|
+
* @returns 后处理结果
|
|
175
|
+
*/
|
|
176
|
+
var processData = dataArr => {
|
|
177
|
+
var result = transferDataSource(dataArr, showCodeName);
|
|
178
|
+
return checkLeaf ? (0, _utils2.applyCheckLeaf)(result) : result;
|
|
179
|
+
};
|
|
168
180
|
var defaultOnSuccessFun = res => {
|
|
169
181
|
var _res$status = res.status,
|
|
170
182
|
status = _res$status === void 0 ? 200 : _res$status,
|
|
@@ -174,9 +186,9 @@ var ProTreeSelect = (props, ref) => {
|
|
|
174
186
|
_message2.default.error(msg);
|
|
175
187
|
return;
|
|
176
188
|
}
|
|
177
|
-
// 先转换字段名,再处理 code-name
|
|
189
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
178
190
|
var transformedData = transformFieldNames(data || []);
|
|
179
|
-
var resultData =
|
|
191
|
+
var resultData = processData(transformedData);
|
|
180
192
|
setState({
|
|
181
193
|
selectList: resultData || [],
|
|
182
194
|
origDataSource: resultData || []
|
|
@@ -205,9 +217,9 @@ var ProTreeSelect = (props, ref) => {
|
|
|
205
217
|
onSuccess: data => {
|
|
206
218
|
if (transformResponse && typeof transformResponse === 'function') {
|
|
207
219
|
var responseData = transformResponse(data);
|
|
208
|
-
// 先转换字段名,再处理 code-name
|
|
220
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
209
221
|
var transformedData = transformFieldNames(responseData);
|
|
210
|
-
var resultData =
|
|
222
|
+
var resultData = processData(transformedData);
|
|
211
223
|
setState({
|
|
212
224
|
selectList: countChild(resultData),
|
|
213
225
|
origDataSource: resultData
|
|
@@ -228,9 +240,9 @@ var ProTreeSelect = (props, ref) => {
|
|
|
228
240
|
if (fetchFunction !== null && fetchFunction !== void 0 && fetchFunction.data, useRequest !== null && useRequest !== void 0 && (_useRequest$options2 = useRequest.options) !== null && _useRequest$options2 !== void 0 && _useRequest$options2.cacheKey) {
|
|
229
241
|
if (transformResponse && typeof transformResponse === 'function') {
|
|
230
242
|
var responseData = transformResponse(fetchFunction.data);
|
|
231
|
-
// 先转换字段名,再处理 code-name
|
|
243
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
232
244
|
var transformedData = transformFieldNames(responseData);
|
|
233
|
-
var resultData =
|
|
245
|
+
var resultData = processData(transformedData);
|
|
234
246
|
setState({
|
|
235
247
|
selectList: countChild(resultData),
|
|
236
248
|
origDataSource: resultData
|
|
@@ -244,18 +256,18 @@ var ProTreeSelect = (props, ref) => {
|
|
|
244
256
|
(0, _ahooks.useDeepCompareEffect)(() => {
|
|
245
257
|
if (enumCode) {
|
|
246
258
|
var dictEnum = dics[enumCode] || [];
|
|
247
|
-
// 先转换字段名,再处理 code-name
|
|
259
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
248
260
|
var transformedData = transformFieldNames(dictEnum);
|
|
249
|
-
var resultData =
|
|
261
|
+
var resultData = processData(transformedData);
|
|
250
262
|
var processedList = countChild(resultData);
|
|
251
263
|
setState({
|
|
252
264
|
selectList: processedList,
|
|
253
265
|
origDataSource: resultData
|
|
254
266
|
});
|
|
255
267
|
} else if (dataSource) {
|
|
256
|
-
// 先转换字段名,再处理 code-name
|
|
268
|
+
// 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
|
|
257
269
|
var _transformedData = transformFieldNames(dataSource);
|
|
258
|
-
var _resultData =
|
|
270
|
+
var _resultData = processData(_transformedData);
|
|
259
271
|
var _processedList = countChild(_resultData);
|
|
260
272
|
setState({
|
|
261
273
|
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 是否单行省略
|
|
@@ -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
|
package/lib/ProTree/utils.d.ts
CHANGED
|
@@ -41,3 +41,13 @@ export declare function getChildrenKeys(node: ProTreeDataType, childrenKeys: str
|
|
|
41
41
|
* @param allkeys 所有key
|
|
42
42
|
*/
|
|
43
43
|
export declare function getDefaultExpandKeys(isExpand: any, allKeys: any): any;
|
|
44
|
+
/**
|
|
45
|
+
* checkLeaf 模式:只能选择叶子节点,非叶子节点设 disabled=true 整行置灰不可点
|
|
46
|
+
* 数据已是标准格式(label, value, children),仅单选 treeSelect 场景使用
|
|
47
|
+
* 不可变:返回全新数组,不修改入参
|
|
48
|
+
* @param data 标准格式树数据
|
|
49
|
+
* @returns 标记后的新树数据
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyCheckLeaf<T extends {
|
|
52
|
+
children?: T[];
|
|
53
|
+
}>(data: T[]): T[];
|
package/lib/ProTree/utils.js
CHANGED
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.applyCheckLeaf = applyCheckLeaf;
|
|
7
8
|
exports.filterCheckedNodes = filterCheckedNodes;
|
|
8
9
|
exports.findTreeNodeByKey = findTreeNodeByKey;
|
|
9
10
|
exports.getAllKeys = getAllKeys;
|
|
@@ -213,4 +214,27 @@ function getDefaultExpandKeys(isExpand, allKeys) {
|
|
|
213
214
|
return allKeys;
|
|
214
215
|
}
|
|
215
216
|
return [];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* checkLeaf 模式:只能选择叶子节点,非叶子节点设 disabled=true 整行置灰不可点
|
|
221
|
+
* 数据已是标准格式(label, value, children),仅单选 treeSelect 场景使用
|
|
222
|
+
* 不可变:返回全新数组,不修改入参
|
|
223
|
+
* @param data 标准格式树数据
|
|
224
|
+
* @returns 标记后的新树数据
|
|
225
|
+
*/
|
|
226
|
+
function applyCheckLeaf(data) {
|
|
227
|
+
if (!Array.isArray(data)) {
|
|
228
|
+
return data;
|
|
229
|
+
}
|
|
230
|
+
return data.map(node => {
|
|
231
|
+
var hasChildren = Array.isArray(node.children) && node.children.length > 0;
|
|
232
|
+
if (!hasChildren) {
|
|
233
|
+
return (0, _objectSpread2.default)({}, node);
|
|
234
|
+
}
|
|
235
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, node), {}, {
|
|
236
|
+
disabled: true,
|
|
237
|
+
children: applyCheckLeaf(node.children)
|
|
238
|
+
});
|
|
239
|
+
});
|
|
216
240
|
}
|
package/package.json
CHANGED
package/.gitnexus/lbug
DELETED
|
Binary file
|
package/.gitnexus/meta.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"repoPath": "/Users/zakj/site/work/xk-基线/xk-sisyphus-web",
|
|
3
|
-
"lastCommit": "5ab31e4d45abcc5c0646c554d6e8e44e53df7c9d",
|
|
4
|
-
"indexedAt": "2026-05-11T09:33:46.340Z",
|
|
5
|
-
"remoteUrl": "https://xk-wanchongyang:aaabbb111@git.zhonganinfo.com/zaxk/xk-sisyphus-web",
|
|
6
|
-
"stats": {
|
|
7
|
-
"files": 870,
|
|
8
|
-
"nodes": 9247,
|
|
9
|
-
"edges": 13683,
|
|
10
|
-
"communities": 235,
|
|
11
|
-
"processes": 266,
|
|
12
|
-
"embeddings": 0
|
|
13
|
-
}
|
|
14
|
-
}
|