@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 +1 -0
- package/dist/module.d.ts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Form/InputText/index.vue +27 -2
- package/dist/runtime/components/Table/ColumnDate.vue +1 -1
- package/dist/runtime/components/Table/ColumnDateTime.vue +3 -15
- package/dist/runtime/core.config.d.ts +1 -0
- package/dist/runtime/core.config.mjs +1 -0
- package/dist/runtime/utils/TimeHelper.mjs +7 -1
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -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' :
|
|
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'
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
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
|
|
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>
|
|
@@ -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
|
-
|
|
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) {
|