easycomponentstools 1.0.0-dev.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/.idea/EasyComponents.iml +8 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +19 -0
- package/.idea/prettier.xml +7 -0
- package/.prettierrc +9 -0
- package/dist/easyComponents.es.js +35624 -0
- package/dist/easyComponents.umd.js +27 -0
- package/dist/easycomponents.css +2 -0
- package/dist/src/components/Form/EasyForm.vue.d.ts +24 -0
- package/dist/src/components/Form/MenuActions.vue.d.ts +7 -0
- package/dist/src/components/Form/types/DatePicker.vue.d.ts +16 -0
- package/dist/src/components/Form/types/FileInput.vue.d.ts +16 -0
- package/dist/src/components/Form/types/Gallery.vue.d.ts +7 -0
- package/dist/src/components/Form/types/Input.vue.d.ts +12 -0
- package/dist/src/components/Form/types/MapAutoComplete.vue.d.ts +20 -0
- package/dist/src/components/Form/types/Number.vue.d.ts +12 -0
- package/dist/src/components/Form/types/Password.vue.d.ts +12 -0
- package/dist/src/components/Form/types/RangeDatePicker.vue.d.ts +16 -0
- package/dist/src/components/Form/types/Selects.vue.d.ts +16 -0
- package/dist/src/components/Form/types/SelectsAutoComplete.vue.d.ts +16 -0
- package/dist/src/components/Form/types/Switch.vue.d.ts +16 -0
- package/dist/src/components/Form/types/Tags.vue.d.ts +16 -0
- package/dist/src/components/Form/types/TextArea.vue.d.ts +12 -0
- package/dist/src/components/Form/types/map/CustomMapAutoComplete.vue.d.ts +7 -0
- package/dist/src/composables/useHelpers.d.ts +9 -0
- package/dist/src/composables/useMap.d.ts +41 -0
- package/dist/src/lang/el/form.d.ts +5 -0
- package/dist/src/lang/el/index.d.ts +7 -0
- package/dist/src/lang/en/form.d.ts +5 -0
- package/dist/src/lang/en/index.d.ts +7 -0
- package/dist/src/main.d.ts +6 -0
- package/dist/src/stores/useInfo.d.ts +7 -0
- package/dist/src/types/form.d.ts +48 -0
- package/dist/src/types/gallery.d.ts +4 -0
- package/dist/src/types/map.d.ts +32 -0
- package/dist/src/types/plugins.d.ts +14 -0
- package/dist/src/types/table.d.ts +79 -0
- package/eslint.config.ts +26 -0
- package/package.json +54 -0
- package/src/components/Form/EasyForm.vue +194 -0
- package/src/components/Form/MenuActions.vue +40 -0
- package/src/components/Form/types/DatePicker.vue +103 -0
- package/src/components/Form/types/FileInput.vue +68 -0
- package/src/components/Form/types/Gallery.vue +28 -0
- package/src/components/Form/types/Input.vue +23 -0
- package/src/components/Form/types/MapAutoComplete.vue +83 -0
- package/src/components/Form/types/Number.vue +24 -0
- package/src/components/Form/types/Password.vue +53 -0
- package/src/components/Form/types/RangeDatePicker.vue +133 -0
- package/src/components/Form/types/Selects.vue +24 -0
- package/src/components/Form/types/SelectsAutoComplete.vue +24 -0
- package/src/components/Form/types/Switch.vue +24 -0
- package/src/components/Form/types/Tags.vue +59 -0
- package/src/components/Form/types/TextArea.vue +23 -0
- package/src/components/Form/types/map/CustomMapAutoComplete.vue +83 -0
- package/src/composables/useHelpers.ts +48 -0
- package/src/composables/useMap.ts +104 -0
- package/src/lang/el/form.ts +4 -0
- package/src/lang/el/index.ts +5 -0
- package/src/lang/en/form.ts +4 -0
- package/src/lang/en/index.ts +5 -0
- package/src/main.ts +59 -0
- package/src/scss/app.scss +57 -0
- package/src/shims-scss.d.ts +3 -0
- package/src/stores/useInfo.ts +10 -0
- package/src/types/form.ts +63 -0
- package/src/types/gallery.ts +4 -0
- package/src/types/map.ts +33 -0
- package/src/types/plugins.ts +15 -0
- package/src/types/table.ts +80 -0
- package/tsconfig.json +9 -0
- package/vite.config.ts +19 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container class="mainform" :height="($attrs.height as string | undefined) ?? '100%'">
|
|
3
|
+
<v-form v-if="formdata && formdata.binder" ref="formref">
|
|
4
|
+
<v-card :elevation="formdata?.elevation ?? 1" :loading="loading">
|
|
5
|
+
<v-card-title v-if="formdata.title">
|
|
6
|
+
<i v-if="formdata.icon" :class="formdata.icon" /> {{ formdata.title }}
|
|
7
|
+
</v-card-title>
|
|
8
|
+
<v-card-subtitle v-if="formdata.subtitle">
|
|
9
|
+
{{ formdata.subtitle }}
|
|
10
|
+
</v-card-subtitle>
|
|
11
|
+
<v-card-text>
|
|
12
|
+
<v-row v-for="(input, index) in formdata.inputs" :key="index">
|
|
13
|
+
<v-col v-if="input.type === 'input'">
|
|
14
|
+
<Input
|
|
15
|
+
v-model="formdata.binder[input.key]"
|
|
16
|
+
:input="input"
|
|
17
|
+
@submit="submit"
|
|
18
|
+
></Input>
|
|
19
|
+
</v-col>
|
|
20
|
+
<v-col v-if="input.type === 'textarea'">
|
|
21
|
+
<TextArea
|
|
22
|
+
v-model="formdata.binder[input.key]"
|
|
23
|
+
:input="input"
|
|
24
|
+
@submit="submit"
|
|
25
|
+
></TextArea>
|
|
26
|
+
</v-col>
|
|
27
|
+
<v-col v-if="input.type === 'number'">
|
|
28
|
+
<Number
|
|
29
|
+
v-model="formdata.binder[input.key]"
|
|
30
|
+
:input="input"
|
|
31
|
+
@submit="submit"
|
|
32
|
+
></Number>
|
|
33
|
+
</v-col>
|
|
34
|
+
<v-col v-if="input.type === 'password' || input.type === 'password-eye'">
|
|
35
|
+
<Password
|
|
36
|
+
v-model="formdata.binder[input.key]"
|
|
37
|
+
:input="input"
|
|
38
|
+
@update:type="(type: inputType) => (input.type = type)"
|
|
39
|
+
@submit="submit"
|
|
40
|
+
></Password>
|
|
41
|
+
</v-col>
|
|
42
|
+
<v-col v-if="input.type === 'checkbox'">
|
|
43
|
+
<Switch v-model="formdata.binder[input.key]" :input="input"></Switch>
|
|
44
|
+
</v-col>
|
|
45
|
+
<v-col v-if="input.type === 'selects'">
|
|
46
|
+
<Selects v-model="formdata.binder[input.key]" :input="input"></Selects>
|
|
47
|
+
</v-col>
|
|
48
|
+
<v-col v-if="input.type === 'selectsAutoComplete'">
|
|
49
|
+
<SelectsAutoComplete
|
|
50
|
+
v-model="formdata.binder[input.key]"
|
|
51
|
+
:input="input"
|
|
52
|
+
></SelectsAutoComplete>
|
|
53
|
+
</v-col>
|
|
54
|
+
<v-col v-if="input.type === 'selectsAutoCompleteChips'">
|
|
55
|
+
<Tags v-model="formdata.binder[input.key]" :input="input"> </Tags>
|
|
56
|
+
</v-col>
|
|
57
|
+
<v-col v-if="input.type === 'date'">
|
|
58
|
+
<DatePicker
|
|
59
|
+
v-model="formdata.binder[input.key]"
|
|
60
|
+
:input="input"
|
|
61
|
+
></DatePicker>
|
|
62
|
+
</v-col>
|
|
63
|
+
<v-col v-if="input.type === 'rangeDate'">
|
|
64
|
+
<RangeDatePicker v-model="formdata.binder[input.key]" :input="input">
|
|
65
|
+
</RangeDatePicker>
|
|
66
|
+
</v-col>
|
|
67
|
+
<v-col v-if="input.type === 'file'" eager>
|
|
68
|
+
<FileInput v-model="formdata.binder[input.key]" :input="input">
|
|
69
|
+
</FileInput>
|
|
70
|
+
</v-col>
|
|
71
|
+
<v-col v-if="input.type === 'map'">
|
|
72
|
+
<MapAutoComplete v-model="formdata.binder[input.key]" :input="input">
|
|
73
|
+
</MapAutoComplete>
|
|
74
|
+
</v-col>
|
|
75
|
+
<v-col v-if="input.type === 'slot'">
|
|
76
|
+
<slot
|
|
77
|
+
:name="input.key"
|
|
78
|
+
:items="formdata.binder[input.key]"
|
|
79
|
+
:options="{ ...input?.options }"
|
|
80
|
+
/>
|
|
81
|
+
</v-col>
|
|
82
|
+
</v-row>
|
|
83
|
+
</v-card-text>
|
|
84
|
+
<v-card-actions v-if="formdata.button || formdata.menuButtons || formdata.submit">
|
|
85
|
+
<v-row class="p-4">
|
|
86
|
+
<v-col v-if="formdata.button" style="display: flex; justify-content: start">
|
|
87
|
+
<v-btn
|
|
88
|
+
class="ellipsis_btn"
|
|
89
|
+
:color="formdata.button?.color ?? 'error'"
|
|
90
|
+
variant="flat"
|
|
91
|
+
:loading="!!formdata.button?.loading"
|
|
92
|
+
:disabled="!!formdata.button?.disabled"
|
|
93
|
+
@click="formdata.button.onClick()"
|
|
94
|
+
>
|
|
95
|
+
<i v-if="formdata.button.icon" :class="formdata.button.icon" />
|
|
96
|
+
<span class="labelMore">
|
|
97
|
+
{{ formdata.button.label }}
|
|
98
|
+
</span>
|
|
99
|
+
</v-btn>
|
|
100
|
+
</v-col>
|
|
101
|
+
<v-col
|
|
102
|
+
v-if="formdata.menuButtons"
|
|
103
|
+
style="display: flex; justify-content: start"
|
|
104
|
+
>
|
|
105
|
+
<MenuActions :menu-buttons="formdata.menuButtons"></MenuActions>
|
|
106
|
+
</v-col>
|
|
107
|
+
<v-col style="display: flex; justify-content: end">
|
|
108
|
+
<v-btn
|
|
109
|
+
v-if="formdata.submit"
|
|
110
|
+
class="ellipsis_btn"
|
|
111
|
+
:loading="loading"
|
|
112
|
+
:color="formdata.submit?.color ?? 'success'"
|
|
113
|
+
variant="flat"
|
|
114
|
+
@click="submit"
|
|
115
|
+
>
|
|
116
|
+
<i v-if="formdata.submit.icon" :class="formdata.submit.icon" />
|
|
117
|
+
<span class="labelMore">
|
|
118
|
+
{{ formdata.submit.label ?? '' }}
|
|
119
|
+
</span>
|
|
120
|
+
</v-btn>
|
|
121
|
+
</v-col>
|
|
122
|
+
</v-row>
|
|
123
|
+
</v-card-actions>
|
|
124
|
+
</v-card>
|
|
125
|
+
</v-form>
|
|
126
|
+
</v-container>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script setup lang="ts">
|
|
130
|
+
import { ComponentPublicInstance, onMounted, ref, Ref } from 'vue'
|
|
131
|
+
import { FormDTO, inputType } from '../../types/form'
|
|
132
|
+
import Input from './types/Input.vue'
|
|
133
|
+
import TextArea from './types/TextArea.vue'
|
|
134
|
+
import Number from './types/Number.vue'
|
|
135
|
+
import Password from './types/Password.vue'
|
|
136
|
+
import Switch from './types/Switch.vue'
|
|
137
|
+
import Selects from './types/Selects.vue'
|
|
138
|
+
import SelectsAutoComplete from './types/SelectsAutoComplete.vue'
|
|
139
|
+
import Tags from './types/Tags.vue'
|
|
140
|
+
import DatePicker from './types/DatePicker.vue'
|
|
141
|
+
import RangeDatePicker from './types/RangeDatePicker.vue'
|
|
142
|
+
import FileInput from './types/FileInput.vue'
|
|
143
|
+
import MapAutoComplete from './types/MapAutoComplete.vue'
|
|
144
|
+
import MenuActions from './MenuActions.vue'
|
|
145
|
+
|
|
146
|
+
type propsTypes = {
|
|
147
|
+
form: FormDTO
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const props = defineProps<propsTypes>()
|
|
151
|
+
const formdata: Ref<FormDTO | null> = ref(null)
|
|
152
|
+
const formref: Ref<ComponentPublicInstance | null> = ref(null)
|
|
153
|
+
const loading: Ref<boolean> = ref(false)
|
|
154
|
+
|
|
155
|
+
async function submit() {
|
|
156
|
+
if (!formdata.value) return null
|
|
157
|
+
if (loading.value) return null
|
|
158
|
+
const valid = await (formref?.value as any)?.validate()
|
|
159
|
+
if (!valid?.valid) return null
|
|
160
|
+
|
|
161
|
+
const data = {}
|
|
162
|
+
formdata.value.inputs.forEach((input) => {
|
|
163
|
+
if (
|
|
164
|
+
formdata.value &&
|
|
165
|
+
formdata.value.binder[input.key] &&
|
|
166
|
+
formdata.value.binder[input.key].length !== 0
|
|
167
|
+
) {
|
|
168
|
+
Object.assign(data, { [input.key]: formdata.value.binder[input.key] })
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
if (formdata.value.submit && typeof formdata.value.submit.onSubmit === 'function') {
|
|
172
|
+
formdata.value.submit.onSubmit(data)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
onMounted(() => {
|
|
177
|
+
formdata.value = props.form
|
|
178
|
+
if (formdata.value && formdata.value.binder) {
|
|
179
|
+
Object.keys(formdata.value.binder).map((key) => {
|
|
180
|
+
if (
|
|
181
|
+
formdata.value &&
|
|
182
|
+
formdata.value.binder[key] &&
|
|
183
|
+
!Array.isArray(formdata.value.binder[key]) &&
|
|
184
|
+
typeof formdata.value.binder[key] === 'object' &&
|
|
185
|
+
(isNaN(formdata.value.binder[key].lat) || isNaN(formdata.value.binder[key].lng))
|
|
186
|
+
) {
|
|
187
|
+
formdata.value.binder.value[key] = { lat: 0, lng: 0 }
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
defineExpose({ formref, loading })
|
|
194
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu>
|
|
3
|
+
<template #activator="{ props: menuProps }">
|
|
4
|
+
<v-btn
|
|
5
|
+
class="ellipsis_btn"
|
|
6
|
+
v-bind="menuProps"
|
|
7
|
+
:color="menuButtons?.color ?? 'error'"
|
|
8
|
+
variant="flat"
|
|
9
|
+
>
|
|
10
|
+
<i v-if="menuButtons?.icon" :class="menuButtons?.icon" />
|
|
11
|
+
<span class="labelMore">{{ menuButtons.label }}</span>
|
|
12
|
+
<v-icon>icon-chevron-down</v-icon>
|
|
13
|
+
</v-btn>
|
|
14
|
+
</template>
|
|
15
|
+
<v-list>
|
|
16
|
+
<v-list-item
|
|
17
|
+
v-for="(item, index) in menuButtons.items"
|
|
18
|
+
:key="index"
|
|
19
|
+
:value="index"
|
|
20
|
+
@click="item.onClick()"
|
|
21
|
+
>
|
|
22
|
+
<template #prepend>
|
|
23
|
+
<v-icon v-if="item?.icon">{{ item.icon }}</v-icon>
|
|
24
|
+
</template>
|
|
25
|
+
<v-list-item-title>
|
|
26
|
+
{{ item.label }}
|
|
27
|
+
</v-list-item-title>
|
|
28
|
+
</v-list-item>
|
|
29
|
+
</v-list>
|
|
30
|
+
</v-menu>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { MenuButtonsDTO } from '../../types/form'
|
|
35
|
+
|
|
36
|
+
type propsType = {
|
|
37
|
+
menuButtons: MenuButtonsDTO
|
|
38
|
+
}
|
|
39
|
+
defineProps<propsType>()
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog v-model="dialog" max-width="380">
|
|
3
|
+
<template #activator="{ props: activatorProps }">
|
|
4
|
+
<v-text-field
|
|
5
|
+
v-model="dateText"
|
|
6
|
+
readonly
|
|
7
|
+
:label="input.label"
|
|
8
|
+
clearable
|
|
9
|
+
v-bind="{ ...input.options, ...activatorProps }"
|
|
10
|
+
:rules="input.validation && input.validation.length !== 0 ? input.validation : []"
|
|
11
|
+
:class="input.required ? 'required_field' : null"
|
|
12
|
+
@click:clear="clear"
|
|
13
|
+
>
|
|
14
|
+
</v-text-field>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<v-card>
|
|
18
|
+
<v-card-text>
|
|
19
|
+
<v-date-picker v-if="isDate" v-model="date" />
|
|
20
|
+
<v-time-picker
|
|
21
|
+
v-if="isTime && input.options.enableTime"
|
|
22
|
+
v-model="time"
|
|
23
|
+
format="24hr"
|
|
24
|
+
></v-time-picker>
|
|
25
|
+
</v-card-text>
|
|
26
|
+
<v-card-actions>
|
|
27
|
+
<v-btn @click="cancel">
|
|
28
|
+
{{ $i18n.t('form.cancel') }}
|
|
29
|
+
</v-btn>
|
|
30
|
+
<v-btn @click="getDate"> OK </v-btn>
|
|
31
|
+
</v-card-actions>
|
|
32
|
+
</v-card>
|
|
33
|
+
</v-dialog>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { Ref, ref, watch } from 'vue'
|
|
38
|
+
import { InputDTO } from '../../../types/form'
|
|
39
|
+
import { useI18n } from 'vue-i18n'
|
|
40
|
+
import useHelpers from '../../../composables/useHelpers'
|
|
41
|
+
|
|
42
|
+
type propsType = {
|
|
43
|
+
input: InputDTO
|
|
44
|
+
}
|
|
45
|
+
const props = defineProps<propsType>()
|
|
46
|
+
const $i18n = useI18n()
|
|
47
|
+
const { dateTimeFormatter, dateFormatter, timeFormatter, dateValue, dateTimeValue } = useHelpers()
|
|
48
|
+
const date: Ref<Date | string | null> = ref(null)
|
|
49
|
+
const time: Ref<string | null> = ref(null)
|
|
50
|
+
const dateText: Ref<string> = ref('')
|
|
51
|
+
const dialog: Ref<boolean> = ref(false)
|
|
52
|
+
const isDate: Ref<boolean> = ref(true)
|
|
53
|
+
const isTime: Ref<boolean> = ref(false)
|
|
54
|
+
const dateTimeModel = defineModel<string | null>()
|
|
55
|
+
|
|
56
|
+
watch(
|
|
57
|
+
dateTimeModel,
|
|
58
|
+
(v) => {
|
|
59
|
+
date.value = v ? new Date(v) : null
|
|
60
|
+
if (date.value) {
|
|
61
|
+
dateText.value = props.input.options.enableTime
|
|
62
|
+
? dateTimeFormatter(date.value)
|
|
63
|
+
: dateFormatter(date.value)
|
|
64
|
+
if (props.input.options.enableTime) {
|
|
65
|
+
time.value = timeFormatter(date.value)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{ deep: true, immediate: true }
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
const getDate = () => {
|
|
73
|
+
if (!date.value) return
|
|
74
|
+
if (isDate.value) {
|
|
75
|
+
if (props.input.options.enableTime) {
|
|
76
|
+
isTime.value = true
|
|
77
|
+
isDate.value = false
|
|
78
|
+
} else {
|
|
79
|
+
dateText.value = dateFormatter(date.value)
|
|
80
|
+
dateTimeModel.value = dateValue(date.value)
|
|
81
|
+
dialog.value = false
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
const datetime = `${dateValue(date.value)} ${time.value}`
|
|
85
|
+
dateText.value = dateTimeFormatter(datetime)
|
|
86
|
+
dateTimeModel.value = dateTimeValue(datetime)
|
|
87
|
+
isDate.value = true
|
|
88
|
+
isTime.value = false
|
|
89
|
+
dialog.value = false
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const cancel = () => {
|
|
93
|
+
isDate.value = true
|
|
94
|
+
isTime.value = false
|
|
95
|
+
dialog.value = false
|
|
96
|
+
}
|
|
97
|
+
const clear = () => {
|
|
98
|
+
date.value = null
|
|
99
|
+
dateTimeModel.value = null
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-card elevation="0">
|
|
3
|
+
<v-card-title style="font-size: 16px">
|
|
4
|
+
<v-icon v-if="input.icon">{{ input.icon }}</v-icon> {{ input.label }}
|
|
5
|
+
</v-card-title>
|
|
6
|
+
<v-card-text>
|
|
7
|
+
<v-row>
|
|
8
|
+
<v-col v-if="checkMedia()" cols="12" md="6">
|
|
9
|
+
<Gallery
|
|
10
|
+
v-if="Array.isArray(value) && value.length !== 0"
|
|
11
|
+
:id="input.key"
|
|
12
|
+
:ref="input.key"
|
|
13
|
+
:media="value"
|
|
14
|
+
eager
|
|
15
|
+
@on-delete="
|
|
16
|
+
(v: any) =>
|
|
17
|
+
typeof input.onDelete === 'function' ? input.onDelete(v) : null
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
</Gallery>
|
|
21
|
+
</v-col>
|
|
22
|
+
<v-col cols="12" :md="checkMedia() ? 6 : 12" class="d-flex align-center">
|
|
23
|
+
<v-file-upload
|
|
24
|
+
v-bind="{ ...input.options }"
|
|
25
|
+
v-model="fileValue"
|
|
26
|
+
density="default"
|
|
27
|
+
:class="input.required ? 'required_field' : null"
|
|
28
|
+
:label="input.label"
|
|
29
|
+
:rules="
|
|
30
|
+
input.validation && input.validation.length !== 0
|
|
31
|
+
? input.validation
|
|
32
|
+
: []
|
|
33
|
+
"
|
|
34
|
+
>
|
|
35
|
+
</v-file-upload>
|
|
36
|
+
</v-col>
|
|
37
|
+
</v-row>
|
|
38
|
+
</v-card-text>
|
|
39
|
+
</v-card>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import Gallery from './Gallery.vue'
|
|
44
|
+
import { InputDTO } from '../../../types/form'
|
|
45
|
+
import { ref, Ref, watch } from 'vue'
|
|
46
|
+
|
|
47
|
+
type propsType = {
|
|
48
|
+
input: InputDTO
|
|
49
|
+
}
|
|
50
|
+
defineProps<propsType>()
|
|
51
|
+
const value = defineModel<any[]>()
|
|
52
|
+
const fileValue: Ref<File | File[] | null> = ref(null)
|
|
53
|
+
const checkMedia = () => value.value?.some((item: any) => !!item?.src)
|
|
54
|
+
|
|
55
|
+
watch(
|
|
56
|
+
fileValue,
|
|
57
|
+
(v: File | File[] | null) => {
|
|
58
|
+
if (Array.isArray(v)) {
|
|
59
|
+
value.value = v
|
|
60
|
+
} else if (v) {
|
|
61
|
+
value.value = [v]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{ deep: true, immediate: true }
|
|
65
|
+
)
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style scoped></style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-carousel>
|
|
3
|
+
<v-carousel-item v-for="(image, index) in media" :key="index" :src="image.src">
|
|
4
|
+
<v-btn
|
|
5
|
+
class="delete_btn"
|
|
6
|
+
color="error"
|
|
7
|
+
variant="flat"
|
|
8
|
+
@click="emit('onDelete', image.id)"
|
|
9
|
+
>
|
|
10
|
+
{{ $i18n.t('form.delete') }}
|
|
11
|
+
</v-btn>
|
|
12
|
+
</v-carousel-item>
|
|
13
|
+
</v-carousel>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { Media } from '../../../types/gallery'
|
|
18
|
+
import { useI18n } from 'vue-i18n'
|
|
19
|
+
|
|
20
|
+
type propsType = {
|
|
21
|
+
media: Media[]
|
|
22
|
+
}
|
|
23
|
+
defineProps<propsType>()
|
|
24
|
+
const $i18n = useI18n()
|
|
25
|
+
const emit = defineEmits(['onDelete'])
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style scoped></style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-text-field
|
|
3
|
+
v-model="value"
|
|
4
|
+
:label="input.label"
|
|
5
|
+
:class="input.required ? 'required_field' : null"
|
|
6
|
+
v-bind="{ ...input.options }"
|
|
7
|
+
:rules="input.validation && input.validation.length !== 0 ? input.validation : []"
|
|
8
|
+
@keyup.enter="emit('submit')"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { InputDTO } from '../../../types/form'
|
|
14
|
+
|
|
15
|
+
type propsType = {
|
|
16
|
+
input: InputDTO
|
|
17
|
+
}
|
|
18
|
+
defineProps<propsType>()
|
|
19
|
+
const value = defineModel<string>()
|
|
20
|
+
const emit = defineEmits(['submit'])
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped></style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CustomMapAutoComplete
|
|
3
|
+
:class="input.required ? 'required_field' : ''"
|
|
4
|
+
:label="input.label"
|
|
5
|
+
@place_changed="change_location"
|
|
6
|
+
></CustomMapAutoComplete>
|
|
7
|
+
<v-card ref="cardMapRef" :loading="loading" :elevation="0" class="cardMap">
|
|
8
|
+
<GMapMap
|
|
9
|
+
id="gmap"
|
|
10
|
+
:key="input.key + '_' + $useMap.mapOptions.value.key"
|
|
11
|
+
ref="mapRef"
|
|
12
|
+
:center="value"
|
|
13
|
+
map-type-id="hybrid"
|
|
14
|
+
:zoom="$useMap.mapOptions.value.zoom"
|
|
15
|
+
:options="$useMap.mapOptions.value"
|
|
16
|
+
style="height: 500px"
|
|
17
|
+
>
|
|
18
|
+
<v-btn
|
|
19
|
+
:key="$useMap.fullScreenButtonKey.value"
|
|
20
|
+
class="fullscreen_btn"
|
|
21
|
+
@click="$useMap.toggleFullscreen()"
|
|
22
|
+
>
|
|
23
|
+
<i :class="$useMap.isFullScreen() ? 'icon-shrink' : 'icon-maximize'"></i>
|
|
24
|
+
</v-btn>
|
|
25
|
+
<GMapMarker :position="value" :draggable="true" @dragend="set_location" />
|
|
26
|
+
</GMapMap>
|
|
27
|
+
</v-card>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import CustomMapAutoComplete from './map/CustomMapAutoComplete.vue'
|
|
32
|
+
import { ComponentPublicInstance, onMounted, ref } from 'vue'
|
|
33
|
+
import useMap from '../../../composables/useMap'
|
|
34
|
+
import { InputDTO } from '../../../types/form'
|
|
35
|
+
|
|
36
|
+
type propsType = {
|
|
37
|
+
input: InputDTO
|
|
38
|
+
}
|
|
39
|
+
type Location = {
|
|
40
|
+
lat: number
|
|
41
|
+
lng: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
defineProps<propsType>()
|
|
45
|
+
const value = defineModel<Location>()
|
|
46
|
+
const $useMap = useMap()
|
|
47
|
+
const cardMapRef = ref<ComponentPublicInstance | null>(null)
|
|
48
|
+
const mapRef = ref<ComponentPublicInstance | null>(null)
|
|
49
|
+
const loading = ref<string | undefined>(undefined)
|
|
50
|
+
|
|
51
|
+
const change_location = (place: any) => {
|
|
52
|
+
const { lat, lng } = place.geometry.location
|
|
53
|
+
value.value = {
|
|
54
|
+
lat,
|
|
55
|
+
lng,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$useMap.mapOptions.value.zoom = 18
|
|
59
|
+
$useMap.mapOptions.value.key++
|
|
60
|
+
}
|
|
61
|
+
const set_location = (position: any) => {
|
|
62
|
+
if (!value.value) return
|
|
63
|
+
value.value.lat = position.latLng.lat()
|
|
64
|
+
value.value.lng = position.latLng.lng()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
if (!cardMapRef.value) return
|
|
70
|
+
if (!mapRef.value) return
|
|
71
|
+
$useMap.addMap(mapRef.value, cardMapRef.value)
|
|
72
|
+
const map: any = (mapRef.value as any).$mapObject
|
|
73
|
+
if (map) {
|
|
74
|
+
const panorama = map.getStreetView()
|
|
75
|
+
panorama.setOptions({
|
|
76
|
+
fullscreenControl: false, // Disable fullscreen control inside Street View
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
}, 500)
|
|
80
|
+
})
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<style scoped></style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-text-field
|
|
3
|
+
v-model.number="value"
|
|
4
|
+
:class="input.required ? 'required_field' : null"
|
|
5
|
+
type="number"
|
|
6
|
+
:label="input.label"
|
|
7
|
+
v-bind="{ ...input.options }"
|
|
8
|
+
:rules="input.validation && input.validation.length !== 0 ? input.validation : []"
|
|
9
|
+
@keyup.enter="emit('submit')"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { InputDTO } from '../../../types/form'
|
|
15
|
+
|
|
16
|
+
type propsType = {
|
|
17
|
+
input: InputDTO
|
|
18
|
+
}
|
|
19
|
+
defineProps<propsType>()
|
|
20
|
+
const value = defineModel<number>()
|
|
21
|
+
const emit = defineEmits(['submit'])
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style scoped></style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-text-field
|
|
3
|
+
v-model="value"
|
|
4
|
+
:class="input.required ? 'required_field' : null"
|
|
5
|
+
:type="input.type === 'password' ? 'password' : 'text'"
|
|
6
|
+
:label="input.label"
|
|
7
|
+
v-bind="{ ...input.options }"
|
|
8
|
+
:rules="input.validation && input.validation.length !== 0 ? input.validation : []"
|
|
9
|
+
@keyup.enter="emit('submit')"
|
|
10
|
+
>
|
|
11
|
+
<template #append-inner>
|
|
12
|
+
<span style="cursor: pointer; font-size: 22px" @click="setPassword()">
|
|
13
|
+
<i :class="input.type === 'password' ? 'icon icon-eye' : 'icon icon-eye-off'" />
|
|
14
|
+
</span>
|
|
15
|
+
<v-tooltip location="bottom">
|
|
16
|
+
<template #activator="{ props }">
|
|
17
|
+
<span
|
|
18
|
+
v-if="typeof input.moreButton?.onClick === 'function'"
|
|
19
|
+
v-bind="props"
|
|
20
|
+
class="moreOption"
|
|
21
|
+
@click="input.moreButton.onClick"
|
|
22
|
+
>
|
|
23
|
+
<i :class="input.moreButton.icon" />
|
|
24
|
+
</span>
|
|
25
|
+
</template>
|
|
26
|
+
{{ input.moreButton?.label ?? '' }}
|
|
27
|
+
</v-tooltip>
|
|
28
|
+
</template>
|
|
29
|
+
</v-text-field>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import { InputDTO } from '../../../types/form'
|
|
34
|
+
|
|
35
|
+
type propsType = {
|
|
36
|
+
input: InputDTO
|
|
37
|
+
}
|
|
38
|
+
const props = defineProps<propsType>()
|
|
39
|
+
const value = defineModel<string>()
|
|
40
|
+
const emit = defineEmits(['submit', 'update:type'])
|
|
41
|
+
|
|
42
|
+
const setPassword = () => {
|
|
43
|
+
emit('update:type', props.input.type === 'password' ? 'password-eye' : 'password')
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<style scoped>
|
|
48
|
+
.moreOption {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
font-size: 22px;
|
|
51
|
+
margin-left: 5px;
|
|
52
|
+
}
|
|
53
|
+
</style>
|