atom-nuxt 1.3.1 → 1.3.3
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.d.mts +3 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/AlertDisplay.vue +11 -18
- package/dist/runtime/components/AlertDisplay.vue.d.ts +2 -0
- package/dist/runtime/components/CrudAddressSearchField.vue +22 -35
- package/dist/runtime/components/CrudAddressSearchField.vue.d.ts +8 -0
- package/dist/runtime/components/CrudApiSelectorField.vue +11 -24
- package/dist/runtime/components/CrudApiSelectorField.vue.d.ts +30 -0
- package/dist/runtime/components/CrudConfirmDialog.vue +11 -17
- package/dist/runtime/components/CrudConfirmDialog.vue.d.ts +18 -0
- package/dist/runtime/components/CrudErrorDisplay.vue +3 -4
- package/dist/runtime/components/CrudErrorDisplay.vue.d.ts +6 -0
- package/dist/runtime/components/CrudFilter.vue +25 -46
- package/dist/runtime/components/CrudFilter.vue.d.ts +8 -0
- package/dist/runtime/components/CrudFilterList.vue +0 -6
- package/dist/runtime/components/CrudFilterList.vue.d.ts +5 -0
- package/dist/runtime/components/CrudFormDialog.vue +82 -24
- package/dist/runtime/components/CrudFormDialog.vue.d.ts +39 -0
- package/dist/runtime/components/CrudFormLoader.vue +127 -120
- package/dist/runtime/components/CrudFormLoader.vue.d.ts +46 -0
- package/dist/runtime/components/CrudListLoader.vue +16 -27
- package/dist/runtime/components/CrudListLoader.vue.d.ts +37 -0
- package/dist/runtime/components/CrudPaginatedLoader.vue +118 -99
- package/dist/runtime/components/CrudPaginatedLoader.vue.d.ts +83 -0
- package/dist/runtime/components/CrudUploadField.vue +6 -28
- package/dist/runtime/components/CrudUploadField.vue.d.ts +23 -0
- package/dist/runtime/components/CrudUploadFieldSelection.vue +19 -27
- package/dist/runtime/components/CrudUploadFieldSelection.vue.d.ts +18 -0
- package/dist/types.d.mts +4 -2
- package/package.json +1 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -22
- package/dist/types.d.ts +0 -7
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<script setup async>
|
|
2
|
-
import {useCrudApi} from "../composables/useCrudApi";
|
|
2
|
+
import { useCrudApi } from "../composables/useCrudApi";
|
|
3
3
|
import CrudErrorDisplay from "./CrudErrorDisplay.vue";
|
|
4
|
-
import {useListenerService} from "../composables/useListenerService";
|
|
5
|
-
import {watch, onMounted, onBeforeUnmount, ref} from "vue";
|
|
6
|
-
import {useDebounceFn} from "@vueuse/core";
|
|
7
|
-
|
|
4
|
+
import { useListenerService } from "../composables/useListenerService";
|
|
5
|
+
import { watch, onMounted, onBeforeUnmount, ref } from "vue";
|
|
6
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
8
7
|
const props = defineProps({
|
|
9
|
-
debounced
|
|
8
|
+
debounced: {
|
|
10
9
|
type: Boolean,
|
|
11
|
-
default
|
|
10
|
+
default: false
|
|
12
11
|
},
|
|
13
|
-
disableNoResults
|
|
12
|
+
disableNoResults: {
|
|
14
13
|
type: Boolean,
|
|
15
14
|
default: false
|
|
16
15
|
},
|
|
@@ -37,7 +36,7 @@ const props = defineProps({
|
|
|
37
36
|
required: false,
|
|
38
37
|
default: false
|
|
39
38
|
},
|
|
40
|
-
listeners
|
|
39
|
+
listeners: {
|
|
41
40
|
type: Array,
|
|
42
41
|
required: false,
|
|
43
42
|
default: () => []
|
|
@@ -64,20 +63,16 @@ const {
|
|
|
64
63
|
totalPages,
|
|
65
64
|
hasListErrors
|
|
66
65
|
} = useCrudApi(props.path);
|
|
67
|
-
|
|
68
66
|
const debouncedGet = useDebounceFn(getItems, 500);
|
|
69
|
-
|
|
70
67
|
const lastRequest = ref(null);
|
|
71
|
-
|
|
72
68
|
const setLastRequest = () => {
|
|
73
|
-
lastRequest.value = JSON.stringify({page: props.page, perPage: props.perPage, customFilters: props.customFilters});
|
|
74
|
-
}
|
|
75
|
-
|
|
69
|
+
lastRequest.value = JSON.stringify({ page: props.page, perPage: props.perPage, customFilters: props.customFilters });
|
|
70
|
+
};
|
|
76
71
|
watch(() => props.customFilters, () => {
|
|
77
|
-
if (lastRequest.value === JSON.stringify({page: props.page, perPage: props.perPage, customFilters: props.customFilters})) {
|
|
72
|
+
if (lastRequest.value === JSON.stringify({ page: props.page, perPage: props.perPage, customFilters: props.customFilters })) {
|
|
78
73
|
return;
|
|
79
74
|
}
|
|
80
|
-
if(props.debounced) {
|
|
75
|
+
if (props.debounced) {
|
|
81
76
|
debouncedGet(props.page, props.perPage, props.customFilters);
|
|
82
77
|
} else {
|
|
83
78
|
getItems(props.page, props.perPage, props.customFilters);
|
|
@@ -87,27 +82,25 @@ watch(() => props.customFilters, () => {
|
|
|
87
82
|
watch(() => props.page, () => {
|
|
88
83
|
getItems(props.page, props.perPage, props.customFilters);
|
|
89
84
|
});
|
|
90
|
-
if(props.await) {
|
|
85
|
+
if (props.await) {
|
|
91
86
|
await getItems(props.page, props.perPage, props.customFilters);
|
|
92
87
|
} else {
|
|
93
88
|
getItems(props.page, props.perPage, props.customFilters);
|
|
94
89
|
}
|
|
95
90
|
setLastRequest();
|
|
96
|
-
|
|
97
|
-
const {addListener, removeLocalListenersWithEvent, notify} = useListenerService();
|
|
91
|
+
const { addListener, removeLocalListenersWithEvent, notify } = useListenerService();
|
|
98
92
|
onMounted(() => {
|
|
99
93
|
props.listeners.forEach((listener) => {
|
|
100
94
|
addListener(listener, (data) => {
|
|
101
95
|
getItems(props.page, null, props.customFilters);
|
|
102
96
|
});
|
|
103
97
|
});
|
|
104
|
-
})
|
|
98
|
+
});
|
|
105
99
|
onBeforeUnmount(() => {
|
|
106
100
|
props.listeners.forEach((listener) => {
|
|
107
101
|
removeLocalListenersWithEvent(listener);
|
|
108
102
|
});
|
|
109
|
-
})
|
|
110
|
-
|
|
103
|
+
});
|
|
111
104
|
</script>
|
|
112
105
|
|
|
113
106
|
<template>
|
|
@@ -135,7 +128,3 @@ onBeforeUnmount(() => {
|
|
|
135
128
|
</slot>
|
|
136
129
|
</div>
|
|
137
130
|
</template>
|
|
138
|
-
|
|
139
|
-
<style scoped>
|
|
140
|
-
|
|
141
|
-
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
|
+
page: number;
|
|
8
|
+
debounced: boolean;
|
|
9
|
+
disableNoResults: boolean;
|
|
10
|
+
path: string;
|
|
11
|
+
perPage: number;
|
|
12
|
+
await: boolean;
|
|
13
|
+
listeners: unknown[];
|
|
14
|
+
noResultsText: string;
|
|
15
|
+
useQueryParams: boolean;
|
|
16
|
+
customFilters?: Record<string, any> | undefined;
|
|
17
|
+
$props: any;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
type __VLS_Slots = {
|
|
20
|
+
errors?: ((props: {}) => any) | undefined;
|
|
21
|
+
} & {
|
|
22
|
+
empty?: ((props: {}) => any) | undefined;
|
|
23
|
+
} & {
|
|
24
|
+
loader?: ((props: {
|
|
25
|
+
empty: boolean;
|
|
26
|
+
}) => any) | undefined;
|
|
27
|
+
} & {
|
|
28
|
+
default?: ((props: {
|
|
29
|
+
items: any;
|
|
30
|
+
pending: any;
|
|
31
|
+
totalItems: any;
|
|
32
|
+
totalPages: any;
|
|
33
|
+
currentPage: any;
|
|
34
|
+
perPage: any;
|
|
35
|
+
filters: any;
|
|
36
|
+
}) => any) | undefined;
|
|
37
|
+
};
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
<script setup async>
|
|
2
|
-
import {useCrudApi} from "../composables/useCrudApi";
|
|
3
|
-
import {useCrudConverters} from "../composables/useCrudConverters";
|
|
4
|
-
import {usePreviousRoute} from "../composables/usePreviousRoute";
|
|
5
|
-
import {useRoute, useRouter} from
|
|
2
|
+
import { useCrudApi } from "../composables/useCrudApi";
|
|
3
|
+
import { useCrudConverters } from "../composables/useCrudConverters";
|
|
4
|
+
import { usePreviousRoute } from "../composables/usePreviousRoute";
|
|
5
|
+
import { useRoute, useRouter } from "#app";
|
|
6
6
|
import CrudFilterList from "./CrudFilterList.vue";
|
|
7
|
-
import {computed, ref, watch, onMounted, onBeforeUnmount} from "vue";
|
|
8
|
-
import {useDebounceFn} from
|
|
9
|
-
import {useListenerService} from "../composables/useListenerService";
|
|
7
|
+
import { computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
|
|
8
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
9
|
+
import { useListenerService } from "../composables/useListenerService";
|
|
10
10
|
import CrudFormDialog from "./CrudFormDialog.vue";
|
|
11
11
|
import CrudErrorDisplay from "./CrudErrorDisplay.vue";
|
|
12
|
-
|
|
13
|
-
const {parseQuery, stringifyQuery, cloneDeep} = useCrudConverters();
|
|
12
|
+
const { parseQuery, stringifyQuery, cloneDeep } = useCrudConverters();
|
|
14
13
|
const props = defineProps({
|
|
14
|
+
filterClasses: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: false,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
resultClasses: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: false,
|
|
22
|
+
default: ""
|
|
23
|
+
},
|
|
15
24
|
fullScreenDialog: {
|
|
16
25
|
type: Boolean,
|
|
17
26
|
required: false,
|
|
@@ -123,6 +132,36 @@ const props = defineProps({
|
|
|
123
132
|
type: String,
|
|
124
133
|
required: false,
|
|
125
134
|
default: ""
|
|
135
|
+
},
|
|
136
|
+
dialogStyle: {
|
|
137
|
+
type: String,
|
|
138
|
+
required: false,
|
|
139
|
+
default: null
|
|
140
|
+
},
|
|
141
|
+
dialogSize: {
|
|
142
|
+
type: [String, Number],
|
|
143
|
+
required: false,
|
|
144
|
+
default: null
|
|
145
|
+
},
|
|
146
|
+
createDialogSize: {
|
|
147
|
+
type: [String, Number],
|
|
148
|
+
required: false,
|
|
149
|
+
default: null
|
|
150
|
+
},
|
|
151
|
+
updateDialogSize: {
|
|
152
|
+
type: [String, Number],
|
|
153
|
+
required: false,
|
|
154
|
+
default: null
|
|
155
|
+
},
|
|
156
|
+
deleteDialogSize: {
|
|
157
|
+
type: [String, Number],
|
|
158
|
+
required: false,
|
|
159
|
+
default: null
|
|
160
|
+
},
|
|
161
|
+
viewDialogSize: {
|
|
162
|
+
type: [String, Number],
|
|
163
|
+
required: false,
|
|
164
|
+
default: null
|
|
126
165
|
}
|
|
127
166
|
});
|
|
128
167
|
const {
|
|
@@ -152,40 +191,29 @@ const {
|
|
|
152
191
|
hasExportErrors,
|
|
153
192
|
hasListErrors
|
|
154
193
|
} = useCrudApi(props.path, false, props.transformItem, props.transformItems);
|
|
155
|
-
|
|
156
194
|
perPage.value = props.perPage;
|
|
157
|
-
|
|
158
195
|
const route = useRoute();
|
|
159
196
|
const router = useRouter();
|
|
160
197
|
const previousRoute = usePreviousRoute();
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
const actionId = computed(() => route.query[(props.loaderKey ?? '') + 'actionId']);
|
|
164
|
-
|
|
198
|
+
const action = computed(() => route.query[(props.loaderKey ?? "") + "action"]);
|
|
199
|
+
const actionId = computed(() => route.query[(props.loaderKey ?? "") + "actionId"]);
|
|
165
200
|
const dialogOpen = computed({
|
|
166
|
-
get: () => !!(action.value === "create" ||
|
|
201
|
+
get: () => !!(action.value === "create" || action.value === "update" && actionId.value || action.value === "delete" && actionId.value || action.value === "view" && actionId.value),
|
|
167
202
|
set: (value) => {
|
|
168
203
|
if (!value) {
|
|
169
|
-
const hasBackState = router.options.history.state.back
|
|
170
|
-
|
|
171
|
-
console.log(
|
|
172
|
-
console.log(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
console.log('currentRouteName', currentRouteName)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (hasBackState && previousRouteName === currentRouteName) { // Only go back if there's a back state AND the previous route is the same
|
|
183
|
-
console.log('going back')
|
|
204
|
+
const hasBackState = router.options.history.state.back;
|
|
205
|
+
console.log("hasBackState", hasBackState);
|
|
206
|
+
console.log("previousRoute", previousRoute.value);
|
|
207
|
+
console.log("route", route);
|
|
208
|
+
const previousRouteName = previousRoute.value?.name;
|
|
209
|
+
const currentRouteName = route.name;
|
|
210
|
+
console.log("previousRouteName", previousRouteName);
|
|
211
|
+
console.log("currentRouteName", currentRouteName);
|
|
212
|
+
if (hasBackState && previousRouteName === currentRouteName) {
|
|
213
|
+
console.log("going back");
|
|
184
214
|
router.back();
|
|
185
215
|
} else {
|
|
186
|
-
|
|
187
|
-
const currentQuery = {...route.query};
|
|
188
|
-
|
|
216
|
+
const currentQuery = { ...route.query };
|
|
189
217
|
if (props.loaderKey) {
|
|
190
218
|
delete currentQuery[`${props.loaderKey}action`];
|
|
191
219
|
delete currentQuery[`${props.loaderKey}actionId`];
|
|
@@ -193,40 +221,35 @@ const dialogOpen = computed({
|
|
|
193
221
|
delete currentQuery.action;
|
|
194
222
|
delete currentQuery.actionId;
|
|
195
223
|
}
|
|
196
|
-
|
|
197
224
|
const finalRoute = {
|
|
198
225
|
path: route.path,
|
|
199
|
-
query: currentQuery
|
|
226
|
+
query: currentQuery
|
|
200
227
|
};
|
|
201
228
|
router.replace(finalRoute);
|
|
202
229
|
}
|
|
203
230
|
}
|
|
204
231
|
}
|
|
205
232
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
233
|
const page = computed(() => props.loaderKey ? parseQuery(route.query[props.loaderKey])?.page ?? 1 : route.query.page ?? 1);
|
|
209
|
-
const filterValues = props.loaderKey ? ref({...props.customFilters, ...parseQuery(route.query[props.loaderKey])}
|
|
210
|
-
const onQueryChange = (
|
|
234
|
+
const filterValues = props.loaderKey ? ref({ ...props.customFilters, ...parseQuery(route.query[props.loaderKey]) }) : ref({ ...props.customFilters, ...route.query });
|
|
235
|
+
const onQueryChange = (page2) => {
|
|
211
236
|
console.error("QUERY CHANGED");
|
|
212
|
-
const newQuery = {}
|
|
237
|
+
const newQuery = {};
|
|
213
238
|
const existingQuery = parseQuery(route.query);
|
|
214
|
-
|
|
215
239
|
for (const key in filterValues.value) {
|
|
216
240
|
if (filterValues.value[key] !== null && filterValues.value[key] !== "") {
|
|
217
241
|
newQuery[key] = filterValues.value[key];
|
|
218
242
|
}
|
|
219
243
|
}
|
|
220
|
-
newQuery.page =
|
|
244
|
+
newQuery.page = page2;
|
|
221
245
|
let finalQuery = {
|
|
222
|
-
...existingQuery
|
|
223
|
-
}
|
|
246
|
+
...existingQuery
|
|
247
|
+
};
|
|
224
248
|
if (props.loaderKey) {
|
|
225
249
|
finalQuery[props.loaderKey] = stringifyQuery(newQuery);
|
|
226
250
|
} else {
|
|
227
251
|
finalQuery = newQuery;
|
|
228
252
|
}
|
|
229
|
-
//Delete action and actionId from query when filters or page change
|
|
230
253
|
if (props.loaderKey) {
|
|
231
254
|
delete finalQuery[`${props.loaderKey}action`];
|
|
232
255
|
delete finalQuery[`${props.loaderKey}actionId`];
|
|
@@ -235,76 +258,70 @@ const onQueryChange = (page) => {
|
|
|
235
258
|
delete finalQuery.actionId;
|
|
236
259
|
}
|
|
237
260
|
console.error("Setting query", finalQuery);
|
|
238
|
-
router.replace({path: route.path, query: finalQuery, force: true})
|
|
239
|
-
}
|
|
261
|
+
router.replace({ path: route.path, query: finalQuery, force: true });
|
|
262
|
+
};
|
|
240
263
|
watch(currentPage, (newVal, oldValue) => {
|
|
241
264
|
onQueryChange(currentPage.value);
|
|
242
265
|
});
|
|
243
266
|
watch(filterValues, (newVal, oldValue) => {
|
|
244
267
|
console.error("FILTERS CHANGED");
|
|
245
268
|
onQueryChange(1);
|
|
246
|
-
}, {deep: true});
|
|
247
|
-
|
|
248
|
-
|
|
269
|
+
}, { deep: true });
|
|
249
270
|
watch(() => page, () => {
|
|
250
271
|
console.error("ROUTE CHANGED");
|
|
251
272
|
debouncedGet();
|
|
252
|
-
}, {deep: true});
|
|
273
|
+
}, { deep: true });
|
|
253
274
|
watch(() => filterValues, () => {
|
|
254
275
|
console.error("ROUTE CHANGED");
|
|
255
276
|
debouncedGet();
|
|
256
|
-
}, {deep: true});
|
|
257
|
-
|
|
277
|
+
}, { deep: true });
|
|
258
278
|
const debouncedGet = useDebounceFn(() => {
|
|
259
279
|
console.error("DEBOUNCED GET");
|
|
260
280
|
getItems(Number.parseInt(page.value) ?? null, null, filterValues.value);
|
|
261
|
-
}, 200)
|
|
262
|
-
|
|
281
|
+
}, 200);
|
|
263
282
|
const updateForm = async (id) => {
|
|
264
|
-
const newQuery = {query: {...route.query}};
|
|
283
|
+
const newQuery = { query: { ...route.query } };
|
|
265
284
|
if (props.loaderKey) {
|
|
266
|
-
newQuery.query[(props.loaderKey ??
|
|
267
|
-
newQuery.query[(props.loaderKey ??
|
|
285
|
+
newQuery.query[(props.loaderKey ?? "") + "action"] = "update";
|
|
286
|
+
newQuery.query[(props.loaderKey ?? "") + "actionId"] = id;
|
|
268
287
|
} else {
|
|
269
288
|
newQuery.query.action = "update";
|
|
270
289
|
newQuery.query.actionId = id;
|
|
271
290
|
}
|
|
272
291
|
await router.push(newQuery);
|
|
273
|
-
}
|
|
292
|
+
};
|
|
274
293
|
const deleteForm = async (id) => {
|
|
275
|
-
|
|
276
|
-
const newQuery = {query: {...route.query}};
|
|
294
|
+
const newQuery = { query: { ...route.query } };
|
|
277
295
|
if (props.loaderKey) {
|
|
278
|
-
newQuery.query[(props.loaderKey ??
|
|
279
|
-
newQuery.query[(props.loaderKey ??
|
|
296
|
+
newQuery.query[(props.loaderKey ?? "") + "action"] = "delete";
|
|
297
|
+
newQuery.query[(props.loaderKey ?? "") + "actionId"] = id;
|
|
280
298
|
} else {
|
|
281
299
|
newQuery.query.action = "delete";
|
|
282
300
|
newQuery.query.actionId = id;
|
|
283
301
|
}
|
|
284
302
|
await router.push(newQuery);
|
|
285
|
-
}
|
|
303
|
+
};
|
|
286
304
|
const viewForm = async (id) => {
|
|
287
|
-
const newQuery = {query: {...route.query}};
|
|
305
|
+
const newQuery = { query: { ...route.query } };
|
|
288
306
|
if (props.loaderKey) {
|
|
289
|
-
newQuery.query[(props.loaderKey ??
|
|
290
|
-
newQuery.query[(props.loaderKey ??
|
|
307
|
+
newQuery.query[(props.loaderKey ?? "") + "action"] = "view";
|
|
308
|
+
newQuery.query[(props.loaderKey ?? "") + "actionId"] = id;
|
|
291
309
|
} else {
|
|
292
310
|
newQuery.query.action = "view";
|
|
293
311
|
newQuery.query.actionId = id;
|
|
294
312
|
}
|
|
295
313
|
await router.push(newQuery);
|
|
296
|
-
}
|
|
314
|
+
};
|
|
297
315
|
const createForm = () => {
|
|
298
316
|
item.value = props.initialItem ? cloneDeep(props.initialItem) : {};
|
|
299
|
-
const newQuery = {query: {...route.query}};
|
|
317
|
+
const newQuery = { query: { ...route.query } };
|
|
300
318
|
if (props.loaderKey) {
|
|
301
|
-
newQuery.query[(props.loaderKey ??
|
|
319
|
+
newQuery.query[(props.loaderKey ?? "") + "action"] = "create";
|
|
302
320
|
} else {
|
|
303
321
|
newQuery.query.action = "create";
|
|
304
322
|
}
|
|
305
323
|
router.push(newQuery);
|
|
306
|
-
}
|
|
307
|
-
|
|
324
|
+
};
|
|
308
325
|
const saveAction = async () => {
|
|
309
326
|
formPending.value = true;
|
|
310
327
|
let itemToSave = JSON.parse(JSON.stringify(item.value));
|
|
@@ -335,14 +352,12 @@ const saveAction = async () => {
|
|
|
335
352
|
await getItems(Number.parseInt(page.value) ?? null, null, filterValues.value);
|
|
336
353
|
notify(savedPath + ":" + savedAction, savedItem);
|
|
337
354
|
}
|
|
338
|
-
}
|
|
339
|
-
|
|
355
|
+
};
|
|
340
356
|
if (props.await) {
|
|
341
357
|
await getItems(page.value ?? null, null, filterValues.value);
|
|
342
358
|
} else {
|
|
343
359
|
getItems(page.value ?? null, null, filterValues.value);
|
|
344
360
|
}
|
|
345
|
-
|
|
346
361
|
watch(action, (newVal, oldValue) => {
|
|
347
362
|
try {
|
|
348
363
|
if (action.value === "update" && actionId.value) {
|
|
@@ -357,28 +372,26 @@ watch(action, (newVal, oldValue) => {
|
|
|
357
372
|
} catch (error) {
|
|
358
373
|
console.error("Error in actionId watcher:", error);
|
|
359
374
|
}
|
|
360
|
-
}, {immediate: true});
|
|
361
|
-
|
|
362
|
-
const {addListener, removeLocalListenersWithEvent, notify} = useListenerService();
|
|
375
|
+
}, { immediate: true });
|
|
376
|
+
const { addListener, removeLocalListenersWithEvent, notify } = useListenerService();
|
|
363
377
|
onMounted(() => {
|
|
364
378
|
props.listeners.forEach((listener) => {
|
|
365
379
|
addListener(listener, (data) => {
|
|
366
380
|
getItems(Number.parseInt(page.value) ?? null, null, filterValues.value);
|
|
367
381
|
});
|
|
368
382
|
});
|
|
369
|
-
})
|
|
383
|
+
});
|
|
370
384
|
onBeforeUnmount(() => {
|
|
371
385
|
props.listeners.forEach((listener) => {
|
|
372
386
|
removeLocalListenersWithEvent(listener);
|
|
373
387
|
});
|
|
374
|
-
})
|
|
388
|
+
});
|
|
375
389
|
const exportAction = async () => {
|
|
376
390
|
await exportItems(filterValues.value);
|
|
377
391
|
if (!hasExportErrors.value) {
|
|
378
|
-
window.open(exportUrl.value,
|
|
392
|
+
window.open(exportUrl.value, "_blank");
|
|
379
393
|
}
|
|
380
|
-
}
|
|
381
|
-
|
|
394
|
+
};
|
|
382
395
|
</script>
|
|
383
396
|
|
|
384
397
|
<template>
|
|
@@ -405,7 +418,9 @@ const exportAction = async () => {
|
|
|
405
418
|
<v-col v-if="!hideFilters && filters.length > 0" cols="12" md="3">
|
|
406
419
|
<div>
|
|
407
420
|
<slot name="filters" :filters="filters">
|
|
408
|
-
<
|
|
421
|
+
<div :class="filterClasses">
|
|
422
|
+
<crud-filter-list v-model="filterValues" :filters="filters"></crud-filter-list>
|
|
423
|
+
</div>
|
|
409
424
|
</slot>
|
|
410
425
|
</div>
|
|
411
426
|
</v-col>
|
|
@@ -419,16 +434,18 @@ const exportAction = async () => {
|
|
|
419
434
|
<slot v-if="hasListErrors" name="error" :errors="listErrors">
|
|
420
435
|
<crud-error-display :errors="listErrors"></crud-error-display>
|
|
421
436
|
</slot>
|
|
422
|
-
<
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
437
|
+
<div :class="resultClasses">
|
|
438
|
+
<slot
|
|
439
|
+
v-if="totalItems > 0"
|
|
440
|
+
:items="items"
|
|
441
|
+
:pending="listPending"
|
|
442
|
+
:update-action="updateForm"
|
|
443
|
+
:view-action="viewForm"
|
|
444
|
+
:delete-action="deleteForm"
|
|
445
|
+
:form-pending="formPending"
|
|
446
|
+
>
|
|
447
|
+
</slot>
|
|
448
|
+
</div>
|
|
432
449
|
</div>
|
|
433
450
|
<div v-if="totalItems > 0 && totalPages > 1" class="pa-3">
|
|
434
451
|
<span class="d-none d-md-block pa-3">Page {{ currentPage }} of {{ totalPages }} pages with {{ totalItems }} items</span>
|
|
@@ -457,6 +474,12 @@ const exportAction = async () => {
|
|
|
457
474
|
:view-title="viewTitle"
|
|
458
475
|
:save-action="saveAction"
|
|
459
476
|
:full-screen="fullScreenDialog"
|
|
477
|
+
:dialog-style="dialogStyle"
|
|
478
|
+
:dialog-size="dialogSize"
|
|
479
|
+
:create-dialog-size="createDialogSize"
|
|
480
|
+
:update-dialog-size="updateDialogSize"
|
|
481
|
+
:delete-dialog-size="deleteDialogSize"
|
|
482
|
+
:view-dialog-size="viewDialogSize"
|
|
460
483
|
>
|
|
461
484
|
<slot
|
|
462
485
|
name="form" :action="action"
|
|
@@ -469,7 +492,3 @@ const exportAction = async () => {
|
|
|
469
492
|
|
|
470
493
|
</div>
|
|
471
494
|
</template>
|
|
472
|
-
|
|
473
|
-
<style scoped>
|
|
474
|
-
|
|
475
|
-
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
|
+
path: string;
|
|
8
|
+
customFilters: Record<string, any>;
|
|
9
|
+
perPage: number;
|
|
10
|
+
await: boolean;
|
|
11
|
+
listeners: unknown[];
|
|
12
|
+
noResultsText: string;
|
|
13
|
+
createTitle: string;
|
|
14
|
+
updateTitle: string;
|
|
15
|
+
deleteTitle: string;
|
|
16
|
+
viewTitle: string;
|
|
17
|
+
dialogStyle: string;
|
|
18
|
+
dialogSize: string | number;
|
|
19
|
+
createDialogSize: string | number;
|
|
20
|
+
updateDialogSize: string | number;
|
|
21
|
+
deleteDialogSize: string | number;
|
|
22
|
+
viewDialogSize: string | number;
|
|
23
|
+
allowCreate: boolean;
|
|
24
|
+
hideFilters: boolean;
|
|
25
|
+
filterClasses: string;
|
|
26
|
+
resultClasses: string;
|
|
27
|
+
fullScreenDialog: boolean;
|
|
28
|
+
contentClasses: string;
|
|
29
|
+
title?: string | undefined;
|
|
30
|
+
loaderKey?: string | undefined;
|
|
31
|
+
initialItem?: Record<string, any> | undefined;
|
|
32
|
+
transformItem?: Function | undefined;
|
|
33
|
+
transformItems?: Function | undefined;
|
|
34
|
+
beforeSave?: Function | undefined;
|
|
35
|
+
beforeCreate?: Function | undefined;
|
|
36
|
+
beforeUpdate?: Function | undefined;
|
|
37
|
+
beforeDelete?: Function | undefined;
|
|
38
|
+
$props: any;
|
|
39
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
+
type __VLS_Slots = {
|
|
41
|
+
before?: ((props: {
|
|
42
|
+
items: any;
|
|
43
|
+
totalItems: any;
|
|
44
|
+
totalPages: any;
|
|
45
|
+
pending: any;
|
|
46
|
+
createAction: any;
|
|
47
|
+
updateAction: any;
|
|
48
|
+
viewAction: any;
|
|
49
|
+
deleteAction: any;
|
|
50
|
+
formPending: any;
|
|
51
|
+
exportAction: any;
|
|
52
|
+
exportPending: any;
|
|
53
|
+
exportErrors: any;
|
|
54
|
+
}) => any) | undefined;
|
|
55
|
+
} & {
|
|
56
|
+
filters?: ((props: {
|
|
57
|
+
filters: any;
|
|
58
|
+
}) => any) | undefined;
|
|
59
|
+
} & {
|
|
60
|
+
empty?: ((props: {
|
|
61
|
+
createAction: any;
|
|
62
|
+
}) => any) | undefined;
|
|
63
|
+
} & {
|
|
64
|
+
error?: ((props: {
|
|
65
|
+
errors: any;
|
|
66
|
+
}) => any) | undefined;
|
|
67
|
+
} & {
|
|
68
|
+
default?: ((props: {
|
|
69
|
+
items: any;
|
|
70
|
+
pending: any;
|
|
71
|
+
updateAction: any;
|
|
72
|
+
viewAction: any;
|
|
73
|
+
deleteAction: any;
|
|
74
|
+
formPending: any;
|
|
75
|
+
}) => any) | undefined;
|
|
76
|
+
} & {
|
|
77
|
+
form?: ((props: {
|
|
78
|
+
action: any;
|
|
79
|
+
item: any;
|
|
80
|
+
originalItem: any;
|
|
81
|
+
errors: any;
|
|
82
|
+
}) => any) | undefined;
|
|
83
|
+
};
|