@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
package/lib/by-components.umd.js
CHANGED
|
@@ -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=
|
|
96029
|
-
var
|
|
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_37aef47d_render = function render() {
|
|
|
96268
96268
|
staticClass: "empty-state"
|
|
96269
96269
|
}, [_vm._v("暂无选中项")])], 1)])])])]);
|
|
96270
96270
|
};
|
|
96271
|
-
var
|
|
96271
|
+
var ByCascaderPanelProvue_type_template_id_e4b10a08_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 (
|
|
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
|
-
|
|
97164
|
-
|
|
97165
|
-
|
|
97166
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
97743
|
-
node.
|
|
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();
|
|
@@ -98404,7 +98442,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98404
98442
|
// 紧凑模式下稳定的空 value 引用,避免 watch 误触发清空
|
|
98405
98443
|
searchDebounceTimer: null,
|
|
98406
98444
|
searchLeafSetCache: null,
|
|
98407
|
-
panelSyncTimer: null
|
|
98445
|
+
panelSyncTimer: null,
|
|
98446
|
+
// 外部 v-model 回显同步中,避免与用户操作冲突
|
|
98447
|
+
isExternalSync: false
|
|
98408
98448
|
};
|
|
98409
98449
|
},
|
|
98410
98450
|
computed: {
|
|
@@ -98539,6 +98579,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98539
98579
|
} else {
|
|
98540
98580
|
this.isAllSelected = this.selectedCount === this.totalCount;
|
|
98541
98581
|
}
|
|
98582
|
+
} else if (panel && panel.store && panel.selection && this.aggregationMode) {
|
|
98583
|
+
this.isAllSelected = panel.selection.size() === panel.store.totalLeafCount && panel.store.totalLeafCount > 0;
|
|
98542
98584
|
}
|
|
98543
98585
|
} else {
|
|
98544
98586
|
if (newVal.length > 1) {
|
|
@@ -98587,7 +98629,13 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98587
98629
|
selection
|
|
98588
98630
|
} = panel;
|
|
98589
98631
|
if (this.aggregationMode) {
|
|
98590
|
-
|
|
98632
|
+
let items = CascaderUtilsPro.getAggregatedItemsFromSelection(store, selection, this.filteredOptions, this.cascaderProps);
|
|
98633
|
+
if (items.length === 0 && selection.size() > 0 && !selection.isCompactSelection()) {
|
|
98634
|
+
const paths = selection.getCheckedPaths();
|
|
98635
|
+
if (paths.length > 0) {
|
|
98636
|
+
items = CascaderUtilsPro.getAggregatedSelectedItems(paths, this.filteredOptions, this.cascaderProps);
|
|
98637
|
+
}
|
|
98638
|
+
}
|
|
98591
98639
|
this.selectedItems = items;
|
|
98592
98640
|
this.selectedCount = items.length;
|
|
98593
98641
|
this.isAllSelected = selection.size() === store.totalLeafCount && store.totalLeafCount > 0;
|
|
@@ -98608,18 +98656,18 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98608
98656
|
this.updateSelectedItems();
|
|
98609
98657
|
panel.bumpSelectionView();
|
|
98610
98658
|
},
|
|
98611
|
-
|
|
98612
|
-
|
|
98613
|
-
|
|
98614
|
-
|
|
98615
|
-
|
|
98616
|
-
|
|
98617
|
-
|
|
98618
|
-
|
|
98619
|
-
|
|
98620
|
-
|
|
98659
|
+
/**
|
|
98660
|
+
* 用户操作(勾选/全选/清除/删除)统一提交:更新展示 + emit,标记内部更新防回显覆盖
|
|
98661
|
+
*/
|
|
98662
|
+
commitUserSelectionChange() {
|
|
98663
|
+
this.isInternalUpdate = true;
|
|
98664
|
+
this.applyPanelSelectionChange();
|
|
98665
|
+
},
|
|
98666
|
+
/**
|
|
98667
|
+
* 向父组件 emit 当前选中(仅用户操作路径调用,外部回显走 syncPanelFromExternalValue 不 emit)
|
|
98668
|
+
*/
|
|
98669
|
+
emitSelectionToParent() {
|
|
98621
98670
|
if (this.aggregationMode) {
|
|
98622
|
-
this.isInternalUpdate = true;
|
|
98623
98671
|
let emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
|
|
98624
98672
|
if (!this.isMultiple && emitValue.length > 0) {
|
|
98625
98673
|
emitValue = emitValue[0];
|
|
@@ -98628,25 +98676,28 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98628
98676
|
this.$emit('change', this.getSelectedData());
|
|
98629
98677
|
return;
|
|
98630
98678
|
}
|
|
98631
|
-
|
|
98632
|
-
|
|
98679
|
+
const panel = this.$refs.cascaderPanel;
|
|
98680
|
+
const isCompact = panel && panel.selection && panel.selection.isCompactSelection();
|
|
98681
|
+
if (isCompact) {
|
|
98633
98682
|
this.$emit('input', this.currentValue);
|
|
98634
98683
|
this.$emit('change', this.getSelectedData());
|
|
98635
98684
|
return;
|
|
98636
98685
|
}
|
|
98637
98686
|
this.$nextTick(() => {
|
|
98638
|
-
this.isInternalUpdate = true;
|
|
98639
98687
|
let emitValue = this.currentValue;
|
|
98640
|
-
if (this.aggregationMode) {
|
|
98641
|
-
emitValue = CascaderUtilsPro.getAggregatedEmitValues(this.selectedItems, this.parentNodePrefix);
|
|
98642
|
-
if (!this.isMultiple && emitValue.length > 0) {
|
|
98643
|
-
emitValue = emitValue[0];
|
|
98644
|
-
}
|
|
98645
|
-
}
|
|
98646
98688
|
this.$emit('input', emitValue);
|
|
98647
98689
|
this.$emit('change', this.getSelectedData());
|
|
98648
98690
|
});
|
|
98649
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
|
+
},
|
|
98650
98701
|
buildSelectedItemsFromValuesLazy(panel) {
|
|
98651
98702
|
if (!panel || !panel.selection) {
|
|
98652
98703
|
return [];
|
|
@@ -98661,18 +98712,26 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98661
98712
|
if (!panel || !panel.selection || !panel.store) {
|
|
98662
98713
|
return false;
|
|
98663
98714
|
}
|
|
98715
|
+
this.isExternalSync = true;
|
|
98664
98716
|
if (!this.hasExternalValue()) {
|
|
98665
|
-
panel.
|
|
98717
|
+
if (panel.selection) {
|
|
98718
|
+
panel.selection.clear();
|
|
98719
|
+
panel.bumpSelectionView();
|
|
98720
|
+
}
|
|
98666
98721
|
this.selectedItems = [];
|
|
98667
98722
|
this.selectedValues = [];
|
|
98723
|
+
this.isExternalSync = false;
|
|
98668
98724
|
return true;
|
|
98669
98725
|
}
|
|
98670
98726
|
panel.selection.clear();
|
|
98671
|
-
this.
|
|
98727
|
+
this.getExternalValueList().forEach(val => {
|
|
98728
|
+
CascaderUtilsPro.addValueToSelection(panel.store, panel.selection, val, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
98729
|
+
});
|
|
98672
98730
|
panel.selection._reconcileAllRoots();
|
|
98673
98731
|
panel.bumpSelectionView();
|
|
98674
98732
|
this.refreshSelectionDisplayFromPanel();
|
|
98675
98733
|
this.expandPanelToExternalValue(panel);
|
|
98734
|
+
this.isExternalSync = false;
|
|
98676
98735
|
return true;
|
|
98677
98736
|
},
|
|
98678
98737
|
hasExternalValue() {
|
|
@@ -98685,46 +98744,6 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98685
98744
|
}
|
|
98686
98745
|
return true;
|
|
98687
98746
|
},
|
|
98688
|
-
applyExternalValueToPanelSelection(panel) {
|
|
98689
|
-
const {
|
|
98690
|
-
store,
|
|
98691
|
-
selection
|
|
98692
|
-
} = 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
|
-
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
|
-
}
|
|
98726
|
-
});
|
|
98727
|
-
},
|
|
98728
98747
|
getExternalValueList() {
|
|
98729
98748
|
const val = this.value;
|
|
98730
98749
|
if (val == null || val === '') {
|
|
@@ -98748,12 +98767,16 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98748
98767
|
}
|
|
98749
98768
|
},
|
|
98750
98769
|
schedulePanelSyncFromExternalValue(retry = 0) {
|
|
98770
|
+
if (this.isInternalUpdate || this.isExternalSync) {
|
|
98771
|
+
return;
|
|
98772
|
+
}
|
|
98751
98773
|
this.clearPanelSyncTimer();
|
|
98752
98774
|
this.$nextTick(() => {
|
|
98753
98775
|
if (!this.hasExternalValue()) {
|
|
98754
98776
|
const panel = this.$refs.cascaderPanel;
|
|
98755
98777
|
if (panel && panel.selection) {
|
|
98756
|
-
panel.
|
|
98778
|
+
panel.selection.clear();
|
|
98779
|
+
panel.bumpSelectionView();
|
|
98757
98780
|
}
|
|
98758
98781
|
this.selectedItems = [];
|
|
98759
98782
|
this.selectedValues = [];
|
|
@@ -98994,7 +99017,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
98994
99017
|
const paths = [];
|
|
98995
99018
|
panel.selection.selectedLeafSet.forEach(leaf => {
|
|
98996
99019
|
if (searchLeafSet.has(leaf)) {
|
|
98997
|
-
const path = panel.store
|
|
99020
|
+
const path = getStoreLeafPath(panel.store, leaf);
|
|
98998
99021
|
if (path) {
|
|
98999
99022
|
paths.push(path);
|
|
99000
99023
|
}
|
|
@@ -99034,9 +99057,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99034
99057
|
this.$refs.searchCascaderPanel.expandPathValues([firstOption[valueKey]], true);
|
|
99035
99058
|
}
|
|
99036
99059
|
},
|
|
99037
|
-
//
|
|
99060
|
+
// 值变化处理(面板勾选)
|
|
99038
99061
|
handleValueChange() {
|
|
99039
|
-
this.
|
|
99062
|
+
this.commitUserSelectionChange();
|
|
99040
99063
|
},
|
|
99041
99064
|
// 搜索模式值变化处理
|
|
99042
99065
|
handleSearchValueChange() {
|
|
@@ -99057,7 +99080,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99057
99080
|
});
|
|
99058
99081
|
mainPanel.selection._reconcileAllRoots();
|
|
99059
99082
|
mainPanel.bumpSelectionView();
|
|
99060
|
-
this.
|
|
99083
|
+
this.commitUserSelectionChange();
|
|
99061
99084
|
},
|
|
99062
99085
|
// 移除已选项
|
|
99063
99086
|
removeItem(item, index) {
|
|
@@ -99085,7 +99108,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99085
99108
|
panel.selection.toggleNode(node.id, false);
|
|
99086
99109
|
}
|
|
99087
99110
|
}
|
|
99088
|
-
this.
|
|
99111
|
+
this.commitUserSelectionChange();
|
|
99089
99112
|
if (this.isShowSearch) {
|
|
99090
99113
|
this.syncSearchPanelSelection();
|
|
99091
99114
|
}
|
|
@@ -99111,32 +99134,35 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99111
99134
|
this.$emit('input', emitValue);
|
|
99112
99135
|
});
|
|
99113
99136
|
},
|
|
99137
|
+
clearPanelSelectionState(panel) {
|
|
99138
|
+
if (!panel || !panel.selection) {
|
|
99139
|
+
return;
|
|
99140
|
+
}
|
|
99141
|
+
panel.selection.clear();
|
|
99142
|
+
panel.bumpSelectionView();
|
|
99143
|
+
},
|
|
99114
99144
|
// 全选/取消全选
|
|
99115
99145
|
handleSelectAll() {
|
|
99116
99146
|
if (!this.isMultiple) {
|
|
99117
|
-
// 单选模式下不支持全选
|
|
99118
99147
|
return;
|
|
99119
99148
|
}
|
|
99149
|
+
const panel = this.$refs.cascaderPanel;
|
|
99150
|
+
const searchPanel = this.$refs.searchCascaderPanel;
|
|
99120
99151
|
if (this.isAllSelected) {
|
|
99121
|
-
|
|
99122
|
-
|
|
99123
|
-
|
|
99124
|
-
|
|
99125
|
-
|
|
99126
|
-
|
|
99127
|
-
|
|
99128
|
-
|
|
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();
|
|
99129
99161
|
}
|
|
99130
99162
|
} else {
|
|
99131
|
-
|
|
99132
|
-
if (panel) {
|
|
99133
|
-
panel.selectAllLeaves();
|
|
99134
|
-
} else {
|
|
99135
|
-
this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
99136
|
-
this.updateSelectedItems();
|
|
99137
|
-
this.applyPanelSelectionChange();
|
|
99138
|
-
}
|
|
99163
|
+
this.selectedValues = CascaderUtilsPro.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
99139
99164
|
}
|
|
99165
|
+
this.commitUserSelectionChange();
|
|
99140
99166
|
},
|
|
99141
99167
|
// 获取选中的数据
|
|
99142
99168
|
getSelectedData() {
|
|
@@ -99162,14 +99188,12 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99162
99188
|
// 清空选择
|
|
99163
99189
|
clearSelection() {
|
|
99164
99190
|
const panel = this.$refs.cascaderPanel;
|
|
99165
|
-
|
|
99166
|
-
|
|
99167
|
-
|
|
99168
|
-
|
|
99169
|
-
|
|
99170
|
-
|
|
99171
|
-
this.applyPanelSelectionChange();
|
|
99172
|
-
}
|
|
99191
|
+
const searchPanel = this.$refs.searchCascaderPanel;
|
|
99192
|
+
this.clearPanelSelectionState(panel);
|
|
99193
|
+
this.clearPanelSelectionState(searchPanel);
|
|
99194
|
+
this.selectedValues = [];
|
|
99195
|
+
this.searchSelectedValues = [];
|
|
99196
|
+
this.commitUserSelectionChange();
|
|
99173
99197
|
},
|
|
99174
99198
|
// 设置选择值
|
|
99175
99199
|
setValue(values) {
|
|
@@ -99220,15 +99244,10 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99220
99244
|
const findPath = (options, targetValues, currentPath = []) => {
|
|
99221
99245
|
for (const option of options) {
|
|
99222
99246
|
const newPath = [...currentPath, option[this.cascaderProps.value]];
|
|
99223
|
-
if (targetValues.some(target => target == option[this.cascaderProps.value])) {
|
|
99224
|
-
|
|
99225
|
-
if (!option[this.cascaderProps.children]) {
|
|
99226
|
-
paths.push(newPath);
|
|
99227
|
-
}
|
|
99247
|
+
if (targetValues.some(target => target == option[this.cascaderProps.value]) && CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
|
|
99248
|
+
paths.push(newPath);
|
|
99228
99249
|
}
|
|
99229
|
-
|
|
99230
|
-
// 递归查找子节点
|
|
99231
|
-
if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
|
|
99250
|
+
if (!CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps)) {
|
|
99232
99251
|
findPath(option[this.cascaderProps.children], targetValues, newPath);
|
|
99233
99252
|
}
|
|
99234
99253
|
}
|
|
@@ -99273,7 +99292,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99273
99292
|
});
|
|
99274
99293
|
panel.selection._reconcileAllRoots();
|
|
99275
99294
|
panel.bumpSelectionView();
|
|
99276
|
-
this.
|
|
99295
|
+
this.commitUserSelectionChange();
|
|
99277
99296
|
} else {
|
|
99278
99297
|
const newSelectedValues = [...this.selectedValues];
|
|
99279
99298
|
matchedPaths.forEach(path => {
|
|
@@ -99318,7 +99337,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99318
99337
|
});
|
|
99319
99338
|
|
|
99320
99339
|
// 检查是否为叶子节点且匹配且未禁用
|
|
99321
|
-
const isLeafNode =
|
|
99340
|
+
const isLeafNode = CascaderUtilsPro.isTreeLeafNode(option, this.cascaderProps);
|
|
99322
99341
|
const isNotDisabled = !this.isItemDisabled(option);
|
|
99323
99342
|
if (isMatched && isLeafNode && isNotDisabled) {
|
|
99324
99343
|
// 如果是叶子节点、匹配且未禁用,添加到结果中
|
|
@@ -99371,8 +99390,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
|
|
|
99371
99390
|
;
|
|
99372
99391
|
var ByCascaderPanelPro_component = normalizeComponent(
|
|
99373
99392
|
cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
|
|
99374
|
-
|
|
99375
|
-
|
|
99393
|
+
ByCascaderPanelProvue_type_template_id_e4b10a08_render,
|
|
99394
|
+
ByCascaderPanelProvue_type_template_id_e4b10a08_staticRenderFns,
|
|
99376
99395
|
false,
|
|
99377
99396
|
null,
|
|
99378
99397
|
null,
|