@weitutech/by-components 1.2.1 → 1.2.3
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/lib/by-components.common.js +375 -276
- package/lib/by-components.umd.js +375 -276
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
package/lib/by-components.umd.js
CHANGED
|
@@ -96025,8 +96025,8 @@ var ByCascaderPanel_component = normalizeComponent(
|
|
|
96025
96025
|
)
|
|
96026
96026
|
|
|
96027
96027
|
/* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
|
|
96028
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"8cd600e8-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/cascader-panel-pro/ByCascaderPanelPro.vue?vue&type=template&id=
|
|
96029
|
-
var
|
|
96028
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"8cd600e8-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/cascader-panel-pro/ByCascaderPanelPro.vue?vue&type=template&id=075d43fb
|
|
96029
|
+
var ByCascaderPanelProvue_type_template_id_075d43fb_render = function render() {
|
|
96030
96030
|
var _vm = this,
|
|
96031
96031
|
_c = _vm._self._c;
|
|
96032
96032
|
return _c('div', {
|
|
@@ -96268,8 +96268,215 @@ var ByCascaderPanelProvue_type_template_id_804df886_render = function render() {
|
|
|
96268
96268
|
staticClass: "empty-state"
|
|
96269
96269
|
}, [_vm._v("暂无选中项")])], 1)])])])]);
|
|
96270
96270
|
};
|
|
96271
|
-
var
|
|
96271
|
+
var ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns = [];
|
|
96272
96272
|
|
|
96273
|
+
;// ./src/components/cascader-panel-pro/cascaderStorePro.js
|
|
96274
|
+
|
|
96275
|
+
|
|
96276
|
+
|
|
96277
|
+
|
|
96278
|
+
|
|
96279
|
+
|
|
96280
|
+
/**
|
|
96281
|
+
* 级联树扁平化存储,初始化时预计算子树叶子元数据,供 O(1) 级勾选/聚合
|
|
96282
|
+
*/
|
|
96283
|
+
|
|
96284
|
+
let nodeIdSeed = 0;
|
|
96285
|
+
function nextId() {
|
|
96286
|
+
nodeIdSeed += 1;
|
|
96287
|
+
return nodeIdSeed;
|
|
96288
|
+
}
|
|
96289
|
+
function resetCascaderStoreIdSeed() {
|
|
96290
|
+
nodeIdSeed = 0;
|
|
96291
|
+
}
|
|
96292
|
+
|
|
96293
|
+
/**
|
|
96294
|
+
* @param {Array} options
|
|
96295
|
+
* @param {Object} config - disabledField/disabledValue/disabledCheck
|
|
96296
|
+
* @param {Object} cascaderProps
|
|
96297
|
+
* @param {Object} utils - CascaderUtilsPro
|
|
96298
|
+
*/
|
|
96299
|
+
function buildCascaderStore(options, config, cascaderProps, utils) {
|
|
96300
|
+
resetCascaderStoreIdSeed();
|
|
96301
|
+
const valueKey = cascaderProps.value || 'value';
|
|
96302
|
+
const labelKey = cascaderProps.label || 'label';
|
|
96303
|
+
const childrenKey = cascaderProps.children || 'children';
|
|
96304
|
+
const disabledKey = cascaderProps.disabled || 'disabled';
|
|
96305
|
+
const nodes = [];
|
|
96306
|
+
const nodeById = new Map();
|
|
96307
|
+
const nodeByValue = new Map();
|
|
96308
|
+
const childrenByParentId = new Map();
|
|
96309
|
+
const rootIds = [];
|
|
96310
|
+
const pathByLeafValue = new Map();
|
|
96311
|
+
const allLeafValues = [];
|
|
96312
|
+
const allLeafPaths = [];
|
|
96313
|
+
const createNode = (raw, parentPath, level, parentId) => {
|
|
96314
|
+
const value = raw[valueKey];
|
|
96315
|
+
const children = raw[childrenKey];
|
|
96316
|
+
const hasChildren = Array.isArray(children) && children.length > 0;
|
|
96317
|
+
const id = nextId();
|
|
96318
|
+
const nodePath = parentId == null ? [value] : parentPath.concat(value);
|
|
96319
|
+
const node = {
|
|
96320
|
+
id,
|
|
96321
|
+
value,
|
|
96322
|
+
label: raw[labelKey],
|
|
96323
|
+
path: nodePath,
|
|
96324
|
+
level,
|
|
96325
|
+
parentId,
|
|
96326
|
+
childIds: [],
|
|
96327
|
+
isLeaf: !hasChildren,
|
|
96328
|
+
disabled: !!raw[disabledKey],
|
|
96329
|
+
raw,
|
|
96330
|
+
descendantLeafValues: [],
|
|
96331
|
+
descendantLeafCount: 0,
|
|
96332
|
+
descendantPaths: []
|
|
96333
|
+
};
|
|
96334
|
+
nodes.push(node);
|
|
96335
|
+
nodeById.set(id, node);
|
|
96336
|
+
if (!nodeByValue.has(value)) {
|
|
96337
|
+
nodeByValue.set(value, node);
|
|
96338
|
+
}
|
|
96339
|
+
if (parentId == null) {
|
|
96340
|
+
rootIds.push(id);
|
|
96341
|
+
} else {
|
|
96342
|
+
const siblings = childrenByParentId.get(parentId) || [];
|
|
96343
|
+
siblings.push(id);
|
|
96344
|
+
childrenByParentId.set(parentId, siblings);
|
|
96345
|
+
const parent = nodeById.get(parentId);
|
|
96346
|
+
if (parent) {
|
|
96347
|
+
parent.childIds.push(id);
|
|
96348
|
+
}
|
|
96349
|
+
}
|
|
96350
|
+
if (hasChildren) {
|
|
96351
|
+
children.forEach(child => {
|
|
96352
|
+
createNode(child, nodePath, level + 1, id);
|
|
96353
|
+
});
|
|
96354
|
+
} else {
|
|
96355
|
+
pathByLeafValue.set(value, nodePath);
|
|
96356
|
+
if (!node.disabled) {
|
|
96357
|
+
allLeafValues.push(value);
|
|
96358
|
+
allLeafPaths.push(nodePath);
|
|
96359
|
+
}
|
|
96360
|
+
}
|
|
96361
|
+
return node;
|
|
96362
|
+
};
|
|
96363
|
+
const walkRoots = (items, ancestorDisabled = false) => {
|
|
96364
|
+
items.forEach(item => {
|
|
96365
|
+
const isDisabled = ancestorDisabled || utils.isItemDisabled(item, config);
|
|
96366
|
+
const cloned = {
|
|
96367
|
+
...item
|
|
96368
|
+
};
|
|
96369
|
+
if (isDisabled) {
|
|
96370
|
+
cloned[disabledKey] = true;
|
|
96371
|
+
}
|
|
96372
|
+
createNode(cloned, [], 0, null);
|
|
96373
|
+
});
|
|
96374
|
+
};
|
|
96375
|
+
walkRoots(options || []);
|
|
96376
|
+
|
|
96377
|
+
// 自底向上汇总子树叶子
|
|
96378
|
+
const sorted = nodes.slice().sort((a, b) => b.level - a.level);
|
|
96379
|
+
sorted.forEach(node => {
|
|
96380
|
+
if (node.isLeaf) {
|
|
96381
|
+
node.descendantLeafValues = [node.value];
|
|
96382
|
+
node.descendantLeafCount = 1;
|
|
96383
|
+
node.descendantPaths = [node.path];
|
|
96384
|
+
return;
|
|
96385
|
+
}
|
|
96386
|
+
const leafValues = [];
|
|
96387
|
+
const leafPaths = [];
|
|
96388
|
+
node.childIds.forEach(childId => {
|
|
96389
|
+
const child = nodeById.get(childId);
|
|
96390
|
+
if (!child || child.descendantLeafCount === 0) {
|
|
96391
|
+
return;
|
|
96392
|
+
}
|
|
96393
|
+
leafValues.push(...child.descendantLeafValues);
|
|
96394
|
+
leafPaths.push(...child.descendantPaths);
|
|
96395
|
+
});
|
|
96396
|
+
node.descendantLeafValues = leafValues;
|
|
96397
|
+
node.descendantLeafCount = leafValues.length;
|
|
96398
|
+
node.descendantPaths = leafPaths;
|
|
96399
|
+
});
|
|
96400
|
+
return {
|
|
96401
|
+
nodes,
|
|
96402
|
+
nodeById,
|
|
96403
|
+
nodeByValue,
|
|
96404
|
+
childrenByParentId,
|
|
96405
|
+
rootIds,
|
|
96406
|
+
pathByLeafValue,
|
|
96407
|
+
allLeafValues,
|
|
96408
|
+
allLeafPaths,
|
|
96409
|
+
totalLeafCount: allLeafPaths.length
|
|
96410
|
+
};
|
|
96411
|
+
}
|
|
96412
|
+
function getStoreChildren(store, parentId) {
|
|
96413
|
+
if (parentId == null) {
|
|
96414
|
+
return store.rootIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
96415
|
+
}
|
|
96416
|
+
const childIds = store.childrenByParentId.get(parentId) || [];
|
|
96417
|
+
return childIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
96418
|
+
}
|
|
96419
|
+
function resolveStoreNodeByValue(store, value) {
|
|
96420
|
+
if (!store || value == null || value === '') {
|
|
96421
|
+
return null;
|
|
96422
|
+
}
|
|
96423
|
+
if (store.nodeByValue.has(value)) {
|
|
96424
|
+
return store.nodeByValue.get(value);
|
|
96425
|
+
}
|
|
96426
|
+
const num = Number(value);
|
|
96427
|
+
if (!Number.isNaN(num) && store.nodeByValue.has(num)) {
|
|
96428
|
+
return store.nodeByValue.get(num);
|
|
96429
|
+
}
|
|
96430
|
+
const str = String(value);
|
|
96431
|
+
if (str !== value && store.nodeByValue.has(str)) {
|
|
96432
|
+
return store.nodeByValue.get(str);
|
|
96433
|
+
}
|
|
96434
|
+
for (const [key, node] of store.nodeByValue) {
|
|
96435
|
+
if (key == value) {
|
|
96436
|
+
return node;
|
|
96437
|
+
}
|
|
96438
|
+
}
|
|
96439
|
+
return null;
|
|
96440
|
+
}
|
|
96441
|
+
function getStoreLeafPath(store, leafValue) {
|
|
96442
|
+
if (!store || leafValue == null || leafValue === '') {
|
|
96443
|
+
return null;
|
|
96444
|
+
}
|
|
96445
|
+
if (store.pathByLeafValue.has(leafValue)) {
|
|
96446
|
+
return store.pathByLeafValue.get(leafValue);
|
|
96447
|
+
}
|
|
96448
|
+
const node = resolveStoreNodeByValue(store, leafValue);
|
|
96449
|
+
if (node && node.isLeaf) {
|
|
96450
|
+
return node.path;
|
|
96451
|
+
}
|
|
96452
|
+
for (const [key, path] of store.pathByLeafValue) {
|
|
96453
|
+
if (key == leafValue) {
|
|
96454
|
+
return path;
|
|
96455
|
+
}
|
|
96456
|
+
}
|
|
96457
|
+
return null;
|
|
96458
|
+
}
|
|
96459
|
+
function storeHasLeafValue(store, leafValue) {
|
|
96460
|
+
return getStoreLeafPath(store, leafValue) != null;
|
|
96461
|
+
}
|
|
96462
|
+
function findStoreNodeByPath(store, pathValues) {
|
|
96463
|
+
if (!pathValues || pathValues.length === 0) {
|
|
96464
|
+
return null;
|
|
96465
|
+
}
|
|
96466
|
+
let node = resolveStoreNodeByValue(store, pathValues[0]);
|
|
96467
|
+
if (!node || pathValues.length === 1) {
|
|
96468
|
+
return node;
|
|
96469
|
+
}
|
|
96470
|
+
for (let i = 1; i < pathValues.length; i++) {
|
|
96471
|
+
const target = pathValues[i];
|
|
96472
|
+
const children = getStoreChildren(store, node.id);
|
|
96473
|
+
node = children.find(child => child.value == target) || null;
|
|
96474
|
+
if (!node) {
|
|
96475
|
+
return null;
|
|
96476
|
+
}
|
|
96477
|
+
}
|
|
96478
|
+
return node;
|
|
96479
|
+
}
|
|
96273
96480
|
;// ./src/components/cascader-panel-pro/cascaderUtilsPro.js
|
|
96274
96481
|
|
|
96275
96482
|
|
|
@@ -96289,7 +96496,46 @@ var ByCascaderPanelProvue_type_template_id_804df886_staticRenderFns = [];
|
|
|
96289
96496
|
/**
|
|
96290
96497
|
* 级联选择器工具类(Pro 版,独立于 CascaderUtils)
|
|
96291
96498
|
*/
|
|
96499
|
+
|
|
96292
96500
|
class CascaderUtilsPro {
|
|
96501
|
+
static isTreeLeafNode(node, cascaderProps) {
|
|
96502
|
+
const childrenKey = cascaderProps && cascaderProps.children || 'children';
|
|
96503
|
+
const children = node[childrenKey];
|
|
96504
|
+
return !Array.isArray(children) || children.length === 0;
|
|
96505
|
+
}
|
|
96506
|
+
|
|
96507
|
+
/**
|
|
96508
|
+
* 将单个外部 value(含 __parent__ 前缀)同步到面板 selection
|
|
96509
|
+
*/
|
|
96510
|
+
static addValueToSelection(store, selection, value, options, cascaderProps, prefix = '__parent__') {
|
|
96511
|
+
if (!store || !selection || value == null || value === '') {
|
|
96512
|
+
return;
|
|
96513
|
+
}
|
|
96514
|
+
const isParent = this.isParentNodeValue(value, prefix);
|
|
96515
|
+
const actualValue = isParent ? this.extractParentNodeValue(value, prefix) : value;
|
|
96516
|
+
const node = resolveStoreNodeByValue(store, actualValue);
|
|
96517
|
+
if (node) {
|
|
96518
|
+
if (node.isLeaf) {
|
|
96519
|
+
selection.selectedLeafSet.add(node.value);
|
|
96520
|
+
} else {
|
|
96521
|
+
node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
|
|
96522
|
+
}
|
|
96523
|
+
return;
|
|
96524
|
+
}
|
|
96525
|
+
let paths = isParent ? this.getLeafPathsByParentValue(actualValue, options, cascaderProps) : this.findPathsByValues([actualValue], options, cascaderProps);
|
|
96526
|
+
if (paths.length === 0 && !isParent) {
|
|
96527
|
+
paths = this.getLeafPathsByParentValue(actualValue, options, cascaderProps);
|
|
96528
|
+
}
|
|
96529
|
+
paths.forEach(path => {
|
|
96530
|
+
const leafValue = path[path.length - 1];
|
|
96531
|
+
const leafPath = getStoreLeafPath(store, leafValue);
|
|
96532
|
+
if (leafPath) {
|
|
96533
|
+
selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
96534
|
+
} else {
|
|
96535
|
+
selection.selectedLeafSet.add(leafValue);
|
|
96536
|
+
}
|
|
96537
|
+
});
|
|
96538
|
+
}
|
|
96293
96539
|
/**
|
|
96294
96540
|
* 估算级联节点标签文本宽度(px)
|
|
96295
96541
|
*/
|
|
@@ -96552,16 +96798,13 @@ class CascaderUtilsPro {
|
|
|
96552
96798
|
|
|
96553
96799
|
// 检查当前节点是否禁用
|
|
96554
96800
|
const isCurrentDisabled = this.isItemDisabled(node, config);
|
|
96555
|
-
if (
|
|
96801
|
+
if (this.isTreeLeafNode(node, cascaderProps)) {
|
|
96556
96802
|
// 只包含非禁用项且路径上没有禁选项的叶子节点
|
|
96557
96803
|
if (!isCurrentDisabled && !this.isPathDisabled(tree, newPath, config, cascaderProps)) {
|
|
96558
96804
|
paths.push(newPath);
|
|
96559
96805
|
}
|
|
96560
|
-
} else {
|
|
96561
|
-
|
|
96562
|
-
if (!isCurrentDisabled) {
|
|
96563
|
-
traverse(node[cascaderProps.children], newPath);
|
|
96564
|
-
}
|
|
96806
|
+
} else if (!isCurrentDisabled) {
|
|
96807
|
+
traverse(node[cascaderProps.children], newPath);
|
|
96565
96808
|
}
|
|
96566
96809
|
});
|
|
96567
96810
|
};
|
|
@@ -96631,14 +96874,14 @@ class CascaderUtilsPro {
|
|
|
96631
96874
|
}
|
|
96632
96875
|
const items = [];
|
|
96633
96876
|
selection.selectedLeafSet.forEach(leafValue => {
|
|
96634
|
-
const path = store
|
|
96635
|
-
const node = store
|
|
96877
|
+
const path = getStoreLeafPath(store, leafValue);
|
|
96878
|
+
const node = resolveStoreNodeByValue(store, leafValue);
|
|
96636
96879
|
if (!path || !node) {
|
|
96637
96880
|
return;
|
|
96638
96881
|
}
|
|
96639
96882
|
items.push({
|
|
96640
96883
|
...node.raw,
|
|
96641
|
-
value:
|
|
96884
|
+
value: node.value,
|
|
96642
96885
|
label: node.label,
|
|
96643
96886
|
path
|
|
96644
96887
|
});
|
|
@@ -96762,7 +97005,7 @@ class CascaderUtilsPro {
|
|
|
96762
97005
|
const items = [];
|
|
96763
97006
|
const walk = nodeId => {
|
|
96764
97007
|
const node = store.nodeById.get(nodeId);
|
|
96765
|
-
if (!node
|
|
97008
|
+
if (!node) {
|
|
96766
97009
|
return;
|
|
96767
97010
|
}
|
|
96768
97011
|
const state = selection.getCheckState(nodeId);
|
|
@@ -96951,12 +97194,14 @@ class CascaderUtilsPro {
|
|
|
96951
97194
|
for (const node of nodes) {
|
|
96952
97195
|
const newPath = [...currentPath, node[cascaderProps.value]];
|
|
96953
97196
|
if (node[cascaderProps.value] == parentValue) {
|
|
96954
|
-
|
|
96955
|
-
|
|
96956
|
-
|
|
96957
|
-
|
|
96958
|
-
|
|
96959
|
-
|
|
97197
|
+
if (this.isTreeLeafNode(node, cascaderProps)) {
|
|
97198
|
+
paths.push(newPath);
|
|
97199
|
+
} else {
|
|
97200
|
+
this.getAllLeafPaths([node], {}, cascaderProps).forEach(leafPath => {
|
|
97201
|
+
const fullPath = [...currentPath, ...leafPath];
|
|
97202
|
+
paths.push(fullPath);
|
|
97203
|
+
});
|
|
97204
|
+
}
|
|
96960
97205
|
return true;
|
|
96961
97206
|
}
|
|
96962
97207
|
|
|
@@ -96990,8 +97235,10 @@ class CascaderUtilsPro {
|
|
|
96990
97235
|
const leafPaths = this.getLeafPathsByParentValue(actualValue, options, cascaderProps);
|
|
96991
97236
|
paths.push(...leafPaths);
|
|
96992
97237
|
} else {
|
|
96993
|
-
|
|
96994
|
-
|
|
97238
|
+
let valuePaths = this.findPathsByValues([value], options, cascaderProps);
|
|
97239
|
+
if (valuePaths.length === 0) {
|
|
97240
|
+
valuePaths = this.getLeafPathsByParentValue(value, options, cascaderProps);
|
|
97241
|
+
}
|
|
96995
97242
|
paths.push(...valuePaths);
|
|
96996
97243
|
}
|
|
96997
97244
|
}
|
|
@@ -97010,15 +97257,10 @@ class CascaderUtilsPro {
|
|
|
97010
97257
|
const findPath = (nodes, targetValues, currentPath = []) => {
|
|
97011
97258
|
for (const option of nodes) {
|
|
97012
97259
|
const newPath = [...currentPath, option[cascaderProps.value]];
|
|
97013
|
-
if (targetValues.
|
|
97014
|
-
|
|
97015
|
-
if (!option[cascaderProps.children]) {
|
|
97016
|
-
paths.push(newPath);
|
|
97017
|
-
}
|
|
97260
|
+
if (targetValues.some(target => target == option[cascaderProps.value]) && this.isTreeLeafNode(option, cascaderProps)) {
|
|
97261
|
+
paths.push(newPath);
|
|
97018
97262
|
}
|
|
97019
|
-
|
|
97020
|
-
// 递归查找子节点
|
|
97021
|
-
if (option[cascaderProps.children] && option[cascaderProps.children].length > 0) {
|
|
97263
|
+
if (!this.isTreeLeafNode(option, cascaderProps)) {
|
|
97022
97264
|
findPath(option[cascaderProps.children], targetValues, newPath);
|
|
97023
97265
|
}
|
|
97024
97266
|
}
|
|
@@ -97275,170 +97517,6 @@ var VirtualList_component = normalizeComponent(
|
|
|
97275
97517
|
)
|
|
97276
97518
|
|
|
97277
97519
|
/* harmony default export */ var VirtualList = (VirtualList_component.exports);
|
|
97278
|
-
;// ./src/components/cascader-panel-pro/cascaderStorePro.js
|
|
97279
|
-
|
|
97280
|
-
|
|
97281
|
-
|
|
97282
|
-
|
|
97283
|
-
|
|
97284
|
-
|
|
97285
|
-
/**
|
|
97286
|
-
* 级联树扁平化存储,初始化时预计算子树叶子元数据,供 O(1) 级勾选/聚合
|
|
97287
|
-
*/
|
|
97288
|
-
|
|
97289
|
-
let nodeIdSeed = 0;
|
|
97290
|
-
function nextId() {
|
|
97291
|
-
nodeIdSeed += 1;
|
|
97292
|
-
return nodeIdSeed;
|
|
97293
|
-
}
|
|
97294
|
-
function resetCascaderStoreIdSeed() {
|
|
97295
|
-
nodeIdSeed = 0;
|
|
97296
|
-
}
|
|
97297
|
-
|
|
97298
|
-
/**
|
|
97299
|
-
* @param {Array} options
|
|
97300
|
-
* @param {Object} config - disabledField/disabledValue/disabledCheck
|
|
97301
|
-
* @param {Object} cascaderProps
|
|
97302
|
-
* @param {Object} utils - CascaderUtilsPro
|
|
97303
|
-
*/
|
|
97304
|
-
function buildCascaderStore(options, config, cascaderProps, utils) {
|
|
97305
|
-
resetCascaderStoreIdSeed();
|
|
97306
|
-
const valueKey = cascaderProps.value || 'value';
|
|
97307
|
-
const labelKey = cascaderProps.label || 'label';
|
|
97308
|
-
const childrenKey = cascaderProps.children || 'children';
|
|
97309
|
-
const disabledKey = cascaderProps.disabled || 'disabled';
|
|
97310
|
-
const nodes = [];
|
|
97311
|
-
const nodeById = new Map();
|
|
97312
|
-
const nodeByValue = new Map();
|
|
97313
|
-
const childrenByParentId = new Map();
|
|
97314
|
-
const rootIds = [];
|
|
97315
|
-
const pathByLeafValue = new Map();
|
|
97316
|
-
const allLeafValues = [];
|
|
97317
|
-
const allLeafPaths = [];
|
|
97318
|
-
const createNode = (raw, parentPath, level, parentId) => {
|
|
97319
|
-
const value = raw[valueKey];
|
|
97320
|
-
const children = raw[childrenKey];
|
|
97321
|
-
const hasChildren = Array.isArray(children) && children.length > 0;
|
|
97322
|
-
const id = nextId();
|
|
97323
|
-
const nodePath = parentId == null ? [value] : parentPath.concat(value);
|
|
97324
|
-
const node = {
|
|
97325
|
-
id,
|
|
97326
|
-
value,
|
|
97327
|
-
label: raw[labelKey],
|
|
97328
|
-
path: nodePath,
|
|
97329
|
-
level,
|
|
97330
|
-
parentId,
|
|
97331
|
-
childIds: [],
|
|
97332
|
-
isLeaf: !hasChildren,
|
|
97333
|
-
disabled: !!raw[disabledKey],
|
|
97334
|
-
raw,
|
|
97335
|
-
descendantLeafValues: [],
|
|
97336
|
-
descendantLeafCount: 0,
|
|
97337
|
-
descendantPaths: []
|
|
97338
|
-
};
|
|
97339
|
-
nodes.push(node);
|
|
97340
|
-
nodeById.set(id, node);
|
|
97341
|
-
if (!nodeByValue.has(value)) {
|
|
97342
|
-
nodeByValue.set(value, node);
|
|
97343
|
-
}
|
|
97344
|
-
if (parentId == null) {
|
|
97345
|
-
rootIds.push(id);
|
|
97346
|
-
} else {
|
|
97347
|
-
const siblings = childrenByParentId.get(parentId) || [];
|
|
97348
|
-
siblings.push(id);
|
|
97349
|
-
childrenByParentId.set(parentId, siblings);
|
|
97350
|
-
const parent = nodeById.get(parentId);
|
|
97351
|
-
if (parent) {
|
|
97352
|
-
parent.childIds.push(id);
|
|
97353
|
-
}
|
|
97354
|
-
}
|
|
97355
|
-
if (hasChildren) {
|
|
97356
|
-
children.forEach(child => {
|
|
97357
|
-
createNode(child, nodePath, level + 1, id);
|
|
97358
|
-
});
|
|
97359
|
-
} else if (!node.disabled) {
|
|
97360
|
-
pathByLeafValue.set(value, nodePath);
|
|
97361
|
-
allLeafValues.push(value);
|
|
97362
|
-
allLeafPaths.push(nodePath);
|
|
97363
|
-
}
|
|
97364
|
-
return node;
|
|
97365
|
-
};
|
|
97366
|
-
const walkRoots = (items, ancestorDisabled = false) => {
|
|
97367
|
-
items.forEach(item => {
|
|
97368
|
-
const isDisabled = ancestorDisabled || utils.isItemDisabled(item, config);
|
|
97369
|
-
const cloned = {
|
|
97370
|
-
...item
|
|
97371
|
-
};
|
|
97372
|
-
if (isDisabled) {
|
|
97373
|
-
cloned[disabledKey] = true;
|
|
97374
|
-
}
|
|
97375
|
-
createNode(cloned, [], 0, null);
|
|
97376
|
-
});
|
|
97377
|
-
};
|
|
97378
|
-
walkRoots(options || []);
|
|
97379
|
-
|
|
97380
|
-
// 自底向上汇总子树叶子
|
|
97381
|
-
const sorted = nodes.slice().sort((a, b) => b.level - a.level);
|
|
97382
|
-
sorted.forEach(node => {
|
|
97383
|
-
if (node.isLeaf) {
|
|
97384
|
-
if (!node.disabled) {
|
|
97385
|
-
node.descendantLeafValues = [node.value];
|
|
97386
|
-
node.descendantLeafCount = 1;
|
|
97387
|
-
node.descendantPaths = [node.path];
|
|
97388
|
-
}
|
|
97389
|
-
return;
|
|
97390
|
-
}
|
|
97391
|
-
const leafValues = [];
|
|
97392
|
-
const leafPaths = [];
|
|
97393
|
-
node.childIds.forEach(childId => {
|
|
97394
|
-
const child = nodeById.get(childId);
|
|
97395
|
-
if (!child || child.descendantLeafCount === 0) {
|
|
97396
|
-
return;
|
|
97397
|
-
}
|
|
97398
|
-
leafValues.push(...child.descendantLeafValues);
|
|
97399
|
-
leafPaths.push(...child.descendantPaths);
|
|
97400
|
-
});
|
|
97401
|
-
node.descendantLeafValues = leafValues;
|
|
97402
|
-
node.descendantLeafCount = leafValues.length;
|
|
97403
|
-
node.descendantPaths = leafPaths;
|
|
97404
|
-
});
|
|
97405
|
-
return {
|
|
97406
|
-
nodes,
|
|
97407
|
-
nodeById,
|
|
97408
|
-
nodeByValue,
|
|
97409
|
-
childrenByParentId,
|
|
97410
|
-
rootIds,
|
|
97411
|
-
pathByLeafValue,
|
|
97412
|
-
allLeafValues,
|
|
97413
|
-
allLeafPaths,
|
|
97414
|
-
totalLeafCount: allLeafPaths.length
|
|
97415
|
-
};
|
|
97416
|
-
}
|
|
97417
|
-
function getStoreChildren(store, parentId) {
|
|
97418
|
-
if (parentId == null) {
|
|
97419
|
-
return store.rootIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
97420
|
-
}
|
|
97421
|
-
const childIds = store.childrenByParentId.get(parentId) || [];
|
|
97422
|
-
return childIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
97423
|
-
}
|
|
97424
|
-
function findStoreNodeByPath(store, pathValues) {
|
|
97425
|
-
if (!pathValues || pathValues.length === 0) {
|
|
97426
|
-
return null;
|
|
97427
|
-
}
|
|
97428
|
-
let node = store.nodeByValue.get(pathValues[0]);
|
|
97429
|
-
if (!node || pathValues.length === 1) {
|
|
97430
|
-
return node;
|
|
97431
|
-
}
|
|
97432
|
-
for (let i = 1; i < pathValues.length; i++) {
|
|
97433
|
-
const target = pathValues[i];
|
|
97434
|
-
const children = getStoreChildren(store, node.id);
|
|
97435
|
-
node = children.find(child => child.value == target) || null;
|
|
97436
|
-
if (!node) {
|
|
97437
|
-
return null;
|
|
97438
|
-
}
|
|
97439
|
-
}
|
|
97440
|
-
return node;
|
|
97441
|
-
}
|
|
97442
97520
|
;// ./src/components/cascader-panel-pro/selectionStatePro.js
|
|
97443
97521
|
|
|
97444
97522
|
|
|
@@ -97450,6 +97528,7 @@ function findStoreNodeByPath(store, pathValues) {
|
|
|
97450
97528
|
|
|
97451
97529
|
|
|
97452
97530
|
|
|
97531
|
+
|
|
97453
97532
|
const COMPACT_EMIT_THRESHOLD = 300;
|
|
97454
97533
|
|
|
97455
97534
|
class SelectionStatePro {
|
|
@@ -97614,32 +97693,40 @@ class SelectionStatePro {
|
|
|
97614
97693
|
return;
|
|
97615
97694
|
}
|
|
97616
97695
|
const leafValue = path[path.length - 1];
|
|
97617
|
-
|
|
97618
|
-
|
|
97696
|
+
const leafPath = getStoreLeafPath(this.store, leafValue);
|
|
97697
|
+
if (leafPath) {
|
|
97698
|
+
this.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
97619
97699
|
}
|
|
97620
97700
|
});
|
|
97621
97701
|
this._reconcileAllRoots();
|
|
97622
97702
|
}
|
|
97623
97703
|
getCheckState(nodeId) {
|
|
97624
97704
|
const node = this.store.nodeById.get(nodeId);
|
|
97625
|
-
if (!node
|
|
97705
|
+
if (!node) {
|
|
97626
97706
|
return 'disabled';
|
|
97627
97707
|
}
|
|
97708
|
+
let selectionState;
|
|
97628
97709
|
if (node.isLeaf) {
|
|
97629
|
-
|
|
97630
|
-
}
|
|
97631
|
-
|
|
97632
|
-
|
|
97633
|
-
|
|
97634
|
-
|
|
97635
|
-
|
|
97636
|
-
|
|
97637
|
-
|
|
97710
|
+
selectionState = this.selectedLeafSet.has(node.value) ? 'checked' : 'unchecked';
|
|
97711
|
+
} else {
|
|
97712
|
+
const total = node.descendantLeafCount;
|
|
97713
|
+
if (total === 0) {
|
|
97714
|
+
selectionState = 'unchecked';
|
|
97715
|
+
} else {
|
|
97716
|
+
const selected = this.subtreeSelectedCount.get(node.id) || 0;
|
|
97717
|
+
if (selected === 0) {
|
|
97718
|
+
selectionState = 'unchecked';
|
|
97719
|
+
} else if (selected >= total) {
|
|
97720
|
+
selectionState = 'checked';
|
|
97721
|
+
} else {
|
|
97722
|
+
selectionState = 'indeterminate';
|
|
97723
|
+
}
|
|
97724
|
+
}
|
|
97638
97725
|
}
|
|
97639
|
-
if (
|
|
97640
|
-
return '
|
|
97726
|
+
if (node.disabled && selectionState === 'unchecked') {
|
|
97727
|
+
return 'disabled';
|
|
97641
97728
|
}
|
|
97642
|
-
return
|
|
97729
|
+
return selectionState;
|
|
97643
97730
|
}
|
|
97644
97731
|
isChecked(nodeId) {
|
|
97645
97732
|
return this.getCheckState(nodeId) === 'checked';
|
|
@@ -97685,9 +97772,13 @@ class SelectionStatePro {
|
|
|
97685
97772
|
if (typeof val === 'string' && val.startsWith(prefix)) {
|
|
97686
97773
|
rootValue = val.substring(prefix.length);
|
|
97687
97774
|
}
|
|
97688
|
-
const node = this.store
|
|
97689
|
-
if (node
|
|
97690
|
-
node.
|
|
97775
|
+
const node = resolveStoreNodeByValue(this.store, rootValue);
|
|
97776
|
+
if (node) {
|
|
97777
|
+
if (node.isLeaf) {
|
|
97778
|
+
this.selectedLeafSet.add(node.value);
|
|
97779
|
+
} else {
|
|
97780
|
+
node.descendantLeafValues.forEach(v => this.selectedLeafSet.add(v));
|
|
97781
|
+
}
|
|
97691
97782
|
}
|
|
97692
97783
|
});
|
|
97693
97784
|
this._reconcileAllRoots();
|
|
@@ -98215,6 +98306,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98215
98306
|
|
|
98216
98307
|
|
|
98217
98308
|
|
|
98309
|
+
|
|
98218
98310
|
/* harmony default export */ var ByCascaderPanelProvue_type_script_lang_js = ({
|
|
98219
98311
|
name: 'ByCascaderPanelPro',
|
|
98220
98312
|
components: {
|
|
@@ -98523,7 +98615,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98523
98615
|
this.selectedValues = value && value.length ? [value] : [];
|
|
98524
98616
|
}
|
|
98525
98617
|
},
|
|
98526
|
-
|
|
98618
|
+
refreshSelectionDisplayFromPanel() {
|
|
98527
98619
|
const panel = this.$refs.cascaderPanel;
|
|
98528
98620
|
if (!panel || !panel.store || !panel.selection) {
|
|
98529
98621
|
return;
|
|
@@ -98533,36 +98625,65 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98533
98625
|
selection
|
|
98534
98626
|
} = panel;
|
|
98535
98627
|
if (this.aggregationMode) {
|
|
98536
|
-
|
|
98628
|
+
let items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
|
|
98629
|
+
if (items.length === 0 && selection.size() > 0) {
|
|
98630
|
+
const paths = selection.getCheckedPaths();
|
|
98631
|
+
if (paths.length > 0) {
|
|
98632
|
+
items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
|
|
98633
|
+
}
|
|
98634
|
+
}
|
|
98635
|
+
if (items.length === 0 && this.hasExternalValue()) {
|
|
98636
|
+
const paths = this.resolveExternalValueToPaths();
|
|
98637
|
+
if (paths.length > 0) {
|
|
98638
|
+
items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
|
|
98639
|
+
}
|
|
98640
|
+
}
|
|
98537
98641
|
this.selectedItems = items;
|
|
98538
98642
|
this.selectedCount = items.length;
|
|
98539
98643
|
this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
|
|
98540
98644
|
if (!selection.isCompactSelection()) {
|
|
98541
98645
|
this.selectedValues = selection.getCheckedPaths();
|
|
98542
98646
|
}
|
|
98647
|
+
panel.bumpSelectionView();
|
|
98648
|
+
return;
|
|
98649
|
+
}
|
|
98650
|
+
if (selection.isCompactSelection()) {
|
|
98651
|
+
this.selectedItems = this.buildSelectedItemsFromValuesLazy(panel);
|
|
98652
|
+
this.selectedCount = selection.size();
|
|
98653
|
+
this.isAllSelected = selection.size() === store.totalLeafCount;
|
|
98654
|
+
panel.bumpSelectionView();
|
|
98655
|
+
return;
|
|
98656
|
+
}
|
|
98657
|
+
this.selectedValues = selection.getCheckedPaths();
|
|
98658
|
+
this.updateSelectedItems();
|
|
98659
|
+
panel.bumpSelectionView();
|
|
98660
|
+
},
|
|
98661
|
+
applyPanelSelectionChange() {
|
|
98662
|
+
const panel = this.$refs.cascaderPanel;
|
|
98663
|
+
if (!panel || !panel.store || !panel.selection) {
|
|
98664
|
+
return;
|
|
98665
|
+
}
|
|
98666
|
+
const {
|
|
98667
|
+
store,
|
|
98668
|
+
selection
|
|
98669
|
+
} = panel;
|
|
98670
|
+
this.refreshSelectionDisplayFromPanel();
|
|
98671
|
+
if (this.aggregationMode) {
|
|
98543
98672
|
this.isInternalUpdate = true;
|
|
98544
|
-
let emitValue = CascaderUtilsPro.getAggregatedEmitValues(
|
|
98673
|
+
let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
|
|
98545
98674
|
if (!this.isMultiple && emitValue.length > 0) {
|
|
98546
98675
|
emitValue = emitValue[0];
|
|
98547
98676
|
}
|
|
98548
98677
|
this.$emit('input', emitValue);
|
|
98549
98678
|
this.$emit('change', this.getSelectedData());
|
|
98550
|
-
panel.bumpSelectionView();
|
|
98551
98679
|
return;
|
|
98552
98680
|
}
|
|
98553
98681
|
if (selection.isCompactSelection()) {
|
|
98554
|
-
this.selectedItems = this.buildSelectedItemsFromValuesLazy(panel);
|
|
98555
|
-
this.selectedCount = this.aggregationMode ? this.selectedItems.length : selection.size();
|
|
98556
|
-
this.isAllSelected = selection.size() === store.totalLeafCount;
|
|
98557
98682
|
this.isInternalUpdate = true;
|
|
98558
98683
|
this.$emit('input', this.currentValue);
|
|
98559
98684
|
this.$emit('change', this.getSelectedData());
|
|
98560
|
-
panel.bumpSelectionView();
|
|
98561
98685
|
return;
|
|
98562
98686
|
}
|
|
98563
|
-
this.selectedValues = selection.getCheckedPaths();
|
|
98564
|
-
this.updateSelectedItems();
|
|
98565
|
-
panel.bumpSelectionView();
|
|
98566
98687
|
this.$nextTick(() => {
|
|
98567
98688
|
this.isInternalUpdate = true;
|
|
98568
98689
|
let emitValue = this.currentValue;
|
|
@@ -98591,16 +98712,21 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98591
98712
|
return false;
|
|
98592
98713
|
}
|
|
98593
98714
|
if (!this.hasExternalValue()) {
|
|
98594
|
-
panel.
|
|
98715
|
+
if (panel.selection) {
|
|
98716
|
+
panel.selection.clear();
|
|
98717
|
+
panel.bumpSelectionView();
|
|
98718
|
+
}
|
|
98595
98719
|
this.selectedItems = [];
|
|
98596
98720
|
this.selectedValues = [];
|
|
98597
98721
|
return true;
|
|
98598
98722
|
}
|
|
98599
98723
|
panel.selection.clear();
|
|
98600
|
-
this.
|
|
98724
|
+
this.getExternalValueList().forEach(val => {
|
|
98725
|
+
CascaderUtilsPro.addValueToSelection(panel.store, panel.selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
98726
|
+
});
|
|
98601
98727
|
panel.selection._reconcileAllRoots();
|
|
98602
98728
|
panel.bumpSelectionView();
|
|
98603
|
-
this.
|
|
98729
|
+
this.refreshSelectionDisplayFromPanel();
|
|
98604
98730
|
this.expandPanelToExternalValue(panel);
|
|
98605
98731
|
return true;
|
|
98606
98732
|
},
|
|
@@ -98619,34 +98745,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98619
98745
|
store,
|
|
98620
98746
|
selection
|
|
98621
98747
|
} = panel;
|
|
98622
|
-
const paths = this.resolveExternalValueToPaths();
|
|
98623
|
-
paths.forEach(path => {
|
|
98624
|
-
const leafValue = path[path.length - 1];
|
|
98625
|
-
if (store.pathByLeafValue.has(leafValue)) {
|
|
98626
|
-
selection.selectedLeafSet.add(leafValue);
|
|
98627
|
-
}
|
|
98628
|
-
});
|
|
98629
|
-
|
|
98630
|
-
// 直接按外部 value 再补一遍,避免 paths 解析遗漏(聚合父节点、异步 options 等)
|
|
98631
98748
|
this.getExternalValueList().forEach(val => {
|
|
98632
|
-
|
|
98633
|
-
const actualValue = CascaderUtilsPro.extractParentNodeValue(val, this.parentNodePrefix);
|
|
98634
|
-
const node = store.nodeByValue.get(actualValue);
|
|
98635
|
-
if (node && !node.isLeaf && !node.disabled) {
|
|
98636
|
-
node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
|
|
98637
|
-
}
|
|
98638
|
-
return;
|
|
98639
|
-
}
|
|
98640
|
-
if (store.pathByLeafValue.has(val)) {
|
|
98641
|
-
selection.selectedLeafSet.add(val);
|
|
98642
|
-
return;
|
|
98643
|
-
}
|
|
98644
|
-
const node = store.nodeByValue.get(val);
|
|
98645
|
-
if (node && node.isLeaf && !node.disabled) {
|
|
98646
|
-
selection.selectedLeafSet.add(val);
|
|
98647
|
-
} else if (node && !node.isLeaf && !node.disabled) {
|
|
98648
|
-
node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
|
|
98649
|
-
}
|
|
98749
|
+
CascaderUtilsPro.addValueToSelection(store, selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
98650
98750
|
});
|
|
98651
98751
|
},
|
|
98652
98752
|
getExternalValueList() {
|
|
@@ -98677,7 +98777,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98677
98777
|
if (!this.hasExternalValue()) {
|
|
98678
98778
|
const panel = this.$refs.cascaderPanel;
|
|
98679
98779
|
if (panel && panel.selection) {
|
|
98680
|
-
panel.
|
|
98780
|
+
panel.selection.clear();
|
|
98781
|
+
panel.bumpSelectionView();
|
|
98681
98782
|
}
|
|
98682
98783
|
this.selectedItems = [];
|
|
98683
98784
|
this.selectedValues = [];
|
|
@@ -98717,15 +98818,17 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98717
98818
|
let pathValues = [];
|
|
98718
98819
|
if (this.aggregationMode && CascaderUtilsPro.isParentNodeValue(firstValue, this.parentNodePrefix)) {
|
|
98719
98820
|
const actualValue = CascaderUtilsPro.extractParentNodeValue(firstValue, this.parentNodePrefix);
|
|
98720
|
-
const node = panel.store
|
|
98821
|
+
const node = resolveStoreNodeByValue(panel.store, actualValue);
|
|
98721
98822
|
pathValues = node ? [...node.path] : [];
|
|
98722
|
-
} else if (panel.store.pathByLeafValue.has(firstValue)) {
|
|
98723
|
-
const path = panel.store.pathByLeafValue.get(firstValue);
|
|
98724
|
-
pathValues = path ? path.slice(0, -1) : [];
|
|
98725
98823
|
} else {
|
|
98726
|
-
const
|
|
98727
|
-
if (
|
|
98728
|
-
pathValues =
|
|
98824
|
+
const leafPath = getStoreLeafPath(panel.store, firstValue);
|
|
98825
|
+
if (leafPath) {
|
|
98826
|
+
pathValues = leafPath.slice(0, -1);
|
|
98827
|
+
} else {
|
|
98828
|
+
const node = resolveStoreNodeByValue(panel.store, firstValue);
|
|
98829
|
+
if (node) {
|
|
98830
|
+
pathValues = node.isLeaf ? node.path.slice(0, -1) : [...node.path];
|
|
98831
|
+
}
|
|
98729
98832
|
}
|
|
98730
98833
|
}
|
|
98731
98834
|
if (pathValues.length > 0) {
|
|
@@ -98986,23 +99089,23 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98986
99089
|
const panel = this.$refs.cascaderPanel;
|
|
98987
99090
|
if (panel && panel.selection) {
|
|
98988
99091
|
if (item.isAggregated) {
|
|
98989
|
-
const node = panel.store
|
|
99092
|
+
const node = resolveStoreNodeByValue(panel.store, item.value);
|
|
98990
99093
|
if (node) {
|
|
98991
99094
|
panel.selection.toggleNode(node.id, false);
|
|
98992
99095
|
}
|
|
98993
99096
|
} else if (item.path && item.path.length > 0) {
|
|
98994
99097
|
const leafValue = item.path[item.path.length - 1];
|
|
98995
|
-
const leafNode = panel.store
|
|
99098
|
+
const leafNode = resolveStoreNodeByValue(panel.store, leafValue);
|
|
98996
99099
|
if (leafNode) {
|
|
98997
99100
|
panel.selection.toggleNode(leafNode.id, false);
|
|
98998
99101
|
} else {
|
|
98999
|
-
const node = panel.store
|
|
99102
|
+
const node = resolveStoreNodeByValue(panel.store, item.value);
|
|
99000
99103
|
if (node) {
|
|
99001
99104
|
panel.selection.toggleNode(node.id, false);
|
|
99002
99105
|
}
|
|
99003
99106
|
}
|
|
99004
99107
|
} else {
|
|
99005
|
-
const node = panel.store
|
|
99108
|
+
const node = resolveStoreNodeByValue(panel.store, item.value);
|
|
99006
99109
|
if (node) {
|
|
99007
99110
|
panel.selection.toggleNode(node.id, false);
|
|
99008
99111
|
}
|
|
@@ -99142,15 +99245,10 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99142
99245
|
const findPath = (options, targetValues, currentPath = []) => {
|
|
99143
99246
|
for (const option of options) {
|
|
99144
99247
|
const newPath = [...currentPath, option[this.cascaderProps.value]];
|
|
99145
|
-
if (targetValues.
|
|
99146
|
-
|
|
99147
|
-
if (!option[this.cascaderProps.children]) {
|
|
99148
|
-
paths.push(newPath);
|
|
99149
|
-
}
|
|
99248
|
+
if (targetValues.some(target => target == option[this.cascaderProps.value]) && CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
|
|
99249
|
+
paths.push(newPath);
|
|
99150
99250
|
}
|
|
99151
|
-
|
|
99152
|
-
// 递归查找子节点
|
|
99153
|
-
if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
|
|
99251
|
+
if (!CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
|
|
99154
99252
|
findPath(option[this.cascaderProps.children], targetValues, newPath);
|
|
99155
99253
|
}
|
|
99156
99254
|
}
|
|
@@ -99188,8 +99286,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99188
99286
|
if (panel && panel.selection && panel.store) {
|
|
99189
99287
|
matchedPaths.forEach(path => {
|
|
99190
99288
|
const leafValue = path[path.length - 1];
|
|
99191
|
-
|
|
99192
|
-
|
|
99289
|
+
const leafPath = getStoreLeafPath(panel.store, leafValue);
|
|
99290
|
+
if (leafPath) {
|
|
99291
|
+
panel.selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
99193
99292
|
}
|
|
99194
99293
|
});
|
|
99195
99294
|
panel.selection._reconcileAllRoots();
|
|
@@ -99292,8 +99391,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99292
99391
|
;
|
|
99293
99392
|
var ByCascaderPanelPro_component = normalizeComponent(
|
|
99294
99393
|
cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
|
|
99295
|
-
|
|
99296
|
-
|
|
99394
|
+
ByCascaderPanelProvue_type_template_id_075d43fb_render,
|
|
99395
|
+
ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns,
|
|
99297
99396
|
false,
|
|
99298
99397
|
null,
|
|
99299
99398
|
null,
|