@94ai/nf-virtual-select 100.1.45 → 100.1.47
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 +126 -182
- package/lib/nf-virtual-select.cjs.js +82 -97
- package/lib/nf-virtual-select.esm-bundler.js +82 -97
- package/lib/nf-virtual-select.vue.d.ts +43 -63
- package/package/el-option-node.vue +14 -13
- package/package/nf-virtual-select.vue +91 -77
- package/package.json +3 -3
|
@@ -31,12 +31,11 @@ const _sfc_main$1 = {
|
|
|
31
31
|
showTip: {
|
|
32
32
|
// 提示
|
|
33
33
|
type: Boolean,
|
|
34
|
-
default:
|
|
34
|
+
default: false
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
var _sfc_render$1 = function render() {
|
|
39
|
-
var _a, _b, _c2, _d, _e, _f, _g, _h;
|
|
40
39
|
var _vm = this, _c = _vm._self._c;
|
|
41
40
|
return _c("el-option", {
|
|
42
41
|
key: _vm.index,
|
|
@@ -45,35 +44,14 @@ var _sfc_render$1 = function render() {
|
|
|
45
44
|
"value": _vm.source[_vm.value],
|
|
46
45
|
"disabled": _vm.source["disabled"]
|
|
47
46
|
}
|
|
48
|
-
}, [
|
|
49
|
-
attrs: {
|
|
50
|
-
"effect": "dark",
|
|
51
|
-
"placement": "right"
|
|
52
|
-
}
|
|
53
|
-
}, [_c("div", {
|
|
54
|
-
staticStyle: {
|
|
55
|
-
"max-width": "350px"
|
|
56
|
-
},
|
|
57
|
-
attrs: {
|
|
58
|
-
"slot": "content"
|
|
59
|
-
},
|
|
60
|
-
slot: "content"
|
|
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", {
|
|
47
|
+
}, [_vm.showTip ? _c("el-tooltip", {
|
|
62
48
|
attrs: {
|
|
63
49
|
"content": _vm.source[_vm.label],
|
|
64
50
|
"open-delay": 1e3,
|
|
65
51
|
"effect": "dark",
|
|
66
52
|
"placement": "left"
|
|
67
53
|
}
|
|
68
|
-
}, [_c("
|
|
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);
|
|
54
|
+
}, [_c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])]) : _c("span", [_vm._v(_vm._s(_vm.source[_vm.label]))])], 1);
|
|
77
55
|
};
|
|
78
56
|
var _sfc_staticRenderFns$1 = [];
|
|
79
57
|
var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
@@ -85,6 +63,9 @@ const _sfc_main = {
|
|
|
85
63
|
},
|
|
86
64
|
inheritAttrs: false,
|
|
87
65
|
props: {
|
|
66
|
+
/**
|
|
67
|
+
* 虚拟滚动属性
|
|
68
|
+
*/
|
|
88
69
|
offset: {
|
|
89
70
|
type: Number,
|
|
90
71
|
default: 0
|
|
@@ -162,7 +143,7 @@ const _sfc_main = {
|
|
|
162
143
|
},
|
|
163
144
|
footerTag: {
|
|
164
145
|
type: String,
|
|
165
|
-
default: "
|
|
146
|
+
default: "span"
|
|
166
147
|
},
|
|
167
148
|
footerClass: {
|
|
168
149
|
type: String,
|
|
@@ -178,32 +159,48 @@ const _sfc_main = {
|
|
|
178
159
|
type: Number,
|
|
179
160
|
default: 30
|
|
180
161
|
},
|
|
181
|
-
|
|
182
|
-
* 每个项目的估计大小,如果它更接近平均大小,滚动条长度看起来更准确。建议指定自己计算的平均值。
|
|
183
|
-
*/
|
|
162
|
+
// 每个项目的估计大小,如果它更接近平均大小,滚动条长度看起来更准确。建议指定自己计算的平均值。
|
|
184
163
|
estimateSize: {
|
|
185
164
|
type: Number,
|
|
186
165
|
default: 50
|
|
187
166
|
},
|
|
167
|
+
extraProps: {
|
|
168
|
+
type: Object,
|
|
169
|
+
default: () => ({
|
|
170
|
+
label: "label",
|
|
171
|
+
value: "value"
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
dataComponent: {
|
|
175
|
+
type: Object
|
|
176
|
+
},
|
|
177
|
+
dataKey: {
|
|
178
|
+
type: [String, Function],
|
|
179
|
+
default: "templateId"
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* 选中值
|
|
183
|
+
*/
|
|
188
184
|
value: {
|
|
189
185
|
type: [String, Number, Array],
|
|
190
186
|
default: () => {
|
|
191
187
|
return "";
|
|
192
188
|
}
|
|
193
189
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
/**
|
|
191
|
+
* 开启tooltip
|
|
192
|
+
*/
|
|
193
|
+
showTip: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: false
|
|
197
196
|
},
|
|
198
|
-
|
|
197
|
+
/**
|
|
198
|
+
* keyValue别名
|
|
199
|
+
*/
|
|
199
200
|
keyValue: {
|
|
200
201
|
type: Array,
|
|
201
202
|
default: () => ["label", "value"]
|
|
202
203
|
},
|
|
203
|
-
placeholder: {
|
|
204
|
-
type: String,
|
|
205
|
-
default: "请选择"
|
|
206
|
-
},
|
|
207
204
|
itemOptions: {
|
|
208
205
|
type: Object,
|
|
209
206
|
default() {
|
|
@@ -221,9 +218,9 @@ const _sfc_main = {
|
|
|
221
218
|
type: Array,
|
|
222
219
|
default: () => []
|
|
223
220
|
},
|
|
224
|
-
|
|
225
|
-
type:
|
|
226
|
-
default:
|
|
221
|
+
placeholder: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: "请选择"
|
|
227
224
|
},
|
|
228
225
|
multiple: {
|
|
229
226
|
type: Boolean,
|
|
@@ -236,24 +233,6 @@ const _sfc_main = {
|
|
|
236
233
|
height: {
|
|
237
234
|
type: String,
|
|
238
235
|
default: "245px"
|
|
239
|
-
},
|
|
240
|
-
isFitWidth: {
|
|
241
|
-
type: Boolean,
|
|
242
|
-
default: true
|
|
243
|
-
},
|
|
244
|
-
dataComponent: {
|
|
245
|
-
type: Object
|
|
246
|
-
},
|
|
247
|
-
extraProps: {
|
|
248
|
-
type: Object,
|
|
249
|
-
default: () => ({
|
|
250
|
-
label: "label",
|
|
251
|
-
value: "value"
|
|
252
|
-
})
|
|
253
|
-
},
|
|
254
|
-
dataKey: {
|
|
255
|
-
type: [String, Function],
|
|
256
|
-
default: "templateId"
|
|
257
236
|
}
|
|
258
237
|
},
|
|
259
238
|
data() {
|
|
@@ -271,11 +250,6 @@ const _sfc_main = {
|
|
|
271
250
|
default() {
|
|
272
251
|
return {};
|
|
273
252
|
}
|
|
274
|
-
},
|
|
275
|
-
showTip: {
|
|
276
|
-
// 提示
|
|
277
|
-
type: Boolean,
|
|
278
|
-
default: true
|
|
279
253
|
}
|
|
280
254
|
},
|
|
281
255
|
render(h) {
|
|
@@ -283,7 +257,7 @@ const _sfc_main = {
|
|
|
283
257
|
attrs: {
|
|
284
258
|
label: that.keyValue[0],
|
|
285
259
|
value: that.keyValue[1],
|
|
286
|
-
showTip:
|
|
260
|
+
showTip: that.showTip,
|
|
287
261
|
source: this.source,
|
|
288
262
|
index: this.index
|
|
289
263
|
}
|
|
@@ -302,18 +276,16 @@ const _sfc_main = {
|
|
|
302
276
|
},
|
|
303
277
|
set(v) {
|
|
304
278
|
this.$emit("input", v);
|
|
279
|
+
this.$emit("change", v);
|
|
280
|
+
this.$emit("update:value", v);
|
|
305
281
|
}
|
|
306
282
|
},
|
|
307
|
-
isSelect() {
|
|
308
|
-
return Object.prototype.hasOwnProperty.call(this.itemOptions, "virtualList") && !this.itemOptions.virtualList || !this.virtualList;
|
|
309
|
-
},
|
|
310
283
|
isVirtualSelect() {
|
|
311
284
|
return this.virtualList || this.itemOptions.virtualList;
|
|
312
285
|
},
|
|
313
286
|
// 绑定属性
|
|
314
287
|
bindProps() {
|
|
315
288
|
let obj = {
|
|
316
|
-
size: this.size,
|
|
317
289
|
clearable: true,
|
|
318
290
|
...this.$attrs,
|
|
319
291
|
...this.formatItemOptions
|
|
@@ -343,13 +315,10 @@ const _sfc_main = {
|
|
|
343
315
|
formatItemOptions() {
|
|
344
316
|
const that = this;
|
|
345
317
|
return {
|
|
346
|
-
size: this.size,
|
|
347
318
|
...this.itemOptions,
|
|
348
319
|
...this.$attrs,
|
|
349
|
-
element: "el-select",
|
|
350
320
|
virtualList: this.itemOptions.virtualList || this.virtualList,
|
|
351
321
|
placeholder: this.itemOptions.placeholder || this.placeholder,
|
|
352
|
-
filterable: this.itemOptions.filterable || this.filterable,
|
|
353
322
|
multiple: this.itemOptions.multiple || this.multiple,
|
|
354
323
|
options: this.optionsList,
|
|
355
324
|
events: {
|
|
@@ -368,9 +337,6 @@ const _sfc_main = {
|
|
|
368
337
|
} else {
|
|
369
338
|
return [];
|
|
370
339
|
}
|
|
371
|
-
},
|
|
372
|
-
maxLimitElWidth() {
|
|
373
|
-
return this.isFitWidth ? this.width : null;
|
|
374
340
|
}
|
|
375
341
|
},
|
|
376
342
|
watch: {
|
|
@@ -452,6 +418,8 @@ const _sfc_main = {
|
|
|
452
418
|
this.itemOptions.events.change(event, this);
|
|
453
419
|
} else {
|
|
454
420
|
this.$emit("change", event);
|
|
421
|
+
this.$emit("input", event);
|
|
422
|
+
this.$emit("update:value", event);
|
|
455
423
|
}
|
|
456
424
|
},
|
|
457
425
|
init() {
|
|
@@ -486,7 +454,11 @@ const _sfc_main = {
|
|
|
486
454
|
});
|
|
487
455
|
},
|
|
488
456
|
// 搜索
|
|
489
|
-
filterMethod(query) {
|
|
457
|
+
async filterMethod(query) {
|
|
458
|
+
const filterHandler = this.bindProps["filter-method"];
|
|
459
|
+
if (filterHandler) {
|
|
460
|
+
await filterHandler(query);
|
|
461
|
+
}
|
|
490
462
|
if (query !== "") {
|
|
491
463
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
492
464
|
let timer = setTimeout(() => {
|
|
@@ -526,6 +498,7 @@ const _sfc_main = {
|
|
|
526
498
|
this.reset();
|
|
527
499
|
this.init();
|
|
528
500
|
}
|
|
501
|
+
this.$emit("visible-change", bool);
|
|
529
502
|
}
|
|
530
503
|
},
|
|
531
504
|
beforeDestroy() {
|
|
@@ -544,18 +517,17 @@ var _sfc_render = function render2() {
|
|
|
544
517
|
var _vm = this, _c = _vm._self._c;
|
|
545
518
|
return _c("div", {
|
|
546
519
|
staticClass: "nf-virtual-select"
|
|
547
|
-
}, [_vm.isVirtualSelect ?
|
|
548
|
-
|
|
549
|
-
|
|
520
|
+
}, [_vm.isVirtualSelect ? _c("el-select", _vm._g(_vm._b({
|
|
521
|
+
ref: "nfVirtualSelect",
|
|
522
|
+
staticClass: "nf-virtual-select-el-select",
|
|
550
523
|
attrs: {
|
|
551
|
-
"popper-class": "nf-virtual-list-
|
|
552
|
-
"
|
|
553
|
-
"filter-method": _vm.filterMethod
|
|
554
|
-
"filterable": ""
|
|
524
|
+
"popper-class": "nf-virtual-select-virtual-list-popper",
|
|
525
|
+
"filterable": "",
|
|
526
|
+
"filter-method": _vm.filterMethod
|
|
555
527
|
},
|
|
556
528
|
on: {
|
|
557
|
-
"
|
|
558
|
-
"change": _vm.
|
|
529
|
+
"change": _vm.handleChange,
|
|
530
|
+
"visible-change": _vm.visibleChange
|
|
559
531
|
},
|
|
560
532
|
model: {
|
|
561
533
|
value: _vm.currentVal,
|
|
@@ -564,10 +536,14 @@ var _sfc_render = function render2() {
|
|
|
564
536
|
},
|
|
565
537
|
expression: "currentVal"
|
|
566
538
|
}
|
|
567
|
-
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [
|
|
539
|
+
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [_vm._t("prefix", null, {
|
|
540
|
+
"slot": "prefix"
|
|
541
|
+
}), _vm._t("empty", null, {
|
|
542
|
+
"slot": "empty"
|
|
543
|
+
}), _c("virtual-list", {
|
|
568
544
|
ref: "virtualSelectList",
|
|
569
545
|
staticClass: "nf-virtual-select-list",
|
|
570
|
-
style: `max-height: ${_vm.height};width: ${_vm.
|
|
546
|
+
style: `max-height: ${_vm.height};min-width: ${_vm.width}; overflow-y: auto;`,
|
|
571
547
|
attrs: {
|
|
572
548
|
"offset": _vm.offset,
|
|
573
549
|
"start": _vm.start,
|
|
@@ -589,12 +565,12 @@ var _sfc_render = function render2() {
|
|
|
589
565
|
"footer-tag": _vm.footerTag,
|
|
590
566
|
"footer-class": _vm.footerClass,
|
|
591
567
|
"footer-style": _vm.footerStyle,
|
|
568
|
+
"extra-props": _vm.extraProps,
|
|
569
|
+
"data-component": _vm.itemComponent,
|
|
570
|
+
"data-sources": _vm.selectArr,
|
|
592
571
|
"data-key": _vm.dataKey,
|
|
593
572
|
"estimate-size": _vm.estimateSize,
|
|
594
|
-
"
|
|
595
|
-
"data-component": _vm.itemComponent,
|
|
596
|
-
"keeps": _vm.keeps,
|
|
597
|
-
"extra-props": _vm.extraProps
|
|
573
|
+
"keeps": _vm.keeps
|
|
598
574
|
},
|
|
599
575
|
on: {
|
|
600
576
|
"scroll": _vm.scroll,
|
|
@@ -602,10 +578,15 @@ var _sfc_render = function render2() {
|
|
|
602
578
|
"tobottom": _vm.tobottom,
|
|
603
579
|
"resized": _vm.resized
|
|
604
580
|
}
|
|
605
|
-
}
|
|
606
|
-
|
|
581
|
+
}, [_vm._t("footer", null, {
|
|
582
|
+
"slot": "footer"
|
|
583
|
+
}), _vm._t("header", null, {
|
|
584
|
+
"slot": "header"
|
|
585
|
+
})], 2), _vm._t("default")], 2) : _c("el-select", _vm._g(_vm._b({
|
|
586
|
+
ref: "nfVirtualSelect",
|
|
587
|
+
staticClass: "nf-virtual-select-el-select",
|
|
607
588
|
attrs: {
|
|
608
|
-
"popper-class": "select-popper"
|
|
589
|
+
"popper-class": "nf-virtual-select-el-select-popper"
|
|
609
590
|
},
|
|
610
591
|
on: {
|
|
611
592
|
"change": _vm.handleChange
|
|
@@ -617,7 +598,11 @@ var _sfc_render = function render2() {
|
|
|
617
598
|
},
|
|
618
599
|
expression: "currentVal"
|
|
619
600
|
}
|
|
620
|
-
}, "el-select", _vm.bindProps, false), _vm.bindEvents), _vm.
|
|
601
|
+
}, "el-select", _vm.bindProps, false), _vm.bindEvents), [_vm._t("prefix", null, {
|
|
602
|
+
"slot": "prefix"
|
|
603
|
+
}), _vm._t("empty", null, {
|
|
604
|
+
"slot": "empty"
|
|
605
|
+
}), _vm._t("header"), _vm._l(_vm.selectArr, function(item, index) {
|
|
621
606
|
return _c("el-option", {
|
|
622
607
|
key: item[_vm.keyValue[0]] + "_" + index,
|
|
623
608
|
attrs: {
|
|
@@ -625,15 +610,15 @@ var _sfc_render = function render2() {
|
|
|
625
610
|
"value": item[_vm.keyValue[1]],
|
|
626
611
|
"disabled": item.disabled
|
|
627
612
|
}
|
|
628
|
-
}, [_c("el-tooltip", {
|
|
613
|
+
}, [_vm.showTip ? _c("el-tooltip", {
|
|
629
614
|
attrs: {
|
|
630
615
|
"content": item[_vm.keyValue[0]],
|
|
631
616
|
"open-delay": 1e3,
|
|
632
617
|
"effect": "dark",
|
|
633
618
|
"placement": "left"
|
|
634
619
|
}
|
|
635
|
-
}, [_c("span", [_vm._v(_vm._s(item[_vm.keyValue[0]]))])])], 1);
|
|
636
|
-
}),
|
|
620
|
+
}, [_c("span", [_vm._v(_vm._s(item[_vm.keyValue[0]]))])]) : _c("span", [_vm._v(" " + _vm._s(item[_vm.keyValue[0]]) + " ")])], 1);
|
|
621
|
+
}), _vm._t("default"), _vm._t("footer")], 2)], 1);
|
|
637
622
|
};
|
|
638
623
|
var _sfc_staticRenderFns = [];
|
|
639
624
|
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|