@weitutech/by-components 1.1.219 → 1.1.221
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 +703 -0
- package/lib/by-components.umd.js +703 -0
- package/lib/by-components.umd.min.js +56 -56
- package/lib/index.css +1 -1
- package/package.json +1 -1
|
@@ -74293,6 +74293,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
74293
74293
|
ByTable: function() { return /* reexport */ table; },
|
|
74294
74294
|
ByTag: function() { return /* reexport */ ByTag; },
|
|
74295
74295
|
ByToolBar: function() { return /* reexport */ ByToolBar; },
|
|
74296
|
+
ByTreePanel: function() { return /* reexport */ ByTreePanel; },
|
|
74296
74297
|
ByTreeSearch: function() { return /* reexport */ ByTreeSearch; },
|
|
74297
74298
|
GridItem: function() { return /* reexport */ vue_grid_layout_common.GridItem; },
|
|
74298
74299
|
ToolBarItemType: function() { return /* reexport */ ToolBarItemType; },
|
|
@@ -96014,6 +96015,706 @@ var ByCascaderPanel_component = normalizeComponent(
|
|
|
96014
96015
|
)
|
|
96015
96016
|
|
|
96016
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/tree-panel/ByTreePanel.vue?vue&type=template&id=af06ba0a
|
|
96019
|
+
var ByTreePanelvue_type_template_id_af06ba0a_render = function render() {
|
|
96020
|
+
var _vm = this,
|
|
96021
|
+
_c = _vm._self._c;
|
|
96022
|
+
return _c('div', {
|
|
96023
|
+
staticClass: "tree-panel"
|
|
96024
|
+
}, [_c('div', {
|
|
96025
|
+
staticClass: "panel-container"
|
|
96026
|
+
}, [_c('div', {
|
|
96027
|
+
staticClass: "left-panel"
|
|
96028
|
+
}, [_c('div', {
|
|
96029
|
+
staticClass: "panel-header"
|
|
96030
|
+
}, [!_vm.aggregationMode ? _c('div', {
|
|
96031
|
+
staticClass: "panel-title"
|
|
96032
|
+
}, [_vm._v("可选(" + _vm._s(_vm.selectedCount) + "/" + _vm._s(_vm.totalCount) + ")")]) : _vm._e(), _c('div', {
|
|
96033
|
+
staticClass: "search-section"
|
|
96034
|
+
}, [_c('div', {
|
|
96035
|
+
staticClass: "search-container"
|
|
96036
|
+
}, [_c('el-input', {
|
|
96037
|
+
staticClass: "search-input",
|
|
96038
|
+
attrs: {
|
|
96039
|
+
"placeholder": _vm.searchPlaceholder,
|
|
96040
|
+
"clearable": "",
|
|
96041
|
+
"size": "mini",
|
|
96042
|
+
"disabled": _vm.isViewMode
|
|
96043
|
+
},
|
|
96044
|
+
on: {
|
|
96045
|
+
"input": _vm.handleSearch
|
|
96046
|
+
},
|
|
96047
|
+
model: {
|
|
96048
|
+
value: _vm.searchInput,
|
|
96049
|
+
callback: function ($$v) {
|
|
96050
|
+
_vm.searchInput = $$v;
|
|
96051
|
+
},
|
|
96052
|
+
expression: "searchInput"
|
|
96053
|
+
}
|
|
96054
|
+
}), _vm.isMultiple && !_vm.isViewMode ? _c('el-popover', {
|
|
96055
|
+
attrs: {
|
|
96056
|
+
"placement": "bottom-start",
|
|
96057
|
+
"width": 300,
|
|
96058
|
+
"trigger": "click",
|
|
96059
|
+
"popper-class": "batch-search-popover"
|
|
96060
|
+
},
|
|
96061
|
+
on: {
|
|
96062
|
+
"show": _vm.handleBatchSearchShow
|
|
96063
|
+
},
|
|
96064
|
+
model: {
|
|
96065
|
+
value: _vm.batchSearchVisible,
|
|
96066
|
+
callback: function ($$v) {
|
|
96067
|
+
_vm.batchSearchVisible = $$v;
|
|
96068
|
+
},
|
|
96069
|
+
expression: "batchSearchVisible"
|
|
96070
|
+
}
|
|
96071
|
+
}, [_c('div', {
|
|
96072
|
+
staticClass: "batch-search-container"
|
|
96073
|
+
}, [_c('div', {
|
|
96074
|
+
staticClass: "popover-title"
|
|
96075
|
+
}, [_vm._v("批量输入")]), _c('el-input', {
|
|
96076
|
+
staticClass: "batch-search-textarea",
|
|
96077
|
+
attrs: {
|
|
96078
|
+
"type": "textarea",
|
|
96079
|
+
"rows": 12,
|
|
96080
|
+
"placeholder": "请输入名称,多个名称用换行、逗号、分号、空格分隔"
|
|
96081
|
+
},
|
|
96082
|
+
model: {
|
|
96083
|
+
value: _vm.batchSearchContent,
|
|
96084
|
+
callback: function ($$v) {
|
|
96085
|
+
_vm.batchSearchContent = $$v;
|
|
96086
|
+
},
|
|
96087
|
+
expression: "batchSearchContent"
|
|
96088
|
+
}
|
|
96089
|
+
}), _c('div', {
|
|
96090
|
+
staticClass: "popover-footer"
|
|
96091
|
+
}, [_c('el-button', {
|
|
96092
|
+
attrs: {
|
|
96093
|
+
"size": "mini"
|
|
96094
|
+
},
|
|
96095
|
+
on: {
|
|
96096
|
+
"click": function ($event) {
|
|
96097
|
+
_vm.batchSearchVisible = false;
|
|
96098
|
+
}
|
|
96099
|
+
}
|
|
96100
|
+
}, [_vm._v("取消")]), _c('el-button', {
|
|
96101
|
+
attrs: {
|
|
96102
|
+
"size": "mini",
|
|
96103
|
+
"type": "primary"
|
|
96104
|
+
},
|
|
96105
|
+
on: {
|
|
96106
|
+
"click": _vm.handleBatchSearch
|
|
96107
|
+
}
|
|
96108
|
+
}, [_vm._v("确定")])], 1)], 1), _c('el-button', {
|
|
96109
|
+
staticClass: "batch-search-btn",
|
|
96110
|
+
attrs: {
|
|
96111
|
+
"slot": "reference",
|
|
96112
|
+
"size": "mini",
|
|
96113
|
+
"type": "text"
|
|
96114
|
+
},
|
|
96115
|
+
slot: "reference"
|
|
96116
|
+
}, [_c('i', {
|
|
96117
|
+
staticClass: "el-icon-edit-outline"
|
|
96118
|
+
})])], 1) : _vm._e()], 1)]), _c('div', {
|
|
96119
|
+
staticClass: "action-buttons"
|
|
96120
|
+
}, [_vm.searchInput === '' && _vm.isMultiple && _vm.showSelectAll && !_vm.isViewMode ? _c('div', {
|
|
96121
|
+
staticClass: "all-select",
|
|
96122
|
+
on: {
|
|
96123
|
+
"click": _vm.handleSelectAll
|
|
96124
|
+
}
|
|
96125
|
+
}, [_vm._v(" " + _vm._s(_vm.isAllSelected ? '取消全选' : '全选') + " ")]) : _vm._e()])]), _c('div', {
|
|
96126
|
+
staticClass: "panel-content",
|
|
96127
|
+
style: {
|
|
96128
|
+
height: _vm.computedPanelHeight + 'px'
|
|
96129
|
+
}
|
|
96130
|
+
}, [_c('div', {
|
|
96131
|
+
staticClass: "tree-content-wrapper"
|
|
96132
|
+
}, [_vm.displayOptions.length > 0 ? _c('el-tree', {
|
|
96133
|
+
ref: "tree",
|
|
96134
|
+
staticClass: "tree-panel-inner",
|
|
96135
|
+
attrs: {
|
|
96136
|
+
"data": _vm.displayOptions,
|
|
96137
|
+
"props": _vm.treeFieldProps,
|
|
96138
|
+
"node-key": _vm.nodeKey,
|
|
96139
|
+
"show-checkbox": _vm.isMultiple && !_vm.isViewMode,
|
|
96140
|
+
"check-strictly": false,
|
|
96141
|
+
"highlight-current": !_vm.isMultiple,
|
|
96142
|
+
"expand-on-click-node": !_vm.isMultiple,
|
|
96143
|
+
"default-expand-all": false,
|
|
96144
|
+
"filter-node-method": _vm.filterNodeMethod
|
|
96145
|
+
},
|
|
96146
|
+
on: {
|
|
96147
|
+
"check": _vm.handleTreeCheck,
|
|
96148
|
+
"node-click": _vm.handleNodeClick
|
|
96149
|
+
}
|
|
96150
|
+
}) : _vm.searchInput ? _c('div', {
|
|
96151
|
+
staticClass: "empty-search"
|
|
96152
|
+
}, [_c('el-empty', {
|
|
96153
|
+
attrs: {
|
|
96154
|
+
"image-size": 100
|
|
96155
|
+
}
|
|
96156
|
+
})], 1) : _vm._e()], 1)])]), _c('div', {
|
|
96157
|
+
staticClass: "right-panel"
|
|
96158
|
+
}, [_c('div', {
|
|
96159
|
+
staticClass: "panel-header"
|
|
96160
|
+
}, [_c('div', {
|
|
96161
|
+
staticClass: "panel-title"
|
|
96162
|
+
}, [_vm._v("已选(" + _vm._s(_vm.selectedItems.length) + ")")]), _c('div', {
|
|
96163
|
+
staticClass: "action-buttons"
|
|
96164
|
+
}, [_vm.selectedItems.length > 0 && !_vm.isViewMode ? _c('div', {
|
|
96165
|
+
staticClass: "clear-btn",
|
|
96166
|
+
on: {
|
|
96167
|
+
"click": _vm.clearSelection
|
|
96168
|
+
}
|
|
96169
|
+
}, [_vm._v("清除")]) : _vm._e()])]), _c('div', {
|
|
96170
|
+
staticClass: "panel-content",
|
|
96171
|
+
style: {
|
|
96172
|
+
height: _vm.computedPanelHeight - 5 + 'px'
|
|
96173
|
+
}
|
|
96174
|
+
}, [_c('div', {
|
|
96175
|
+
staticClass: "selected-list"
|
|
96176
|
+
}, [_vm._l(_vm.selectedItems, function (item, index) {
|
|
96177
|
+
return _c('div', {
|
|
96178
|
+
key: _vm.getSelectedItemKey(item, index),
|
|
96179
|
+
staticClass: "selected-item"
|
|
96180
|
+
}, [_c('div', {
|
|
96181
|
+
staticClass: "item-content"
|
|
96182
|
+
}, [_c('div', {
|
|
96183
|
+
staticClass: "item-label"
|
|
96184
|
+
}, [_vm._v(_vm._s(item.label || ''))]), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
|
|
96185
|
+
staticClass: "item-subtitle"
|
|
96186
|
+
}, [_vm._v(" " + _vm._s(item[_vm.subtitleField]) + " ")]) : _vm._e()]), !_vm.isViewMode ? _c('div', {
|
|
96187
|
+
staticClass: "remove-btn",
|
|
96188
|
+
on: {
|
|
96189
|
+
"click": function ($event) {
|
|
96190
|
+
return _vm.removeItem(item, index);
|
|
96191
|
+
}
|
|
96192
|
+
}
|
|
96193
|
+
}, [_c('i', {
|
|
96194
|
+
staticClass: "el-icon-close"
|
|
96195
|
+
})]) : _vm._e()]);
|
|
96196
|
+
}), _vm.selectedItems.length === 0 ? _c('div', {
|
|
96197
|
+
staticClass: "empty-state"
|
|
96198
|
+
}, [_vm._v("暂无选中项")]) : _vm._e()], 2)])])])]);
|
|
96199
|
+
};
|
|
96200
|
+
var ByTreePanelvue_type_template_id_af06ba0a_staticRenderFns = [];
|
|
96201
|
+
|
|
96202
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./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/tree-panel/ByTreePanel.vue?vue&type=script&lang=js
|
|
96203
|
+
|
|
96204
|
+
|
|
96205
|
+
|
|
96206
|
+
|
|
96207
|
+
|
|
96208
|
+
|
|
96209
|
+
|
|
96210
|
+
|
|
96211
|
+
/* harmony default export */ var ByTreePanelvue_type_script_lang_js = ({
|
|
96212
|
+
name: 'ByTreePanel',
|
|
96213
|
+
props: {
|
|
96214
|
+
options: {
|
|
96215
|
+
type: Array,
|
|
96216
|
+
default: () => []
|
|
96217
|
+
},
|
|
96218
|
+
value: {
|
|
96219
|
+
type: [Array, Number, String],
|
|
96220
|
+
default: () => []
|
|
96221
|
+
},
|
|
96222
|
+
cascaderProps: {
|
|
96223
|
+
type: Object,
|
|
96224
|
+
default: () => ({
|
|
96225
|
+
multiple: true,
|
|
96226
|
+
label: 'label',
|
|
96227
|
+
value: 'value',
|
|
96228
|
+
children: 'children'
|
|
96229
|
+
})
|
|
96230
|
+
},
|
|
96231
|
+
panelHeight: {
|
|
96232
|
+
type: [String, Number],
|
|
96233
|
+
default: 300
|
|
96234
|
+
},
|
|
96235
|
+
searchPlaceholder: {
|
|
96236
|
+
type: String,
|
|
96237
|
+
default: '请输入名称搜索'
|
|
96238
|
+
},
|
|
96239
|
+
disabledField: {
|
|
96240
|
+
type: String,
|
|
96241
|
+
default: 'disabled'
|
|
96242
|
+
},
|
|
96243
|
+
disabledValue: {
|
|
96244
|
+
type: [String, Number, Boolean],
|
|
96245
|
+
default: true
|
|
96246
|
+
},
|
|
96247
|
+
disabledCheck: {
|
|
96248
|
+
type: Function,
|
|
96249
|
+
default: null
|
|
96250
|
+
},
|
|
96251
|
+
showSelectAll: {
|
|
96252
|
+
type: Boolean,
|
|
96253
|
+
default: true
|
|
96254
|
+
},
|
|
96255
|
+
aggregationMode: {
|
|
96256
|
+
type: Boolean,
|
|
96257
|
+
default: false
|
|
96258
|
+
},
|
|
96259
|
+
parentNodePrefix: {
|
|
96260
|
+
type: String,
|
|
96261
|
+
default: '__parent__'
|
|
96262
|
+
},
|
|
96263
|
+
isViewMode: {
|
|
96264
|
+
type: Boolean,
|
|
96265
|
+
default: false
|
|
96266
|
+
},
|
|
96267
|
+
showSubtitle: {
|
|
96268
|
+
type: Boolean,
|
|
96269
|
+
default: false
|
|
96270
|
+
},
|
|
96271
|
+
subtitleField: {
|
|
96272
|
+
type: String,
|
|
96273
|
+
default: ''
|
|
96274
|
+
}
|
|
96275
|
+
},
|
|
96276
|
+
data() {
|
|
96277
|
+
return {
|
|
96278
|
+
selectedValues: [],
|
|
96279
|
+
filteredOptions: [],
|
|
96280
|
+
displayOptions: [],
|
|
96281
|
+
selectedItems: [],
|
|
96282
|
+
searchInput: '',
|
|
96283
|
+
totalCount: 0,
|
|
96284
|
+
selectedCount: 0,
|
|
96285
|
+
isAllSelected: false,
|
|
96286
|
+
isInternalUpdate: false,
|
|
96287
|
+
batchSearchVisible: false,
|
|
96288
|
+
batchSearchContent: '',
|
|
96289
|
+
searchDebounceTimer: null,
|
|
96290
|
+
isSyncingTree: false
|
|
96291
|
+
};
|
|
96292
|
+
},
|
|
96293
|
+
computed: {
|
|
96294
|
+
computedPanelHeight() {
|
|
96295
|
+
const height = Number(this.panelHeight);
|
|
96296
|
+
if (isNaN(height)) return 300;
|
|
96297
|
+
return Math.max(200, Math.min(800, height));
|
|
96298
|
+
},
|
|
96299
|
+
isMultiple() {
|
|
96300
|
+
return this.cascaderProps.multiple !== false;
|
|
96301
|
+
},
|
|
96302
|
+
valueKey() {
|
|
96303
|
+
return this.cascaderProps.value || 'value';
|
|
96304
|
+
},
|
|
96305
|
+
labelKey() {
|
|
96306
|
+
return this.cascaderProps.label || 'label';
|
|
96307
|
+
},
|
|
96308
|
+
childrenKey() {
|
|
96309
|
+
return this.cascaderProps.children || 'children';
|
|
96310
|
+
},
|
|
96311
|
+
nodeKey() {
|
|
96312
|
+
return this.valueKey;
|
|
96313
|
+
},
|
|
96314
|
+
treeFieldProps() {
|
|
96315
|
+
return {
|
|
96316
|
+
label: this.labelKey,
|
|
96317
|
+
children: this.childrenKey,
|
|
96318
|
+
disabled: 'disabled'
|
|
96319
|
+
};
|
|
96320
|
+
},
|
|
96321
|
+
disabledConfig() {
|
|
96322
|
+
return {
|
|
96323
|
+
disabledField: this.disabledField,
|
|
96324
|
+
disabledValue: this.disabledValue,
|
|
96325
|
+
disabledCheck: this.disabledCheck
|
|
96326
|
+
};
|
|
96327
|
+
},
|
|
96328
|
+
currentValue() {
|
|
96329
|
+
if (this.isMultiple) {
|
|
96330
|
+
return this.selectedItems.map(item => item.value);
|
|
96331
|
+
}
|
|
96332
|
+
return this.selectedItems.length > 0 ? this.selectedItems[0].value : null;
|
|
96333
|
+
}
|
|
96334
|
+
},
|
|
96335
|
+
watch: {
|
|
96336
|
+
options: {
|
|
96337
|
+
handler() {
|
|
96338
|
+
this.initOptions();
|
|
96339
|
+
},
|
|
96340
|
+
immediate: true
|
|
96341
|
+
},
|
|
96342
|
+
value: {
|
|
96343
|
+
handler() {
|
|
96344
|
+
if (this.isInternalUpdate) {
|
|
96345
|
+
this.isInternalUpdate = false;
|
|
96346
|
+
return;
|
|
96347
|
+
}
|
|
96348
|
+
if (!this.filteredOptions.length) return;
|
|
96349
|
+
this.processValue();
|
|
96350
|
+
},
|
|
96351
|
+
deep: true
|
|
96352
|
+
},
|
|
96353
|
+
selectedValues: {
|
|
96354
|
+
handler() {
|
|
96355
|
+
this.updateSelectAllState();
|
|
96356
|
+
},
|
|
96357
|
+
deep: true
|
|
96358
|
+
}
|
|
96359
|
+
},
|
|
96360
|
+
mounted() {
|
|
96361
|
+
this.$nextTick(() => {
|
|
96362
|
+
this.updateSelectedItems();
|
|
96363
|
+
this.syncTreeCheckedState();
|
|
96364
|
+
});
|
|
96365
|
+
},
|
|
96366
|
+
beforeDestroy() {
|
|
96367
|
+
if (this.searchDebounceTimer) {
|
|
96368
|
+
clearTimeout(this.searchDebounceTimer);
|
|
96369
|
+
}
|
|
96370
|
+
},
|
|
96371
|
+
methods: {
|
|
96372
|
+
initOptions() {
|
|
96373
|
+
this.filteredOptions = this.processOptions(this.options);
|
|
96374
|
+
this.displayOptions = this.filteredOptions;
|
|
96375
|
+
this.countTotalItems();
|
|
96376
|
+
this.processValue();
|
|
96377
|
+
},
|
|
96378
|
+
processOptions(options) {
|
|
96379
|
+
const processedOptions = this.cloneTree(options);
|
|
96380
|
+
if (this.isViewMode) {
|
|
96381
|
+
const disabledKey = this.cascaderProps && this.cascaderProps.disabled || 'disabled';
|
|
96382
|
+
const dfs = items => {
|
|
96383
|
+
items.forEach(item => {
|
|
96384
|
+
item[disabledKey] = true;
|
|
96385
|
+
if (item[this.childrenKey] && item[this.childrenKey].length > 0) {
|
|
96386
|
+
dfs(item[this.childrenKey]);
|
|
96387
|
+
}
|
|
96388
|
+
});
|
|
96389
|
+
};
|
|
96390
|
+
dfs(processedOptions);
|
|
96391
|
+
return processedOptions;
|
|
96392
|
+
}
|
|
96393
|
+
CascaderUtils.setDisabledItems(processedOptions, this.disabledConfig, this.cascaderProps);
|
|
96394
|
+
return processedOptions;
|
|
96395
|
+
},
|
|
96396
|
+
cloneTree(options) {
|
|
96397
|
+
if (!Array.isArray(options)) return [];
|
|
96398
|
+
return options.map(item => {
|
|
96399
|
+
const cloned = {
|
|
96400
|
+
...item
|
|
96401
|
+
};
|
|
96402
|
+
if (item[this.childrenKey] && item[this.childrenKey].length > 0) {
|
|
96403
|
+
cloned[this.childrenKey] = this.cloneTree(item[this.childrenKey]);
|
|
96404
|
+
}
|
|
96405
|
+
return cloned;
|
|
96406
|
+
});
|
|
96407
|
+
},
|
|
96408
|
+
countTotalItems() {
|
|
96409
|
+
this.totalCount = CascaderUtils.countTotalItems(this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
96410
|
+
},
|
|
96411
|
+
processValue() {
|
|
96412
|
+
if (!this.filteredOptions.length) return;
|
|
96413
|
+
if (this.isMultiple) {
|
|
96414
|
+
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
96415
|
+
if (typeof this.value[0] === 'string' || typeof this.value[0] === 'number') {
|
|
96416
|
+
if (this.aggregationMode) {
|
|
96417
|
+
this.selectedValues = CascaderUtils.processValuesWithParentNodes(this.value, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
96418
|
+
} else {
|
|
96419
|
+
this.selectedValues = CascaderUtils.findPathsByValues(this.value, this.filteredOptions, this.cascaderProps);
|
|
96420
|
+
}
|
|
96421
|
+
} else {
|
|
96422
|
+
this.selectedValues = [...this.value];
|
|
96423
|
+
}
|
|
96424
|
+
} else {
|
|
96425
|
+
this.selectedValues = [];
|
|
96426
|
+
}
|
|
96427
|
+
} else if (this.value !== null && this.value !== undefined && this.value !== '') {
|
|
96428
|
+
if (Array.isArray(this.value)) {
|
|
96429
|
+
this.selectedValues = [...this.value];
|
|
96430
|
+
} else if (this.aggregationMode) {
|
|
96431
|
+
this.selectedValues = CascaderUtils.processValuesWithParentNodes([this.value], this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
96432
|
+
} else {
|
|
96433
|
+
this.selectedValues = CascaderUtils.findPathsByValues([this.value], this.filteredOptions, this.cascaderProps);
|
|
96434
|
+
}
|
|
96435
|
+
} else {
|
|
96436
|
+
this.selectedValues = [];
|
|
96437
|
+
}
|
|
96438
|
+
this.updateSelectedItems();
|
|
96439
|
+
this.syncTreeCheckedState();
|
|
96440
|
+
},
|
|
96441
|
+
updateSelectedItems() {
|
|
96442
|
+
if (this.aggregationMode) {
|
|
96443
|
+
this.selectedItems = CascaderUtils.getAggregatedSelectedItems(this.selectedValues, this.filteredOptions, this.cascaderProps);
|
|
96444
|
+
} else {
|
|
96445
|
+
this.selectedItems = CascaderUtils.buildSelectedItemsFromValues(this.selectedValues, this.filteredOptions, this.cascaderProps);
|
|
96446
|
+
}
|
|
96447
|
+
this.selectedCount = this.selectedItems.length;
|
|
96448
|
+
this.$emit('change', this.getSelectedData());
|
|
96449
|
+
},
|
|
96450
|
+
updateSelectAllState() {
|
|
96451
|
+
if (!this.isMultiple) return;
|
|
96452
|
+
if (this.aggregationMode) {
|
|
96453
|
+
this.isAllSelected = CascaderUtils.isAggregatedAllSelected(this.selectedValues, this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
96454
|
+
} else {
|
|
96455
|
+
this.isAllSelected = this.selectedCount === this.totalCount && this.totalCount > 0;
|
|
96456
|
+
}
|
|
96457
|
+
},
|
|
96458
|
+
getNodePath(node) {
|
|
96459
|
+
const tree = this.$refs.tree;
|
|
96460
|
+
let treeNode = node;
|
|
96461
|
+
|
|
96462
|
+
// getCheckedNodes 返回的是 data 对象,需转为内部 Node 才能取路径
|
|
96463
|
+
if (tree && treeNode && typeof treeNode.level !== 'number') {
|
|
96464
|
+
treeNode = tree.getNode(treeNode);
|
|
96465
|
+
}
|
|
96466
|
+
const path = [];
|
|
96467
|
+
let current = treeNode;
|
|
96468
|
+
while (current && current.level > 0) {
|
|
96469
|
+
path.unshift(current.data[this.valueKey]);
|
|
96470
|
+
current = current.parent;
|
|
96471
|
+
}
|
|
96472
|
+
return path;
|
|
96473
|
+
},
|
|
96474
|
+
syncTreeCheckedState() {
|
|
96475
|
+
this.$nextTick(() => {
|
|
96476
|
+
const tree = this.$refs.tree;
|
|
96477
|
+
if (!tree) return;
|
|
96478
|
+
this.isSyncingTree = true;
|
|
96479
|
+
if (this.isMultiple) {
|
|
96480
|
+
const leafKeys = this.selectedValues.map(path => path[path.length - 1]);
|
|
96481
|
+
tree.setCheckedKeys(leafKeys);
|
|
96482
|
+
} else if (this.selectedValues.length > 0) {
|
|
96483
|
+
const leafKey = this.selectedValues[0][this.selectedValues[0].length - 1];
|
|
96484
|
+
tree.setCurrentKey(leafKey);
|
|
96485
|
+
} else {
|
|
96486
|
+
tree.setCurrentKey(null);
|
|
96487
|
+
}
|
|
96488
|
+
this.$nextTick(() => {
|
|
96489
|
+
this.isSyncingTree = false;
|
|
96490
|
+
});
|
|
96491
|
+
});
|
|
96492
|
+
},
|
|
96493
|
+
handleTreeCheck() {
|
|
96494
|
+
if (this.isSyncingTree) return;
|
|
96495
|
+
const tree = this.$refs.tree;
|
|
96496
|
+
if (!tree) return;
|
|
96497
|
+
const leafKeys = tree.getCheckedKeys(true);
|
|
96498
|
+
this.selectedValues = CascaderUtils.findPathsByValues(leafKeys, this.filteredOptions, this.cascaderProps);
|
|
96499
|
+
this.updateSelectedItems();
|
|
96500
|
+
this.emitInput();
|
|
96501
|
+
},
|
|
96502
|
+
handleNodeClick(data, node) {
|
|
96503
|
+
if (this.isMultiple || this.isViewMode) return;
|
|
96504
|
+
const hasChildren = data[this.childrenKey] && data[this.childrenKey].length > 0;
|
|
96505
|
+
if (hasChildren) return;
|
|
96506
|
+
if (CascaderUtils.isItemDisabled(data, this.disabledConfig)) return;
|
|
96507
|
+
this.selectedValues = [this.getNodePath(node)];
|
|
96508
|
+
this.updateSelectedItems();
|
|
96509
|
+
this.emitInput();
|
|
96510
|
+
},
|
|
96511
|
+
handleSearch() {
|
|
96512
|
+
if (this.searchDebounceTimer) {
|
|
96513
|
+
clearTimeout(this.searchDebounceTimer);
|
|
96514
|
+
}
|
|
96515
|
+
this.searchDebounceTimer = setTimeout(() => {
|
|
96516
|
+
const keyword = this.searchInput.trim();
|
|
96517
|
+
if (!keyword) {
|
|
96518
|
+
this.displayOptions = this.filteredOptions;
|
|
96519
|
+
this.$nextTick(() => this.syncTreeCheckedState());
|
|
96520
|
+
return;
|
|
96521
|
+
}
|
|
96522
|
+
this.displayOptions = CascaderUtils.searchInTree(this.filteredOptions, keyword, this.cascaderProps);
|
|
96523
|
+
this.$nextTick(() => {
|
|
96524
|
+
this.syncTreeCheckedState();
|
|
96525
|
+
this.expandAllNodes();
|
|
96526
|
+
});
|
|
96527
|
+
}, 300);
|
|
96528
|
+
},
|
|
96529
|
+
expandAllNodes() {
|
|
96530
|
+
const tree = this.$refs.tree;
|
|
96531
|
+
if (!tree || !tree.store) return;
|
|
96532
|
+
const expandNode = node => {
|
|
96533
|
+
node.expanded = true;
|
|
96534
|
+
if (node.childNodes) {
|
|
96535
|
+
node.childNodes.forEach(expandNode);
|
|
96536
|
+
}
|
|
96537
|
+
};
|
|
96538
|
+
tree.store.root.childNodes.forEach(expandNode);
|
|
96539
|
+
},
|
|
96540
|
+
filterNodeMethod() {
|
|
96541
|
+
return true;
|
|
96542
|
+
},
|
|
96543
|
+
handleSelectAll() {
|
|
96544
|
+
if (!this.isMultiple) return;
|
|
96545
|
+
if (this.isAllSelected) {
|
|
96546
|
+
this.selectedValues = [];
|
|
96547
|
+
} else {
|
|
96548
|
+
this.selectedValues = CascaderUtils.getAllLeafPaths(this.filteredOptions, this.disabledConfig, this.cascaderProps);
|
|
96549
|
+
}
|
|
96550
|
+
this.updateSelectedItems();
|
|
96551
|
+
this.syncTreeCheckedState();
|
|
96552
|
+
this.emitInput();
|
|
96553
|
+
},
|
|
96554
|
+
removeItem(item) {
|
|
96555
|
+
const valueToRemove = item.value;
|
|
96556
|
+
this.selectedValues = this.selectedValues.filter(path => path[path.length - 1] !== valueToRemove);
|
|
96557
|
+
const tree = this.$refs.tree;
|
|
96558
|
+
if (tree) {
|
|
96559
|
+
tree.setChecked(valueToRemove, false, true);
|
|
96560
|
+
if (!this.isMultiple) {
|
|
96561
|
+
tree.setCurrentKey(null);
|
|
96562
|
+
}
|
|
96563
|
+
}
|
|
96564
|
+
this.updateSelectedItems();
|
|
96565
|
+
this.emitInput();
|
|
96566
|
+
},
|
|
96567
|
+
clearSelection() {
|
|
96568
|
+
this.selectedValues = [];
|
|
96569
|
+
this.updateSelectedItems();
|
|
96570
|
+
this.syncTreeCheckedState();
|
|
96571
|
+
this.emitInput();
|
|
96572
|
+
},
|
|
96573
|
+
emitInput() {
|
|
96574
|
+
this.$nextTick(() => {
|
|
96575
|
+
this.isInternalUpdate = true;
|
|
96576
|
+
let emitValue = this.currentValue;
|
|
96577
|
+
if (this.aggregationMode) {
|
|
96578
|
+
emitValue = CascaderUtils.getAggregatedSelectedValues(this.selectedValues, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
96579
|
+
if (!this.isMultiple && emitValue.length > 0) {
|
|
96580
|
+
emitValue = emitValue[0];
|
|
96581
|
+
}
|
|
96582
|
+
}
|
|
96583
|
+
this.$emit('input', emitValue);
|
|
96584
|
+
});
|
|
96585
|
+
},
|
|
96586
|
+
getSelectedData() {
|
|
96587
|
+
let values = this.currentValue;
|
|
96588
|
+
let valuesPath = this.selectedValues;
|
|
96589
|
+
if (this.aggregationMode) {
|
|
96590
|
+
values = CascaderUtils.getAggregatedSelectedValues(this.selectedValues, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
96591
|
+
valuesPath = CascaderUtils.getAggregatedSelectedPaths(this.selectedValues, this.filteredOptions, this.cascaderProps);
|
|
96592
|
+
if (!this.isMultiple && values.length > 0) {
|
|
96593
|
+
values = values[0];
|
|
96594
|
+
}
|
|
96595
|
+
}
|
|
96596
|
+
return {
|
|
96597
|
+
valuesPath,
|
|
96598
|
+
values,
|
|
96599
|
+
items: this.selectedItems,
|
|
96600
|
+
count: this.selectedItems.length
|
|
96601
|
+
};
|
|
96602
|
+
},
|
|
96603
|
+
setValue(values) {
|
|
96604
|
+
if (this.isMultiple) {
|
|
96605
|
+
if (Array.isArray(values) && values.length > 0) {
|
|
96606
|
+
if (typeof values[0] === 'string' || typeof values[0] === 'number') {
|
|
96607
|
+
if (this.aggregationMode) {
|
|
96608
|
+
this.selectedValues = CascaderUtils.processValuesWithParentNodes(values, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
96609
|
+
} else {
|
|
96610
|
+
this.selectedValues = CascaderUtils.findPathsByValues(values, this.filteredOptions, this.cascaderProps);
|
|
96611
|
+
}
|
|
96612
|
+
} else {
|
|
96613
|
+
this.selectedValues = [...values];
|
|
96614
|
+
}
|
|
96615
|
+
} else {
|
|
96616
|
+
this.selectedValues = [];
|
|
96617
|
+
}
|
|
96618
|
+
} else if (values !== null && values !== undefined && values !== '') {
|
|
96619
|
+
if (Array.isArray(values)) {
|
|
96620
|
+
this.selectedValues = [...values];
|
|
96621
|
+
} else if (this.aggregationMode) {
|
|
96622
|
+
this.selectedValues = CascaderUtils.processValuesWithParentNodes([values], this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
96623
|
+
} else {
|
|
96624
|
+
this.selectedValues = CascaderUtils.findPathsByValues([values], this.filteredOptions, this.cascaderProps);
|
|
96625
|
+
}
|
|
96626
|
+
} else {
|
|
96627
|
+
this.selectedValues = [];
|
|
96628
|
+
}
|
|
96629
|
+
this.syncTreeCheckedState();
|
|
96630
|
+
this.updateSelectedItems();
|
|
96631
|
+
},
|
|
96632
|
+
handleBatchSearchShow() {
|
|
96633
|
+
if (this.searchInput) {
|
|
96634
|
+
this.searchInput = '';
|
|
96635
|
+
this.displayOptions = this.filteredOptions;
|
|
96636
|
+
}
|
|
96637
|
+
},
|
|
96638
|
+
handleBatchSearch() {
|
|
96639
|
+
if (!this.batchSearchContent.trim()) {
|
|
96640
|
+
this.batchSearchVisible = false;
|
|
96641
|
+
return;
|
|
96642
|
+
}
|
|
96643
|
+
const inputNames = this.batchSearchContent.split(/[\n,;,;\s]+/).filter(item => item.trim()).map(item => item.trim());
|
|
96644
|
+
if (inputNames.length === 0) {
|
|
96645
|
+
this.batchSearchVisible = false;
|
|
96646
|
+
return;
|
|
96647
|
+
}
|
|
96648
|
+
const matchedPaths = this.searchNamesInTree(inputNames);
|
|
96649
|
+
if (matchedPaths.length > 0) {
|
|
96650
|
+
const newSelectedValues = [...this.selectedValues];
|
|
96651
|
+
matchedPaths.forEach(path => {
|
|
96652
|
+
const exists = newSelectedValues.some(existingPath => existingPath.length === path.length && existingPath.every((value, index) => value === path[index]));
|
|
96653
|
+
if (!exists) {
|
|
96654
|
+
newSelectedValues.push(path);
|
|
96655
|
+
}
|
|
96656
|
+
});
|
|
96657
|
+
this.selectedValues = newSelectedValues;
|
|
96658
|
+
this.updateSelectedItems();
|
|
96659
|
+
this.syncTreeCheckedState();
|
|
96660
|
+
this.emitInput();
|
|
96661
|
+
}
|
|
96662
|
+
this.batchSearchVisible = false;
|
|
96663
|
+
this.batchSearchContent = '';
|
|
96664
|
+
},
|
|
96665
|
+
searchNamesInTree(names) {
|
|
96666
|
+
const matchedPaths = [];
|
|
96667
|
+
const searchInOptions = (options, currentPath = []) => {
|
|
96668
|
+
for (const option of options) {
|
|
96669
|
+
const newPath = [...currentPath, option[this.valueKey]];
|
|
96670
|
+
const optionLabel = String(option[this.labelKey] || '').replace(/\s+/g, '');
|
|
96671
|
+
const isMatched = names.some(name => {
|
|
96672
|
+
const cleanName = name.replace(/\s+/g, '');
|
|
96673
|
+
return optionLabel.toLowerCase() === cleanName.toLowerCase();
|
|
96674
|
+
});
|
|
96675
|
+
const isLeafNode = !option[this.childrenKey] || option[this.childrenKey].length === 0;
|
|
96676
|
+
const isNotDisabled = !CascaderUtils.isItemDisabled(option, this.disabledConfig);
|
|
96677
|
+
if (isMatched && isLeafNode && isNotDisabled) {
|
|
96678
|
+
matchedPaths.push(newPath);
|
|
96679
|
+
}
|
|
96680
|
+
if (option[this.childrenKey] && option[this.childrenKey].length > 0) {
|
|
96681
|
+
searchInOptions(option[this.childrenKey], newPath);
|
|
96682
|
+
}
|
|
96683
|
+
}
|
|
96684
|
+
};
|
|
96685
|
+
searchInOptions(this.filteredOptions);
|
|
96686
|
+
return matchedPaths;
|
|
96687
|
+
},
|
|
96688
|
+
getSelectedItemKey(item, index) {
|
|
96689
|
+
if (item.path && item.path.length) {
|
|
96690
|
+
return item.path.join('__');
|
|
96691
|
+
}
|
|
96692
|
+
return `${item.value}_${index}`;
|
|
96693
|
+
}
|
|
96694
|
+
}
|
|
96695
|
+
});
|
|
96696
|
+
;// ./src/components/tree-panel/ByTreePanel.vue?vue&type=script&lang=js
|
|
96697
|
+
/* harmony default export */ var tree_panel_ByTreePanelvue_type_script_lang_js = (ByTreePanelvue_type_script_lang_js);
|
|
96698
|
+
;// ./src/components/tree-panel/ByTreePanel.vue
|
|
96699
|
+
|
|
96700
|
+
|
|
96701
|
+
|
|
96702
|
+
|
|
96703
|
+
|
|
96704
|
+
/* normalize component */
|
|
96705
|
+
;
|
|
96706
|
+
var ByTreePanel_component = normalizeComponent(
|
|
96707
|
+
tree_panel_ByTreePanelvue_type_script_lang_js,
|
|
96708
|
+
ByTreePanelvue_type_template_id_af06ba0a_render,
|
|
96709
|
+
ByTreePanelvue_type_template_id_af06ba0a_staticRenderFns,
|
|
96710
|
+
false,
|
|
96711
|
+
null,
|
|
96712
|
+
null,
|
|
96713
|
+
null
|
|
96714
|
+
|
|
96715
|
+
)
|
|
96716
|
+
|
|
96717
|
+
/* harmony default export */ var ByTreePanel = (ByTreePanel_component.exports);
|
|
96017
96718
|
;// ./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/floating-menu/ByFloatingMenu.vue?vue&type=template&id=04723f13
|
|
96018
96719
|
var ByFloatingMenuvue_type_template_id_04723f13_render = function render() {
|
|
96019
96720
|
var _vm = this,
|
|
@@ -98709,6 +99410,7 @@ var ByCardSelector_component = normalizeComponent(
|
|
|
98709
99410
|
|
|
98710
99411
|
|
|
98711
99412
|
|
|
99413
|
+
|
|
98712
99414
|
|
|
98713
99415
|
|
|
98714
99416
|
const components = {
|
|
@@ -98726,6 +99428,7 @@ const components = {
|
|
|
98726
99428
|
ByTreeSearch: ByTreeSearch,
|
|
98727
99429
|
ByDialog: ByDialog,
|
|
98728
99430
|
ByCascaderPanel: ByCascaderPanel,
|
|
99431
|
+
ByTreePanel: ByTreePanel,
|
|
98729
99432
|
ByFloatingMenu: ByFloatingMenu,
|
|
98730
99433
|
ByPopoverSelector: ByPopoverSelector,
|
|
98731
99434
|
ByGridLayout: ByGridLayout,
|