@signal24/vue-foundation 4.25.4 → 4.25.5

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.4",
4
+ "version": "4.25.5",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -53,6 +53,8 @@
53
53
  import { debounce, groupBy, isEqual, uniq } from 'lodash';
54
54
  import { computed, onMounted, ref, watch } from 'vue';
55
55
 
56
+ import { isNotNullOrUndefined } from '@/helpers';
57
+
56
58
  import { escapeHtml } from '../helpers/string';
57
59
  import type { VfSmartSelectOptionDescriptor } from './vf-smart-select.types';
58
60
 
@@ -321,7 +323,7 @@ onMounted(async () => {
321
323
  if (selectedOption.value !== props.modelValue) {
322
324
  emit(
323
325
  'update:modelValue',
324
- selectedOption.value !== null && effectiveValueExtractor.value !== null
326
+ isNotNullOrUndefined(selectedOption.value) && effectiveValueExtractor.value !== null
325
327
  ? effectiveValueExtractor.value(selectedOption.value)
326
328
  : selectedOption.value
327
329
  );
@@ -559,7 +561,7 @@ function handleValueChanged() {
559
561
  selectedOption.value = effectiveValueExtractor.value
560
562
  ? allOptions.value.find(o => props.modelValue === effectiveValueExtractor.value!(o))
561
563
  : props.modelValue;
562
- selectedOptionTitle.value = selectedOption.value !== null ? effectiveSelectionFormatter.value(selectedOption.value) : null;
564
+ selectedOptionTitle.value = isNotNullOrUndefined(selectedOption.value) ? effectiveSelectionFormatter.value(selectedOption.value) : null;
563
565
  searchText.value = selectedOptionTitle.value ?? '';
564
566
  } else {
565
567
  selectedOption.value = null;
@@ -18,3 +18,7 @@ export function nullifyEmptyInputs<T extends Record<string, unknown>, K extends
18
18
  }
19
19
  return result;
20
20
  }
21
+
22
+ export function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {
23
+ return value !== null && value !== undefined;
24
+ }