@finema/core 1.4.82 → 1.4.83
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 +63 -63
- 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 +53 -53
- package/dist/runtime/components/Breadcrumb.vue +44 -44
- package/dist/runtime/components/Button/Group.vue +37 -37
- package/dist/runtime/components/Button/index.vue +76 -76
- package/dist/runtime/components/Card.vue +38 -38
- package/dist/runtime/components/Core.vue +13 -13
- package/dist/runtime/components/Dialog/index.vue +108 -108
- package/dist/runtime/components/Dropdown/index.vue +70 -70
- package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
- package/dist/runtime/components/Form/Fields.vue +160 -160
- package/dist/runtime/components/Form/InputCheckbox/index.vue +21 -21
- package/dist/runtime/components/Form/InputDateTime/index.vue +60 -60
- 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 +36 -36
- package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
- package/dist/runtime/components/Form/InputText/index.vue +67 -67
- package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
- package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +158 -158
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +242 -242
- package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +101 -101
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +165 -165
- 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 +14 -14
- package/dist/runtime/components/Modal/index.vue +146 -146
- package/dist/runtime/components/SimplePagination.vue +96 -96
- package/dist/runtime/components/Slideover/index.vue +110 -110
- package/dist/runtime/components/Table/Base.vue +139 -139
- 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 +25 -25
- package/dist/runtime/components/Table/Simple.vue +64 -64
- package/dist/runtime/components/Table/index.vue +60 -60
- package/dist/runtime/components/Tabs/index.vue +64 -64
- package/dist/runtime/ui.css +32 -32
- package/package.json +1 -1
|
@@ -1,160 +1,160 @@
|
|
|
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
|
-
<FormInputRadio
|
|
67
|
-
v-else-if="option.type === INPUT_TYPES.RADIO"
|
|
68
|
-
:class="option.class"
|
|
69
|
-
:form="form"
|
|
70
|
-
:options="option.props.options"
|
|
71
|
-
v-bind="getFieldBinding(option)"
|
|
72
|
-
v-on="option.on ?? {}"
|
|
73
|
-
/>
|
|
74
|
-
<FormInputCheckbox
|
|
75
|
-
v-else-if="option.type === INPUT_TYPES.CHECKBOX"
|
|
76
|
-
:class="option.class"
|
|
77
|
-
:form="form"
|
|
78
|
-
v-bind="getFieldBinding(option)"
|
|
79
|
-
v-on="option.on ?? {}"
|
|
80
|
-
/>
|
|
81
|
-
<FormInputDateTime
|
|
82
|
-
v-else-if="option.type === INPUT_TYPES.DATE_TIME"
|
|
83
|
-
:class="option.class"
|
|
84
|
-
:form="form"
|
|
85
|
-
v-bind="getFieldBinding(option)"
|
|
86
|
-
v-on="option.on ?? {}"
|
|
87
|
-
/>
|
|
88
|
-
<FormInputDateTime
|
|
89
|
-
v-else-if="option.type === INPUT_TYPES.DATE"
|
|
90
|
-
:class="option.class"
|
|
91
|
-
:form="form"
|
|
92
|
-
v-bind="getFieldBinding(option)"
|
|
93
|
-
:disabled-time="true"
|
|
94
|
-
v-on="option.on ?? {}"
|
|
95
|
-
/>
|
|
96
|
-
<FormInputUploadFileClassic
|
|
97
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC"
|
|
98
|
-
:class="option.class"
|
|
99
|
-
:form="form"
|
|
100
|
-
v-bind="getFieldBinding(option)"
|
|
101
|
-
v-on="option.on ?? {}"
|
|
102
|
-
/>
|
|
103
|
-
<FormInputUploadFileClassicAuto
|
|
104
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC_AUTO"
|
|
105
|
-
:class="option.class"
|
|
106
|
-
:form="form"
|
|
107
|
-
v-bind="getFieldBinding(option)"
|
|
108
|
-
v-on="option.on ?? {}"
|
|
109
|
-
/>
|
|
110
|
-
<FormInputUploadDropzone
|
|
111
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE"
|
|
112
|
-
:class="option.class"
|
|
113
|
-
:form="form"
|
|
114
|
-
v-bind="getFieldBinding(option)"
|
|
115
|
-
v-on="option.on ?? {}"
|
|
116
|
-
/>
|
|
117
|
-
<FormInputUploadDropzoneAuto
|
|
118
|
-
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_AUTO"
|
|
119
|
-
:class="option.class"
|
|
120
|
-
:form="form"
|
|
121
|
-
:request-options="option.props.requestOptions"
|
|
122
|
-
v-bind="getFieldBinding(option)"
|
|
123
|
-
v-on="option.on ?? {}"
|
|
124
|
-
/>
|
|
125
|
-
</template>
|
|
126
|
-
</div>
|
|
127
|
-
</template>
|
|
128
|
-
<script lang="ts" setup>
|
|
129
|
-
import { type FormContext } from 'vee-validate'
|
|
130
|
-
import { type IFormField, INPUT_TYPES } from '#core/components/Form/types'
|
|
131
|
-
|
|
132
|
-
const props = withDefaults(
|
|
133
|
-
defineProps<{
|
|
134
|
-
form?: FormContext
|
|
135
|
-
options: IFormField[]
|
|
136
|
-
orientation?: 'horizontal' | 'vertical'
|
|
137
|
-
class?: any
|
|
138
|
-
}>(),
|
|
139
|
-
{
|
|
140
|
-
class: 'space-y-4',
|
|
141
|
-
orientation: 'vertical',
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
const getFieldBinding = (field: IFormField) => {
|
|
146
|
-
if (props.orientation === 'horizontal') {
|
|
147
|
-
return {
|
|
148
|
-
...field.props,
|
|
149
|
-
containerUi: {
|
|
150
|
-
...field.props.containerUi,
|
|
151
|
-
wrapper:
|
|
152
|
-
'lg:grid lg:grid-cols-3 lg:gap-4 lg:items-start ' + field.props.containerUi?.wrapper,
|
|
153
|
-
container: 'lg:col-span-2 ' + field.props.containerUi?.container,
|
|
154
|
-
},
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return field.props
|
|
159
|
-
}
|
|
160
|
-
</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
|
+
<FormInputRadio
|
|
67
|
+
v-else-if="option.type === INPUT_TYPES.RADIO"
|
|
68
|
+
:class="option.class"
|
|
69
|
+
:form="form"
|
|
70
|
+
:options="option.props.options"
|
|
71
|
+
v-bind="getFieldBinding(option)"
|
|
72
|
+
v-on="option.on ?? {}"
|
|
73
|
+
/>
|
|
74
|
+
<FormInputCheckbox
|
|
75
|
+
v-else-if="option.type === INPUT_TYPES.CHECKBOX"
|
|
76
|
+
:class="option.class"
|
|
77
|
+
:form="form"
|
|
78
|
+
v-bind="getFieldBinding(option)"
|
|
79
|
+
v-on="option.on ?? {}"
|
|
80
|
+
/>
|
|
81
|
+
<FormInputDateTime
|
|
82
|
+
v-else-if="option.type === INPUT_TYPES.DATE_TIME"
|
|
83
|
+
:class="option.class"
|
|
84
|
+
:form="form"
|
|
85
|
+
v-bind="getFieldBinding(option)"
|
|
86
|
+
v-on="option.on ?? {}"
|
|
87
|
+
/>
|
|
88
|
+
<FormInputDateTime
|
|
89
|
+
v-else-if="option.type === INPUT_TYPES.DATE"
|
|
90
|
+
:class="option.class"
|
|
91
|
+
:form="form"
|
|
92
|
+
v-bind="getFieldBinding(option)"
|
|
93
|
+
:disabled-time="true"
|
|
94
|
+
v-on="option.on ?? {}"
|
|
95
|
+
/>
|
|
96
|
+
<FormInputUploadFileClassic
|
|
97
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC"
|
|
98
|
+
:class="option.class"
|
|
99
|
+
:form="form"
|
|
100
|
+
v-bind="getFieldBinding(option)"
|
|
101
|
+
v-on="option.on ?? {}"
|
|
102
|
+
/>
|
|
103
|
+
<FormInputUploadFileClassicAuto
|
|
104
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_FILE_CLASSIC_AUTO"
|
|
105
|
+
:class="option.class"
|
|
106
|
+
:form="form"
|
|
107
|
+
v-bind="getFieldBinding(option)"
|
|
108
|
+
v-on="option.on ?? {}"
|
|
109
|
+
/>
|
|
110
|
+
<FormInputUploadDropzone
|
|
111
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE"
|
|
112
|
+
:class="option.class"
|
|
113
|
+
:form="form"
|
|
114
|
+
v-bind="getFieldBinding(option)"
|
|
115
|
+
v-on="option.on ?? {}"
|
|
116
|
+
/>
|
|
117
|
+
<FormInputUploadDropzoneAuto
|
|
118
|
+
v-else-if="option.type === INPUT_TYPES.UPLOAD_DROPZONE_AUTO"
|
|
119
|
+
:class="option.class"
|
|
120
|
+
:form="form"
|
|
121
|
+
:request-options="option.props.requestOptions"
|
|
122
|
+
v-bind="getFieldBinding(option)"
|
|
123
|
+
v-on="option.on ?? {}"
|
|
124
|
+
/>
|
|
125
|
+
</template>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
<script lang="ts" setup>
|
|
129
|
+
import { type FormContext } from 'vee-validate'
|
|
130
|
+
import { type IFormField, INPUT_TYPES } from '#core/components/Form/types'
|
|
131
|
+
|
|
132
|
+
const props = withDefaults(
|
|
133
|
+
defineProps<{
|
|
134
|
+
form?: FormContext
|
|
135
|
+
options: IFormField[]
|
|
136
|
+
orientation?: 'horizontal' | 'vertical'
|
|
137
|
+
class?: any
|
|
138
|
+
}>(),
|
|
139
|
+
{
|
|
140
|
+
class: 'space-y-4',
|
|
141
|
+
orientation: 'vertical',
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
const getFieldBinding = (field: IFormField) => {
|
|
146
|
+
if (props.orientation === 'horizontal') {
|
|
147
|
+
return {
|
|
148
|
+
...field.props,
|
|
149
|
+
containerUi: {
|
|
150
|
+
...field.props.containerUi,
|
|
151
|
+
wrapper:
|
|
152
|
+
'lg:grid lg:grid-cols-3 lg:gap-4 lg:items-start ' + field.props.containerUi?.wrapper,
|
|
153
|
+
container: 'lg:col-span-2 ' + field.props.containerUi?.container,
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return field.props
|
|
159
|
+
}
|
|
160
|
+
</script>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps" label="">
|
|
3
|
-
<UCheckbox
|
|
4
|
-
v-model="value"
|
|
5
|
-
:disabled="wrapperProps.isDisabled"
|
|
6
|
-
:name="name"
|
|
7
|
-
:label="props.label"
|
|
8
|
-
:required="isRequired"
|
|
9
|
-
:ui="ui"
|
|
10
|
-
/>
|
|
11
|
-
</FieldWrapper>
|
|
12
|
-
</template>
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import { useFieldHOC } from '#core/composables/useForm'
|
|
15
|
-
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
16
|
-
import { type ICheckboxFieldProps } from '#core/components/Form/InputCheckbox/types'
|
|
17
|
-
|
|
18
|
-
const props = withDefaults(defineProps<ICheckboxFieldProps>(), {})
|
|
19
|
-
|
|
20
|
-
const { value, wrapperProps } = useFieldHOC<boolean>(props)
|
|
21
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps" label="">
|
|
3
|
+
<UCheckbox
|
|
4
|
+
v-model="value"
|
|
5
|
+
:disabled="wrapperProps.isDisabled"
|
|
6
|
+
:name="name"
|
|
7
|
+
:label="props.label"
|
|
8
|
+
:required="isRequired"
|
|
9
|
+
:ui="ui"
|
|
10
|
+
/>
|
|
11
|
+
</FieldWrapper>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
15
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
16
|
+
import { type ICheckboxFieldProps } from '#core/components/Form/InputCheckbox/types'
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(defineProps<ICheckboxFieldProps>(), {})
|
|
19
|
+
|
|
20
|
+
const { value, wrapperProps } = useFieldHOC<boolean>(props)
|
|
21
|
+
</script>
|
|
@@ -1,60 +1,60 @@
|
|
|
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
|
-
:value="innerValue"
|
|
26
|
-
:placeholder="wrapperProps.placeholder"
|
|
27
|
-
:readonly="true"
|
|
28
|
-
input-class="cursor-pointer select-none"
|
|
29
|
-
/>
|
|
30
|
-
</template>
|
|
31
|
-
</Datepicker>
|
|
32
|
-
</FieldWrapper>
|
|
33
|
-
</template>
|
|
34
|
-
<script lang="ts" setup>
|
|
35
|
-
import Datepicker from '@vuepic/vue-datepicker'
|
|
36
|
-
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
37
|
-
import { type IDateTimeFieldProps } from '#core/components/Form/InputDateTime/date_time_field.types'
|
|
38
|
-
import { TimeHelper, useFieldHOC } from '#imports'
|
|
39
|
-
import '@vuepic/vue-datepicker/dist/main.css'
|
|
40
|
-
|
|
41
|
-
const props = withDefaults(defineProps<IDateTimeFieldProps>(), {})
|
|
42
|
-
|
|
43
|
-
const { value, wrapperProps } = useFieldHOC<string>(props)
|
|
44
|
-
|
|
45
|
-
const format = (date: Date) => {
|
|
46
|
-
if (props.disabledTime) {
|
|
47
|
-
return TimeHelper.displayDate(date)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return TimeHelper.displayDateTime(date)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const onInput = (_value: any) => {
|
|
54
|
-
if (props.disabledTime && !props.isReturnISO) {
|
|
55
|
-
value.value = TimeHelper.getDateFormTime(_value)
|
|
56
|
-
} else {
|
|
57
|
-
value.value = _value
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
</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
|
+
:value="innerValue"
|
|
26
|
+
:placeholder="wrapperProps.placeholder"
|
|
27
|
+
:readonly="true"
|
|
28
|
+
input-class="cursor-pointer select-none"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
</Datepicker>
|
|
32
|
+
</FieldWrapper>
|
|
33
|
+
</template>
|
|
34
|
+
<script lang="ts" setup>
|
|
35
|
+
import Datepicker from '@vuepic/vue-datepicker'
|
|
36
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
37
|
+
import { type IDateTimeFieldProps } from '#core/components/Form/InputDateTime/date_time_field.types'
|
|
38
|
+
import { TimeHelper, useFieldHOC } from '#imports'
|
|
39
|
+
import '@vuepic/vue-datepicker/dist/main.css'
|
|
40
|
+
|
|
41
|
+
const props = withDefaults(defineProps<IDateTimeFieldProps>(), {})
|
|
42
|
+
|
|
43
|
+
const { value, wrapperProps } = useFieldHOC<string>(props)
|
|
44
|
+
|
|
45
|
+
const format = (date: Date) => {
|
|
46
|
+
if (props.disabledTime) {
|
|
47
|
+
return TimeHelper.displayDate(date)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return TimeHelper.displayDateTime(date)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const onInput = (_value: any) => {
|
|
54
|
+
if (props.disabledTime && !props.isReturnISO) {
|
|
55
|
+
value.value = TimeHelper.getDateFormTime(_value)
|
|
56
|
+
} else {
|
|
57
|
+
value.value = _value
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<UInput
|
|
4
|
-
v-model.number="value"
|
|
5
|
-
type="number"
|
|
6
|
-
:disabled="wrapperProps.isDisabled"
|
|
7
|
-
:leading-icon="leadingIcon"
|
|
8
|
-
:trailing-icon="trailingIcon"
|
|
9
|
-
:name="name"
|
|
10
|
-
:placeholder="wrapperProps.placeholder"
|
|
11
|
-
:autofocus="!!autoFocus"
|
|
12
|
-
:icon="icon"
|
|
13
|
-
:readonly="isReadonly"
|
|
14
|
-
:ui="_deepMerge({}, ui, { icon: { trailing: { pointer: '' } } })"
|
|
15
|
-
/>
|
|
16
|
-
</FieldWrapper>
|
|
17
|
-
</template>
|
|
18
|
-
<script lang="ts" setup>
|
|
19
|
-
import { _deepMerge } from '#imports'
|
|
20
|
-
import { useFieldHOC } from '#core/composables/useForm'
|
|
21
|
-
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
22
|
-
import type { INumberFieldProps } from '#core/components/Form/InputNumber/types'
|
|
23
|
-
|
|
24
|
-
const props = withDefaults(defineProps<INumberFieldProps>(), {})
|
|
25
|
-
|
|
26
|
-
const { value, wrapperProps } = useFieldHOC<number>(props)
|
|
27
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<UInput
|
|
4
|
+
v-model.number="value"
|
|
5
|
+
type="number"
|
|
6
|
+
:disabled="wrapperProps.isDisabled"
|
|
7
|
+
:leading-icon="leadingIcon"
|
|
8
|
+
:trailing-icon="trailingIcon"
|
|
9
|
+
:name="name"
|
|
10
|
+
:placeholder="wrapperProps.placeholder"
|
|
11
|
+
:autofocus="!!autoFocus"
|
|
12
|
+
:icon="icon"
|
|
13
|
+
:readonly="isReadonly"
|
|
14
|
+
:ui="_deepMerge({}, ui, { icon: { trailing: { pointer: '' } } })"
|
|
15
|
+
/>
|
|
16
|
+
</FieldWrapper>
|
|
17
|
+
</template>
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import { _deepMerge } from '#imports'
|
|
20
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
21
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
22
|
+
import type { INumberFieldProps } from '#core/components/Form/InputNumber/types'
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(defineProps<INumberFieldProps>(), {})
|
|
25
|
+
|
|
26
|
+
const { value, wrapperProps } = useFieldHOC<number>(props)
|
|
27
|
+
</script>
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<URadioGroup
|
|
4
|
-
v-model="value"
|
|
5
|
-
:options="options"
|
|
6
|
-
:disabled="wrapperProps.isDisabled"
|
|
7
|
-
:required="isRequired"
|
|
8
|
-
value-attribute="value"
|
|
9
|
-
option-attribute="label"
|
|
10
|
-
:icon="icon"
|
|
11
|
-
:color="color"
|
|
12
|
-
:size="size"
|
|
13
|
-
:ui="ui"
|
|
14
|
-
:ui-menu="uiMenu"
|
|
15
|
-
/>
|
|
16
|
-
</FieldWrapper>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script lang="ts" setup>
|
|
20
|
-
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
21
|
-
import { useFieldHOC } from '#core/composables/useForm'
|
|
22
|
-
import { type ISelectFieldProps } from '#core/components/Form/InputSelect/types'
|
|
23
|
-
|
|
24
|
-
const props = withDefaults(defineProps<ISelectFieldProps>(), {})
|
|
25
|
-
|
|
26
|
-
const { value, wrapperProps } = useFieldHOC<any>(props)
|
|
27
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<URadioGroup
|
|
4
|
+
v-model="value"
|
|
5
|
+
:options="options"
|
|
6
|
+
:disabled="wrapperProps.isDisabled"
|
|
7
|
+
:required="isRequired"
|
|
8
|
+
value-attribute="value"
|
|
9
|
+
option-attribute="label"
|
|
10
|
+
:icon="icon"
|
|
11
|
+
:color="color"
|
|
12
|
+
:size="size"
|
|
13
|
+
:ui="ui"
|
|
14
|
+
:ui-menu="uiMenu"
|
|
15
|
+
/>
|
|
16
|
+
</FieldWrapper>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
21
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
22
|
+
import { type ISelectFieldProps } from '#core/components/Form/InputSelect/types'
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(defineProps<ISelectFieldProps>(), {})
|
|
25
|
+
|
|
26
|
+
const { value, wrapperProps } = useFieldHOC<any>(props)
|
|
27
|
+
</script>
|