@weitutech/by-components 1.2.1 → 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.
@@ -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=804df886
96019
- var ByCascaderPanelProvue_type_template_id_804df886_render = function render() {
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', {
@@ -96258,8 +96258,215 @@ var ByCascaderPanelProvue_type_template_id_804df886_render = function render() {
96258
96258
  staticClass: "empty-state"
96259
96259
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96260
96260
  };
96261
- var ByCascaderPanelProvue_type_template_id_804df886_staticRenderFns = [];
96261
+ var ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns = [];
96262
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 || []);
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
+ }
96263
96470
  ;// ./src/components/cascader-panel-pro/cascaderUtilsPro.js
96264
96471
 
96265
96472
 
@@ -96279,6 +96486,7 @@ var ByCascaderPanelProvue_type_template_id_804df886_staticRenderFns = [];
96279
96486
  /**
96280
96487
  * 级联选择器工具类(Pro 版,独立于 CascaderUtils)
96281
96488
  */
96489
+
96282
96490
  class CascaderUtilsPro {
96283
96491
  /**
96284
96492
  * 估算级联节点标签文本宽度(px)
@@ -96621,14 +96829,14 @@ class CascaderUtilsPro {
96621
96829
  }
96622
96830
  const items = [];
96623
96831
  selection.selectedLeafSet.forEach(leafValue => {
96624
- const path = store.pathByLeafValue.get(leafValue);
96625
- const node = store.nodeByValue.get(leafValue);
96832
+ const path = getStoreLeafPath(store, leafValue);
96833
+ const node = resolveStoreNodeByValue(store, leafValue);
96626
96834
  if (!path || !node) {
96627
96835
  return;
96628
96836
  }
96629
96837
  items.push({
96630
96838
  ...node.raw,
96631
- value: leafValue,
96839
+ value: node.value,
96632
96840
  label: node.label,
96633
96841
  path
96634
96842
  });
@@ -96752,7 +96960,7 @@ class CascaderUtilsPro {
96752
96960
  const items = [];
96753
96961
  const walk = nodeId => {
96754
96962
  const node = store.nodeById.get(nodeId);
96755
- if (!node || node.disabled) {
96963
+ if (!node) {
96756
96964
  return;
96757
96965
  }
96758
96966
  const state = selection.getCheckState(nodeId);
@@ -97000,7 +97208,7 @@ class CascaderUtilsPro {
97000
97208
  const findPath = (nodes, targetValues, currentPath = []) => {
97001
97209
  for (const option of nodes) {
97002
97210
  const newPath = [...currentPath, option[cascaderProps.value]];
97003
- if (targetValues.includes(option[cascaderProps.value])) {
97211
+ if (targetValues.some(target => target == option[cascaderProps.value])) {
97004
97212
  // 如果是叶子节点(没有children属性),添加到路径中
97005
97213
  if (!option[cascaderProps.children]) {
97006
97214
  paths.push(newPath);
@@ -97265,170 +97473,6 @@ var VirtualList_component = normalizeComponent(
97265
97473
  )
97266
97474
 
97267
97475
  /* harmony default export */ var VirtualList = (VirtualList_component.exports);
97268
- ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
97269
-
97270
-
97271
-
97272
-
97273
-
97274
-
97275
- /**
97276
- * 级联树扁平化存储,初始化时预计算子树叶子元数据,供 O(1) 级勾选/聚合
97277
- */
97278
-
97279
- let nodeIdSeed = 0;
97280
- function nextId() {
97281
- nodeIdSeed += 1;
97282
- return nodeIdSeed;
97283
- }
97284
- function resetCascaderStoreIdSeed() {
97285
- nodeIdSeed = 0;
97286
- }
97287
-
97288
- /**
97289
- * @param {Array} options
97290
- * @param {Object} config - disabledField/disabledValue/disabledCheck
97291
- * @param {Object} cascaderProps
97292
- * @param {Object} utils - CascaderUtilsPro
97293
- */
97294
- function buildCascaderStore(options, config, cascaderProps, utils) {
97295
- resetCascaderStoreIdSeed();
97296
- const valueKey = cascaderProps.value || 'value';
97297
- const labelKey = cascaderProps.label || 'label';
97298
- const childrenKey = cascaderProps.children || 'children';
97299
- const disabledKey = cascaderProps.disabled || 'disabled';
97300
- const nodes = [];
97301
- const nodeById = new Map();
97302
- const nodeByValue = new Map();
97303
- const childrenByParentId = new Map();
97304
- const rootIds = [];
97305
- const pathByLeafValue = new Map();
97306
- const allLeafValues = [];
97307
- const allLeafPaths = [];
97308
- const createNode = (raw, parentPath, level, parentId) => {
97309
- const value = raw[valueKey];
97310
- const children = raw[childrenKey];
97311
- const hasChildren = Array.isArray(children) && children.length > 0;
97312
- const id = nextId();
97313
- const nodePath = parentId == null ? [value] : parentPath.concat(value);
97314
- const node = {
97315
- id,
97316
- value,
97317
- label: raw[labelKey],
97318
- path: nodePath,
97319
- level,
97320
- parentId,
97321
- childIds: [],
97322
- isLeaf: !hasChildren,
97323
- disabled: !!raw[disabledKey],
97324
- raw,
97325
- descendantLeafValues: [],
97326
- descendantLeafCount: 0,
97327
- descendantPaths: []
97328
- };
97329
- nodes.push(node);
97330
- nodeById.set(id, node);
97331
- if (!nodeByValue.has(value)) {
97332
- nodeByValue.set(value, node);
97333
- }
97334
- if (parentId == null) {
97335
- rootIds.push(id);
97336
- } else {
97337
- const siblings = childrenByParentId.get(parentId) || [];
97338
- siblings.push(id);
97339
- childrenByParentId.set(parentId, siblings);
97340
- const parent = nodeById.get(parentId);
97341
- if (parent) {
97342
- parent.childIds.push(id);
97343
- }
97344
- }
97345
- if (hasChildren) {
97346
- children.forEach(child => {
97347
- createNode(child, nodePath, level + 1, id);
97348
- });
97349
- } else if (!node.disabled) {
97350
- pathByLeafValue.set(value, nodePath);
97351
- allLeafValues.push(value);
97352
- allLeafPaths.push(nodePath);
97353
- }
97354
- return node;
97355
- };
97356
- const walkRoots = (items, ancestorDisabled = false) => {
97357
- items.forEach(item => {
97358
- const isDisabled = ancestorDisabled || utils.isItemDisabled(item, config);
97359
- const cloned = {
97360
- ...item
97361
- };
97362
- if (isDisabled) {
97363
- cloned[disabledKey] = true;
97364
- }
97365
- createNode(cloned, [], 0, null);
97366
- });
97367
- };
97368
- walkRoots(options || []);
97369
-
97370
- // 自底向上汇总子树叶子
97371
- const sorted = nodes.slice().sort((a, b) => b.level - a.level);
97372
- sorted.forEach(node => {
97373
- if (node.isLeaf) {
97374
- if (!node.disabled) {
97375
- node.descendantLeafValues = [node.value];
97376
- node.descendantLeafCount = 1;
97377
- node.descendantPaths = [node.path];
97378
- }
97379
- return;
97380
- }
97381
- const leafValues = [];
97382
- const leafPaths = [];
97383
- node.childIds.forEach(childId => {
97384
- const child = nodeById.get(childId);
97385
- if (!child || child.descendantLeafCount === 0) {
97386
- return;
97387
- }
97388
- leafValues.push(...child.descendantLeafValues);
97389
- leafPaths.push(...child.descendantPaths);
97390
- });
97391
- node.descendantLeafValues = leafValues;
97392
- node.descendantLeafCount = leafValues.length;
97393
- node.descendantPaths = leafPaths;
97394
- });
97395
- return {
97396
- nodes,
97397
- nodeById,
97398
- nodeByValue,
97399
- childrenByParentId,
97400
- rootIds,
97401
- pathByLeafValue,
97402
- allLeafValues,
97403
- allLeafPaths,
97404
- totalLeafCount: allLeafPaths.length
97405
- };
97406
- }
97407
- function getStoreChildren(store, parentId) {
97408
- if (parentId == null) {
97409
- return store.rootIds.map(id => store.nodeById.get(id)).filter(Boolean);
97410
- }
97411
- const childIds = store.childrenByParentId.get(parentId) || [];
97412
- return childIds.map(id => store.nodeById.get(id)).filter(Boolean);
97413
- }
97414
- function findStoreNodeByPath(store, pathValues) {
97415
- if (!pathValues || pathValues.length === 0) {
97416
- return null;
97417
- }
97418
- let node = store.nodeByValue.get(pathValues[0]);
97419
- if (!node || pathValues.length === 1) {
97420
- return node;
97421
- }
97422
- for (let i = 1; i < pathValues.length; i++) {
97423
- const target = pathValues[i];
97424
- const children = getStoreChildren(store, node.id);
97425
- node = children.find(child => child.value == target) || null;
97426
- if (!node) {
97427
- return null;
97428
- }
97429
- }
97430
- return node;
97431
- }
97432
97476
  ;// ./src/components/cascader-panel-pro/selectionStatePro.js
97433
97477
 
97434
97478
 
@@ -97440,6 +97484,7 @@ function findStoreNodeByPath(store, pathValues) {
97440
97484
 
97441
97485
 
97442
97486
 
97487
+
97443
97488
  const COMPACT_EMIT_THRESHOLD = 300;
97444
97489
 
97445
97490
  class SelectionStatePro {
@@ -97604,32 +97649,40 @@ class SelectionStatePro {
97604
97649
  return;
97605
97650
  }
97606
97651
  const leafValue = path[path.length - 1];
97607
- if (this.store.pathByLeafValue.has(leafValue)) {
97608
- this.selectedLeafSet.add(leafValue);
97652
+ const leafPath = getStoreLeafPath(this.store, leafValue);
97653
+ if (leafPath) {
97654
+ this.selectedLeafSet.add(leafPath[leafPath.length - 1]);
97609
97655
  }
97610
97656
  });
97611
97657
  this._reconcileAllRoots();
97612
97658
  }
97613
97659
  getCheckState(nodeId) {
97614
97660
  const node = this.store.nodeById.get(nodeId);
97615
- if (!node || node.disabled) {
97661
+ if (!node) {
97616
97662
  return 'disabled';
97617
97663
  }
97664
+ let selectionState;
97618
97665
  if (node.isLeaf) {
97619
- return this.selectedLeafSet.has(node.value) ? 'checked' : 'unchecked';
97620
- }
97621
- const total = node.descendantLeafCount;
97622
- if (total === 0) {
97623
- return 'unchecked';
97624
- }
97625
- const selected = this.subtreeSelectedCount.get(node.id) || 0;
97626
- if (selected === 0) {
97627
- return 'unchecked';
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
+ }
97628
97681
  }
97629
- if (selected >= total) {
97630
- return 'checked';
97682
+ if (node.disabled && selectionState === 'unchecked') {
97683
+ return 'disabled';
97631
97684
  }
97632
- return 'indeterminate';
97685
+ return selectionState;
97633
97686
  }
97634
97687
  isChecked(nodeId) {
97635
97688
  return this.getCheckState(nodeId) === 'checked';
@@ -97675,8 +97728,8 @@ class SelectionStatePro {
97675
97728
  if (typeof val === 'string' && val.startsWith(prefix)) {
97676
97729
  rootValue = val.substring(prefix.length);
97677
97730
  }
97678
- const node = this.store.nodeByValue.get(rootValue);
97679
- if (node && !node.isLeaf && !node.disabled) {
97731
+ const node = resolveStoreNodeByValue(this.store, rootValue);
97732
+ if (node && !node.isLeaf) {
97680
97733
  node.descendantLeafValues.forEach(v => this.selectedLeafSet.add(v));
97681
97734
  }
97682
97735
  });
@@ -98205,6 +98258,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98205
98258
 
98206
98259
 
98207
98260
 
98261
+
98208
98262
  /* harmony default export */ var ByCascaderPanelProvue_type_script_lang_js = ({
98209
98263
  name: 'ByCascaderPanelPro',
98210
98264
  components: {
@@ -98513,7 +98567,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98513
98567
  this.selectedValues = value && value.length ? [value] : [];
98514
98568
  }
98515
98569
  },
98516
- applyPanelSelectionChange() {
98570
+ refreshSelectionDisplayFromPanel() {
98517
98571
  const panel = this.$refs.cascaderPanel;
98518
98572
  if (!panel || !panel.store || !panel.selection) {
98519
98573
  return;
@@ -98530,29 +98584,46 @@ var VirtualCascaderPanel_component = normalizeComponent(
98530
98584
  if (!selection.isCompactSelection()) {
98531
98585
  this.selectedValues = selection.getCheckedPaths();
98532
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) {
98533
98612
  this.isInternalUpdate = true;
98534
- let emitValue = CascaderUtilsPro.getAggregatedEmitValues(items, this.parentNodePrefix);
98613
+ let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
98535
98614
  if (!this.isMultiple && emitValue.length > 0) {
98536
98615
  emitValue = emitValue[0];
98537
98616
  }
98538
98617
  this.$emit('input', emitValue);
98539
98618
  this.$emit('change', this.getSelectedData());
98540
- panel.bumpSelectionView();
98541
98619
  return;
98542
98620
  }
98543
98621
  if (selection.isCompactSelection()) {
98544
- this.selectedItems = this.buildSelectedItemsFromValuesLazy(panel);
98545
- this.selectedCount = this.aggregationMode ? this.selectedItems.length : selection.size();
98546
- this.isAllSelected = selection.size() === store.totalLeafCount;
98547
98622
  this.isInternalUpdate = true;
98548
98623
  this.$emit('input', this.currentValue);
98549
98624
  this.$emit('change', this.getSelectedData());
98550
- panel.bumpSelectionView();
98551
98625
  return;
98552
98626
  }
98553
- this.selectedValues = selection.getCheckedPaths();
98554
- this.updateSelectedItems();
98555
- panel.bumpSelectionView();
98556
98627
  this.$nextTick(() => {
98557
98628
  this.isInternalUpdate = true;
98558
98629
  let emitValue = this.currentValue;
@@ -98590,7 +98661,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98590
98661
  this.applyExternalValueToPanelSelection(panel);
98591
98662
  panel.selection._reconcileAllRoots();
98592
98663
  panel.bumpSelectionView();
98593
- this.applyPanelSelectionChange();
98664
+ this.refreshSelectionDisplayFromPanel();
98594
98665
  this.expandPanelToExternalValue(panel);
98595
98666
  return true;
98596
98667
  },
@@ -98611,9 +98682,13 @@ var VirtualCascaderPanel_component = normalizeComponent(
98611
98682
  } = panel;
98612
98683
  const paths = this.resolveExternalValueToPaths();
98613
98684
  paths.forEach(path => {
98685
+ if (!Array.isArray(path) || path.length === 0) {
98686
+ return;
98687
+ }
98614
98688
  const leafValue = path[path.length - 1];
98615
- if (store.pathByLeafValue.has(leafValue)) {
98616
- selection.selectedLeafSet.add(leafValue);
98689
+ const leafPath = getStoreLeafPath(store, leafValue);
98690
+ if (leafPath) {
98691
+ selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
98617
98692
  }
98618
98693
  });
98619
98694
 
@@ -98621,20 +98696,21 @@ var VirtualCascaderPanel_component = normalizeComponent(
98621
98696
  this.getExternalValueList().forEach(val => {
98622
98697
  if (this.aggregationMode && CascaderUtilsPro.isParentNodeValue(val, this.parentNodePrefix)) {
98623
98698
  const actualValue = CascaderUtilsPro.extractParentNodeValue(val, this.parentNodePrefix);
98624
- const node = store.nodeByValue.get(actualValue);
98625
- if (node && !node.isLeaf && !node.disabled) {
98699
+ const node = resolveStoreNodeByValue(store, actualValue);
98700
+ if (node && !node.isLeaf) {
98626
98701
  node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
98627
98702
  }
98628
98703
  return;
98629
98704
  }
98630
- if (store.pathByLeafValue.has(val)) {
98631
- selection.selectedLeafSet.add(val);
98705
+ const leafPath = getStoreLeafPath(store, val);
98706
+ if (leafPath) {
98707
+ selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
98632
98708
  return;
98633
98709
  }
98634
- const node = store.nodeByValue.get(val);
98635
- if (node && node.isLeaf && !node.disabled) {
98636
- selection.selectedLeafSet.add(val);
98637
- } else if (node && !node.isLeaf && !node.disabled) {
98710
+ const node = resolveStoreNodeByValue(store, val);
98711
+ if (node && node.isLeaf) {
98712
+ selection.selectedLeafSet.add(node.value);
98713
+ } else if (node && !node.isLeaf) {
98638
98714
  node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
98639
98715
  }
98640
98716
  });
@@ -98707,15 +98783,17 @@ var VirtualCascaderPanel_component = normalizeComponent(
98707
98783
  let pathValues = [];
98708
98784
  if (this.aggregationMode && CascaderUtilsPro.isParentNodeValue(firstValue, this.parentNodePrefix)) {
98709
98785
  const actualValue = CascaderUtilsPro.extractParentNodeValue(firstValue, this.parentNodePrefix);
98710
- const node = panel.store.nodeByValue.get(actualValue);
98786
+ const node = resolveStoreNodeByValue(panel.store, actualValue);
98711
98787
  pathValues = node ? [...node.path] : [];
98712
- } else if (panel.store.pathByLeafValue.has(firstValue)) {
98713
- const path = panel.store.pathByLeafValue.get(firstValue);
98714
- pathValues = path ? path.slice(0, -1) : [];
98715
98788
  } else {
98716
- const node = panel.store.nodeByValue.get(firstValue);
98717
- if (node) {
98718
- pathValues = node.isLeaf ? node.path.slice(0, -1) : [...node.path];
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
+ }
98719
98797
  }
98720
98798
  }
98721
98799
  if (pathValues.length > 0) {
@@ -98976,23 +99054,23 @@ var VirtualCascaderPanel_component = normalizeComponent(
98976
99054
  const panel = this.$refs.cascaderPanel;
98977
99055
  if (panel && panel.selection) {
98978
99056
  if (item.isAggregated) {
98979
- const node = panel.store.nodeByValue.get(item.value);
99057
+ const node = resolveStoreNodeByValue(panel.store, item.value);
98980
99058
  if (node) {
98981
99059
  panel.selection.toggleNode(node.id, false);
98982
99060
  }
98983
99061
  } else if (item.path && item.path.length > 0) {
98984
99062
  const leafValue = item.path[item.path.length - 1];
98985
- const leafNode = panel.store.nodeByValue.get(leafValue);
99063
+ const leafNode = resolveStoreNodeByValue(panel.store, leafValue);
98986
99064
  if (leafNode) {
98987
99065
  panel.selection.toggleNode(leafNode.id, false);
98988
99066
  } else {
98989
- const node = panel.store.nodeByValue.get(item.value);
99067
+ const node = resolveStoreNodeByValue(panel.store, item.value);
98990
99068
  if (node) {
98991
99069
  panel.selection.toggleNode(node.id, false);
98992
99070
  }
98993
99071
  }
98994
99072
  } else {
98995
- const node = panel.store.nodeByValue.get(item.value);
99073
+ const node = resolveStoreNodeByValue(panel.store, item.value);
98996
99074
  if (node) {
98997
99075
  panel.selection.toggleNode(node.id, false);
98998
99076
  }
@@ -99132,7 +99210,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99132
99210
  const findPath = (options, targetValues, currentPath = []) => {
99133
99211
  for (const option of options) {
99134
99212
  const newPath = [...currentPath, option[this.cascaderProps.value]];
99135
- if (targetValues.includes(option[this.cascaderProps.value])) {
99213
+ if (targetValues.some(target => target == option[this.cascaderProps.value])) {
99136
99214
  // 如果是叶子节点(没有children属性),添加到路径中
99137
99215
  if (!option[this.cascaderProps.children]) {
99138
99216
  paths.push(newPath);
@@ -99178,8 +99256,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99178
99256
  if (panel && panel.selection && panel.store) {
99179
99257
  matchedPaths.forEach(path => {
99180
99258
  const leafValue = path[path.length - 1];
99181
- if (panel.store.pathByLeafValue.has(leafValue)) {
99182
- panel.selection.selectedLeafSet.add(leafValue);
99259
+ const leafPath = getStoreLeafPath(panel.store, leafValue);
99260
+ if (leafPath) {
99261
+ panel.selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
99183
99262
  }
99184
99263
  });
99185
99264
  panel.selection._reconcileAllRoots();
@@ -99282,8 +99361,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99282
99361
  ;
99283
99362
  var ByCascaderPanelPro_component = normalizeComponent(
99284
99363
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
99285
- ByCascaderPanelProvue_type_template_id_804df886_render,
99286
- ByCascaderPanelProvue_type_template_id_804df886_staticRenderFns,
99364
+ ByCascaderPanelProvue_type_template_id_37aef47d_render,
99365
+ ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns,
99287
99366
  false,
99288
99367
  null,
99289
99368
  null,