@signal24/vue-foundation 4.25.4 → 4.25.6

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.6",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -51,7 +51,9 @@
51
51
 
52
52
  <script lang="ts" setup generic="T, V = T">
53
53
  import { debounce, groupBy, isEqual, uniq } from 'lodash';
54
- import { computed, onMounted, ref, watch } from 'vue';
54
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
55
+
56
+ import { isNotNullOrUndefined } from '@/helpers';
55
57
 
56
58
  import { escapeHtml } from '../helpers/string';
57
59
  import type { VfSmartSelectOptionDescriptor } from './vf-smart-select.types';
@@ -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
  );
@@ -333,6 +335,10 @@ onMounted(async () => {
333
335
  }
334
336
  });
335
337
 
338
+ onBeforeUnmount(() => {
339
+ optionsContainer.value?.remove();
340
+ });
341
+
336
342
  async function loadRemoteOptions() {
337
343
  await reloadOptions();
338
344
  if (loadedOptions.value) emit('optionsLoaded', loadedOptions.value);
@@ -559,7 +565,7 @@ function handleValueChanged() {
559
565
  selectedOption.value = effectiveValueExtractor.value
560
566
  ? allOptions.value.find(o => props.modelValue === effectiveValueExtractor.value!(o))
561
567
  : props.modelValue;
562
- selectedOptionTitle.value = selectedOption.value !== null ? effectiveSelectionFormatter.value(selectedOption.value) : null;
568
+ selectedOptionTitle.value = isNotNullOrUndefined(selectedOption.value) ? effectiveSelectionFormatter.value(selectedOption.value) : null;
563
569
  searchText.value = selectedOptionTitle.value ?? '';
564
570
  } else {
565
571
  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
+ }