una-nuxt-module 1.0.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/README.md +84 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +6 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +105 -0
- package/dist/runtime/assets/scss/styles.css +1249 -0
- package/dist/runtime/classes/FetchClient.d.ts +61 -0
- package/dist/runtime/classes/FetchClient.js +71 -0
- package/dist/runtime/components/layout/footer/Footer.vue +16 -0
- package/dist/runtime/components/layout/header/BtnExtendMenu.vue +29 -0
- package/dist/runtime/components/layout/header/Header.vue +7 -0
- package/dist/runtime/components/layout/header/HeaderMenu.vue +41 -0
- package/dist/runtime/components/layout/header/HeaderMenuTabs.vue +102 -0
- package/dist/runtime/components/layout/sidebar/NavCollapse.vue +38 -0
- package/dist/runtime/components/layout/sidebar/NavGroup.vue +9 -0
- package/dist/runtime/components/layout/sidebar/NavItem.vue +25 -0
- package/dist/runtime/components/layout/sidebar/SideBar.vue +74 -0
- package/dist/runtime/components/layout/sidebar/SideBarFooter.vue +69 -0
- package/dist/runtime/components/layout/sidebar/TopSideBarLogo.vue +25 -0
- package/dist/runtime/components/shared/authorization/AuthorizedRenderer.vue +41 -0
- package/dist/runtime/components/shared/buttons/BtnBack.vue +19 -0
- package/dist/runtime/components/shared/buttons/BtnCancel.vue +13 -0
- package/dist/runtime/components/shared/buttons/BtnConfirm.vue +14 -0
- package/dist/runtime/components/shared/containers/JsonViewer.vue +13 -0
- package/dist/runtime/components/shared/dates/DatePicker.vue +91 -0
- package/dist/runtime/components/shared/dialogs/DialogConfirmDelete.vue +32 -0
- package/dist/runtime/components/shared/dialogs/DialogExportTable.vue +42 -0
- package/dist/runtime/components/shared/feedback/LoadingSession.vue +17 -0
- package/dist/runtime/components/shared/feedback/SnackBar.vue +36 -0
- package/dist/runtime/components/shared/forms/FormBuilder/FieldBuilder.vue +251 -0
- package/dist/runtime/components/shared/forms/FormBuilder/FieldSlotMissed.vue +20 -0
- package/dist/runtime/components/shared/forms/FormBuilder/FormBuilder.vue +213 -0
- package/dist/runtime/components/shared/forms/FormBuilder/SteppersBuilder.vue +32 -0
- package/dist/runtime/components/shared/forms/FormBuilder/TabsBuilder.vue +30 -0
- package/dist/runtime/components/shared/forms/FormDialogWrapper.vue +48 -0
- package/dist/runtime/components/shared/forms/FormPageWrapper.vue +19 -0
- package/dist/runtime/components/shared/forms/FormSubmitSection.vue +48 -0
- package/dist/runtime/components/shared/navigation/BreadCrumbs.vue +21 -0
- package/dist/runtime/components/shared/tables/CustomTable.vue +261 -0
- package/dist/runtime/components/shared/tables/CustomTableHeader.vue +25 -0
- package/dist/runtime/components/shared/tables/NoDataMessage.vue +12 -0
- package/dist/runtime/components/shared/tables/TableSearchBar.vue +22 -0
- package/dist/runtime/components/shared/tables/buttons/BtnAdd.vue +25 -0
- package/dist/runtime/components/shared/tables/buttons/BtnDelete.vue +32 -0
- package/dist/runtime/components/shared/tables/buttons/BtnEdit.vue +30 -0
- package/dist/runtime/components/shared/tables/buttons/BtnExport.vue +17 -0
- package/dist/runtime/components/shared/tables/buttons/BtnFilter.vue +21 -0
- package/dist/runtime/components/shared/tables/pagination/ItemsPerPageCombo.vue +24 -0
- package/dist/runtime/components/shared/tables/pagination/ItemsPerPageLabel.vue +5 -0
- package/dist/runtime/components/shared/tables/pagination/PageSelector.vue +16 -0
- package/dist/runtime/components/shared/tables/pagination/PaginationInfo.vue +31 -0
- package/dist/runtime/composables/useAuthorization.d.ts +32 -0
- package/dist/runtime/composables/useAuthorization.js +95 -0
- package/dist/runtime/constants/form.d.ts +44 -0
- package/dist/runtime/constants/form.js +58 -0
- package/dist/runtime/constants/index.d.ts +4 -0
- package/dist/runtime/constants/index.js +4 -0
- package/dist/runtime/constants/pagination.d.ts +13 -0
- package/dist/runtime/constants/pagination.js +8 -0
- package/dist/runtime/constants/request.d.ts +5 -0
- package/dist/runtime/constants/request.js +6 -0
- package/dist/runtime/constants/tables.d.ts +4 -0
- package/dist/runtime/constants/tables.js +15 -0
- package/dist/runtime/enums/EAsyncDataRequestStatus.d.ts +9 -0
- package/dist/runtime/enums/EAsyncDataRequestStatus.js +7 -0
- package/dist/runtime/enums/EAuthorization.d.ts +8 -0
- package/dist/runtime/enums/EAuthorization.js +6 -0
- package/dist/runtime/enums/EFormField.d.ts +14 -0
- package/dist/runtime/enums/EFormField.js +12 -0
- package/dist/runtime/enums/EFormMode.d.ts +7 -0
- package/dist/runtime/enums/EFormMode.js +5 -0
- package/dist/runtime/enums/ERequestMethod.d.ts +9 -0
- package/dist/runtime/enums/ERequestMethod.js +7 -0
- package/dist/runtime/enums/ETheme.d.ts +7 -0
- package/dist/runtime/enums/ETheme.js +5 -0
- package/dist/runtime/enums/EVuetifyDateFormats.d.ts +32 -0
- package/dist/runtime/enums/EVuetifyDateFormats.js +30 -0
- package/dist/runtime/enums/index.d.ts +6 -0
- package/dist/runtime/enums/index.js +6 -0
- package/dist/runtime/i18n/config.d.ts +61 -0
- package/dist/runtime/i18n/config.js +10 -0
- package/dist/runtime/i18n/locales/es.json +55 -0
- package/dist/runtime/i18n/service.d.ts +72 -0
- package/dist/runtime/i18n/service.js +3 -0
- package/dist/runtime/i18n/vueI18n.d.ts +5 -0
- package/dist/runtime/i18n/vueI18n.js +3 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/layouts/default.vue +31 -0
- package/dist/runtime/layouts/empty.vue +12 -0
- package/dist/runtime/middleware/authentication.d.ts +10 -0
- package/dist/runtime/middleware/authentication.js +30 -0
- package/dist/runtime/middleware/authorization.d.ts +7 -0
- package/dist/runtime/middleware/authorization.js +39 -0
- package/dist/runtime/pages/401.vue +34 -0
- package/dist/runtime/pages/403.vue +35 -0
- package/dist/runtime/pages/ssoCallback.vue +14 -0
- package/dist/runtime/plugins/auth.d.ts +12 -0
- package/dist/runtime/plugins/auth.js +83 -0
- package/dist/runtime/plugins/vue-json.d.ts +12 -0
- package/dist/runtime/plugins/vue-json.js +5 -0
- package/dist/runtime/public/images/logos/UNA_LogoMark_Black.png +0 -0
- package/dist/runtime/public/images/logos/UNA_LogoType_LogoMark_Red.png +0 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/stores/UiCustomizer.d.ts +22 -0
- package/dist/runtime/stores/UiCustomizer.js +34 -0
- package/dist/runtime/stores/appStatus.d.ts +63 -0
- package/dist/runtime/stores/appStatus.js +101 -0
- package/dist/runtime/stores/auth.d.ts +76 -0
- package/dist/runtime/stores/auth.js +66 -0
- package/dist/runtime/stores/formModeTracker.d.ts +14 -0
- package/dist/runtime/stores/formModeTracker.js +10 -0
- package/dist/runtime/types/index.d.ts +584 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/utils/buildSortQueryParams.d.ts +10 -0
- package/dist/runtime/utils/buildSortQueryParams.js +3 -0
- package/dist/runtime/utils/getCurrentPath.d.ts +7 -0
- package/dist/runtime/utils/getCurrentPath.js +4 -0
- package/dist/runtime/utils/getDateTimeInISO8601.d.ts +11 -0
- package/dist/runtime/utils/getDateTimeInISO8601.js +3 -0
- package/dist/runtime/utils/getFromLocalStorage.d.ts +9 -0
- package/dist/runtime/utils/getFromLocalStorage.js +6 -0
- package/dist/runtime/utils/isNumberInRange.d.ts +11 -0
- package/dist/runtime/utils/isNumberInRange.js +5 -0
- package/dist/runtime/utils/onlyNumbers.d.ts +9 -0
- package/dist/runtime/utils/onlyNumbers.js +3 -0
- package/dist/runtime/utils/stringToBoolean.d.ts +9 -0
- package/dist/runtime/utils/stringToBoolean.js +3 -0
- package/dist/types.d.mts +7 -0
- package/dist/types.d.ts +7 -0
- package/package.json +69 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="json-container-view">
|
|
3
|
+
<h5>{{ props.title }}:</h5>
|
|
4
|
+
<VueJsonPretty :data />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
data: { type: Object, default: {} },
|
|
11
|
+
title: { type: String, default: "Data" },
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu v-model="openCalendar" :close-on-content-click="false">
|
|
3
|
+
<template v-slot:activator="{ props }">
|
|
4
|
+
<v-text-field
|
|
5
|
+
:aria-label="label"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
:label="label"
|
|
8
|
+
:readonly="true"
|
|
9
|
+
:required="required"
|
|
10
|
+
:rules="rules"
|
|
11
|
+
:title="title"
|
|
12
|
+
color="primary"
|
|
13
|
+
persistent-placeholder
|
|
14
|
+
v-bind="props"
|
|
15
|
+
v-model="formattedDate"
|
|
16
|
+
variant="outlined"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<v-date-picker
|
|
21
|
+
color="primary"
|
|
22
|
+
elevation="4"
|
|
23
|
+
hide-actions
|
|
24
|
+
title=""
|
|
25
|
+
v-model="date"
|
|
26
|
+
>
|
|
27
|
+
<template v-slot:header>
|
|
28
|
+
<div />
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<template v-slot:actions>
|
|
32
|
+
<div class="mt-n10 d-flex justify-space-between w-100">
|
|
33
|
+
<v-btn
|
|
34
|
+
@click="date = null"
|
|
35
|
+
color="primary"
|
|
36
|
+
density="compact"
|
|
37
|
+
text="Borrar"
|
|
38
|
+
/>
|
|
39
|
+
<v-btn
|
|
40
|
+
@click="openCalendar = false"
|
|
41
|
+
color="primary"
|
|
42
|
+
density="compact"
|
|
43
|
+
text="Cerrar"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
</v-date-picker>
|
|
48
|
+
</v-menu>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script lang="ts" setup>
|
|
52
|
+
import { computed, ref, watch, type PropType } from "vue";
|
|
53
|
+
import { useDate } from "vuetify";
|
|
54
|
+
import type { TVuetifyDateFormat } from "../../../types";
|
|
55
|
+
import { EVuetifyDateFormats } from "../../../enums";
|
|
56
|
+
|
|
57
|
+
const dateFormatter = useDate();
|
|
58
|
+
|
|
59
|
+
const openCalendar = ref(false);
|
|
60
|
+
|
|
61
|
+
const date = defineModel<Date | null>("date", { required: true });
|
|
62
|
+
|
|
63
|
+
const props = defineProps({
|
|
64
|
+
disabled: { type: Boolean, default: false },
|
|
65
|
+
displayFormat: {
|
|
66
|
+
type: String as PropType<TVuetifyDateFormat>,
|
|
67
|
+
required: false,
|
|
68
|
+
default: EVuetifyDateFormats.fullDateWithWeekday,
|
|
69
|
+
},
|
|
70
|
+
label: { type: String, required: true },
|
|
71
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
72
|
+
required: { type: Boolean, required: false, default: false },
|
|
73
|
+
rules: { type: Array as PropType<Array<any>>, required: false, default: [] },
|
|
74
|
+
title: { type: String, required: true },
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const formattedDate = computed(() => {
|
|
78
|
+
if (date.value) {
|
|
79
|
+
return dateFormatter.format(date.value, props.displayFormat);
|
|
80
|
+
}
|
|
81
|
+
return props.required ? "Seleccione una fecha..." : "";
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
watch(date, () => {
|
|
85
|
+
openCalendar.value = false;
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style>
|
|
90
|
+
.v-overlay__content:has(>.v-date-picker){min-width:auto!important}.v-picker-title{padding:0!important}
|
|
91
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog
|
|
3
|
+
v-model="appStatusStore.openDialogDelete"
|
|
4
|
+
persistent
|
|
5
|
+
max-width="500"
|
|
6
|
+
>
|
|
7
|
+
<v-card :title="$t('Components.Dialogs.Delete.Title')" class="py-2">
|
|
8
|
+
<template v-slot:prepend>
|
|
9
|
+
<v-icon icon="mdi-delete" color="error" />
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<template v-slot:actions>
|
|
13
|
+
<div class="d-flex justify-space-between w-100 px-2 pt-4">
|
|
14
|
+
<BtnCancel @on-cancel="handleCancel" />
|
|
15
|
+
<BtnConfirm @on-confirm="emit('on-delete')" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
</v-card>
|
|
19
|
+
</v-dialog>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { useAppStatusStore } from "../../../stores/appStatus";
|
|
24
|
+
|
|
25
|
+
const appStatusStore = useAppStatusStore();
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits(["on-delete"]);
|
|
28
|
+
|
|
29
|
+
const handleCancel = () => {
|
|
30
|
+
appStatusStore.SET_OPEN_DIALOG_DELETE(false);
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
const appStatusStore = useAppStatusStore();
|
|
34
|
+
|
|
35
|
+
const exportTypesSelected = ref([0]);
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits(["on-export"]);
|
|
38
|
+
|
|
39
|
+
const handleCancel = () => {
|
|
40
|
+
appStatusStore.SET_OPEN_DIALOG_EXPORT(false);
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
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>
|
|
@@ -0,0 +1,36 @@
|
|
|
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="appStatusStore.SET_SHOW_INFO(false)"
|
|
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
|
+
// TODO: AGREGAR UNA CUENTA REGRESIVA DE CUANTO FALTA PARA QUE EL SNACKBAR SE CIERRE
|
|
35
|
+
onMounted(() => {});
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,251 @@
|
|
|
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>
|
|
@@ -0,0 +1,20 @@
|
|
|
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>
|