una-nuxt-module 2.1.38 → 2.1.40
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/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/auth/composables/useAuthorization.d.ts +1 -20
- package/dist/runtime/auth/composables/useAuthorization.js +1 -30
- package/dist/runtime/components/ui/stepper/StepperItem.d.vue.ts +1 -1
- package/dist/runtime/components/ui/stepper/StepperItem.vue.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +0 -36
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -173,7 +173,7 @@ function addTemplates() {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
const name = "una-nuxt-module";
|
|
176
|
-
const version = "2.1.
|
|
176
|
+
const version = "2.1.40";
|
|
177
177
|
|
|
178
178
|
const module = defineNuxtModule({
|
|
179
179
|
meta: {
|
|
@@ -193,6 +193,7 @@ const module = defineNuxtModule({
|
|
|
193
193
|
async setup(options, nuxt) {
|
|
194
194
|
const logger = useLogger(name);
|
|
195
195
|
const { resolve } = createResolver(import.meta.url);
|
|
196
|
+
options = defu(nuxt.options.runtimeConfig.public.unaNuxtModule, options);
|
|
196
197
|
nuxt.options.alias["#unaxt"] = resolve("./runtime");
|
|
197
198
|
function setupAutoImports() {
|
|
198
199
|
addImportsDir(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IHasAuthorizationInResourceParams,
|
|
1
|
+
import type { IHasAuthorizationInResourceParams, IResource } from "../../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Composable encargado de exponer los métodos de autorización.
|
|
4
4
|
*/
|
|
@@ -7,23 +7,4 @@ export declare const useAuthorization: () => {
|
|
|
7
7
|
getResources: (token: string) => Promise<IResource[]>;
|
|
8
8
|
isPageUnprotected: (page: string) => boolean;
|
|
9
9
|
hasAuthorizationIn: (params: IHasAuthorizationInResourceParams) => boolean;
|
|
10
|
-
getAuthorizedPaths: () => ({
|
|
11
|
-
header: string;
|
|
12
|
-
title?: string;
|
|
13
|
-
icon?: string;
|
|
14
|
-
to?: string;
|
|
15
|
-
divider?: boolean;
|
|
16
|
-
children?: IMenuItem[];
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
description?: string;
|
|
19
|
-
} | {
|
|
20
|
-
title: string;
|
|
21
|
-
header?: string;
|
|
22
|
-
icon?: string;
|
|
23
|
-
to?: string;
|
|
24
|
-
divider?: boolean;
|
|
25
|
-
children?: IMenuItem[];
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
description?: string;
|
|
28
|
-
})[];
|
|
29
10
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#imports";
|
|
2
|
-
import { useI18n } from "vue-i18n";
|
|
3
2
|
import { useAuthStore } from "../stores/auth.js";
|
|
4
3
|
export const useAuthorization = () => {
|
|
5
4
|
const isPageUnprotected = (page) => {
|
|
@@ -40,38 +39,10 @@ export const useAuthorization = () => {
|
|
|
40
39
|
}
|
|
41
40
|
return [];
|
|
42
41
|
};
|
|
43
|
-
const removeUnathorizedPaths = (navigationMenu) => {
|
|
44
|
-
const { t } = useI18n();
|
|
45
|
-
return navigationMenu.map((menuItem) => {
|
|
46
|
-
if (menuItem?.header) {
|
|
47
|
-
return { ...menuItem, header: t(menuItem.header) };
|
|
48
|
-
}
|
|
49
|
-
if (menuItem?.to && menuItem?.title) {
|
|
50
|
-
if (isPageUnprotected(menuItem?.to) || hasAccessTo(menuItem.to)) {
|
|
51
|
-
return { ...menuItem, title: t(menuItem.title) };
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (menuItem?.children && menuItem?.title) {
|
|
55
|
-
menuItem.children = removeUnathorizedPaths(
|
|
56
|
-
menuItem.children
|
|
57
|
-
);
|
|
58
|
-
return { ...menuItem, title: t(menuItem.title) };
|
|
59
|
-
}
|
|
60
|
-
}).filter((menuItem) => {
|
|
61
|
-
return menuItem !== void 0;
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const getAuthorizedPaths = () => {
|
|
65
|
-
const runtimeConfig = useRuntimeConfig();
|
|
66
|
-
return removeUnathorizedPaths(
|
|
67
|
-
runtimeConfig.public.unaNuxtModule.navigation.menu
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
42
|
return {
|
|
71
43
|
hasAccessTo,
|
|
72
44
|
getResources,
|
|
73
45
|
isPageUnprotected,
|
|
74
|
-
hasAuthorizationIn
|
|
75
|
-
getAuthorizedPaths
|
|
46
|
+
hasAuthorizationIn
|
|
76
47
|
};
|
|
77
48
|
};
|
|
@@ -4,7 +4,7 @@ type __VLS_Props = StepperItemProps & {
|
|
|
4
4
|
class?: HTMLAttributes["class"];
|
|
5
5
|
};
|
|
6
6
|
declare var __VLS_7: {
|
|
7
|
-
state: "
|
|
7
|
+
state: "inactive" | "active" | "completed";
|
|
8
8
|
};
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_7) => any;
|
|
@@ -4,7 +4,7 @@ type __VLS_Props = StepperItemProps & {
|
|
|
4
4
|
class?: HTMLAttributes["class"];
|
|
5
5
|
};
|
|
6
6
|
declare var __VLS_7: {
|
|
7
|
-
state: "
|
|
7
|
+
state: "inactive" | "active" | "completed";
|
|
8
8
|
};
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_7) => any;
|
|
@@ -72,10 +72,6 @@ export interface IUnaNuxtModuleOptions {
|
|
|
72
72
|
* Páginas que no requieren autenticación.
|
|
73
73
|
*/
|
|
74
74
|
unprotectedPages: string[];
|
|
75
|
-
/**
|
|
76
|
-
* Menú de navegación configurado para la aplicación.
|
|
77
|
-
*/
|
|
78
|
-
menu: IMenuItem[];
|
|
79
75
|
};
|
|
80
76
|
use: {
|
|
81
77
|
sso: boolean;
|
|
@@ -300,38 +296,6 @@ export interface IHasAuthorizationInResourceParams {
|
|
|
300
296
|
* @type TItemsPerPage
|
|
301
297
|
*/
|
|
302
298
|
export type TItemsPerPage = 10 | 20 | 50;
|
|
303
|
-
/**
|
|
304
|
-
* Interfaz para las opciones del menú de navegación.
|
|
305
|
-
*
|
|
306
|
-
* @interface IMenuItem
|
|
307
|
-
*
|
|
308
|
-
* @property {string} - *header* - Si no es nulo la opción será de tipo header
|
|
309
|
-
* @property {string} - *title* - Texto de la opción
|
|
310
|
-
* @property {string} - *icon* - Icono de la opción
|
|
311
|
-
* @property {string} - *to* - Ruta de la opción
|
|
312
|
-
* @property {boolean} - *divider* - Si es true la opción será de tipo divider
|
|
313
|
-
* @property {IMenuItem[]} - *children* - Opciones del menú, sino es nulo la opción será de tipo ComboBox
|
|
314
|
-
* @property {boolean} - *disabled* - Indica si la opción esta deshabilitada
|
|
315
|
-
* @property {string} - *description* - Descripción de la opción
|
|
316
|
-
*/
|
|
317
|
-
export interface IMenuItem {
|
|
318
|
-
/** Si no es nulo la opción será de tipo header */
|
|
319
|
-
header?: string;
|
|
320
|
-
/** Texto de la opción */
|
|
321
|
-
title?: string;
|
|
322
|
-
/** Icono de la opción */
|
|
323
|
-
icon?: string;
|
|
324
|
-
/** Ruta de la opción */
|
|
325
|
-
to?: string;
|
|
326
|
-
/** Si es true la opción será de tipo divider */
|
|
327
|
-
divider?: boolean;
|
|
328
|
-
/** Opciones del menú, sino es nulo la opción será de tipo ComboBox */
|
|
329
|
-
children?: IMenuItem[];
|
|
330
|
-
/** Indica si la opción esta deshabilitada */
|
|
331
|
-
disabled?: boolean;
|
|
332
|
-
/** Descripción de la opción */
|
|
333
|
-
description?: string;
|
|
334
|
-
}
|
|
335
299
|
/**
|
|
336
300
|
* Tipo para los filtros de ordenamiento de la tabla.
|
|
337
301
|
*
|