@signal24/vue-foundation 4.25.3 → 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.
@@ -1,25 +1,75 @@
1
1
  <template>
2
2
  <div id="demo-vf-smart-select">
3
3
  <div>
4
- <VfSmartSelect v-model="selectedOption" :options="options" label-field="label" />
4
+ <VfSmartSelect v-model="selectedInstantOption1" :options="instantOptions" label-field="label" />
5
5
 
6
- Selected value: {{ selectedOption?.label ?? '-' }}
6
+ Selected value label: {{ selectedInstantOption1?.label ?? '-' }}
7
7
  </div>
8
8
 
9
9
  <div>
10
- <VfSmartSelect v-model="selectedOption" :options="options" label-field="label" group-field="group" null-title="No selection" />
10
+ <VfSmartSelect
11
+ v-model="selectedInstantOption2"
12
+ :options="instantOptions"
13
+ label-field="label"
14
+ group-field="group"
15
+ null-title="No selection"
16
+ />
11
17
 
12
- Selected value: {{ selectedOption?.label ?? '-' }}
18
+ Selected value label: {{ selectedInstantOption2?.label ?? '-' }}
19
+ </div>
20
+
21
+ <div>
22
+ <VfSmartSelect
23
+ v-model="selectedDelayedOption1"
24
+ :options="delayedOptions"
25
+ label-field="label"
26
+ group-field="group"
27
+ null-title="No selection"
28
+ />
29
+
30
+ Selected value label: {{ selectedDelayedOption1?.label ?? '-' }}
31
+ </div>
32
+
33
+ <div>
34
+ <VfSmartSelect
35
+ v-model="selectedDelayedOption2"
36
+ :options="delayedOptions"
37
+ label-field="label"
38
+ value-field="value"
39
+ group-field="group"
40
+ null-title="No selection"
41
+ />
42
+
43
+ Selected value: {{ selectedDelayedOption2 ?? '-' }}
44
+ </div>
45
+
46
+ <div>
47
+ <VfSmartSelect
48
+ v-model="selectedDelayedOption3"
49
+ :options="delayedOptions"
50
+ label-field="label"
51
+ value-field="value"
52
+ group-field="group"
53
+ null-title="No selection"
54
+ />
55
+
56
+ Selected value: {{ selectedDelayedOption3 ?? '-' }}
13
57
  </div>
14
58
  </div>
15
59
  </template>
16
60
 
17
61
  <script lang="ts" setup>
18
- import { ref } from 'vue';
62
+ import { cloneDeep } from 'lodash';
63
+ import { onMounted, ref } from 'vue';
19
64
 
20
65
  import VfSmartSelect from '@/components/vf-smart-select.vue';
21
66
 
22
- const options = [
67
+ interface IOption {
68
+ label: string;
69
+ value: string;
70
+ group?: string;
71
+ }
72
+ const options: IOption[] = [
23
73
  { value: '1', label: 'Option 1', group: 'Set 1' },
24
74
  { value: '2', label: 'Option 2', group: 'Set 1' },
25
75
  { value: '3', label: 'Option 3', group: 'Set 1' },
@@ -32,7 +82,20 @@ const options = [
32
82
  { value: '10', label: 'Option 10', group: 'Set 2' }
33
83
  ];
34
84
 
35
- const selectedOption = ref<(typeof options)[number] | null>(null);
85
+ const instantOptions = ref<IOption[]>(cloneDeep(options));
86
+ const delayedOptions = ref<IOption[]>();
87
+
88
+ const selectedInstantOption1 = ref<IOption | null>(null);
89
+ const selectedInstantOption2 = ref<IOption | null>(null);
90
+ const selectedDelayedOption1 = ref<IOption | null>(options[1]);
91
+ const selectedDelayedOption2 = ref<string | null>('2');
92
+ const selectedDelayedOption3 = ref<string | null>('19'); // intentionally invalid value
93
+
94
+ function setDelayedOptions() {
95
+ delayedOptions.value = cloneDeep(options);
96
+ }
97
+
98
+ onMounted(() => setTimeout(setDelayedOptions, 1000));
36
99
  </script>
37
100
 
38
101
  <style lang="scss" scoped>
@@ -5,6 +5,7 @@ declare const _default: <T, V = T>(__VLS_props: NonNullable<Awaited<typeof __VLS
5
5
  readonly onOptionsLoaded?: ((args_0: T[]) => any) | undefined;
6
6
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onOptionsLoaded"> & {
7
7
  modelValue: V | null;
8
+ loadingText?: string;
8
9
  loadOptions?: (searchText: string | null) => Promise<T[]>;
9
10
  options?: T[];
10
11
  prependOptions?: T[];
@@ -24,6 +25,7 @@ declare const _default: <T, V = T>(__VLS_props: NonNullable<Awaited<typeof __VLS
24
25
  formatter?: (option: T) => string;
25
26
  subtitleFormatter?: (option: T) => string;
26
27
  classForOption?: (option: T) => string;
28
+ selectionFormatter?: (option: T) => string;
27
29
  nullTitle?: string;
28
30
  noResultsText?: string;
29
31
  disabled?: boolean;
@@ -1,2 +1,3 @@
1
1
  export declare function cloneProp<T>(prop: T | undefined | null, fallback: T): T;
2
2
  export declare function nullifyEmptyInputs<T extends Record<string, unknown>, K extends keyof T>(obj: T, fields: K[]): T;
3
+ export declare function isNotNullOrUndefined<T>(value: T | null | undefined): value is T;