@94ai/nf-virtual-select 3.2.75 → 3.2.76
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.
|
@@ -3,6 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const virtualList = require("vue-virtual-scroll-list");
|
|
4
4
|
const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
|
|
5
5
|
const lodashEs = require("lodash-es");
|
|
6
|
+
const vueDemi = require("vue-demi");
|
|
6
7
|
const _sfc_main$1 = {
|
|
7
8
|
name: "ItemComponent",
|
|
8
9
|
props: {
|
|
@@ -457,41 +458,37 @@ const _sfc_main = {
|
|
|
457
458
|
},
|
|
458
459
|
// 搜索
|
|
459
460
|
async filterMethod(query) {
|
|
461
|
+
var _a, _b, _c;
|
|
460
462
|
const filterHandler = this.bindProps["filter-method"];
|
|
461
463
|
if (query !== "") {
|
|
462
464
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
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
|
-
}
|
|
486
|
-
}, 100);
|
|
487
|
-
this.$once("hook:beforeDestroy", () => {
|
|
488
|
-
clearTimeout(timer);
|
|
489
|
-
timer = null;
|
|
490
|
-
});
|
|
491
|
-
this.$once("hook:deactivated", () => {
|
|
492
|
-
clearTimeout(timer);
|
|
493
|
-
timer = null;
|
|
465
|
+
await vueDemi.nextTick();
|
|
466
|
+
await new Promise((resolve) => {
|
|
467
|
+
let timer = setTimeout(() => {
|
|
468
|
+
clearTimeout(timer);
|
|
469
|
+
timer = void 0;
|
|
470
|
+
resolve(true);
|
|
471
|
+
}, 30);
|
|
494
472
|
});
|
|
473
|
+
if (filterHandler) {
|
|
474
|
+
await filterHandler(query);
|
|
475
|
+
} else {
|
|
476
|
+
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 : [];
|
|
477
|
+
const selectArr = arr.filter((item) => {
|
|
478
|
+
if (item[this.keyValue[0]]) {
|
|
479
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
this.selectArr = (selectArr || []).map((it) => {
|
|
483
|
+
return {
|
|
484
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
485
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
486
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
487
|
+
disabled: it["disabled"] ? it["disabled"] : false,
|
|
488
|
+
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
489
|
+
};
|
|
490
|
+
});
|
|
491
|
+
}
|
|
495
492
|
} else if (filterHandler) {
|
|
496
493
|
await filterHandler(query);
|
|
497
494
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import virtualList from "vue-virtual-scroll-list";
|
|
2
2
|
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
3
|
import { isEqual } from "lodash-es";
|
|
4
|
+
import { nextTick } from "vue-demi";
|
|
4
5
|
const _sfc_main$1 = {
|
|
5
6
|
name: "ItemComponent",
|
|
6
7
|
props: {
|
|
@@ -455,41 +456,37 @@ const _sfc_main = {
|
|
|
455
456
|
},
|
|
456
457
|
// 搜索
|
|
457
458
|
async filterMethod(query) {
|
|
459
|
+
var _a, _b, _c;
|
|
458
460
|
const filterHandler = this.bindProps["filter-method"];
|
|
459
461
|
if (query !== "") {
|
|
460
462
|
this.$refs.virtualSelectList.scrollToIndex(0);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
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 : [];
|
|
469
|
-
const selectArr = arr.filter((item) => {
|
|
470
|
-
if (item[this.keyValue[0]]) {
|
|
471
|
-
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
this.selectArr = (selectArr || []).map((it) => {
|
|
475
|
-
return {
|
|
476
|
-
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
477
|
-
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
478
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
479
|
-
disabled: it["disabled"] ? it["disabled"] : false,
|
|
480
|
-
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
481
|
-
};
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
}, 100);
|
|
485
|
-
this.$once("hook:beforeDestroy", () => {
|
|
486
|
-
clearTimeout(timer);
|
|
487
|
-
timer = null;
|
|
488
|
-
});
|
|
489
|
-
this.$once("hook:deactivated", () => {
|
|
490
|
-
clearTimeout(timer);
|
|
491
|
-
timer = null;
|
|
463
|
+
await nextTick();
|
|
464
|
+
await new Promise((resolve) => {
|
|
465
|
+
let timer = setTimeout(() => {
|
|
466
|
+
clearTimeout(timer);
|
|
467
|
+
timer = void 0;
|
|
468
|
+
resolve(true);
|
|
469
|
+
}, 30);
|
|
492
470
|
});
|
|
471
|
+
if (filterHandler) {
|
|
472
|
+
await filterHandler(query);
|
|
473
|
+
} else {
|
|
474
|
+
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 : [];
|
|
475
|
+
const selectArr = arr.filter((item) => {
|
|
476
|
+
if (item[this.keyValue[0]]) {
|
|
477
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
this.selectArr = (selectArr || []).map((it) => {
|
|
481
|
+
return {
|
|
482
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
483
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
484
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
485
|
+
disabled: it["disabled"] ? it["disabled"] : false,
|
|
486
|
+
slotContent: (it == null ? void 0 : it.slotContent) || {}
|
|
487
|
+
};
|
|
488
|
+
});
|
|
489
|
+
}
|
|
493
490
|
} else if (filterHandler) {
|
|
494
491
|
await filterHandler(query);
|
|
495
492
|
} else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
1
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
2
2
|
offset: {
|
|
3
3
|
type: NumberConstructor;
|
|
4
4
|
default: number;
|
|
@@ -160,7 +160,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
160
160
|
bindEvents(): any;
|
|
161
161
|
formatItemOptions(): any;
|
|
162
162
|
optionsList(): any;
|
|
163
|
-
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
|
|
163
|
+
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
164
164
|
offset: {
|
|
165
165
|
type: NumberConstructor;
|
|
166
166
|
default: number;
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
import virtualList from 'vue-virtual-scroll-list'
|
|
95
95
|
import ElOptionNode from './el-option-node.vue'
|
|
96
96
|
import { isEqual } from 'lodash-es'
|
|
97
|
+
import { nextTick } from 'vue-demi'
|
|
97
98
|
export default {
|
|
98
99
|
name: 'nf-virtual-select',
|
|
99
100
|
components: { 'virtual-list': virtualList },
|
|
@@ -494,37 +495,33 @@ export default {
|
|
|
494
495
|
const filterHandler = this.bindProps['filter-method']
|
|
495
496
|
if (query !== '') {
|
|
496
497
|
this.$refs.virtualSelectList.scrollToIndex(0)// 滚动到顶部
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
timer =
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const selectArr = arr.filter(item => {
|
|
505
|
-
if (item[this.keyValue[0]]) {
|
|
506
|
-
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
507
|
-
}
|
|
508
|
-
})
|
|
509
|
-
this.selectArr = (selectArr || []).map(it => {
|
|
510
|
-
return {
|
|
511
|
-
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
512
|
-
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
513
|
-
[this.dataKey]: it[this.keyValue[1]],
|
|
514
|
-
disabled: it['disabled'] ? it['disabled'] : false,
|
|
515
|
-
slotContent: it?.slotContent || {}
|
|
516
|
-
}
|
|
517
|
-
})
|
|
518
|
-
}
|
|
519
|
-
}, 100)
|
|
520
|
-
this.$once('hook:beforeDestroy', () => {
|
|
521
|
-
clearTimeout(timer)
|
|
522
|
-
timer = null
|
|
523
|
-
})
|
|
524
|
-
this.$once('hook:deactivated', () => {
|
|
525
|
-
clearTimeout(timer)
|
|
526
|
-
timer = null
|
|
498
|
+
await nextTick()
|
|
499
|
+
await new Promise((resolve) => {
|
|
500
|
+
let timer = setTimeout(() => {
|
|
501
|
+
clearTimeout(timer)
|
|
502
|
+
timer = undefined
|
|
503
|
+
resolve(true)
|
|
504
|
+
}, 30)
|
|
527
505
|
})
|
|
506
|
+
if (filterHandler) {
|
|
507
|
+
await filterHandler(query)
|
|
508
|
+
} else {
|
|
509
|
+
const arr = this.itemOptions?.options?.length ? this.itemOptions.options : this.options?.length ? this.options : []
|
|
510
|
+
const selectArr = arr.filter(item => {
|
|
511
|
+
if (item[this.keyValue[0]]) {
|
|
512
|
+
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
this.selectArr = (selectArr || []).map(it => {
|
|
516
|
+
return {
|
|
517
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
518
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
519
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
520
|
+
disabled: it['disabled'] ? it['disabled'] : false,
|
|
521
|
+
slotContent: it?.slotContent || {}
|
|
522
|
+
}
|
|
523
|
+
})
|
|
524
|
+
}
|
|
528
525
|
} else if (filterHandler) {
|
|
529
526
|
await filterHandler(query)
|
|
530
527
|
} else {
|
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.76",
|
|
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.76",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^3.2.76",
|
|
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": "07f6d8aca65e93849c2f70cf0b83fdf2ae2cc0f1"
|
|
37
37
|
}
|