@finema/core 2.33.0 → 2.34.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.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -4
- package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
- package/dist/runtime/components/Form/Fields.vue +18 -13
- package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
- package/dist/runtime/components/Form/InputComponent/index.vue +1 -1
- package/dist/runtime/components/Form/InputDateTime/index.vue +52 -52
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +55 -55
- package/dist/runtime/components/Form/InputMonth/index.vue +105 -0
- package/dist/runtime/components/Form/InputMonth/index.vue.d.ts +6 -0
- package/dist/runtime/components/Form/InputMonth/types.d.ts +9 -0
- package/dist/runtime/components/Form/InputMonth/types.js +0 -0
- package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
- package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
- package/dist/runtime/components/Form/InputTime/index.vue +37 -37
- 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/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 +3 -1
- package/dist/runtime/components/Form/types.js +1 -0
- package/dist/runtime/components/Image.vue +28 -28
- package/dist/runtime/components/Log/index.vue +17 -17
- package/dist/runtime/components/Table/Base.vue +67 -67
- 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.vue +1 -1
- package/dist/runtime/components/Table/Simple.vue +20 -20
- package/dist/runtime/server/tsconfig.json +3 -3
- package/package.json +2 -2
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
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.
|
|
7
|
+
const version = "2.34.0";
|
|
8
8
|
|
|
9
9
|
const nuxtAppOptions = {
|
|
10
10
|
head: {
|
|
@@ -52,9 +52,10 @@ const core = {
|
|
|
52
52
|
limit_per_page: 30,
|
|
53
53
|
default_primary_key: "id",
|
|
54
54
|
time_format: "HH:mm",
|
|
55
|
-
date_format: "dd-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
date_format: "dd-MMM-yyyy",
|
|
56
|
+
month_format: "MMM-yyyy",
|
|
57
|
+
date_time_format: "dd-MMM-yyyy HH:mm",
|
|
58
|
+
date_format_system: "yyyy-MMM-dd",
|
|
58
59
|
date_time_format_system: "yyyy-MM-dd HH:mm",
|
|
59
60
|
is_thai_year: false,
|
|
60
61
|
is_thai_month: false,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FormField
|
|
3
|
-
:label="label"
|
|
4
|
-
:name="name"
|
|
5
|
-
:description="description"
|
|
6
|
-
:hint="hint"
|
|
7
|
-
:data-testid="name"
|
|
8
|
-
:help="help"
|
|
9
|
-
:error="errorMessage"
|
|
10
|
-
:required="!!required"
|
|
11
|
-
:ui="containerUi"
|
|
12
|
-
>
|
|
13
|
-
<slot />
|
|
14
|
-
</FormField>
|
|
2
|
+
<FormField
|
|
3
|
+
:label="label"
|
|
4
|
+
:name="name"
|
|
5
|
+
:description="description"
|
|
6
|
+
:hint="hint"
|
|
7
|
+
:data-testid="name"
|
|
8
|
+
:help="help"
|
|
9
|
+
:error="errorMessage"
|
|
10
|
+
:required="!!required"
|
|
11
|
+
:ui="containerUi"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</FormField>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script setup>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
3
|
:class="[theme.base({
|
|
4
4
|
class: [$props.class, ui?.base]
|
|
5
|
-
})]"
|
|
6
|
-
>
|
|
7
|
-
<component
|
|
8
|
-
:is="componentMap[option.type]?.component"
|
|
9
|
-
v-for="option in options.filter((item) => !item.isHide)"
|
|
10
|
-
:key="option.props.name"
|
|
11
|
-
:class="option.class"
|
|
12
|
-
:form="form"
|
|
5
|
+
})]"
|
|
6
|
+
>
|
|
7
|
+
<component
|
|
8
|
+
:is="componentMap[option.type]?.component"
|
|
9
|
+
v-for="option in options.filter((item) => !item.isHide)"
|
|
10
|
+
:key="option.props.name"
|
|
11
|
+
:class="option.class"
|
|
12
|
+
:form="form"
|
|
13
13
|
v-bind="{
|
|
14
14
|
...getFieldBinding(option),
|
|
15
15
|
...componentMap[option.type]?.props
|
|
16
|
-
}"
|
|
17
|
-
v-on="option.on ?? {}"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
16
|
+
}"
|
|
17
|
+
v-on="option.on ?? {}"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script setup>
|
|
@@ -33,6 +33,7 @@ import FormInputComponent from "./InputComponent/index.vue";
|
|
|
33
33
|
import FormInputRadio from "./InputRadio/index.vue";
|
|
34
34
|
import FormInputDateTime from "./InputDateTime/index.vue";
|
|
35
35
|
import FormInputTime from "./InputTime/index.vue";
|
|
36
|
+
import FormInputMonth from "./InputMonth/index.vue";
|
|
36
37
|
import FormInputDateTimeRange from "./InputDateTimeRange/index.vue";
|
|
37
38
|
import FormInputUploadDropzoneAuto from "./InputUploadDropzoneAuto/index.vue";
|
|
38
39
|
import FormInputUploadDropzone from "./InputUploadDropzone/index.vue";
|
|
@@ -118,6 +119,10 @@ const componentMap = {
|
|
|
118
119
|
disabledTime: true
|
|
119
120
|
}
|
|
120
121
|
},
|
|
122
|
+
[INPUT_TYPES.MONTH]: {
|
|
123
|
+
component: FormInputMonth,
|
|
124
|
+
props: {}
|
|
125
|
+
},
|
|
121
126
|
[INPUT_TYPES.DATE_RANGE]: {
|
|
122
127
|
component: FormInputDateTimeRange,
|
|
123
128
|
props: {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper
|
|
3
|
-
v-bind="wrapperProps"
|
|
4
|
-
label=""
|
|
5
|
-
description=""
|
|
6
|
-
>
|
|
7
|
-
<Checkbox
|
|
8
|
-
:model-value="value"
|
|
9
|
-
:disabled="wrapperProps.disabled"
|
|
10
|
-
:name="name"
|
|
11
|
-
:label="label"
|
|
12
|
-
:description="description"
|
|
13
|
-
:required="required"
|
|
14
|
-
:variant="variant"
|
|
15
|
-
:indicator="indicator"
|
|
16
|
-
:ui="ui"
|
|
17
|
-
@update:modelValue="onChange"
|
|
18
|
-
/>
|
|
19
|
-
</FieldWrapper>
|
|
2
|
+
<FieldWrapper
|
|
3
|
+
v-bind="wrapperProps"
|
|
4
|
+
label=""
|
|
5
|
+
description=""
|
|
6
|
+
>
|
|
7
|
+
<Checkbox
|
|
8
|
+
:model-value="value"
|
|
9
|
+
:disabled="wrapperProps.disabled"
|
|
10
|
+
:name="name"
|
|
11
|
+
:label="label"
|
|
12
|
+
:description="description"
|
|
13
|
+
:required="required"
|
|
14
|
+
:variant="variant"
|
|
15
|
+
:indicator="indicator"
|
|
16
|
+
:ui="ui"
|
|
17
|
+
@update:modelValue="onChange"
|
|
18
|
+
/>
|
|
19
|
+
</FieldWrapper>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script setup>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<Datepicker
|
|
4
|
-
:teleport="true"
|
|
5
|
-
:model-value="innerValue"
|
|
6
|
-
:disabled="wrapperProps.disabled"
|
|
7
|
-
cancel-text="ยกเลิก"
|
|
8
|
-
select-text="เลือก"
|
|
9
|
-
locale="th"
|
|
10
|
-
:enable-time-picker="!disabledTime"
|
|
11
|
-
:placeholder="wrapperProps.placeholder"
|
|
12
|
-
:format="format"
|
|
13
|
-
:min-date="minDate"
|
|
14
|
-
:max-date="maxDate"
|
|
15
|
-
:min-time="minTime"
|
|
16
|
-
:max-time="maxTime"
|
|
17
|
-
:start-time="startTime"
|
|
18
|
-
:required="required"
|
|
19
|
-
:flow="['calendar', 'time']"
|
|
20
|
-
@update:model-value="onInput"
|
|
21
|
-
>
|
|
22
|
-
<template
|
|
23
|
-
v-if="appConfig.core?.is_thai_year"
|
|
24
|
-
#year="{ value }"
|
|
25
|
-
>
|
|
26
|
-
{{ value + 543 }}
|
|
27
|
-
</template>
|
|
28
|
-
<template
|
|
29
|
-
v-if="appConfig.core?.is_thai_year"
|
|
30
|
-
#year-overlay-value="{ value }"
|
|
31
|
-
>
|
|
32
|
-
{{ value + 543 }}
|
|
33
|
-
</template>
|
|
34
|
-
<template #dp-input="{ value: innerValue }">
|
|
35
|
-
<Input
|
|
36
|
-
:trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
|
|
37
|
-
type="text"
|
|
38
|
-
:disabled="wrapperProps.disabled"
|
|
39
|
-
:model-value="innerValue"
|
|
40
|
-
:placeholder="wrapperProps.placeholder"
|
|
41
|
-
:readonly="true"
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<Datepicker
|
|
4
|
+
:teleport="true"
|
|
5
|
+
:model-value="innerValue"
|
|
6
|
+
:disabled="wrapperProps.disabled"
|
|
7
|
+
cancel-text="ยกเลิก"
|
|
8
|
+
select-text="เลือก"
|
|
9
|
+
locale="th"
|
|
10
|
+
:enable-time-picker="!disabledTime"
|
|
11
|
+
:placeholder="wrapperProps.placeholder"
|
|
12
|
+
:format="format"
|
|
13
|
+
:min-date="minDate"
|
|
14
|
+
:max-date="maxDate"
|
|
15
|
+
:min-time="minTime"
|
|
16
|
+
:max-time="maxTime"
|
|
17
|
+
:start-time="startTime"
|
|
18
|
+
:required="required"
|
|
19
|
+
:flow="['calendar', 'time']"
|
|
20
|
+
@update:model-value="onInput"
|
|
21
|
+
>
|
|
22
|
+
<template
|
|
23
|
+
v-if="appConfig.core?.is_thai_year"
|
|
24
|
+
#year="{ value }"
|
|
25
|
+
>
|
|
26
|
+
{{ value + 543 }}
|
|
27
|
+
</template>
|
|
28
|
+
<template
|
|
29
|
+
v-if="appConfig.core?.is_thai_year"
|
|
30
|
+
#year-overlay-value="{ value }"
|
|
31
|
+
>
|
|
32
|
+
{{ value + 543 }}
|
|
33
|
+
</template>
|
|
34
|
+
<template #dp-input="{ value: innerValue }">
|
|
35
|
+
<Input
|
|
36
|
+
:trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
|
|
37
|
+
type="text"
|
|
38
|
+
:disabled="wrapperProps.disabled"
|
|
39
|
+
:model-value="innerValue"
|
|
40
|
+
:placeholder="wrapperProps.placeholder"
|
|
41
|
+
:readonly="true"
|
|
42
42
|
:ui="{
|
|
43
43
|
base: 'cursor-pointer select-none',
|
|
44
44
|
trailingIcon: 'cursor-pointer'
|
|
45
|
-
}"
|
|
46
|
-
/>
|
|
47
|
-
</template>
|
|
48
|
-
<template #clear-icon="{ clear }">
|
|
49
|
-
<Icon
|
|
50
|
-
:name="clearIcon"
|
|
45
|
+
}"
|
|
46
|
+
/>
|
|
47
|
+
</template>
|
|
48
|
+
<template #clear-icon="{ clear }">
|
|
49
|
+
<Icon
|
|
50
|
+
:name="clearIcon"
|
|
51
51
|
:class="theme.clearIcon({
|
|
52
52
|
class: [ui?.clearIcon]
|
|
53
|
-
})"
|
|
54
|
-
@click.stop="clear"
|
|
55
|
-
/>
|
|
56
|
-
</template>
|
|
57
|
-
</Datepicker>
|
|
58
|
-
</FieldWrapper>
|
|
53
|
+
})"
|
|
54
|
+
@click.stop="clear"
|
|
55
|
+
/>
|
|
56
|
+
</template>
|
|
57
|
+
</Datepicker>
|
|
58
|
+
</FieldWrapper>
|
|
59
59
|
</template>
|
|
60
60
|
|
|
61
61
|
<script setup>
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<Datepicker
|
|
4
|
-
ref="datepicker"
|
|
5
|
-
v-model="innerValueRef"
|
|
6
|
-
:teleport="true"
|
|
7
|
-
:disabled="wrapperProps.disabled"
|
|
8
|
-
cancel-text="ยกเลิก"
|
|
9
|
-
select-text="เลือก"
|
|
10
|
-
locale="th"
|
|
11
|
-
:format="format"
|
|
12
|
-
:enable-time-picker="!disabledTime"
|
|
13
|
-
:placeholder="wrapperProps.placeholder"
|
|
14
|
-
:min-date="minDate"
|
|
15
|
-
:max-date="maxDate"
|
|
16
|
-
:min-time="minTime"
|
|
17
|
-
:max-time="maxTime"
|
|
18
|
-
:start-time="startTime"
|
|
19
|
-
:multi-calendars="!isDisabledMultiCalendar"
|
|
20
|
-
:required="required"
|
|
21
|
-
time-picker-inline
|
|
22
|
-
range
|
|
23
|
-
:flow="['calendar', 'time']"
|
|
24
|
-
@update:model-value="onInput"
|
|
25
|
-
>
|
|
26
|
-
<template
|
|
27
|
-
v-if="appConfig.core?.is_thai_year"
|
|
28
|
-
#year="{ value }"
|
|
29
|
-
>
|
|
30
|
-
{{ value + 543 }}
|
|
31
|
-
</template>
|
|
32
|
-
<template
|
|
33
|
-
v-if="appConfig.core?.is_thai_year"
|
|
34
|
-
#year-overlay-value="{ value }"
|
|
35
|
-
>
|
|
36
|
-
{{ value + 543 }}
|
|
37
|
-
</template>
|
|
38
|
-
<template #dp-input="{ value: innerValue }">
|
|
39
|
-
<Input
|
|
40
|
-
:trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
|
|
41
|
-
type="text"
|
|
42
|
-
:model-value="innerValue"
|
|
43
|
-
:placeholder="wrapperProps.placeholder"
|
|
44
|
-
:readonly="true"
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<Datepicker
|
|
4
|
+
ref="datepicker"
|
|
5
|
+
v-model="innerValueRef"
|
|
6
|
+
:teleport="true"
|
|
7
|
+
:disabled="wrapperProps.disabled"
|
|
8
|
+
cancel-text="ยกเลิก"
|
|
9
|
+
select-text="เลือก"
|
|
10
|
+
locale="th"
|
|
11
|
+
:format="format"
|
|
12
|
+
:enable-time-picker="!disabledTime"
|
|
13
|
+
:placeholder="wrapperProps.placeholder"
|
|
14
|
+
:min-date="minDate"
|
|
15
|
+
:max-date="maxDate"
|
|
16
|
+
:min-time="minTime"
|
|
17
|
+
:max-time="maxTime"
|
|
18
|
+
:start-time="startTime"
|
|
19
|
+
:multi-calendars="!isDisabledMultiCalendar"
|
|
20
|
+
:required="required"
|
|
21
|
+
time-picker-inline
|
|
22
|
+
range
|
|
23
|
+
:flow="['calendar', 'time']"
|
|
24
|
+
@update:model-value="onInput"
|
|
25
|
+
>
|
|
26
|
+
<template
|
|
27
|
+
v-if="appConfig.core?.is_thai_year"
|
|
28
|
+
#year="{ value }"
|
|
29
|
+
>
|
|
30
|
+
{{ value + 543 }}
|
|
31
|
+
</template>
|
|
32
|
+
<template
|
|
33
|
+
v-if="appConfig.core?.is_thai_year"
|
|
34
|
+
#year-overlay-value="{ value }"
|
|
35
|
+
>
|
|
36
|
+
{{ value + 543 }}
|
|
37
|
+
</template>
|
|
38
|
+
<template #dp-input="{ value: innerValue }">
|
|
39
|
+
<Input
|
|
40
|
+
:trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
|
|
41
|
+
type="text"
|
|
42
|
+
:model-value="innerValue"
|
|
43
|
+
:placeholder="wrapperProps.placeholder"
|
|
44
|
+
:readonly="true"
|
|
45
45
|
:ui="{
|
|
46
46
|
base: 'cursor-pointer select-none',
|
|
47
47
|
trailingIcon: 'cursor-pointer'
|
|
48
|
-
}"
|
|
49
|
-
/>
|
|
50
|
-
</template>
|
|
51
|
-
<template #clear-icon="{ clear }">
|
|
52
|
-
<Icon
|
|
53
|
-
:name="clearIcon"
|
|
48
|
+
}"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
51
|
+
<template #clear-icon="{ clear }">
|
|
52
|
+
<Icon
|
|
53
|
+
:name="clearIcon"
|
|
54
54
|
:class="theme.clearIcon({
|
|
55
55
|
class: [ui?.clearIcon]
|
|
56
|
-
})"
|
|
57
|
-
@click.stop="clear"
|
|
58
|
-
/>
|
|
59
|
-
</template>
|
|
60
|
-
</Datepicker>
|
|
61
|
-
</FieldWrapper>
|
|
56
|
+
})"
|
|
57
|
+
@click.stop="clear"
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
</Datepicker>
|
|
61
|
+
</FieldWrapper>
|
|
62
62
|
</template>
|
|
63
63
|
|
|
64
64
|
<script setup>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<Datepicker
|
|
4
|
+
v-model="value"
|
|
5
|
+
:teleport="true"
|
|
6
|
+
:disabled="wrapperProps.disabled"
|
|
7
|
+
cancel-text="ยกเลิก"
|
|
8
|
+
select-text="เลือก"
|
|
9
|
+
locale="th"
|
|
10
|
+
:format="appConfig.core?.month_format"
|
|
11
|
+
month-picker
|
|
12
|
+
:placeholder="wrapperProps.placeholder"
|
|
13
|
+
:min-date="minDate"
|
|
14
|
+
:max-date="maxDate"
|
|
15
|
+
:required="wrapperProps.required"
|
|
16
|
+
:clearable="true"
|
|
17
|
+
:always-clearable="true"
|
|
18
|
+
>
|
|
19
|
+
<template
|
|
20
|
+
v-if="appConfig.core?.is_thai_year"
|
|
21
|
+
#year="{ year }"
|
|
22
|
+
>
|
|
23
|
+
{{ year + 543 }}
|
|
24
|
+
</template>
|
|
25
|
+
<template
|
|
26
|
+
v-if="appConfig.core?.is_thai_year"
|
|
27
|
+
#year-overlay-value="{ value }"
|
|
28
|
+
>
|
|
29
|
+
{{ value + 543 }}
|
|
30
|
+
</template>
|
|
31
|
+
<template #dp-input>
|
|
32
|
+
<Input
|
|
33
|
+
:trailing-icon="!wrapperProps.required && value ? void 0 : 'i-heroicons-calendar-days'"
|
|
34
|
+
type="text"
|
|
35
|
+
:disabled="wrapperProps.disabled"
|
|
36
|
+
:model-value="formatDisplay(value)"
|
|
37
|
+
:placeholder="wrapperProps.placeholder"
|
|
38
|
+
:readonly="true"
|
|
39
|
+
:ui="{
|
|
40
|
+
base: 'cursor-pointer select-none',
|
|
41
|
+
trailingIcon: 'cursor-pointer'
|
|
42
|
+
}"
|
|
43
|
+
/>
|
|
44
|
+
</template>
|
|
45
|
+
<template #clear-icon="{ clear }">
|
|
46
|
+
<Icon
|
|
47
|
+
v-if="value && !wrapperProps.disabled && !wrapperProps.required"
|
|
48
|
+
:name="clearIcon"
|
|
49
|
+
:class="theme.clearIcon({
|
|
50
|
+
class: [ui?.clearIcon]
|
|
51
|
+
})"
|
|
52
|
+
@click.stop="clear"
|
|
53
|
+
/>
|
|
54
|
+
</template>
|
|
55
|
+
</Datepicker>
|
|
56
|
+
</FieldWrapper>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup>
|
|
60
|
+
import Datepicker from "@vuepic/vue-datepicker";
|
|
61
|
+
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
62
|
+
import { computed, useAppConfig, useFieldHOC, useUiConfig } from "#imports";
|
|
63
|
+
import "@vuepic/vue-datepicker/dist/main.css";
|
|
64
|
+
import { dateTimeTheme } from "#core/theme/dateTime";
|
|
65
|
+
import { format } from "date-fns-tz";
|
|
66
|
+
import * as locales from "date-fns/locale";
|
|
67
|
+
import { addYears } from "date-fns";
|
|
68
|
+
const props = defineProps({
|
|
69
|
+
clearIcon: { type: String, required: false, default: "ph:x-circle-fill" },
|
|
70
|
+
minDate: { type: [Date, String], required: false },
|
|
71
|
+
maxDate: { type: [Date, String], required: false },
|
|
72
|
+
form: { type: Object, required: false },
|
|
73
|
+
name: { type: String, required: true },
|
|
74
|
+
errorMessage: { type: String, required: false },
|
|
75
|
+
label: { type: null, required: false },
|
|
76
|
+
description: { type: String, required: false },
|
|
77
|
+
hint: { type: String, required: false },
|
|
78
|
+
rules: { type: null, required: false },
|
|
79
|
+
autoFocus: { type: Boolean, required: false },
|
|
80
|
+
placeholder: { type: String, required: false },
|
|
81
|
+
disabled: { type: Boolean, required: false },
|
|
82
|
+
readonly: { type: Boolean, required: false },
|
|
83
|
+
required: { type: Boolean, required: false },
|
|
84
|
+
help: { type: String, required: false },
|
|
85
|
+
ui: { type: null, required: false }
|
|
86
|
+
});
|
|
87
|
+
const appConfig = useAppConfig();
|
|
88
|
+
const theme = computed(() => useUiConfig(dateTimeTheme, "dateTime")());
|
|
89
|
+
const {
|
|
90
|
+
value,
|
|
91
|
+
wrapperProps
|
|
92
|
+
} = useFieldHOC(props);
|
|
93
|
+
const formatDisplay = (date) => {
|
|
94
|
+
if (!date) return "";
|
|
95
|
+
let newDateStr = new Date(date.year, date.month);
|
|
96
|
+
const options = {};
|
|
97
|
+
if (appConfig.core?.is_thai_year) {
|
|
98
|
+
newDateStr = addYears(newDateStr, 543);
|
|
99
|
+
}
|
|
100
|
+
if (appConfig.core?.is_thai_month) {
|
|
101
|
+
options.locale = locales.th;
|
|
102
|
+
}
|
|
103
|
+
return format(newDateStr, appConfig.core?.month_format, options);
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '@vuepic/vue-datepicker/dist/main.css';
|
|
2
|
+
import type { IMonthFieldProps } from '#core/components/Form/InputMonth/types';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<IMonthFieldProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IMonthFieldProps> & Readonly<{}>, {
|
|
4
|
+
clearIcon: string;
|
|
5
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
|
|
2
|
+
export interface IMonthFieldProps extends IFieldProps {
|
|
3
|
+
clearIcon?: string;
|
|
4
|
+
minDate?: Date | string;
|
|
5
|
+
maxDate?: Date | string;
|
|
6
|
+
}
|
|
7
|
+
export type IMonthField = IFormFieldBase<INPUT_TYPES.MONTH, IMonthFieldProps, {
|
|
8
|
+
change: (value: string) => void;
|
|
9
|
+
}>;
|
|
File without changes
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<InputNumber
|
|
4
|
-
:model-value="value"
|
|
5
|
-
:disabled="wrapperProps.disabled"
|
|
6
|
-
:name="name"
|
|
7
|
-
:placeholder="wrapperProps.placeholder"
|
|
8
|
-
:autofocus="!!autoFocus"
|
|
9
|
-
:readonly="readonly"
|
|
10
|
-
:orientation="orientation"
|
|
11
|
-
:increment-disabled="incrementDisabled"
|
|
12
|
-
:decrement-disabled="decrementDisabled"
|
|
13
|
-
:min="min"
|
|
14
|
-
:max="max"
|
|
15
|
-
:step="step"
|
|
16
|
-
:disable-wheel-change="disableWheelChange"
|
|
17
|
-
:format-options="formatOptions"
|
|
18
|
-
:ui="ui"
|
|
19
|
-
@update:model-value="onChange"
|
|
20
|
-
/>
|
|
21
|
-
</FieldWrapper>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<InputNumber
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:disabled="wrapperProps.disabled"
|
|
6
|
+
:name="name"
|
|
7
|
+
:placeholder="wrapperProps.placeholder"
|
|
8
|
+
:autofocus="!!autoFocus"
|
|
9
|
+
:readonly="readonly"
|
|
10
|
+
:orientation="orientation"
|
|
11
|
+
:increment-disabled="incrementDisabled"
|
|
12
|
+
:decrement-disabled="decrementDisabled"
|
|
13
|
+
:min="min"
|
|
14
|
+
:max="max"
|
|
15
|
+
:step="step"
|
|
16
|
+
:disable-wheel-change="disableWheelChange"
|
|
17
|
+
:format-options="formatOptions"
|
|
18
|
+
:ui="ui"
|
|
19
|
+
@update:model-value="onChange"
|
|
20
|
+
/>
|
|
21
|
+
</FieldWrapper>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script setup>
|