@weitutech/by-components 1.2.3 → 1.2.4

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=075d43fb
96019
- var ByCascaderPanelProvue_type_template_id_075d43fb_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=e4b10a08
96019
+ var ByCascaderPanelProvue_type_template_id_e4b10a08_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_075d43fb_render = function render() {
96258
96258
  staticClass: "empty-state"
96259
96259
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96260
96260
  };
96261
- var ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns = [];
96261
+ var ByCascaderPanelProvue_type_template_id_e4b10a08_staticRenderFns = [];
96262
96262
 
96263
96263
  ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
96264
96264
 
@@ -98432,7 +98432,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
98432
98432
  // 紧凑模式下稳定的空 value 引用,避免 watch 误触发清空
98433
98433
  searchDebounceTimer: null,
98434
98434
  searchLeafSetCache: null,
98435
- panelSyncTimer: null
98435
+ panelSyncTimer: null,
98436
+ // 外部 v-model 回显同步中,避免与用户操作冲突
98437
+ isExternalSync: false
98436
98438
  };
98437
98439
  },
98438
98440
  computed: {
@@ -98567,6 +98569,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
98567
98569
  } else {
98568
98570
  this.isAllSelected = this.selectedCount === this.totalCount;
98569
98571
  }
98572
+ } else if (panel && panel.store && panel.selection && this.aggregationMode) {
98573
+ this.isAllSelected = panel.selection.size() === panel.store.totalLeafCount && panel.store.totalLeafCount > 0;
98570
98574
  }
98571
98575
  } else {
98572
98576
  if (newVal.length > 1) {
@@ -98616,18 +98620,12 @@ var VirtualCascaderPanel_component = normalizeComponent(
98616
98620
  } = panel;
98617
98621
  if (this.aggregationMode) {
98618
98622
  let items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
98619
- if (items.length === 0 && selection.size() > 0) {
98623
+ if (items.length === 0 && selection.size() > 0 && !selection.isCompactSelection()) {
98620
98624
  const paths = selection.getCheckedPaths();
98621
98625
  if (paths.length > 0) {
98622
98626
  items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
98623
98627
  }
98624
98628
  }
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
- }
98631
98629
  this.selectedItems = items;
98632
98630
  this.selectedCount = items.length;
98633
98631
  this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
@@ -98648,18 +98646,18 @@ var VirtualCascaderPanel_component = normalizeComponent(
98648
98646
  this.updateSelectedItems();
98649
98647
  panel.bumpSelectionView();
98650
98648
  },
98651
- applyPanelSelectionChange() {
98652
- const panel = this.$refs.cascaderPanel;
98653
- if (!panel || !panel.store || !panel.selection) {
98654
- return;
98655
- }
98656
- const {
98657
- store,
98658
- selection
98659
- } = panel;
98660
- this.refreshSelectionDisplayFromPanel();
98649
+ /**
98650
+ * 用户操作(勾选/全选/清除/删除)统一提交:更新展示 + emit,标记内部更新防回显覆盖
98651
+ */
98652
+ commitUserSelectionChange() {
98653
+ this.isInternalUpdate = true;
98654
+ this.applyPanelSelectionChange();
98655
+ },
98656
+ /**
98657
+ * 向父组件 emit 当前选中(仅用户操作路径调用,外部回显走 syncPanelFromExternalValue 不 emit)
98658
+ */
98659
+ emitSelectionToParent() {
98661
98660
  if (this.aggregationMode) {
98662
- this.isInternalUpdate = true;
98663
98661
  let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
98664
98662
  if (!this.isMultiple && emitValue.length > 0) {
98665
98663
  emitValue = emitValue[0];
@@ -98668,25 +98666,28 @@ var VirtualCascaderPanel_component = normalizeComponent(
98668
98666
  this.$emit('change', this.getSelectedData());
98669
98667
  return;
98670
98668
  }
98671
- if (selection.isCompactSelection()) {
98672
- this.isInternalUpdate = true;
98669
+ const panel = this.$refs.cascaderPanel;
98670
+ const isCompact = panel && panel.selection && panel.selection.isCompactSelection();
98671
+ if (isCompact) {
98673
98672
  this.$emit('input', this.currentValue);
98674
98673
  this.$emit('change', this.getSelectedData());
98675
98674
  return;
98676
98675
  }
98677
98676
  this.$nextTick(() => {
98678
- this.isInternalUpdate = true;
98679
98677
  let emitValue = this.currentValue;
98680
- if (this.aggregationMode) {
98681
- emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
98682
- if (!this.isMultiple && emitValue.length > 0) {
98683
- emitValue = emitValue[0];
98684
- }
98685
- }
98686
98678
  this.$emit('input', emitValue);
98687
98679
  this.$emit('change', this.getSelectedData());
98688
98680
  });
98689
98681
  },
98682
+ applyPanelSelectionChange() {
98683
+ const panel = this.$refs.cascaderPanel;
98684
+ if (panel && panel.store && panel.selection) {
98685
+ this.refreshSelectionDisplayFromPanel();
98686
+ } else if (!this.aggregationMode) {
98687
+ this.updateSelectedItems();
98688
+ }
98689
+ this.emitSelectionToParent();
98690
+ },
98690
98691
  buildSelectedItemsFromValuesLazy(panel) {
98691
98692
  if (!panel || !panel.selection) {
98692
98693
  return [];
@@ -98701,6 +98702,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98701
98702
  if (!panel || !panel.selection || !panel.store) {
98702
98703
  return false;
98703
98704
  }
98705
+ this.isExternalSync = true;
98704
98706
  if (!this.hasExternalValue()) {
98705
98707
  if (panel.selection) {
98706
98708
  panel.selection.clear();
@@ -98708,6 +98710,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98708
98710
  }
98709
98711
  this.selectedItems = [];
98710
98712
  this.selectedValues = [];
98713
+ this.isExternalSync = false;
98711
98714
  return true;
98712
98715
  }
98713
98716
  panel.selection.clear();
@@ -98718,6 +98721,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98718
98721
  panel.bumpSelectionView();
98719
98722
  this.refreshSelectionDisplayFromPanel();
98720
98723
  this.expandPanelToExternalValue(panel);
98724
+ this.isExternalSync = false;
98721
98725
  return true;
98722
98726
  },
98723
98727
  hasExternalValue() {
@@ -98730,15 +98734,6 @@ var VirtualCascaderPanel_component = normalizeComponent(
98730
98734
  }
98731
98735
  return true;
98732
98736
  },
98733
- applyExternalValueToPanelSelection(panel) {
98734
- const {
98735
- store,
98736
- selection
98737
- } = panel;
98738
- this.getExternalValueList().forEach(val => {
98739
- CascaderUtilsPro.addValueToSelection(store, selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
98740
- });
98741
- },
98742
98737
  getExternalValueList() {
98743
98738
  const val = this.value;
98744
98739
  if (val == null || val === '') {
@@ -98762,6 +98757,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
98762
98757
  }
98763
98758
  },
98764
98759
  schedulePanelSyncFromExternalValue(retry = 0) {
98760
+ if (this.isInternalUpdate || this.isExternalSync) {
98761
+ return;
98762
+ }
98765
98763
  this.clearPanelSyncTimer();
98766
98764
  this.$nextTick(() => {
98767
98765
  if (!this.hasExternalValue()) {
@@ -99009,7 +99007,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99009
99007
  const paths = [];
99010
99008
  panel.selection.selectedLeafSet.forEach(leaf => {
99011
99009
  if (searchLeafSet.has(leaf)) {
99012
- const path = panel.store.pathByLeafValue.get(leaf);
99010
+ const path = getStoreLeafPath(panel.store, leaf);
99013
99011
  if (path) {
99014
99012
  paths.push(path);
99015
99013
  }
@@ -99049,9 +99047,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99049
99047
  this.$refs.searchCascaderPanel.expandPathValues([firstOption[valueKey]], true);
99050
99048
  }
99051
99049
  },
99052
- // 值变化处理
99050
+ // 值变化处理(面板勾选)
99053
99051
  handleValueChange() {
99054
- this.applyPanelSelectionChange();
99052
+ this.commitUserSelectionChange();
99055
99053
  },
99056
99054
  // 搜索模式值变化处理
99057
99055
  handleSearchValueChange() {
@@ -99072,7 +99070,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99072
99070
  });
99073
99071
  mainPanel.selection._reconcileAllRoots();
99074
99072
  mainPanel.bumpSelectionView();
99075
- this.applyPanelSelectionChange();
99073
+ this.commitUserSelectionChange();
99076
99074
  },
99077
99075
  // 移除已选项
99078
99076
  removeItem(item, index) {
@@ -99100,7 +99098,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99100
99098
  panel.selection.toggleNode(node.id, false);
99101
99099
  }
99102
99100
  }
99103
- this.applyPanelSelectionChange();
99101
+ this.commitUserSelectionChange();
99104
99102
  if (this.isShowSearch) {
99105
99103
  this.syncSearchPanelSelection();
99106
99104
  }
@@ -99126,32 +99124,35 @@ var VirtualCascaderPanel_component = normalizeComponent(
99126
99124
  this.$emit('input', emitValue);
99127
99125
  });
99128
99126
  },
99127
+ clearPanelSelectionState(panel) {
99128
+ if (!panel || !panel.selection) {
99129
+ return;
99130
+ }
99131
+ panel.selection.clear();
99132
+ panel.bumpSelectionView();
99133
+ },
99129
99134
  // 全选/取消全选
99130
99135
  handleSelectAll() {
99131
99136
  if (!this.isMultiple) {
99132
- // 单选模式下不支持全选
99133
99137
  return;
99134
99138
  }
99139
+ const panel = this.$refs.cascaderPanel;
99140
+ const searchPanel = this.$refs.searchCascaderPanel;
99135
99141
  if (this.isAllSelected) {
99136
- const panel = this.$refs.cascaderPanel;
99137
- if (panel) {
99138
- panel.clearCheckedNodes();
99139
- } else {
99140
- this.selectedValues = [];
99141
- this.selectedItems = [];
99142
- this.searchSelectedValues = [];
99143
- this.applyPanelSelectionChange();
99142
+ this.clearPanelSelectionState(panel);
99143
+ this.clearPanelSelectionState(searchPanel);
99144
+ this.selectedValues = [];
99145
+ this.searchSelectedValues = [];
99146
+ } else if (panel && panel.selection) {
99147
+ panel.selection.selectAll();
99148
+ panel.bumpSelectionView();
99149
+ if (searchPanel && searchPanel.selection) {
99150
+ this.syncSearchPanelSelection();
99144
99151
  }
99145
99152
  } else {
99146
- const panel = this.$refs.cascaderPanel;
99147
- if (panel) {
99148
- panel.selectAllLeaves();
99149
- } else {
99150
- this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
99151
- this.updateSelectedItems();
99152
- this.applyPanelSelectionChange();
99153
- }
99153
+ this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
99154
99154
  }
99155
+ this.commitUserSelectionChange();
99155
99156
  },
99156
99157
  // 获取选中的数据
99157
99158
  getSelectedData() {
@@ -99177,14 +99178,12 @@ var VirtualCascaderPanel_component = normalizeComponent(
99177
99178
  // 清空选择
99178
99179
  clearSelection() {
99179
99180
  const panel = this.$refs.cascaderPanel;
99180
- if (panel) {
99181
- panel.clearCheckedNodes();
99182
- } else {
99183
- this.selectedValues = [];
99184
- this.selectedItems = [];
99185
- this.searchSelectedValues = [];
99186
- this.applyPanelSelectionChange();
99187
- }
99181
+ const searchPanel = this.$refs.searchCascaderPanel;
99182
+ this.clearPanelSelectionState(panel);
99183
+ this.clearPanelSelectionState(searchPanel);
99184
+ this.selectedValues = [];
99185
+ this.searchSelectedValues = [];
99186
+ this.commitUserSelectionChange();
99188
99187
  },
99189
99188
  // 设置选择值
99190
99189
  setValue(values) {
@@ -99283,7 +99282,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99283
99282
  });
99284
99283
  panel.selection._reconcileAllRoots();
99285
99284
  panel.bumpSelectionView();
99286
- this.applyPanelSelectionChange();
99285
+ this.commitUserSelectionChange();
99287
99286
  } else {
99288
99287
  const newSelectedValues = [...this.selectedValues];
99289
99288
  matchedPaths.forEach(path => {
@@ -99328,7 +99327,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99328
99327
  });
99329
99328
 
99330
99329
  // 检查是否为叶子节点且匹配且未禁用
99331
- const isLeafNode = !option[this.cascaderProps.children];
99330
+ const isLeafNode = CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps);
99332
99331
  const isNotDisabled = !this.isItemDisabled(option);
99333
99332
  if (isMatched && isLeafNode && isNotDisabled) {
99334
99333
  // 如果是叶子节点、匹配且未禁用,添加到结果中
@@ -99381,8 +99380,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99381
99380
  ;
99382
99381
  var ByCascaderPanelPro_component = normalizeComponent(
99383
99382
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
99384
- ByCascaderPanelProvue_type_template_id_075d43fb_render,
99385
- ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns,
99383
+ ByCascaderPanelProvue_type_template_id_e4b10a08_render,
99384
+ ByCascaderPanelProvue_type_template_id_e4b10a08_staticRenderFns,
99386
99385
  false,
99387
99386
  null,
99388
99387
  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=075d43fb
96029
- var ByCascaderPanelProvue_type_template_id_075d43fb_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=e4b10a08
96029
+ var ByCascaderPanelProvue_type_template_id_e4b10a08_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_075d43fb_render = function render() {
96268
96268
  staticClass: "empty-state"
96269
96269
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96270
96270
  };
96271
- var ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns = [];
96271
+ var ByCascaderPanelProvue_type_template_id_e4b10a08_staticRenderFns = [];
96272
96272
 
96273
96273
  ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
96274
96274
 
@@ -98442,7 +98442,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
98442
98442
  // 紧凑模式下稳定的空 value 引用,避免 watch 误触发清空
98443
98443
  searchDebounceTimer: null,
98444
98444
  searchLeafSetCache: null,
98445
- panelSyncTimer: null
98445
+ panelSyncTimer: null,
98446
+ // 外部 v-model 回显同步中,避免与用户操作冲突
98447
+ isExternalSync: false
98446
98448
  };
98447
98449
  },
98448
98450
  computed: {
@@ -98577,6 +98579,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
98577
98579
  } else {
98578
98580
  this.isAllSelected = this.selectedCount === this.totalCount;
98579
98581
  }
98582
+ } else if (panel && panel.store && panel.selection && this.aggregationMode) {
98583
+ this.isAllSelected = panel.selection.size() === panel.store.totalLeafCount && panel.store.totalLeafCount > 0;
98580
98584
  }
98581
98585
  } else {
98582
98586
  if (newVal.length > 1) {
@@ -98626,18 +98630,12 @@ var VirtualCascaderPanel_component = normalizeComponent(
98626
98630
  } = panel;
98627
98631
  if (this.aggregationMode) {
98628
98632
  let items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
98629
- if (items.length === 0 && selection.size() > 0) {
98633
+ if (items.length === 0 && selection.size() > 0 && !selection.isCompactSelection()) {
98630
98634
  const paths = selection.getCheckedPaths();
98631
98635
  if (paths.length > 0) {
98632
98636
  items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
98633
98637
  }
98634
98638
  }
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
- }
98641
98639
  this.selectedItems = items;
98642
98640
  this.selectedCount = items.length;
98643
98641
  this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
@@ -98658,18 +98656,18 @@ var VirtualCascaderPanel_component = normalizeComponent(
98658
98656
  this.updateSelectedItems();
98659
98657
  panel.bumpSelectionView();
98660
98658
  },
98661
- applyPanelSelectionChange() {
98662
- const panel = this.$refs.cascaderPanel;
98663
- if (!panel || !panel.store || !panel.selection) {
98664
- return;
98665
- }
98666
- const {
98667
- store,
98668
- selection
98669
- } = panel;
98670
- this.refreshSelectionDisplayFromPanel();
98659
+ /**
98660
+ * 用户操作(勾选/全选/清除/删除)统一提交:更新展示 + emit,标记内部更新防回显覆盖
98661
+ */
98662
+ commitUserSelectionChange() {
98663
+ this.isInternalUpdate = true;
98664
+ this.applyPanelSelectionChange();
98665
+ },
98666
+ /**
98667
+ * 向父组件 emit 当前选中(仅用户操作路径调用,外部回显走 syncPanelFromExternalValue 不 emit)
98668
+ */
98669
+ emitSelectionToParent() {
98671
98670
  if (this.aggregationMode) {
98672
- this.isInternalUpdate = true;
98673
98671
  let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
98674
98672
  if (!this.isMultiple && emitValue.length > 0) {
98675
98673
  emitValue = emitValue[0];
@@ -98678,25 +98676,28 @@ var VirtualCascaderPanel_component = normalizeComponent(
98678
98676
  this.$emit('change', this.getSelectedData());
98679
98677
  return;
98680
98678
  }
98681
- if (selection.isCompactSelection()) {
98682
- this.isInternalUpdate = true;
98679
+ const panel = this.$refs.cascaderPanel;
98680
+ const isCompact = panel && panel.selection && panel.selection.isCompactSelection();
98681
+ if (isCompact) {
98683
98682
  this.$emit('input', this.currentValue);
98684
98683
  this.$emit('change', this.getSelectedData());
98685
98684
  return;
98686
98685
  }
98687
98686
  this.$nextTick(() => {
98688
- this.isInternalUpdate = true;
98689
98687
  let emitValue = this.currentValue;
98690
- if (this.aggregationMode) {
98691
- emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
98692
- if (!this.isMultiple && emitValue.length > 0) {
98693
- emitValue = emitValue[0];
98694
- }
98695
- }
98696
98688
  this.$emit('input', emitValue);
98697
98689
  this.$emit('change', this.getSelectedData());
98698
98690
  });
98699
98691
  },
98692
+ applyPanelSelectionChange() {
98693
+ const panel = this.$refs.cascaderPanel;
98694
+ if (panel && panel.store && panel.selection) {
98695
+ this.refreshSelectionDisplayFromPanel();
98696
+ } else if (!this.aggregationMode) {
98697
+ this.updateSelectedItems();
98698
+ }
98699
+ this.emitSelectionToParent();
98700
+ },
98700
98701
  buildSelectedItemsFromValuesLazy(panel) {
98701
98702
  if (!panel || !panel.selection) {
98702
98703
  return [];
@@ -98711,6 +98712,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98711
98712
  if (!panel || !panel.selection || !panel.store) {
98712
98713
  return false;
98713
98714
  }
98715
+ this.isExternalSync = true;
98714
98716
  if (!this.hasExternalValue()) {
98715
98717
  if (panel.selection) {
98716
98718
  panel.selection.clear();
@@ -98718,6 +98720,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98718
98720
  }
98719
98721
  this.selectedItems = [];
98720
98722
  this.selectedValues = [];
98723
+ this.isExternalSync = false;
98721
98724
  return true;
98722
98725
  }
98723
98726
  panel.selection.clear();
@@ -98728,6 +98731,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
98728
98731
  panel.bumpSelectionView();
98729
98732
  this.refreshSelectionDisplayFromPanel();
98730
98733
  this.expandPanelToExternalValue(panel);
98734
+ this.isExternalSync = false;
98731
98735
  return true;
98732
98736
  },
98733
98737
  hasExternalValue() {
@@ -98740,15 +98744,6 @@ var VirtualCascaderPanel_component = normalizeComponent(
98740
98744
  }
98741
98745
  return true;
98742
98746
  },
98743
- applyExternalValueToPanelSelection(panel) {
98744
- const {
98745
- store,
98746
- selection
98747
- } = panel;
98748
- this.getExternalValueList().forEach(val => {
98749
- CascaderUtilsPro.addValueToSelection(store, selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
98750
- });
98751
- },
98752
98747
  getExternalValueList() {
98753
98748
  const val = this.value;
98754
98749
  if (val == null || val === '') {
@@ -98772,6 +98767,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
98772
98767
  }
98773
98768
  },
98774
98769
  schedulePanelSyncFromExternalValue(retry = 0) {
98770
+ if (this.isInternalUpdate || this.isExternalSync) {
98771
+ return;
98772
+ }
98775
98773
  this.clearPanelSyncTimer();
98776
98774
  this.$nextTick(() => {
98777
98775
  if (!this.hasExternalValue()) {
@@ -99019,7 +99017,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99019
99017
  const paths = [];
99020
99018
  panel.selection.selectedLeafSet.forEach(leaf => {
99021
99019
  if (searchLeafSet.has(leaf)) {
99022
- const path = panel.store.pathByLeafValue.get(leaf);
99020
+ const path = getStoreLeafPath(panel.store, leaf);
99023
99021
  if (path) {
99024
99022
  paths.push(path);
99025
99023
  }
@@ -99059,9 +99057,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99059
99057
  this.$refs.searchCascaderPanel.expandPathValues([firstOption[valueKey]], true);
99060
99058
  }
99061
99059
  },
99062
- // 值变化处理
99060
+ // 值变化处理(面板勾选)
99063
99061
  handleValueChange() {
99064
- this.applyPanelSelectionChange();
99062
+ this.commitUserSelectionChange();
99065
99063
  },
99066
99064
  // 搜索模式值变化处理
99067
99065
  handleSearchValueChange() {
@@ -99082,7 +99080,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99082
99080
  });
99083
99081
  mainPanel.selection._reconcileAllRoots();
99084
99082
  mainPanel.bumpSelectionView();
99085
- this.applyPanelSelectionChange();
99083
+ this.commitUserSelectionChange();
99086
99084
  },
99087
99085
  // 移除已选项
99088
99086
  removeItem(item, index) {
@@ -99110,7 +99108,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99110
99108
  panel.selection.toggleNode(node.id, false);
99111
99109
  }
99112
99110
  }
99113
- this.applyPanelSelectionChange();
99111
+ this.commitUserSelectionChange();
99114
99112
  if (this.isShowSearch) {
99115
99113
  this.syncSearchPanelSelection();
99116
99114
  }
@@ -99136,32 +99134,35 @@ var VirtualCascaderPanel_component = normalizeComponent(
99136
99134
  this.$emit('input', emitValue);
99137
99135
  });
99138
99136
  },
99137
+ clearPanelSelectionState(panel) {
99138
+ if (!panel || !panel.selection) {
99139
+ return;
99140
+ }
99141
+ panel.selection.clear();
99142
+ panel.bumpSelectionView();
99143
+ },
99139
99144
  // 全选/取消全选
99140
99145
  handleSelectAll() {
99141
99146
  if (!this.isMultiple) {
99142
- // 单选模式下不支持全选
99143
99147
  return;
99144
99148
  }
99149
+ const panel = this.$refs.cascaderPanel;
99150
+ const searchPanel = this.$refs.searchCascaderPanel;
99145
99151
  if (this.isAllSelected) {
99146
- const panel = this.$refs.cascaderPanel;
99147
- if (panel) {
99148
- panel.clearCheckedNodes();
99149
- } else {
99150
- this.selectedValues = [];
99151
- this.selectedItems = [];
99152
- this.searchSelectedValues = [];
99153
- this.applyPanelSelectionChange();
99152
+ this.clearPanelSelectionState(panel);
99153
+ this.clearPanelSelectionState(searchPanel);
99154
+ this.selectedValues = [];
99155
+ this.searchSelectedValues = [];
99156
+ } else if (panel && panel.selection) {
99157
+ panel.selection.selectAll();
99158
+ panel.bumpSelectionView();
99159
+ if (searchPanel && searchPanel.selection) {
99160
+ this.syncSearchPanelSelection();
99154
99161
  }
99155
99162
  } else {
99156
- const panel = this.$refs.cascaderPanel;
99157
- if (panel) {
99158
- panel.selectAllLeaves();
99159
- } else {
99160
- this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
99161
- this.updateSelectedItems();
99162
- this.applyPanelSelectionChange();
99163
- }
99163
+ this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
99164
99164
  }
99165
+ this.commitUserSelectionChange();
99165
99166
  },
99166
99167
  // 获取选中的数据
99167
99168
  getSelectedData() {
@@ -99187,14 +99188,12 @@ var VirtualCascaderPanel_component = normalizeComponent(
99187
99188
  // 清空选择
99188
99189
  clearSelection() {
99189
99190
  const panel = this.$refs.cascaderPanel;
99190
- if (panel) {
99191
- panel.clearCheckedNodes();
99192
- } else {
99193
- this.selectedValues = [];
99194
- this.selectedItems = [];
99195
- this.searchSelectedValues = [];
99196
- this.applyPanelSelectionChange();
99197
- }
99191
+ const searchPanel = this.$refs.searchCascaderPanel;
99192
+ this.clearPanelSelectionState(panel);
99193
+ this.clearPanelSelectionState(searchPanel);
99194
+ this.selectedValues = [];
99195
+ this.searchSelectedValues = [];
99196
+ this.commitUserSelectionChange();
99198
99197
  },
99199
99198
  // 设置选择值
99200
99199
  setValue(values) {
@@ -99293,7 +99292,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99293
99292
  });
99294
99293
  panel.selection._reconcileAllRoots();
99295
99294
  panel.bumpSelectionView();
99296
- this.applyPanelSelectionChange();
99295
+ this.commitUserSelectionChange();
99297
99296
  } else {
99298
99297
  const newSelectedValues = [...this.selectedValues];
99299
99298
  matchedPaths.forEach(path => {
@@ -99338,7 +99337,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99338
99337
  });
99339
99338
 
99340
99339
  // 检查是否为叶子节点且匹配且未禁用
99341
- const isLeafNode = !option[this.cascaderProps.children];
99340
+ const isLeafNode = CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps);
99342
99341
  const isNotDisabled = !this.isItemDisabled(option);
99343
99342
  if (isMatched && isLeafNode && isNotDisabled) {
99344
99343
  // 如果是叶子节点、匹配且未禁用,添加到结果中
@@ -99391,8 +99390,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99391
99390
  ;
99392
99391
  var ByCascaderPanelPro_component = normalizeComponent(
99393
99392
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
99394
- ByCascaderPanelProvue_type_template_id_075d43fb_render,
99395
- ByCascaderPanelProvue_type_template_id_075d43fb_staticRenderFns,
99393
+ ByCascaderPanelProvue_type_template_id_e4b10a08_render,
99394
+ ByCascaderPanelProvue_type_template_id_e4b10a08_staticRenderFns,
99396
99395
  false,
99397
99396
  null,
99398
99397
  null,