@finema/core 3.12.0 → 3.13.1

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": "3.12.0",
3
+ "version": "3.13.1",
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 = "3.12.0";
7
+ const version = "3.13.1";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -1,6 +1,102 @@
1
1
  <template>
2
2
  <FieldWrapper v-bind="wrapperProps">
3
+ <Drawer
4
+ v-if="isMobile"
5
+ v-model:open="isShowModal"
6
+ >
7
+ <Input
8
+ v-if="!readMode"
9
+ :trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
10
+ type="text"
11
+ :disabled="wrapperProps.disabled"
12
+ :model-value="format(innerValue)"
13
+ :placeholder="wrapperProps.placeholder"
14
+ :readonly="true"
15
+ :ui="{
16
+ base: 'cursor-pointer select-none',
17
+ trailingIcon: 'cursor-pointer'
18
+ }"
19
+ >
20
+ <template #trailing>
21
+ <Icon
22
+ v-if="clearable && value"
23
+ :name="clearIcon"
24
+ :class="theme.clearIcon({
25
+ class: [ui?.clearIcon, 'mr-0 cursor-pointer']
26
+ })"
27
+ @click.stop="value = null"
28
+ />
29
+ </template>
30
+ </Input>
31
+ <div
32
+ v-else
33
+ class="cursor-pointer rounded-md px-2 py-1 hover:bg-gray-100"
34
+ :class="classReadMode"
35
+ >
36
+ {{ innerValue ? format(innerValue) : "None" }}
37
+ </div>
38
+
39
+ <template #content>
40
+ <Datepicker
41
+ inline
42
+ :model-value="innerValue"
43
+ :disabled="wrapperProps.disabled"
44
+ :cancel-text="appConfig.core?.locale === 'th' ? '\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01' : 'Cancel'"
45
+ :select-text="appConfig.core?.locale === 'th' ? '\u0E15\u0E01\u0E25\u0E07' : 'Select'"
46
+ :locale="appConfig.core?.locale"
47
+ :enable-time-picker="!disabledTime"
48
+ :placeholder="wrapperProps.placeholder"
49
+ :format="format"
50
+ :min-date="minDate"
51
+ :max-date="maxDate"
52
+ :min-time="minTime"
53
+ :max-time="maxTime"
54
+ :six-weeks="true"
55
+ :start-time="startTime"
56
+ :required="required"
57
+ :flow="['calendar', 'time']"
58
+ @update:model-value="onInput"
59
+ >
60
+ <template #action-row="{ internalModelValue, selectDate, closePicker }">
61
+ <div class="flex w-full items-center justify-between">
62
+ <p>
63
+ {{ format(internalModelValue) }}
64
+ </p>
65
+
66
+ <div class="flex items-center space-x-2">
67
+ <Button
68
+ color="neutral"
69
+ variant="subtle"
70
+ @click="closePicker;
71
+ isShowModal = false"
72
+ >
73
+ {{ appConfig.core?.locale === "th" ? "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01" : "Cancel" }}
74
+ </Button> <Button
75
+ @click="selectDate;
76
+ isShowModal = false"
77
+ >
78
+ {{ appConfig.core?.locale === "th" ? "\u0E15\u0E01\u0E25\u0E07" : "Select" }}
79
+ </Button>
80
+ </div>
81
+ </div>
82
+ </template>
83
+ <template
84
+ v-if="appConfig.core?.locale === 'th' && appConfig.core?.is_thai_year"
85
+ #year="{ value }"
86
+ >
87
+ {{ value + 543 }}
88
+ </template>
89
+ <template
90
+ v-if="appConfig.core?.locale === 'th' && appConfig.core?.is_thai_year"
91
+ #year-overlay-value="{ value }"
92
+ >
93
+ {{ value + 543 }}
94
+ </template>
95
+ </Datepicker>
96
+ </template>
97
+ </Drawer>
3
98
  <Datepicker
99
+ v-else
4
100
  :model-value="innerValue"
5
101
  :disabled="wrapperProps.disabled"
6
102
  :cancel-text="appConfig.core?.locale === 'th' ? '\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01' : 'Cancel'"
@@ -48,10 +144,10 @@
48
144
  />
49
145
  <div
50
146
  v-else
51
- class="cursor-pointer p-1 hover:bg-gray-100"
147
+ class="cursor-pointer rounded-md px-2 py-1 hover:bg-gray-100"
52
148
  :class="classReadMode"
53
149
  >
54
- {{ innerValue || "none" }}
150
+ {{ innerValue || "None" }}
55
151
  </div>
56
152
  </template>
57
153
  <template #clear-icon="{ clear }">
@@ -74,6 +170,7 @@ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
74
170
  import { computed, TimeHelper, useAppConfig, useFieldHOC, useUiConfig, ref, watch, onMounted } from "#imports";
75
171
  import "@vuepic/vue-datepicker/dist/main.css";
76
172
  import { dateTimeTheme } from "#core/theme/dateTime";
173
+ import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
77
174
  const emits = defineEmits(["change"]);
78
175
  const props = defineProps({
79
176
  clearIcon: { type: String, required: false, default: "ph:x-circle-fill" },
@@ -105,11 +202,14 @@ const props = defineProps({
105
202
  });
106
203
  const appConfig = useAppConfig();
107
204
  const theme = computed(() => useUiConfig(dateTimeTheme, "dateTime")());
205
+ const isShowModal = ref(false);
108
206
  const {
109
207
  value,
110
208
  wrapperProps
111
209
  } = useFieldHOC(props);
112
210
  const innerValue = ref();
211
+ const breakpoints = useBreakpoints(breakpointsTailwind);
212
+ const isMobile = breakpoints.smallerOrEqual("md");
113
213
  const initializeValue = () => {
114
214
  const currentValue = value.value;
115
215
  if (currentValue) {
@@ -137,6 +237,7 @@ const format = (date) => {
137
237
  return TimeHelper.displayDateTime(date);
138
238
  };
139
239
  const onInput = (_value) => {
240
+ console.log(_value);
140
241
  if (props.disabledTime && !props.isReturnISO) {
141
242
  value.value = TimeHelper.getDateFormTime(_value);
142
243
  } else {
@@ -145,3 +246,7 @@ const onInput = (_value) => {
145
246
  emits("change", value.value);
146
247
  };
147
248
  </script>
249
+
250
+ <style scoped>
251
+ :deep(.dp__calendar_item){display:flex;justify-content:center;text-align:center}
252
+ </style>
@@ -148,8 +148,9 @@ const onChange = (value2) => {
148
148
  showSuggestions.value = true;
149
149
  selectedSuggestionIndex.value = -1;
150
150
  }
151
- handleChange(value2);
152
- emits("change", value2);
151
+ const trimmedValue = typeof value2 === "string" ? value2.trim() : value2;
152
+ handleChange(trimmedValue);
153
+ emits("change", trimmedValue);
153
154
  };
154
155
  const filteredSuggestions = computed(() => {
155
156
  if (!props.suggestions || !value.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.12.0",
3
+ "version": "3.13.1",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -44,7 +44,7 @@
44
44
  "@iconify-json/ph": "^1.2.2",
45
45
  "@iconify-json/svg-spinners": "^1.2.2",
46
46
  "@nuxt/kit": "^4.1.3",
47
- "@nuxt/ui": "^4.4.0",
47
+ "@nuxt/ui": "^4.5.0",
48
48
  "@pinia/nuxt": "^0.11.0",
49
49
  "@tailwindcss/typography": "^0.5.0-alpha.3",
50
50
  "@tiptap/extension-text-align": "^3.18.0",
@@ -83,4 +83,4 @@
83
83
  "lint-staged": {
84
84
  "*": "eslint"
85
85
  }
86
- }
86
+ }