@signal24/vue-foundation 4.25.2 → 4.25.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.
|
@@ -1,25 +1,62 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="demo-vf-smart-select">
|
|
3
3
|
<div>
|
|
4
|
-
<VfSmartSelect v-model="
|
|
4
|
+
<VfSmartSelect v-model="selectedInstantOption1" :options="instantOptions" label-field="label" />
|
|
5
5
|
|
|
6
|
-
Selected value: {{
|
|
6
|
+
Selected value label: {{ selectedInstantOption1?.label ?? '-' }}
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
<div>
|
|
10
|
-
<VfSmartSelect
|
|
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: {{
|
|
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 ?? '-' }}
|
|
13
44
|
</div>
|
|
14
45
|
</div>
|
|
15
46
|
</template>
|
|
16
47
|
|
|
17
48
|
<script lang="ts" setup>
|
|
18
|
-
import {
|
|
49
|
+
import { cloneDeep } from 'lodash';
|
|
50
|
+
import { onMounted, ref } from 'vue';
|
|
19
51
|
|
|
20
52
|
import VfSmartSelect from '@/components/vf-smart-select.vue';
|
|
21
53
|
|
|
22
|
-
|
|
54
|
+
interface IOption {
|
|
55
|
+
label: string;
|
|
56
|
+
value: string;
|
|
57
|
+
group?: string;
|
|
58
|
+
}
|
|
59
|
+
const options: IOption[] = [
|
|
23
60
|
{ value: '1', label: 'Option 1', group: 'Set 1' },
|
|
24
61
|
{ value: '2', label: 'Option 2', group: 'Set 1' },
|
|
25
62
|
{ value: '3', label: 'Option 3', group: 'Set 1' },
|
|
@@ -32,7 +69,19 @@ const options = [
|
|
|
32
69
|
{ value: '10', label: 'Option 10', group: 'Set 2' }
|
|
33
70
|
];
|
|
34
71
|
|
|
35
|
-
const
|
|
72
|
+
const instantOptions = ref<IOption[]>(cloneDeep(options));
|
|
73
|
+
const delayedOptions = ref<IOption[]>();
|
|
74
|
+
|
|
75
|
+
const selectedInstantOption1 = ref<IOption | null>(null);
|
|
76
|
+
const selectedInstantOption2 = ref<IOption | null>(null);
|
|
77
|
+
const selectedDelayedOption1 = ref<IOption | null>(options[1]);
|
|
78
|
+
const selectedDelayedOption2 = ref<string | null>(options[1].value);
|
|
79
|
+
|
|
80
|
+
function setDelayedOptions() {
|
|
81
|
+
delayedOptions.value = cloneDeep(options);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onMounted(() => setTimeout(setDelayedOptions, 1000));
|
|
36
85
|
</script>
|
|
37
86
|
|
|
38
87
|
<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;
|