@finema/core 2.26.8 → 2.28.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.26.8",
3
+ "version": "2.28.0",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import * as lodash from 'lodash-es';
4
4
  import * as theme from '../dist/runtime/theme/index.js';
5
5
 
6
6
  const name = "@finema/core";
7
- const version = "2.26.8";
7
+ const version = "2.28.0";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -1,60 +1,60 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Datepicker
4
- :model-value="innerValue"
5
- :disabled="wrapperProps.disabled"
6
- cancel-text="ยกเลิก"
7
- select-text="เลือก"
8
- locale="th"
9
- :enable-time-picker="!disabledTime"
10
- :placeholder="wrapperProps.placeholder"
11
- :format="format"
12
- :min-date="minDate"
13
- :max-date="maxDate"
14
- :min-time="minTime"
15
- :max-time="maxTime"
16
- :start-time="startTime"
17
- :required="required"
18
- :flow="['calendar', 'time']"
19
- @update:model-value="onInput"
20
- >
21
- <template
22
- v-if="appConfig.core?.is_thai_year"
23
- #year="{ value }"
24
- >
25
- {{ value + 543 }}
26
- </template>
27
- <template
28
- v-if="appConfig.core?.is_thai_year"
29
- #year-overlay-value="{ value }"
30
- >
31
- {{ value + 543 }}
32
- </template>
33
- <template #dp-input="{ value: innerValue }">
34
- <Input
35
- :trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
36
- type="text"
37
- :disabled="wrapperProps.disabled"
38
- :model-value="innerValue"
39
- :placeholder="wrapperProps.placeholder"
40
- :readonly="true"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Datepicker
4
+ :model-value="innerValue"
5
+ :disabled="wrapperProps.disabled"
6
+ cancel-text="ยกเลิก"
7
+ select-text="เลือก"
8
+ locale="th"
9
+ :enable-time-picker="!disabledTime"
10
+ :placeholder="wrapperProps.placeholder"
11
+ :format="format"
12
+ :min-date="minDate"
13
+ :max-date="maxDate"
14
+ :min-time="minTime"
15
+ :max-time="maxTime"
16
+ :start-time="startTime"
17
+ :required="required"
18
+ :flow="['calendar', 'time']"
19
+ @update:model-value="onInput"
20
+ >
21
+ <template
22
+ v-if="appConfig.core?.is_thai_year"
23
+ #year="{ value }"
24
+ >
25
+ {{ value + 543 }}
26
+ </template>
27
+ <template
28
+ v-if="appConfig.core?.is_thai_year"
29
+ #year-overlay-value="{ value }"
30
+ >
31
+ {{ value + 543 }}
32
+ </template>
33
+ <template #dp-input="{ value: innerValue }">
34
+ <Input
35
+ :trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
36
+ type="text"
37
+ :disabled="wrapperProps.disabled"
38
+ :model-value="innerValue"
39
+ :placeholder="wrapperProps.placeholder"
40
+ :readonly="true"
41
41
  :ui="{
42
42
  base: 'cursor-pointer select-none',
43
43
  trailingIcon: 'cursor-pointer'
44
- }"
45
- />
46
- </template>
47
- <template #clear-icon="{ clear }">
48
- <Icon
49
- :name="clearIcon"
44
+ }"
45
+ />
46
+ </template>
47
+ <template #clear-icon="{ clear }">
48
+ <Icon
49
+ :name="clearIcon"
50
50
  :class="theme.clearIcon({
51
51
  class: [ui?.clearIcon]
52
- })"
53
- @click.stop="clear"
54
- />
55
- </template>
56
- </Datepicker>
57
- </FieldWrapper>
52
+ })"
53
+ @click.stop="clear"
54
+ />
55
+ </template>
56
+ </Datepicker>
57
+ </FieldWrapper>
58
58
  </template>
59
59
 
60
60
  <script setup>
@@ -1,81 +1,81 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div class="relative">
4
- <Input
5
- v-if="type === 'password'"
6
- ref="inputRef"
7
- v-maska="activeMaskOptions"
8
- :model-value="value"
9
- :disabled="wrapperProps.disabled"
10
- :leading-icon="leadingIcon"
11
- :trailing-icon="trailingIcon"
12
- :loading="loading"
13
- :loading-icon="loadingIcon"
14
- :name="name"
15
- :placeholder="wrapperProps.placeholder"
16
- :type="isShowPassword ? 'text' : 'password'"
17
- :autofocus="!!autoFocus"
18
- :icon="icon"
19
- :readonly="readonly"
20
- :ui="defu(ui, { icon: { trailing: { pointer: '' } } })"
21
- @update:model-value="onChange"
22
- @focus="onFocus"
23
- @blur="onBlur"
24
- @keydown="onKeydown"
25
- >
26
- <template #trailing>
27
- <Button
28
- color="neutral"
29
- variant="link"
30
- :icon="isShowPassword ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
31
- :padded="false"
32
- @click="isShowPassword = !isShowPassword"
33
- />
34
- </template>
35
- </Input>
36
- <Input
37
- v-else
38
- ref="inputRef"
39
- v-maska="activeMaskOptions"
40
- :model-value="value"
41
- :disabled="wrapperProps.disabled"
42
- :leading-icon="leadingIcon"
43
- :trailing-icon="trailingIcon"
44
- :loading="loading"
45
- :loading-icon="loadingIcon"
46
- :name="name"
47
- :placeholder="wrapperProps.placeholder"
48
- :type="type"
49
- :autofocus="!!autoFocus"
50
- :icon="icon"
51
- :readonly="readonly"
52
- :ui="ui"
53
- @update:model-value="onChange"
54
- @focus="onFocus"
55
- @blur="onBlur"
56
- @keydown="onKeydown"
57
- />
58
- <div
59
- v-if="showSuggestions && filteredSuggestions.length > 0"
60
- ref="suggestionsContainerRef"
61
- :class="theme.suggestionsContainer()"
62
- >
63
- <div
64
- v-for="(suggestion, index) in filteredSuggestions"
65
- :key="suggestion"
66
- :ref="(el) => setSuggestionItemRef(el, index)"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <div class="relative">
4
+ <Input
5
+ v-if="type === 'password'"
6
+ ref="inputRef"
7
+ v-maska="activeMaskOptions"
8
+ :model-value="value"
9
+ :disabled="wrapperProps.disabled"
10
+ :leading-icon="leadingIcon"
11
+ :trailing-icon="trailingIcon"
12
+ :loading="loading"
13
+ :loading-icon="loadingIcon"
14
+ :name="name"
15
+ :placeholder="wrapperProps.placeholder"
16
+ :type="isShowPassword ? 'text' : 'password'"
17
+ :autofocus="!!autoFocus"
18
+ :icon="icon"
19
+ :readonly="readonly"
20
+ :ui="defu(ui, { icon: { trailing: { pointer: '' } } })"
21
+ @update:model-value="onChange"
22
+ @focus="onFocus"
23
+ @blur="onBlur"
24
+ @keydown="onKeydown"
25
+ >
26
+ <template #trailing>
27
+ <Button
28
+ color="neutral"
29
+ variant="link"
30
+ :icon="isShowPassword ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
31
+ :padded="false"
32
+ @click="isShowPassword = !isShowPassword"
33
+ />
34
+ </template>
35
+ </Input>
36
+ <Input
37
+ v-else
38
+ ref="inputRef"
39
+ v-maska="activeMaskOptions"
40
+ :model-value="value"
41
+ :disabled="wrapperProps.disabled"
42
+ :leading-icon="leadingIcon"
43
+ :trailing-icon="trailingIcon"
44
+ :loading="loading"
45
+ :loading-icon="loadingIcon"
46
+ :name="name"
47
+ :placeholder="wrapperProps.placeholder"
48
+ :type="type"
49
+ :autofocus="!!autoFocus"
50
+ :icon="icon"
51
+ :readonly="readonly"
52
+ :ui="ui"
53
+ @update:model-value="onChange"
54
+ @focus="onFocus"
55
+ @blur="onBlur"
56
+ @keydown="onKeydown"
57
+ />
58
+ <div
59
+ v-if="showSuggestions && filteredSuggestions.length > 0"
60
+ ref="suggestionsContainerRef"
61
+ :class="theme.suggestionsContainer()"
62
+ >
63
+ <div
64
+ v-for="(suggestion, index) in filteredSuggestions"
65
+ :key="suggestion"
66
+ :ref="(el) => setSuggestionItemRef(el, index)"
67
67
  :class="[
68
68
  theme.suggestionItem(),
69
69
  { [theme.suggestionItemActive()]: index === selectedSuggestionIndex }
70
- ]"
71
- @mousedown.prevent="selectSuggestion(suggestion, index)"
72
- @mouseenter="selectedSuggestionIndex = index"
73
- >
74
- {{ suggestion }}
75
- </div>
76
- </div>
77
- </div>
78
- </FieldWrapper>
70
+ ]"
71
+ @mousedown.prevent="selectSuggestion(suggestion, index)"
72
+ @mouseenter="selectedSuggestionIndex = index"
73
+ >
74
+ {{ suggestion }}
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </FieldWrapper>
79
79
  </template>
80
80
 
81
81
  <script setup>
@@ -85,7 +85,7 @@ import { ref, computed, nextTick, useUiConfig } from "#imports";
85
85
  import { useFieldHOC } from "#core/composables/useForm";
86
86
  import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
87
87
  import { inputTheme } from "#core/theme/input";
88
- const emits = defineEmits(["change"]);
88
+ const emits = defineEmits(["change", "selected"]);
89
89
  const props = defineProps({
90
90
  type: { type: String, required: false, default: "text" },
91
91
  leadingIcon: { type: null, required: false },
@@ -193,6 +193,7 @@ const selectSuggestion = (suggestion, index) => {
193
193
  scrollToSuggestionByIndex(index);
194
194
  }
195
195
  handleChange(suggestion);
196
+ emits("selected", suggestion);
196
197
  emits("change", suggestion);
197
198
  showSuggestions.value = false;
198
199
  selectedSuggestionIndex.value = -1;
@@ -1,8 +1,10 @@
1
1
  import type { ITextFieldProps } from '#core/components/Form/InputText/types';
2
2
  declare const _default: import("vue").DefineComponent<ITextFieldProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
3
  change: (...args: any[]) => void;
4
+ selected: (...args: any[]) => void;
4
5
  }, string, import("vue").PublicProps, Readonly<ITextFieldProps> & Readonly<{
5
6
  onChange?: ((...args: any[]) => any) | undefined;
7
+ onSelected?: ((...args: any[]) => any) | undefined;
6
8
  }>, {
7
9
  type: "text" | "password" | "email";
8
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -17,4 +17,5 @@ export interface ITextFieldProps extends IFieldProps {
17
17
  }
18
18
  export type ITextField = IFormFieldBase<INPUT_TYPES.TEXT | INPUT_TYPES.PASSWORD | INPUT_TYPES.EMAIL, ITextFieldProps, {
19
19
  change?: (value: string) => void;
20
+ selected?: (value: string) => void;
20
21
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.26.8",
3
+ "version": "2.28.0",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",