@94ai/nf-virtual-select 8.3.0 → 8.3.1
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/el-option-node.vue.d.ts +2 -2
- package/lib/nf-virtual-select-container.vue.d.ts +3 -3
- package/lib/nf-virtual-select.cjs.js +23 -7
- package/lib/nf-virtual-select.esm-bundler.js +23 -7
- package/package/el-option-node.vue +1 -1
- package/package/nf-virtual-select-container.vue +1 -1
- package/package/nf-virtual-select.vue +21 -5
- package/package.json +4 -4
|
@@ -12,7 +12,7 @@ declare var _default: import("vue").DefineComponent<{
|
|
|
12
12
|
required: true;
|
|
13
13
|
};
|
|
14
14
|
value: {
|
|
15
|
-
type: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
15
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
|
|
16
16
|
required: true;
|
|
17
17
|
};
|
|
18
18
|
showTip: {
|
|
@@ -41,7 +41,7 @@ declare var _default: import("vue").DefineComponent<{
|
|
|
41
41
|
required: true;
|
|
42
42
|
};
|
|
43
43
|
value: {
|
|
44
|
-
type: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
44
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
|
|
45
45
|
required: true;
|
|
46
46
|
};
|
|
47
47
|
showTip: {
|
|
@@ -4,7 +4,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
4
4
|
default: string;
|
|
5
5
|
};
|
|
6
6
|
value: {
|
|
7
|
-
type: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
7
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
|
|
8
8
|
default: () => "";
|
|
9
9
|
};
|
|
10
10
|
config: {
|
|
@@ -19,7 +19,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
19
19
|
default: string;
|
|
20
20
|
};
|
|
21
21
|
value: {
|
|
22
|
-
type: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
22
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
|
|
23
23
|
default: () => "";
|
|
24
24
|
};
|
|
25
25
|
config: {
|
|
@@ -27,7 +27,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
27
27
|
default: () => {};
|
|
28
28
|
};
|
|
29
29
|
}>>, {
|
|
30
|
-
value: string | number | unknown[];
|
|
30
|
+
value: string | number | boolean | unknown[];
|
|
31
31
|
tag: string;
|
|
32
32
|
config: Record<string, any>;
|
|
33
33
|
}>;
|
|
@@ -26,7 +26,7 @@ const _sfc_main$2 = {
|
|
|
26
26
|
},
|
|
27
27
|
value: {
|
|
28
28
|
// 绑定的值
|
|
29
|
-
type: [String, Number, Array],
|
|
29
|
+
type: [String, Number, Array, Boolean],
|
|
30
30
|
required: true
|
|
31
31
|
},
|
|
32
32
|
showTip: {
|
|
@@ -2277,7 +2277,7 @@ const _sfc_main$1 = vueDemi.defineComponent({
|
|
|
2277
2277
|
default: "el-select"
|
|
2278
2278
|
},
|
|
2279
2279
|
value: {
|
|
2280
|
-
type: [String, Number, Array],
|
|
2280
|
+
type: [String, Number, Array, Boolean],
|
|
2281
2281
|
default: () => ""
|
|
2282
2282
|
},
|
|
2283
2283
|
config: {
|
|
@@ -2485,7 +2485,7 @@ const _sfc_main = {
|
|
|
2485
2485
|
* 选中值
|
|
2486
2486
|
*/
|
|
2487
2487
|
value: {
|
|
2488
|
-
type: [String, Number, Array],
|
|
2488
|
+
type: [String, Number, Array, Boolean],
|
|
2489
2489
|
default: () => {
|
|
2490
2490
|
return "";
|
|
2491
2491
|
}
|
|
@@ -2568,6 +2568,10 @@ const _sfc_main = {
|
|
|
2568
2568
|
clearable: {
|
|
2569
2569
|
type: Boolean,
|
|
2570
2570
|
default: false
|
|
2571
|
+
},
|
|
2572
|
+
reserveKeyword: {
|
|
2573
|
+
type: Boolean,
|
|
2574
|
+
default: true
|
|
2571
2575
|
}
|
|
2572
2576
|
},
|
|
2573
2577
|
data() {
|
|
@@ -2661,6 +2665,7 @@ const _sfc_main = {
|
|
|
2661
2665
|
bindProps() {
|
|
2662
2666
|
let obj = {
|
|
2663
2667
|
clearable: this.clearable,
|
|
2668
|
+
reserveKeyword: this.reserveKeyword,
|
|
2664
2669
|
...this.itemOptions,
|
|
2665
2670
|
...this.$attrs,
|
|
2666
2671
|
keywordHighlight: !!(this.keywordHighlight || this.itemOptions.keywordHighlight),
|
|
@@ -2705,6 +2710,9 @@ const _sfc_main = {
|
|
|
2705
2710
|
isMultipleSelect() {
|
|
2706
2711
|
return this.multiple || this.itemOptions.multiple;
|
|
2707
2712
|
},
|
|
2713
|
+
isReserveKeyword() {
|
|
2714
|
+
return this.reserveKeyword || this.itemOptions.reserveKeyword;
|
|
2715
|
+
},
|
|
2708
2716
|
placeholderDesc() {
|
|
2709
2717
|
return this.itemOptions.placeholder || this.placeholder;
|
|
2710
2718
|
},
|
|
@@ -2819,7 +2827,7 @@ const _sfc_main = {
|
|
|
2819
2827
|
...it,
|
|
2820
2828
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
2821
2829
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
2822
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
2830
|
+
[this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
|
|
2823
2831
|
disabled: it["disabled"] ?? false
|
|
2824
2832
|
}))) ?? [];
|
|
2825
2833
|
if (this.currentVal && this.echoValueTop) {
|
|
@@ -2838,6 +2846,9 @@ const _sfc_main = {
|
|
|
2838
2846
|
this.keywordHighlightFn(selectArr);
|
|
2839
2847
|
}
|
|
2840
2848
|
this.selectArr = selectArr;
|
|
2849
|
+
if (this.keyword && this.isMultipleSelect && this.isReserveKeyword) {
|
|
2850
|
+
this.filterMethod(this.keyword, false);
|
|
2851
|
+
}
|
|
2841
2852
|
} else {
|
|
2842
2853
|
let selectArr = [];
|
|
2843
2854
|
selectArr = (this.optionsList || []).map((it) => ({
|
|
@@ -2874,14 +2885,15 @@ const _sfc_main = {
|
|
|
2874
2885
|
}
|
|
2875
2886
|
},
|
|
2876
2887
|
// 搜索
|
|
2877
|
-
async filterMethod(query) {
|
|
2888
|
+
async filterMethod(query, needReset = true) {
|
|
2878
2889
|
this.keyword = query;
|
|
2879
2890
|
const filterHandler = this.bindProps["filter-method"];
|
|
2880
2891
|
if (query !== "") {
|
|
2881
2892
|
if (filterHandler) {
|
|
2882
2893
|
await filterHandler(query);
|
|
2883
2894
|
} else {
|
|
2884
|
-
|
|
2895
|
+
if (needReset)
|
|
2896
|
+
this.reset();
|
|
2885
2897
|
const queryLower = query.toLowerCase().trim();
|
|
2886
2898
|
const queryText = (query || "").replace(/\,/g, ",");
|
|
2887
2899
|
let querySet = null;
|
|
@@ -2902,11 +2914,15 @@ const _sfc_main = {
|
|
|
2902
2914
|
}
|
|
2903
2915
|
});
|
|
2904
2916
|
}
|
|
2917
|
+
if (this.isVirtualSelect && this.echoValueTop && this.isMultipleSelect && this.isReserveKeyword) {
|
|
2918
|
+
const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
2919
|
+
selectArr = [...multiple_elements, ...selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
2920
|
+
}
|
|
2905
2921
|
this.selectArr = (selectArr || []).map((it) => {
|
|
2906
2922
|
return {
|
|
2907
2923
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
2908
2924
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
2909
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
2925
|
+
[this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
|
|
2910
2926
|
disabled: it["disabled"] ? it["disabled"] : false
|
|
2911
2927
|
};
|
|
2912
2928
|
});
|
|
@@ -24,7 +24,7 @@ const _sfc_main$2 = {
|
|
|
24
24
|
},
|
|
25
25
|
value: {
|
|
26
26
|
// 绑定的值
|
|
27
|
-
type: [String, Number, Array],
|
|
27
|
+
type: [String, Number, Array, Boolean],
|
|
28
28
|
required: true
|
|
29
29
|
},
|
|
30
30
|
showTip: {
|
|
@@ -2275,7 +2275,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
2275
2275
|
default: "el-select"
|
|
2276
2276
|
},
|
|
2277
2277
|
value: {
|
|
2278
|
-
type: [String, Number, Array],
|
|
2278
|
+
type: [String, Number, Array, Boolean],
|
|
2279
2279
|
default: () => ""
|
|
2280
2280
|
},
|
|
2281
2281
|
config: {
|
|
@@ -2483,7 +2483,7 @@ const _sfc_main = {
|
|
|
2483
2483
|
* 选中值
|
|
2484
2484
|
*/
|
|
2485
2485
|
value: {
|
|
2486
|
-
type: [String, Number, Array],
|
|
2486
|
+
type: [String, Number, Array, Boolean],
|
|
2487
2487
|
default: () => {
|
|
2488
2488
|
return "";
|
|
2489
2489
|
}
|
|
@@ -2566,6 +2566,10 @@ const _sfc_main = {
|
|
|
2566
2566
|
clearable: {
|
|
2567
2567
|
type: Boolean,
|
|
2568
2568
|
default: false
|
|
2569
|
+
},
|
|
2570
|
+
reserveKeyword: {
|
|
2571
|
+
type: Boolean,
|
|
2572
|
+
default: true
|
|
2569
2573
|
}
|
|
2570
2574
|
},
|
|
2571
2575
|
data() {
|
|
@@ -2659,6 +2663,7 @@ const _sfc_main = {
|
|
|
2659
2663
|
bindProps() {
|
|
2660
2664
|
let obj = {
|
|
2661
2665
|
clearable: this.clearable,
|
|
2666
|
+
reserveKeyword: this.reserveKeyword,
|
|
2662
2667
|
...this.itemOptions,
|
|
2663
2668
|
...this.$attrs,
|
|
2664
2669
|
keywordHighlight: !!(this.keywordHighlight || this.itemOptions.keywordHighlight),
|
|
@@ -2703,6 +2708,9 @@ const _sfc_main = {
|
|
|
2703
2708
|
isMultipleSelect() {
|
|
2704
2709
|
return this.multiple || this.itemOptions.multiple;
|
|
2705
2710
|
},
|
|
2711
|
+
isReserveKeyword() {
|
|
2712
|
+
return this.reserveKeyword || this.itemOptions.reserveKeyword;
|
|
2713
|
+
},
|
|
2706
2714
|
placeholderDesc() {
|
|
2707
2715
|
return this.itemOptions.placeholder || this.placeholder;
|
|
2708
2716
|
},
|
|
@@ -2817,7 +2825,7 @@ const _sfc_main = {
|
|
|
2817
2825
|
...it,
|
|
2818
2826
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
2819
2827
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
2820
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
2828
|
+
[this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
|
|
2821
2829
|
disabled: it["disabled"] ?? false
|
|
2822
2830
|
}))) ?? [];
|
|
2823
2831
|
if (this.currentVal && this.echoValueTop) {
|
|
@@ -2836,6 +2844,9 @@ const _sfc_main = {
|
|
|
2836
2844
|
this.keywordHighlightFn(selectArr);
|
|
2837
2845
|
}
|
|
2838
2846
|
this.selectArr = selectArr;
|
|
2847
|
+
if (this.keyword && this.isMultipleSelect && this.isReserveKeyword) {
|
|
2848
|
+
this.filterMethod(this.keyword, false);
|
|
2849
|
+
}
|
|
2839
2850
|
} else {
|
|
2840
2851
|
let selectArr = [];
|
|
2841
2852
|
selectArr = (this.optionsList || []).map((it) => ({
|
|
@@ -2872,14 +2883,15 @@ const _sfc_main = {
|
|
|
2872
2883
|
}
|
|
2873
2884
|
},
|
|
2874
2885
|
// 搜索
|
|
2875
|
-
async filterMethod(query) {
|
|
2886
|
+
async filterMethod(query, needReset = true) {
|
|
2876
2887
|
this.keyword = query;
|
|
2877
2888
|
const filterHandler = this.bindProps["filter-method"];
|
|
2878
2889
|
if (query !== "") {
|
|
2879
2890
|
if (filterHandler) {
|
|
2880
2891
|
await filterHandler(query);
|
|
2881
2892
|
} else {
|
|
2882
|
-
|
|
2893
|
+
if (needReset)
|
|
2894
|
+
this.reset();
|
|
2883
2895
|
const queryLower = query.toLowerCase().trim();
|
|
2884
2896
|
const queryText = (query || "").replace(/\,/g, ",");
|
|
2885
2897
|
let querySet = null;
|
|
@@ -2900,11 +2912,15 @@ const _sfc_main = {
|
|
|
2900
2912
|
}
|
|
2901
2913
|
});
|
|
2902
2914
|
}
|
|
2915
|
+
if (this.isVirtualSelect && this.echoValueTop && this.isMultipleSelect && this.isReserveKeyword) {
|
|
2916
|
+
const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
2917
|
+
selectArr = [...multiple_elements, ...selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
2918
|
+
}
|
|
2903
2919
|
this.selectArr = (selectArr || []).map((it) => {
|
|
2904
2920
|
return {
|
|
2905
2921
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
2906
2922
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
2907
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
2923
|
+
[this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
|
|
2908
2924
|
disabled: it["disabled"] ? it["disabled"] : false
|
|
2909
2925
|
};
|
|
2910
2926
|
});
|
|
@@ -233,7 +233,7 @@ export default {
|
|
|
233
233
|
* 选中值
|
|
234
234
|
*/
|
|
235
235
|
value: {
|
|
236
|
-
type: [String, Number, Array],
|
|
236
|
+
type: [String, Number, Array, Boolean],
|
|
237
237
|
default: () => {
|
|
238
238
|
return ''
|
|
239
239
|
}
|
|
@@ -318,6 +318,10 @@ export default {
|
|
|
318
318
|
type: Boolean,
|
|
319
319
|
default: false
|
|
320
320
|
},
|
|
321
|
+
reserveKeyword: {
|
|
322
|
+
type: Boolean,
|
|
323
|
+
default: true
|
|
324
|
+
},
|
|
321
325
|
},
|
|
322
326
|
data() {
|
|
323
327
|
const that = this
|
|
@@ -401,6 +405,7 @@ export default {
|
|
|
401
405
|
bindProps() {
|
|
402
406
|
let obj = {
|
|
403
407
|
clearable: this.clearable,
|
|
408
|
+
reserveKeyword: this.reserveKeyword,
|
|
404
409
|
...this.itemOptions,
|
|
405
410
|
...this.$attrs,
|
|
406
411
|
keywordHighlight: !!(this.keywordHighlight || this.itemOptions.keywordHighlight),
|
|
@@ -442,6 +447,9 @@ export default {
|
|
|
442
447
|
isMultipleSelect() {
|
|
443
448
|
return this.multiple || this.itemOptions.multiple
|
|
444
449
|
},
|
|
450
|
+
isReserveKeyword() {
|
|
451
|
+
return this.reserveKeyword || this.itemOptions.reserveKeyword
|
|
452
|
+
},
|
|
445
453
|
placeholderDesc() {
|
|
446
454
|
return this.itemOptions.placeholder || this.placeholder
|
|
447
455
|
},
|
|
@@ -551,7 +559,7 @@ export default {
|
|
|
551
559
|
...it,
|
|
552
560
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
553
561
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
554
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
562
|
+
[this.dataKey]: typeof it[this.keyValue[1]] === 'boolean' ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
|
|
555
563
|
disabled: it['disabled'] ?? false
|
|
556
564
|
})) ?? []
|
|
557
565
|
if (this.currentVal && this.echoValueTop) {
|
|
@@ -573,6 +581,9 @@ export default {
|
|
|
573
581
|
this.keywordHighlightFn(selectArr)
|
|
574
582
|
}
|
|
575
583
|
this.selectArr = selectArr
|
|
584
|
+
if(this.keyword && this.isMultipleSelect && this.isReserveKeyword) {
|
|
585
|
+
this.filterMethod(this.keyword, false)
|
|
586
|
+
}
|
|
576
587
|
} else {
|
|
577
588
|
// 非虚拟选择器
|
|
578
589
|
let selectArr = []
|
|
@@ -613,14 +624,14 @@ export default {
|
|
|
613
624
|
}
|
|
614
625
|
},
|
|
615
626
|
// 搜索
|
|
616
|
-
async filterMethod(query) {
|
|
627
|
+
async filterMethod(query, needReset = true) {
|
|
617
628
|
this.keyword = query
|
|
618
629
|
const filterHandler = this.bindProps['filter-method']
|
|
619
630
|
if (query !== '') {
|
|
620
631
|
if (filterHandler) {
|
|
621
632
|
await filterHandler(query)
|
|
622
633
|
} else {
|
|
623
|
-
this.reset()
|
|
634
|
+
if(needReset) this.reset()
|
|
624
635
|
const queryLower = query.toLowerCase().trim();
|
|
625
636
|
const queryText = (query || '').replace(/\,/g, ',')
|
|
626
637
|
let querySet = null
|
|
@@ -643,11 +654,16 @@ export default {
|
|
|
643
654
|
}
|
|
644
655
|
});
|
|
645
656
|
}
|
|
657
|
+
// 处理 虚拟下拉在多选可搜索且保留搜索关键词的时候,修改数据顺序
|
|
658
|
+
if(this.isVirtualSelect && this.echoValueTop && this.isMultipleSelect && this.isReserveKeyword) {
|
|
659
|
+
const multiple_elements = selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
|
|
660
|
+
selectArr = [...multiple_elements, ...selectArr.filter(item => !multiple_elements.includes(item))]
|
|
661
|
+
}
|
|
646
662
|
this.selectArr = (selectArr || []).map(it => {
|
|
647
663
|
return {
|
|
648
664
|
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
649
665
|
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
650
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
666
|
+
[this.dataKey]: typeof it[this.keyValue[1]] === 'boolean' ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
|
|
651
667
|
disabled: it['disabled'] ? it['disabled'] : false
|
|
652
668
|
}
|
|
653
669
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-virtual-select",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.1",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>,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": "^8.3.
|
|
18
|
-
"@94ai/nf-theme-chalk": "^8.3.
|
|
17
|
+
"@94ai/common-utils": "^8.3.1",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^8.3.1",
|
|
19
19
|
"lodash-es": "^4.17.21",
|
|
20
20
|
"sortablejs": "^1.15.3",
|
|
21
21
|
"vue-demi": "^0.14.5",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"types": "lib/index.d.ts",
|
|
35
35
|
"main": "lib/nf-virtual-select.cjs.js",
|
|
36
36
|
"module": "lib/nf-virtual-select.esm-bundler.js",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "dce9841321fbd24cdf1fc19ee094afa69ae1701c"
|
|
38
38
|
}
|