@94ai/nf-virtual-select 3.2.68 → 3.2.70
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
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginObject } from 'vue-demi';
|
|
2
2
|
declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{
|
|
3
|
-
refresh: number;
|
|
4
3
|
itemComponent: any;
|
|
5
4
|
selectArr: never[];
|
|
6
5
|
}, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
@@ -486,7 +485,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
486
485
|
default: string;
|
|
487
486
|
};
|
|
488
487
|
}>>> & import("vue-demi").ShallowUnwrapRef<{}> & {
|
|
489
|
-
refresh: number;
|
|
490
488
|
itemComponent: any;
|
|
491
489
|
selectArr: never[];
|
|
492
490
|
} & import("vue/types/v3-component-options").ExtractComputedReturns<{
|
|
@@ -798,7 +796,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
798
796
|
default: string;
|
|
799
797
|
};
|
|
800
798
|
}>>, {}, {
|
|
801
|
-
refresh: number;
|
|
802
799
|
itemComponent: any;
|
|
803
800
|
selectArr: never[];
|
|
804
801
|
}, {
|
|
@@ -269,7 +269,6 @@ const _sfc_main = {
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
return {
|
|
272
|
-
refresh: Date.now(),
|
|
273
272
|
itemComponent: this.dataComponent ?? ElOption,
|
|
274
273
|
selectArr: []
|
|
275
274
|
};
|
|
@@ -455,37 +454,31 @@ const _sfc_main = {
|
|
|
455
454
|
// 搜索
|
|
456
455
|
async filterMethod(query) {
|
|
457
456
|
const filterHandler = this.bindProps["filter-method"];
|
|
458
|
-
let interrupt = false;
|
|
459
|
-
if (filterHandler) {
|
|
460
|
-
interrupt = await filterHandler(query);
|
|
461
|
-
if (!interrupt) {
|
|
462
|
-
this.refresh = Date.now();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
if (interrupt) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
457
|
if (query !== "") {
|
|
469
458
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
470
|
-
let timer = setTimeout(() => {
|
|
459
|
+
let timer = setTimeout(async () => {
|
|
471
460
|
var _a, _b, _c;
|
|
472
|
-
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 : [];
|
|
473
|
-
const selectArr = arr.filter((item) => {
|
|
474
|
-
if (item[this.keyValue[0]]) {
|
|
475
|
-
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
this.selectArr = (selectArr || []).map((it) => {
|
|
479
|
-
return {
|
|
480
|
-
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
481
|
-
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
482
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
483
|
-
disabled: it["disabled"] ? it["disabled"] : false,
|
|
484
|
-
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
485
|
-
};
|
|
486
|
-
});
|
|
487
461
|
clearTimeout(timer);
|
|
488
462
|
timer = null;
|
|
463
|
+
if (filterHandler) {
|
|
464
|
+
await filterHandler(query);
|
|
465
|
+
} else {
|
|
466
|
+
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 : [];
|
|
467
|
+
const selectArr = arr.filter((item) => {
|
|
468
|
+
if (item[this.keyValue[0]]) {
|
|
469
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
this.selectArr = (selectArr || []).map((it) => {
|
|
473
|
+
return {
|
|
474
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
475
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
476
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
477
|
+
disabled: it["disabled"] ? it["disabled"] : false,
|
|
478
|
+
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
479
|
+
};
|
|
480
|
+
});
|
|
481
|
+
}
|
|
489
482
|
}, 100);
|
|
490
483
|
this.$once("hook:beforeDestroy", () => {
|
|
491
484
|
clearTimeout(timer);
|
|
@@ -495,6 +488,8 @@ const _sfc_main = {
|
|
|
495
488
|
clearTimeout(timer);
|
|
496
489
|
timer = null;
|
|
497
490
|
});
|
|
491
|
+
} else if (filterHandler) {
|
|
492
|
+
await filterHandler(query);
|
|
498
493
|
} else {
|
|
499
494
|
this.init();
|
|
500
495
|
}
|
|
@@ -546,7 +541,6 @@ var _sfc_render = function render2() {
|
|
|
546
541
|
}), _vm._t("empty", null, {
|
|
547
542
|
"slot": "empty"
|
|
548
543
|
}), _c("virtual-list", {
|
|
549
|
-
key: _vm.refresh,
|
|
550
544
|
ref: "virtualSelectList",
|
|
551
545
|
staticClass: "nf-virtual-select-list",
|
|
552
546
|
style: `max-height: ${_vm.height};min-width: ${_vm.width};max-width: ${_vm.maxWidth};overflow-y: auto;`,
|
|
@@ -267,7 +267,6 @@ const _sfc_main = {
|
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
269
|
return {
|
|
270
|
-
refresh: Date.now(),
|
|
271
270
|
itemComponent: this.dataComponent ?? ElOption,
|
|
272
271
|
selectArr: []
|
|
273
272
|
};
|
|
@@ -453,37 +452,31 @@ const _sfc_main = {
|
|
|
453
452
|
// 搜索
|
|
454
453
|
async filterMethod(query) {
|
|
455
454
|
const filterHandler = this.bindProps["filter-method"];
|
|
456
|
-
let interrupt = false;
|
|
457
|
-
if (filterHandler) {
|
|
458
|
-
interrupt = await filterHandler(query);
|
|
459
|
-
if (!interrupt) {
|
|
460
|
-
this.refresh = Date.now();
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
if (interrupt) {
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
455
|
if (query !== "") {
|
|
467
456
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
468
|
-
let timer = setTimeout(() => {
|
|
457
|
+
let timer = setTimeout(async () => {
|
|
469
458
|
var _a, _b, _c;
|
|
470
|
-
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 : [];
|
|
471
|
-
const selectArr = arr.filter((item) => {
|
|
472
|
-
if (item[this.keyValue[0]]) {
|
|
473
|
-
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
this.selectArr = (selectArr || []).map((it) => {
|
|
477
|
-
return {
|
|
478
|
-
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
479
|
-
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
480
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
481
|
-
disabled: it["disabled"] ? it["disabled"] : false,
|
|
482
|
-
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
483
|
-
};
|
|
484
|
-
});
|
|
485
459
|
clearTimeout(timer);
|
|
486
460
|
timer = null;
|
|
461
|
+
if (filterHandler) {
|
|
462
|
+
await filterHandler(query);
|
|
463
|
+
} else {
|
|
464
|
+
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 : [];
|
|
465
|
+
const selectArr = arr.filter((item) => {
|
|
466
|
+
if (item[this.keyValue[0]]) {
|
|
467
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
this.selectArr = (selectArr || []).map((it) => {
|
|
471
|
+
return {
|
|
472
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
473
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
474
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
475
|
+
disabled: it["disabled"] ? it["disabled"] : false,
|
|
476
|
+
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
477
|
+
};
|
|
478
|
+
});
|
|
479
|
+
}
|
|
487
480
|
}, 100);
|
|
488
481
|
this.$once("hook:beforeDestroy", () => {
|
|
489
482
|
clearTimeout(timer);
|
|
@@ -493,6 +486,8 @@ const _sfc_main = {
|
|
|
493
486
|
clearTimeout(timer);
|
|
494
487
|
timer = null;
|
|
495
488
|
});
|
|
489
|
+
} else if (filterHandler) {
|
|
490
|
+
await filterHandler(query);
|
|
496
491
|
} else {
|
|
497
492
|
this.init();
|
|
498
493
|
}
|
|
@@ -544,7 +539,6 @@ var _sfc_render = function render2() {
|
|
|
544
539
|
}), _vm._t("empty", null, {
|
|
545
540
|
"slot": "empty"
|
|
546
541
|
}), _c("virtual-list", {
|
|
547
|
-
key: _vm.refresh,
|
|
548
542
|
ref: "virtualSelectList",
|
|
549
543
|
staticClass: "nf-virtual-select-list",
|
|
550
544
|
style: `max-height: ${_vm.height};min-width: ${_vm.width};max-width: ${_vm.maxWidth};overflow-y: auto;`,
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
<slot name="prefix" slot="prefix" />
|
|
16
16
|
<slot name="empty" slot="empty" />
|
|
17
17
|
<virtual-list
|
|
18
|
-
:key="refresh"
|
|
19
18
|
:offset="offset"
|
|
20
19
|
:start="start"
|
|
21
20
|
:page-mode="pageMode"
|
|
@@ -306,7 +305,6 @@ export default {
|
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
307
|
return {
|
|
309
|
-
refresh: Date.now(),
|
|
310
308
|
itemComponent: this.dataComponent ?? ElOption,
|
|
311
309
|
selectArr: []
|
|
312
310
|
}
|
|
@@ -456,71 +454,65 @@ export default {
|
|
|
456
454
|
this.$nextTick(() => {
|
|
457
455
|
if ((this.isVirtualSelect)) {
|
|
458
456
|
// 虚拟
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
457
|
+
// 无回显值
|
|
458
|
+
this.selectArr = this.optionsList?.map(it => ({
|
|
459
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
460
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
461
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
462
|
+
disabled: it['disabled'] ?? false
|
|
463
|
+
})) ?? [];
|
|
464
|
+
if (this.currentVal) {
|
|
465
|
+
// 有回显值
|
|
466
|
+
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
467
|
+
// 多选
|
|
468
|
+
const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
|
|
469
|
+
this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))];
|
|
470
|
+
} else {
|
|
471
|
+
// 单选
|
|
472
|
+
const index = this.selectArr.findIndex(item => item.value === this.currentVal);
|
|
473
|
+
if (index !== -1) {
|
|
474
|
+
const obj = this.selectArr.splice(index, 1)[0];
|
|
475
|
+
this.selectArr.unshift(obj);
|
|
479
476
|
}
|
|
480
477
|
}
|
|
481
|
-
} else {
|
|
482
|
-
// 非虚拟选择器
|
|
483
|
-
this.selectArr = (this.optionsList || []).map(it => ({
|
|
484
|
-
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
485
|
-
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
486
|
-
disabled: it['disabled'] ?? false
|
|
487
|
-
}))
|
|
488
478
|
}
|
|
479
|
+
} else {
|
|
480
|
+
// 非虚拟选择器
|
|
481
|
+
this.selectArr = (this.optionsList || []).map(it => ({
|
|
482
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
483
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
484
|
+
disabled: it['disabled'] ?? false
|
|
485
|
+
}))
|
|
486
|
+
}
|
|
489
487
|
})
|
|
490
488
|
},
|
|
491
489
|
// 搜索
|
|
492
490
|
async filterMethod(query) {
|
|
493
491
|
const filterHandler = this.bindProps['filter-method']
|
|
494
|
-
let interrupt = false
|
|
495
|
-
if (filterHandler) {
|
|
496
|
-
interrupt = await filterHandler(query)
|
|
497
|
-
if (!interrupt) {
|
|
498
|
-
this.refresh = Date.now()
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
if (interrupt) {
|
|
502
|
-
return
|
|
503
|
-
}
|
|
504
492
|
if (query !== '') {
|
|
505
493
|
this.$refs.virtualSelectList.scrollToIndex(0)// 滚动到顶部
|
|
506
|
-
let timer = setTimeout(() => {
|
|
507
|
-
const arr = this.itemOptions?.options?.length ? this.itemOptions.options : this.options?.length ? this.options : []
|
|
508
|
-
const selectArr = arr.filter(item => {
|
|
509
|
-
if (item[this.keyValue[0]]) {
|
|
510
|
-
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
511
|
-
}
|
|
512
|
-
})
|
|
513
|
-
this.selectArr = (selectArr || []).map(it => {
|
|
514
|
-
return {
|
|
515
|
-
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
516
|
-
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
517
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
518
|
-
disabled: it['disabled'] ? it['disabled'] : false,
|
|
519
|
-
slotContent: it?.slotContent || {}
|
|
520
|
-
}
|
|
521
|
-
})
|
|
494
|
+
let timer = setTimeout(async () => {
|
|
522
495
|
clearTimeout(timer)
|
|
523
496
|
timer = null
|
|
497
|
+
if (filterHandler) {
|
|
498
|
+
await filterHandler(query)
|
|
499
|
+
} else {
|
|
500
|
+
const arr = this.itemOptions?.options?.length ? this.itemOptions.options : this.options?.length ? this.options : []
|
|
501
|
+
const selectArr = arr.filter(item => {
|
|
502
|
+
if (item[this.keyValue[0]]) {
|
|
503
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
504
|
+
}
|
|
505
|
+
})
|
|
506
|
+
this.selectArr = (selectArr || []).map(it => {
|
|
507
|
+
return {
|
|
508
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
509
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
510
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
511
|
+
disabled: it['disabled'] ? it['disabled'] : false,
|
|
512
|
+
slotContent: it?.slotContent || {}
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
}
|
|
524
516
|
}, 100)
|
|
525
517
|
this.$once('hook:beforeDestroy', () => {
|
|
526
518
|
clearTimeout(timer)
|
|
@@ -530,6 +522,8 @@ export default {
|
|
|
530
522
|
clearTimeout(timer)
|
|
531
523
|
timer = null
|
|
532
524
|
})
|
|
525
|
+
} else if (filterHandler) {
|
|
526
|
+
await filterHandler(query)
|
|
533
527
|
} else {
|
|
534
528
|
this.init()
|
|
535
529
|
}
|
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.70",
|
|
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.70",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^3.2.70",
|
|
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": "8d34ebea758609976687c2585cea11a0ca01a7c8"
|
|
37
37
|
}
|