@signal24/vue-foundation 4.20.1 → 4.20.2
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/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/vf-smart-select.types.d.ts +7 -0
- package/dist/src/components/vf-smart-select.vue.d.ts +8 -1
- package/dist/vue-foundation.es.js +313 -305
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/vf-smart-select.types.ts +7 -0
- package/src/components/vf-smart-select.vue +13 -17
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -8,5 +8,6 @@ export * from './alert-helpers';
|
|
|
8
8
|
export * from './modal-helpers';
|
|
9
9
|
export * from './overlay-container';
|
|
10
10
|
export * from './toast-helpers';
|
|
11
|
+
export * from './vf-smart-select.types';
|
|
11
12
|
|
|
12
13
|
export { VfAjaxSelect, VfAlertModal, VfEzSmartSelect, VfModal, VfSmartSelect };
|
|
@@ -21,17 +21,19 @@
|
|
|
21
21
|
v-for="option in effectiveOptions"
|
|
22
22
|
:key="String(option.key)"
|
|
23
23
|
class="option"
|
|
24
|
-
:class="
|
|
25
|
-
highlighted: highlightedOptionKey === option.key
|
|
26
|
-
}"
|
|
24
|
+
:class="[highlightedOptionKey === option.key && 'highlighted', option.ref && classForOption?.(option.ref)]"
|
|
27
25
|
@mousemove="handleOptionHover(option)"
|
|
28
26
|
@mousedown="selectOption(option)"
|
|
29
27
|
>
|
|
30
|
-
<
|
|
31
|
-
|
|
28
|
+
<slot name="option" :option="option">
|
|
29
|
+
<div class="title" v-html="option.title" />
|
|
30
|
+
<div v-if="option.subtitle" class="subtitle" v-html="option.subtitle" />
|
|
31
|
+
</slot>
|
|
32
32
|
</div>
|
|
33
33
|
<div v-if="!effectiveOptions.length && searchText" class="no-results">
|
|
34
|
-
|
|
34
|
+
<slot name="no-results">
|
|
35
|
+
{{ effectiveNoResultsText }}
|
|
36
|
+
</slot>
|
|
35
37
|
</div>
|
|
36
38
|
</template>
|
|
37
39
|
</div>
|
|
@@ -43,20 +45,13 @@ import { debounce, isEqual } from 'lodash';
|
|
|
43
45
|
import { computed, onMounted, type Ref, ref, watch } from 'vue';
|
|
44
46
|
|
|
45
47
|
import { escapeHtml } from '../helpers/string';
|
|
48
|
+
import type { VfSmartSelectOptionDescriptor } from './vf-smart-select.types';
|
|
46
49
|
|
|
47
50
|
const NullSymbol = Symbol('null');
|
|
48
51
|
const CreateSymbol = Symbol('create');
|
|
49
52
|
|
|
50
53
|
const VALID_KEYS = `\`1234567890-=[]\\;',./~!@#$%^&*()_+{}|:"<>?qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM`;
|
|
51
54
|
|
|
52
|
-
interface OptionDescriptor {
|
|
53
|
-
key: string | symbol;
|
|
54
|
-
title: string;
|
|
55
|
-
subtitle?: string | null;
|
|
56
|
-
searchContent?: string;
|
|
57
|
-
ref?: T;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
55
|
const props = defineProps<{
|
|
61
56
|
modelValue: V | null;
|
|
62
57
|
loadOptions?: (searchText: string | null) => Promise<T[]>;
|
|
@@ -75,6 +70,7 @@ const props = defineProps<{
|
|
|
75
70
|
labelField?: keyof T;
|
|
76
71
|
formatter?: (option: T) => string;
|
|
77
72
|
subtitleFormatter?: (option: T) => string;
|
|
73
|
+
classForOption?: (option: T) => string;
|
|
78
74
|
nullTitle?: string;
|
|
79
75
|
noResultsText?: string;
|
|
80
76
|
disabled?: boolean;
|
|
@@ -166,7 +162,7 @@ const optionsDescriptors = computed(() => {
|
|
|
166
162
|
subtitle,
|
|
167
163
|
searchContent: searchContent.join(''),
|
|
168
164
|
ref: option
|
|
169
|
-
} as
|
|
165
|
+
} as VfSmartSelectOptionDescriptor<T>;
|
|
170
166
|
});
|
|
171
167
|
});
|
|
172
168
|
|
|
@@ -454,7 +450,7 @@ function highlightInitialOption() {
|
|
|
454
450
|
containerEl.scrollTop = highlightedOptionEl.offsetTop;
|
|
455
451
|
}
|
|
456
452
|
|
|
457
|
-
function handleOptionHover(option:
|
|
453
|
+
function handleOptionHover(option: VfSmartSelectOptionDescriptor<T>) {
|
|
458
454
|
highlightedOptionKey.value = option ? option.key : null;
|
|
459
455
|
}
|
|
460
456
|
|
|
@@ -480,7 +476,7 @@ function incrementHighlightedOption(increment: number) {
|
|
|
480
476
|
}
|
|
481
477
|
}
|
|
482
478
|
|
|
483
|
-
function selectOption(option:
|
|
479
|
+
function selectOption(option: VfSmartSelectOptionDescriptor<T>) {
|
|
484
480
|
isSearching.value = false;
|
|
485
481
|
|
|
486
482
|
if (option.key == NullSymbol) {
|