@94ai/nf-virtual-select 3.2.81 → 3.2.82
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/index.d.ts +30 -0
- package/lib/nf-virtual-select-container.vue.d.ts +32 -0
- package/lib/nf-virtual-select.cjs.js +104 -52
- package/lib/nf-virtual-select.esm-bundler.js +106 -54
- package/lib/nf-virtual-select.vue.d.ts +13 -2
- package/package/nf-virtual-select-container.vue +68 -0
- package/package/nf-virtual-select.vue +68 -53
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
3
3
|
itemComponent: any;
|
|
4
4
|
selectArr: never[];
|
|
5
5
|
}, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
6
|
+
tag: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
6
10
|
offset: {
|
|
7
11
|
type: NumberConstructor;
|
|
8
12
|
default: number;
|
|
@@ -152,6 +156,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
152
156
|
default: string;
|
|
153
157
|
};
|
|
154
158
|
}>>, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
159
|
+
tag: {
|
|
160
|
+
type: StringConstructor;
|
|
161
|
+
default: string;
|
|
162
|
+
};
|
|
155
163
|
offset: {
|
|
156
164
|
type: NumberConstructor;
|
|
157
165
|
default: number;
|
|
@@ -304,6 +312,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
304
312
|
value: string | number | unknown[];
|
|
305
313
|
showTip: boolean;
|
|
306
314
|
placeholder: string;
|
|
315
|
+
tag: string;
|
|
307
316
|
offset: number;
|
|
308
317
|
start: number;
|
|
309
318
|
pageMode: boolean;
|
|
@@ -336,6 +345,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
336
345
|
maxWidth: string;
|
|
337
346
|
height: string;
|
|
338
347
|
}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
348
|
+
tag: {
|
|
349
|
+
type: StringConstructor;
|
|
350
|
+
default: string;
|
|
351
|
+
};
|
|
339
352
|
offset: {
|
|
340
353
|
type: NumberConstructor;
|
|
341
354
|
default: number;
|
|
@@ -488,6 +501,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
488
501
|
itemComponent: any;
|
|
489
502
|
selectArr: never[];
|
|
490
503
|
} & import("vue/types/v3-component-options").ExtractComputedReturns<{
|
|
504
|
+
config(): any;
|
|
491
505
|
currentVal: {
|
|
492
506
|
get(): any;
|
|
493
507
|
set(v: any): void;
|
|
@@ -498,7 +512,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
498
512
|
isMultipleSelect(): any;
|
|
499
513
|
placeholderDesc(): any;
|
|
500
514
|
optionsList(): any;
|
|
515
|
+
nfVirtualSelect(): any;
|
|
501
516
|
}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
|
|
517
|
+
tag: {
|
|
518
|
+
type: StringConstructor;
|
|
519
|
+
default: string;
|
|
520
|
+
};
|
|
502
521
|
offset: {
|
|
503
522
|
type: NumberConstructor;
|
|
504
523
|
default: number;
|
|
@@ -648,6 +667,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
648
667
|
default: string;
|
|
649
668
|
};
|
|
650
669
|
}>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
670
|
+
tag: {
|
|
671
|
+
type: StringConstructor;
|
|
672
|
+
default: string;
|
|
673
|
+
};
|
|
651
674
|
offset: {
|
|
652
675
|
type: NumberConstructor;
|
|
653
676
|
default: number;
|
|
@@ -800,6 +823,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
800
823
|
itemComponent: any;
|
|
801
824
|
selectArr: never[];
|
|
802
825
|
}, {
|
|
826
|
+
config(): any;
|
|
803
827
|
currentVal: {
|
|
804
828
|
get(): any;
|
|
805
829
|
set(v: any): void;
|
|
@@ -810,10 +834,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
810
834
|
isMultipleSelect(): any;
|
|
811
835
|
placeholderDesc(): any;
|
|
812
836
|
optionsList(): any;
|
|
837
|
+
nfVirtualSelect(): any;
|
|
813
838
|
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {
|
|
814
839
|
value: string | number | unknown[];
|
|
815
840
|
showTip: boolean;
|
|
816
841
|
placeholder: string;
|
|
842
|
+
tag: string;
|
|
817
843
|
offset: number;
|
|
818
844
|
start: number;
|
|
819
845
|
pageMode: boolean;
|
|
@@ -847,6 +873,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
847
873
|
height: string;
|
|
848
874
|
}> & {
|
|
849
875
|
props: {
|
|
876
|
+
tag: {
|
|
877
|
+
type: StringConstructor;
|
|
878
|
+
default: string;
|
|
879
|
+
};
|
|
850
880
|
offset: {
|
|
851
881
|
type: NumberConstructor;
|
|
852
882
|
default: number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
2
|
+
tag: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
value: {
|
|
7
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
8
|
+
default: () => "";
|
|
9
|
+
};
|
|
10
|
+
config: {
|
|
11
|
+
type: ObjectConstructor;
|
|
12
|
+
default: () => {};
|
|
13
|
+
};
|
|
14
|
+
}, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
15
|
+
tag: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
value: {
|
|
20
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
21
|
+
default: () => "";
|
|
22
|
+
};
|
|
23
|
+
config: {
|
|
24
|
+
type: ObjectConstructor;
|
|
25
|
+
default: () => {};
|
|
26
|
+
};
|
|
27
|
+
}>>, {
|
|
28
|
+
value: string | number | unknown[];
|
|
29
|
+
tag: string;
|
|
30
|
+
config: Record<string, any>;
|
|
31
|
+
}>;
|
|
32
|
+
export default _default;
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const virtualList = require("vue-virtual-scroll-list");
|
|
4
4
|
const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
|
|
5
5
|
const lodashEs = require("lodash-es");
|
|
6
|
-
require("vue-demi");
|
|
7
|
-
const _sfc_main$
|
|
6
|
+
const vueDemi = require("vue-demi");
|
|
7
|
+
const _sfc_main$2 = {
|
|
8
8
|
name: "ItemComponent",
|
|
9
9
|
props: {
|
|
10
10
|
index: {
|
|
@@ -36,7 +36,7 @@ const _sfc_main$1 = {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
var _sfc_render$
|
|
39
|
+
var _sfc_render$2 = function render() {
|
|
40
40
|
var _vm = this, _c = _vm._self._c;
|
|
41
41
|
return _c("el-option", {
|
|
42
42
|
key: _vm.index,
|
|
@@ -54,16 +54,79 @@ var _sfc_render$1 = function render() {
|
|
|
54
54
|
}
|
|
55
55
|
}, [_c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])], 1);
|
|
56
56
|
};
|
|
57
|
-
var _sfc_staticRenderFns$
|
|
57
|
+
var _sfc_staticRenderFns$2 = [];
|
|
58
|
+
var __component__$2 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, null, null, null);
|
|
59
|
+
const ElOptionNode = __component__$2.exports;
|
|
60
|
+
const _sfc_main$1 = vueDemi.defineComponent({
|
|
61
|
+
name: "nf-virtual-select-container",
|
|
62
|
+
props: {
|
|
63
|
+
/**
|
|
64
|
+
* 指定容器类型
|
|
65
|
+
*/
|
|
66
|
+
tag: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: "el-select"
|
|
69
|
+
},
|
|
70
|
+
value: {
|
|
71
|
+
type: [String, Number, Array],
|
|
72
|
+
default: () => ""
|
|
73
|
+
},
|
|
74
|
+
config: {
|
|
75
|
+
type: Object,
|
|
76
|
+
default: () => ({})
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
render() {
|
|
80
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
81
|
+
const Tag = this.tag;
|
|
82
|
+
const on = this.$listeners;
|
|
83
|
+
return vueDemi.h(Tag, {
|
|
84
|
+
"ref": "nfVirtualSelect",
|
|
85
|
+
"props": {
|
|
86
|
+
...{
|
|
87
|
+
...this.config,
|
|
88
|
+
value: this.value
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"on": {
|
|
92
|
+
...{
|
|
93
|
+
...on,
|
|
94
|
+
input: (val) => {
|
|
95
|
+
if (this.tag === "el-select" || this.tag === "custom-select-dropdown") {
|
|
96
|
+
this.$emit("update:value", val);
|
|
97
|
+
this.$emit("change", val);
|
|
98
|
+
this.$emit("input", val);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, [(_b = (_a = this.$scopedSlots).default) == null ? void 0 : _b.call(_a, {}), vueDemi.h("template", {
|
|
104
|
+
"slot": "prefix"
|
|
105
|
+
}, [(_d = (_c = this.$scopedSlots).prefix) == null ? void 0 : _d.call(_c, {})]), vueDemi.h("template", {
|
|
106
|
+
"slot": "empty"
|
|
107
|
+
}, [(_f = (_e = this.$scopedSlots).empty) == null ? void 0 : _f.call(_e, {})]), vueDemi.h("template", {
|
|
108
|
+
"slot": "footer"
|
|
109
|
+
}, [(_h = (_g = this.$scopedSlots).footer) == null ? void 0 : _h.call(_g, {})]), vueDemi.h("template", {
|
|
110
|
+
"slot": "header"
|
|
111
|
+
}, [(_j = (_i = this.$scopedSlots).header) == null ? void 0 : _j.call(_i, {})])]);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const _sfc_render$1 = null;
|
|
115
|
+
const _sfc_staticRenderFns$1 = null;
|
|
58
116
|
var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
59
|
-
const
|
|
117
|
+
const VirtualSelectContainer = __component__$1.exports;
|
|
60
118
|
const _sfc_main = {
|
|
61
119
|
name: "nf-virtual-select",
|
|
62
120
|
components: {
|
|
63
|
-
"virtual-list": virtualList
|
|
121
|
+
"virtual-list": virtualList,
|
|
122
|
+
"virtual-select-container": VirtualSelectContainer
|
|
64
123
|
},
|
|
65
124
|
inheritAttrs: false,
|
|
66
125
|
props: {
|
|
126
|
+
tag: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: "el-select"
|
|
129
|
+
},
|
|
67
130
|
/**
|
|
68
131
|
* 虚拟滚动属性
|
|
69
132
|
*/
|
|
@@ -275,6 +338,20 @@ const _sfc_main = {
|
|
|
275
338
|
};
|
|
276
339
|
},
|
|
277
340
|
computed: {
|
|
341
|
+
config() {
|
|
342
|
+
const configData = {
|
|
343
|
+
...this.bindProps,
|
|
344
|
+
"popper-class": (this.bindProps.popperClass || "") + ` ${this.isVirtualSelect ? "nf-virtual-select-virtual-list-popper" : "nf-virtual-select-el-select-popper"}`
|
|
345
|
+
};
|
|
346
|
+
if (this.isVirtualSelect) {
|
|
347
|
+
return {
|
|
348
|
+
...configData,
|
|
349
|
+
"filter-method": this.filterMethod,
|
|
350
|
+
filterable: true
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
return configData;
|
|
354
|
+
},
|
|
278
355
|
currentVal: {
|
|
279
356
|
get() {
|
|
280
357
|
return this.value;
|
|
@@ -313,7 +390,6 @@ const _sfc_main = {
|
|
|
313
390
|
},
|
|
314
391
|
// 绑定方法
|
|
315
392
|
bindEvents() {
|
|
316
|
-
var _a;
|
|
317
393
|
const events = {
|
|
318
394
|
...this.$listeners || {},
|
|
319
395
|
...this.itemOptions.events
|
|
@@ -327,7 +403,7 @@ const _sfc_main = {
|
|
|
327
403
|
if (events == null ? void 0 : events["update:value"]) {
|
|
328
404
|
delete events["update:value"];
|
|
329
405
|
}
|
|
330
|
-
if (
|
|
406
|
+
if (events == null ? void 0 : events["visible-change"]) {
|
|
331
407
|
delete events["visible-change"];
|
|
332
408
|
}
|
|
333
409
|
return events || {};
|
|
@@ -350,6 +426,10 @@ const _sfc_main = {
|
|
|
350
426
|
} else {
|
|
351
427
|
return [];
|
|
352
428
|
}
|
|
429
|
+
},
|
|
430
|
+
nfVirtualSelect() {
|
|
431
|
+
var _a, _b;
|
|
432
|
+
return (_b = (_a = this.$refs.nfVirtualSelectContainer) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfVirtualSelect;
|
|
353
433
|
}
|
|
354
434
|
},
|
|
355
435
|
watch: {
|
|
@@ -373,7 +453,7 @@ const _sfc_main = {
|
|
|
373
453
|
if (this.isVirtualSelect) {
|
|
374
454
|
(_a = this.$refs.virtualSelectList) == null ? void 0 : _a.reset();
|
|
375
455
|
} else {
|
|
376
|
-
const container = (_e = (_d = (_c = (_b = this
|
|
456
|
+
const container = (_e = (_d = (_c = (_b = this.nfVirtualSelect) == null ? void 0 : _b.$refs) == null ? void 0 : _c.popper) == null ? void 0 : _d.$el) == null ? void 0 : _e.querySelector(".el-select-dropdown__wrap");
|
|
377
457
|
if (container) {
|
|
378
458
|
container.scrollTop = 0;
|
|
379
459
|
}
|
|
@@ -443,18 +523,6 @@ const _sfc_main = {
|
|
|
443
523
|
[this.dataKey]: it[this.keyValue[1]],
|
|
444
524
|
disabled: it["disabled"] ?? false
|
|
445
525
|
}))) ?? [];
|
|
446
|
-
if (this.currentVal) {
|
|
447
|
-
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
448
|
-
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
449
|
-
this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
450
|
-
} else {
|
|
451
|
-
const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
|
|
452
|
-
if (index !== -1) {
|
|
453
|
-
const obj = this.selectArr.splice(index, 1)[0];
|
|
454
|
-
this.selectArr.unshift(obj);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
526
|
} else {
|
|
459
527
|
this.selectArr = (this.optionsList || []).map((it) => ({
|
|
460
528
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
@@ -496,13 +564,17 @@ const _sfc_main = {
|
|
|
496
564
|
...this.$listeners || {},
|
|
497
565
|
...this.itemOptions.events
|
|
498
566
|
};
|
|
499
|
-
|
|
500
|
-
|
|
567
|
+
const fn = events["visible-change"];
|
|
568
|
+
if (fn) {
|
|
569
|
+
let go = fn(bool);
|
|
570
|
+
if (Promise.resolve(go) === go) {
|
|
571
|
+
go = await go;
|
|
572
|
+
}
|
|
501
573
|
if (go === "break") {
|
|
502
574
|
return go;
|
|
503
575
|
}
|
|
504
576
|
}
|
|
505
|
-
if (!bool) {
|
|
577
|
+
if (!bool && this.isVirtualSelect) {
|
|
506
578
|
this.reset();
|
|
507
579
|
this.init();
|
|
508
580
|
}
|
|
@@ -522,15 +594,12 @@ const _sfc_main = {
|
|
|
522
594
|
};
|
|
523
595
|
var _sfc_render = function render2() {
|
|
524
596
|
var _vm = this, _c = _vm._self._c;
|
|
525
|
-
return _c("
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
ref: "nfVirtualSelect",
|
|
529
|
-
class: ["nf-virtual-select-el-select", _vm.bindProps["collapse-tags"] ? "nf-virtual-select-collapse-tags" : ""],
|
|
597
|
+
return _c("virtual-select-container", _vm._g({
|
|
598
|
+
ref: "nfVirtualSelectContainer",
|
|
599
|
+
class: ["nf-virtual-select nf-virtual-select-el-select", _vm.bindProps["collapse-tags"] ? "nf-virtual-select-collapse-tags" : ""],
|
|
530
600
|
attrs: {
|
|
531
|
-
"
|
|
532
|
-
"
|
|
533
|
-
"filter-method": _vm.filterMethod
|
|
601
|
+
"config": _vm.config,
|
|
602
|
+
"tag": _vm.tag
|
|
534
603
|
},
|
|
535
604
|
on: {
|
|
536
605
|
"visible-change": _vm.visibleChange
|
|
@@ -542,7 +611,7 @@ var _sfc_render = function render2() {
|
|
|
542
611
|
},
|
|
543
612
|
expression: "currentVal"
|
|
544
613
|
}
|
|
545
|
-
},
|
|
614
|
+
}, _vm.bindEvents), [_vm.isVirtualSelect ? [_vm._t("prefix", null, {
|
|
546
615
|
"slot": "prefix"
|
|
547
616
|
}), _vm._t("empty", null, {
|
|
548
617
|
"slot": "empty"
|
|
@@ -588,24 +657,7 @@ var _sfc_render = function render2() {
|
|
|
588
657
|
"slot": "footer"
|
|
589
658
|
}), _vm._t("header", null, {
|
|
590
659
|
"slot": "header"
|
|
591
|
-
})], 2), _vm._t("default")]
|
|
592
|
-
ref: "nfVirtualSelect",
|
|
593
|
-
staticClass: "nf-virtual-select-el-select",
|
|
594
|
-
attrs: {
|
|
595
|
-
"popper-class": "nf-virtual-select-el-select-popper"
|
|
596
|
-
},
|
|
597
|
-
model: {
|
|
598
|
-
value: _vm.currentVal,
|
|
599
|
-
callback: function($$v) {
|
|
600
|
-
_vm.currentVal = $$v;
|
|
601
|
-
},
|
|
602
|
-
expression: "currentVal"
|
|
603
|
-
}
|
|
604
|
-
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [_vm._t("prefix", null, {
|
|
605
|
-
"slot": "prefix"
|
|
606
|
-
}), _vm._t("empty", null, {
|
|
607
|
-
"slot": "empty"
|
|
608
|
-
}), _vm._t("header"), _vm._l(_vm.selectArr, function(item, index) {
|
|
660
|
+
})], 2), _vm._t("default")] : [_vm._t("header"), _vm._l(_vm.selectArr, function(item, index) {
|
|
609
661
|
return _c("el-option", {
|
|
610
662
|
key: item[_vm.keyValue[0]] + "_" + index,
|
|
611
663
|
attrs: {
|
|
@@ -621,7 +673,7 @@ var _sfc_render = function render2() {
|
|
|
621
673
|
"placement": "left"
|
|
622
674
|
}
|
|
623
675
|
}, [_c("span", [_vm._v(_vm._s(item[_vm.keyValue[0]]))])]) : _c("span", [_vm._v(" " + _vm._s(item[_vm.keyValue[0]]) + " ")])], 1);
|
|
624
|
-
}), _vm._t("default"), _vm._t("footer")], 2)
|
|
676
|
+
}), _vm._t("default"), _vm._t("footer")]], 2);
|
|
625
677
|
};
|
|
626
678
|
var _sfc_staticRenderFns = [];
|
|
627
679
|
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import virtualList from "vue-virtual-scroll-list";
|
|
2
2
|
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
3
|
import { isEqual } from "lodash-es";
|
|
4
|
-
import "vue-demi";
|
|
5
|
-
const _sfc_main$
|
|
4
|
+
import { defineComponent, h } from "vue-demi";
|
|
5
|
+
const _sfc_main$2 = {
|
|
6
6
|
name: "ItemComponent",
|
|
7
7
|
props: {
|
|
8
8
|
index: {
|
|
@@ -34,7 +34,7 @@ const _sfc_main$1 = {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var _sfc_render$
|
|
37
|
+
var _sfc_render$2 = function render() {
|
|
38
38
|
var _vm = this, _c = _vm._self._c;
|
|
39
39
|
return _c("el-option", {
|
|
40
40
|
key: _vm.index,
|
|
@@ -52,16 +52,79 @@ var _sfc_render$1 = function render() {
|
|
|
52
52
|
}
|
|
53
53
|
}, [_c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])], 1);
|
|
54
54
|
};
|
|
55
|
-
var _sfc_staticRenderFns$
|
|
55
|
+
var _sfc_staticRenderFns$2 = [];
|
|
56
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, null, null, null);
|
|
57
|
+
const ElOptionNode = __component__$2.exports;
|
|
58
|
+
const _sfc_main$1 = defineComponent({
|
|
59
|
+
name: "nf-virtual-select-container",
|
|
60
|
+
props: {
|
|
61
|
+
/**
|
|
62
|
+
* 指定容器类型
|
|
63
|
+
*/
|
|
64
|
+
tag: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "el-select"
|
|
67
|
+
},
|
|
68
|
+
value: {
|
|
69
|
+
type: [String, Number, Array],
|
|
70
|
+
default: () => ""
|
|
71
|
+
},
|
|
72
|
+
config: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({})
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
render() {
|
|
78
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
79
|
+
const Tag = this.tag;
|
|
80
|
+
const on = this.$listeners;
|
|
81
|
+
return h(Tag, {
|
|
82
|
+
"ref": "nfVirtualSelect",
|
|
83
|
+
"props": {
|
|
84
|
+
...{
|
|
85
|
+
...this.config,
|
|
86
|
+
value: this.value
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"on": {
|
|
90
|
+
...{
|
|
91
|
+
...on,
|
|
92
|
+
input: (val) => {
|
|
93
|
+
if (this.tag === "el-select" || this.tag === "custom-select-dropdown") {
|
|
94
|
+
this.$emit("update:value", val);
|
|
95
|
+
this.$emit("change", val);
|
|
96
|
+
this.$emit("input", val);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [(_b = (_a = this.$scopedSlots).default) == null ? void 0 : _b.call(_a, {}), h("template", {
|
|
102
|
+
"slot": "prefix"
|
|
103
|
+
}, [(_d = (_c = this.$scopedSlots).prefix) == null ? void 0 : _d.call(_c, {})]), h("template", {
|
|
104
|
+
"slot": "empty"
|
|
105
|
+
}, [(_f = (_e = this.$scopedSlots).empty) == null ? void 0 : _f.call(_e, {})]), h("template", {
|
|
106
|
+
"slot": "footer"
|
|
107
|
+
}, [(_h = (_g = this.$scopedSlots).footer) == null ? void 0 : _h.call(_g, {})]), h("template", {
|
|
108
|
+
"slot": "header"
|
|
109
|
+
}, [(_j = (_i = this.$scopedSlots).header) == null ? void 0 : _j.call(_i, {})])]);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const _sfc_render$1 = null;
|
|
113
|
+
const _sfc_staticRenderFns$1 = null;
|
|
56
114
|
var __component__$1 = /* @__PURE__ */ normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
57
|
-
const
|
|
115
|
+
const VirtualSelectContainer = __component__$1.exports;
|
|
58
116
|
const _sfc_main = {
|
|
59
117
|
name: "nf-virtual-select",
|
|
60
118
|
components: {
|
|
61
|
-
"virtual-list": virtualList
|
|
119
|
+
"virtual-list": virtualList,
|
|
120
|
+
"virtual-select-container": VirtualSelectContainer
|
|
62
121
|
},
|
|
63
122
|
inheritAttrs: false,
|
|
64
123
|
props: {
|
|
124
|
+
tag: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: "el-select"
|
|
127
|
+
},
|
|
65
128
|
/**
|
|
66
129
|
* 虚拟滚动属性
|
|
67
130
|
*/
|
|
@@ -255,8 +318,8 @@ const _sfc_main = {
|
|
|
255
318
|
}
|
|
256
319
|
}
|
|
257
320
|
},
|
|
258
|
-
render(
|
|
259
|
-
return
|
|
321
|
+
render(h2) {
|
|
322
|
+
return h2(ElOptionNode, {
|
|
260
323
|
attrs: {
|
|
261
324
|
label: that.keyValue[0],
|
|
262
325
|
value: that.keyValue[1],
|
|
@@ -273,6 +336,20 @@ const _sfc_main = {
|
|
|
273
336
|
};
|
|
274
337
|
},
|
|
275
338
|
computed: {
|
|
339
|
+
config() {
|
|
340
|
+
const configData = {
|
|
341
|
+
...this.bindProps,
|
|
342
|
+
"popper-class": (this.bindProps.popperClass || "") + ` ${this.isVirtualSelect ? "nf-virtual-select-virtual-list-popper" : "nf-virtual-select-el-select-popper"}`
|
|
343
|
+
};
|
|
344
|
+
if (this.isVirtualSelect) {
|
|
345
|
+
return {
|
|
346
|
+
...configData,
|
|
347
|
+
"filter-method": this.filterMethod,
|
|
348
|
+
filterable: true
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
return configData;
|
|
352
|
+
},
|
|
276
353
|
currentVal: {
|
|
277
354
|
get() {
|
|
278
355
|
return this.value;
|
|
@@ -311,7 +388,6 @@ const _sfc_main = {
|
|
|
311
388
|
},
|
|
312
389
|
// 绑定方法
|
|
313
390
|
bindEvents() {
|
|
314
|
-
var _a;
|
|
315
391
|
const events = {
|
|
316
392
|
...this.$listeners || {},
|
|
317
393
|
...this.itemOptions.events
|
|
@@ -325,7 +401,7 @@ const _sfc_main = {
|
|
|
325
401
|
if (events == null ? void 0 : events["update:value"]) {
|
|
326
402
|
delete events["update:value"];
|
|
327
403
|
}
|
|
328
|
-
if (
|
|
404
|
+
if (events == null ? void 0 : events["visible-change"]) {
|
|
329
405
|
delete events["visible-change"];
|
|
330
406
|
}
|
|
331
407
|
return events || {};
|
|
@@ -348,6 +424,10 @@ const _sfc_main = {
|
|
|
348
424
|
} else {
|
|
349
425
|
return [];
|
|
350
426
|
}
|
|
427
|
+
},
|
|
428
|
+
nfVirtualSelect() {
|
|
429
|
+
var _a, _b;
|
|
430
|
+
return (_b = (_a = this.$refs.nfVirtualSelectContainer) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfVirtualSelect;
|
|
351
431
|
}
|
|
352
432
|
},
|
|
353
433
|
watch: {
|
|
@@ -371,7 +451,7 @@ const _sfc_main = {
|
|
|
371
451
|
if (this.isVirtualSelect) {
|
|
372
452
|
(_a = this.$refs.virtualSelectList) == null ? void 0 : _a.reset();
|
|
373
453
|
} else {
|
|
374
|
-
const container = (_e = (_d = (_c = (_b = this
|
|
454
|
+
const container = (_e = (_d = (_c = (_b = this.nfVirtualSelect) == null ? void 0 : _b.$refs) == null ? void 0 : _c.popper) == null ? void 0 : _d.$el) == null ? void 0 : _e.querySelector(".el-select-dropdown__wrap");
|
|
375
455
|
if (container) {
|
|
376
456
|
container.scrollTop = 0;
|
|
377
457
|
}
|
|
@@ -441,18 +521,6 @@ const _sfc_main = {
|
|
|
441
521
|
[this.dataKey]: it[this.keyValue[1]],
|
|
442
522
|
disabled: it["disabled"] ?? false
|
|
443
523
|
}))) ?? [];
|
|
444
|
-
if (this.currentVal) {
|
|
445
|
-
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
446
|
-
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
447
|
-
this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
448
|
-
} else {
|
|
449
|
-
const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
|
|
450
|
-
if (index !== -1) {
|
|
451
|
-
const obj = this.selectArr.splice(index, 1)[0];
|
|
452
|
-
this.selectArr.unshift(obj);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
524
|
} else {
|
|
457
525
|
this.selectArr = (this.optionsList || []).map((it) => ({
|
|
458
526
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
@@ -494,13 +562,17 @@ const _sfc_main = {
|
|
|
494
562
|
...this.$listeners || {},
|
|
495
563
|
...this.itemOptions.events
|
|
496
564
|
};
|
|
497
|
-
|
|
498
|
-
|
|
565
|
+
const fn = events["visible-change"];
|
|
566
|
+
if (fn) {
|
|
567
|
+
let go = fn(bool);
|
|
568
|
+
if (Promise.resolve(go) === go) {
|
|
569
|
+
go = await go;
|
|
570
|
+
}
|
|
499
571
|
if (go === "break") {
|
|
500
572
|
return go;
|
|
501
573
|
}
|
|
502
574
|
}
|
|
503
|
-
if (!bool) {
|
|
575
|
+
if (!bool && this.isVirtualSelect) {
|
|
504
576
|
this.reset();
|
|
505
577
|
this.init();
|
|
506
578
|
}
|
|
@@ -520,15 +592,12 @@ const _sfc_main = {
|
|
|
520
592
|
};
|
|
521
593
|
var _sfc_render = function render2() {
|
|
522
594
|
var _vm = this, _c = _vm._self._c;
|
|
523
|
-
return _c("
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
ref: "nfVirtualSelect",
|
|
527
|
-
class: ["nf-virtual-select-el-select", _vm.bindProps["collapse-tags"] ? "nf-virtual-select-collapse-tags" : ""],
|
|
595
|
+
return _c("virtual-select-container", _vm._g({
|
|
596
|
+
ref: "nfVirtualSelectContainer",
|
|
597
|
+
class: ["nf-virtual-select nf-virtual-select-el-select", _vm.bindProps["collapse-tags"] ? "nf-virtual-select-collapse-tags" : ""],
|
|
528
598
|
attrs: {
|
|
529
|
-
"
|
|
530
|
-
"
|
|
531
|
-
"filter-method": _vm.filterMethod
|
|
599
|
+
"config": _vm.config,
|
|
600
|
+
"tag": _vm.tag
|
|
532
601
|
},
|
|
533
602
|
on: {
|
|
534
603
|
"visible-change": _vm.visibleChange
|
|
@@ -540,7 +609,7 @@ var _sfc_render = function render2() {
|
|
|
540
609
|
},
|
|
541
610
|
expression: "currentVal"
|
|
542
611
|
}
|
|
543
|
-
},
|
|
612
|
+
}, _vm.bindEvents), [_vm.isVirtualSelect ? [_vm._t("prefix", null, {
|
|
544
613
|
"slot": "prefix"
|
|
545
614
|
}), _vm._t("empty", null, {
|
|
546
615
|
"slot": "empty"
|
|
@@ -586,24 +655,7 @@ var _sfc_render = function render2() {
|
|
|
586
655
|
"slot": "footer"
|
|
587
656
|
}), _vm._t("header", null, {
|
|
588
657
|
"slot": "header"
|
|
589
|
-
})], 2), _vm._t("default")]
|
|
590
|
-
ref: "nfVirtualSelect",
|
|
591
|
-
staticClass: "nf-virtual-select-el-select",
|
|
592
|
-
attrs: {
|
|
593
|
-
"popper-class": "nf-virtual-select-el-select-popper"
|
|
594
|
-
},
|
|
595
|
-
model: {
|
|
596
|
-
value: _vm.currentVal,
|
|
597
|
-
callback: function($$v) {
|
|
598
|
-
_vm.currentVal = $$v;
|
|
599
|
-
},
|
|
600
|
-
expression: "currentVal"
|
|
601
|
-
}
|
|
602
|
-
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [_vm._t("prefix", null, {
|
|
603
|
-
"slot": "prefix"
|
|
604
|
-
}), _vm._t("empty", null, {
|
|
605
|
-
"slot": "empty"
|
|
606
|
-
}), _vm._t("header"), _vm._l(_vm.selectArr, function(item, index) {
|
|
658
|
+
})], 2), _vm._t("default")] : [_vm._t("header"), _vm._l(_vm.selectArr, function(item, index) {
|
|
607
659
|
return _c("el-option", {
|
|
608
660
|
key: item[_vm.keyValue[0]] + "_" + index,
|
|
609
661
|
attrs: {
|
|
@@ -619,7 +671,7 @@ var _sfc_render = function render2() {
|
|
|
619
671
|
"placement": "left"
|
|
620
672
|
}
|
|
621
673
|
}, [_c("span", [_vm._v(_vm._s(item[_vm.keyValue[0]]))])]) : _c("span", [_vm._v(" " + _vm._s(item[_vm.keyValue[0]]) + " ")])], 1);
|
|
622
|
-
}), _vm._t("default"), _vm._t("footer")], 2)
|
|
674
|
+
}), _vm._t("default"), _vm._t("footer")]], 2);
|
|
623
675
|
};
|
|
624
676
|
var _sfc_staticRenderFns = [];
|
|
625
677
|
var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
declare const _default: import("vue
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
tag: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
2
6
|
offset: {
|
|
3
7
|
type: NumberConstructor;
|
|
4
8
|
default: number;
|
|
@@ -151,6 +155,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
151
155
|
itemComponent: any;
|
|
152
156
|
selectArr: never[];
|
|
153
157
|
}, {
|
|
158
|
+
config(): any;
|
|
154
159
|
currentVal: {
|
|
155
160
|
get(): any;
|
|
156
161
|
set(v: any): void;
|
|
@@ -161,7 +166,12 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
161
166
|
isMultipleSelect(): any;
|
|
162
167
|
placeholderDesc(): any;
|
|
163
168
|
optionsList(): any;
|
|
164
|
-
|
|
169
|
+
nfVirtualSelect(): any;
|
|
170
|
+
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
|
|
171
|
+
tag: {
|
|
172
|
+
type: StringConstructor;
|
|
173
|
+
default: string;
|
|
174
|
+
};
|
|
165
175
|
offset: {
|
|
166
176
|
type: NumberConstructor;
|
|
167
177
|
default: number;
|
|
@@ -314,6 +324,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
314
324
|
value: string | number | unknown[];
|
|
315
325
|
showTip: boolean;
|
|
316
326
|
placeholder: string;
|
|
327
|
+
tag: string;
|
|
317
328
|
offset: number;
|
|
318
329
|
start: number;
|
|
319
330
|
pageMode: boolean;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
} from 'vue-demi'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'nf-virtual-select-container',
|
|
8
|
+
props: {
|
|
9
|
+
/**
|
|
10
|
+
* 指定容器类型
|
|
11
|
+
*/
|
|
12
|
+
tag: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'el-select',
|
|
15
|
+
},
|
|
16
|
+
value: {
|
|
17
|
+
type: [String, Number, Array],
|
|
18
|
+
default: () => '',
|
|
19
|
+
},
|
|
20
|
+
config: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => ({})
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
render() {
|
|
26
|
+
const Tag = this.tag;
|
|
27
|
+
const on = this.$listeners
|
|
28
|
+
return (
|
|
29
|
+
<Tag
|
|
30
|
+
ref="nfVirtualSelect"
|
|
31
|
+
{...{
|
|
32
|
+
props: {
|
|
33
|
+
...this.config,
|
|
34
|
+
value: this.value
|
|
35
|
+
},
|
|
36
|
+
}}
|
|
37
|
+
{...{
|
|
38
|
+
on: {
|
|
39
|
+
...on,
|
|
40
|
+
input: (val) => {
|
|
41
|
+
if (this.tag === 'el-select' || this.tag === 'custom-select-dropdown') {
|
|
42
|
+
this.$emit('update:value', val)
|
|
43
|
+
this.$emit('change', val)
|
|
44
|
+
this.$emit('input', val)
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{this.$scopedSlots.default?.({})}
|
|
51
|
+
<template slot="prefix">
|
|
52
|
+
{this.$scopedSlots.prefix?.({})}
|
|
53
|
+
</template>
|
|
54
|
+
<template slot="empty">
|
|
55
|
+
{this.$scopedSlots.empty?.({})}
|
|
56
|
+
</template>
|
|
57
|
+
<template slot="footer">
|
|
58
|
+
{this.$scopedSlots.footer?.({})}
|
|
59
|
+
</template>
|
|
60
|
+
<template slot="header">
|
|
61
|
+
{this.$scopedSlots.header?.({})}
|
|
62
|
+
</template>
|
|
63
|
+
</Tag>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
68
|
+
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
:filter-method="filterMethod"
|
|
13
|
-
@visible-change="visibleChange"
|
|
14
|
-
>
|
|
2
|
+
<virtual-select-container
|
|
3
|
+
v-model="currentVal"
|
|
4
|
+
v-on="bindEvents"
|
|
5
|
+
@visible-change="visibleChange"
|
|
6
|
+
ref="nfVirtualSelectContainer"
|
|
7
|
+
:class="['nf-virtual-select nf-virtual-select-el-select', bindProps['collapse-tags'] ? 'nf-virtual-select-collapse-tags' : '']"
|
|
8
|
+
:config="config"
|
|
9
|
+
:tag="tag"
|
|
10
|
+
>
|
|
11
|
+
<template v-if="isVirtualSelect">
|
|
15
12
|
<slot name="prefix" slot="prefix" />
|
|
16
13
|
<slot name="empty" slot="empty" />
|
|
17
14
|
<virtual-list
|
|
@@ -53,18 +50,8 @@
|
|
|
53
50
|
<slot slot="header" name="header" />
|
|
54
51
|
</virtual-list>
|
|
55
52
|
<slot />
|
|
56
|
-
</
|
|
57
|
-
<
|
|
58
|
-
v-else
|
|
59
|
-
v-model="currentVal"
|
|
60
|
-
v-bind="bindProps"
|
|
61
|
-
v-on="bindEvents"
|
|
62
|
-
ref="nfVirtualSelect"
|
|
63
|
-
class="nf-virtual-select-el-select"
|
|
64
|
-
popper-class="nf-virtual-select-el-select-popper"
|
|
65
|
-
>
|
|
66
|
-
<slot name="prefix" slot="prefix" />
|
|
67
|
-
<slot name="empty" slot="empty" />
|
|
53
|
+
</template>
|
|
54
|
+
<template v-else>
|
|
68
55
|
<slot name="header" />
|
|
69
56
|
<el-option
|
|
70
57
|
v-for="(item, index) in selectArr"
|
|
@@ -81,26 +68,33 @@
|
|
|
81
68
|
<span>{{ item[keyValue[0]] }}</span>
|
|
82
69
|
</el-tooltip>
|
|
83
70
|
<span v-else>
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
{{ item[keyValue[0]] }}
|
|
72
|
+
</span>
|
|
86
73
|
</el-option>
|
|
87
74
|
<slot />
|
|
88
75
|
<slot name="footer" />
|
|
89
|
-
</
|
|
90
|
-
</
|
|
76
|
+
</template>
|
|
77
|
+
</virtual-select-container>
|
|
91
78
|
</template>
|
|
92
79
|
|
|
93
80
|
<script>
|
|
94
81
|
import virtualList from 'vue-virtual-scroll-list'
|
|
95
82
|
import ElOptionNode from './el-option-node.vue'
|
|
96
83
|
import { isEqual } from 'lodash-es'
|
|
97
|
-
import
|
|
84
|
+
import VirtualSelectContainer from './nf-virtual-select-container.vue'
|
|
98
85
|
|
|
99
86
|
export default {
|
|
100
87
|
name: 'nf-virtual-select',
|
|
101
|
-
components: {
|
|
88
|
+
components: {
|
|
89
|
+
'virtual-list': virtualList,
|
|
90
|
+
'virtual-select-container': VirtualSelectContainer
|
|
91
|
+
},
|
|
102
92
|
inheritAttrs: false,
|
|
103
93
|
props: {
|
|
94
|
+
tag: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: 'el-select'
|
|
97
|
+
},
|
|
104
98
|
/**
|
|
105
99
|
* 虚拟滚动属性
|
|
106
100
|
*/
|
|
@@ -245,7 +239,7 @@ export default {
|
|
|
245
239
|
default() {
|
|
246
240
|
return {
|
|
247
241
|
options: [],
|
|
248
|
-
virtualList: false
|
|
242
|
+
virtualList: false
|
|
249
243
|
}
|
|
250
244
|
}
|
|
251
245
|
},
|
|
@@ -311,6 +305,20 @@ export default {
|
|
|
311
305
|
}
|
|
312
306
|
},
|
|
313
307
|
computed: {
|
|
308
|
+
config() {
|
|
309
|
+
const configData = {
|
|
310
|
+
...this.bindProps,
|
|
311
|
+
'popper-class': (this.bindProps.popperClass || '') + ` ${this.isVirtualSelect ? 'nf-virtual-select-virtual-list-popper' : 'nf-virtual-select-el-select-popper'}`
|
|
312
|
+
}
|
|
313
|
+
if (this.isVirtualSelect) {
|
|
314
|
+
return {
|
|
315
|
+
...configData,
|
|
316
|
+
'filter-method': this.filterMethod,
|
|
317
|
+
filterable: true,
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return configData
|
|
321
|
+
},
|
|
314
322
|
currentVal: {
|
|
315
323
|
get() {
|
|
316
324
|
return this.value
|
|
@@ -358,7 +366,7 @@ export default {
|
|
|
358
366
|
if (events?.['update:value']) {
|
|
359
367
|
delete events['update:value']
|
|
360
368
|
}
|
|
361
|
-
if (events?.['visible-change']
|
|
369
|
+
if (events?.['visible-change']) {
|
|
362
370
|
delete events['visible-change']
|
|
363
371
|
}
|
|
364
372
|
return events || {}
|
|
@@ -380,6 +388,9 @@ export default {
|
|
|
380
388
|
} else {
|
|
381
389
|
return []
|
|
382
390
|
}
|
|
391
|
+
},
|
|
392
|
+
nfVirtualSelect() {
|
|
393
|
+
return this.$refs.nfVirtualSelectContainer?.$refs?.nfVirtualSelect
|
|
383
394
|
}
|
|
384
395
|
},
|
|
385
396
|
watch: {
|
|
@@ -402,7 +413,7 @@ export default {
|
|
|
402
413
|
if (this.isVirtualSelect) {
|
|
403
414
|
this.$refs.virtualSelectList?.reset()
|
|
404
415
|
} else {
|
|
405
|
-
const container = this
|
|
416
|
+
const container = this.nfVirtualSelect?.$refs?.popper?.$el?.querySelector('.el-select-dropdown__wrap')
|
|
406
417
|
if (container) {
|
|
407
418
|
container.scrollTop = 0
|
|
408
419
|
}
|
|
@@ -471,21 +482,21 @@ export default {
|
|
|
471
482
|
[this.dataKey]: it[this.keyValue[1]],
|
|
472
483
|
disabled: it['disabled'] ?? false
|
|
473
484
|
})) ?? []
|
|
474
|
-
if (this.currentVal) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
485
|
+
// if (this.currentVal) {
|
|
486
|
+
// // 有回显值
|
|
487
|
+
// if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
488
|
+
// // 多选
|
|
489
|
+
// const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
|
|
490
|
+
// this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))]
|
|
491
|
+
// } else {
|
|
492
|
+
// // 单选
|
|
493
|
+
// const index = this.selectArr.findIndex(item => item.value === this.currentVal)
|
|
494
|
+
// if (index !== -1) {
|
|
495
|
+
// const obj = this.selectArr.splice(index, 1)[0]
|
|
496
|
+
// this.selectArr.unshift(obj)
|
|
497
|
+
// }
|
|
498
|
+
// }
|
|
499
|
+
// }
|
|
489
500
|
} else {
|
|
490
501
|
// 非虚拟选择器
|
|
491
502
|
this.selectArr = (this.optionsList || []).map(it => ({
|
|
@@ -513,7 +524,7 @@ export default {
|
|
|
513
524
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
514
525
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
515
526
|
[this.dataKey]: it[this.keyValue[1]],
|
|
516
|
-
disabled: it['disabled'] ? it['disabled'] : false
|
|
527
|
+
disabled: it['disabled'] ? it['disabled'] : false
|
|
517
528
|
}
|
|
518
529
|
})
|
|
519
530
|
}
|
|
@@ -525,13 +536,17 @@ export default {
|
|
|
525
536
|
},
|
|
526
537
|
async visibleChange(bool) {
|
|
527
538
|
const events = { ...(this.$listeners || {}), ...this.itemOptions.events }
|
|
528
|
-
|
|
529
|
-
|
|
539
|
+
const fn = events['visible-change']
|
|
540
|
+
if (fn) {
|
|
541
|
+
let go = fn(bool)
|
|
542
|
+
if (Promise.resolve(go) === go) {
|
|
543
|
+
go = await go
|
|
544
|
+
}
|
|
530
545
|
if (go === 'break') {
|
|
531
546
|
return go
|
|
532
547
|
}
|
|
533
548
|
}
|
|
534
|
-
if (!bool) {
|
|
549
|
+
if (!bool && this.isVirtualSelect) {
|
|
535
550
|
this.reset()
|
|
536
551
|
this.init()
|
|
537
552
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-virtual-select",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.82",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "DESKTOP-1EDDQ79\\dev026 <liuxiangxiang@94ai.com>",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^3.2.
|
|
18
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
17
|
+
"@94ai/common-utils": "^3.2.82",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^3.2.82",
|
|
19
19
|
"lodash-es": "^4.17.21",
|
|
20
20
|
"vue-demi": "^0.14.5",
|
|
21
21
|
"vue-virtual-scroll-list": "^2.3.5"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"types": "lib/index.d.ts",
|
|
34
34
|
"main": "lib/nf-virtual-select.cjs.js",
|
|
35
35
|
"module": "lib/nf-virtual-select.esm-bundler.js",
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1a0dfe015520e800c5565377459cac24bb723ee6"
|
|
37
37
|
}
|