@finema/core 1.4.201 → 1.4.203
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 +60 -60
- package/dist/module.d.mts +1 -0
- package/dist/module.d.ts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/Alert.vue +48 -48
- package/dist/runtime/components/Avatar.vue +27 -27
- package/dist/runtime/components/Badge.vue +11 -11
- package/dist/runtime/components/Breadcrumb.vue +44 -44
- package/dist/runtime/components/Button/Group.vue +37 -37
- package/dist/runtime/components/Button/index.vue +75 -75
- package/dist/runtime/components/Card.vue +38 -38
- package/dist/runtime/components/Core.vue +45 -45
- package/dist/runtime/components/Dialog/index.vue +108 -108
- package/dist/runtime/components/Dropdown/index.vue +70 -70
- package/dist/runtime/components/FlexDeck/Base.vue +152 -152
- package/dist/runtime/components/FlexDeck/index.vue +68 -68
- package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
- package/dist/runtime/components/Form/Fields.vue +230 -230
- package/dist/runtime/components/Form/InputCheckbox/index.vue +28 -28
- package/dist/runtime/components/Form/InputDateTime/index.vue +61 -61
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +83 -83
- package/dist/runtime/components/Form/InputNumber/index.vue +27 -27
- package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
- package/dist/runtime/components/Form/InputSelect/index.vue +45 -45
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +54 -54
- package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
- package/dist/runtime/components/Form/InputTags/index.vue +141 -141
- package/dist/runtime/components/Form/InputText/index.vue +68 -68
- package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
- package/dist/runtime/components/Form/InputToggle/index.vue +27 -27
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +206 -206
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +342 -342
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemUpload.vue +241 -241
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemView.vue +89 -89
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +170 -170
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemUpload.vue +161 -161
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemView.vue +64 -64
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/index.vue +178 -178
- package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +95 -95
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +151 -151
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +219 -219
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +55 -55
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +228 -228
- package/dist/runtime/components/Form/index.vue +6 -6
- package/dist/runtime/components/Icon.vue +23 -23
- package/dist/runtime/components/Image.vue +36 -36
- package/dist/runtime/components/Loader.vue +27 -27
- package/dist/runtime/components/Modal/index.vue +146 -146
- package/dist/runtime/components/QRCode.vue +22 -22
- package/dist/runtime/components/SimplePagination.vue +96 -96
- package/dist/runtime/components/Slideover/index.vue +110 -110
- package/dist/runtime/components/Table/Base.vue +153 -153
- package/dist/runtime/components/Table/ColumnDate.vue +16 -16
- package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
- package/dist/runtime/components/Table/ColumnImage.vue +15 -15
- package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
- package/dist/runtime/components/Table/ColumnText.vue +29 -29
- package/dist/runtime/components/Table/Simple.vue +69 -69
- package/dist/runtime/components/Table/index.vue +65 -65
- package/dist/runtime/components/Tabs/index.vue +64 -64
- package/dist/runtime/components/TeleportSafe.vue +40 -40
- package/dist/runtime/core.config.d.ts +1 -0
- package/dist/runtime/core.config.mjs +2 -1
- package/dist/runtime/ui.config/notifications.d.ts +3 -0
- package/dist/runtime/ui.config/notifications.mjs +3 -0
- package/dist/runtime/utils/TimeHelper.mjs +15 -10
- package/dist/runtime/utils/TimeHelper.spec.mjs +11 -4
- package/dist/runtime/utils/TimeHelper.thai.spec.mjs +2 -1
- package/package.json +102 -101
- package/dist/runtime/components/Form/InputDateTime/index.vue~ +0 -61
- package/dist/runtime/ui.config/table.ts~ +0 -48
|
@@ -1,230 +1,230 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['fields', $props.class]">
|
|
3
|
-
<template
|
|
4
|
-
v-for="(option, index) in options.filter((item) => !item.isHide)"
|
|
5
|
-
:key="option.props.name + index + option.type"
|
|
6
|
-
>
|
|
7
|
-
<FormInputStatic
|
|
8
|
-
v-if="option.type === INPUT_TYPES.STATIC"
|
|
9
|
-
:class="option.class"
|
|
10
|
-
:form="form"
|
|
11
|
-
v-bind="getFieldBinding(option)"
|
|
12
|
-
v-on="option.on ?? {}"
|
|
13
|
-
/>
|
|
14
|
-
<FormInputText
|
|
15
|
-
v-else-if="option.type === INPUT_TYPES.TEXT"
|
|
16
|
-
:class="option.class"
|
|
17
|
-
:form="form"
|
|
18
|
-
v-bind="getFieldBinding(option)"
|
|
19
|
-
v-on="option.on ?? {}"
|
|
20
|
-
/>
|
|
21
|
-
<FormInputNumber
|
|
22
|
-
v-else-if="option.type === INPUT_TYPES.NUMBER"
|
|
23
|
-
:class="option.class"
|
|
24
|
-
:form="form"
|
|
25
|
-
v-bind="getFieldBinding(option)"
|
|
26
|
-
v-on="option.on ?? {}"
|
|
27
|
-
/>
|
|
28
|
-
<FormInputText
|
|
29
|
-
v-else-if="option.type === INPUT_TYPES.PASSWORD"
|
|
30
|
-
:class="option.class"
|
|
31
|
-
type="password"
|
|
32
|
-
:form="form"
|
|
33
|
-
v-bind="getFieldBinding(option)"
|
|
34
|
-
v-on="option.on ?? {}"
|
|
35
|
-
/>
|
|
36
|
-
<FormInputText
|
|
37
|
-
v-else-if="option.type === INPUT_TYPES.EMAIL"
|
|
38
|
-
:class="option.class"
|
|
39
|
-
type="email"
|
|
40
|
-
:form="form"
|
|
41
|
-
v-bind="getFieldBinding(option)"
|
|
42
|
-
v-on="option.on ?? {}"
|
|
43
|
-
/>
|
|
44
|
-
<FormInputTextarea
|
|
45
|
-
v-else-if="option.type === INPUT_TYPES.TEXTAREA"
|
|
46
|
-
:class="option.class"
|
|
47
|
-
:form="form"
|
|
48
|
-
v-bind="getFieldBinding(option)"
|
|
49
|
-
v-on="option.on ?? {}"
|
|
50
|
-
/>
|
|
51
|
-
<FormInputToggle
|
|
52
|
-
v-else-if="option.type === INPUT_TYPES.TOGGLE"
|
|
53
|
-
:class="option.class"
|
|
54
|
-
:form="form"
|
|
55
|
-
v-bind="getFieldBinding(option)"
|
|
56
|
-
v-on="option.on ?? {}"
|
|
57
|
-
/>
|
|
58
|
-
<FormInputSelect
|
|
59
|
-
v-else-if="option.type === INPUT_TYPES.SELECT"
|
|
60
|
-
:class="option.class"
|
|
61
|
-
:form="form"
|
|
62
|
-
:options="option.props.options"
|
|
63
|
-
v-bind="getFieldBinding(option)"
|
|
64
|
-
v-on="option.on ?? {}"
|
|
65
|
-
/>
|
|
66
|
-
<FormInputSelectMultiple
|
|
67
|
-
v-else-if="option.type === INPUT_TYPES.SELECT_MULTIPLE"
|
|
68
|
-
:class="option.class"
|
|
69
|
-
:form="form"
|
|
70
|
-
:options="option.props.options"
|
|
71
|
-
v-bind="getFieldBinding(option)"
|
|
72
|
-
v-on="option.on ?? {}"
|
|
73
|
-
/>
|
|
74
|
-
<FormInputRadio
|
|
75
|
-
v-else-if="option.type === INPUT_TYPES.RADIO"
|
|
76
|
-
:class="option.class"
|
|
77
|
-
:form="form"
|
|
78
|
-
:options="option.props.options"
|
|
79
|
-
v-bind="getFieldBinding(option)"
|
|
80
|
-
v-on="option.on ?? {}"
|
|
81
|
-
/>
|
|
82
|
-
<FormInputCheckbox
|
|
83
|
-
v-else-if="option.type === INPUT_TYPES.CHECKBOX"
|
|
84
|
-
:class="option.class"
|
|
85
|
-
:form="form"
|
|
86
|
-
v-bind="getFieldBinding(option)"
|
|
87
|
-
v-on="option.on ?? {}"
|
|
88
|
-
/>
|
|
89
|
-
<FormInputDateTime
|
|
90
|
-
v-else-if="option.type === INPUT_TYPES.DATE_TIME"
|
|
91
|
-
:class="option.class"
|
|
92
|
-
:form="form"
|
|
93
|
-
v-bind="getFieldBinding(option)"
|
|
94
|
-
v-on="option.on ?? {}"
|
|
95
|
-
/>
|
|
96
|
-
<FormInputDateTime
|
|
97
|
-
v-else-if="option.type === INPUT_TYPES.DATE"
|
|
98
|
-
:class="option.class"
|
|
99
|
-
:form="form"
|
|
100
|
-
v-bind="getFieldBinding(option)"
|
|
101
|
-
:disabled-time="true"
|
|
102
|
-
v-on="option.on ?? {}"
|
|
103
|
-
/>
|
|
104
|
-
<FormInputDateTimeRange
|
|
105
|
-
v-else-if="option.type === INPUT_TYPES.DATE_TIME_RANGE"
|
|
106
|
-
:class="option.class"
|
|
107
|
-
:form="form"
|
|
108
|
-
v-bind="getFieldBinding(option)"
|
|
109
|
-
v-on="option.on ?? {}"
|
|
110
|
-
/>
|
|
111
|
-
<FormInputDateTimeRange
|
|
112
|
-
v-else-if="option.type === INPUT_TYPES.DATE_RANGE"
|
|
113
|
-
:class="option.class"
|
|
114
|
-
:form="form"
|
|
115
|
-
:disabled-time="true"
|
|
116
|
-
v-bind="getFieldBinding(option)"
|
|
117
|
-
v-on="option.on ?? {}"
|
|
118
|
-
/>
|
|
119
|
-
<FormInputUploadFileClassic
|
|
120
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC"
|
|
121
|
-
:class="option.class"
|
|
122
|
-
:form="form"
|
|
123
|
-
v-bind="getFieldBinding(option)"
|
|
124
|
-
v-on="option.on ?? {}"
|
|
125
|
-
/>
|
|
126
|
-
<FormInputUploadFileClassicAuto
|
|
127
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC_AUTO"
|
|
128
|
-
:class="option.class"
|
|
129
|
-
:form="form"
|
|
130
|
-
:request-options="option.props.requestOptions"
|
|
131
|
-
v-bind="getFieldBinding(option)"
|
|
132
|
-
v-on="option.on ?? {}"
|
|
133
|
-
/>
|
|
134
|
-
<FormInputUploadImageAuto
|
|
135
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_IMAGE_AUTO"
|
|
136
|
-
:class="option.class"
|
|
137
|
-
:form="form"
|
|
138
|
-
:request-options="option.props.requestOptions"
|
|
139
|
-
v-bind="getFieldBinding(option)"
|
|
140
|
-
v-on="option.on ?? {}"
|
|
141
|
-
/>
|
|
142
|
-
<FormInputUploadDropzone
|
|
143
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE"
|
|
144
|
-
:class="option.class"
|
|
145
|
-
:form="form"
|
|
146
|
-
v-bind="getFieldBinding(option)"
|
|
147
|
-
v-on="option.on ?? {}"
|
|
148
|
-
/>
|
|
149
|
-
<FormInputUploadDropzoneAuto
|
|
150
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_AUTO"
|
|
151
|
-
:class="option.class"
|
|
152
|
-
:form="form"
|
|
153
|
-
:request-options="option.props.requestOptions"
|
|
154
|
-
v-bind="getFieldBinding(option)"
|
|
155
|
-
v-on="option.on ?? {}"
|
|
156
|
-
/>
|
|
157
|
-
<FormInputUploadDropzoneAutoMultiple
|
|
158
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_AUTO_MULTIPLE"
|
|
159
|
-
:class="option.class"
|
|
160
|
-
:form="form"
|
|
161
|
-
:request-options="option.props.requestOptions"
|
|
162
|
-
v-bind="getFieldBinding(option)"
|
|
163
|
-
v-on="option.on ?? {}"
|
|
164
|
-
/>
|
|
165
|
-
<FormInputUploadDropzoneImageAutoMultiple
|
|
166
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_IMAGE_AUTO_MULTIPLE"
|
|
167
|
-
:class="option.class"
|
|
168
|
-
:form="form"
|
|
169
|
-
:request-options="option.props.requestOptions"
|
|
170
|
-
v-bind="getFieldBinding(option)"
|
|
171
|
-
v-on="option.on ?? {}"
|
|
172
|
-
/>
|
|
173
|
-
<FormInputWYSIWYG
|
|
174
|
-
v-else-if="option.type === INPUT_TYPES.WYSIWYG"
|
|
175
|
-
:class="option.class"
|
|
176
|
-
:form="form"
|
|
177
|
-
v-bind="getFieldBinding(option)"
|
|
178
|
-
v-on="option.on ?? {}"
|
|
179
|
-
/>
|
|
180
|
-
<FormInputTags
|
|
181
|
-
v-else-if="option.type === INPUT_TYPES.TAGS"
|
|
182
|
-
:class="option.class"
|
|
183
|
-
:form="form"
|
|
184
|
-
v-bind="getFieldBinding(option)"
|
|
185
|
-
v-on="option.on ?? {}"
|
|
186
|
-
/>
|
|
187
|
-
<component
|
|
188
|
-
:is="option.component"
|
|
189
|
-
v-else-if="option.type === INPUT_TYPES.COMPONENT"
|
|
190
|
-
:class="option.class"
|
|
191
|
-
:form="form"
|
|
192
|
-
v-bind="getFieldBinding(option)"
|
|
193
|
-
v-on="option.on ?? {}"
|
|
194
|
-
/>
|
|
195
|
-
</template>
|
|
196
|
-
</div>
|
|
197
|
-
</template>
|
|
198
|
-
<script lang="ts" setup>
|
|
199
|
-
import { type FormContext } from 'vee-validate'
|
|
200
|
-
import { type IFormField, INPUT_TYPES } from '#core/components/Form/types'
|
|
201
|
-
|
|
202
|
-
const props = withDefaults(
|
|
203
|
-
defineProps<{
|
|
204
|
-
form?: FormContext
|
|
205
|
-
options: IFormField[]
|
|
206
|
-
orientation?: 'horizontal' | 'vertical'
|
|
207
|
-
class?: any
|
|
208
|
-
}>(),
|
|
209
|
-
{
|
|
210
|
-
class: 'space-y-4',
|
|
211
|
-
orientation: 'vertical',
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
const getFieldBinding = (field: IFormField) => {
|
|
216
|
-
if (props.orientation === 'horizontal') {
|
|
217
|
-
return {
|
|
218
|
-
...field.props,
|
|
219
|
-
containerUi: {
|
|
220
|
-
...field.props.containerUi,
|
|
221
|
-
wrapper:
|
|
222
|
-
'lg:grid lg:grid-cols-3 lg:gap-4 lg:items-start ' + field.props.containerUi?.wrapper,
|
|
223
|
-
container: 'lg:col-span-2 ' + field.props.containerUi?.container,
|
|
224
|
-
},
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return field.props
|
|
229
|
-
}
|
|
230
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['fields', $props.class]">
|
|
3
|
+
<template
|
|
4
|
+
v-for="(option, index) in options.filter((item) => !item.isHide)"
|
|
5
|
+
:key="option.props.name + index + option.type"
|
|
6
|
+
>
|
|
7
|
+
<FormInputStatic
|
|
8
|
+
v-if="option.type === INPUT_TYPES.STATIC"
|
|
9
|
+
:class="option.class"
|
|
10
|
+
:form="form"
|
|
11
|
+
v-bind="getFieldBinding(option)"
|
|
12
|
+
v-on="option.on ?? {}"
|
|
13
|
+
/>
|
|
14
|
+
<FormInputText
|
|
15
|
+
v-else-if="option.type === INPUT_TYPES.TEXT"
|
|
16
|
+
:class="option.class"
|
|
17
|
+
:form="form"
|
|
18
|
+
v-bind="getFieldBinding(option)"
|
|
19
|
+
v-on="option.on ?? {}"
|
|
20
|
+
/>
|
|
21
|
+
<FormInputNumber
|
|
22
|
+
v-else-if="option.type === INPUT_TYPES.NUMBER"
|
|
23
|
+
:class="option.class"
|
|
24
|
+
:form="form"
|
|
25
|
+
v-bind="getFieldBinding(option)"
|
|
26
|
+
v-on="option.on ?? {}"
|
|
27
|
+
/>
|
|
28
|
+
<FormInputText
|
|
29
|
+
v-else-if="option.type === INPUT_TYPES.PASSWORD"
|
|
30
|
+
:class="option.class"
|
|
31
|
+
type="password"
|
|
32
|
+
:form="form"
|
|
33
|
+
v-bind="getFieldBinding(option)"
|
|
34
|
+
v-on="option.on ?? {}"
|
|
35
|
+
/>
|
|
36
|
+
<FormInputText
|
|
37
|
+
v-else-if="option.type === INPUT_TYPES.EMAIL"
|
|
38
|
+
:class="option.class"
|
|
39
|
+
type="email"
|
|
40
|
+
:form="form"
|
|
41
|
+
v-bind="getFieldBinding(option)"
|
|
42
|
+
v-on="option.on ?? {}"
|
|
43
|
+
/>
|
|
44
|
+
<FormInputTextarea
|
|
45
|
+
v-else-if="option.type === INPUT_TYPES.TEXTAREA"
|
|
46
|
+
:class="option.class"
|
|
47
|
+
:form="form"
|
|
48
|
+
v-bind="getFieldBinding(option)"
|
|
49
|
+
v-on="option.on ?? {}"
|
|
50
|
+
/>
|
|
51
|
+
<FormInputToggle
|
|
52
|
+
v-else-if="option.type === INPUT_TYPES.TOGGLE"
|
|
53
|
+
:class="option.class"
|
|
54
|
+
:form="form"
|
|
55
|
+
v-bind="getFieldBinding(option)"
|
|
56
|
+
v-on="option.on ?? {}"
|
|
57
|
+
/>
|
|
58
|
+
<FormInputSelect
|
|
59
|
+
v-else-if="option.type === INPUT_TYPES.SELECT"
|
|
60
|
+
:class="option.class"
|
|
61
|
+
:form="form"
|
|
62
|
+
:options="option.props.options"
|
|
63
|
+
v-bind="getFieldBinding(option)"
|
|
64
|
+
v-on="option.on ?? {}"
|
|
65
|
+
/>
|
|
66
|
+
<FormInputSelectMultiple
|
|
67
|
+
v-else-if="option.type === INPUT_TYPES.SELECT_MULTIPLE"
|
|
68
|
+
:class="option.class"
|
|
69
|
+
:form="form"
|
|
70
|
+
:options="option.props.options"
|
|
71
|
+
v-bind="getFieldBinding(option)"
|
|
72
|
+
v-on="option.on ?? {}"
|
|
73
|
+
/>
|
|
74
|
+
<FormInputRadio
|
|
75
|
+
v-else-if="option.type === INPUT_TYPES.RADIO"
|
|
76
|
+
:class="option.class"
|
|
77
|
+
:form="form"
|
|
78
|
+
:options="option.props.options"
|
|
79
|
+
v-bind="getFieldBinding(option)"
|
|
80
|
+
v-on="option.on ?? {}"
|
|
81
|
+
/>
|
|
82
|
+
<FormInputCheckbox
|
|
83
|
+
v-else-if="option.type === INPUT_TYPES.CHECKBOX"
|
|
84
|
+
:class="option.class"
|
|
85
|
+
:form="form"
|
|
86
|
+
v-bind="getFieldBinding(option)"
|
|
87
|
+
v-on="option.on ?? {}"
|
|
88
|
+
/>
|
|
89
|
+
<FormInputDateTime
|
|
90
|
+
v-else-if="option.type === INPUT_TYPES.DATE_TIME"
|
|
91
|
+
:class="option.class"
|
|
92
|
+
:form="form"
|
|
93
|
+
v-bind="getFieldBinding(option)"
|
|
94
|
+
v-on="option.on ?? {}"
|
|
95
|
+
/>
|
|
96
|
+
<FormInputDateTime
|
|
97
|
+
v-else-if="option.type === INPUT_TYPES.DATE"
|
|
98
|
+
:class="option.class"
|
|
99
|
+
:form="form"
|
|
100
|
+
v-bind="getFieldBinding(option)"
|
|
101
|
+
:disabled-time="true"
|
|
102
|
+
v-on="option.on ?? {}"
|
|
103
|
+
/>
|
|
104
|
+
<FormInputDateTimeRange
|
|
105
|
+
v-else-if="option.type === INPUT_TYPES.DATE_TIME_RANGE"
|
|
106
|
+
:class="option.class"
|
|
107
|
+
:form="form"
|
|
108
|
+
v-bind="getFieldBinding(option)"
|
|
109
|
+
v-on="option.on ?? {}"
|
|
110
|
+
/>
|
|
111
|
+
<FormInputDateTimeRange
|
|
112
|
+
v-else-if="option.type === INPUT_TYPES.DATE_RANGE"
|
|
113
|
+
:class="option.class"
|
|
114
|
+
:form="form"
|
|
115
|
+
:disabled-time="true"
|
|
116
|
+
v-bind="getFieldBinding(option)"
|
|
117
|
+
v-on="option.on ?? {}"
|
|
118
|
+
/>
|
|
119
|
+
<FormInputUploadFileClassic
|
|
120
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC"
|
|
121
|
+
:class="option.class"
|
|
122
|
+
:form="form"
|
|
123
|
+
v-bind="getFieldBinding(option)"
|
|
124
|
+
v-on="option.on ?? {}"
|
|
125
|
+
/>
|
|
126
|
+
<FormInputUploadFileClassicAuto
|
|
127
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC_AUTO"
|
|
128
|
+
:class="option.class"
|
|
129
|
+
:form="form"
|
|
130
|
+
:request-options="option.props.requestOptions"
|
|
131
|
+
v-bind="getFieldBinding(option)"
|
|
132
|
+
v-on="option.on ?? {}"
|
|
133
|
+
/>
|
|
134
|
+
<FormInputUploadImageAuto
|
|
135
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_IMAGE_AUTO"
|
|
136
|
+
:class="option.class"
|
|
137
|
+
:form="form"
|
|
138
|
+
:request-options="option.props.requestOptions"
|
|
139
|
+
v-bind="getFieldBinding(option)"
|
|
140
|
+
v-on="option.on ?? {}"
|
|
141
|
+
/>
|
|
142
|
+
<FormInputUploadDropzone
|
|
143
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE"
|
|
144
|
+
:class="option.class"
|
|
145
|
+
:form="form"
|
|
146
|
+
v-bind="getFieldBinding(option)"
|
|
147
|
+
v-on="option.on ?? {}"
|
|
148
|
+
/>
|
|
149
|
+
<FormInputUploadDropzoneAuto
|
|
150
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_AUTO"
|
|
151
|
+
:class="option.class"
|
|
152
|
+
:form="form"
|
|
153
|
+
:request-options="option.props.requestOptions"
|
|
154
|
+
v-bind="getFieldBinding(option)"
|
|
155
|
+
v-on="option.on ?? {}"
|
|
156
|
+
/>
|
|
157
|
+
<FormInputUploadDropzoneAutoMultiple
|
|
158
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_AUTO_MULTIPLE"
|
|
159
|
+
:class="option.class"
|
|
160
|
+
:form="form"
|
|
161
|
+
:request-options="option.props.requestOptions"
|
|
162
|
+
v-bind="getFieldBinding(option)"
|
|
163
|
+
v-on="option.on ?? {}"
|
|
164
|
+
/>
|
|
165
|
+
<FormInputUploadDropzoneImageAutoMultiple
|
|
166
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_IMAGE_AUTO_MULTIPLE"
|
|
167
|
+
:class="option.class"
|
|
168
|
+
:form="form"
|
|
169
|
+
:request-options="option.props.requestOptions"
|
|
170
|
+
v-bind="getFieldBinding(option)"
|
|
171
|
+
v-on="option.on ?? {}"
|
|
172
|
+
/>
|
|
173
|
+
<FormInputWYSIWYG
|
|
174
|
+
v-else-if="option.type === INPUT_TYPES.WYSIWYG"
|
|
175
|
+
:class="option.class"
|
|
176
|
+
:form="form"
|
|
177
|
+
v-bind="getFieldBinding(option)"
|
|
178
|
+
v-on="option.on ?? {}"
|
|
179
|
+
/>
|
|
180
|
+
<FormInputTags
|
|
181
|
+
v-else-if="option.type === INPUT_TYPES.TAGS"
|
|
182
|
+
:class="option.class"
|
|
183
|
+
:form="form"
|
|
184
|
+
v-bind="getFieldBinding(option)"
|
|
185
|
+
v-on="option.on ?? {}"
|
|
186
|
+
/>
|
|
187
|
+
<component
|
|
188
|
+
:is="option.component"
|
|
189
|
+
v-else-if="option.type === INPUT_TYPES.COMPONENT"
|
|
190
|
+
:class="option.class"
|
|
191
|
+
:form="form"
|
|
192
|
+
v-bind="getFieldBinding(option)"
|
|
193
|
+
v-on="option.on ?? {}"
|
|
194
|
+
/>
|
|
195
|
+
</template>
|
|
196
|
+
</div>
|
|
197
|
+
</template>
|
|
198
|
+
<script lang="ts" setup>
|
|
199
|
+
import { type FormContext } from 'vee-validate'
|
|
200
|
+
import { type IFormField, INPUT_TYPES } from '#core/components/Form/types'
|
|
201
|
+
|
|
202
|
+
const props = withDefaults(
|
|
203
|
+
defineProps<{
|
|
204
|
+
form?: FormContext
|
|
205
|
+
options: IFormField[]
|
|
206
|
+
orientation?: 'horizontal' | 'vertical'
|
|
207
|
+
class?: any
|
|
208
|
+
}>(),
|
|
209
|
+
{
|
|
210
|
+
class: 'space-y-4',
|
|
211
|
+
orientation: 'vertical',
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
const getFieldBinding = (field: IFormField) => {
|
|
216
|
+
if (props.orientation === 'horizontal') {
|
|
217
|
+
return {
|
|
218
|
+
...field.props,
|
|
219
|
+
containerUi: {
|
|
220
|
+
...field.props.containerUi,
|
|
221
|
+
wrapper:
|
|
222
|
+
'lg:grid lg:grid-cols-3 lg:gap-4 lg:items-start ' + field.props.containerUi?.wrapper,
|
|
223
|
+
container: 'lg:col-span-2 ' + field.props.containerUi?.container,
|
|
224
|
+
},
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return field.props
|
|
229
|
+
}
|
|
230
|
+
</script>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps" label="">
|
|
3
|
-
<UCheckbox
|
|
4
|
-
:model-value="value"
|
|
5
|
-
:disabled="wrapperProps.isDisabled"
|
|
6
|
-
:name="name"
|
|
7
|
-
:label="props.label"
|
|
8
|
-
:required="isRequired"
|
|
9
|
-
:ui="ui"
|
|
10
|
-
@update:modelValue="onChange"
|
|
11
|
-
/>
|
|
12
|
-
</FieldWrapper>
|
|
13
|
-
</template>
|
|
14
|
-
<script lang="ts" setup>
|
|
15
|
-
import { useFieldHOC } from '#core/composables/useForm'
|
|
16
|
-
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
17
|
-
import { type ICheckboxFieldProps } from '#core/components/Form/InputCheckbox/types'
|
|
18
|
-
|
|
19
|
-
const emits = defineEmits(['change'])
|
|
20
|
-
const props = withDefaults(defineProps<ICheckboxFieldProps>(), {})
|
|
21
|
-
|
|
22
|
-
const { value, wrapperProps, handleChange } = useFieldHOC<boolean>(props)
|
|
23
|
-
|
|
24
|
-
const onChange = (value: any) => {
|
|
25
|
-
handleChange(value)
|
|
26
|
-
emits('change', value)
|
|
27
|
-
}
|
|
28
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps" label="">
|
|
3
|
+
<UCheckbox
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:disabled="wrapperProps.isDisabled"
|
|
6
|
+
:name="name"
|
|
7
|
+
:label="props.label"
|
|
8
|
+
:required="isRequired"
|
|
9
|
+
:ui="ui"
|
|
10
|
+
@update:modelValue="onChange"
|
|
11
|
+
/>
|
|
12
|
+
</FieldWrapper>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
16
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
17
|
+
import { type ICheckboxFieldProps } from '#core/components/Form/InputCheckbox/types'
|
|
18
|
+
|
|
19
|
+
const emits = defineEmits(['change'])
|
|
20
|
+
const props = withDefaults(defineProps<ICheckboxFieldProps>(), {})
|
|
21
|
+
|
|
22
|
+
const { value, wrapperProps, handleChange } = useFieldHOC<boolean>(props)
|
|
23
|
+
|
|
24
|
+
const onChange = (value: any) => {
|
|
25
|
+
handleChange(value)
|
|
26
|
+
emits('change', value)
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<Datepicker
|
|
4
|
-
:model-value="value"
|
|
5
|
-
:disabled="wrapperProps.isDisabled"
|
|
6
|
-
cancel-text="ยกเลิก"
|
|
7
|
-
select-text="เลือก"
|
|
8
|
-
locale="th"
|
|
9
|
-
:enable-time-picker="!disabledTime"
|
|
10
|
-
:placeholder="wrapperProps.placeholder"
|
|
11
|
-
:format="format"
|
|
12
|
-
:min-date="minDate"
|
|
13
|
-
:max-date="maxDate"
|
|
14
|
-
:min-time="minTime"
|
|
15
|
-
:max-time="maxTime"
|
|
16
|
-
:start-time="startTime"
|
|
17
|
-
:required="isRequired"
|
|
18
|
-
time-picker-inline
|
|
19
|
-
@update:model-value="onInput"
|
|
20
|
-
>
|
|
21
|
-
<template #dp-input="{ value: innerValue }">
|
|
22
|
-
<UInput
|
|
23
|
-
:trailing-icon="innerValue ? undefined : 'i-heroicons-calendar-days'"
|
|
24
|
-
type="text"
|
|
25
|
-
:disabled="wrapperProps.isDisabled"
|
|
26
|
-
:model-value="innerValue"
|
|
27
|
-
:placeholder="wrapperProps.placeholder"
|
|
28
|
-
:readonly="true"
|
|
29
|
-
input-class="cursor-pointer select-none"
|
|
30
|
-
/>
|
|
31
|
-
</template>
|
|
32
|
-
</Datepicker>
|
|
33
|
-
</FieldWrapper>
|
|
34
|
-
</template>
|
|
35
|
-
<script lang="ts" setup>
|
|
36
|
-
import Datepicker from '@vuepic/vue-datepicker'
|
|
37
|
-
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
38
|
-
import { type IDateTimeFieldProps } from '#core/components/Form/InputDateTime/date_time_field.types'
|
|
39
|
-
import { TimeHelper, useFieldHOC } from '#imports'
|
|
40
|
-
import '@vuepic/vue-datepicker/dist/main.css'
|
|
41
|
-
|
|
42
|
-
const props = withDefaults(defineProps<IDateTimeFieldProps>(), {})
|
|
43
|
-
|
|
44
|
-
const { value, wrapperProps } = useFieldHOC<string>(props)
|
|
45
|
-
|
|
46
|
-
const format = (date: Date) => {
|
|
47
|
-
if (props.disabledTime) {
|
|
48
|
-
return TimeHelper.displayDate(date)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return TimeHelper.displayDateTime(date)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const onInput = (_value: any) => {
|
|
55
|
-
if (props.disabledTime && !props.isReturnISO) {
|
|
56
|
-
value.value = TimeHelper.getDateFormTime(_value)
|
|
57
|
-
} else {
|
|
58
|
-
value.value = _value
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<Datepicker
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:disabled="wrapperProps.isDisabled"
|
|
6
|
+
cancel-text="ยกเลิก"
|
|
7
|
+
select-text="เลือก"
|
|
8
|
+
locale="th"
|
|
9
|
+
:enable-time-picker="!disabledTime"
|
|
10
|
+
:placeholder="wrapperProps.placeholder"
|
|
11
|
+
:format="format"
|
|
12
|
+
:min-date="minDate"
|
|
13
|
+
:max-date="maxDate"
|
|
14
|
+
:min-time="minTime"
|
|
15
|
+
:max-time="maxTime"
|
|
16
|
+
:start-time="startTime"
|
|
17
|
+
:required="isRequired"
|
|
18
|
+
time-picker-inline
|
|
19
|
+
@update:model-value="onInput"
|
|
20
|
+
>
|
|
21
|
+
<template #dp-input="{ value: innerValue }">
|
|
22
|
+
<UInput
|
|
23
|
+
:trailing-icon="innerValue ? undefined : 'i-heroicons-calendar-days'"
|
|
24
|
+
type="text"
|
|
25
|
+
:disabled="wrapperProps.isDisabled"
|
|
26
|
+
:model-value="innerValue"
|
|
27
|
+
:placeholder="wrapperProps.placeholder"
|
|
28
|
+
:readonly="true"
|
|
29
|
+
input-class="cursor-pointer select-none"
|
|
30
|
+
/>
|
|
31
|
+
</template>
|
|
32
|
+
</Datepicker>
|
|
33
|
+
</FieldWrapper>
|
|
34
|
+
</template>
|
|
35
|
+
<script lang="ts" setup>
|
|
36
|
+
import Datepicker from '@vuepic/vue-datepicker'
|
|
37
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
38
|
+
import { type IDateTimeFieldProps } from '#core/components/Form/InputDateTime/date_time_field.types'
|
|
39
|
+
import { TimeHelper, useFieldHOC } from '#imports'
|
|
40
|
+
import '@vuepic/vue-datepicker/dist/main.css'
|
|
41
|
+
|
|
42
|
+
const props = withDefaults(defineProps<IDateTimeFieldProps>(), {})
|
|
43
|
+
|
|
44
|
+
const { value, wrapperProps } = useFieldHOC<string>(props)
|
|
45
|
+
|
|
46
|
+
const format = (date: Date) => {
|
|
47
|
+
if (props.disabledTime) {
|
|
48
|
+
return TimeHelper.displayDate(date)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return TimeHelper.displayDateTime(date)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const onInput = (_value: any) => {
|
|
55
|
+
if (props.disabledTime && !props.isReturnISO) {
|
|
56
|
+
value.value = TimeHelper.getDateFormTime(_value)
|
|
57
|
+
} else {
|
|
58
|
+
value.value = _value
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|