@finema/core 2.59.2 → 2.60.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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
- package/dist/runtime/components/Form/Fields.vue +13 -18
- package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
- package/dist/runtime/components/Form/InputDateTime/index.vue +55 -63
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +66 -82
- package/dist/runtime/components/Form/InputMonth/index.vue +51 -52
- package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
- package/dist/runtime/components/Form/InputSelect/index.vue +38 -46
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -62
- package/dist/runtime/components/Form/InputTags/index.d.vue.ts +0 -2
- package/dist/runtime/components/Form/InputTags/index.vue +25 -179
- package/dist/runtime/components/Form/InputTags/index.vue.d.ts +0 -2
- package/dist/runtime/components/Form/InputTags/types.d.ts +3 -5
- package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
- package/dist/runtime/components/Form/InputTime/index.vue +38 -39
- package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +30 -30
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +50 -50
- package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
- package/dist/runtime/components/Form/fileState/FailedState.vue +33 -33
- package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
- package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
- package/dist/runtime/components/Form/index.vue +5 -5
- package/dist/runtime/components/Form/types.d.ts +1 -3
- package/dist/runtime/components/Form/types.js +0 -1
- package/dist/runtime/components/Image.vue +28 -28
- package/dist/runtime/components/Log/index.vue +17 -17
- package/dist/runtime/components/Table/ColumnDate.vue +1 -1
- package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
- package/dist/runtime/components/Table/ColumnImage.vue +4 -4
- package/dist/runtime/components/Table/ColumnText.d.vue.ts +1 -5
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/ColumnText.vue.d.ts +1 -5
- package/dist/runtime/components/Table/Pagination.vue +46 -46
- package/dist/runtime/components/Table/Simple.vue +17 -17
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/styles/main.css +1 -1
- package/dist/runtime/theme/selectMenu.js +2 -2
- package/dist/runtime/theme/table.js +1 -1
- package/dist/runtime/utils/TimeHelper.d.ts +5 -15
- package/dist/runtime/utils/TimeHelper.js +11 -34
- package/package.json +1 -1
- package/dist/runtime/components/Form/InputCheckboxGroup/index.d.vue.ts +0 -8
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +0 -59
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue.d.ts +0 -8
- package/dist/runtime/components/Form/InputCheckboxGroup/types.d.ts +0 -21
- package/dist/runtime/components/Form/InputCheckboxGroup/types.js +0 -0
|
@@ -1,56 +1,48 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<SelectMenu
|
|
4
|
-
:model-value="value"
|
|
5
|
-
:items="options"
|
|
6
|
-
:placeholder="wrapperProps.placeholder"
|
|
7
|
-
:disabled="wrapperProps.disabled"
|
|
8
|
-
:loading="loading"
|
|
9
|
-
:search-input="searchInput"
|
|
10
|
-
:selected-icon="selectedIcon"
|
|
11
|
-
value-key="value"
|
|
12
|
-
label-key="label"
|
|
13
|
-
:icon="icon"
|
|
14
|
-
:ui="ui"
|
|
15
|
-
:leading-icon="options.find((item) => item.value === value)?.icon"
|
|
16
|
-
:avatar="options.find((item) => item.value === value)?.avatar"
|
|
17
|
-
@update:modelValue="onChange"
|
|
18
|
-
@update:searchTerm="onSearch"
|
|
19
|
-
>
|
|
20
|
-
<template #default="{ modelValue
|
|
21
|
-
<
|
|
22
|
-
v-if="
|
|
23
|
-
v-bind="options.find((item) => item.value === modelValue)?.chip"
|
|
24
|
-
inset
|
|
25
|
-
standalone
|
|
26
|
-
:size="selectMenuUi.itemLeadingChipSize()"
|
|
27
|
-
:class="selectMenuUi.itemLeadingChip()"
|
|
28
|
-
/>
|
|
29
|
-
<div
|
|
30
|
-
v-if="value"
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<SelectMenu
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:items="options"
|
|
6
|
+
:placeholder="wrapperProps.placeholder"
|
|
7
|
+
:disabled="wrapperProps.disabled"
|
|
8
|
+
:loading="loading"
|
|
9
|
+
:search-input="searchInput"
|
|
10
|
+
:selected-icon="selectedIcon"
|
|
11
|
+
value-key="value"
|
|
12
|
+
label-key="label"
|
|
13
|
+
:icon="icon"
|
|
14
|
+
:ui="ui"
|
|
15
|
+
:leading-icon="options.find((item) => item.value === value)?.icon"
|
|
16
|
+
:avatar="options.find((item) => item.value === value)?.avatar"
|
|
17
|
+
@update:modelValue="onChange"
|
|
18
|
+
@update:searchTerm="onSearch"
|
|
19
|
+
>
|
|
20
|
+
<template #default="{ modelValue }">
|
|
21
|
+
<div
|
|
22
|
+
v-if="value"
|
|
31
23
|
:class="theme.selectedWrapper({
|
|
32
24
|
class: [ui?.selectedWrapper]
|
|
33
|
-
})"
|
|
34
|
-
>
|
|
35
|
-
<span
|
|
25
|
+
})"
|
|
26
|
+
>
|
|
27
|
+
<span
|
|
36
28
|
:class="theme.selectedLabel({
|
|
37
29
|
class: [ui?.selectedLabel]
|
|
38
|
-
})"
|
|
39
|
-
>
|
|
40
|
-
{{ options.find((item) => item.value === modelValue)?.label || modelValue }}
|
|
41
|
-
</span>
|
|
42
|
-
<Icon
|
|
43
|
-
v-if="clearable"
|
|
44
|
-
:name="clearIcon"
|
|
30
|
+
})"
|
|
31
|
+
>
|
|
32
|
+
{{ options.find((item) => item.value === modelValue)?.label || modelValue }}
|
|
33
|
+
</span>
|
|
34
|
+
<Icon
|
|
35
|
+
v-if="clearable"
|
|
36
|
+
:name="clearIcon"
|
|
45
37
|
:class="theme.clearIcon({
|
|
46
38
|
class: [ui?.clearIcon]
|
|
47
|
-
})"
|
|
48
|
-
@click.stop="onChange(void 0)"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
</SelectMenu>
|
|
53
|
-
</FieldWrapper>
|
|
39
|
+
})"
|
|
40
|
+
@click.stop="onChange(void 0)"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</SelectMenu>
|
|
45
|
+
</FieldWrapper>
|
|
54
46
|
</template>
|
|
55
47
|
|
|
56
48
|
<script setup>
|
|
@@ -1,76 +1,57 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<SelectMenu
|
|
4
|
-
:model-value="value"
|
|
5
|
-
:items="options"
|
|
6
|
-
multiple
|
|
7
|
-
:placeholder="wrapperProps.placeholder"
|
|
8
|
-
:disabled="wrapperProps.disabled"
|
|
9
|
-
:loading="loading"
|
|
10
|
-
:search-input="searchInput"
|
|
11
|
-
:selected-icon="selectedIcon"
|
|
12
|
-
value-key="value"
|
|
13
|
-
label-key="label"
|
|
14
|
-
:icon="icon"
|
|
15
|
-
:ui="ui"
|
|
16
|
-
:ignore-filter="!!$attrs.onSearch"
|
|
17
|
-
@update:model-value="onChange"
|
|
18
|
-
@update:searchTerm="onSearch"
|
|
19
|
-
>
|
|
20
|
-
<template #default="{ modelValue
|
|
21
|
-
<div
|
|
22
|
-
v-if="!ArrayHelper.isEmpty(value)"
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<SelectMenu
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:items="options"
|
|
6
|
+
multiple
|
|
7
|
+
:placeholder="wrapperProps.placeholder"
|
|
8
|
+
:disabled="wrapperProps.disabled"
|
|
9
|
+
:loading="loading"
|
|
10
|
+
:search-input="searchInput"
|
|
11
|
+
:selected-icon="selectedIcon"
|
|
12
|
+
value-key="value"
|
|
13
|
+
label-key="label"
|
|
14
|
+
:icon="icon"
|
|
15
|
+
:ui="ui"
|
|
16
|
+
:ignore-filter="!!$attrs.onSearch"
|
|
17
|
+
@update:model-value="onChange"
|
|
18
|
+
@update:searchTerm="onSearch"
|
|
19
|
+
>
|
|
20
|
+
<template #default="{ modelValue }">
|
|
21
|
+
<div
|
|
22
|
+
v-if="!ArrayHelper.isEmpty(value)"
|
|
23
23
|
:class="theme.tagsWrapper({
|
|
24
24
|
class: [ui?.tagsWrapper]
|
|
25
|
-
})"
|
|
26
|
-
>
|
|
27
|
-
<div
|
|
28
|
-
v-for="_value in ArrayHelper.toArray(modelValue)"
|
|
29
|
-
:key="_value"
|
|
25
|
+
})"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
v-for="_value in ArrayHelper.toArray(modelValue)"
|
|
29
|
+
:key="_value"
|
|
30
30
|
:class="theme.tagsItem({
|
|
31
31
|
class: [ui?.tagsItem]
|
|
32
|
-
})"
|
|
33
|
-
>
|
|
34
|
-
<
|
|
35
|
-
v-if="options.find((item) => item.value === _value)?.chip"
|
|
36
|
-
v-bind="options.find((item) => item.value === _value)?.chip"
|
|
37
|
-
inset
|
|
38
|
-
standalone
|
|
39
|
-
:size="selectMenuUi.itemLeadingChipSize()"
|
|
40
|
-
class="p-1"
|
|
41
|
-
/>
|
|
42
|
-
<Icon
|
|
43
|
-
v-if="options.find((item) => item.value === _value)?.icon"
|
|
44
|
-
:name="options.find((item) => item.value === _value)?.icon"
|
|
45
|
-
class="size-4"
|
|
46
|
-
/>
|
|
47
|
-
<Avatar
|
|
48
|
-
v-if="options.find((item) => item.value === _value)?.avatar"
|
|
49
|
-
v-bind="options.find((item) => item.value === _value)?.avatar"
|
|
50
|
-
:class="selectMenuUi.itemLeadingAvatar()"
|
|
51
|
-
size="2xs"
|
|
52
|
-
/>
|
|
53
|
-
<div
|
|
32
|
+
})"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
54
35
|
:class="theme.tagsItemText({
|
|
55
36
|
class: [ui?.tagsItemText]
|
|
56
|
-
})"
|
|
57
|
-
>
|
|
58
|
-
{{ options.find((item) => item.value === _value)?.label || _value }}
|
|
59
|
-
<Icon
|
|
37
|
+
})"
|
|
38
|
+
>
|
|
39
|
+
{{ options.find((item) => item.value === _value)?.label || _value }}
|
|
40
|
+
<Icon
|
|
60
41
|
:name="theme.tagsItemDeleteIcon({
|
|
61
42
|
class: [ui?.tagsItemDeleteIcon]
|
|
62
|
-
})"
|
|
43
|
+
})"
|
|
63
44
|
:class="theme.tagsItemDelete({
|
|
64
45
|
class: [ui?.tagsItemDelete]
|
|
65
|
-
})"
|
|
66
|
-
@click.stop="handleDelete(_value)"
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</template>
|
|
72
|
-
</SelectMenu>
|
|
73
|
-
</FieldWrapper>
|
|
46
|
+
})"
|
|
47
|
+
@click.stop="handleDelete(_value)"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
</SelectMenu>
|
|
54
|
+
</FieldWrapper>
|
|
74
55
|
</template>
|
|
75
56
|
|
|
76
57
|
<script setup>
|
|
@@ -2,12 +2,10 @@ import type { ITagsFieldProps } from '#core/components/Form/InputTags/types';
|
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<ITagsFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
3
|
add: (...args: any[]) => void;
|
|
4
4
|
change: (...args: any[]) => void;
|
|
5
|
-
selected: (...args: any[]) => void;
|
|
6
5
|
remove: (...args: any[]) => void;
|
|
7
6
|
}, string, import("vue").PublicProps, Readonly<ITagsFieldProps> & Readonly<{
|
|
8
7
|
onAdd?: ((...args: any[]) => any) | undefined;
|
|
9
8
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
10
|
-
onSelected?: ((...args: any[]) => any) | undefined;
|
|
11
9
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
12
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,82 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
:ui="ui"
|
|
26
|
-
@update:model-value="onChange"
|
|
27
|
-
@addTag="onAdd"
|
|
28
|
-
@removeTag="onRemove"
|
|
29
|
-
@focus="onFocus"
|
|
30
|
-
@blur="onBlur"
|
|
31
|
-
@keydown="onKeydown"
|
|
32
|
-
@input="onInput"
|
|
33
|
-
/>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<template #content>
|
|
37
|
-
<div
|
|
38
|
-
v-if="showSuggestions && filteredSuggestions.length > 0"
|
|
39
|
-
ref="suggestionsContainerRef"
|
|
40
|
-
:class="theme.suggestionsContainer()"
|
|
41
|
-
>
|
|
42
|
-
<div
|
|
43
|
-
v-for="(suggestion, index) in filteredSuggestions"
|
|
44
|
-
:key="suggestion"
|
|
45
|
-
:ref="(el) => setSuggestionItemRef(el, index)"
|
|
46
|
-
:class="[
|
|
47
|
-
theme.suggestionItem(),
|
|
48
|
-
{
|
|
49
|
-
[theme.suggestionItemActive()]: index === selectedSuggestionIndex
|
|
50
|
-
}
|
|
51
|
-
]"
|
|
52
|
-
@mousedown.prevent="selectSuggestion(suggestion, index)"
|
|
53
|
-
@mouseenter="selectedSuggestionIndex = index"
|
|
54
|
-
>
|
|
55
|
-
{{ suggestion }}
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</template>
|
|
59
|
-
</Popover>
|
|
60
|
-
</FieldWrapper>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<InputTags
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:disabled="wrapperProps.disabled"
|
|
6
|
+
:leading-icon="leadingIcon"
|
|
7
|
+
:max-length="maxLength"
|
|
8
|
+
:varant="variant"
|
|
9
|
+
:delete-icon="deleteIcon"
|
|
10
|
+
:size="size"
|
|
11
|
+
:trailing-icon="trailingIcon"
|
|
12
|
+
:loading="loading"
|
|
13
|
+
:loading-icon="loadingIcon"
|
|
14
|
+
:name="name"
|
|
15
|
+
:placeholder="wrapperProps.placeholder"
|
|
16
|
+
:autofocus="!!autoFocus"
|
|
17
|
+
:icon="icon"
|
|
18
|
+
:readonly="readonly"
|
|
19
|
+
:ui="ui"
|
|
20
|
+
@update:model-value="onChange"
|
|
21
|
+
@addTag="onAdd"
|
|
22
|
+
@removeTag="onRemove"
|
|
23
|
+
/>
|
|
24
|
+
</FieldWrapper>
|
|
61
25
|
</template>
|
|
62
26
|
|
|
63
27
|
<script setup>
|
|
64
28
|
import { useFieldHOC } from "#core/composables/useForm";
|
|
65
29
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
66
|
-
|
|
67
|
-
import { inputTheme } from "#core/theme/input";
|
|
68
|
-
const emits = defineEmits(["change", "add", "remove", "selected"]);
|
|
30
|
+
const emits = defineEmits(["change", "add", "remove"]);
|
|
69
31
|
const props = defineProps({
|
|
70
32
|
leadingIcon: { type: null, required: false },
|
|
71
33
|
trailingIcon: { type: null, required: false },
|
|
72
34
|
loading: { type: Boolean, required: false },
|
|
73
35
|
loadingIcon: { type: null, required: false },
|
|
74
36
|
icon: { type: String, required: false },
|
|
75
|
-
maxLength: { type:
|
|
37
|
+
maxLength: { type: String, required: false },
|
|
76
38
|
variant: { type: String, required: false },
|
|
77
39
|
size: { type: String, required: false },
|
|
78
40
|
deleteIcon: { type: String, required: false },
|
|
79
|
-
suggestions: { type: Array, required: false },
|
|
80
41
|
form: { type: Object, required: false },
|
|
81
42
|
name: { type: String, required: true },
|
|
82
43
|
errorMessage: { type: String, required: false },
|
|
@@ -92,18 +53,11 @@ const props = defineProps({
|
|
|
92
53
|
help: { type: String, required: false },
|
|
93
54
|
ui: { type: null, required: false }
|
|
94
55
|
});
|
|
95
|
-
const theme = computed(() => useUiConfig(inputTheme, "input")());
|
|
96
56
|
const {
|
|
97
57
|
value,
|
|
98
58
|
wrapperProps,
|
|
99
59
|
handleChange
|
|
100
60
|
} = useFieldHOC(props);
|
|
101
|
-
const showSuggestions = ref(false);
|
|
102
|
-
const selectedSuggestionIndex = ref(-1);
|
|
103
|
-
const suggestionsContainerRef = ref();
|
|
104
|
-
const suggestionItemRefs = ref([]);
|
|
105
|
-
const inputRef = ref();
|
|
106
|
-
const currentInput = ref("");
|
|
107
61
|
const onChange = (value2) => {
|
|
108
62
|
handleChange(value2);
|
|
109
63
|
emits("change", value2);
|
|
@@ -114,112 +68,4 @@ const onAdd = (value2) => {
|
|
|
114
68
|
const onRemove = (value2) => {
|
|
115
69
|
emits("remove", value2);
|
|
116
70
|
};
|
|
117
|
-
const onInput = (event) => {
|
|
118
|
-
const target = event.target;
|
|
119
|
-
currentInput.value = target.value.toLowerCase();
|
|
120
|
-
};
|
|
121
|
-
const setSuggestionItemRef = (el, index) => {
|
|
122
|
-
if (suggestionItemRefs.value) {
|
|
123
|
-
suggestionItemRefs.value[index] = el;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const filteredSuggestions = computed(() => {
|
|
127
|
-
if (!props.suggestions) return [];
|
|
128
|
-
const inputVal = currentInput.value?.trim().toLowerCase() || "";
|
|
129
|
-
if (!inputVal) {
|
|
130
|
-
return props.suggestions.filter((s) => !value.value?.includes(s));
|
|
131
|
-
}
|
|
132
|
-
return props.suggestions.filter(
|
|
133
|
-
(suggestion) => suggestion.toLowerCase().includes(inputVal) && !value.value?.includes(suggestion)
|
|
134
|
-
);
|
|
135
|
-
});
|
|
136
|
-
const onFocus = () => {
|
|
137
|
-
if (props.suggestions && props.suggestions.length > 0) {
|
|
138
|
-
showSuggestions.value = true;
|
|
139
|
-
selectedSuggestionIndex.value = -1;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const onBlur = (event) => {
|
|
143
|
-
setTimeout(() => {
|
|
144
|
-
showSuggestions.value = false;
|
|
145
|
-
selectedSuggestionIndex.value = -1;
|
|
146
|
-
}, 150);
|
|
147
|
-
};
|
|
148
|
-
const onKeydown = (event) => {
|
|
149
|
-
if (!showSuggestions.value || filteredSuggestions.value.length === 0) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
switch (event.key) {
|
|
153
|
-
case "ArrowDown":
|
|
154
|
-
event.preventDefault();
|
|
155
|
-
selectedSuggestionIndex.value = selectedSuggestionIndex.value < filteredSuggestions.value.length - 1 ? selectedSuggestionIndex.value + 1 : 0;
|
|
156
|
-
scrollToSelectedSuggestion();
|
|
157
|
-
break;
|
|
158
|
-
case "ArrowUp":
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
selectedSuggestionIndex.value = selectedSuggestionIndex.value > 0 ? selectedSuggestionIndex.value - 1 : filteredSuggestions.value.length - 1;
|
|
161
|
-
scrollToSelectedSuggestion();
|
|
162
|
-
break;
|
|
163
|
-
case "Enter":
|
|
164
|
-
if (selectedSuggestionIndex.value === -1) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
event.preventDefault();
|
|
168
|
-
if (selectedSuggestionIndex.value >= 0) {
|
|
169
|
-
const suggestion = filteredSuggestions.value[selectedSuggestionIndex.value];
|
|
170
|
-
if (suggestion) {
|
|
171
|
-
selectSuggestion(suggestion, selectedSuggestionIndex.value);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
break;
|
|
175
|
-
case "Escape":
|
|
176
|
-
showSuggestions.value = false;
|
|
177
|
-
selectedSuggestionIndex.value = -1;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
const selectSuggestion = (suggestion, index) => {
|
|
182
|
-
if (index !== void 0) {
|
|
183
|
-
scrollToSuggestionByIndex(index);
|
|
184
|
-
}
|
|
185
|
-
const newValue = [...value.value || [], suggestion];
|
|
186
|
-
handleChange(newValue);
|
|
187
|
-
emits("selected", suggestion);
|
|
188
|
-
emits("change", newValue);
|
|
189
|
-
showSuggestions.value = false;
|
|
190
|
-
selectedSuggestionIndex.value = -1;
|
|
191
|
-
currentInput.value = "";
|
|
192
|
-
nextTick(() => {
|
|
193
|
-
if (inputRef.value) {
|
|
194
|
-
inputRef.value.$el.querySelector("input")?.focus();
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
const scrollToSelectedSuggestion = () => {
|
|
199
|
-
nextTick(() => {
|
|
200
|
-
if (selectedSuggestionIndex.value >= 0) {
|
|
201
|
-
scrollToSuggestionByIndex(selectedSuggestionIndex.value);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
const scrollToSuggestionByIndex = (index) => {
|
|
206
|
-
if (!suggestionsContainerRef.value || !suggestionItemRefs.value[index]) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
const container = suggestionsContainerRef.value;
|
|
210
|
-
const item = suggestionItemRefs.value[index];
|
|
211
|
-
if (item) {
|
|
212
|
-
const containerRect = container.getBoundingClientRect();
|
|
213
|
-
const itemRect = item.getBoundingClientRect();
|
|
214
|
-
const isAboveView = itemRect.top < containerRect.top;
|
|
215
|
-
const isBelowView = itemRect.bottom > containerRect.bottom;
|
|
216
|
-
if (isAboveView || isBelowView) {
|
|
217
|
-
item.scrollIntoView({
|
|
218
|
-
behavior: "smooth",
|
|
219
|
-
block: "nearest",
|
|
220
|
-
inline: "nearest"
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
71
|
</script>
|
|
@@ -2,12 +2,10 @@ import type { ITagsFieldProps } from '#core/components/Form/InputTags/types';
|
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<ITagsFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
3
|
add: (...args: any[]) => void;
|
|
4
4
|
change: (...args: any[]) => void;
|
|
5
|
-
selected: (...args: any[]) => void;
|
|
6
5
|
remove: (...args: any[]) => void;
|
|
7
6
|
}, string, import("vue").PublicProps, Readonly<ITagsFieldProps> & Readonly<{
|
|
8
7
|
onAdd?: ((...args: any[]) => any) | undefined;
|
|
9
8
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
10
|
-
onSelected?: ((...args: any[]) => any) | undefined;
|
|
11
9
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
12
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -5,15 +5,13 @@ export interface ITagsFieldProps extends IFieldProps {
|
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
loadingIcon?: any;
|
|
7
7
|
icon?: string;
|
|
8
|
-
maxLength?:
|
|
9
|
-
variant?:
|
|
10
|
-
size?:
|
|
8
|
+
maxLength?: string;
|
|
9
|
+
variant?: string;
|
|
10
|
+
size?: string;
|
|
11
11
|
deleteIcon?: string;
|
|
12
|
-
suggestions?: string[];
|
|
13
12
|
}
|
|
14
13
|
export type ITagsField = IFormFieldBase<INPUT_TYPES.TAGS, ITagsFieldProps, {
|
|
15
14
|
change?: (value: string[]) => void;
|
|
16
15
|
add?: (value: string) => void;
|
|
17
16
|
remove?: (value: string) => void;
|
|
18
|
-
selected?: (value: string) => void;
|
|
19
17
|
}>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<Textarea
|
|
4
|
-
:model-value="value"
|
|
5
|
-
:disabled="wrapperProps.disabled"
|
|
6
|
-
:name="name"
|
|
7
|
-
:resize="resize"
|
|
8
|
-
:placeholder="wrapperProps.placeholder"
|
|
9
|
-
:autofocus="!!autoFocus"
|
|
10
|
-
:autoresize="autoresize"
|
|
11
|
-
:rows="rows"
|
|
12
|
-
:maxrows="maxrows"
|
|
13
|
-
:loading="loading"
|
|
14
|
-
:loading-icon="loadingIcon"
|
|
15
|
-
:readonly="readonly"
|
|
16
|
-
:ui="ui"
|
|
17
|
-
@update:model-value="onChange"
|
|
18
|
-
/>
|
|
19
|
-
</FieldWrapper>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<Textarea
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:disabled="wrapperProps.disabled"
|
|
6
|
+
:name="name"
|
|
7
|
+
:resize="resize"
|
|
8
|
+
:placeholder="wrapperProps.placeholder"
|
|
9
|
+
:autofocus="!!autoFocus"
|
|
10
|
+
:autoresize="autoresize"
|
|
11
|
+
:rows="rows"
|
|
12
|
+
:maxrows="maxrows"
|
|
13
|
+
:loading="loading"
|
|
14
|
+
:loading-icon="loadingIcon"
|
|
15
|
+
:readonly="readonly"
|
|
16
|
+
:ui="ui"
|
|
17
|
+
@update:model-value="onChange"
|
|
18
|
+
/>
|
|
19
|
+
</FieldWrapper>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script setup>
|
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<Datepicker
|
|
4
|
-
v-model="innerValue"
|
|
5
|
-
:teleport="teleport"
|
|
6
|
-
:disabled="wrapperProps.disabled"
|
|
7
|
-
:cancel-text="appConfig.core?.locale === 'th' ? '\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01' : 'Cancel'"
|
|
8
|
-
:select-text="appConfig.core?.locale === 'th' ? '\u0E15\u0E01\u0E25\u0E07' : 'Select'"
|
|
9
|
-
:locale="appConfig.core?.locale"
|
|
10
|
-
time-picker
|
|
11
|
-
:placeholder="wrapperProps.placeholder"
|
|
12
|
-
:format="format"
|
|
13
|
-
:min-time="minTime"
|
|
14
|
-
:max-time="maxTime"
|
|
15
|
-
:start-time="startTime"
|
|
16
|
-
:required="required"
|
|
17
|
-
:enable-seconds="enableSeconds"
|
|
18
|
-
:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
:
|
|
26
|
-
:
|
|
27
|
-
:
|
|
28
|
-
:readonly="true"
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<Datepicker
|
|
4
|
+
v-model="innerValue"
|
|
5
|
+
:teleport="teleport"
|
|
6
|
+
:disabled="wrapperProps.disabled"
|
|
7
|
+
:cancel-text="appConfig.core?.locale === 'th' ? '\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01' : 'Cancel'"
|
|
8
|
+
:select-text="appConfig.core?.locale === 'th' ? '\u0E15\u0E01\u0E25\u0E07' : 'Select'"
|
|
9
|
+
:locale="appConfig.core?.locale"
|
|
10
|
+
time-picker
|
|
11
|
+
:placeholder="wrapperProps.placeholder"
|
|
12
|
+
:format="format"
|
|
13
|
+
:min-time="minTime"
|
|
14
|
+
:max-time="maxTime"
|
|
15
|
+
:start-time="startTime"
|
|
16
|
+
:required="required"
|
|
17
|
+
:enable-seconds="enableSeconds"
|
|
18
|
+
@update:model-value="onChange"
|
|
19
|
+
>
|
|
20
|
+
<template #dp-input="{ value: innerValue }">
|
|
21
|
+
<Input
|
|
22
|
+
:trailing-icon="innerValue ? void 0 : 'i-heroicons-clock'"
|
|
23
|
+
type="text"
|
|
24
|
+
:disabled="wrapperProps.disabled"
|
|
25
|
+
:model-value="innerValue"
|
|
26
|
+
:placeholder="wrapperProps.placeholder"
|
|
27
|
+
:readonly="true"
|
|
29
28
|
:ui="{
|
|
30
29
|
base: 'cursor-pointer select-none',
|
|
31
30
|
trailingIcon: 'cursor-pointer'
|
|
32
|
-
}"
|
|
33
|
-
/>
|
|
34
|
-
</template>
|
|
35
|
-
<template #clear-icon="{ clear }">
|
|
36
|
-
<Icon
|
|
37
|
-
:name="clearIcon"
|
|
31
|
+
}"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
<template #clear-icon="{ clear }">
|
|
35
|
+
<Icon
|
|
36
|
+
:name="clearIcon"
|
|
38
37
|
:class="theme.clearIcon({
|
|
39
38
|
class: [ui?.clearIcon]
|
|
40
|
-
})"
|
|
41
|
-
@click.stop="clear"
|
|
42
|
-
/>
|
|
43
|
-
</template>
|
|
44
|
-
</Datepicker>
|
|
45
|
-
</FieldWrapper>
|
|
39
|
+
})"
|
|
40
|
+
@click.stop="clear"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
</Datepicker>
|
|
44
|
+
</FieldWrapper>
|
|
46
45
|
</template>
|
|
47
46
|
|
|
48
47
|
<script setup>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper
|
|
3
|
-
v-bind="wrapperProps"
|
|
4
|
-
label=""
|
|
5
|
-
description=""
|
|
6
|
-
>
|
|
7
|
-
<Switch
|
|
8
|
-
:model-value="value"
|
|
9
|
-
:disabled="wrapperProps.disabled"
|
|
10
|
-
:name="name"
|
|
11
|
-
:ui="ui"
|
|
12
|
-
:label="label"
|
|
13
|
-
:description="description"
|
|
14
|
-
:loading="loading"
|
|
15
|
-
:loading-icon="loadingIcon"
|
|
16
|
-
@update:modelValue="onChange"
|
|
17
|
-
/>
|
|
18
|
-
</FieldWrapper>
|
|
2
|
+
<FieldWrapper
|
|
3
|
+
v-bind="wrapperProps"
|
|
4
|
+
label=""
|
|
5
|
+
description=""
|
|
6
|
+
>
|
|
7
|
+
<Switch
|
|
8
|
+
:model-value="value"
|
|
9
|
+
:disabled="wrapperProps.disabled"
|
|
10
|
+
:name="name"
|
|
11
|
+
:ui="ui"
|
|
12
|
+
:label="label"
|
|
13
|
+
:description="description"
|
|
14
|
+
:loading="loading"
|
|
15
|
+
:loading-icon="loadingIcon"
|
|
16
|
+
@update:modelValue="onChange"
|
|
17
|
+
/>
|
|
18
|
+
</FieldWrapper>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script setup>
|