@signal24/vue-foundation 4.29.2 → 4.29.4
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/package.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
:name="name"
|
|
13
13
|
data-1p-ignore
|
|
14
14
|
@keydown="handleKeyDown"
|
|
15
|
+
@paste="handlePaste"
|
|
15
16
|
@focus="handleInputFocused"
|
|
16
17
|
@blur="handleInputBlurred"
|
|
17
18
|
/>
|
|
@@ -309,16 +310,14 @@ onMounted(async () => {
|
|
|
309
310
|
shouldShowCreateOption.value = props.onCreateItem !== undefined;
|
|
310
311
|
|
|
311
312
|
if (props.loadOptions && props.preload) {
|
|
312
|
-
|
|
313
|
-
await loadRemoteOptions();
|
|
314
|
-
searchText.value = '';
|
|
313
|
+
await loadInitialRemoteOptions();
|
|
315
314
|
}
|
|
316
315
|
|
|
317
316
|
// if we have a value, but we don't have options and we use a specific field for the value,
|
|
318
317
|
// then the value is not something we can pass through the formatter.
|
|
319
318
|
// thus, we have to wait to parse the value and render the value later.
|
|
320
|
-
if (!props.options && !props.loadOptions && (props.valueField || props.valueExtractor)) {
|
|
321
|
-
|
|
319
|
+
else if (!props.options && !props.loadOptions && (props.valueField || props.valueExtractor)) {
|
|
320
|
+
// do nothing & let the placeholder formatter handle it
|
|
322
321
|
} else {
|
|
323
322
|
handleValueChanged();
|
|
324
323
|
}
|
|
@@ -342,16 +341,18 @@ onBeforeUnmount(() => {
|
|
|
342
341
|
optionsContainer.value?.remove();
|
|
343
342
|
});
|
|
344
343
|
|
|
345
|
-
async function
|
|
346
|
-
await reloadOptions();
|
|
344
|
+
async function loadInitialRemoteOptions() {
|
|
345
|
+
await reloadOptions(true);
|
|
346
|
+
handleValueChanged();
|
|
347
347
|
if (remoteOptions.value) emit('optionsLoaded', remoteOptions.value);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
async function reloadOptions() {
|
|
350
|
+
async function reloadOptions(invokeValueChanged = false) {
|
|
351
351
|
const effectiveSearchText = props.remoteSearch && isSearching.value && searchText.value.length ? searchText.value : null;
|
|
352
352
|
isLoading.value = true;
|
|
353
353
|
remoteOptions.value = (await props.loadOptions?.(effectiveSearchText)) ?? [];
|
|
354
354
|
isLoading.value = false;
|
|
355
|
+
if (invokeValueChanged) handleValueChanged();
|
|
355
356
|
setHighlightedOptionKey();
|
|
356
357
|
}
|
|
357
358
|
|
|
@@ -411,6 +412,10 @@ function handleKeyDown(e: KeyboardEvent) {
|
|
|
411
412
|
}
|
|
412
413
|
}
|
|
413
414
|
|
|
415
|
+
function handlePaste() {
|
|
416
|
+
isSearching.value = true;
|
|
417
|
+
}
|
|
418
|
+
|
|
414
419
|
function handleInputFocused() {
|
|
415
420
|
setHighlightedOptionKey();
|
|
416
421
|
shouldDisplayOptions.value = true;
|
|
@@ -468,7 +473,7 @@ function handleInputBlurred() {
|
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
function handleOptionsDisplayed() {
|
|
471
|
-
if (!isLoaded.value)
|
|
476
|
+
if (!isLoaded.value) loadInitialRemoteOptions();
|
|
472
477
|
if (props.optionsListId) optionsContainer.value?.setAttribute('id', props.optionsListId);
|
|
473
478
|
teleportOptionsContainer();
|
|
474
479
|
}
|