@weitutech/by-components 1.2.2 → 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.
@@ -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=37aef47d
96019
- var ByCascaderPanelProvue_type_template_id_37aef47d_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=075d43fb
96019
+ var ByCascaderPanelProvue_type_template_id_075d43fb_render = function render() {
96020
96020
  var _vm = this,
96021
96021
  _c = _vm._self._c;
96022
96022
  return _c('div', {
@@ -96258,7 +96258,7 @@ var ByCascaderPanelProvue_type_template_id_37aef47d_render = function render() {
96258
96258
  staticClass: "empty-state"
96259
96259
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96260
96260
  };
96261
- var ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns = [];
96261
+ var ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns = [];
96262
96262
 
96263
96263
  ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
96264
96264
 
@@ -96488,6 +96488,44 @@ function findStoreNodeByPath(store, pathValues) {
96488
96488
  */
96489
96489
 
96490
96490
  class CascaderUtilsPro {
96491
+ static isTreeLeafNode(node, cascaderProps) {
96492
+ const childrenKey = cascaderProps && cascaderProps.children || 'children';
96493
+ const children = node[childrenKey];
96494
+ return !Array.isArray(children) || children.length === 0;
96495
+ }
96496
+
96497
+ /**
96498
+ * 将单个外部 value(含 __parent__ 前缀)同步到面板 selection
96499
+ */
96500
+ static addValueToSelection(store, selection, value, options, cascaderProps, prefix = '__parent__') {
96501
+ if (!store || !selection || value == null || value === '') {
96502
+ return;
96503
+ }
96504
+ const isParent = this.isParentNodeValue(value, prefix);
96505
+ const actualValue = isParent ? this.extractParentNodeValue(value, prefix) : value;
96506
+ const node = resolveStoreNodeByValue(store, actualValue);
96507
+ if (node) {
96508
+ if (node.isLeaf) {
96509
+ selection.selectedLeafSet.add(node.value);
96510
+ } else {
96511
+ node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
96512
+ }
96513
+ return;
96514
+ }
96515
+ let paths = isParent ? this.getLeafPathsByParentValue(actualValue, options, cascaderProps) : this.findPathsByValues([actualValue], options, cascaderProps);
96516
+ if (paths.length === 0 && !isParent) {
96517
+ paths = this.getLeafPathsByParentValue(actualValue, options, cascaderProps);
96518
+ }
96519
+ paths.forEach(path => {
96520
+ const leafValue = path[path.length - 1];
96521
+ const leafPath = getStoreLeafPath(store, leafValue);
96522
+ if (leafPath) {
96523
+ selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
96524
+ } else {
96525
+ selection.selectedLeafSet.add(leafValue);
96526
+ }
96527
+ });
96528
+ }
96491
96529
  /**
96492
96530
  * 估算级联节点标签文本宽度(px)
96493
96531
  */
@@ -96750,16 +96788,13 @@ class CascaderUtilsPro {
96750
96788
 
96751
96789
  // 检查当前节点是否禁用
96752
96790
  const isCurrentDisabled = this.isItemDisabled(node, config);
96753
- if (!node[cascaderProps.children]) {
96791
+ if (this.isTreeLeafNode(node, cascaderProps)) {
96754
96792
  // 只包含非禁用项且路径上没有禁选项的叶子节点
96755
96793
  if (!isCurrentDisabled && !this.isPathDisabled(tree, newPath, config, cascaderProps)) {
96756
96794
  paths.push(newPath);
96757
96795
  }
96758
- } else {
96759
- // 如果当前节点禁用,则其所有子节点都不可选
96760
- if (!isCurrentDisabled) {
96761
- traverse(node[cascaderProps.children], newPath);
96762
- }
96796
+ } else if (!isCurrentDisabled) {
96797
+ traverse(node[cascaderProps.children], newPath);
96763
96798
  }
96764
96799
  });
96765
96800
  };
@@ -97149,12 +97184,14 @@ class CascaderUtilsPro {
97149
97184
  for (const node of nodes) {
97150
97185
  const newPath = [...currentPath, node[cascaderProps.value]];
97151
97186
  if (node[cascaderProps.value] == parentValue) {
97152
- // 找到目标非叶子节点,获取其所有叶子节点路径
97153
- this.getAllLeafPaths([node], {}, cascaderProps).forEach(leafPath => {
97154
- // 将叶子节点路径与当前路径合并
97155
- const fullPath = [...currentPath, ...leafPath];
97156
- paths.push(fullPath);
97157
- });
97187
+ if (this.isTreeLeafNode(node, cascaderProps)) {
97188
+ paths.push(newPath);
97189
+ } else {
97190
+ this.getAllLeafPaths([node], {}, cascaderProps).forEach(leafPath => {
97191
+ const fullPath = [...currentPath, ...leafPath];
97192
+ paths.push(fullPath);
97193
+ });
97194
+ }
97158
97195
  return true;
97159
97196
  }
97160
97197
 
@@ -97188,8 +97225,10 @@ class CascaderUtilsPro {
97188
97225
  const leafPaths = this.getLeafPathsByParentValue(actualValue, options, cascaderProps);
97189
97226
  paths.push(...leafPaths);
97190
97227
  } else {
97191
- // 普通值,查找对应的路径
97192
- const valuePaths = this.findPathsByValues([value], options, cascaderProps);
97228
+ let valuePaths = this.findPathsByValues([value], options, cascaderProps);
97229
+ if (valuePaths.length === 0) {
97230
+ valuePaths = this.getLeafPathsByParentValue(value, options, cascaderProps);
97231
+ }
97193
97232
  paths.push(...valuePaths);
97194
97233
  }
97195
97234
  }
@@ -97208,15 +97247,10 @@ class CascaderUtilsPro {
97208
97247
  const findPath = (nodes, targetValues, currentPath = []) => {
97209
97248
  for (const option of nodes) {
97210
97249
  const newPath = [...currentPath, option[cascaderProps.value]];
97211
- if (targetValues.some(target => target == option[cascaderProps.value])) {
97212
- // 如果是叶子节点(没有children属性),添加到路径中
97213
- if (!option[cascaderProps.children]) {
97214
- paths.push(newPath);
97215
- }
97250
+ if (targetValues.some(target => target == option[cascaderProps.value]) && this.isTreeLeafNode(option, cascaderProps)) {
97251
+ paths.push(newPath);
97216
97252
  }
97217
-
97218
- // 递归查找子节点
97219
- if (option[cascaderProps.children] && option[cascaderProps.children].length > 0) {
97253
+ if (!this.isTreeLeafNode(option, cascaderProps)) {
97220
97254
  findPath(option[cascaderProps.children], targetValues, newPath);
97221
97255
  }
97222
97256
  }
@@ -97729,8 +97763,12 @@ class SelectionStatePro {
97729
97763
  rootValue = val.substring(prefix.length);
97730
97764
  }
97731
97765
  const node = resolveStoreNodeByValue(this.store, rootValue);
97732
- if (node && !node.isLeaf) {
97733
- node.descendantLeafValues.forEach(v => this.selectedLeafSet.add(v));
97766
+ if (node) {
97767
+ if (node.isLeaf) {
97768
+ this.selectedLeafSet.add(node.value);
97769
+ } else {
97770
+ node.descendantLeafValues.forEach(v => this.selectedLeafSet.add(v));
97771
+ }
97734
97772
  }
97735
97773
  });
97736
97774
  this._reconcileAllRoots();
@@ -98577,7 +98615,19 @@ var VirtualCascaderPanel_component = normalizeComponent(
98577
98615
  selection
98578
98616
  } = panel;
98579
98617
  if (this.aggregationMode) {
98580
- const items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
98618
+ let items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
98619
+ if (items.length === 0 && selection.size() > 0) {
98620
+ const paths = selection.getCheckedPaths();
98621
+ if (paths.length > 0) {
98622
+ items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
98623
+ }
98624
+ }
98625
+ if (items.length === 0 && this.hasExternalValue()) {
98626
+ const paths = this.resolveExternalValueToPaths();
98627
+ if (paths.length > 0) {
98628
+ items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
98629
+ }
98630
+ }
98581
98631
  this.selectedItems = items;
98582
98632
  this.selectedCount = items.length;
98583
98633
  this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
@@ -98652,13 +98702,18 @@ var VirtualCascaderPanel_component = normalizeComponent(
98652
98702
  return false;
98653
98703
  }
98654
98704
  if (!this.hasExternalValue()) {
98655
- panel.clearCheckedNodes();
98705
+ if (panel.selection) {
98706
+ panel.selection.clear();
98707
+ panel.bumpSelectionView();
98708
+ }
98656
98709
  this.selectedItems = [];
98657
98710
  this.selectedValues = [];
98658
98711
  return true;
98659
98712
  }
98660
98713
  panel.selection.clear();
98661
- this.applyExternalValueToPanelSelection(panel);
98714
+ this.getExternalValueList().forEach(val => {
98715
+ CascaderUtilsPro.addValueToSelection(panel.store, panel.selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
98716
+ });
98662
98717
  panel.selection._reconcileAllRoots();
98663
98718
  panel.bumpSelectionView();
98664
98719
  this.refreshSelectionDisplayFromPanel();
@@ -98680,39 +98735,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
98680
98735
  store,
98681
98736
  selection
98682
98737
  } = panel;
98683
- const paths = this.resolveExternalValueToPaths();
98684
- paths.forEach(path => {
98685
- if (!Array.isArray(path) || path.length === 0) {
98686
- return;
98687
- }
98688
- const leafValue = path[path.length - 1];
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
98738
  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
- }
98739
+ CascaderUtilsPro.addValueToSelection(store, selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
98716
98740
  });
98717
98741
  },
98718
98742
  getExternalValueList() {
@@ -98743,7 +98767,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
98743
98767
  if (!this.hasExternalValue()) {
98744
98768
  const panel = this.$refs.cascaderPanel;
98745
98769
  if (panel && panel.selection) {
98746
- panel.clearCheckedNodes();
98770
+ panel.selection.clear();
98771
+ panel.bumpSelectionView();
98747
98772
  }
98748
98773
  this.selectedItems = [];
98749
98774
  this.selectedValues = [];
@@ -99210,15 +99235,10 @@ var VirtualCascaderPanel_component = normalizeComponent(
99210
99235
  const findPath = (options, targetValues, currentPath = []) => {
99211
99236
  for (const option of options) {
99212
99237
  const newPath = [...currentPath, option[this.cascaderProps.value]];
99213
- if (targetValues.some(target => target == option[this.cascaderProps.value])) {
99214
- // 如果是叶子节点(没有children属性),添加到路径中
99215
- if (!option[this.cascaderProps.children]) {
99216
- paths.push(newPath);
99217
- }
99238
+ if (targetValues.some(target => target == option[this.cascaderProps.value]) && CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
99239
+ paths.push(newPath);
99218
99240
  }
99219
-
99220
- // 递归查找子节点
99221
- if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
99241
+ if (!CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
99222
99242
  findPath(option[this.cascaderProps.children], targetValues, newPath);
99223
99243
  }
99224
99244
  }
@@ -99361,8 +99381,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99361
99381
  ;
99362
99382
  var ByCascaderPanelPro_component = normalizeComponent(
99363
99383
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
99364
- ByCascaderPanelProvue_type_template_id_37aef47d_render,
99365
- ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns,
99384
+ ByCascaderPanelProvue_type_template_id_075d43fb_render,
99385
+ ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns,
99366
99386
  false,
99367
99387
  null,
99368
99388
  null,
@@ -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=37aef47d
96029
- var ByCascaderPanelProvue_type_template_id_37aef47d_render = function render() {
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,7 +96268,7 @@ var ByCascaderPanelProvue_type_template_id_37aef47d_render = function render() {
96268
96268
  staticClass: "empty-state"
96269
96269
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96270
96270
  };
96271
- var ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns = [];
96271
+ var ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns = [];
96272
96272
 
96273
96273
  ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
96274
96274
 
@@ -96498,6 +96498,44 @@ function findStoreNodeByPath(store, pathValues) {
96498
96498
  */
96499
96499
 
96500
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
+ }
96501
96539
  /**
96502
96540
  * 估算级联节点标签文本宽度(px)
96503
96541
  */
@@ -96760,16 +96798,13 @@ class CascaderUtilsPro {
96760
96798
 
96761
96799
  // 检查当前节点是否禁用
96762
96800
  const isCurrentDisabled = this.isItemDisabled(node, config);
96763
- if (!node[cascaderProps.children]) {
96801
+ if (this.isTreeLeafNode(node, cascaderProps)) {
96764
96802
  // 只包含非禁用项且路径上没有禁选项的叶子节点
96765
96803
  if (!isCurrentDisabled && !this.isPathDisabled(tree, newPath, config, cascaderProps)) {
96766
96804
  paths.push(newPath);
96767
96805
  }
96768
- } else {
96769
- // 如果当前节点禁用,则其所有子节点都不可选
96770
- if (!isCurrentDisabled) {
96771
- traverse(node[cascaderProps.children], newPath);
96772
- }
96806
+ } else if (!isCurrentDisabled) {
96807
+ traverse(node[cascaderProps.children], newPath);
96773
96808
  }
96774
96809
  });
96775
96810
  };
@@ -97159,12 +97194,14 @@ class CascaderUtilsPro {
97159
97194
  for (const node of nodes) {
97160
97195
  const newPath = [...currentPath, node[cascaderProps.value]];
97161
97196
  if (node[cascaderProps.value] == parentValue) {
97162
- // 找到目标非叶子节点,获取其所有叶子节点路径
97163
- this.getAllLeafPaths([node], {}, cascaderProps).forEach(leafPath => {
97164
- // 将叶子节点路径与当前路径合并
97165
- const fullPath = [...currentPath, ...leafPath];
97166
- paths.push(fullPath);
97167
- });
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
+ }
97168
97205
  return true;
97169
97206
  }
97170
97207
 
@@ -97198,8 +97235,10 @@ class CascaderUtilsPro {
97198
97235
  const leafPaths = this.getLeafPathsByParentValue(actualValue, options, cascaderProps);
97199
97236
  paths.push(...leafPaths);
97200
97237
  } else {
97201
- // 普通值,查找对应的路径
97202
- const valuePaths = this.findPathsByValues([value], options, cascaderProps);
97238
+ let valuePaths = this.findPathsByValues([value], options, cascaderProps);
97239
+ if (valuePaths.length === 0) {
97240
+ valuePaths = this.getLeafPathsByParentValue(value, options, cascaderProps);
97241
+ }
97203
97242
  paths.push(...valuePaths);
97204
97243
  }
97205
97244
  }
@@ -97218,15 +97257,10 @@ class CascaderUtilsPro {
97218
97257
  const findPath = (nodes, targetValues, currentPath = []) => {
97219
97258
  for (const option of nodes) {
97220
97259
  const newPath = [...currentPath, option[cascaderProps.value]];
97221
- if (targetValues.some(target => target == option[cascaderProps.value])) {
97222
- // 如果是叶子节点(没有children属性),添加到路径中
97223
- if (!option[cascaderProps.children]) {
97224
- paths.push(newPath);
97225
- }
97260
+ if (targetValues.some(target => target == option[cascaderProps.value]) && this.isTreeLeafNode(option, cascaderProps)) {
97261
+ paths.push(newPath);
97226
97262
  }
97227
-
97228
- // 递归查找子节点
97229
- if (option[cascaderProps.children] && option[cascaderProps.children].length > 0) {
97263
+ if (!this.isTreeLeafNode(option, cascaderProps)) {
97230
97264
  findPath(option[cascaderProps.children], targetValues, newPath);
97231
97265
  }
97232
97266
  }
@@ -97739,8 +97773,12 @@ class SelectionStatePro {
97739
97773
  rootValue = val.substring(prefix.length);
97740
97774
  }
97741
97775
  const node = resolveStoreNodeByValue(this.store, rootValue);
97742
- if (node && !node.isLeaf) {
97743
- node.descendantLeafValues.forEach(v => this.selectedLeafSet.add(v));
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
+ }
97744
97782
  }
97745
97783
  });
97746
97784
  this._reconcileAllRoots();
@@ -98587,7 +98625,19 @@ var VirtualCascaderPanel_component = normalizeComponent(
98587
98625
  selection
98588
98626
  } = panel;
98589
98627
  if (this.aggregationMode) {
98590
- const items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
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
+ }
98591
98641
  this.selectedItems = items;
98592
98642
  this.selectedCount = items.length;
98593
98643
  this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
@@ -98662,13 +98712,18 @@ var VirtualCascaderPanel_component = normalizeComponent(
98662
98712
  return false;
98663
98713
  }
98664
98714
  if (!this.hasExternalValue()) {
98665
- panel.clearCheckedNodes();
98715
+ if (panel.selection) {
98716
+ panel.selection.clear();
98717
+ panel.bumpSelectionView();
98718
+ }
98666
98719
  this.selectedItems = [];
98667
98720
  this.selectedValues = [];
98668
98721
  return true;
98669
98722
  }
98670
98723
  panel.selection.clear();
98671
- this.applyExternalValueToPanelSelection(panel);
98724
+ this.getExternalValueList().forEach(val => {
98725
+ CascaderUtilsPro.addValueToSelection(panel.store, panel.selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
98726
+ });
98672
98727
  panel.selection._reconcileAllRoots();
98673
98728
  panel.bumpSelectionView();
98674
98729
  this.refreshSelectionDisplayFromPanel();
@@ -98690,39 +98745,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
98690
98745
  store,
98691
98746
  selection
98692
98747
  } = panel;
98693
- const paths = this.resolveExternalValueToPaths();
98694
- paths.forEach(path => {
98695
- if (!Array.isArray(path) || path.length === 0) {
98696
- return;
98697
- }
98698
- const leafValue = path[path.length - 1];
98699
- const leafPath = getStoreLeafPath(store, leafValue);
98700
- if (leafPath) {
98701
- selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
98702
- }
98703
- });
98704
-
98705
- // 直接按外部 value 再补一遍,避免 paths 解析遗漏(聚合父节点、异步 options 等)
98706
98748
  this.getExternalValueList().forEach(val => {
98707
- if (this.aggregationMode && CascaderUtilsPro.isParentNodeValue(val, this.parentNodePrefix)) {
98708
- const actualValue = CascaderUtilsPro.extractParentNodeValue(val, this.parentNodePrefix);
98709
- const node = resolveStoreNodeByValue(store, actualValue);
98710
- if (node && !node.isLeaf) {
98711
- node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
98712
- }
98713
- return;
98714
- }
98715
- const leafPath = getStoreLeafPath(store, val);
98716
- if (leafPath) {
98717
- selection.selectedLeafSet.add(leafPath[leafPath.length - 1]);
98718
- return;
98719
- }
98720
- const node = resolveStoreNodeByValue(store, val);
98721
- if (node && node.isLeaf) {
98722
- selection.selectedLeafSet.add(node.value);
98723
- } else if (node && !node.isLeaf) {
98724
- node.descendantLeafValues.forEach(leaf => selection.selectedLeafSet.add(leaf));
98725
- }
98749
+ CascaderUtilsPro.addValueToSelection(store, selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
98726
98750
  });
98727
98751
  },
98728
98752
  getExternalValueList() {
@@ -98753,7 +98777,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
98753
98777
  if (!this.hasExternalValue()) {
98754
98778
  const panel = this.$refs.cascaderPanel;
98755
98779
  if (panel && panel.selection) {
98756
- panel.clearCheckedNodes();
98780
+ panel.selection.clear();
98781
+ panel.bumpSelectionView();
98757
98782
  }
98758
98783
  this.selectedItems = [];
98759
98784
  this.selectedValues = [];
@@ -99220,15 +99245,10 @@ var VirtualCascaderPanel_component = normalizeComponent(
99220
99245
  const findPath = (options, targetValues, currentPath = []) => {
99221
99246
  for (const option of options) {
99222
99247
  const newPath = [...currentPath, option[this.cascaderProps.value]];
99223
- if (targetValues.some(target => target == option[this.cascaderProps.value])) {
99224
- // 如果是叶子节点(没有children属性),添加到路径中
99225
- if (!option[this.cascaderProps.children]) {
99226
- paths.push(newPath);
99227
- }
99248
+ if (targetValues.some(target => target == option[this.cascaderProps.value]) && CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
99249
+ paths.push(newPath);
99228
99250
  }
99229
-
99230
- // 递归查找子节点
99231
- if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
99251
+ if (!CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
99232
99252
  findPath(option[this.cascaderProps.children], targetValues, newPath);
99233
99253
  }
99234
99254
  }
@@ -99371,8 +99391,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99371
99391
  ;
99372
99392
  var ByCascaderPanelPro_component = normalizeComponent(
99373
99393
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
99374
- ByCascaderPanelProvue_type_template_id_37aef47d_render,
99375
- ByCascaderPanelProvue_type_template_id_37aef47d_staticRenderFns,
99394
+ ByCascaderPanelProvue_type_template_id_075d43fb_render,
99395
+ ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns,
99376
99396
  false,
99377
99397
  null,
99378
99398
  null,