atom-nuxt 1.0.156 → 1.1.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/dist/module.json +1 -1
- package/dist/runtime/components/CrudFormDialog.vue +16 -9
- package/dist/runtime/components/CrudFormDialog.vue.d.ts +2 -0
- package/dist/runtime/components/CrudPaginatedLoader.vue +24 -1
- package/dist/runtime/components/CrudPaginatedLoader.vue.d.ts +3 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -54,6 +54,11 @@ const props = defineProps({
|
|
|
54
54
|
required: false,
|
|
55
55
|
default: "Delete item"
|
|
56
56
|
},
|
|
57
|
+
viewTitle: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: false,
|
|
60
|
+
default: "View item"
|
|
61
|
+
},
|
|
57
62
|
saveAction: {
|
|
58
63
|
type: Function,
|
|
59
64
|
required: true
|
|
@@ -94,13 +99,14 @@ const item = defineModel();
|
|
|
94
99
|
const dialogOpen = defineModel("dialog");
|
|
95
100
|
const hasItem = computed(() => item.value && Object.keys(item.value).length > 0);
|
|
96
101
|
const buttonTitle = computed(() => {
|
|
97
|
-
return props.btnText ? props.btnText : props.action === "create" ? props.createTitle : props.action === "update" ? props.updateTitle : props.action === "delete" ? props.deleteTitle : "";
|
|
102
|
+
return props.btnText ? props.btnText : props.action === "create" ? props.createTitle : props.action === "update" ? props.updateTitle : props.action === "delete" ? props.deleteTitle : props.action === "view" ? props.viewTitle : "";
|
|
98
103
|
});
|
|
99
104
|
const buttonIcon = computed(() => {
|
|
100
|
-
return props.btnIcon ? props.btnIcon : props.action === "create" ? "mdi-plus" : props.action === "update" ? "mdi-pencil" : props.action === "delete" ? "mdi-delete" : "mdi-timer-sand";
|
|
105
|
+
return props.btnIcon ? props.btnIcon : props.action === "create" ? "mdi-plus" : props.action === "update" ? "mdi-pencil" : props.action === "delete" ? "mdi-delete" : props.action === "view" ? "mdi-eye" : "mdi-timer-sand";
|
|
101
106
|
});
|
|
102
107
|
const display = useDisplay();
|
|
103
108
|
const isLarge = computed(() => display.lgAndUp.value);
|
|
109
|
+
const readonly = computed(() => props.action === "view");
|
|
104
110
|
</script>
|
|
105
111
|
|
|
106
112
|
<template>
|
|
@@ -129,7 +135,7 @@ const isLarge = computed(() => display.lgAndUp.value);
|
|
|
129
135
|
Loading
|
|
130
136
|
</v-toolbar-title>
|
|
131
137
|
<v-toolbar-title v-else>{{
|
|
132
|
-
action === 'create' ? createTitle : (action === 'update' ? updateTitle : (action === 'delete' ? deleteTitle : ''))
|
|
138
|
+
action === 'create' ? createTitle : (action === 'update' ? updateTitle : (action === 'delete' ? deleteTitle : (action === 'view' ? viewTitle : '')))
|
|
133
139
|
}}
|
|
134
140
|
</v-toolbar-title>
|
|
135
141
|
</v-toolbar>
|
|
@@ -143,7 +149,7 @@ const isLarge = computed(() => display.lgAndUp.value);
|
|
|
143
149
|
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
|
144
150
|
</div>
|
|
145
151
|
|
|
146
|
-
<div v-if="(hasItem && !itemPending) || action === 'create'" class="flex-fill">
|
|
152
|
+
<div v-if="(hasItem && !itemPending) || action === 'create' || action === 'view'" class="flex-fill">
|
|
147
153
|
<suspense>
|
|
148
154
|
<template #fallback>
|
|
149
155
|
<div v-if="!itemPending" class="d-flex flex-fill flex-column justify-center align-center"
|
|
@@ -151,21 +157,22 @@ const isLarge = computed(() => display.lgAndUp.value);
|
|
|
151
157
|
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
|
152
158
|
</div>
|
|
153
159
|
</template>
|
|
154
|
-
<slot
|
|
155
|
-
|
|
156
|
-
|
|
160
|
+
<slot :action="action"
|
|
161
|
+
:readonly="readonly"
|
|
162
|
+
:item="item"
|
|
163
|
+
:errors="formErrors">
|
|
157
164
|
|
|
158
165
|
</slot>
|
|
159
166
|
</suspense>
|
|
160
167
|
</div>
|
|
161
168
|
</div>
|
|
162
|
-
<v-card-actions v-if="!hideActions" class="pa-0 border-t pa-4 elevation-5">
|
|
169
|
+
<v-card-actions v-if="!hideActions && action !== 'view'" class="pa-0 border-t pa-4 elevation-5">
|
|
163
170
|
<v-btn
|
|
164
171
|
size="large"
|
|
165
172
|
class="px-5"
|
|
166
173
|
:width="isLarge ? 'auto' : '100%'"
|
|
167
174
|
:disabled="disabled || !action"
|
|
168
|
-
:color="btnColor ? btnColor : (action === 'create' ? 'success' : (action === 'update' ? 'info' : (action === 'delete' ? 'error' : 'light')))"
|
|
175
|
+
:color="btnColor ? btnColor : (action === 'create' ? 'success' : (action === 'update' ? 'info' : (action === 'delete' ? 'error' : (action === 'view' ? 'primary' : 'light'))))"
|
|
169
176
|
variant="flat"
|
|
170
177
|
@click="saveAction"
|
|
171
178
|
:loading="formPending"
|
|
@@ -13,6 +13,7 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
13
13
|
createTitle: string;
|
|
14
14
|
updateTitle: string;
|
|
15
15
|
deleteTitle: string;
|
|
16
|
+
viewTitle: string;
|
|
16
17
|
saveAction: Function;
|
|
17
18
|
btnIcon: string;
|
|
18
19
|
btnColor: string;
|
|
@@ -25,6 +26,7 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
25
26
|
type __VLS_Slots = {
|
|
26
27
|
default?: ((props: {
|
|
27
28
|
action: any;
|
|
29
|
+
readonly: any;
|
|
28
30
|
item: any;
|
|
29
31
|
errors: any;
|
|
30
32
|
}) => any) | undefined;
|
|
@@ -90,6 +90,13 @@ const props = defineProps({
|
|
|
90
90
|
return "Create item";
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
|
+
viewTitle: {
|
|
94
|
+
type: String,
|
|
95
|
+
required: false,
|
|
96
|
+
default() {
|
|
97
|
+
return "View item";
|
|
98
|
+
}
|
|
99
|
+
},
|
|
93
100
|
customFilters: {
|
|
94
101
|
type: Object,
|
|
95
102
|
required: false,
|
|
@@ -151,7 +158,7 @@ const previousRoute = usePreviousRoute();
|
|
|
151
158
|
const action = computed(() => route.query[(props.loaderKey ?? "") + "action"]);
|
|
152
159
|
const actionId = computed(() => route.query[(props.loaderKey ?? "") + "actionId"]);
|
|
153
160
|
const dialogOpen = computed({
|
|
154
|
-
get: () => !!(action.value === "create" || action.value === "update" && actionId.value || action.value === "delete" && actionId.value),
|
|
161
|
+
get: () => !!(action.value === "create" || action.value === "update" && actionId.value || action.value === "delete" && actionId.value || action.value === "view" && actionId.value),
|
|
155
162
|
set: (value) => {
|
|
156
163
|
if (!value) {
|
|
157
164
|
const hasBackState = router.options.history.state.back;
|
|
@@ -254,6 +261,17 @@ const deleteForm = async (id) => {
|
|
|
254
261
|
}
|
|
255
262
|
await router.push(newQuery);
|
|
256
263
|
};
|
|
264
|
+
const viewForm = async (id) => {
|
|
265
|
+
const newQuery = { query: { ...route.query } };
|
|
266
|
+
if (props.loaderKey) {
|
|
267
|
+
newQuery.query[(props.loaderKey ?? "") + "action"] = "view";
|
|
268
|
+
newQuery.query[(props.loaderKey ?? "") + "actionId"] = id;
|
|
269
|
+
} else {
|
|
270
|
+
newQuery.query.action = "view";
|
|
271
|
+
newQuery.query.actionId = id;
|
|
272
|
+
}
|
|
273
|
+
await router.push(newQuery);
|
|
274
|
+
};
|
|
257
275
|
const createForm = () => {
|
|
258
276
|
item.value = props.initialItem ? cloneDeep(props.initialItem) : {};
|
|
259
277
|
const newQuery = { query: { ...route.query } };
|
|
@@ -308,6 +326,8 @@ watch(action, (newVal, oldValue) => {
|
|
|
308
326
|
item.value = props.initialItem ? cloneDeep(props.initialItem) : {};
|
|
309
327
|
} else if (action.value === "delete" && actionId.value) {
|
|
310
328
|
getItem(actionId.value);
|
|
329
|
+
} else if (action.value === "view" && actionId.value) {
|
|
330
|
+
getItem(actionId.value);
|
|
311
331
|
}
|
|
312
332
|
} catch (error) {
|
|
313
333
|
console.error("Error in actionId watcher:", error);
|
|
@@ -344,6 +364,7 @@ const exportAction = async () => {
|
|
|
344
364
|
:pending="listPending"
|
|
345
365
|
:create-action="createForm"
|
|
346
366
|
:update-action="updateForm"
|
|
367
|
+
:view-action="viewForm"
|
|
347
368
|
:delete-action="deleteForm"
|
|
348
369
|
:form-pending="formPending"
|
|
349
370
|
:export-action="exportAction"
|
|
@@ -376,6 +397,7 @@ const exportAction = async () => {
|
|
|
376
397
|
:items="items"
|
|
377
398
|
:pending="listPending"
|
|
378
399
|
:update-action="updateForm"
|
|
400
|
+
:view-action="viewForm"
|
|
379
401
|
:delete-action="deleteForm"
|
|
380
402
|
:form-pending="formPending"
|
|
381
403
|
>
|
|
@@ -405,6 +427,7 @@ const exportAction = async () => {
|
|
|
405
427
|
:create-title="createTitle"
|
|
406
428
|
:update-title="updateTitle"
|
|
407
429
|
:delete-title="deleteTitle"
|
|
430
|
+
:view-title="viewTitle"
|
|
408
431
|
:save-action="saveAction"
|
|
409
432
|
:full-screen="fullScreenDialog"
|
|
410
433
|
>
|
|
@@ -13,6 +13,7 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
13
13
|
createTitle: string;
|
|
14
14
|
updateTitle: string;
|
|
15
15
|
deleteTitle: string;
|
|
16
|
+
viewTitle: string;
|
|
16
17
|
allowCreate: boolean;
|
|
17
18
|
hideFilters: boolean;
|
|
18
19
|
fullScreenDialog: boolean;
|
|
@@ -36,6 +37,7 @@ type __VLS_Slots = {
|
|
|
36
37
|
pending: any;
|
|
37
38
|
createAction: any;
|
|
38
39
|
updateAction: any;
|
|
40
|
+
viewAction: any;
|
|
39
41
|
deleteAction: any;
|
|
40
42
|
formPending: any;
|
|
41
43
|
exportAction: any;
|
|
@@ -59,6 +61,7 @@ type __VLS_Slots = {
|
|
|
59
61
|
items: any;
|
|
60
62
|
pending: any;
|
|
61
63
|
updateAction: any;
|
|
64
|
+
viewAction: any;
|
|
62
65
|
deleteAction: any;
|
|
63
66
|
formPending: any;
|
|
64
67
|
}) => any) | undefined;
|