@finema/core 3.22.0 → 3.24.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/README.md +22 -2
- package/dist/module.d.mts +2 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +18 -15
- package/dist/runtime/components/App.vue +1 -1
- package/dist/runtime/components/DevToolsWindow/index.vue +24 -26
- package/dist/runtime/components/Dialog/index.d.vue.ts +1 -4
- package/dist/runtime/components/Dialog/index.vue +17 -17
- package/dist/runtime/components/Dialog/index.vue.d.ts +1 -4
- package/dist/runtime/components/Empty.d.vue.ts +1 -2
- package/dist/runtime/components/Empty.vue +19 -11
- package/dist/runtime/components/Empty.vue.d.ts +1 -2
- package/dist/runtime/components/FlexDeck/index.vue +21 -23
- package/dist/runtime/components/Form/FieldWrapper.vue +1 -1
- package/dist/runtime/components/Form/Fields.d.vue.ts +1 -1
- package/dist/runtime/components/Form/Fields.vue +26 -20
- package/dist/runtime/components/Form/Fields.vue.d.ts +1 -1
- package/dist/runtime/components/Form/InputCheckbox/index.vue +3 -6
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +3 -6
- package/dist/runtime/components/Form/InputComponent/index.vue +2 -1
- package/dist/runtime/components/Form/InputCurrency/index.vue +11 -11
- package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +3 -1
- package/dist/runtime/components/Form/InputDateTime/index.vue +12 -17
- package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +1 -1
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +28 -20
- package/dist/runtime/components/Form/InputMonth/index.vue +14 -12
- package/dist/runtime/components/Form/InputMonth/types.d.ts +1 -1
- package/dist/runtime/components/Form/InputNumber/index.vue +3 -6
- package/dist/runtime/components/Form/InputRadio/index.vue +3 -6
- package/dist/runtime/components/Form/InputRating/index.vue +3 -6
- package/dist/runtime/components/Form/InputSearch/index.vue +6 -7
- package/dist/runtime/components/Form/InputSelect/index.vue +6 -15
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +7 -18
- package/dist/runtime/components/Form/InputTags/index.vue +3 -6
- package/dist/runtime/components/Form/InputText/index.vue +41 -51
- package/dist/runtime/components/Form/InputTextarea/index.vue +3 -6
- package/dist/runtime/components/Form/InputTime/index.vue +32 -27
- package/dist/runtime/components/Form/InputTime/types.d.ts +1 -1
- package/dist/runtime/components/Form/InputToggle/index.vue +3 -5
- package/dist/runtime/components/Form/InputUploadDropzone/index.d.vue.ts +1 -4
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +25 -23
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue.d.ts +1 -4
- package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +2 -2
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.d.vue.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +22 -23
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue.d.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.d.vue.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +26 -24
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue.d.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +1 -6
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +22 -23
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +1 -6
- package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImagePasteExtension.js +7 -6
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.js +13 -12
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +3 -1
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +20 -22
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +140 -118
- package/dist/runtime/components/Form/fileState/EmptyState.vue +1 -1
- package/dist/runtime/components/Form/fileState/FailedState.vue +4 -2
- package/dist/runtime/components/Form/fileState/MultipleFilesState.d.vue.ts +4 -4
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +5 -5
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue.d.ts +4 -4
- package/dist/runtime/components/Form/fileState/SuccessState.d.vue.ts +2 -2
- package/dist/runtime/components/Form/fileState/SuccessState.vue +8 -13
- package/dist/runtime/components/Form/fileState/SuccessState.vue.d.ts +2 -2
- package/dist/runtime/components/Form/fileState/useFilePicker.d.ts +34 -0
- package/dist/runtime/components/Form/fileState/useFilePicker.js +48 -0
- package/dist/runtime/components/Form/fileState/useFileState.d.ts +7 -9
- package/dist/runtime/components/Form/fileState/useFileState.js +32 -120
- package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +7 -8
- package/dist/runtime/components/Form/fileState/useUploadImageState.js +27 -301
- package/dist/runtime/components/Form/fileState/useUploadState.d.ts +11 -7
- package/dist/runtime/components/Form/fileState/useUploadState.js +52 -136
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.d.ts +12 -18
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.js +88 -226
- package/dist/runtime/components/Form/types.d.ts +2 -0
- package/dist/runtime/components/Image.vue +4 -10
- package/dist/runtime/components/Loader.d.vue.ts +2 -1
- package/dist/runtime/components/Loader.vue +10 -7
- package/dist/runtime/components/Loader.vue.d.ts +2 -1
- package/dist/runtime/components/Log/LogItem.vue +1 -3
- package/dist/runtime/components/Log/index.vue +1 -3
- package/dist/runtime/components/Table/Base.d.vue.ts +15 -1
- package/dist/runtime/components/Table/Base.vue +9 -29
- package/dist/runtime/components/Table/Base.vue.d.ts +15 -1
- package/dist/runtime/components/Table/ColumnText.d.vue.ts +2 -3
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/ColumnText.vue.d.ts +2 -3
- package/dist/runtime/components/Table/Pagination.vue +19 -22
- package/dist/runtime/components/Table/index.d.vue.ts +1 -1
- package/dist/runtime/components/Table/index.vue +5 -7
- package/dist/runtime/components/Table/index.vue.d.ts +1 -1
- package/dist/runtime/composables/loaderList.d.ts +2 -1
- package/dist/runtime/composables/loaderList.js +3 -4
- package/dist/runtime/composables/loaderObject.d.ts +2 -1
- package/dist/runtime/composables/loaderObject.js +2 -1
- package/dist/runtime/composables/loaderPage.js +223 -350
- package/dist/runtime/composables/useConfig.js +4 -3
- package/dist/runtime/composables/useDialog.js +3 -1
- package/dist/runtime/composables/useForm.d.ts +2 -2
- package/dist/runtime/composables/useForm.js +2 -4
- package/dist/runtime/composables/useMessages.d.ts +10 -0
- package/dist/runtime/composables/useMessages.js +10 -0
- package/dist/runtime/composables/useTable.js +2 -14
- package/dist/runtime/helpers/apiBaseHelper.js +6 -24
- package/dist/runtime/helpers/apiListHelper.js +2 -5
- package/dist/runtime/helpers/apiObjectHelper.js +2 -5
- package/dist/runtime/helpers/apiPageHelper.d.ts +0 -1
- package/dist/runtime/helpers/apiPageHelper.js +19 -38
- package/dist/runtime/helpers/componentHelper.js +2 -6
- package/dist/runtime/helpers/uploadCore.d.ts +54 -0
- package/dist/runtime/helpers/uploadCore.js +81 -0
- package/dist/runtime/i18n/valibot.d.ts +5 -68
- package/dist/runtime/i18n/valibot.js +33 -29
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +42 -0
- package/dist/runtime/locale/index.d.ts +7 -0
- package/dist/runtime/locale/index.js +5 -0
- package/dist/runtime/locale/th.d.ts +43 -0
- package/dist/runtime/locale/th.js +42 -0
- package/dist/runtime/server/tsconfig.json +1 -1
- package/dist/runtime/styles/main.css +1 -1
- package/dist/runtime/utils/ParamHelper.js +1 -1
- package/dist/runtime/utils/StringHelper.js +1 -4
- package/dist/runtime/utils/TimeHelper.js +2 -2
- package/dist/runtime/utils/lodash.js +2 -2
- package/package.json +57 -36
|
@@ -45,13 +45,10 @@ const props = defineProps({
|
|
|
45
45
|
readonly: { type: Boolean, required: false },
|
|
46
46
|
required: { type: Boolean, required: false },
|
|
47
47
|
help: { type: String, required: false },
|
|
48
|
-
ui: { type: null, required: false }
|
|
48
|
+
ui: { type: null, required: false },
|
|
49
|
+
containerUi: { type: null, required: false }
|
|
49
50
|
});
|
|
50
|
-
const {
|
|
51
|
-
value,
|
|
52
|
-
wrapperProps,
|
|
53
|
-
handleChange
|
|
54
|
-
} = useFieldHOC(props);
|
|
51
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
55
52
|
const onChange = (value2) => {
|
|
56
53
|
handleChange(value2);
|
|
57
54
|
emits("change", value2);
|
|
@@ -21,6 +21,7 @@ const props = defineProps({
|
|
|
21
21
|
readonly: { type: Boolean, required: false },
|
|
22
22
|
required: { type: Boolean, required: false },
|
|
23
23
|
help: { type: String, required: false },
|
|
24
|
-
ui: { type: null, required: false }
|
|
24
|
+
ui: { type: null, required: false },
|
|
25
|
+
containerUi: { type: null, required: false }
|
|
25
26
|
});
|
|
26
27
|
</script>
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
:error-message="undefined"
|
|
5
5
|
>
|
|
6
6
|
<div
|
|
7
|
-
:class="[
|
|
8
|
-
'ring-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
:class="[
|
|
8
|
+
'inline-flex w-full items-center -space-x-px rounded-lg ring-1',
|
|
9
|
+
{
|
|
10
|
+
'ring-error': wrapperProps.errorMessage,
|
|
11
|
+
'ring-gray-300': !wrapperProps.errorMessage
|
|
12
|
+
}
|
|
13
|
+
]"
|
|
11
14
|
>
|
|
12
15
|
<p class="pl-3 text-lg">
|
|
13
16
|
{{ currencySymbol }}
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
</div>
|
|
47
50
|
<p
|
|
48
51
|
v-if="wrapperProps.errorMessage"
|
|
49
|
-
class="text-error
|
|
52
|
+
class="mt-2 text-error"
|
|
50
53
|
>
|
|
51
54
|
{{ wrapperProps.errorMessage }}
|
|
52
55
|
</p>
|
|
@@ -90,13 +93,10 @@ const props = defineProps({
|
|
|
90
93
|
readonly: { type: Boolean, required: false },
|
|
91
94
|
required: { type: Boolean, required: false },
|
|
92
95
|
help: { type: String, required: false },
|
|
93
|
-
ui: { type: null, required: false }
|
|
96
|
+
ui: { type: null, required: false },
|
|
97
|
+
containerUi: { type: null, required: false }
|
|
94
98
|
});
|
|
95
|
-
const {
|
|
96
|
-
value,
|
|
97
|
-
wrapperProps,
|
|
98
|
-
handleChange
|
|
99
|
-
} = useFieldHOC(props);
|
|
99
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
100
100
|
const currencySymbol = computed(() => props.options.find((item) => item.value === value.value.currency)?.symbol);
|
|
101
101
|
const updateValue = (payload) => {
|
|
102
102
|
const newValue = {
|
|
@@ -9,6 +9,8 @@ export interface IDateTimeFieldProps extends IFieldProps {
|
|
|
9
9
|
disabledTime?: boolean;
|
|
10
10
|
minDate?: Date | string;
|
|
11
11
|
maxDate?: Date | string;
|
|
12
|
+
startDate?: Date | string;
|
|
13
|
+
focusStartDate?: boolean;
|
|
12
14
|
startTime?: ITimeOption;
|
|
13
15
|
minTime?: ITimeOption;
|
|
14
16
|
maxTime?: ITimeOption;
|
|
@@ -20,5 +22,5 @@ export interface IDateTimeFieldProps extends IFieldProps {
|
|
|
20
22
|
autoApply?: boolean;
|
|
21
23
|
}
|
|
22
24
|
export type IDateTimeField = IFormFieldBase<INPUT_TYPES.DATE_TIME | INPUT_TYPES.DATE, IDateTimeFieldProps, {
|
|
23
|
-
change
|
|
25
|
+
change?: (value: string) => void;
|
|
24
26
|
}>;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<Datepicker
|
|
4
4
|
:model-value="innerValue"
|
|
5
5
|
:disabled="wrapperProps.disabled"
|
|
6
|
-
:cancel-text="
|
|
7
|
-
:select-text="
|
|
6
|
+
:cancel-text="messages.common.cancel"
|
|
7
|
+
:select-text="messages.common.select"
|
|
8
8
|
:locale="appConfig.core?.locale"
|
|
9
9
|
:enable-time-picker="!disabledTime"
|
|
10
10
|
:auto-apply="autoApply && disabledTime"
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
:max-time="maxTime"
|
|
17
17
|
:six-weeks="true"
|
|
18
18
|
:start-time="startTime"
|
|
19
|
+
:start-date="startDate"
|
|
20
|
+
:focus-start-date="focusStartDate"
|
|
19
21
|
:teleport="teleport"
|
|
20
22
|
:required="required"
|
|
21
23
|
:flow="flowCalendar"
|
|
@@ -72,18 +74,10 @@
|
|
|
72
74
|
</template>
|
|
73
75
|
|
|
74
76
|
<script setup>
|
|
77
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
75
78
|
import Datepicker from "@vuepic/vue-datepicker";
|
|
76
79
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
77
|
-
import {
|
|
78
|
-
computed,
|
|
79
|
-
TimeHelper,
|
|
80
|
-
useAppConfig,
|
|
81
|
-
useFieldHOC,
|
|
82
|
-
useUiConfig,
|
|
83
|
-
ref,
|
|
84
|
-
watch,
|
|
85
|
-
onMounted
|
|
86
|
-
} from "#imports";
|
|
80
|
+
import { computed, TimeHelper, useAppConfig, useFieldHOC, useUiConfig, ref, watch, onMounted } from "#imports";
|
|
87
81
|
import "@vuepic/vue-datepicker/dist/main.css";
|
|
88
82
|
import { dateTimeTheme } from "#core/theme/dateTime";
|
|
89
83
|
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
|
|
@@ -93,6 +87,8 @@ const props = defineProps({
|
|
|
93
87
|
disabledTime: { type: Boolean, required: false },
|
|
94
88
|
minDate: { type: [Date, String], required: false },
|
|
95
89
|
maxDate: { type: [Date, String], required: false },
|
|
90
|
+
startDate: { type: [Date, String], required: false },
|
|
91
|
+
focusStartDate: { type: Boolean, required: false },
|
|
96
92
|
startTime: { type: Object, required: false },
|
|
97
93
|
minTime: { type: Object, required: false },
|
|
98
94
|
maxTime: { type: Object, required: false },
|
|
@@ -115,15 +111,13 @@ const props = defineProps({
|
|
|
115
111
|
readonly: { type: Boolean, required: false },
|
|
116
112
|
required: { type: Boolean, required: false },
|
|
117
113
|
help: { type: String, required: false },
|
|
118
|
-
ui: { type: null, required: false }
|
|
114
|
+
ui: { type: null, required: false },
|
|
115
|
+
containerUi: { type: null, required: false }
|
|
119
116
|
});
|
|
120
117
|
const appConfig = useAppConfig();
|
|
121
118
|
const theme = computed(() => useUiConfig(dateTimeTheme, "dateTime")());
|
|
122
119
|
const isShowModal = ref(false);
|
|
123
|
-
const {
|
|
124
|
-
value,
|
|
125
|
-
wrapperProps
|
|
126
|
-
} = useFieldHOC(props);
|
|
120
|
+
const { value, wrapperProps } = useFieldHOC(props);
|
|
127
121
|
const innerValue = ref();
|
|
128
122
|
const breakpoints = useBreakpoints(breakpointsTailwind);
|
|
129
123
|
const isMobile = breakpoints.smallerOrEqual("md");
|
|
@@ -168,6 +162,7 @@ const onInput = (_value) => {
|
|
|
168
162
|
}
|
|
169
163
|
emits("change", value.value);
|
|
170
164
|
};
|
|
165
|
+
const { messages } = useCoreMessages();
|
|
171
166
|
</script>
|
|
172
167
|
|
|
173
168
|
<style scoped>
|
|
@@ -14,5 +14,5 @@ export interface IDateTimeRangeFieldProps extends IDateTimeFieldProps {
|
|
|
14
14
|
teleport?: boolean | string | HTMLElement;
|
|
15
15
|
}
|
|
16
16
|
export type IDateTimeRangeField = IFormFieldBase<INPUT_TYPES.DATE_RANGE | INPUT_TYPES.DATE_TIME_RANGE, IDateTimeRangeFieldProps, {
|
|
17
|
-
change
|
|
17
|
+
change?: (value: IDateTimeRangeResponse) => void;
|
|
18
18
|
}>;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
v-model="innerValueRef"
|
|
6
6
|
:teleport="teleport"
|
|
7
7
|
:disabled="wrapperProps.disabled"
|
|
8
|
-
:cancel-text="
|
|
9
|
-
:select-text="
|
|
8
|
+
:cancel-text="messages.common.cancel"
|
|
9
|
+
:select-text="messages.common.select"
|
|
10
10
|
:locale="appConfig.core?.locale"
|
|
11
11
|
:format="format"
|
|
12
12
|
:enable-time-picker="!disabledTime"
|
|
@@ -52,9 +52,11 @@
|
|
|
52
52
|
<template #clear-icon="{ clear }">
|
|
53
53
|
<Icon
|
|
54
54
|
:name="clearIcon"
|
|
55
|
-
:class="
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
:class="
|
|
56
|
+
theme.clearIcon({
|
|
57
|
+
class: [ui?.clearIcon]
|
|
58
|
+
})
|
|
59
|
+
"
|
|
58
60
|
@click.stop="clear"
|
|
59
61
|
/>
|
|
60
62
|
</template>
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
</template>
|
|
64
66
|
|
|
65
67
|
<script setup>
|
|
68
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
66
69
|
import Datepicker from "@vuepic/vue-datepicker";
|
|
67
70
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
68
71
|
import { TimeHelper, ref, useFieldHOC, useAppConfig, computed, useUiConfig, watch, onMounted } from "#imports";
|
|
@@ -76,6 +79,8 @@ const props = defineProps({
|
|
|
76
79
|
disabledTime: { type: Boolean, required: false },
|
|
77
80
|
minDate: { type: [Date, String], required: false },
|
|
78
81
|
maxDate: { type: [Date, String], required: false },
|
|
82
|
+
startDate: { type: [Date, String], required: false },
|
|
83
|
+
focusStartDate: { type: Boolean, required: false },
|
|
79
84
|
startTime: { type: Object, required: false },
|
|
80
85
|
minTime: { type: Object, required: false },
|
|
81
86
|
maxTime: { type: Object, required: false },
|
|
@@ -97,14 +102,12 @@ const props = defineProps({
|
|
|
97
102
|
readonly: { type: Boolean, required: false },
|
|
98
103
|
required: { type: Boolean, required: false },
|
|
99
104
|
help: { type: String, required: false },
|
|
100
|
-
ui: { type: null, required: false }
|
|
105
|
+
ui: { type: null, required: false },
|
|
106
|
+
containerUi: { type: null, required: false }
|
|
101
107
|
});
|
|
102
108
|
const appConfig = useAppConfig();
|
|
103
109
|
const theme = computed(() => useUiConfig(dateTimeTheme, "dateTime")());
|
|
104
|
-
const {
|
|
105
|
-
value,
|
|
106
|
-
wrapperProps
|
|
107
|
-
} = useFieldHOC(props);
|
|
110
|
+
const { value, wrapperProps } = useFieldHOC(props);
|
|
108
111
|
const innerValueRef = ref([]);
|
|
109
112
|
const initializeValue = () => {
|
|
110
113
|
const currentValue = value.value;
|
|
@@ -116,17 +119,21 @@ const initializeValue = () => {
|
|
|
116
119
|
innerValueRef.value = [];
|
|
117
120
|
}
|
|
118
121
|
};
|
|
119
|
-
watch(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
watch(
|
|
123
|
+
value,
|
|
124
|
+
(newValue) => {
|
|
125
|
+
if (newValue && (newValue.start || newValue.end)) {
|
|
126
|
+
const start = typeof newValue.start === "string" ? new Date(newValue.start) : newValue.start;
|
|
127
|
+
const end = typeof newValue.end === "string" ? new Date(newValue.end) : newValue.end;
|
|
128
|
+
innerValueRef.value = [start, end];
|
|
129
|
+
} else if (!newValue) {
|
|
130
|
+
innerValueRef.value = [];
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
immediate: false
|
|
126
135
|
}
|
|
127
|
-
|
|
128
|
-
immediate: false
|
|
129
|
-
});
|
|
136
|
+
);
|
|
130
137
|
onMounted(() => {
|
|
131
138
|
initializeValue();
|
|
132
139
|
});
|
|
@@ -155,4 +162,5 @@ const onInput = (_value) => {
|
|
|
155
162
|
}
|
|
156
163
|
emits("change", value.value);
|
|
157
164
|
};
|
|
165
|
+
const { messages } = useCoreMessages();
|
|
158
166
|
</script>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
:model-value="value"
|
|
5
5
|
:teleport="teleport"
|
|
6
6
|
:disabled="wrapperProps.disabled"
|
|
7
|
-
:cancel-text="
|
|
8
|
-
:select-text="
|
|
7
|
+
:cancel-text="messages.common.cancel"
|
|
8
|
+
:select-text="messages.common.select"
|
|
9
9
|
:locale="appConfig.core?.locale"
|
|
10
10
|
:format="appConfig.core?.month_format"
|
|
11
11
|
month-picker
|
|
@@ -47,9 +47,11 @@
|
|
|
47
47
|
<Icon
|
|
48
48
|
v-if="value && !wrapperProps.disabled && !wrapperProps.required"
|
|
49
49
|
:name="clearIcon"
|
|
50
|
-
:class="
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
:class="
|
|
51
|
+
theme.clearIcon({
|
|
52
|
+
class: [ui?.clearIcon]
|
|
53
|
+
})
|
|
54
|
+
"
|
|
53
55
|
@click.stop="clear"
|
|
54
56
|
/>
|
|
55
57
|
</template>
|
|
@@ -58,13 +60,14 @@
|
|
|
58
60
|
</template>
|
|
59
61
|
|
|
60
62
|
<script setup>
|
|
63
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
61
64
|
import Datepicker from "@vuepic/vue-datepicker";
|
|
62
65
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
63
66
|
import { computed, useAppConfig, useFieldHOC, useUiConfig } from "#imports";
|
|
64
67
|
import "@vuepic/vue-datepicker/dist/main.css";
|
|
65
68
|
import { dateTimeTheme } from "#core/theme/dateTime";
|
|
66
69
|
import { format } from "date-fns-tz";
|
|
67
|
-
import
|
|
70
|
+
import { th } from "date-fns/locale/th";
|
|
68
71
|
import { addYears } from "date-fns";
|
|
69
72
|
const emits = defineEmits(["change"]);
|
|
70
73
|
const props = defineProps({
|
|
@@ -85,14 +88,12 @@ const props = defineProps({
|
|
|
85
88
|
readonly: { type: Boolean, required: false },
|
|
86
89
|
required: { type: Boolean, required: false },
|
|
87
90
|
help: { type: String, required: false },
|
|
88
|
-
ui: { type: null, required: false }
|
|
91
|
+
ui: { type: null, required: false },
|
|
92
|
+
containerUi: { type: null, required: false }
|
|
89
93
|
});
|
|
90
94
|
const appConfig = useAppConfig();
|
|
91
95
|
const theme = computed(() => useUiConfig(dateTimeTheme, "dateTime")());
|
|
92
|
-
const {
|
|
93
|
-
value,
|
|
94
|
-
wrapperProps
|
|
95
|
-
} = useFieldHOC(props);
|
|
96
|
+
const { value, wrapperProps } = useFieldHOC(props);
|
|
96
97
|
const formatDisplay = (date) => {
|
|
97
98
|
if (!date) return "";
|
|
98
99
|
let newDateStr = new Date(date.year, date.month);
|
|
@@ -101,7 +102,7 @@ const formatDisplay = (date) => {
|
|
|
101
102
|
newDateStr = addYears(newDateStr, 543);
|
|
102
103
|
}
|
|
103
104
|
if (appConfig.core?.locale === "th" && appConfig.core?.is_thai_month) {
|
|
104
|
-
options.locale =
|
|
105
|
+
options.locale = th;
|
|
105
106
|
}
|
|
106
107
|
return format(newDateStr, appConfig.core?.month_format, options);
|
|
107
108
|
};
|
|
@@ -109,4 +110,5 @@ const onInput = (date) => {
|
|
|
109
110
|
value.value = date;
|
|
110
111
|
emits("change", value.value);
|
|
111
112
|
};
|
|
113
|
+
const { messages } = useCoreMessages();
|
|
112
114
|
</script>
|
|
@@ -6,7 +6,7 @@ export interface IMonthFieldProps extends IFieldProps {
|
|
|
6
6
|
teleport?: boolean | string | HTMLElement;
|
|
7
7
|
}
|
|
8
8
|
export type IMonthField = IFormFieldBase<INPUT_TYPES.MONTH, IMonthFieldProps, {
|
|
9
|
-
change
|
|
9
|
+
change?: (value: {
|
|
10
10
|
year: number;
|
|
11
11
|
month: number;
|
|
12
12
|
} | undefined) => void;
|
|
@@ -47,13 +47,10 @@ const props = defineProps({
|
|
|
47
47
|
readonly: { type: Boolean, required: false },
|
|
48
48
|
required: { type: Boolean, required: false },
|
|
49
49
|
help: { type: String, required: false },
|
|
50
|
-
ui: { type: null, required: false }
|
|
50
|
+
ui: { type: null, required: false },
|
|
51
|
+
containerUi: { type: null, required: false }
|
|
51
52
|
});
|
|
52
|
-
const {
|
|
53
|
-
value,
|
|
54
|
-
wrapperProps,
|
|
55
|
-
handleChange
|
|
56
|
-
} = useFieldHOC(props);
|
|
53
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
57
54
|
const onChange = (value2) => {
|
|
58
55
|
handleChange(value2);
|
|
59
56
|
emits("change", value2);
|
|
@@ -42,13 +42,10 @@ const props = defineProps({
|
|
|
42
42
|
readonly: { type: Boolean, required: false },
|
|
43
43
|
required: { type: Boolean, required: false },
|
|
44
44
|
help: { type: String, required: false },
|
|
45
|
-
ui: { type: null, required: false }
|
|
45
|
+
ui: { type: null, required: false },
|
|
46
|
+
containerUi: { type: null, required: false }
|
|
46
47
|
});
|
|
47
|
-
const {
|
|
48
|
-
value,
|
|
49
|
-
wrapperProps,
|
|
50
|
-
handleChange
|
|
51
|
-
} = useFieldHOC(props);
|
|
48
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
52
49
|
const onChange = (newValue) => {
|
|
53
50
|
handleChange(newValue);
|
|
54
51
|
emits("change", newValue);
|
|
@@ -50,13 +50,10 @@ const props = defineProps({
|
|
|
50
50
|
readonly: { type: Boolean, required: false },
|
|
51
51
|
required: { type: Boolean, required: false },
|
|
52
52
|
help: { type: String, required: false },
|
|
53
|
-
ui: { type: null, required: false }
|
|
53
|
+
ui: { type: null, required: false },
|
|
54
|
+
containerUi: { type: null, required: false }
|
|
54
55
|
});
|
|
55
|
-
const {
|
|
56
|
-
value,
|
|
57
|
-
wrapperProps,
|
|
58
|
-
handleChange
|
|
59
|
-
} = useFieldHOC(props);
|
|
56
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
60
57
|
const onChange = (value2) => {
|
|
61
58
|
handleChange(value2);
|
|
62
59
|
emits("change", value2);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
variant="link"
|
|
25
25
|
:icon="clearIcon || 'i-heroicons-x-mark'"
|
|
26
26
|
:padded="false"
|
|
27
|
-
title="
|
|
27
|
+
:title="messages.common.clearSearch"
|
|
28
28
|
@click="onClear"
|
|
29
29
|
/>
|
|
30
30
|
</template>
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script setup>
|
|
36
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
36
37
|
import { useFieldHOC } from "#core/composables/useForm";
|
|
37
38
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
38
39
|
const emits = defineEmits(["change", "search", "clear"]);
|
|
@@ -58,13 +59,10 @@ const props = defineProps({
|
|
|
58
59
|
readonly: { type: Boolean, required: false },
|
|
59
60
|
required: { type: Boolean, required: false },
|
|
60
61
|
help: { type: String, required: false },
|
|
61
|
-
ui: { type: null, required: false }
|
|
62
|
+
ui: { type: null, required: false },
|
|
63
|
+
containerUi: { type: null, required: false }
|
|
62
64
|
});
|
|
63
|
-
const {
|
|
64
|
-
value,
|
|
65
|
-
wrapperProps,
|
|
66
|
-
handleChange
|
|
67
|
-
} = useFieldHOC(props);
|
|
65
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
68
66
|
const onInput = (newValue) => {
|
|
69
67
|
handleChange(newValue);
|
|
70
68
|
emits("change", newValue);
|
|
@@ -76,4 +74,5 @@ const onClear = () => {
|
|
|
76
74
|
emits("clear");
|
|
77
75
|
emits("search", "");
|
|
78
76
|
};
|
|
77
|
+
const { messages } = useCoreMessages();
|
|
79
78
|
</script>
|
|
@@ -39,9 +39,7 @@
|
|
|
39
39
|
<div class="flex min-w-0 flex-1 items-center gap-x-2 overflow-hidden">
|
|
40
40
|
<component
|
|
41
41
|
:is="selectedOption.component"
|
|
42
|
-
v-if="
|
|
43
|
-
componentPosition === 'leading' && selectedOption?.component
|
|
44
|
-
"
|
|
42
|
+
v-if="componentPosition === 'leading' && selectedOption?.component"
|
|
45
43
|
v-bind="selectedOption.componentProps"
|
|
46
44
|
/>
|
|
47
45
|
<span
|
|
@@ -63,9 +61,7 @@
|
|
|
63
61
|
</span>
|
|
64
62
|
<component
|
|
65
63
|
:is="selectedOption.component"
|
|
66
|
-
v-if="
|
|
67
|
-
componentPosition === 'trailing' && selectedOption?.component
|
|
68
|
-
"
|
|
64
|
+
v-if="componentPosition === 'trailing' && selectedOption?.component"
|
|
69
65
|
v-bind="selectedOption.componentProps"
|
|
70
66
|
/>
|
|
71
67
|
</div>
|
|
@@ -166,17 +162,12 @@ const props = defineProps({
|
|
|
166
162
|
readonly: { type: Boolean, required: false },
|
|
167
163
|
required: { type: Boolean, required: false },
|
|
168
164
|
help: { type: String, required: false },
|
|
169
|
-
ui: { type: null, required: false }
|
|
165
|
+
ui: { type: null, required: false },
|
|
166
|
+
containerUi: { type: null, required: false }
|
|
170
167
|
});
|
|
171
168
|
const theme = computed(() => useUiConfig(selectMenuTheme, "selectMenu")());
|
|
172
|
-
const {
|
|
173
|
-
|
|
174
|
-
wrapperProps,
|
|
175
|
-
handleChange
|
|
176
|
-
} = useFieldHOC(props);
|
|
177
|
-
const selectedOption = computed(
|
|
178
|
-
() => props.options.find((item) => item.value === value.value)
|
|
179
|
-
);
|
|
169
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
170
|
+
const selectedOption = computed(() => props.options.find((item) => item.value === value.value));
|
|
180
171
|
const menuLabelStyle = computed(() => {
|
|
181
172
|
const lines = props.menuLabelLines ?? 1;
|
|
182
173
|
if (lines <= 1) return void 0;
|
|
@@ -57,9 +57,7 @@
|
|
|
57
57
|
/>
|
|
58
58
|
<component
|
|
59
59
|
:is="getOption(_value)?.component"
|
|
60
|
-
v-if="
|
|
61
|
-
componentPosition === 'leading' && getOption(_value)?.component
|
|
62
|
-
"
|
|
60
|
+
v-if="componentPosition === 'leading' && getOption(_value)?.component"
|
|
63
61
|
v-bind="getOption(_value)?.componentProps"
|
|
64
62
|
/>
|
|
65
63
|
<div
|
|
@@ -72,9 +70,7 @@
|
|
|
72
70
|
{{ getOption(_value)?.label ?? _value }}
|
|
73
71
|
<component
|
|
74
72
|
:is="getOption(_value)?.component"
|
|
75
|
-
v-if="
|
|
76
|
-
componentPosition === 'trailing' && getOption(_value)?.component
|
|
77
|
-
"
|
|
73
|
+
v-if="componentPosition === 'trailing' && getOption(_value)?.component"
|
|
78
74
|
v-bind="getOption(_value)?.componentProps"
|
|
79
75
|
/>
|
|
80
76
|
<Icon
|
|
@@ -180,17 +176,12 @@ const props = defineProps({
|
|
|
180
176
|
readonly: { type: Boolean, required: false },
|
|
181
177
|
required: { type: Boolean, required: false },
|
|
182
178
|
help: { type: String, required: false },
|
|
183
|
-
ui: { type: null, required: false }
|
|
179
|
+
ui: { type: null, required: false },
|
|
180
|
+
containerUi: { type: null, required: false }
|
|
184
181
|
});
|
|
185
182
|
const theme = computed(() => useUiConfig(selectMenuTheme, "select")());
|
|
186
|
-
const {
|
|
187
|
-
|
|
188
|
-
wrapperProps,
|
|
189
|
-
handleChange
|
|
190
|
-
} = useFieldHOC(props);
|
|
191
|
-
const optionByValue = computed(
|
|
192
|
-
() => new Map(props.options.map((opt) => [opt.value, opt]))
|
|
193
|
-
);
|
|
183
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
184
|
+
const optionByValue = computed(() => new Map(props.options.map((opt) => [opt.value, opt])));
|
|
194
185
|
const getOption = (_value) => optionByValue.value.get(_value);
|
|
195
186
|
const componentPosition = computed(() => props.componentPosition);
|
|
196
187
|
const menuLabelStyle = computed(() => {
|
|
@@ -211,8 +202,6 @@ const onSearch = (value2) => {
|
|
|
211
202
|
emits("search", value2);
|
|
212
203
|
};
|
|
213
204
|
const handleDelete = (_value) => {
|
|
214
|
-
value.value = ArrayHelper.toArray(value.value).filter(
|
|
215
|
-
(item) => item !== _value
|
|
216
|
-
);
|
|
205
|
+
value.value = ArrayHelper.toArray(value.value).filter((item) => item !== _value);
|
|
217
206
|
};
|
|
218
207
|
</script>
|
|
@@ -90,14 +90,11 @@ const props = defineProps({
|
|
|
90
90
|
readonly: { type: Boolean, required: false },
|
|
91
91
|
required: { type: Boolean, required: false },
|
|
92
92
|
help: { type: String, required: false },
|
|
93
|
-
ui: { type: null, required: false }
|
|
93
|
+
ui: { type: null, required: false },
|
|
94
|
+
containerUi: { type: null, required: false }
|
|
94
95
|
});
|
|
95
96
|
const theme = computed(() => useUiConfig(inputTheme, "input")());
|
|
96
|
-
const {
|
|
97
|
-
value,
|
|
98
|
-
wrapperProps,
|
|
99
|
-
handleChange
|
|
100
|
-
} = useFieldHOC(props);
|
|
97
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
101
98
|
const showSuggestions = ref(false);
|
|
102
99
|
const selectedSuggestionIndex = ref(-1);
|
|
103
100
|
const suggestionsContainerRef = ref();
|