adminforth 2.4.0-next.290 → 2.4.0-next.291
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.
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<label v-if="!$slots.item" :for="item.value">{{ item.label }}</label>
|
|
53
53
|
</div>
|
|
54
54
|
<div v-if="!filteredItems.length" class="px-4 py-2 cursor-pointer text-lightDropdownOptionsText dark:text-darkDropdownOptionsText">
|
|
55
|
-
{{
|
|
55
|
+
{{ $t('No results found') }}
|
|
56
56
|
</div>
|
|
57
57
|
|
|
58
58
|
<div v-if="$slots['extra-item']" class="px-4 py-2 dark:text-gray-400">
|
|
@@ -148,6 +148,10 @@ const props = defineProps({
|
|
|
148
148
|
type: Boolean,
|
|
149
149
|
default: false,
|
|
150
150
|
},
|
|
151
|
+
searchDebounceMs: {
|
|
152
|
+
type: Number,
|
|
153
|
+
default: 300,
|
|
154
|
+
},
|
|
151
155
|
});
|
|
152
156
|
|
|
153
157
|
const emit = defineEmits(['update:modelValue', 'scroll-near-end', 'search']);
|
|
@@ -165,6 +169,7 @@ const dropdownStyle = ref<{ top?: string; }>({
|
|
|
165
169
|
|
|
166
170
|
const selectedItems: Ref<any[]> = ref([]);
|
|
167
171
|
const internalSelect = ref<HTMLElement | null>(null);
|
|
172
|
+
let searchDebounceHandle: ReturnType<typeof setTimeout> | null = null;
|
|
168
173
|
|
|
169
174
|
function inputInput() {
|
|
170
175
|
if (!props.multiple && selectedItems.value.length) {
|
|
@@ -172,7 +177,12 @@ function inputInput() {
|
|
|
172
177
|
emit('update:modelValue', null);
|
|
173
178
|
}
|
|
174
179
|
if (!props.searchDisabled) {
|
|
175
|
-
|
|
180
|
+
if (searchDebounceHandle) {
|
|
181
|
+
clearTimeout(searchDebounceHandle);
|
|
182
|
+
}
|
|
183
|
+
searchDebounceHandle = setTimeout(() => {
|
|
184
|
+
emit('search', search.value);
|
|
185
|
+
}, props.searchDebounceMs);
|
|
176
186
|
}
|
|
177
187
|
}
|
|
178
188
|
|
|
@@ -329,6 +339,10 @@ onUnmounted(() => {
|
|
|
329
339
|
if (props.teleportToBody) {
|
|
330
340
|
window.removeEventListener('scroll', handleScroll, true);
|
|
331
341
|
}
|
|
342
|
+
if (searchDebounceHandle) {
|
|
343
|
+
clearTimeout(searchDebounceHandle);
|
|
344
|
+
searchDebounceHandle = null;
|
|
345
|
+
}
|
|
332
346
|
});
|
|
333
347
|
|
|
334
348
|
const getDropdownPosition = computed(() => {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<Select
|
|
18
18
|
v-else-if="column.foreignResource"
|
|
19
19
|
ref="input"
|
|
20
|
-
:key="
|
|
20
|
+
:key="`select-${column.name}-${source}-${column.foreignResource?.name || column.foreignResource?.table || ''}`"
|
|
21
21
|
class="w-full min-w-24"
|
|
22
22
|
:options="columnOptions[column.name] || []"
|
|
23
23
|
:searchDisabled="!column.foreignResource.searchableFields"
|