@signal24/vue-foundation 4.25.1 → 4.25.3

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.25.1",
4
+ "version": "4.25.3",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -274,7 +274,7 @@ watch(shouldDisplayOptions, () => {
274
274
  setTimeout(handleOptionsDisplayed, 0);
275
275
  } else {
276
276
  isSearching.value = false;
277
- searchText.value = selectedOptionTitle.value || '';
277
+ searchText.value = selectedOptionTitle.value ?? '';
278
278
 
279
279
  if (optionsContainer.value) {
280
280
  optionsContainer.value.style.visibility = 'hidden';
@@ -283,11 +283,14 @@ watch(shouldDisplayOptions, () => {
283
283
  });
284
284
 
285
285
  watch(effectiveOptions, () => {
286
- if (props.modelValue && !selectedOption.value) {
286
+ if (props.modelValue !== null && selectedOption.value === null) {
287
287
  handleValueChanged();
288
288
  }
289
289
 
290
- if ((highlightedOptionKey.value || isSearching.value) && !effectiveOptions.value.find(option => option.key == highlightedOptionKey.value)) {
290
+ if (
291
+ (highlightedOptionKey.value !== null || isSearching.value) &&
292
+ !effectiveOptions.value.find(option => option.key == highlightedOptionKey.value)
293
+ ) {
291
294
  highlightedOptionKey.value = effectiveOptions.value[0]?.key ?? NullSymbol;
292
295
  }
293
296
  });
@@ -308,7 +311,9 @@ onMounted(async () => {
308
311
  if (selectedOption.value !== props.modelValue) {
309
312
  emit(
310
313
  'update:modelValue',
311
- selectedOption.value && effectiveValueExtractor.value ? effectiveValueExtractor.value(selectedOption.value) : selectedOption.value
314
+ selectedOption.value !== null && effectiveValueExtractor.value !== null
315
+ ? effectiveValueExtractor.value(selectedOption.value)
316
+ : selectedOption.value
312
317
  );
313
318
  }
314
319
  });
@@ -324,7 +329,7 @@ async function loadRemoteOptions() {
324
329
  }
325
330
 
326
331
  async function reloadOptions() {
327
- const effectiveSearchText = props.remoteSearch && isSearching.value && searchText.value ? searchText.value : null;
332
+ const effectiveSearchText = props.remoteSearch && isSearching.value && searchText.value.length ? searchText.value : null;
328
333
  isLoading.value = true;
329
334
  loadedOptions.value = (await props.loadOptions?.(effectiveSearchText)) ?? [];
330
335
  isLoading.value = false;
@@ -517,7 +522,7 @@ function incrementHighlightedOption(increment: number) {
517
522
  function selectOption(option: VfSmartSelectOptionDescriptor<T>) {
518
523
  isSearching.value = false;
519
524
 
520
- if (option.key == NullSymbol) {
525
+ if (option.key === NullSymbol) {
521
526
  searchText.value = '';
522
527
  selectedOption.value = null;
523
528
  selectedOptionTitle.value = null;
@@ -532,7 +537,7 @@ function selectOption(option: VfSmartSelectOptionDescriptor<T>) {
532
537
  const realOption = selectedDecoratedOption!.ref;
533
538
  selectedOption.value = realOption!;
534
539
  selectedOptionTitle.value = effectiveFormatter.value(realOption!);
535
- searchText.value = selectedOptionTitle.value || '';
540
+ searchText.value = selectedOptionTitle.value ?? '';
536
541
  }
537
542
 
538
543
  searchField.value?.blur();
@@ -540,12 +545,12 @@ function selectOption(option: VfSmartSelectOptionDescriptor<T>) {
540
545
  }
541
546
 
542
547
  function handleValueChanged() {
543
- if (props.modelValue) {
548
+ if (props.modelValue !== null) {
544
549
  selectedOption.value = effectiveValueExtractor.value
545
550
  ? allOptions.value.find(o => props.modelValue === effectiveValueExtractor.value!(o))
546
551
  : props.modelValue;
547
- selectedOptionTitle.value = selectedOption.value ? effectiveFormatter.value(selectedOption.value) : null;
548
- searchText.value = selectedOptionTitle.value || '';
552
+ selectedOptionTitle.value = selectedOption.value !== null ? effectiveFormatter.value(selectedOption.value) : null;
553
+ searchText.value = selectedOptionTitle.value ?? '';
549
554
  } else {
550
555
  selectedOption.value = null;
551
556
  selectedOptionTitle.value = null;
@@ -84,7 +84,7 @@ function time(value: string | null, formatStr?: string) {
84
84
 
85
85
  function dateTime(value: string | null, formatStr?: string) {
86
86
  if (!value) return value;
87
- return format(new Date(value), formatStr ?? VfOptions.defaultDateFormat);
87
+ return format(new Date(value), formatStr ?? `${VfOptions.defaultDateFormat} ${VfOptions.defaultTimeFormat}`);
88
88
  }
89
89
 
90
90
  function oneDayForward(date?: string | null) {