adminforth 1.1.17 → 1.1.19
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.
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
<ResourceForm
|
|
47
47
|
v-else
|
|
48
|
-
:record="
|
|
48
|
+
:record="record"
|
|
49
49
|
:resource="coreStore.resource"
|
|
50
50
|
@update:record="onUpdateRecord"
|
|
51
51
|
@update:isValid="isValid = $event"
|
|
@@ -75,7 +75,7 @@ import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
|
|
|
75
75
|
import { useCoreStore } from '@/stores/core';
|
|
76
76
|
import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions } from '@/utils';
|
|
77
77
|
import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
|
|
78
|
-
import { onMounted, ref } from 'vue';
|
|
78
|
+
import { onMounted, ref, watch } from 'vue';
|
|
79
79
|
import { useRoute, useRouter } from 'vue-router';
|
|
80
80
|
import { computed } from 'vue';
|
|
81
81
|
|
|
@@ -101,6 +101,8 @@ const initalValues = computed(() => {
|
|
|
101
101
|
return JSON.parse(decodeURIComponent(route.query.values));
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
|
|
105
|
+
|
|
104
106
|
async function onUpdateRecord(newRecord) {
|
|
105
107
|
console.log('newRecord', newRecord);
|
|
106
108
|
record.value = newRecord;
|
|
@@ -108,6 +110,7 @@ async function onUpdateRecord(newRecord) {
|
|
|
108
110
|
|
|
109
111
|
onMounted(async () => {
|
|
110
112
|
loading.value = true;
|
|
113
|
+
record.value = initalValues.value;
|
|
111
114
|
await coreStore.fetchResourceFull({
|
|
112
115
|
resourceId: route.params.resourceId
|
|
113
116
|
});
|
package/package.json
CHANGED
|
@@ -7,9 +7,9 @@ export type PluginOptions = {
|
|
|
7
7
|
* Called to check if user has access to a page
|
|
8
8
|
* Should return `true` if user has access. If user has no access, return `false` or a string with an error message
|
|
9
9
|
* @param user - The user object
|
|
10
|
-
* @param
|
|
10
|
+
* @param action - The {@link AllowedActionsEnum} action
|
|
11
11
|
* @param meta - The meta object containing query for list/show or record for save/edit
|
|
12
12
|
* @returns {boolean | string} -
|
|
13
13
|
*/
|
|
14
|
-
hasAccess: (user: AdminUser,
|
|
14
|
+
hasAccess: (user: AdminUser, action: AllowedActionsEnum, meta: any) => Promise<boolean | string>;
|
|
15
15
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
<ResourceForm
|
|
47
47
|
v-else
|
|
48
|
-
:record="
|
|
48
|
+
:record="record"
|
|
49
49
|
:resource="coreStore.resource"
|
|
50
50
|
@update:record="onUpdateRecord"
|
|
51
51
|
@update:isValid="isValid = $event"
|
|
@@ -75,7 +75,7 @@ import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
|
|
|
75
75
|
import { useCoreStore } from '@/stores/core';
|
|
76
76
|
import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions } from '@/utils';
|
|
77
77
|
import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
|
|
78
|
-
import { onMounted, ref } from 'vue';
|
|
78
|
+
import { onMounted, ref, watch } from 'vue';
|
|
79
79
|
import { useRoute, useRouter } from 'vue-router';
|
|
80
80
|
import { computed } from 'vue';
|
|
81
81
|
|
|
@@ -101,6 +101,8 @@ const initalValues = computed(() => {
|
|
|
101
101
|
return JSON.parse(decodeURIComponent(route.query.values));
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
|
|
105
|
+
|
|
104
106
|
async function onUpdateRecord(newRecord) {
|
|
105
107
|
console.log('newRecord', newRecord);
|
|
106
108
|
record.value = newRecord;
|
|
@@ -108,6 +110,7 @@ async function onUpdateRecord(newRecord) {
|
|
|
108
110
|
|
|
109
111
|
onMounted(async () => {
|
|
110
112
|
loading.value = true;
|
|
113
|
+
record.value = initalValues.value;
|
|
111
114
|
await coreStore.fetchResourceFull({
|
|
112
115
|
resourceId: route.params.resourceId
|
|
113
116
|
});
|
|
@@ -283,6 +283,12 @@ export type AdminForthConfigMenuItem = {
|
|
|
283
283
|
meta?: {
|
|
284
284
|
title?: string,
|
|
285
285
|
},
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Optional callback which will be called before rendering the menu for each item.
|
|
289
|
+
* You can use it to hide menu items depending on some user
|
|
290
|
+
*/
|
|
291
|
+
visible?: (user: AdminUser) => boolean,
|
|
286
292
|
}
|
|
287
293
|
|
|
288
294
|
|