@weitutech/by-components 1.2.2 → 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.
- package/lib/by-components.common.js +153 -134
- package/lib/by-components.umd.js +153 -134
- 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=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_37aef47d_render = function render() {
|
|
|
96258
96258
|
staticClass: "empty-state"
|
|
96259
96259
|
}, [_vm._v("暂无选中项")])], 1)])])])]);
|
|
96260
96260
|
};
|
|
96261
|
-
var
|
|
96261
|
+
var ByCascaderPanelProvue_type_template_id_e4b10a08_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 (
|
|
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
|
-
|
|
97154
|
-
|
|
97155
|
-
|
|
97156
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
97733
|
-
node.
|
|
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();
|
|
@@ -98394,7 +98432,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98394
98432
|
// 紧凑模式下稳定的空 value 引用,避免 watch 误触发清空
|
|
98395
98433
|
searchDebounceTimer: null,
|
|
98396
98434
|
searchLeafSetCache: null,
|
|
98397
|
-
panelSyncTimer: null
|
|
98435
|
+
panelSyncTimer: null,
|
|
98436
|
+
// 外部 v-model 回显同步中,避免与用户操作冲突
|
|
98437
|
+
isExternalSync: false
|
|
98398
98438
|
};
|
|
98399
98439
|
},
|
|
98400
98440
|
computed: {
|
|
@@ -98529,6 +98569,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98529
98569
|
} else {
|
|
98530
98570
|
this.isAllSelected = this.selectedCount === this.totalCount;
|
|
98531
98571
|
}
|
|
98572
|
+
} else if (panel && panel.store && panel.selection && this.aggregationMode) {
|
|
98573
|
+
this.isAllSelected = panel.selection.size() === panel.store.totalLeafCount && panel.store.totalLeafCount > 0;
|
|
98532
98574
|
}
|
|
98533
98575
|
} else {
|
|
98534
98576
|
if (newVal.length > 1) {
|
|
@@ -98577,7 +98619,13 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98577
98619
|
selection
|
|
98578
98620
|
} = panel;
|
|
98579
98621
|
if (this.aggregationMode) {
|
|
98580
|
-
|
|
98622
|
+
let items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
|
|
98623
|
+
if (items.length === 0 && selection.size() > 0 && !selection.isCompactSelection()) {
|
|
98624
|
+
const paths = selection.getCheckedPaths();
|
|
98625
|
+
if (paths.length > 0) {
|
|
98626
|
+
items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
|
|
98627
|
+
}
|
|
98628
|
+
}
|
|
98581
98629
|
this.selectedItems = items;
|
|
98582
98630
|
this.selectedCount = items.length;
|
|
98583
98631
|
this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
|
|
@@ -98598,18 +98646,18 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98598
98646
|
this.updateSelectedItems();
|
|
98599
98647
|
panel.bumpSelectionView();
|
|
98600
98648
|
},
|
|
98601
|
-
|
|
98602
|
-
|
|
98603
|
-
|
|
98604
|
-
|
|
98605
|
-
|
|
98606
|
-
|
|
98607
|
-
|
|
98608
|
-
|
|
98609
|
-
|
|
98610
|
-
|
|
98649
|
+
/**
|
|
98650
|
+
* 用户操作(勾选/全选/清除/删除)统一提交:更新展示 + emit,标记内部更新防回显覆盖
|
|
98651
|
+
*/
|
|
98652
|
+
commitUserSelectionChange() {
|
|
98653
|
+
this.isInternalUpdate = true;
|
|
98654
|
+
this.applyPanelSelectionChange();
|
|
98655
|
+
},
|
|
98656
|
+
/**
|
|
98657
|
+
* 向父组件 emit 当前选中(仅用户操作路径调用,外部回显走 syncPanelFromExternalValue 不 emit)
|
|
98658
|
+
*/
|
|
98659
|
+
emitSelectionToParent() {
|
|
98611
98660
|
if (this.aggregationMode) {
|
|
98612
|
-
this.isInternalUpdate = true;
|
|
98613
98661
|
let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
|
|
98614
98662
|
if (!this.isMultiple && emitValue.length > 0) {
|
|
98615
98663
|
emitValue = emitValue[0];
|
|
@@ -98618,25 +98666,28 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98618
98666
|
this.$emit('change', this.getSelectedData());
|
|
98619
98667
|
return;
|
|
98620
98668
|
}
|
|
98621
|
-
|
|
98622
|
-
|
|
98669
|
+
const panel = this.$refs.cascaderPanel;
|
|
98670
|
+
const isCompact = panel && panel.selection && panel.selection.isCompactSelection();
|
|
98671
|
+
if (isCompact) {
|
|
98623
98672
|
this.$emit('input', this.currentValue);
|
|
98624
98673
|
this.$emit('change', this.getSelectedData());
|
|
98625
98674
|
return;
|
|
98626
98675
|
}
|
|
98627
98676
|
this.$nextTick(() => {
|
|
98628
|
-
this.isInternalUpdate = true;
|
|
98629
98677
|
let emitValue = this.currentValue;
|
|
98630
|
-
if (this.aggregationMode) {
|
|
98631
|
-
emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
|
|
98632
|
-
if (!this.isMultiple && emitValue.length > 0) {
|
|
98633
|
-
emitValue = emitValue[0];
|
|
98634
|
-
}
|
|
98635
|
-
}
|
|
98636
98678
|
this.$emit('input', emitValue);
|
|
98637
98679
|
this.$emit('change', this.getSelectedData());
|
|
98638
98680
|
});
|
|
98639
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
|
+
},
|
|
98640
98691
|
buildSelectedItemsFromValuesLazy(panel) {
|
|
98641
98692
|
if (!panel || !panel.selection) {
|
|
98642
98693
|
return [];
|
|
@@ -98651,18 +98702,26 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98651
98702
|
if (!panel || !panel.selection || !panel.store) {
|
|
98652
98703
|
return false;
|
|
98653
98704
|
}
|
|
98705
|
+
this.isExternalSync = true;
|
|
98654
98706
|
if (!this.hasExternalValue()) {
|
|
98655
|
-
panel.
|
|
98707
|
+
if (panel.selection) {
|
|
98708
|
+
panel.selection.clear();
|
|
98709
|
+
panel.bumpSelectionView();
|
|
98710
|
+
}
|
|
98656
98711
|
this.selectedItems = [];
|
|
98657
98712
|
this.selectedValues = [];
|
|
98713
|
+
this.isExternalSync = false;
|
|
98658
98714
|
return true;
|
|
98659
98715
|
}
|
|
98660
98716
|
panel.selection.clear();
|
|
98661
|
-
this.
|
|
98717
|
+
this.getExternalValueList().forEach(val => {
|
|
98718
|
+
CascaderUtilsPro.addValueToSelection(panel.store, panel.selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
98719
|
+
});
|
|
98662
98720
|
panel.selection._reconcileAllRoots();
|
|
98663
98721
|
panel.bumpSelectionView();
|
|
98664
98722
|
this.refreshSelectionDisplayFromPanel();
|
|
98665
98723
|
this.expandPanelToExternalValue(panel);
|
|
98724
|
+
this.isExternalSync = false;
|
|
98666
98725
|
return true;
|
|
98667
98726
|
},
|
|
98668
98727
|
hasExternalValue() {
|
|
@@ -98675,46 +98734,6 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98675
98734
|
}
|
|
98676
98735
|
return true;
|
|
98677
98736
|
},
|
|
98678
|
-
applyExternalValueToPanelSelection(panel) {
|
|
98679
|
-
const {
|
|
98680
|
-
store,
|
|
98681
|
-
selection
|
|
98682
|
-
} = 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
|
-
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
98737
|
getExternalValueList() {
|
|
98719
98738
|
const val = this.value;
|
|
98720
98739
|
if (val == null || val === '') {
|
|
@@ -98738,12 +98757,16 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98738
98757
|
}
|
|
98739
98758
|
},
|
|
98740
98759
|
schedulePanelSyncFromExternalValue(retry = 0) {
|
|
98760
|
+
if (this.isInternalUpdate || this.isExternalSync) {
|
|
98761
|
+
return;
|
|
98762
|
+
}
|
|
98741
98763
|
this.clearPanelSyncTimer();
|
|
98742
98764
|
this.$nextTick(() => {
|
|
98743
98765
|
if (!this.hasExternalValue()) {
|
|
98744
98766
|
const panel = this.$refs.cascaderPanel;
|
|
98745
98767
|
if (panel && panel.selection) {
|
|
98746
|
-
panel.
|
|
98768
|
+
panel.selection.clear();
|
|
98769
|
+
panel.bumpSelectionView();
|
|
98747
98770
|
}
|
|
98748
98771
|
this.selectedItems = [];
|
|
98749
98772
|
this.selectedValues = [];
|
|
@@ -98984,7 +99007,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98984
99007
|
const paths = [];
|
|
98985
99008
|
panel.selection.selectedLeafSet.forEach(leaf => {
|
|
98986
99009
|
if (searchLeafSet.has(leaf)) {
|
|
98987
|
-
const path = panel.store
|
|
99010
|
+
const path = getStoreLeafPath(panel.store, leaf);
|
|
98988
99011
|
if (path) {
|
|
98989
99012
|
paths.push(path);
|
|
98990
99013
|
}
|
|
@@ -99024,9 +99047,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99024
99047
|
this.$refs.searchCascaderPanel.expandPathValues([firstOption[valueKey]], true);
|
|
99025
99048
|
}
|
|
99026
99049
|
},
|
|
99027
|
-
//
|
|
99050
|
+
// 值变化处理(面板勾选)
|
|
99028
99051
|
handleValueChange() {
|
|
99029
|
-
this.
|
|
99052
|
+
this.commitUserSelectionChange();
|
|
99030
99053
|
},
|
|
99031
99054
|
// 搜索模式值变化处理
|
|
99032
99055
|
handleSearchValueChange() {
|
|
@@ -99047,7 +99070,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99047
99070
|
});
|
|
99048
99071
|
mainPanel.selection._reconcileAllRoots();
|
|
99049
99072
|
mainPanel.bumpSelectionView();
|
|
99050
|
-
this.
|
|
99073
|
+
this.commitUserSelectionChange();
|
|
99051
99074
|
},
|
|
99052
99075
|
// 移除已选项
|
|
99053
99076
|
removeItem(item, index) {
|
|
@@ -99075,7 +99098,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99075
99098
|
panel.selection.toggleNode(node.id, false);
|
|
99076
99099
|
}
|
|
99077
99100
|
}
|
|
99078
|
-
this.
|
|
99101
|
+
this.commitUserSelectionChange();
|
|
99079
99102
|
if (this.isShowSearch) {
|
|
99080
99103
|
this.syncSearchPanelSelection();
|
|
99081
99104
|
}
|
|
@@ -99101,32 +99124,35 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99101
99124
|
this.$emit('input', emitValue);
|
|
99102
99125
|
});
|
|
99103
99126
|
},
|
|
99127
|
+
clearPanelSelectionState(panel) {
|
|
99128
|
+
if (!panel || !panel.selection) {
|
|
99129
|
+
return;
|
|
99130
|
+
}
|
|
99131
|
+
panel.selection.clear();
|
|
99132
|
+
panel.bumpSelectionView();
|
|
99133
|
+
},
|
|
99104
99134
|
// 全选/取消全选
|
|
99105
99135
|
handleSelectAll() {
|
|
99106
99136
|
if (!this.isMultiple) {
|
|
99107
|
-
// 单选模式下不支持全选
|
|
99108
99137
|
return;
|
|
99109
99138
|
}
|
|
99139
|
+
const panel = this.$refs.cascaderPanel;
|
|
99140
|
+
const searchPanel = this.$refs.searchCascaderPanel;
|
|
99110
99141
|
if (this.isAllSelected) {
|
|
99111
|
-
|
|
99112
|
-
|
|
99113
|
-
|
|
99114
|
-
|
|
99115
|
-
|
|
99116
|
-
|
|
99117
|
-
|
|
99118
|
-
|
|
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();
|
|
99119
99151
|
}
|
|
99120
99152
|
} else {
|
|
99121
|
-
|
|
99122
|
-
if (panel) {
|
|
99123
|
-
panel.selectAllLeaves();
|
|
99124
|
-
} else {
|
|
99125
|
-
this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
99126
|
-
this.updateSelectedItems();
|
|
99127
|
-
this.applyPanelSelectionChange();
|
|
99128
|
-
}
|
|
99153
|
+
this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
99129
99154
|
}
|
|
99155
|
+
this.commitUserSelectionChange();
|
|
99130
99156
|
},
|
|
99131
99157
|
// 获取选中的数据
|
|
99132
99158
|
getSelectedData() {
|
|
@@ -99152,14 +99178,12 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99152
99178
|
// 清空选择
|
|
99153
99179
|
clearSelection() {
|
|
99154
99180
|
const panel = this.$refs.cascaderPanel;
|
|
99155
|
-
|
|
99156
|
-
|
|
99157
|
-
|
|
99158
|
-
|
|
99159
|
-
|
|
99160
|
-
|
|
99161
|
-
this.applyPanelSelectionChange();
|
|
99162
|
-
}
|
|
99181
|
+
const searchPanel = this.$refs.searchCascaderPanel;
|
|
99182
|
+
this.clearPanelSelectionState(panel);
|
|
99183
|
+
this.clearPanelSelectionState(searchPanel);
|
|
99184
|
+
this.selectedValues = [];
|
|
99185
|
+
this.searchSelectedValues = [];
|
|
99186
|
+
this.commitUserSelectionChange();
|
|
99163
99187
|
},
|
|
99164
99188
|
// 设置选择值
|
|
99165
99189
|
setValue(values) {
|
|
@@ -99210,15 +99234,10 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99210
99234
|
const findPath = (options, targetValues, currentPath = []) => {
|
|
99211
99235
|
for (const option of options) {
|
|
99212
99236
|
const newPath = [...currentPath, option[this.cascaderProps.value]];
|
|
99213
|
-
if (targetValues.some(target => target == option[this.cascaderProps.value])) {
|
|
99214
|
-
|
|
99215
|
-
if (!option[this.cascaderProps.children]) {
|
|
99216
|
-
paths.push(newPath);
|
|
99217
|
-
}
|
|
99237
|
+
if (targetValues.some(target => target == option[this.cascaderProps.value]) && CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
|
|
99238
|
+
paths.push(newPath);
|
|
99218
99239
|
}
|
|
99219
|
-
|
|
99220
|
-
// 递归查找子节点
|
|
99221
|
-
if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
|
|
99240
|
+
if (!CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
|
|
99222
99241
|
findPath(option[this.cascaderProps.children], targetValues, newPath);
|
|
99223
99242
|
}
|
|
99224
99243
|
}
|
|
@@ -99263,7 +99282,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99263
99282
|
});
|
|
99264
99283
|
panel.selection._reconcileAllRoots();
|
|
99265
99284
|
panel.bumpSelectionView();
|
|
99266
|
-
this.
|
|
99285
|
+
this.commitUserSelectionChange();
|
|
99267
99286
|
} else {
|
|
99268
99287
|
const newSelectedValues = [...this.selectedValues];
|
|
99269
99288
|
matchedPaths.forEach(path => {
|
|
@@ -99308,7 +99327,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99308
99327
|
});
|
|
99309
99328
|
|
|
99310
99329
|
// 检查是否为叶子节点且匹配且未禁用
|
|
99311
|
-
const isLeafNode =
|
|
99330
|
+
const isLeafNode = CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps);
|
|
99312
99331
|
const isNotDisabled = !this.isItemDisabled(option);
|
|
99313
99332
|
if (isMatched && isLeafNode && isNotDisabled) {
|
|
99314
99333
|
// 如果是叶子节点、匹配且未禁用,添加到结果中
|
|
@@ -99361,8 +99380,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99361
99380
|
;
|
|
99362
99381
|
var ByCascaderPanelPro_component = normalizeComponent(
|
|
99363
99382
|
cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
|
|
99364
|
-
|
|
99365
|
-
|
|
99383
|
+
ByCascaderPanelProvue_type_template_id_e4b10a08_render,
|
|
99384
|
+
ByCascaderPanelProvue_type_template_id_e4b10a08_staticRenderFns,
|
|
99366
99385
|
false,
|
|
99367
99386
|
null,
|
|
99368
99387
|
null,
|