@94ai/nf-virtual-select
Advanced tools
Comparing version 3.2.68 to 3.2.69
@@ -458,33 +458,27 @@ "use strict"; | ||
const filterHandler = this.bindProps["filter-method"]; | ||
let interrupt = false; | ||
if (filterHandler) { | ||
interrupt = await filterHandler(query); | ||
if (!interrupt) { | ||
this.refresh = Date.now(); | ||
} | ||
} | ||
if (interrupt) { | ||
return; | ||
} | ||
if (query !== "") { | ||
this.$refs.virtualSelectList.scrollToIndex(0); | ||
let timer = setTimeout(() => { | ||
let timer = setTimeout(async () => { | ||
var _a, _b, _c; | ||
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 : []; | ||
const selectArr = arr.filter((item) => { | ||
if (item[this.keyValue[0]]) { | ||
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1; | ||
} | ||
}); | ||
this.selectArr = (selectArr || []).map((it) => { | ||
return { | ||
[this.keyValue[0]]: it[this.keyValue[0]], | ||
[this.keyValue[1]]: it[this.keyValue[1]], | ||
[this.dataKey]: it[this.keyValue[1]], | ||
disabled: it["disabled"] ? it["disabled"] : false, | ||
slotContent: (it == null ? void 0 : it.slotContent) || {} | ||
}; | ||
}); | ||
clearTimeout(timer); | ||
timer = null; | ||
if (filterHandler) { | ||
await filterHandler(query); | ||
} else { | ||
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 : []; | ||
const selectArr = arr.filter((item) => { | ||
if (item[this.keyValue[0]]) { | ||
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1; | ||
} | ||
}); | ||
this.selectArr = (selectArr || []).map((it) => { | ||
return { | ||
[this.keyValue[0]]: it[this.keyValue[0]], | ||
[this.keyValue[1]]: it[this.keyValue[1]], | ||
[this.dataKey]: it[this.keyValue[1]], | ||
disabled: it["disabled"] ? it["disabled"] : false, | ||
slotContent: (it == null ? void 0 : it.slotContent) || {} | ||
}; | ||
}); | ||
} | ||
}, 100); | ||
@@ -499,2 +493,4 @@ this.$once("hook:beforeDestroy", () => { | ||
}); | ||
} else if (filterHandler) { | ||
await filterHandler(query); | ||
} else { | ||
@@ -501,0 +497,0 @@ this.init(); |
@@ -456,33 +456,27 @@ import virtualList from "vue-virtual-scroll-list"; | ||
const filterHandler = this.bindProps["filter-method"]; | ||
let interrupt = false; | ||
if (filterHandler) { | ||
interrupt = await filterHandler(query); | ||
if (!interrupt) { | ||
this.refresh = Date.now(); | ||
} | ||
} | ||
if (interrupt) { | ||
return; | ||
} | ||
if (query !== "") { | ||
this.$refs.virtualSelectList.scrollToIndex(0); | ||
let timer = setTimeout(() => { | ||
let timer = setTimeout(async () => { | ||
var _a, _b, _c; | ||
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 : []; | ||
const selectArr = arr.filter((item) => { | ||
if (item[this.keyValue[0]]) { | ||
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1; | ||
} | ||
}); | ||
this.selectArr = (selectArr || []).map((it) => { | ||
return { | ||
[this.keyValue[0]]: it[this.keyValue[0]], | ||
[this.keyValue[1]]: it[this.keyValue[1]], | ||
[this.dataKey]: it[this.keyValue[1]], | ||
disabled: it["disabled"] ? it["disabled"] : false, | ||
slotContent: (it == null ? void 0 : it.slotContent) || {} | ||
}; | ||
}); | ||
clearTimeout(timer); | ||
timer = null; | ||
if (filterHandler) { | ||
await filterHandler(query); | ||
} else { | ||
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 : []; | ||
const selectArr = arr.filter((item) => { | ||
if (item[this.keyValue[0]]) { | ||
return item[this.keyValue[0]].toLowerCase().indexOf(query.toLowerCase()) > -1; | ||
} | ||
}); | ||
this.selectArr = (selectArr || []).map((it) => { | ||
return { | ||
[this.keyValue[0]]: it[this.keyValue[0]], | ||
[this.keyValue[1]]: it[this.keyValue[1]], | ||
[this.dataKey]: it[this.keyValue[1]], | ||
disabled: it["disabled"] ? it["disabled"] : false, | ||
slotContent: (it == null ? void 0 : it.slotContent) || {} | ||
}; | ||
}); | ||
} | ||
}, 100); | ||
@@ -497,2 +491,4 @@ this.$once("hook:beforeDestroy", () => { | ||
}); | ||
} else if (filterHandler) { | ||
await filterHandler(query); | ||
} else { | ||
@@ -499,0 +495,0 @@ this.init(); |
{ | ||
"name": "@94ai/nf-virtual-select", | ||
"version": "3.2.68", | ||
"version": "3.2.69", | ||
"description": "> TODO: description", | ||
@@ -17,4 +17,4 @@ "keywords": [], | ||
"dependencies": { | ||
"@94ai/common-utils": "^3.2.68", | ||
"@94ai/nf-theme-chalk": "^3.2.68", | ||
"@94ai/common-utils": "^3.2.69", | ||
"@94ai/nf-theme-chalk": "^3.2.69", | ||
"lodash-es": "^4.17.21", | ||
@@ -21,0 +21,0 @@ "vue-demi": "^0.14.5", |
Sorry, the diff of this file is not supported yet
84179
2719
Updated@94ai/common-utils@^3.2.69
Updated@94ai/nf-theme-chalk@^3.2.69