@94ai/nf-virtual-select 3.2.67 → 3.2.69
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.
|
@@ -455,37 +455,31 @@ const _sfc_main = {
|
|
|
455
455
|
// 搜索
|
|
456
456
|
async filterMethod(query) {
|
|
457
457
|
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
458
|
if (query !== "") {
|
|
469
459
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
470
|
-
let timer = setTimeout(() => {
|
|
460
|
+
let timer = setTimeout(async () => {
|
|
471
461
|
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
462
|
clearTimeout(timer);
|
|
488
463
|
timer = null;
|
|
464
|
+
if (filterHandler) {
|
|
465
|
+
await filterHandler(query);
|
|
466
|
+
} else {
|
|
467
|
+
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 : [];
|
|
468
|
+
const selectArr = arr.filter((item) => {
|
|
469
|
+
if (item[this.keyValue[0]]) {
|
|
470
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
this.selectArr = (selectArr || []).map((it) => {
|
|
474
|
+
return {
|
|
475
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
476
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
477
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
478
|
+
disabled: it["disabled"] ? it["disabled"] : false,
|
|
479
|
+
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
480
|
+
};
|
|
481
|
+
});
|
|
482
|
+
}
|
|
489
483
|
}, 100);
|
|
490
484
|
this.$once("hook:beforeDestroy", () => {
|
|
491
485
|
clearTimeout(timer);
|
|
@@ -495,6 +489,8 @@ const _sfc_main = {
|
|
|
495
489
|
clearTimeout(timer);
|
|
496
490
|
timer = null;
|
|
497
491
|
});
|
|
492
|
+
} else if (filterHandler) {
|
|
493
|
+
await filterHandler(query);
|
|
498
494
|
} else {
|
|
499
495
|
this.init();
|
|
500
496
|
}
|
|
@@ -453,37 +453,31 @@ const _sfc_main = {
|
|
|
453
453
|
// 搜索
|
|
454
454
|
async filterMethod(query) {
|
|
455
455
|
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
456
|
if (query !== "") {
|
|
467
457
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
468
|
-
let timer = setTimeout(() => {
|
|
458
|
+
let timer = setTimeout(async () => {
|
|
469
459
|
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
460
|
clearTimeout(timer);
|
|
486
461
|
timer = null;
|
|
462
|
+
if (filterHandler) {
|
|
463
|
+
await filterHandler(query);
|
|
464
|
+
} else {
|
|
465
|
+
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 : [];
|
|
466
|
+
const selectArr = arr.filter((item) => {
|
|
467
|
+
if (item[this.keyValue[0]]) {
|
|
468
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
this.selectArr = (selectArr || []).map((it) => {
|
|
472
|
+
return {
|
|
473
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
474
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
475
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
476
|
+
disabled: it["disabled"] ? it["disabled"] : false,
|
|
477
|
+
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
478
|
+
};
|
|
479
|
+
});
|
|
480
|
+
}
|
|
487
481
|
}, 100);
|
|
488
482
|
this.$once("hook:beforeDestroy", () => {
|
|
489
483
|
clearTimeout(timer);
|
|
@@ -493,6 +487,8 @@ const _sfc_main = {
|
|
|
493
487
|
clearTimeout(timer);
|
|
494
488
|
timer = null;
|
|
495
489
|
});
|
|
490
|
+
} else if (filterHandler) {
|
|
491
|
+
await filterHandler(query);
|
|
496
492
|
} else {
|
|
497
493
|
this.init();
|
|
498
494
|
}
|
|
@@ -456,71 +456,65 @@ export default {
|
|
|
456
456
|
this.$nextTick(() => {
|
|
457
457
|
if ((this.isVirtualSelect)) {
|
|
458
458
|
// 虚拟
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
459
|
+
// 无回显值
|
|
460
|
+
this.selectArr = this.optionsList?.map(it => ({
|
|
461
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
462
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
463
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
464
|
+
disabled: it['disabled'] ?? false
|
|
465
|
+
})) ?? [];
|
|
466
|
+
if (this.currentVal) {
|
|
467
|
+
// 有回显值
|
|
468
|
+
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
469
|
+
// 多选
|
|
470
|
+
const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
|
|
471
|
+
this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))];
|
|
472
|
+
} else {
|
|
473
|
+
// 单选
|
|
474
|
+
const index = this.selectArr.findIndex(item => item.value === this.currentVal);
|
|
475
|
+
if (index !== -1) {
|
|
476
|
+
const obj = this.selectArr.splice(index, 1)[0];
|
|
477
|
+
this.selectArr.unshift(obj);
|
|
479
478
|
}
|
|
480
479
|
}
|
|
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
480
|
}
|
|
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
|
+
}
|
|
489
489
|
})
|
|
490
490
|
},
|
|
491
491
|
// 搜索
|
|
492
492
|
async filterMethod(query) {
|
|
493
493
|
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
494
|
if (query !== '') {
|
|
505
495
|
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
|
-
})
|
|
496
|
+
let timer = setTimeout(async () => {
|
|
522
497
|
clearTimeout(timer)
|
|
523
498
|
timer = null
|
|
499
|
+
if (filterHandler) {
|
|
500
|
+
await filterHandler(query)
|
|
501
|
+
} else {
|
|
502
|
+
const arr = this.itemOptions?.options?.length ? this.itemOptions.options : this.options?.length ? this.options : []
|
|
503
|
+
const selectArr = arr.filter(item => {
|
|
504
|
+
if (item[this.keyValue[0]]) {
|
|
505
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
506
|
+
}
|
|
507
|
+
})
|
|
508
|
+
this.selectArr = (selectArr || []).map(it => {
|
|
509
|
+
return {
|
|
510
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
511
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
512
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
513
|
+
disabled: it['disabled'] ? it['disabled'] : false,
|
|
514
|
+
slotContent: it?.slotContent || {}
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
}
|
|
524
518
|
}, 100)
|
|
525
519
|
this.$once('hook:beforeDestroy', () => {
|
|
526
520
|
clearTimeout(timer)
|
|
@@ -530,6 +524,8 @@ export default {
|
|
|
530
524
|
clearTimeout(timer)
|
|
531
525
|
timer = null
|
|
532
526
|
})
|
|
527
|
+
} else if (filterHandler) {
|
|
528
|
+
await filterHandler(query)
|
|
533
529
|
} else {
|
|
534
530
|
this.init()
|
|
535
531
|
}
|
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.69",
|
|
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.69",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^3.2.69",
|
|
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": "5a0c98a10f4bc189c07b4e947ffedb4f9aa0c568"
|
|
37
37
|
}
|