@94ai/nf-virtual-select 3.2.52 → 3.2.56
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 +28 -0
- package/lib/nf-virtual-select.cjs.js +72 -24
- package/lib/nf-virtual-select.esm-bundler.js +73 -25
- package/lib/nf-virtual-select.vue.d.ts +10 -0
- package/package/el-option-node.vue +4 -1
- package/package/nf-virtual-select.vue +61 -25
- package/package.json +3 -3
- package/package.json.2027367785 +0 -36
package/lib/index.d.ts
CHANGED
|
@@ -137,6 +137,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
137
137
|
type: StringConstructor;
|
|
138
138
|
default: string;
|
|
139
139
|
};
|
|
140
|
+
isFitWidth: {
|
|
141
|
+
type: BooleanConstructor;
|
|
142
|
+
default: boolean;
|
|
143
|
+
};
|
|
140
144
|
dataComponent: {
|
|
141
145
|
type: ObjectConstructor;
|
|
142
146
|
};
|
|
@@ -286,6 +290,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
286
290
|
type: StringConstructor;
|
|
287
291
|
default: string;
|
|
288
292
|
};
|
|
293
|
+
isFitWidth: {
|
|
294
|
+
type: BooleanConstructor;
|
|
295
|
+
default: boolean;
|
|
296
|
+
};
|
|
289
297
|
dataComponent: {
|
|
290
298
|
type: ObjectConstructor;
|
|
291
299
|
};
|
|
@@ -333,6 +341,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
333
341
|
multiple: boolean;
|
|
334
342
|
width: string;
|
|
335
343
|
height: string;
|
|
344
|
+
isFitWidth: boolean;
|
|
336
345
|
extraProps: Record<string, any>;
|
|
337
346
|
dataKey: string | Function;
|
|
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<{
|
|
@@ -470,6 +479,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
470
479
|
type: StringConstructor;
|
|
471
480
|
default: string;
|
|
472
481
|
};
|
|
482
|
+
isFitWidth: {
|
|
483
|
+
type: BooleanConstructor;
|
|
484
|
+
default: boolean;
|
|
485
|
+
};
|
|
473
486
|
dataComponent: {
|
|
474
487
|
type: ObjectConstructor;
|
|
475
488
|
};
|
|
@@ -498,6 +511,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
498
511
|
bindEvents(): any;
|
|
499
512
|
formatItemOptions(): any;
|
|
500
513
|
optionsList(): any;
|
|
514
|
+
maxLimitElWidth(): any;
|
|
501
515
|
}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
|
|
502
516
|
offset: {
|
|
503
517
|
type: NumberConstructor;
|
|
@@ -633,6 +647,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
633
647
|
type: StringConstructor;
|
|
634
648
|
default: string;
|
|
635
649
|
};
|
|
650
|
+
isFitWidth: {
|
|
651
|
+
type: BooleanConstructor;
|
|
652
|
+
default: boolean;
|
|
653
|
+
};
|
|
636
654
|
dataComponent: {
|
|
637
655
|
type: ObjectConstructor;
|
|
638
656
|
};
|
|
@@ -782,6 +800,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
782
800
|
type: StringConstructor;
|
|
783
801
|
default: string;
|
|
784
802
|
};
|
|
803
|
+
isFitWidth: {
|
|
804
|
+
type: BooleanConstructor;
|
|
805
|
+
default: boolean;
|
|
806
|
+
};
|
|
785
807
|
dataComponent: {
|
|
786
808
|
type: ObjectConstructor;
|
|
787
809
|
};
|
|
@@ -810,6 +832,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
810
832
|
bindEvents(): any;
|
|
811
833
|
formatItemOptions(): any;
|
|
812
834
|
optionsList(): any;
|
|
835
|
+
maxLimitElWidth(): any;
|
|
813
836
|
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {
|
|
814
837
|
value: string | number | unknown[];
|
|
815
838
|
placeholder: string;
|
|
@@ -843,6 +866,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
843
866
|
multiple: boolean;
|
|
844
867
|
width: string;
|
|
845
868
|
height: string;
|
|
869
|
+
isFitWidth: boolean;
|
|
846
870
|
extraProps: Record<string, any>;
|
|
847
871
|
dataKey: string | Function;
|
|
848
872
|
}> & {
|
|
@@ -981,6 +1005,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
981
1005
|
type: StringConstructor;
|
|
982
1006
|
default: string;
|
|
983
1007
|
};
|
|
1008
|
+
isFitWidth: {
|
|
1009
|
+
type: BooleanConstructor;
|
|
1010
|
+
default: boolean;
|
|
1011
|
+
};
|
|
984
1012
|
dataComponent: {
|
|
985
1013
|
type: ObjectConstructor;
|
|
986
1014
|
};
|
|
@@ -61,11 +61,19 @@ var _sfc_render$1 = function render() {
|
|
|
61
61
|
}, [_vm._v(" " + _vm._s((_f = (_e = _vm.source) == null ? void 0 : _e.slotContent) == null ? void 0 : _f.firstCall) + " "), _c("br"), _vm._v(" "), _c("br"), _vm._v(" " + _vm._s((_h = (_g = _vm.source) == null ? void 0 : _g.slotContent) == null ? void 0 : _h.recall) + " ")]), _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _vm._e(), _vm.showTip ? _c("el-tooltip", {
|
|
62
62
|
attrs: {
|
|
63
63
|
"content": _vm.source[_vm.label],
|
|
64
|
-
"open-delay":
|
|
64
|
+
"open-delay": 0,
|
|
65
65
|
"effect": "dark",
|
|
66
66
|
"placement": "left"
|
|
67
67
|
}
|
|
68
|
-
}, [_c("
|
|
68
|
+
}, [_c("div", {
|
|
69
|
+
staticStyle: {
|
|
70
|
+
"max-width": "120px"
|
|
71
|
+
},
|
|
72
|
+
attrs: {
|
|
73
|
+
"slot": "content"
|
|
74
|
+
},
|
|
75
|
+
slot: "content"
|
|
76
|
+
}, [_vm._v(" " + _vm._s(_vm.source[_vm.label]) + " ")]), _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _vm._e()], 1);
|
|
69
77
|
};
|
|
70
78
|
var _sfc_staticRenderFns$1 = [];
|
|
71
79
|
var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
@@ -229,6 +237,10 @@ const _sfc_main = {
|
|
|
229
237
|
type: String,
|
|
230
238
|
default: "245px"
|
|
231
239
|
},
|
|
240
|
+
isFitWidth: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
default: true
|
|
243
|
+
},
|
|
232
244
|
dataComponent: {
|
|
233
245
|
type: Object
|
|
234
246
|
},
|
|
@@ -245,8 +257,41 @@ const _sfc_main = {
|
|
|
245
257
|
}
|
|
246
258
|
},
|
|
247
259
|
data() {
|
|
260
|
+
const that = this;
|
|
261
|
+
const ElOption = {
|
|
262
|
+
props: {
|
|
263
|
+
index: {
|
|
264
|
+
// 每一行的索引
|
|
265
|
+
type: Number,
|
|
266
|
+
required: true
|
|
267
|
+
},
|
|
268
|
+
source: {
|
|
269
|
+
// 每一行的内容
|
|
270
|
+
type: Object,
|
|
271
|
+
default() {
|
|
272
|
+
return {};
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
showTip: {
|
|
276
|
+
// 提示
|
|
277
|
+
type: Boolean,
|
|
278
|
+
default: true
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
render(h) {
|
|
282
|
+
return h(ElOptionNode, {
|
|
283
|
+
attrs: {
|
|
284
|
+
label: that.keyValue[0],
|
|
285
|
+
value: that.keyValue[1],
|
|
286
|
+
showTip: this.showTip,
|
|
287
|
+
source: this.source,
|
|
288
|
+
index: this.index
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
248
293
|
return {
|
|
249
|
-
itemComponent: this.dataComponent ??
|
|
294
|
+
itemComponent: this.dataComponent ?? ElOption,
|
|
250
295
|
selectArr: []
|
|
251
296
|
};
|
|
252
297
|
},
|
|
@@ -323,6 +368,9 @@ const _sfc_main = {
|
|
|
323
368
|
} else {
|
|
324
369
|
return [];
|
|
325
370
|
}
|
|
371
|
+
},
|
|
372
|
+
maxLimitElWidth() {
|
|
373
|
+
return this.isFitWidth ? this.width : null;
|
|
326
374
|
}
|
|
327
375
|
},
|
|
328
376
|
watch: {
|
|
@@ -410,17 +458,15 @@ const _sfc_main = {
|
|
|
410
458
|
this.$nextTick(() => {
|
|
411
459
|
var _a;
|
|
412
460
|
if (this.isVirtualSelect) {
|
|
413
|
-
|
|
414
|
-
this.
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
} else {
|
|
421
|
-
this.selectArr = this.optionsList ? lodashEs.cloneDeep(this.optionsList) : [];
|
|
461
|
+
this.selectArr = ((_a = this.optionsList) == null ? void 0 : _a.map((it) => ({
|
|
462
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
463
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
464
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
465
|
+
disabled: it["disabled"] ?? false
|
|
466
|
+
}))) ?? [];
|
|
467
|
+
if (this.currentVal) {
|
|
422
468
|
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
423
|
-
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item.
|
|
469
|
+
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
424
470
|
this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
425
471
|
} else {
|
|
426
472
|
const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
|
|
@@ -432,8 +478,8 @@ const _sfc_main = {
|
|
|
432
478
|
}
|
|
433
479
|
} else {
|
|
434
480
|
this.selectArr = (this.optionsList || []).map((it) => ({
|
|
435
|
-
|
|
436
|
-
|
|
481
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
482
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
437
483
|
disabled: it["disabled"] ?? false
|
|
438
484
|
}));
|
|
439
485
|
}
|
|
@@ -444,15 +490,17 @@ const _sfc_main = {
|
|
|
444
490
|
if (query !== "") {
|
|
445
491
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
446
492
|
let timer = setTimeout(() => {
|
|
447
|
-
|
|
493
|
+
var _a, _b, _c;
|
|
494
|
+
const arr = ((_b = (_a = this.itemOptions) == null ? void 0 : _a.options) == null ? void 0 : _b.length) ? this.itemOptions.options : ((_c = this.options) == null ? void 0 : _c.length) ? this.options : [];
|
|
495
|
+
const selectArr = arr.filter((item) => {
|
|
448
496
|
if (item[this.keyValue[0]]) {
|
|
449
497
|
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
450
498
|
}
|
|
451
499
|
});
|
|
452
500
|
this.selectArr = (selectArr || []).map((it) => {
|
|
453
501
|
return {
|
|
454
|
-
|
|
455
|
-
|
|
502
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
503
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
456
504
|
[this.dataKey]: it[this.keyValue[1]],
|
|
457
505
|
disabled: it["disabled"] ? it["disabled"] : false,
|
|
458
506
|
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
@@ -519,7 +567,7 @@ var _sfc_render = function render2() {
|
|
|
519
567
|
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [_c("virtual-list", {
|
|
520
568
|
ref: "virtualSelectList",
|
|
521
569
|
staticClass: "nf-virtual-select-list",
|
|
522
|
-
style: `max-height: ${_vm.height};width: ${_vm.
|
|
570
|
+
style: `max-height: ${_vm.height};width: ${_vm.maxLimitElWidth}; overflow-y: auto;`,
|
|
523
571
|
attrs: {
|
|
524
572
|
"offset": _vm.offset,
|
|
525
573
|
"start": _vm.start,
|
|
@@ -571,20 +619,20 @@ var _sfc_render = function render2() {
|
|
|
571
619
|
}
|
|
572
620
|
}, "el-select", _vm.bindProps, false), _vm.bindEvents), _vm._l(_vm.selectArr, function(item, index) {
|
|
573
621
|
return _c("el-option", {
|
|
574
|
-
key: item.
|
|
622
|
+
key: item[_vm.keyValue[0]] + "_" + index,
|
|
575
623
|
attrs: {
|
|
576
|
-
"label": item.
|
|
577
|
-
"value": item.
|
|
624
|
+
"label": item[_vm.keyValue[0]],
|
|
625
|
+
"value": item[_vm.keyValue[1]],
|
|
578
626
|
"disabled": item.disabled
|
|
579
627
|
}
|
|
580
628
|
}, [_c("el-tooltip", {
|
|
581
629
|
attrs: {
|
|
582
|
-
"content": item.
|
|
630
|
+
"content": item[_vm.keyValue[0]],
|
|
583
631
|
"open-delay": 1e3,
|
|
584
632
|
"effect": "dark",
|
|
585
633
|
"placement": "left"
|
|
586
634
|
}
|
|
587
|
-
}, [_c("span", [_vm._v(_vm._s(item.
|
|
635
|
+
}, [_c("span", [_vm._v(_vm._s(item[_vm.keyValue[0]]))])])], 1);
|
|
588
636
|
}), 1) : _vm._e()], 2);
|
|
589
637
|
};
|
|
590
638
|
var _sfc_staticRenderFns = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import virtualList from "vue-virtual-scroll-list";
|
|
2
2
|
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
|
-
import { isEqual
|
|
3
|
+
import { isEqual } from "lodash-es";
|
|
4
4
|
const _sfc_main$1 = {
|
|
5
5
|
name: "ItemComponent",
|
|
6
6
|
props: {
|
|
@@ -59,11 +59,19 @@ var _sfc_render$1 = function render() {
|
|
|
59
59
|
}, [_vm._v(" " + _vm._s((_f = (_e = _vm.source) == null ? void 0 : _e.slotContent) == null ? void 0 : _f.firstCall) + " "), _c("br"), _vm._v(" "), _c("br"), _vm._v(" " + _vm._s((_h = (_g = _vm.source) == null ? void 0 : _g.slotContent) == null ? void 0 : _h.recall) + " ")]), _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _vm._e(), _vm.showTip ? _c("el-tooltip", {
|
|
60
60
|
attrs: {
|
|
61
61
|
"content": _vm.source[_vm.label],
|
|
62
|
-
"open-delay":
|
|
62
|
+
"open-delay": 0,
|
|
63
63
|
"effect": "dark",
|
|
64
64
|
"placement": "left"
|
|
65
65
|
}
|
|
66
|
-
}, [_c("
|
|
66
|
+
}, [_c("div", {
|
|
67
|
+
staticStyle: {
|
|
68
|
+
"max-width": "120px"
|
|
69
|
+
},
|
|
70
|
+
attrs: {
|
|
71
|
+
"slot": "content"
|
|
72
|
+
},
|
|
73
|
+
slot: "content"
|
|
74
|
+
}, [_vm._v(" " + _vm._s(_vm.source[_vm.label]) + " ")]), _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _vm._e()], 1);
|
|
67
75
|
};
|
|
68
76
|
var _sfc_staticRenderFns$1 = [];
|
|
69
77
|
var __component__$1 = /* @__PURE__ */ normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
@@ -227,6 +235,10 @@ const _sfc_main = {
|
|
|
227
235
|
type: String,
|
|
228
236
|
default: "245px"
|
|
229
237
|
},
|
|
238
|
+
isFitWidth: {
|
|
239
|
+
type: Boolean,
|
|
240
|
+
default: true
|
|
241
|
+
},
|
|
230
242
|
dataComponent: {
|
|
231
243
|
type: Object
|
|
232
244
|
},
|
|
@@ -243,8 +255,41 @@ const _sfc_main = {
|
|
|
243
255
|
}
|
|
244
256
|
},
|
|
245
257
|
data() {
|
|
258
|
+
const that = this;
|
|
259
|
+
const ElOption = {
|
|
260
|
+
props: {
|
|
261
|
+
index: {
|
|
262
|
+
// 每一行的索引
|
|
263
|
+
type: Number,
|
|
264
|
+
required: true
|
|
265
|
+
},
|
|
266
|
+
source: {
|
|
267
|
+
// 每一行的内容
|
|
268
|
+
type: Object,
|
|
269
|
+
default() {
|
|
270
|
+
return {};
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
showTip: {
|
|
274
|
+
// 提示
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: true
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
render(h) {
|
|
280
|
+
return h(ElOptionNode, {
|
|
281
|
+
attrs: {
|
|
282
|
+
label: that.keyValue[0],
|
|
283
|
+
value: that.keyValue[1],
|
|
284
|
+
showTip: this.showTip,
|
|
285
|
+
source: this.source,
|
|
286
|
+
index: this.index
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
246
291
|
return {
|
|
247
|
-
itemComponent: this.dataComponent ??
|
|
292
|
+
itemComponent: this.dataComponent ?? ElOption,
|
|
248
293
|
selectArr: []
|
|
249
294
|
};
|
|
250
295
|
},
|
|
@@ -321,6 +366,9 @@ const _sfc_main = {
|
|
|
321
366
|
} else {
|
|
322
367
|
return [];
|
|
323
368
|
}
|
|
369
|
+
},
|
|
370
|
+
maxLimitElWidth() {
|
|
371
|
+
return this.isFitWidth ? this.width : null;
|
|
324
372
|
}
|
|
325
373
|
},
|
|
326
374
|
watch: {
|
|
@@ -408,17 +456,15 @@ const _sfc_main = {
|
|
|
408
456
|
this.$nextTick(() => {
|
|
409
457
|
var _a;
|
|
410
458
|
if (this.isVirtualSelect) {
|
|
411
|
-
|
|
412
|
-
this.
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
} else {
|
|
419
|
-
this.selectArr = this.optionsList ? cloneDeep(this.optionsList) : [];
|
|
459
|
+
this.selectArr = ((_a = this.optionsList) == null ? void 0 : _a.map((it) => ({
|
|
460
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
461
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
462
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
463
|
+
disabled: it["disabled"] ?? false
|
|
464
|
+
}))) ?? [];
|
|
465
|
+
if (this.currentVal) {
|
|
420
466
|
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
421
|
-
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item.
|
|
467
|
+
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
422
468
|
this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
423
469
|
} else {
|
|
424
470
|
const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
|
|
@@ -430,8 +476,8 @@ const _sfc_main = {
|
|
|
430
476
|
}
|
|
431
477
|
} else {
|
|
432
478
|
this.selectArr = (this.optionsList || []).map((it) => ({
|
|
433
|
-
|
|
434
|
-
|
|
479
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
480
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
435
481
|
disabled: it["disabled"] ?? false
|
|
436
482
|
}));
|
|
437
483
|
}
|
|
@@ -442,15 +488,17 @@ const _sfc_main = {
|
|
|
442
488
|
if (query !== "") {
|
|
443
489
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
444
490
|
let timer = setTimeout(() => {
|
|
445
|
-
|
|
491
|
+
var _a, _b, _c;
|
|
492
|
+
const arr = ((_b = (_a = this.itemOptions) == null ? void 0 : _a.options) == null ? void 0 : _b.length) ? this.itemOptions.options : ((_c = this.options) == null ? void 0 : _c.length) ? this.options : [];
|
|
493
|
+
const selectArr = arr.filter((item) => {
|
|
446
494
|
if (item[this.keyValue[0]]) {
|
|
447
495
|
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
448
496
|
}
|
|
449
497
|
});
|
|
450
498
|
this.selectArr = (selectArr || []).map((it) => {
|
|
451
499
|
return {
|
|
452
|
-
|
|
453
|
-
|
|
500
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
501
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
454
502
|
[this.dataKey]: it[this.keyValue[1]],
|
|
455
503
|
disabled: it["disabled"] ? it["disabled"] : false,
|
|
456
504
|
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
@@ -517,7 +565,7 @@ var _sfc_render = function render2() {
|
|
|
517
565
|
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [_c("virtual-list", {
|
|
518
566
|
ref: "virtualSelectList",
|
|
519
567
|
staticClass: "nf-virtual-select-list",
|
|
520
|
-
style: `max-height: ${_vm.height};width: ${_vm.
|
|
568
|
+
style: `max-height: ${_vm.height};width: ${_vm.maxLimitElWidth}; overflow-y: auto;`,
|
|
521
569
|
attrs: {
|
|
522
570
|
"offset": _vm.offset,
|
|
523
571
|
"start": _vm.start,
|
|
@@ -569,20 +617,20 @@ var _sfc_render = function render2() {
|
|
|
569
617
|
}
|
|
570
618
|
}, "el-select", _vm.bindProps, false), _vm.bindEvents), _vm._l(_vm.selectArr, function(item, index) {
|
|
571
619
|
return _c("el-option", {
|
|
572
|
-
key: item.
|
|
620
|
+
key: item[_vm.keyValue[0]] + "_" + index,
|
|
573
621
|
attrs: {
|
|
574
|
-
"label": item.
|
|
575
|
-
"value": item.
|
|
622
|
+
"label": item[_vm.keyValue[0]],
|
|
623
|
+
"value": item[_vm.keyValue[1]],
|
|
576
624
|
"disabled": item.disabled
|
|
577
625
|
}
|
|
578
626
|
}, [_c("el-tooltip", {
|
|
579
627
|
attrs: {
|
|
580
|
-
"content": item.
|
|
628
|
+
"content": item[_vm.keyValue[0]],
|
|
581
629
|
"open-delay": 1e3,
|
|
582
630
|
"effect": "dark",
|
|
583
631
|
"placement": "left"
|
|
584
632
|
}
|
|
585
|
-
}, [_c("span", [_vm._v(_vm._s(item.
|
|
633
|
+
}, [_c("span", [_vm._v(_vm._s(item[_vm.keyValue[0]]))])])], 1);
|
|
586
634
|
}), 1) : _vm._e()], 2);
|
|
587
635
|
};
|
|
588
636
|
var _sfc_staticRenderFns = [];
|
|
@@ -133,6 +133,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
133
133
|
type: StringConstructor;
|
|
134
134
|
default: string;
|
|
135
135
|
};
|
|
136
|
+
isFitWidth: {
|
|
137
|
+
type: BooleanConstructor;
|
|
138
|
+
default: boolean;
|
|
139
|
+
};
|
|
136
140
|
dataComponent: {
|
|
137
141
|
type: ObjectConstructor;
|
|
138
142
|
};
|
|
@@ -161,6 +165,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
161
165
|
bindEvents(): any;
|
|
162
166
|
formatItemOptions(): any;
|
|
163
167
|
optionsList(): any;
|
|
168
|
+
maxLimitElWidth(): any;
|
|
164
169
|
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
|
|
165
170
|
offset: {
|
|
166
171
|
type: NumberConstructor;
|
|
@@ -296,6 +301,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
296
301
|
type: StringConstructor;
|
|
297
302
|
default: string;
|
|
298
303
|
};
|
|
304
|
+
isFitWidth: {
|
|
305
|
+
type: BooleanConstructor;
|
|
306
|
+
default: boolean;
|
|
307
|
+
};
|
|
299
308
|
dataComponent: {
|
|
300
309
|
type: ObjectConstructor;
|
|
301
310
|
};
|
|
@@ -343,6 +352,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
343
352
|
multiple: boolean;
|
|
344
353
|
width: string;
|
|
345
354
|
height: string;
|
|
355
|
+
isFitWidth: boolean;
|
|
346
356
|
extraProps: Record<string, any>;
|
|
347
357
|
dataKey: string | Function;
|
|
348
358
|
}>;
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
<span>{{ source[label] }}</span>
|
|
9
9
|
</el-tooltip>
|
|
10
|
-
<el-tooltip v-if="showTip" :content="source[label]" :open-delay="
|
|
10
|
+
<el-tooltip v-if="showTip" :content="source[label]" :open-delay="0" effect="dark" placement="left">
|
|
11
|
+
<div slot="content" style="max-width: 120px;">
|
|
12
|
+
{{ source[label] }}
|
|
13
|
+
</div>
|
|
11
14
|
<span>{{ source[label] }}</span>
|
|
12
15
|
</el-tooltip>
|
|
13
16
|
</el-option>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
@resized="resized"
|
|
42
42
|
ref="virtualSelectList"
|
|
43
43
|
class="nf-virtual-select-list"
|
|
44
|
-
:style="`max-height: ${height};width: ${
|
|
44
|
+
:style="`max-height: ${height};width: ${maxLimitElWidth}; overflow-y: auto;`"
|
|
45
45
|
:data-key="dataKey"
|
|
46
46
|
:estimate-size="estimateSize"
|
|
47
47
|
:data-sources="selectArr"
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
>
|
|
63
63
|
<el-option
|
|
64
64
|
v-for="(item, index) in selectArr"
|
|
65
|
-
:key="item
|
|
66
|
-
:label="item
|
|
67
|
-
:value="item
|
|
65
|
+
:key="item[keyValue[0]] + '_' + index"
|
|
66
|
+
:label="item[keyValue[0]]"
|
|
67
|
+
:value="item[keyValue[1]]"
|
|
68
68
|
:disabled="item.disabled"
|
|
69
69
|
>
|
|
70
|
-
<el-tooltip :content="item
|
|
71
|
-
<span>{{ item
|
|
70
|
+
<el-tooltip :content="item[keyValue[0]]" :open-delay="1000" effect="dark" placement="left">
|
|
71
|
+
<span>{{ item[keyValue[0]] }}</span>
|
|
72
72
|
</el-tooltip>
|
|
73
73
|
</el-option>
|
|
74
74
|
</el-select>
|
|
@@ -236,6 +236,10 @@ export default {
|
|
|
236
236
|
type: String,
|
|
237
237
|
default: '245px'
|
|
238
238
|
},
|
|
239
|
+
isFitWidth: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: true
|
|
242
|
+
},
|
|
239
243
|
dataComponent: {
|
|
240
244
|
type: Object,
|
|
241
245
|
},
|
|
@@ -252,8 +256,38 @@ export default {
|
|
|
252
256
|
}
|
|
253
257
|
},
|
|
254
258
|
data() {
|
|
259
|
+
const that = this
|
|
260
|
+
const ElOption = {
|
|
261
|
+
props: {
|
|
262
|
+
index: { // 每一行的索引
|
|
263
|
+
type: Number,
|
|
264
|
+
required: true
|
|
265
|
+
},
|
|
266
|
+
source: { // 每一行的内容
|
|
267
|
+
type: Object,
|
|
268
|
+
default() {
|
|
269
|
+
return {}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
showTip: { // 提示
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: true
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
render(h) {
|
|
278
|
+
return h(ElOptionNode, {
|
|
279
|
+
attrs: {
|
|
280
|
+
label: that.keyValue[0],
|
|
281
|
+
value: that.keyValue[1],
|
|
282
|
+
showTip: this.showTip,
|
|
283
|
+
source: this.source,
|
|
284
|
+
index: this.index,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
255
289
|
return {
|
|
256
|
-
itemComponent: this.dataComponent ??
|
|
290
|
+
itemComponent: this.dataComponent ?? ElOption,
|
|
257
291
|
selectArr: []
|
|
258
292
|
}
|
|
259
293
|
},
|
|
@@ -326,6 +360,9 @@ export default {
|
|
|
326
360
|
} else {
|
|
327
361
|
return [];
|
|
328
362
|
}
|
|
363
|
+
},
|
|
364
|
+
maxLimitElWidth() {
|
|
365
|
+
return this.isFitWidth ? this.width : null
|
|
329
366
|
}
|
|
330
367
|
},
|
|
331
368
|
watch: {
|
|
@@ -413,23 +450,21 @@ export default {
|
|
|
413
450
|
this.$nextTick(() => {
|
|
414
451
|
if ((this.isVirtualSelect)) {
|
|
415
452
|
// 虚拟
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
this.
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
} else {
|
|
453
|
+
// 无回显值
|
|
454
|
+
this.selectArr = this.optionsList?.map(it => ({
|
|
455
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
456
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
457
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
458
|
+
disabled: it['disabled'] ?? false
|
|
459
|
+
})) ?? [];
|
|
460
|
+
if (this.currentVal) {
|
|
425
461
|
// 有回显值
|
|
426
|
-
this.selectArr = this.optionsList ? cloneDeep(this.optionsList) : [];
|
|
427
462
|
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
428
|
-
|
|
429
|
-
const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item.
|
|
463
|
+
// 多选
|
|
464
|
+
const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
|
|
430
465
|
this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))];
|
|
431
466
|
} else {
|
|
432
|
-
|
|
467
|
+
// 单选
|
|
433
468
|
const index = this.selectArr.findIndex(item => item.value === this.currentVal);
|
|
434
469
|
if (index !== -1) {
|
|
435
470
|
const obj = this.selectArr.splice(index, 1)[0];
|
|
@@ -440,8 +475,8 @@ export default {
|
|
|
440
475
|
} else {
|
|
441
476
|
// 非虚拟选择器
|
|
442
477
|
this.selectArr = (this.optionsList || []).map(it => ({
|
|
443
|
-
|
|
444
|
-
|
|
478
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
479
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
445
480
|
disabled: it['disabled'] ?? false
|
|
446
481
|
}))
|
|
447
482
|
}
|
|
@@ -452,15 +487,16 @@ export default {
|
|
|
452
487
|
if (query !== '') {
|
|
453
488
|
this.$refs.virtualSelectList.scrollToIndex(0)// 滚动到顶部
|
|
454
489
|
let timer = setTimeout(() => {
|
|
455
|
-
const
|
|
490
|
+
const arr = this.itemOptions?.options?.length ? this.itemOptions.options : this.options?.length ? this.options : []
|
|
491
|
+
const selectArr = arr.filter(item => {
|
|
456
492
|
if (item[this.keyValue[0]]) {
|
|
457
493
|
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
458
494
|
}
|
|
459
495
|
})
|
|
460
496
|
this.selectArr = (selectArr || []).map(it => {
|
|
461
497
|
return {
|
|
462
|
-
|
|
463
|
-
|
|
498
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
499
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
464
500
|
[this.dataKey]: it[this.keyValue[1]],
|
|
465
501
|
disabled: it['disabled'] ? it['disabled'] : false,
|
|
466
502
|
slotContent: it?.slotContent || {}
|
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.56",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "DESKTOP-1EDDQ79\\dev026 <liuxiangxiang@94ai.com>",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
17
|
+
"@94ai/nf-theme-chalk": "^3.2.56",
|
|
18
18
|
"lodash-es": "^4.17.21",
|
|
19
19
|
"vue-demi": "^0.14.5",
|
|
20
20
|
"vue-virtual-scroll-list": "^2.3.5"
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"types": "lib/index.d.ts",
|
|
33
33
|
"main": "lib/nf-virtual-select.cjs.js",
|
|
34
34
|
"module": "lib/nf-virtual-select.esm-bundler.js",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a475b43138116c9b5cf8d660e000903f24dc5ba9"
|
|
36
36
|
}
|
package/package.json.2027367785
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@94ai/nf-virtual-select",
|
|
3
|
-
"version": "3.2.52",
|
|
4
|
-
"description": "> TODO: description",
|
|
5
|
-
"keywords": [],
|
|
6
|
-
"author": "DESKTOP-1EDDQ79\\dev026 <liuxiangxiang@94ai.com>",
|
|
7
|
-
"homepage": "https://oss.xccjh.top/common-ui/#/ai-index",
|
|
8
|
-
"license": "ISC",
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@94ai/nf-theme-chalk": "^3.2.52",
|
|
18
|
-
"lodash-es": "^4.17.21",
|
|
19
|
-
"vue-demi": "^0.14.5",
|
|
20
|
-
"vue-virtual-scroll-list": "^2.3.5"
|
|
21
|
-
},
|
|
22
|
-
"peerDependenciesMeta": {
|
|
23
|
-
"@vue/composition-api": {
|
|
24
|
-
"optional": true
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"peerDependencies": {
|
|
28
|
-
"@vue/composition-api": "^1.0.0-rc.1",
|
|
29
|
-
"element-ui": ">=2.13.2",
|
|
30
|
-
"vue": "^2.0.0 || >=3.0.0"
|
|
31
|
-
},
|
|
32
|
-
"types": "lib/index.d.ts",
|
|
33
|
-
"main": "lib/nf-virtual-select.cjs.js",
|
|
34
|
-
"module": "lib/nf-virtual-select.esm-bundler.js",
|
|
35
|
-
"gitHead": "1c4b9d8c3b8c416274a210124bf9f5f75ce01c73"
|
|
36
|
-
}
|