una-nuxt-module 1.0.4 → 1.0.6
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
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createResolver, defineNuxtModule, useLogger, extendPages, addLayout, addComponentsDir, addImportsDir, addPlugin, addRouteMiddleware, hasNuxtModule } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const name = "una-nuxt-module";
|
|
4
|
-
const version = "1.0.
|
|
4
|
+
const version = "1.0.6";
|
|
5
5
|
|
|
6
6
|
function resolve(path) {
|
|
7
7
|
const resolver = createResolver(import.meta.url);
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type IItemsPerPage, type TFormMode } from "#imports";
|
|
2
|
+
import { type Ref } from "vue";
|
|
3
|
+
export declare const useCrudState: (params: {
|
|
4
|
+
textToSearch: Ref<string | null>;
|
|
5
|
+
formMode: Ref<TFormMode>;
|
|
6
|
+
openForm: Ref<boolean>;
|
|
7
|
+
page: Ref<number>;
|
|
8
|
+
itemsPerPage: Ref<IItemsPerPage>;
|
|
9
|
+
totalPages: Ref<number>;
|
|
10
|
+
totalElements: Ref<number>;
|
|
11
|
+
}) => {
|
|
3
12
|
pagination: import("vue").ComputedRef<{
|
|
4
13
|
page: number;
|
|
5
14
|
size: number;
|
|
6
15
|
}>;
|
|
7
|
-
formState: import("vue").Ref<{
|
|
8
|
-
formMode: TFormMode;
|
|
9
|
-
openForm: boolean;
|
|
10
|
-
}, IFormState | {
|
|
11
|
-
formMode: TFormMode;
|
|
12
|
-
openForm: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
tableState: import("vue").Ref<{
|
|
15
|
-
page: number;
|
|
16
|
-
itemsPerPage: {
|
|
17
|
-
value: number;
|
|
18
|
-
title: string;
|
|
19
|
-
};
|
|
20
|
-
textToSearch: string | null;
|
|
21
|
-
totalPages: number;
|
|
22
|
-
totalElements: number;
|
|
23
|
-
}, ITableState | {
|
|
24
|
-
page: number;
|
|
25
|
-
itemsPerPage: {
|
|
26
|
-
value: number;
|
|
27
|
-
title: string;
|
|
28
|
-
};
|
|
29
|
-
textToSearch: string | null;
|
|
30
|
-
totalPages: number;
|
|
31
|
-
totalElements: number;
|
|
32
|
-
}>;
|
|
33
16
|
resetTableStatus: () => void;
|
|
34
17
|
setFormMode: (newState: TFormMode) => void;
|
|
35
18
|
setOpenForm: (newState: boolean) => void;
|
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
1
|
import {
|
|
3
|
-
computed,
|
|
4
|
-
INITIAL_FORM_STATE,
|
|
5
2
|
INITIAL_TABLE_STATE,
|
|
6
3
|
useFormModeTrackerStore
|
|
7
4
|
} from "#imports";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
export const useCrudState = (params) => {
|
|
7
|
+
const {
|
|
8
|
+
textToSearch,
|
|
9
|
+
formMode,
|
|
10
|
+
openForm,
|
|
11
|
+
page,
|
|
12
|
+
itemsPerPage,
|
|
13
|
+
totalPages,
|
|
14
|
+
totalElements
|
|
15
|
+
} = params;
|
|
11
16
|
const pagination = computed(() => {
|
|
12
17
|
return {
|
|
13
|
-
page:
|
|
14
|
-
size:
|
|
18
|
+
page: page.value - 1,
|
|
19
|
+
size: itemsPerPage.value.value
|
|
15
20
|
};
|
|
16
21
|
});
|
|
17
22
|
function resetTableStatus() {
|
|
18
|
-
|
|
23
|
+
textToSearch.value = INITIAL_TABLE_STATE.textToSearch;
|
|
24
|
+
page.value = INITIAL_TABLE_STATE.page;
|
|
25
|
+
itemsPerPage.value = INITIAL_TABLE_STATE.itemsPerPage;
|
|
26
|
+
totalPages.value = INITIAL_TABLE_STATE.totalPages;
|
|
27
|
+
totalElements.value = INITIAL_TABLE_STATE.totalElements;
|
|
19
28
|
}
|
|
20
29
|
function setFormMode(newState) {
|
|
21
30
|
const formModeTrackerStore = useFormModeTrackerStore();
|
|
22
31
|
formModeTrackerStore.setFormMode(newState);
|
|
23
|
-
|
|
32
|
+
formMode.value = newState;
|
|
24
33
|
}
|
|
25
34
|
function setOpenForm(newState) {
|
|
26
|
-
|
|
35
|
+
openForm.value = newState;
|
|
27
36
|
}
|
|
28
|
-
function updatePagination(
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
function updatePagination(params2) {
|
|
38
|
+
totalElements.value = params2.totalElements;
|
|
39
|
+
totalPages.value = params2.totalPages;
|
|
31
40
|
}
|
|
32
41
|
return {
|
|
33
42
|
pagination,
|
|
34
|
-
formState,
|
|
35
|
-
tableState,
|
|
36
43
|
resetTableStatus,
|
|
37
44
|
setFormMode,
|
|
38
45
|
setOpenForm,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "una-nuxt-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Módulo Nuxt para desarrollo CGI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,17 +20,6 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"prepack": "nuxt-module-build build",
|
|
25
|
-
"dev": "nuxi dev playground",
|
|
26
|
-
"dev:build": "nuxi build playground",
|
|
27
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
28
|
-
"release": "npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
29
|
-
"lint": "eslint .",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test:watch": "vitest watch",
|
|
32
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
33
|
-
},
|
|
34
23
|
"dependencies": {
|
|
35
24
|
"@asgardeo/auth-spa": "^3.1.2",
|
|
36
25
|
"@nuxt/image": "^1.8.1",
|
|
@@ -65,5 +54,15 @@
|
|
|
65
54
|
"bugs": {
|
|
66
55
|
"url": "https://github.com/una-cgi/una-nuxt-module/issues"
|
|
67
56
|
},
|
|
68
|
-
"homepage": "https://github.com/una-cgi/una-nuxt-module#readme"
|
|
69
|
-
|
|
57
|
+
"homepage": "https://github.com/una-cgi/una-nuxt-module#readme",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"dev": "nuxi dev playground",
|
|
60
|
+
"dev:build": "nuxi build playground",
|
|
61
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
62
|
+
"release": "npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
63
|
+
"lint": "eslint .",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest watch",
|
|
66
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
67
|
+
}
|
|
68
|
+
}
|