@weitutech/by-components 1.2.0 → 1.2.2
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 +423 -259
- package/lib/by-components.umd.js +680 -516
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
|
@@ -96015,8 +96015,8 @@ var ByCascaderPanel_component = normalizeComponent(
|
|
|
96015
96015
|
)
|
|
96016
96016
|
|
|
96017
96017
|
/* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
|
|
96018
|
-
;// ./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-40.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=
|
|
96019
|
-
var
|
|
96018
|
+
;// ./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-40.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=37aef47d
|
|
96019
|
+
var ByCascaderPanelProvue_type_template_id_37aef47d_render = function render() {
|
|
96020
96020
|
var _vm = this,
|
|
96021
96021
|
_c = _vm._self._c;
|
|
96022
96022
|
return _c('div', {
|
|
@@ -96154,7 +96154,8 @@ var ByCascaderPanelProvue_type_template_id_4bdb9820_render = function render() {
|
|
|
96154
96154
|
},
|
|
96155
96155
|
on: {
|
|
96156
96156
|
"input": _vm.onMainPanelInput,
|
|
96157
|
-
"change": _vm.handleValueChange
|
|
96157
|
+
"change": _vm.handleValueChange,
|
|
96158
|
+
"store-ready": _vm.schedulePanelSyncFromExternalValue
|
|
96158
96159
|
}
|
|
96159
96160
|
}) : _vm._e(), _vm.searchOptions.length > 0 ? _c('VirtualCascaderPanel', {
|
|
96160
96161
|
directives: [{
|
|
@@ -96257,8 +96258,215 @@ var ByCascaderPanelProvue_type_template_id_4bdb9820_render = function render() {
|
|
|
96257
96258
|
staticClass: "empty-state"
|
|
96258
96259
|
}, [_vm._v("暂无选中项")])], 1)])])])]);
|
|
96259
96260
|
};
|
|
96260
|
-
var
|
|
96261
|
+
var ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns = [];
|
|
96262
|
+
|
|
96263
|
+
;// ./src/components/cascader-panel-pro/cascaderStorePro.js
|
|
96264
|
+
|
|
96265
|
+
|
|
96266
|
+
|
|
96267
|
+
|
|
96268
|
+
|
|
96269
|
+
|
|
96270
|
+
/**
|
|
96271
|
+
* 级联树扁平化存储,初始化时预计算子树叶子元数据,供 O(1) 级勾选/聚合
|
|
96272
|
+
*/
|
|
96273
|
+
|
|
96274
|
+
let nodeIdSeed = 0;
|
|
96275
|
+
function nextId() {
|
|
96276
|
+
nodeIdSeed += 1;
|
|
96277
|
+
return nodeIdSeed;
|
|
96278
|
+
}
|
|
96279
|
+
function resetCascaderStoreIdSeed() {
|
|
96280
|
+
nodeIdSeed = 0;
|
|
96281
|
+
}
|
|
96282
|
+
|
|
96283
|
+
/**
|
|
96284
|
+
* @param {Array} options
|
|
96285
|
+
* @param {Object} config - disabledField/disabledValue/disabledCheck
|
|
96286
|
+
* @param {Object} cascaderProps
|
|
96287
|
+
* @param {Object} utils - CascaderUtilsPro
|
|
96288
|
+
*/
|
|
96289
|
+
function buildCascaderStore(options, config, cascaderProps, utils) {
|
|
96290
|
+
resetCascaderStoreIdSeed();
|
|
96291
|
+
const valueKey = cascaderProps.value || 'value';
|
|
96292
|
+
const labelKey = cascaderProps.label || 'label';
|
|
96293
|
+
const childrenKey = cascaderProps.children || 'children';
|
|
96294
|
+
const disabledKey = cascaderProps.disabled || 'disabled';
|
|
96295
|
+
const nodes = [];
|
|
96296
|
+
const nodeById = new Map();
|
|
96297
|
+
const nodeByValue = new Map();
|
|
96298
|
+
const childrenByParentId = new Map();
|
|
96299
|
+
const rootIds = [];
|
|
96300
|
+
const pathByLeafValue = new Map();
|
|
96301
|
+
const allLeafValues = [];
|
|
96302
|
+
const allLeafPaths = [];
|
|
96303
|
+
const createNode = (raw, parentPath, level, parentId) => {
|
|
96304
|
+
const value = raw[valueKey];
|
|
96305
|
+
const children = raw[childrenKey];
|
|
96306
|
+
const hasChildren = Array.isArray(children) && children.length > 0;
|
|
96307
|
+
const id = nextId();
|
|
96308
|
+
const nodePath = parentId == null ? [value] : parentPath.concat(value);
|
|
96309
|
+
const node = {
|
|
96310
|
+
id,
|
|
96311
|
+
value,
|
|
96312
|
+
label: raw[labelKey],
|
|
96313
|
+
path: nodePath,
|
|
96314
|
+
level,
|
|
96315
|
+
parentId,
|
|
96316
|
+
childIds: [],
|
|
96317
|
+
isLeaf: !hasChildren,
|
|
96318
|
+
disabled: !!raw[disabledKey],
|
|
96319
|
+
raw,
|
|
96320
|
+
descendantLeafValues: [],
|
|
96321
|
+
descendantLeafCount: 0,
|
|
96322
|
+
descendantPaths: []
|
|
96323
|
+
};
|
|
96324
|
+
nodes.push(node);
|
|
96325
|
+
nodeById.set(id, node);
|
|
96326
|
+
if (!nodeByValue.has(value)) {
|
|
96327
|
+
nodeByValue.set(value, node);
|
|
96328
|
+
}
|
|
96329
|
+
if (parentId == null) {
|
|
96330
|
+
rootIds.push(id);
|
|
96331
|
+
} else {
|
|
96332
|
+
const siblings = childrenByParentId.get(parentId) || [];
|
|
96333
|
+
siblings.push(id);
|
|
96334
|
+
childrenByParentId.set(parentId, siblings);
|
|
96335
|
+
const parent = nodeById.get(parentId);
|
|
96336
|
+
if (parent) {
|
|
96337
|
+
parent.childIds.push(id);
|
|
96338
|
+
}
|
|
96339
|
+
}
|
|
96340
|
+
if (hasChildren) {
|
|
96341
|
+
children.forEach(child => {
|
|
96342
|
+
createNode(child, nodePath, level + 1, id);
|
|
96343
|
+
});
|
|
96344
|
+
} else {
|
|
96345
|
+
pathByLeafValue.set(value, nodePath);
|
|
96346
|
+
if (!node.disabled) {
|
|
96347
|
+
allLeafValues.push(value);
|
|
96348
|
+
allLeafPaths.push(nodePath);
|
|
96349
|
+
}
|
|
96350
|
+
}
|
|
96351
|
+
return node;
|
|
96352
|
+
};
|
|
96353
|
+
const walkRoots = (items, ancestorDisabled = false) => {
|
|
96354
|
+
items.forEach(item => {
|
|
96355
|
+
const isDisabled = ancestorDisabled || utils.isItemDisabled(item, config);
|
|
96356
|
+
const cloned = {
|
|
96357
|
+
...item
|
|
96358
|
+
};
|
|
96359
|
+
if (isDisabled) {
|
|
96360
|
+
cloned[disabledKey] = true;
|
|
96361
|
+
}
|
|
96362
|
+
createNode(cloned, [], 0, null);
|
|
96363
|
+
});
|
|
96364
|
+
};
|
|
96365
|
+
walkRoots(options || []);
|
|
96261
96366
|
|
|
96367
|
+
// 自底向上汇总子树叶子
|
|
96368
|
+
const sorted = nodes.slice().sort((a, b) => b.level - a.level);
|
|
96369
|
+
sorted.forEach(node => {
|
|
96370
|
+
if (node.isLeaf) {
|
|
96371
|
+
node.descendantLeafValues = [node.value];
|
|
96372
|
+
node.descendantLeafCount = 1;
|
|
96373
|
+
node.descendantPaths = [node.path];
|
|
96374
|
+
return;
|
|
96375
|
+
}
|
|
96376
|
+
const leafValues = [];
|
|
96377
|
+
const leafPaths = [];
|
|
96378
|
+
node.childIds.forEach(childId => {
|
|
96379
|
+
const child = nodeById.get(childId);
|
|
96380
|
+
if (!child || child.descendantLeafCount === 0) {
|
|
96381
|
+
return;
|
|
96382
|
+
}
|
|
96383
|
+
leafValues.push(...child.descendantLeafValues);
|
|
96384
|
+
leafPaths.push(...child.descendantPaths);
|
|
96385
|
+
});
|
|
96386
|
+
node.descendantLeafValues = leafValues;
|
|
96387
|
+
node.descendantLeafCount = leafValues.length;
|
|
96388
|
+
node.descendantPaths = leafPaths;
|
|
96389
|
+
});
|
|
96390
|
+
return {
|
|
96391
|
+
nodes,
|
|
96392
|
+
nodeById,
|
|
96393
|
+
nodeByValue,
|
|
96394
|
+
childrenByParentId,
|
|
96395
|
+
rootIds,
|
|
96396
|
+
pathByLeafValue,
|
|
96397
|
+
allLeafValues,
|
|
96398
|
+
allLeafPaths,
|
|
96399
|
+
totalLeafCount: allLeafPaths.length
|
|
96400
|
+
};
|
|
96401
|
+
}
|
|
96402
|
+
function getStoreChildren(store, parentId) {
|
|
96403
|
+
if (parentId == null) {
|
|
96404
|
+
return store.rootIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
96405
|
+
}
|
|
96406
|
+
const childIds = store.childrenByParentId.get(parentId) || [];
|
|
96407
|
+
return childIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
96408
|
+
}
|
|
96409
|
+
function resolveStoreNodeByValue(store, value) {
|
|
96410
|
+
if (!store || value == null || value === '') {
|
|
96411
|
+
return null;
|
|
96412
|
+
}
|
|
96413
|
+
if (store.nodeByValue.has(value)) {
|
|
96414
|
+
return store.nodeByValue.get(value);
|
|
96415
|
+
}
|
|
96416
|
+
const num = Number(value);
|
|
96417
|
+
if (!Number.isNaN(num) && store.nodeByValue.has(num)) {
|
|
96418
|
+
return store.nodeByValue.get(num);
|
|
96419
|
+
}
|
|
96420
|
+
const str = String(value);
|
|
96421
|
+
if (str !== value && store.nodeByValue.has(str)) {
|
|
96422
|
+
return store.nodeByValue.get(str);
|
|
96423
|
+
}
|
|
96424
|
+
for (const [key, node] of store.nodeByValue) {
|
|
96425
|
+
if (key == value) {
|
|
96426
|
+
return node;
|
|
96427
|
+
}
|
|
96428
|
+
}
|
|
96429
|
+
return null;
|
|
96430
|
+
}
|
|
96431
|
+
function getStoreLeafPath(store, leafValue) {
|
|
96432
|
+
if (!store || leafValue == null || leafValue === '') {
|
|
96433
|
+
return null;
|
|
96434
|
+
}
|
|
96435
|
+
if (store.pathByLeafValue.has(leafValue)) {
|
|
96436
|
+
return store.pathByLeafValue.get(leafValue);
|
|
96437
|
+
}
|
|
96438
|
+
const node = resolveStoreNodeByValue(store, leafValue);
|
|
96439
|
+
if (node && node.isLeaf) {
|
|
96440
|
+
return node.path;
|
|
96441
|
+
}
|
|
96442
|
+
for (const [key, path] of store.pathByLeafValue) {
|
|
96443
|
+
if (key == leafValue) {
|
|
96444
|
+
return path;
|
|
96445
|
+
}
|
|
96446
|
+
}
|
|
96447
|
+
return null;
|
|
96448
|
+
}
|
|
96449
|
+
function storeHasLeafValue(store, leafValue) {
|
|
96450
|
+
return getStoreLeafPath(store, leafValue) != null;
|
|
96451
|
+
}
|
|
96452
|
+
function findStoreNodeByPath(store, pathValues) {
|
|
96453
|
+
if (!pathValues || pathValues.length === 0) {
|
|
96454
|
+
return null;
|
|
96455
|
+
}
|
|
96456
|
+
let node = resolveStoreNodeByValue(store, pathValues[0]);
|
|
96457
|
+
if (!node || pathValues.length === 1) {
|
|
96458
|
+
return node;
|
|
96459
|
+
}
|
|
96460
|
+
for (let i = 1; i < pathValues.length; i++) {
|
|
96461
|
+
const target = pathValues[i];
|
|
96462
|
+
const children = getStoreChildren(store, node.id);
|
|
96463
|
+
node = children.find(child => child.value == target) || null;
|
|
96464
|
+
if (!node) {
|
|
96465
|
+
return null;
|
|
96466
|
+
}
|
|
96467
|
+
}
|
|
96468
|
+
return node;
|
|
96469
|
+
}
|
|
96262
96470
|
;// ./src/components/cascader-panel-pro/cascaderUtilsPro.js
|
|
96263
96471
|
|
|
96264
96472
|
|
|
@@ -96278,6 +96486,7 @@ var ByCascaderPanelProvue_type_template_id_4bdb9820_staticRenderFns = [];
|
|
|
96278
96486
|
/**
|
|
96279
96487
|
* 级联选择器工具类(Pro 版,独立于 CascaderUtils)
|
|
96280
96488
|
*/
|
|
96489
|
+
|
|
96281
96490
|
class CascaderUtilsPro {
|
|
96282
96491
|
/**
|
|
96283
96492
|
* 估算级联节点标签文本宽度(px)
|
|
@@ -96620,14 +96829,14 @@ class CascaderUtilsPro {
|
|
|
96620
96829
|
}
|
|
96621
96830
|
const items = [];
|
|
96622
96831
|
selection.selectedLeafSet.forEach(leafValue => {
|
|
96623
|
-
const path = store
|
|
96624
|
-
const node = store
|
|
96832
|
+
const path = getStoreLeafPath(store, leafValue);
|
|
96833
|
+
const node = resolveStoreNodeByValue(store, leafValue);
|
|
96625
96834
|
if (!path || !node) {
|
|
96626
96835
|
return;
|
|
96627
96836
|
}
|
|
96628
96837
|
items.push({
|
|
96629
96838
|
...node.raw,
|
|
96630
|
-
value:
|
|
96839
|
+
value: node.value,
|
|
96631
96840
|
label: node.label,
|
|
96632
96841
|
path
|
|
96633
96842
|
});
|
|
@@ -96751,7 +96960,7 @@ class CascaderUtilsPro {
|
|
|
96751
96960
|
const items = [];
|
|
96752
96961
|
const walk = nodeId => {
|
|
96753
96962
|
const node = store.nodeById.get(nodeId);
|
|
96754
|
-
if (!node
|
|
96963
|
+
if (!node) {
|
|
96755
96964
|
return;
|
|
96756
96965
|
}
|
|
96757
96966
|
const state = selection.getCheckState(nodeId);
|
|
@@ -96999,7 +97208,7 @@ class CascaderUtilsPro {
|
|
|
96999
97208
|
const findPath = (nodes, targetValues, currentPath = []) => {
|
|
97000
97209
|
for (const option of nodes) {
|
|
97001
97210
|
const newPath = [...currentPath, option[cascaderProps.value]];
|
|
97002
|
-
if (targetValues.
|
|
97211
|
+
if (targetValues.some(target => target == option[cascaderProps.value])) {
|
|
97003
97212
|
// 如果是叶子节点(没有children属性),添加到路径中
|
|
97004
97213
|
if (!option[cascaderProps.children]) {
|
|
97005
97214
|
paths.push(newPath);
|
|
@@ -97016,8 +97225,8 @@ class CascaderUtilsPro {
|
|
|
97016
97225
|
return paths;
|
|
97017
97226
|
}
|
|
97018
97227
|
}
|
|
97019
|
-
;// ./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-40.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/VirtualCascaderPanel.vue?vue&type=template&id=
|
|
97020
|
-
var
|
|
97228
|
+
;// ./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-40.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/VirtualCascaderPanel.vue?vue&type=template&id=05f77638
|
|
97229
|
+
var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render() {
|
|
97021
97230
|
var _vm = this,
|
|
97022
97231
|
_c = _vm._self._c;
|
|
97023
97232
|
return _c('div', {
|
|
@@ -97108,7 +97317,7 @@ var VirtualCascaderPanelvue_type_template_id_23086f90_render = function render()
|
|
|
97108
97317
|
})], 1);
|
|
97109
97318
|
}), 0);
|
|
97110
97319
|
};
|
|
97111
|
-
var
|
|
97320
|
+
var VirtualCascaderPanelvue_type_template_id_05f77638_staticRenderFns = [];
|
|
97112
97321
|
|
|
97113
97322
|
;// ./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-40.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/VirtualList.vue?vue&type=template&id=43cb1148
|
|
97114
97323
|
var VirtualListvue_type_template_id_43cb1148_render = function render() {
|
|
@@ -97264,170 +97473,6 @@ var VirtualList_component = normalizeComponent(
|
|
|
97264
97473
|
)
|
|
97265
97474
|
|
|
97266
97475
|
/* harmony default export */ var VirtualList = (VirtualList_component.exports);
|
|
97267
|
-
;// ./src/components/cascader-panel-pro/cascaderStorePro.js
|
|
97268
|
-
|
|
97269
|
-
|
|
97270
|
-
|
|
97271
|
-
|
|
97272
|
-
|
|
97273
|
-
|
|
97274
|
-
/**
|
|
97275
|
-
* 级联树扁平化存储,初始化时预计算子树叶子元数据,供 O(1) 级勾选/聚合
|
|
97276
|
-
*/
|
|
97277
|
-
|
|
97278
|
-
let nodeIdSeed = 0;
|
|
97279
|
-
function nextId() {
|
|
97280
|
-
nodeIdSeed += 1;
|
|
97281
|
-
return nodeIdSeed;
|
|
97282
|
-
}
|
|
97283
|
-
function resetCascaderStoreIdSeed() {
|
|
97284
|
-
nodeIdSeed = 0;
|
|
97285
|
-
}
|
|
97286
|
-
|
|
97287
|
-
/**
|
|
97288
|
-
* @param {Array} options
|
|
97289
|
-
* @param {Object} config - disabledField/disabledValue/disabledCheck
|
|
97290
|
-
* @param {Object} cascaderProps
|
|
97291
|
-
* @param {Object} utils - CascaderUtilsPro
|
|
97292
|
-
*/
|
|
97293
|
-
function buildCascaderStore(options, config, cascaderProps, utils) {
|
|
97294
|
-
resetCascaderStoreIdSeed();
|
|
97295
|
-
const valueKey = cascaderProps.value || 'value';
|
|
97296
|
-
const labelKey = cascaderProps.label || 'label';
|
|
97297
|
-
const childrenKey = cascaderProps.children || 'children';
|
|
97298
|
-
const disabledKey = cascaderProps.disabled || 'disabled';
|
|
97299
|
-
const nodes = [];
|
|
97300
|
-
const nodeById = new Map();
|
|
97301
|
-
const nodeByValue = new Map();
|
|
97302
|
-
const childrenByParentId = new Map();
|
|
97303
|
-
const rootIds = [];
|
|
97304
|
-
const pathByLeafValue = new Map();
|
|
97305
|
-
const allLeafValues = [];
|
|
97306
|
-
const allLeafPaths = [];
|
|
97307
|
-
const createNode = (raw, parentPath, level, parentId) => {
|
|
97308
|
-
const value = raw[valueKey];
|
|
97309
|
-
const children = raw[childrenKey];
|
|
97310
|
-
const hasChildren = Array.isArray(children) && children.length > 0;
|
|
97311
|
-
const id = nextId();
|
|
97312
|
-
const nodePath = parentId == null ? [value] : parentPath.concat(value);
|
|
97313
|
-
const node = {
|
|
97314
|
-
id,
|
|
97315
|
-
value,
|
|
97316
|
-
label: raw[labelKey],
|
|
97317
|
-
path: nodePath,
|
|
97318
|
-
level,
|
|
97319
|
-
parentId,
|
|
97320
|
-
childIds: [],
|
|
97321
|
-
isLeaf: !hasChildren,
|
|
97322
|
-
disabled: !!raw[disabledKey],
|
|
97323
|
-
raw,
|
|
97324
|
-
descendantLeafValues: [],
|
|
97325
|
-
descendantLeafCount: 0,
|
|
97326
|
-
descendantPaths: []
|
|
97327
|
-
};
|
|
97328
|
-
nodes.push(node);
|
|
97329
|
-
nodeById.set(id, node);
|
|
97330
|
-
if (!nodeByValue.has(value)) {
|
|
97331
|
-
nodeByValue.set(value, node);
|
|
97332
|
-
}
|
|
97333
|
-
if (parentId == null) {
|
|
97334
|
-
rootIds.push(id);
|
|
97335
|
-
} else {
|
|
97336
|
-
const siblings = childrenByParentId.get(parentId) || [];
|
|
97337
|
-
siblings.push(id);
|
|
97338
|
-
childrenByParentId.set(parentId, siblings);
|
|
97339
|
-
const parent = nodeById.get(parentId);
|
|
97340
|
-
if (parent) {
|
|
97341
|
-
parent.childIds.push(id);
|
|
97342
|
-
}
|
|
97343
|
-
}
|
|
97344
|
-
if (hasChildren) {
|
|
97345
|
-
children.forEach(child => {
|
|
97346
|
-
createNode(child, nodePath, level + 1, id);
|
|
97347
|
-
});
|
|
97348
|
-
} else if (!node.disabled) {
|
|
97349
|
-
pathByLeafValue.set(value, nodePath);
|
|
97350
|
-
allLeafValues.push(value);
|
|
97351
|
-
allLeafPaths.push(nodePath);
|
|
97352
|
-
}
|
|
97353
|
-
return node;
|
|
97354
|
-
};
|
|
97355
|
-
const walkRoots = (items, ancestorDisabled = false) => {
|
|
97356
|
-
items.forEach(item => {
|
|
97357
|
-
const isDisabled = ancestorDisabled || utils.isItemDisabled(item, config);
|
|
97358
|
-
const cloned = {
|
|
97359
|
-
...item
|
|
97360
|
-
};
|
|
97361
|
-
if (isDisabled) {
|
|
97362
|
-
cloned[disabledKey] = true;
|
|
97363
|
-
}
|
|
97364
|
-
createNode(cloned, [], 0, null);
|
|
97365
|
-
});
|
|
97366
|
-
};
|
|
97367
|
-
walkRoots(options || []);
|
|
97368
|
-
|
|
97369
|
-
// 自底向上汇总子树叶子
|
|
97370
|
-
const sorted = nodes.slice().sort((a, b) => b.level - a.level);
|
|
97371
|
-
sorted.forEach(node => {
|
|
97372
|
-
if (node.isLeaf) {
|
|
97373
|
-
if (!node.disabled) {
|
|
97374
|
-
node.descendantLeafValues = [node.value];
|
|
97375
|
-
node.descendantLeafCount = 1;
|
|
97376
|
-
node.descendantPaths = [node.path];
|
|
97377
|
-
}
|
|
97378
|
-
return;
|
|
97379
|
-
}
|
|
97380
|
-
const leafValues = [];
|
|
97381
|
-
const leafPaths = [];
|
|
97382
|
-
node.childIds.forEach(childId => {
|
|
97383
|
-
const child = nodeById.get(childId);
|
|
97384
|
-
if (!child || child.descendantLeafCount === 0) {
|
|
97385
|
-
return;
|
|
97386
|
-
}
|
|
97387
|
-
leafValues.push(...child.descendantLeafValues);
|
|
97388
|
-
leafPaths.push(...child.descendantPaths);
|
|
97389
|
-
});
|
|
97390
|
-
node.descendantLeafValues = leafValues;
|
|
97391
|
-
node.descendantLeafCount = leafValues.length;
|
|
97392
|
-
node.descendantPaths = leafPaths;
|
|
97393
|
-
});
|
|
97394
|
-
return {
|
|
97395
|
-
nodes,
|
|
97396
|
-
nodeById,
|
|
97397
|
-
nodeByValue,
|
|
97398
|
-
childrenByParentId,
|
|
97399
|
-
rootIds,
|
|
97400
|
-
pathByLeafValue,
|
|
97401
|
-
allLeafValues,
|
|
97402
|
-
allLeafPaths,
|
|
97403
|
-
totalLeafCount: allLeafPaths.length
|
|
97404
|
-
};
|
|
97405
|
-
}
|
|
97406
|
-
function getStoreChildren(store, parentId) {
|
|
97407
|
-
if (parentId == null) {
|
|
97408
|
-
return store.rootIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
97409
|
-
}
|
|
97410
|
-
const childIds = store.childrenByParentId.get(parentId) || [];
|
|
97411
|
-
return childIds.map(id => store.nodeById.get(id)).filter(Boolean);
|
|
97412
|
-
}
|
|
97413
|
-
function findStoreNodeByPath(store, pathValues) {
|
|
97414
|
-
if (!pathValues || pathValues.length === 0) {
|
|
97415
|
-
return null;
|
|
97416
|
-
}
|
|
97417
|
-
let node = store.nodeByValue.get(pathValues[0]);
|
|
97418
|
-
if (!node || pathValues.length === 1) {
|
|
97419
|
-
return node;
|
|
97420
|
-
}
|
|
97421
|
-
for (let i = 1; i < pathValues.length; i++) {
|
|
97422
|
-
const target = pathValues[i];
|
|
97423
|
-
const children = getStoreChildren(store, node.id);
|
|
97424
|
-
node = children.find(child => child.value == target) || null;
|
|
97425
|
-
if (!node) {
|
|
97426
|
-
return null;
|
|
97427
|
-
}
|
|
97428
|
-
}
|
|
97429
|
-
return node;
|
|
97430
|
-
}
|
|
97431
97476
|
;// ./src/components/cascader-panel-pro/selectionStatePro.js
|
|
97432
97477
|
|
|
97433
97478
|
|
|
@@ -97439,6 +97484,7 @@ function findStoreNodeByPath(store, pathValues) {
|
|
|
97439
97484
|
|
|
97440
97485
|
|
|
97441
97486
|
|
|
97487
|
+
|
|
97442
97488
|
const COMPACT_EMIT_THRESHOLD = 300;
|
|
97443
97489
|
|
|
97444
97490
|
class SelectionStatePro {
|
|
@@ -97603,32 +97649,40 @@ class SelectionStatePro {
|
|
|
97603
97649
|
return;
|
|
97604
97650
|
}
|
|
97605
97651
|
const leafValue = path[path.length - 1];
|
|
97606
|
-
|
|
97607
|
-
|
|
97652
|
+
const leafPath = getStoreLeafPath(this.store, leafValue);
|
|
97653
|
+
if (leafPath) {
|
|
97654
|
+
this.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
97608
97655
|
}
|
|
97609
97656
|
});
|
|
97610
97657
|
this._reconcileAllRoots();
|
|
97611
97658
|
}
|
|
97612
97659
|
getCheckState(nodeId) {
|
|
97613
97660
|
const node = this.store.nodeById.get(nodeId);
|
|
97614
|
-
if (!node
|
|
97661
|
+
if (!node) {
|
|
97615
97662
|
return 'disabled';
|
|
97616
97663
|
}
|
|
97664
|
+
let selectionState;
|
|
97617
97665
|
if (node.isLeaf) {
|
|
97618
|
-
|
|
97619
|
-
}
|
|
97620
|
-
|
|
97621
|
-
|
|
97622
|
-
|
|
97623
|
-
|
|
97624
|
-
|
|
97625
|
-
|
|
97626
|
-
|
|
97666
|
+
selectionState = this.selectedLeafSet.has(node.value) ? 'checked' : 'unchecked';
|
|
97667
|
+
} else {
|
|
97668
|
+
const total = node.descendantLeafCount;
|
|
97669
|
+
if (total === 0) {
|
|
97670
|
+
selectionState = 'unchecked';
|
|
97671
|
+
} else {
|
|
97672
|
+
const selected = this.subtreeSelectedCount.get(node.id) || 0;
|
|
97673
|
+
if (selected === 0) {
|
|
97674
|
+
selectionState = 'unchecked';
|
|
97675
|
+
} else if (selected >= total) {
|
|
97676
|
+
selectionState = 'checked';
|
|
97677
|
+
} else {
|
|
97678
|
+
selectionState = 'indeterminate';
|
|
97679
|
+
}
|
|
97680
|
+
}
|
|
97627
97681
|
}
|
|
97628
|
-
if (
|
|
97629
|
-
return '
|
|
97682
|
+
if (node.disabled && selectionState === 'unchecked') {
|
|
97683
|
+
return 'disabled';
|
|
97630
97684
|
}
|
|
97631
|
-
return
|
|
97685
|
+
return selectionState;
|
|
97632
97686
|
}
|
|
97633
97687
|
isChecked(nodeId) {
|
|
97634
97688
|
return this.getCheckState(nodeId) === 'checked';
|
|
@@ -97674,8 +97728,8 @@ class SelectionStatePro {
|
|
|
97674
97728
|
if (typeof val === 'string' && val.startsWith(prefix)) {
|
|
97675
97729
|
rootValue = val.substring(prefix.length);
|
|
97676
97730
|
}
|
|
97677
|
-
const node = this.store
|
|
97678
|
-
if (node && !node.isLeaf
|
|
97731
|
+
const node = resolveStoreNodeByValue(this.store, rootValue);
|
|
97732
|
+
if (node && !node.isLeaf) {
|
|
97679
97733
|
node.descendantLeafValues.forEach(v => this.selectedLeafSet.add(v));
|
|
97680
97734
|
}
|
|
97681
97735
|
});
|
|
@@ -97876,6 +97930,9 @@ class SelectionStatePro {
|
|
|
97876
97930
|
}
|
|
97877
97931
|
this.$nextTick(() => {
|
|
97878
97932
|
this.syncHorizontalOverflow();
|
|
97933
|
+
if (!this.syncValueFromParent) {
|
|
97934
|
+
this.$emit('store-ready');
|
|
97935
|
+
}
|
|
97879
97936
|
});
|
|
97880
97937
|
},
|
|
97881
97938
|
syncFromValue() {
|
|
@@ -98173,8 +98230,8 @@ class SelectionStatePro {
|
|
|
98173
98230
|
;
|
|
98174
98231
|
var VirtualCascaderPanel_component = normalizeComponent(
|
|
98175
98232
|
cascader_panel_pro_VirtualCascaderPanelvue_type_script_lang_js,
|
|
98176
|
-
|
|
98177
|
-
|
|
98233
|
+
VirtualCascaderPanelvue_type_template_id_05f77638_render,
|
|
98234
|
+
VirtualCascaderPanelvue_type_template_id_05f77638_staticRenderFns,
|
|
98178
98235
|
false,
|
|
98179
98236
|
null,
|
|
98180
98237
|
null,
|
|
@@ -98201,6 +98258,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98201
98258
|
|
|
98202
98259
|
|
|
98203
98260
|
|
|
98261
|
+
|
|
98204
98262
|
/* harmony default export */ var ByCascaderPanelProvue_type_script_lang_js = ({
|
|
98205
98263
|
name: 'ByCascaderPanelPro',
|
|
98206
98264
|
components: {
|
|
@@ -98335,7 +98393,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98335
98393
|
compactPanelValue: [],
|
|
98336
98394
|
// 紧凑模式下稳定的空 value 引用,避免 watch 误触发清空
|
|
98337
98395
|
searchDebounceTimer: null,
|
|
98338
|
-
searchLeafSetCache: null
|
|
98396
|
+
searchLeafSetCache: null,
|
|
98397
|
+
panelSyncTimer: null
|
|
98339
98398
|
};
|
|
98340
98399
|
},
|
|
98341
98400
|
computed: {
|
|
@@ -98495,6 +98554,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98495
98554
|
clearTimeout(this.searchDebounceTimer);
|
|
98496
98555
|
this.searchDebounceTimer = null;
|
|
98497
98556
|
}
|
|
98557
|
+
this.clearPanelSyncTimer();
|
|
98498
98558
|
},
|
|
98499
98559
|
methods: {
|
|
98500
98560
|
onMainPanelInput(value) {
|
|
@@ -98507,7 +98567,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98507
98567
|
this.selectedValues = value && value.length ? [value] : [];
|
|
98508
98568
|
}
|
|
98509
98569
|
},
|
|
98510
|
-
|
|
98570
|
+
refreshSelectionDisplayFromPanel() {
|
|
98511
98571
|
const panel = this.$refs.cascaderPanel;
|
|
98512
98572
|
if (!panel || !panel.store || !panel.selection) {
|
|
98513
98573
|
return;
|
|
@@ -98524,29 +98584,46 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98524
98584
|
if (!selection.isCompactSelection()) {
|
|
98525
98585
|
this.selectedValues = selection.getCheckedPaths();
|
|
98526
98586
|
}
|
|
98587
|
+
panel.bumpSelectionView();
|
|
98588
|
+
return;
|
|
98589
|
+
}
|
|
98590
|
+
if (selection.isCompactSelection()) {
|
|
98591
|
+
this.selectedItems = this.buildSelectedItemsFromValuesLazy(panel);
|
|
98592
|
+
this.selectedCount = selection.size();
|
|
98593
|
+
this.isAllSelected = selection.size() === store.totalLeafCount;
|
|
98594
|
+
panel.bumpSelectionView();
|
|
98595
|
+
return;
|
|
98596
|
+
}
|
|
98597
|
+
this.selectedValues = selection.getCheckedPaths();
|
|
98598
|
+
this.updateSelectedItems();
|
|
98599
|
+
panel.bumpSelectionView();
|
|
98600
|
+
},
|
|
98601
|
+
applyPanelSelectionChange() {
|
|
98602
|
+
const panel = this.$refs.cascaderPanel;
|
|
98603
|
+
if (!panel || !panel.store || !panel.selection) {
|
|
98604
|
+
return;
|
|
98605
|
+
}
|
|
98606
|
+
const {
|
|
98607
|
+
store,
|
|
98608
|
+
selection
|
|
98609
|
+
} = panel;
|
|
98610
|
+
this.refreshSelectionDisplayFromPanel();
|
|
98611
|
+
if (this.aggregationMode) {
|
|
98527
98612
|
this.isInternalUpdate = true;
|
|
98528
|
-
let emitValue = CascaderUtilsPro.getAggregatedEmitValues(
|
|
98613
|
+
let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
|
|
98529
98614
|
if (!this.isMultiple && emitValue.length > 0) {
|
|
98530
98615
|
emitValue = emitValue[0];
|
|
98531
98616
|
}
|
|
98532
98617
|
this.$emit('input', emitValue);
|
|
98533
98618
|
this.$emit('change', this.getSelectedData());
|
|
98534
|
-
panel.bumpSelectionView();
|
|
98535
98619
|
return;
|
|
98536
98620
|
}
|
|
98537
98621
|
if (selection.isCompactSelection()) {
|
|
98538
|
-
this.selectedItems = this.buildSelectedItemsFromValuesLazy(panel);
|
|
98539
|
-
this.selectedCount = this.aggregationMode ? this.selectedItems.length : selection.size();
|
|
98540
|
-
this.isAllSelected = selection.size() === store.totalLeafCount;
|
|
98541
98622
|
this.isInternalUpdate = true;
|
|
98542
98623
|
this.$emit('input', this.currentValue);
|
|
98543
98624
|
this.$emit('change', this.getSelectedData());
|
|
98544
|
-
panel.bumpSelectionView();
|
|
98545
98625
|
return;
|
|
98546
98626
|
}
|
|
98547
|
-
this.selectedValues = selection.getCheckedPaths();
|
|
98548
|
-
this.updateSelectedItems();
|
|
98549
|
-
panel.bumpSelectionView();
|
|
98550
98627
|
this.$nextTick(() => {
|
|
98551
98628
|
this.isInternalUpdate = true;
|
|
98552
98629
|
let emitValue = this.currentValue;
|
|
@@ -98572,56 +98649,151 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98572
98649
|
syncPanelFromExternalValue() {
|
|
98573
98650
|
const panel = this.$refs.cascaderPanel;
|
|
98574
98651
|
if (!panel || !panel.selection || !panel.store) {
|
|
98575
|
-
return;
|
|
98652
|
+
return false;
|
|
98576
98653
|
}
|
|
98577
|
-
if (!
|
|
98654
|
+
if (!this.hasExternalValue()) {
|
|
98578
98655
|
panel.clearCheckedNodes();
|
|
98579
98656
|
this.selectedItems = [];
|
|
98580
98657
|
this.selectedValues = [];
|
|
98581
|
-
return;
|
|
98658
|
+
return true;
|
|
98582
98659
|
}
|
|
98583
|
-
const paths = this.resolveExternalValueToPaths();
|
|
98584
98660
|
panel.selection.clear();
|
|
98661
|
+
this.applyExternalValueToPanelSelection(panel);
|
|
98662
|
+
panel.selection._reconcileAllRoots();
|
|
98663
|
+
panel.bumpSelectionView();
|
|
98664
|
+
this.refreshSelectionDisplayFromPanel();
|
|
98665
|
+
this.expandPanelToExternalValue(panel);
|
|
98666
|
+
return true;
|
|
98667
|
+
},
|
|
98668
|
+
hasExternalValue() {
|
|
98669
|
+
const val = this.value;
|
|
98670
|
+
if (val == null || val === '') {
|
|
98671
|
+
return false;
|
|
98672
|
+
}
|
|
98673
|
+
if (Array.isArray(val)) {
|
|
98674
|
+
return val.length > 0;
|
|
98675
|
+
}
|
|
98676
|
+
return true;
|
|
98677
|
+
},
|
|
98678
|
+
applyExternalValueToPanelSelection(panel) {
|
|
98679
|
+
const {
|
|
98680
|
+
store,
|
|
98681
|
+
selection
|
|
98682
|
+
} = panel;
|
|
98683
|
+
const paths = this.resolveExternalValueToPaths();
|
|
98585
98684
|
paths.forEach(path => {
|
|
98685
|
+
if (!Array.isArray(path) || path.length === 0) {
|
|
98686
|
+
return;
|
|
98687
|
+
}
|
|
98586
98688
|
const leafValue = path[path.length - 1];
|
|
98587
|
-
|
|
98588
|
-
|
|
98689
|
+
const leafPath = getStoreLeafPath(store, leafValue);
|
|
98690
|
+
if (leafPath) {
|
|
98691
|
+
selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
98692
|
+
}
|
|
98693
|
+
});
|
|
98694
|
+
|
|
98695
|
+
// 直接按外部 value 再补一遍,避免 paths 解析遗漏(聚合父节点、异步 options 等)
|
|
98696
|
+
this.getExternalValueList().forEach(val => {
|
|
98697
|
+
if (this.aggregationMode && CascaderUtilsPro.isParentNodeValue(val, this.parentNodePrefix)) {
|
|
98698
|
+
const actualValue = CascaderUtilsPro.extractParentNodeValue(val, this.parentNodePrefix);
|
|
98699
|
+
const node = resolveStoreNodeByValue(store, actualValue);
|
|
98700
|
+
if (node && !node.isLeaf) {
|
|
98701
|
+
node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
|
|
98702
|
+
}
|
|
98703
|
+
return;
|
|
98704
|
+
}
|
|
98705
|
+
const leafPath = getStoreLeafPath(store, val);
|
|
98706
|
+
if (leafPath) {
|
|
98707
|
+
selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
98708
|
+
return;
|
|
98709
|
+
}
|
|
98710
|
+
const node = resolveStoreNodeByValue(store, val);
|
|
98711
|
+
if (node && node.isLeaf) {
|
|
98712
|
+
selection.selectedLeafSet.add(node.value);
|
|
98713
|
+
} else if (node && !node.isLeaf) {
|
|
98714
|
+
node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
|
|
98715
|
+
}
|
|
98716
|
+
});
|
|
98717
|
+
},
|
|
98718
|
+
getExternalValueList() {
|
|
98719
|
+
const val = this.value;
|
|
98720
|
+
if (val == null || val === '') {
|
|
98721
|
+
return [];
|
|
98722
|
+
}
|
|
98723
|
+
if (Array.isArray(val)) {
|
|
98724
|
+
if (val.length === 0) {
|
|
98725
|
+
return [];
|
|
98726
|
+
}
|
|
98727
|
+
if (Array.isArray(val[0])) {
|
|
98728
|
+
return val.map(path => path[path.length - 1]);
|
|
98729
|
+
}
|
|
98730
|
+
return val;
|
|
98731
|
+
}
|
|
98732
|
+
return [val];
|
|
98733
|
+
},
|
|
98734
|
+
clearPanelSyncTimer() {
|
|
98735
|
+
if (this.panelSyncTimer) {
|
|
98736
|
+
clearTimeout(this.panelSyncTimer);
|
|
98737
|
+
this.panelSyncTimer = null;
|
|
98738
|
+
}
|
|
98739
|
+
},
|
|
98740
|
+
schedulePanelSyncFromExternalValue(retry = 0) {
|
|
98741
|
+
this.clearPanelSyncTimer();
|
|
98742
|
+
this.$nextTick(() => {
|
|
98743
|
+
if (!this.hasExternalValue()) {
|
|
98744
|
+
const panel = this.$refs.cascaderPanel;
|
|
98745
|
+
if (panel && panel.selection) {
|
|
98746
|
+
panel.clearCheckedNodes();
|
|
98747
|
+
}
|
|
98748
|
+
this.selectedItems = [];
|
|
98749
|
+
this.selectedValues = [];
|
|
98750
|
+
return;
|
|
98751
|
+
}
|
|
98752
|
+
const synced = this.syncPanelFromExternalValue();
|
|
98753
|
+
if (!synced && retry < 20) {
|
|
98754
|
+
this.panelSyncTimer = setTimeout(() => {
|
|
98755
|
+
this.schedulePanelSyncFromExternalValue(retry + 1);
|
|
98756
|
+
}, 50);
|
|
98589
98757
|
}
|
|
98590
98758
|
});
|
|
98591
|
-
panel.selection._reconcileAllRoots();
|
|
98592
|
-
panel.bumpSelectionView();
|
|
98593
|
-
this.applyPanelSelectionChange();
|
|
98594
|
-
this.expandPanelToExternalValue(panel);
|
|
98595
98759
|
},
|
|
98596
98760
|
resolveExternalValueToPaths() {
|
|
98597
|
-
|
|
98761
|
+
const val = this.value;
|
|
98762
|
+
if (val == null || val === '') {
|
|
98598
98763
|
return [];
|
|
98599
98764
|
}
|
|
98600
|
-
if (
|
|
98765
|
+
if (Array.isArray(val) && val.length > 0 && Array.isArray(val[0])) {
|
|
98766
|
+
return [...val];
|
|
98767
|
+
}
|
|
98768
|
+
const values = Array.isArray(val) ? val : [val];
|
|
98769
|
+
if (typeof values[0] === 'string' || typeof values[0] === 'number') {
|
|
98601
98770
|
if (this.aggregationMode) {
|
|
98602
|
-
return CascaderUtilsPro.processValuesWithParentNodes(
|
|
98771
|
+
return CascaderUtilsPro.processValuesWithParentNodes(values, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
98603
98772
|
}
|
|
98604
|
-
return this.findPathsByValues(
|
|
98773
|
+
return this.findPathsByValues(values);
|
|
98605
98774
|
}
|
|
98606
|
-
return [...
|
|
98775
|
+
return Array.isArray(val) ? [...val] : [];
|
|
98607
98776
|
},
|
|
98608
98777
|
expandPanelToExternalValue(panel) {
|
|
98609
|
-
if (!panel || !panel.store || !
|
|
98778
|
+
if (!panel || !panel.store || !this.hasExternalValue()) {
|
|
98610
98779
|
return;
|
|
98611
98780
|
}
|
|
98612
|
-
const
|
|
98781
|
+
const values = this.getExternalValueList();
|
|
98782
|
+
const firstValue = values[0];
|
|
98613
98783
|
let pathValues = [];
|
|
98614
98784
|
if (this.aggregationMode && CascaderUtilsPro.isParentNodeValue(firstValue, this.parentNodePrefix)) {
|
|
98615
98785
|
const actualValue = CascaderUtilsPro.extractParentNodeValue(firstValue, this.parentNodePrefix);
|
|
98616
|
-
const node = panel.store
|
|
98786
|
+
const node = resolveStoreNodeByValue(panel.store, actualValue);
|
|
98617
98787
|
pathValues = node ? [...node.path] : [];
|
|
98618
|
-
} else if (panel.store.pathByLeafValue.has(firstValue)) {
|
|
98619
|
-
const path = panel.store.pathByLeafValue.get(firstValue);
|
|
98620
|
-
pathValues = path ? path.slice(0, -1) : [];
|
|
98621
98788
|
} else {
|
|
98622
|
-
const
|
|
98623
|
-
if (
|
|
98624
|
-
pathValues =
|
|
98789
|
+
const leafPath = getStoreLeafPath(panel.store, firstValue);
|
|
98790
|
+
if (leafPath) {
|
|
98791
|
+
pathValues = leafPath.slice(0, -1);
|
|
98792
|
+
} else {
|
|
98793
|
+
const node = resolveStoreNodeByValue(panel.store, firstValue);
|
|
98794
|
+
if (node) {
|
|
98795
|
+
pathValues = node.isLeaf ? node.path.slice(0, -1) : [...node.path];
|
|
98796
|
+
}
|
|
98625
98797
|
}
|
|
98626
98798
|
}
|
|
98627
98799
|
if (pathValues.length > 0) {
|
|
@@ -98642,11 +98814,15 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98642
98814
|
},
|
|
98643
98815
|
// 处理 value 值
|
|
98644
98816
|
processValue() {
|
|
98817
|
+
if (!this.hasExternalValue()) {
|
|
98818
|
+
this.selectedValues = [];
|
|
98819
|
+
this.selectedItems = [];
|
|
98820
|
+
this.schedulePanelSyncFromExternalValue();
|
|
98821
|
+
return;
|
|
98822
|
+
}
|
|
98645
98823
|
if (this.useCompactSelection && this.isMultiple) {
|
|
98646
98824
|
this.selectedValues = [];
|
|
98647
|
-
this
|
|
98648
|
-
this.syncPanelFromExternalValue();
|
|
98649
|
-
});
|
|
98825
|
+
this.schedulePanelSyncFromExternalValue();
|
|
98650
98826
|
return;
|
|
98651
98827
|
}
|
|
98652
98828
|
if (this.isMultiple) {
|
|
@@ -98688,27 +98864,14 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98688
98864
|
this.selectedValues = [];
|
|
98689
98865
|
}
|
|
98690
98866
|
}
|
|
98691
|
-
this.
|
|
98692
|
-
|
|
98693
|
-
// 单选模式下,确保级联面板正确显示选中状态
|
|
98694
|
-
if (!this.isMultiple && this.selectedValues.length > 0) {
|
|
98695
|
-
this.$nextTick(() => {
|
|
98696
|
-
const panel = this.$refs.cascaderPanel;
|
|
98697
|
-
if (panel) {
|
|
98698
|
-
panel.syncCheckedValue();
|
|
98699
|
-
this.updateSelectedItems();
|
|
98700
|
-
}
|
|
98701
|
-
});
|
|
98702
|
-
}
|
|
98867
|
+
this.schedulePanelSyncFromExternalValue();
|
|
98703
98868
|
},
|
|
98704
98869
|
// 初始化选项数据
|
|
98705
98870
|
initOptions() {
|
|
98706
98871
|
this.filteredOptions = this.processOptions(this.options);
|
|
98707
98872
|
this.countTotalItems();
|
|
98708
|
-
if (this.
|
|
98709
|
-
this
|
|
98710
|
-
this.syncPanelFromExternalValue();
|
|
98711
|
-
});
|
|
98873
|
+
if (this.hasExternalValue()) {
|
|
98874
|
+
this.schedulePanelSyncFromExternalValue();
|
|
98712
98875
|
} else {
|
|
98713
98876
|
this.updateSelectedItems();
|
|
98714
98877
|
}
|
|
@@ -98891,23 +99054,23 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98891
99054
|
const panel = this.$refs.cascaderPanel;
|
|
98892
99055
|
if (panel && panel.selection) {
|
|
98893
99056
|
if (item.isAggregated) {
|
|
98894
|
-
const node = panel.store
|
|
99057
|
+
const node = resolveStoreNodeByValue(panel.store, item.value);
|
|
98895
99058
|
if (node) {
|
|
98896
99059
|
panel.selection.toggleNode(node.id, false);
|
|
98897
99060
|
}
|
|
98898
99061
|
} else if (item.path && item.path.length > 0) {
|
|
98899
99062
|
const leafValue = item.path[item.path.length - 1];
|
|
98900
|
-
const leafNode = panel.store
|
|
99063
|
+
const leafNode = resolveStoreNodeByValue(panel.store, leafValue);
|
|
98901
99064
|
if (leafNode) {
|
|
98902
99065
|
panel.selection.toggleNode(leafNode.id, false);
|
|
98903
99066
|
} else {
|
|
98904
|
-
const node = panel.store
|
|
99067
|
+
const node = resolveStoreNodeByValue(panel.store, item.value);
|
|
98905
99068
|
if (node) {
|
|
98906
99069
|
panel.selection.toggleNode(node.id, false);
|
|
98907
99070
|
}
|
|
98908
99071
|
}
|
|
98909
99072
|
} else {
|
|
98910
|
-
const node = panel.store
|
|
99073
|
+
const node = resolveStoreNodeByValue(panel.store, item.value);
|
|
98911
99074
|
if (node) {
|
|
98912
99075
|
panel.selection.toggleNode(node.id, false);
|
|
98913
99076
|
}
|
|
@@ -99039,7 +99202,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99039
99202
|
this.selectedValues = [];
|
|
99040
99203
|
}
|
|
99041
99204
|
}
|
|
99042
|
-
this.
|
|
99205
|
+
this.schedulePanelSyncFromExternalValue();
|
|
99043
99206
|
},
|
|
99044
99207
|
// 根据values找到对应的路径
|
|
99045
99208
|
findPathsByValues(values) {
|
|
@@ -99047,7 +99210,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99047
99210
|
const findPath = (options, targetValues, currentPath = []) => {
|
|
99048
99211
|
for (const option of options) {
|
|
99049
99212
|
const newPath = [...currentPath, option[this.cascaderProps.value]];
|
|
99050
|
-
if (targetValues.
|
|
99213
|
+
if (targetValues.some(target => target == option[this.cascaderProps.value])) {
|
|
99051
99214
|
// 如果是叶子节点(没有children属性),添加到路径中
|
|
99052
99215
|
if (!option[this.cascaderProps.children]) {
|
|
99053
99216
|
paths.push(newPath);
|
|
@@ -99093,8 +99256,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99093
99256
|
if (panel && panel.selection && panel.store) {
|
|
99094
99257
|
matchedPaths.forEach(path => {
|
|
99095
99258
|
const leafValue = path[path.length - 1];
|
|
99096
|
-
|
|
99097
|
-
|
|
99259
|
+
const leafPath = getStoreLeafPath(panel.store, leafValue);
|
|
99260
|
+
if (leafPath) {
|
|
99261
|
+
panel.selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
|
|
99098
99262
|
}
|
|
99099
99263
|
});
|
|
99100
99264
|
panel.selection._reconcileAllRoots();
|
|
@@ -99197,8 +99361,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99197
99361
|
;
|
|
99198
99362
|
var ByCascaderPanelPro_component = normalizeComponent(
|
|
99199
99363
|
cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
|
|
99200
|
-
|
|
99201
|
-
|
|
99364
|
+
ByCascaderPanelProvue_type_template_id_37aef47d_render,
|
|
99365
|
+
ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns,
|
|
99202
99366
|
false,
|
|
99203
99367
|
null,
|
|
99204
99368
|
null,
|