una-nuxt-module 2.1.0 → 2.1.2
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/.nuxt/unaxt/button.ts +36 -0
- package/.nuxt/unaxt.css +3 -0
- package/dist/module.json +4 -4
- package/dist/module.mjs +145 -48
- package/dist/runtime/components/ui/button/Button.vue +23 -0
- package/dist/runtime/components/ui/button/Button.vue.d.ts +47 -0
- package/dist/runtime/components/ui/button/index.d.ts +7 -0
- package/dist/runtime/components/ui/button/index.js +27 -0
- package/dist/runtime/enums/index.d.ts +0 -1
- package/dist/runtime/enums/index.js +0 -1
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/lib/utils.d.ts +2 -0
- package/dist/runtime/lib/utils.js +5 -0
- package/dist/runtime/pages/401.vue +2 -3
- package/dist/runtime/pages/401.vue.d.ts +2 -0
- package/dist/runtime/pages/403.vue +2 -3
- package/dist/runtime/pages/403.vue.d.ts +2 -0
- package/dist/runtime/pages/ssoCallback.vue +5 -5
- package/dist/runtime/pages/ssoCallback.vue.d.ts +2 -0
- package/dist/runtime/types/index.d.ts +9 -38
- package/dist/types.d.mts +2 -2
- package/package.json +59 -24
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -14
- package/dist/runtime/assets/scss/styles.css +0 -1016
- package/dist/runtime/components/layout/footer/Footer.vue +0 -16
- package/dist/runtime/components/layout/header/BtnExtendMenu.vue +0 -29
- package/dist/runtime/components/layout/header/Header.vue +0 -7
- package/dist/runtime/components/layout/header/HeaderMenu.vue +0 -41
- package/dist/runtime/components/layout/header/HeaderMenuTabs.vue +0 -102
- package/dist/runtime/components/layout/sidebar/NavCollapse.vue +0 -38
- package/dist/runtime/components/layout/sidebar/NavGroup.vue +0 -9
- package/dist/runtime/components/layout/sidebar/NavItem.vue +0 -25
- package/dist/runtime/components/layout/sidebar/SideBar.vue +0 -74
- package/dist/runtime/components/layout/sidebar/SideBarFooter.vue +0 -69
- package/dist/runtime/components/layout/sidebar/TopSideBarLogo.vue +0 -25
- package/dist/runtime/components/shared/authorization/AuthorizedRenderer.vue +0 -43
- package/dist/runtime/components/shared/buttons/BtnBack.vue +0 -19
- package/dist/runtime/components/shared/buttons/BtnCancel.vue +0 -13
- package/dist/runtime/components/shared/buttons/BtnConfirm.vue +0 -14
- package/dist/runtime/components/shared/containers/JsonViewer.vue +0 -13
- package/dist/runtime/components/shared/dates/DatePicker.vue +0 -91
- package/dist/runtime/components/shared/dialogs/DialogConfirmDelete.vue +0 -32
- package/dist/runtime/components/shared/dialogs/DialogExportTable.vue +0 -44
- package/dist/runtime/components/shared/feedback/LoadingSession.vue +0 -17
- package/dist/runtime/components/shared/feedback/SnackBar.vue +0 -40
- package/dist/runtime/components/shared/forms/FormBuilder/FieldBuilder.vue +0 -251
- package/dist/runtime/components/shared/forms/FormBuilder/FieldSlotMissed.vue +0 -20
- package/dist/runtime/components/shared/forms/FormBuilder/FormBuilder.vue +0 -213
- package/dist/runtime/components/shared/forms/FormBuilder/SteppersBuilder.vue +0 -32
- package/dist/runtime/components/shared/forms/FormBuilder/TabsBuilder.vue +0 -30
- package/dist/runtime/components/shared/forms/FormDialogWrapper.vue +0 -48
- package/dist/runtime/components/shared/forms/FormPageWrapper.vue +0 -19
- package/dist/runtime/components/shared/forms/FormSubmitSection.vue +0 -48
- package/dist/runtime/components/shared/navigation/BreadCrumbs.vue +0 -21
- package/dist/runtime/components/shared/tables/CustomTable.vue +0 -261
- package/dist/runtime/components/shared/tables/CustomTableHeader.vue +0 -25
- package/dist/runtime/components/shared/tables/NoDataMessage.vue +0 -12
- package/dist/runtime/components/shared/tables/TableSearchBar.vue +0 -22
- package/dist/runtime/components/shared/tables/buttons/BtnAdd.vue +0 -25
- package/dist/runtime/components/shared/tables/buttons/BtnDelete.vue +0 -32
- package/dist/runtime/components/shared/tables/buttons/BtnEdit.vue +0 -30
- package/dist/runtime/components/shared/tables/buttons/BtnExport.vue +0 -17
- package/dist/runtime/components/shared/tables/buttons/BtnFilter.vue +0 -21
- package/dist/runtime/components/shared/tables/pagination/ItemsPerPageCombo.vue +0 -24
- package/dist/runtime/components/shared/tables/pagination/ItemsPerPageLabel.vue +0 -5
- package/dist/runtime/components/shared/tables/pagination/PageSelector.vue +0 -16
- package/dist/runtime/components/shared/tables/pagination/PaginationInfo.vue +0 -31
- package/dist/runtime/enums/EVuetifyDateFormats.d.ts +0 -32
- package/dist/runtime/enums/EVuetifyDateFormats.js +0 -30
- package/dist/runtime/layouts/default.vue +0 -31
- package/dist/runtime/layouts/empty.vue +0 -12
- package/dist/types.d.ts +0 -7
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-dialog
|
|
3
|
-
v-model="appStatusStore.openDialogExport"
|
|
4
|
-
persistent
|
|
5
|
-
max-width="500"
|
|
6
|
-
>
|
|
7
|
-
<v-card :title="$t('Components.Dialogs.Export.Title')" class="py-2">
|
|
8
|
-
<template v-slot:prepend>
|
|
9
|
-
<v-icon icon="mdi-arrow-collapse-down" color="primary" />
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<template v-slot:text>
|
|
13
|
-
<div class="pt-4">
|
|
14
|
-
<v-chip-group v-model="exportTypesSelected" multiple mandatory>
|
|
15
|
-
<v-chip variant="outlined" filter color="primary"> PDF </v-chip>
|
|
16
|
-
<v-chip variant="outlined" filter color="primary"> CSV </v-chip>
|
|
17
|
-
<v-chip variant="outlined" filter color="primary"> EXCEL </v-chip>
|
|
18
|
-
</v-chip-group>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<template v-slot:actions>
|
|
23
|
-
<div class="d-flex justify-space-between w-100 px-2 pt-4">
|
|
24
|
-
<BtnCancel @on-cancel="handleCancel" />
|
|
25
|
-
<BtnConfirm @on-confirm="emit('on-export')" />
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
</v-card>
|
|
29
|
-
</v-dialog>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<script lang="ts" setup>
|
|
33
|
-
import { ref, useAppStatusStore } from "#imports";
|
|
34
|
-
|
|
35
|
-
const appStatusStore = useAppStatusStore();
|
|
36
|
-
|
|
37
|
-
const exportTypesSelected = ref([0]);
|
|
38
|
-
|
|
39
|
-
const emit = defineEmits(["on-export"]);
|
|
40
|
-
|
|
41
|
-
const handleCancel = () => {
|
|
42
|
-
appStatusStore.setOpenDialogExport(false);
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!-- TODO: Embellecer este componente -->
|
|
2
|
-
<template>
|
|
3
|
-
<v-sheet
|
|
4
|
-
class="d-flex align-center justify-center flex-wrap text-center mx-auto px-4"
|
|
5
|
-
elevation="4"
|
|
6
|
-
height="250"
|
|
7
|
-
max-width="800"
|
|
8
|
-
width="100%"
|
|
9
|
-
rounded
|
|
10
|
-
>
|
|
11
|
-
<div>
|
|
12
|
-
<h2 class="text-h4 font-weight-black text-primary">
|
|
13
|
-
Iniciando sesión...
|
|
14
|
-
</h2>
|
|
15
|
-
</div>
|
|
16
|
-
</v-sheet>
|
|
17
|
-
</template>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-snackbar
|
|
4
|
-
:color="appStatusStore.hasError ? 'error' : 'success'"
|
|
5
|
-
:timeout="4000"
|
|
6
|
-
location="top right"
|
|
7
|
-
v-model="appStatusStore.showInfo"
|
|
8
|
-
>
|
|
9
|
-
<h4>{{ appStatusStore.info?.title }}</h4>
|
|
10
|
-
<div class="mt-1">
|
|
11
|
-
{{ appStatusStore.info?.description }}
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<template v-slot:actions>
|
|
15
|
-
<v-btn
|
|
16
|
-
@click.stop="handleClick"
|
|
17
|
-
density="compact"
|
|
18
|
-
icon="mdi-close-circle-outline"
|
|
19
|
-
rounded="lg"
|
|
20
|
-
variant="text"
|
|
21
|
-
>
|
|
22
|
-
</v-btn>
|
|
23
|
-
</template>
|
|
24
|
-
</v-snackbar>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script lang="ts" setup>
|
|
29
|
-
import { onMounted } from "vue";
|
|
30
|
-
import { useAppStatusStore } from "../../../stores/appStatus";
|
|
31
|
-
|
|
32
|
-
const appStatusStore = useAppStatusStore();
|
|
33
|
-
|
|
34
|
-
const handleClick = () => {
|
|
35
|
-
appStatusStore.setShowInfo(false);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// TODO: AGREGAR UNA CUENTA REGRESIVA DE CUANTO FALTA PARA QUE EL SNACKBAR SE CIERRE
|
|
39
|
-
onMounted(() => {});
|
|
40
|
-
</script>
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-text-field
|
|
3
|
-
v-if="field.type == EFormField.TEXT"
|
|
4
|
-
:aria-label="field.label"
|
|
5
|
-
:counter="castToFieldText(field).maxlength"
|
|
6
|
-
:disabled="field.disabled"
|
|
7
|
-
:label="field.label"
|
|
8
|
-
:required="field.required"
|
|
9
|
-
:rules="field.rules"
|
|
10
|
-
:title="field.title"
|
|
11
|
-
@keypress="validateTextFieldInput($event, castToFieldText(field))"
|
|
12
|
-
color="primary"
|
|
13
|
-
persistent-placeholder
|
|
14
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
15
|
-
variant="outlined"
|
|
16
|
-
/>
|
|
17
|
-
|
|
18
|
-
<v-textarea
|
|
19
|
-
v-else-if="field.type == EFormField.TEXTAREA"
|
|
20
|
-
:aria-label="field.label"
|
|
21
|
-
:counter="castToFieldTextArea(field).maxlength"
|
|
22
|
-
:disabled="field.disabled"
|
|
23
|
-
:label="field.label"
|
|
24
|
-
:no-resize="!castToFieldTextArea(field).resizable"
|
|
25
|
-
:required="field.required"
|
|
26
|
-
:rows="castToFieldTextArea(field).rows"
|
|
27
|
-
:rules="field.rules"
|
|
28
|
-
:title="field.title"
|
|
29
|
-
@keypress="validateTextAreaFieldInput($event, castToFieldTextArea(field))"
|
|
30
|
-
color="primary"
|
|
31
|
-
persistent-placeholder
|
|
32
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
33
|
-
variant="outlined"
|
|
34
|
-
/>
|
|
35
|
-
|
|
36
|
-
<v-text-field
|
|
37
|
-
v-else-if="field.type == EFormField.NUMBER"
|
|
38
|
-
:aria-label="field.label"
|
|
39
|
-
:disabled="field.disabled"
|
|
40
|
-
:label="field.label"
|
|
41
|
-
:max="castToFieldNumber(field).max"
|
|
42
|
-
:min="castToFieldNumber(field).min"
|
|
43
|
-
:required="field.required"
|
|
44
|
-
:rules="field.rules"
|
|
45
|
-
:title="field.title"
|
|
46
|
-
@keypress="validateNumberFieldInput($event, castToFieldNumber(field))"
|
|
47
|
-
color="primary"
|
|
48
|
-
persistent-placeholder
|
|
49
|
-
type="number"
|
|
50
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
51
|
-
variant="outlined"
|
|
52
|
-
:counter="castToFieldNumber(field).maxlength"
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<!-- <CustomDatePicker
|
|
56
|
-
v-else-if="field.type == EFormField.DATE"
|
|
57
|
-
:field="castToFieldDate(field)"
|
|
58
|
-
v-model:date="formState[field.key as keyof typeof formState]"
|
|
59
|
-
/> -->
|
|
60
|
-
|
|
61
|
-
<v-autocomplete
|
|
62
|
-
v-else-if="field.type == EFormField.SELECT"
|
|
63
|
-
:item-title="castToFieldSelect(field).itemTitle"
|
|
64
|
-
:item-value="castToFieldSelect(field).itemValue"
|
|
65
|
-
:items="castToFieldSelect(field).items"
|
|
66
|
-
:label="field.label"
|
|
67
|
-
:placeholder="field.placeHolder"
|
|
68
|
-
:return-object="castToFieldSelect(field).returnObject"
|
|
69
|
-
:rules="field.rules"
|
|
70
|
-
:title="field.title"
|
|
71
|
-
auto-select-first
|
|
72
|
-
clearable
|
|
73
|
-
color="primary"
|
|
74
|
-
density="compact"
|
|
75
|
-
no-data-text="No hay datos que coincidan con el criterio de búsqueda..."
|
|
76
|
-
persistent-placeholder
|
|
77
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
78
|
-
variant="outlined"
|
|
79
|
-
/>
|
|
80
|
-
|
|
81
|
-
<v-radio-group
|
|
82
|
-
v-else-if="field.type == EFormField.RADIOBUTTON"
|
|
83
|
-
:aria-label="field.label"
|
|
84
|
-
:label="
|
|
85
|
-
castToFieldRadioButton(field).labelLocation == 'TOP'
|
|
86
|
-
? field.label
|
|
87
|
-
: undefined
|
|
88
|
-
"
|
|
89
|
-
:disabled="field.disabled"
|
|
90
|
-
:inline="castToFieldRadioButton(field).inline"
|
|
91
|
-
:required="field.required"
|
|
92
|
-
:rules="field.rules"
|
|
93
|
-
:title="field.title"
|
|
94
|
-
color="primary"
|
|
95
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
96
|
-
>
|
|
97
|
-
<template
|
|
98
|
-
v-slot:prepend
|
|
99
|
-
v-if="castToFieldRadioButton(field).labelLocation == 'LEFT'"
|
|
100
|
-
>
|
|
101
|
-
<v-label :text="castToFieldRadioButton(field).label" />
|
|
102
|
-
</template>
|
|
103
|
-
|
|
104
|
-
<v-radio
|
|
105
|
-
v-for="(item, i) in castToFieldRadioButton(field).items"
|
|
106
|
-
:label="item.label"
|
|
107
|
-
:value="item.value"
|
|
108
|
-
/>
|
|
109
|
-
</v-radio-group>
|
|
110
|
-
|
|
111
|
-
<v-switch
|
|
112
|
-
v-else-if="field.type == EFormField.SWITCH"
|
|
113
|
-
:aria-label="field.label"
|
|
114
|
-
:indeterminate="castToFieldSwitch(field).indeterminate ?? false"
|
|
115
|
-
:inset="castToFieldSwitch(field).inset"
|
|
116
|
-
:disabled="field.disabled"
|
|
117
|
-
:false-value="castToFieldSwitch(field).falseValue ?? false"
|
|
118
|
-
:label="field.label"
|
|
119
|
-
:required="field.required"
|
|
120
|
-
:rules="field.rules"
|
|
121
|
-
:title="field.title"
|
|
122
|
-
:true-value="castToFieldSwitch(field).trueValue ?? true"
|
|
123
|
-
color="primary"
|
|
124
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
125
|
-
>
|
|
126
|
-
<template v-slot:prepend>
|
|
127
|
-
<v-label :text="castToFieldSwitch(field).labelPrepend" />
|
|
128
|
-
</template>
|
|
129
|
-
</v-switch>
|
|
130
|
-
|
|
131
|
-
<v-checkbox
|
|
132
|
-
v-else-if="field.type == EFormField.CHECKBOX"
|
|
133
|
-
:aria-label="field.label"
|
|
134
|
-
:disabled="field.disabled"
|
|
135
|
-
:false-value="castToFieldCheckBox(field).falseValue ?? false"
|
|
136
|
-
:indeterminate="castToFieldCheckBox(field).indeterminate"
|
|
137
|
-
:label="field.label"
|
|
138
|
-
:required="field.required"
|
|
139
|
-
:rules="field.rules"
|
|
140
|
-
:title="field.title"
|
|
141
|
-
:true-value="castToFieldCheckBox(field).trueValue ?? true"
|
|
142
|
-
color="primary"
|
|
143
|
-
v-model="formState[field.key as keyof typeof formState]"
|
|
144
|
-
/>
|
|
145
|
-
|
|
146
|
-
<div v-else class="text-error">
|
|
147
|
-
{{ "DECLARATION MISSED FOR FIELD " + field.type + " IN FORMBUILDER" }}
|
|
148
|
-
</div>
|
|
149
|
-
</template>
|
|
150
|
-
|
|
151
|
-
<script lang="ts" setup generic="T">
|
|
152
|
-
import { type PropType } from "vue";
|
|
153
|
-
import type {
|
|
154
|
-
TFormBuilderField,
|
|
155
|
-
IFormBuilderFieldText,
|
|
156
|
-
IFormBuilderFieldTextArea,
|
|
157
|
-
IFormBuilderFieldNumber,
|
|
158
|
-
IFormBuilderFieldDate,
|
|
159
|
-
IFormBuilderFieldSelect,
|
|
160
|
-
IFormBuilderFieldCheckBox,
|
|
161
|
-
IFormBuilderFieldRadioButton,
|
|
162
|
-
IFormBuilderFieldSwitch,
|
|
163
|
-
} from "../../../../types";
|
|
164
|
-
import { EFormField } from "../../../../enums";
|
|
165
|
-
import onlyNumbers from "../../../../utils/onlyNumbers";
|
|
166
|
-
|
|
167
|
-
const formState = defineModel<T>("formState", { required: true });
|
|
168
|
-
|
|
169
|
-
const props = defineProps({
|
|
170
|
-
field: { type: Object as PropType<TFormBuilderField>, required: true },
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// #region INPUT VALIDATION METHODS
|
|
174
|
-
const validateTextFieldInput = (event: any, field: IFormBuilderFieldText) => {
|
|
175
|
-
const expect = (event.target.value.toString() +
|
|
176
|
-
event.key.toString()) as string;
|
|
177
|
-
|
|
178
|
-
if (field.maxlength && expect.length > field.maxlength) {
|
|
179
|
-
event.preventDefault();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return true;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const validateTextAreaFieldInput = (
|
|
186
|
-
event: any,
|
|
187
|
-
field: IFormBuilderFieldTextArea
|
|
188
|
-
) => {
|
|
189
|
-
const expect = (event.target.value.toString() +
|
|
190
|
-
event.key.toString()) as string;
|
|
191
|
-
|
|
192
|
-
if (field.maxlength && expect.length > field.maxlength) {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return true;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const validateNumberFieldInput = (
|
|
200
|
-
event: any,
|
|
201
|
-
field: IFormBuilderFieldNumber
|
|
202
|
-
) => {
|
|
203
|
-
const expect = (event.target.value.toString() +
|
|
204
|
-
event.key.toString()) as string;
|
|
205
|
-
|
|
206
|
-
if (!onlyNumbers(expect)) {
|
|
207
|
-
event.preventDefault();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (field.maxlength && expect.length > field.maxlength) {
|
|
211
|
-
event.preventDefault();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return true;
|
|
215
|
-
};
|
|
216
|
-
// #endregion
|
|
217
|
-
|
|
218
|
-
// #region CAST METHODS
|
|
219
|
-
const castToFieldText = (field: Object) => {
|
|
220
|
-
return field as IFormBuilderFieldText;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const castToFieldTextArea = (field: Object) => {
|
|
224
|
-
return field as IFormBuilderFieldTextArea;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const castToFieldNumber = (field: Object) => {
|
|
228
|
-
return field as IFormBuilderFieldNumber;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const castToFieldDate = (field: Object) => {
|
|
232
|
-
return field as IFormBuilderFieldDate;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const castToFieldSelect = (field: Object) => {
|
|
236
|
-
return field as IFormBuilderFieldSelect;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const castToFieldCheckBox = (field: Object) => {
|
|
240
|
-
return field as IFormBuilderFieldCheckBox;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const castToFieldRadioButton = (field: Object) => {
|
|
244
|
-
return field as IFormBuilderFieldRadioButton;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const castToFieldSwitch = (field: Object) => {
|
|
248
|
-
return field as IFormBuilderFieldSwitch;
|
|
249
|
-
};
|
|
250
|
-
// #endregion
|
|
251
|
-
</script>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-text-field
|
|
3
|
-
:placeholder="`Content slot for field '${field.label}' is missed.`"
|
|
4
|
-
:title="'Slot missed!'"
|
|
5
|
-
bg-color="error"
|
|
6
|
-
color="error"
|
|
7
|
-
persistent-placeholder
|
|
8
|
-
readonly
|
|
9
|
-
variant="outlined"
|
|
10
|
-
/>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import type { PropType } from "vue";
|
|
15
|
-
import type { IFormBuilderFieldSlot } from "../../../../types";
|
|
16
|
-
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
field: { type: Object as PropType<IFormBuilderFieldSlot>, required: true },
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- #region TABS OR STEPPER VARIANTS -->
|
|
3
|
-
<template v-if="formConfig.tabs">
|
|
4
|
-
<TabsBuilder
|
|
5
|
-
v-if="formConfig.variant == 'TABS'"
|
|
6
|
-
v-model:form-config="formConfig"
|
|
7
|
-
v-model:tab-selected="tabSelected"
|
|
8
|
-
/>
|
|
9
|
-
<SteppersBuilder
|
|
10
|
-
v-if="formConfig.variant == 'STEPPERS'"
|
|
11
|
-
v-model:form-config="formConfig"
|
|
12
|
-
v-model:tab-selected="tabSelected"
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
<v-window v-model="tabSelected">
|
|
16
|
-
<v-window-item
|
|
17
|
-
v-for="(tab, t) in formConfig.tabs"
|
|
18
|
-
:key="tab.value"
|
|
19
|
-
:value="tab.value"
|
|
20
|
-
reverse-transition="slide-x-transition"
|
|
21
|
-
transition="slide-x-transition"
|
|
22
|
-
>
|
|
23
|
-
<v-form
|
|
24
|
-
@submit.prevent="handleSubmitMultipleForms"
|
|
25
|
-
:ref="(element: TFormDomElement) => asignFormRef(tab.value, element)"
|
|
26
|
-
class="mt-2 mx-3"
|
|
27
|
-
>
|
|
28
|
-
<template v-for="(row, r) in tab.rows" :key="r">
|
|
29
|
-
<v-row v-if="row.section">
|
|
30
|
-
<v-label
|
|
31
|
-
:text="row.section.title"
|
|
32
|
-
class="font-weight-bold text-secondary mb-6"
|
|
33
|
-
/>
|
|
34
|
-
<!-- <v-divider thickness="1" class="mb-6 mt-2" /> -->
|
|
35
|
-
</v-row>
|
|
36
|
-
|
|
37
|
-
<v-row class="mt-n3">
|
|
38
|
-
<template v-for="(field, f) in row.fields" :key="f">
|
|
39
|
-
<v-col :cols="field.size">
|
|
40
|
-
<slot
|
|
41
|
-
v-if="field.type == EFormField.SLOT"
|
|
42
|
-
:name="`field.${field.key}`"
|
|
43
|
-
:field="castToFieldSlot(field)"
|
|
44
|
-
>
|
|
45
|
-
<FieldSlotMissed :field="castToFieldSlot(field)" />
|
|
46
|
-
</slot>
|
|
47
|
-
<FieldBuilder v-else v-model:form-state="formState" :field />
|
|
48
|
-
</v-col>
|
|
49
|
-
</template>
|
|
50
|
-
</v-row>
|
|
51
|
-
</template>
|
|
52
|
-
|
|
53
|
-
<FormSubmitSection
|
|
54
|
-
:formMode="props.formMode"
|
|
55
|
-
:showBtnNextTab="tab.value < tabsCount"
|
|
56
|
-
:showBtnPrevTab="tab.value > 1"
|
|
57
|
-
@on-cancel="emit('on-cancel')"
|
|
58
|
-
@on-prev-tab="prevTab"
|
|
59
|
-
class="mt-8"
|
|
60
|
-
/>
|
|
61
|
-
</v-form>
|
|
62
|
-
</v-window-item>
|
|
63
|
-
</v-window>
|
|
64
|
-
</template>
|
|
65
|
-
<!-- #endregion -->
|
|
66
|
-
|
|
67
|
-
<!-- #region SINGLE FORM VARIANT -->
|
|
68
|
-
<template v-else>
|
|
69
|
-
<v-form
|
|
70
|
-
@submit.prevent="handleSubmitSingleForm"
|
|
71
|
-
ref="singleForm"
|
|
72
|
-
class="mt-8"
|
|
73
|
-
>
|
|
74
|
-
<template v-for="(row, r) in formConfig.rows" :key="r">
|
|
75
|
-
<v-row v-if="row.section">
|
|
76
|
-
<v-label
|
|
77
|
-
:text="row.section.title"
|
|
78
|
-
class="font-weight-bold text-secondary mb-6"
|
|
79
|
-
/>
|
|
80
|
-
<!-- <v-divider thickness="1" class="mb-6 mt-2" /> -->
|
|
81
|
-
</v-row>
|
|
82
|
-
|
|
83
|
-
<v-row class="mt-n3">
|
|
84
|
-
<template v-for="(field, f) in row.fields" :key="f">
|
|
85
|
-
<v-col :cols="field.size">
|
|
86
|
-
<slot
|
|
87
|
-
v-if="field.type == EFormField.SLOT"
|
|
88
|
-
:name="`field.${field.key}`"
|
|
89
|
-
:field="castToFieldSlot(field)"
|
|
90
|
-
>
|
|
91
|
-
<FieldSlotMissed :field="castToFieldSlot(field)" />
|
|
92
|
-
</slot>
|
|
93
|
-
<FieldBuilder v-else :field v-model:form-state="formState" />
|
|
94
|
-
</v-col>
|
|
95
|
-
</template>
|
|
96
|
-
</v-row>
|
|
97
|
-
</template>
|
|
98
|
-
|
|
99
|
-
<FormSubmitSection
|
|
100
|
-
:formMode="props.formMode"
|
|
101
|
-
@on-cancel="emit('on-cancel')"
|
|
102
|
-
/>
|
|
103
|
-
</v-form>
|
|
104
|
-
</template>
|
|
105
|
-
<!-- #endregion -->
|
|
106
|
-
</template>
|
|
107
|
-
|
|
108
|
-
<script lang="ts" setup generic="T">
|
|
109
|
-
import {
|
|
110
|
-
computed,
|
|
111
|
-
ref,
|
|
112
|
-
type ComponentPublicInstance,
|
|
113
|
-
type PropType,
|
|
114
|
-
} from "vue";
|
|
115
|
-
import type {
|
|
116
|
-
IFormBuilderConfig,
|
|
117
|
-
IFormBuilderFieldSlot,
|
|
118
|
-
IFormBuilderTab,
|
|
119
|
-
TFormMode,
|
|
120
|
-
} from "../../../../types";
|
|
121
|
-
import { EFormField } from "../../../../enums";
|
|
122
|
-
|
|
123
|
-
const formState = defineModel<T>("formState", { required: true });
|
|
124
|
-
const formConfig = defineModel<IFormBuilderConfig>("formConfig", {
|
|
125
|
-
required: true,
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const emit = defineEmits(["on-submit", "on-cancel"]);
|
|
129
|
-
|
|
130
|
-
const props = defineProps({
|
|
131
|
-
formMode: { type: String as PropType<TFormMode>, required: true },
|
|
132
|
-
wrapper: { type: String, required: true },
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const tabsForms = ref({});
|
|
136
|
-
const singleForm = ref(null);
|
|
137
|
-
const tabSelected = ref(1);
|
|
138
|
-
|
|
139
|
-
type TFormDomElement = Element | ComponentPublicInstance | null;
|
|
140
|
-
const asignFormRef = (key: number, element: TFormDomElement) => {
|
|
141
|
-
// @ts-ignore
|
|
142
|
-
tabsForms.value[key] = element;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// #region HANDLE TABS LOGIC
|
|
146
|
-
const tabsCount = computed(() => {
|
|
147
|
-
return Number(formConfig.value.tabs?.length);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
const changeTab = (newTab: number) => {
|
|
151
|
-
tabSelected.value = newTab;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const prevTab = () => {
|
|
155
|
-
changeTab(tabSelected.value - 1);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const nextTab = () => {
|
|
159
|
-
changeTab(tabSelected.value + 1);
|
|
160
|
-
};
|
|
161
|
-
// #endregion
|
|
162
|
-
|
|
163
|
-
// #region HANDLE SUBMIT FORMS
|
|
164
|
-
const handleSubmitSingleForm = async () => {
|
|
165
|
-
// @ts-ignore
|
|
166
|
-
const { valid } = await singleForm.value?.validate();
|
|
167
|
-
if (valid) {
|
|
168
|
-
emit("on-submit");
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const handleSubmitMultipleForms = async () => {
|
|
173
|
-
if (!(await isCurrentFormValid())) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (!isCurrentFormTheLast()) {
|
|
178
|
-
nextTab();
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (await allFormsValid()) {
|
|
183
|
-
emit("on-submit");
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const isCurrentFormTheLast = () => {
|
|
188
|
-
return tabSelected.value == tabsCount.value;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const isCurrentFormValid = async () => {
|
|
192
|
-
// @ts-ignore
|
|
193
|
-
const { valid } = await tabsForms.value[tabSelected.value]?.validate();
|
|
194
|
-
return valid;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const allFormsValid = async () => {
|
|
198
|
-
for (const tab of formConfig.value.tabs as IFormBuilderTab[]) {
|
|
199
|
-
// @ts-ignore
|
|
200
|
-
const { valid } = await tabsForms.value[tab.value]?.validate();
|
|
201
|
-
if (!valid) {
|
|
202
|
-
changeTab(tab.value);
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return true;
|
|
207
|
-
};
|
|
208
|
-
// #endregion
|
|
209
|
-
|
|
210
|
-
const castToFieldSlot = (field: Object) => {
|
|
211
|
-
return field as IFormBuilderFieldSlot;
|
|
212
|
-
};
|
|
213
|
-
</script>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-stepper
|
|
3
|
-
:alt-labels="formConfig.stepper?.LabelLocation == 'BOTTOM'"
|
|
4
|
-
class="my-8"
|
|
5
|
-
elevation="1"
|
|
6
|
-
v-model="tabSelected"
|
|
7
|
-
>
|
|
8
|
-
<v-stepper-header>
|
|
9
|
-
<template v-for="(tab, t) in formConfig.tabs" :key="t">
|
|
10
|
-
<v-stepper-item
|
|
11
|
-
:complete="tab.value < tabSelected"
|
|
12
|
-
:title="tab.title"
|
|
13
|
-
:value="tab.value"
|
|
14
|
-
color="primary"
|
|
15
|
-
v-model="tabSelected"
|
|
16
|
-
/>
|
|
17
|
-
<v-divider v-if="tab.value != formConfig.tabs?.length" />
|
|
18
|
-
</template>
|
|
19
|
-
</v-stepper-header>
|
|
20
|
-
</v-stepper>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script lang="ts" setup>
|
|
24
|
-
import type { IFormBuilderConfig } from "../../../../types";
|
|
25
|
-
|
|
26
|
-
const formConfig = defineModel<IFormBuilderConfig>("formConfig", {
|
|
27
|
-
required: true,
|
|
28
|
-
});
|
|
29
|
-
const tabSelected = defineModel<number>("tabSelected", {
|
|
30
|
-
required: true,
|
|
31
|
-
});
|
|
32
|
-
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-row class="my-8 mx-0">
|
|
3
|
-
<v-tabs color="primary" grow v-model="tabSelected">
|
|
4
|
-
<template v-for="(tab, t) in formConfig.tabs" :key="t">
|
|
5
|
-
<v-tab
|
|
6
|
-
:class="tabSelected == tab.value ? 'activeTab' : ''"
|
|
7
|
-
:text="tab.title"
|
|
8
|
-
:value="tab.value"
|
|
9
|
-
color="primary"
|
|
10
|
-
variant="plain"
|
|
11
|
-
/>
|
|
12
|
-
</template>
|
|
13
|
-
</v-tabs>
|
|
14
|
-
</v-row>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script lang="ts" setup>
|
|
18
|
-
import type { IFormBuilderConfig } from "../../../../types";
|
|
19
|
-
|
|
20
|
-
const formConfig = defineModel<IFormBuilderConfig>("formConfig", {
|
|
21
|
-
required: true,
|
|
22
|
-
});
|
|
23
|
-
const tabSelected = defineModel<number>("tabSelected", {
|
|
24
|
-
required: true,
|
|
25
|
-
});
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style>
|
|
29
|
-
.activeTab{background-color:rgb(var(--v-theme-borderLight))}
|
|
30
|
-
</style>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-dialog v-model="openDialog" persistent :class="width">
|
|
3
|
-
<v-card elevation="2" rounded="lg">
|
|
4
|
-
<div class="d-flex align-center py-2 ml-10 mr-6">
|
|
5
|
-
<!-- Título del formulario -->
|
|
6
|
-
<span class="text-h6 text-primary font-weight-bold">
|
|
7
|
-
{{ props.title }}
|
|
8
|
-
</span>
|
|
9
|
-
|
|
10
|
-
<v-spacer />
|
|
11
|
-
|
|
12
|
-
<!-- Botón cancelar-->
|
|
13
|
-
<v-btn
|
|
14
|
-
@click="emit('on-cancel')"
|
|
15
|
-
elevation="0"
|
|
16
|
-
icon="mdi-close"
|
|
17
|
-
style="opacity: 0.8"
|
|
18
|
-
variant="text"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<v-divider :thickness="1" />
|
|
23
|
-
|
|
24
|
-
<!-- Slot para el formulario -->
|
|
25
|
-
<div class="mb-8 mx-13">
|
|
26
|
-
<slot name="form" wrapper="dialog" />
|
|
27
|
-
</div>
|
|
28
|
-
</v-card>
|
|
29
|
-
</v-dialog>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<script lang="ts" setup>
|
|
33
|
-
import type { PropType } from "vue";
|
|
34
|
-
|
|
35
|
-
type TFormWidth = "w-50" | "w-75" | "w-100";
|
|
36
|
-
|
|
37
|
-
const openDialog = defineModel<boolean>("openDialog", { required: true });
|
|
38
|
-
|
|
39
|
-
const emit = defineEmits(["on-cancel"]);
|
|
40
|
-
|
|
41
|
-
const props = defineProps({
|
|
42
|
-
title: { type: String, required: true },
|
|
43
|
-
width: {
|
|
44
|
-
type: String as PropType<TFormWidth>,
|
|
45
|
-
default: "w-50",
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
</script>
|