@finema/core 1.4.39 → 1.4.41

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.d.mts CHANGED
@@ -7,6 +7,7 @@ declare const core: {
7
7
  date_time_format: string;
8
8
  time_format: string;
9
9
  is_thai_year: boolean;
10
+ is_thai_month: boolean;
10
11
  site_name: string;
11
12
  };
12
13
 
package/dist/module.d.ts CHANGED
@@ -7,6 +7,7 @@ declare const core: {
7
7
  date_time_format: string;
8
8
  time_format: string;
9
9
  is_thai_year: boolean;
10
+ is_thai_month: boolean;
10
11
  site_name: string;
11
12
  };
12
13
 
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.39",
3
+ "version": "1.4.41",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponen
2
2
  import 'lodash-es';
3
3
 
4
4
  const name = "@finema/core";
5
- const version = "1.4.39";
5
+ const version = "1.4.41";
6
6
 
7
7
  const colors = {
8
8
  black: "#20243E",
@@ -1,13 +1,38 @@
1
1
  <template>
2
2
  <FieldWrapper v-bind="wrapperProps">
3
3
  <UInput
4
+ v-if="type === 'password'"
4
5
  v-model="value"
5
6
  :disabled="wrapperProps.isDisabled"
6
7
  :leading-icon="leadingIcon"
7
8
  :trailing-icon="trailingIcon"
8
9
  :name="name"
9
10
  :placeholder="wrapperProps.placeholder"
10
- :type="isShowPassword ? 'text' : type || 'text'"
11
+ :type="isShowPassword ? 'text' : 'password'"
12
+ :autofocus="!!autoFocus"
13
+ :icon="icon"
14
+ :readonly="isReadonly"
15
+ :ui="_deepMerge({}, ui, { icon: { trailing: { pointer: '' } } })"
16
+ >
17
+ <template #trailing>
18
+ <UButton
19
+ color="gray"
20
+ variant="link"
21
+ :icon="isShowPassword ? 'i-heroicons-eye' : 'i-heroicons-eye-slash'"
22
+ :padded="false"
23
+ @click="isShowPassword = !isShowPassword"
24
+ />
25
+ </template>
26
+ </UInput>
27
+ <UInput
28
+ v-else
29
+ v-model="value"
30
+ :disabled="wrapperProps.isDisabled"
31
+ :leading-icon="leadingIcon"
32
+ :trailing-icon="trailingIcon"
33
+ :name="name"
34
+ :placeholder="wrapperProps.placeholder"
35
+ :type="type || 'text'"
11
36
  :autofocus="!!autoFocus"
12
37
  :icon="icon"
13
38
  :readonly="isReadonly"
@@ -16,7 +41,7 @@
16
41
  </FieldWrapper>
17
42
  </template>
18
43
  <script lang="ts" setup>
19
- import { ref } from '#imports'
44
+ import { _deepMerge, ref } from '#imports'
20
45
  import { type ITextFieldProps } from '#core/components/Form/InputText/types'
21
46
  import { useFieldHOC } from '#core/composables/useForm'
22
47
  import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
@@ -12,5 +12,5 @@ const props = defineProps<{
12
12
  column: IColumn
13
13
  }>()
14
14
 
15
- const getValue = computed<string>(() => TimeHelper.getDateFormTime(props.value))
15
+ const getValue = computed<string>(() => TimeHelper.displayDate(props.value))
16
16
  </script>
@@ -1,12 +1,5 @@
1
1
  <template>
2
- <p :title="`${getValue.date} ${getValue.time}`" class="flex flex-col whitespace-nowrap px-4">
3
- <span>
4
- {{ getValue.date }}
5
- </span>
6
- <span class="text-gray text-xs">
7
- {{ getValue.time }}
8
- </span>
9
- </p>
2
+ {{ getValue }}
10
3
  </template>
11
4
  <script lang="ts" setup>
12
5
  import { computed } from 'vue'
@@ -19,12 +12,7 @@ const props = defineProps<{
19
12
  column: IColumn
20
13
  }>()
21
14
 
22
- const getValue = computed<{ date: string; time: string }>(() => {
23
- return props.value
24
- ? {
25
- date: TimeHelper.getDateFormTime(props.value),
26
- time: TimeHelper.getTimeFormTime(props.value),
27
- }
28
- : { date: '-', time: '-' }
15
+ const getValue = computed(() => {
16
+ return TimeHelper.displayDateTime(props.value)
29
17
  })
30
18
  </script>
@@ -5,5 +5,6 @@ export declare const core: {
5
5
  date_time_format: string;
6
6
  time_format: string;
7
7
  is_thai_year: boolean;
8
+ is_thai_month: boolean;
8
9
  site_name: string;
9
10
  };
@@ -5,5 +5,6 @@ export const core = {
5
5
  date_time_format: "dd-MM-yyyy HH:mm",
6
6
  time_format: "HH:mm",
7
7
  is_thai_year: false,
8
+ is_thai_month: false,
8
9
  site_name: ""
9
10
  };
@@ -1,16 +1,22 @@
1
1
  import { addHours, format, formatISO, isDate, isValid, parse, subHours, addYears } from "date-fns";
2
2
  import { useCoreConfig } from "#core/composables/useConfig";
3
+ import { th } from "date-fns/locale";
3
4
  const dateFormat = useCoreConfig().date_format;
4
5
  const dateTimeFormat = useCoreConfig().date_time_format;
5
6
  const timeFormat = useCoreConfig().time_format;
6
7
  const isThaiYear = useCoreConfig().is_thai_year;
8
+ const isThaiMonth = useCoreConfig().is_thai_month;
7
9
  export class TimeHelper {
8
10
  static thaiFormat = (dateStr, formatStr) => {
9
11
  let newDateStr = dateStr;
12
+ const options = {};
10
13
  if (isThaiYear) {
11
14
  newDateStr = addYears(dateStr, 543);
12
15
  }
13
- return format(newDateStr, formatStr);
16
+ if (isThaiMonth) {
17
+ options.locale = th;
18
+ }
19
+ return format(newDateStr, formatStr, options);
14
20
  };
15
21
  static displayDate = (time) => {
16
22
  if (!time) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.39",
3
+ "version": "1.4.41",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",