adminforth 1.0.83 → 1.0.86
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/index.js +34 -16
- package/dist/modules/codeInjector.js +19 -10
- package/dist/plugins/ForeignInlineListPlugin/index.js +3 -2
- package/dist/servers/express.js +0 -3
- package/dist/spa/spa/package-lock.json +13 -0
- package/dist/spa/spa/package.json +1 -0
- package/dist/spa/spa/src/App.vue +44 -19
- package/dist/spa/spa/src/components/AcceptModal.vue +2 -9
- package/dist/spa/spa/src/components/Toast.vue +65 -0
- package/dist/spa/spa/src/components/ValueRenderer.vue +8 -8
- package/dist/spa/spa/src/composables/useStores.ts +51 -0
- package/dist/spa/spa/src/stores/core.ts +5 -1
- package/dist/spa/spa/src/stores/modal.ts +13 -2
- package/dist/spa/spa/src/stores/toast.ts +15 -0
- package/dist/spa/spa/src/views/CreateView.vue +25 -2
- package/dist/spa/spa/src/views/EditView.vue +28 -3
- package/dist/spa/spa/src/views/ListView.vue +28 -5
- package/dist/spa/spa/src/views/ShowView.vue +33 -7
- package/dist/types/AdminForthConfig.js +54 -0
- package/dist/types/FrontendAPI.js +7 -0
- package/documentation/docs/Getting Started.md +374 -0
- package/documentation/docs/Glossary.md +37 -0
- package/documentation/docs/image.png +0 -0
- package/documentation/docusaurus.config.ts +4 -4
- package/documentation/static/CNAME +1 -0
- package/index.ts +50 -35
- package/modules/codeInjector.ts +15 -6
- package/package.json +1 -1
- package/plugins/ForeignInlineListPlugin/index.ts +3 -3
- package/servers/express.ts +4 -9
- package/spa/package-lock.json +13 -0
- package/spa/package.json +1 -0
- package/spa/src/App.vue +44 -19
- package/spa/src/components/AcceptModal.vue +2 -9
- package/spa/src/components/Toast.vue +65 -0
- package/spa/src/components/ValueRenderer.vue +8 -8
- package/spa/src/composables/useStores.ts +51 -0
- package/spa/src/stores/core.ts +5 -1
- package/spa/src/stores/modal.ts +13 -2
- package/spa/src/stores/toast.ts +15 -0
- package/spa/src/views/CreateView.vue +25 -2
- package/spa/src/views/EditView.vue +28 -3
- package/spa/src/views/ListView.vue +28 -5
- package/spa/src/views/ShowView.vue +33 -7
- package/types/AdminForthConfig.ts +469 -42
- package/types/FrontendAPI.ts +73 -0
- package/documentation/static/img/docusaurus-social-card.jpg +0 -0
- package/documentation/static/img/tail.png:Zone.Identifier +0 -0
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="relative">
|
|
3
3
|
|
|
4
|
+
<component
|
|
5
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.beforeBreadcrumbs || []"
|
|
6
|
+
:is="getCustomComponent(c)"
|
|
7
|
+
:record="coreStore.record"
|
|
8
|
+
:resource="coreStore.resource"
|
|
9
|
+
:adminUser="coreStore.adminUser"
|
|
10
|
+
/>
|
|
11
|
+
|
|
4
12
|
<BreadcrumbsWithButtons>
|
|
5
13
|
<!-- save and cancle -->
|
|
6
14
|
<button @click="$router.back()"
|
|
@@ -22,6 +30,14 @@
|
|
|
22
30
|
|
|
23
31
|
</BreadcrumbsWithButtons>
|
|
24
32
|
|
|
33
|
+
<component
|
|
34
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.afterBreadcrumbs || []"
|
|
35
|
+
:is="getCustomComponent(c)"
|
|
36
|
+
:record="coreStore.record"
|
|
37
|
+
:resource="coreStore.resource"
|
|
38
|
+
:adminUser="coreStore.adminUser"
|
|
39
|
+
/>
|
|
40
|
+
|
|
25
41
|
<SingleSkeletLoader v-if="loading"></SingleSkeletLoader>
|
|
26
42
|
|
|
27
43
|
|
|
@@ -36,6 +52,13 @@
|
|
|
36
52
|
>
|
|
37
53
|
</ResourceForm>
|
|
38
54
|
|
|
55
|
+
<component
|
|
56
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.bottom || []"
|
|
57
|
+
:is="getCustomComponent(c)"
|
|
58
|
+
:record="coreStore.record"
|
|
59
|
+
:resource="coreStore.resource"
|
|
60
|
+
:adminUser="coreStore.adminUser"
|
|
61
|
+
/>
|
|
39
62
|
|
|
40
63
|
</div>
|
|
41
64
|
</template>
|
|
@@ -78,8 +101,8 @@ onMounted(async () => {
|
|
|
78
101
|
resourceId: route.params.resourceId
|
|
79
102
|
});
|
|
80
103
|
createComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
|
|
81
|
-
if (column.
|
|
82
|
-
acc[column.name] = getCustomComponent(column.
|
|
104
|
+
if (column.components?.create) {
|
|
105
|
+
acc[column.name] = getCustomComponent(column.components.create);
|
|
83
106
|
}
|
|
84
107
|
return acc;
|
|
85
108
|
}, {});
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="relative">
|
|
3
|
+
<component
|
|
4
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.beforeBreadcrumbs || []"
|
|
5
|
+
:is="getCustomComponent(c)"
|
|
6
|
+
:record="editableRecord"
|
|
7
|
+
:resource="coreStore.resource"
|
|
8
|
+
:adminUser="coreStore.adminUser"
|
|
9
|
+
/>
|
|
3
10
|
|
|
4
11
|
<BreadcrumbsWithButtons>
|
|
5
12
|
<!-- save and cancle -->
|
|
@@ -19,18 +26,36 @@
|
|
|
19
26
|
|
|
20
27
|
</BreadcrumbsWithButtons>
|
|
21
28
|
|
|
29
|
+
<component
|
|
30
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.afterBreadcrumbs || []"
|
|
31
|
+
:is="getCustomComponent(c)"
|
|
32
|
+
:record="coreStore.record"
|
|
33
|
+
:resource="coreStore.resource"
|
|
34
|
+
:adminUser="coreStore.adminUser"
|
|
35
|
+
/>
|
|
36
|
+
|
|
22
37
|
<SingleSkeletLoader v-if="loading"></SingleSkeletLoader>
|
|
23
38
|
|
|
24
39
|
<ResourceForm
|
|
25
40
|
v-else
|
|
26
41
|
:record="editableRecord"
|
|
27
|
-
:
|
|
42
|
+
:resource="coreStore.resource"
|
|
43
|
+
:adminUser="coreStore.adminUser"
|
|
28
44
|
@update:record="onUpdateRecord"
|
|
29
45
|
@update:isValid="isValid = $event"
|
|
30
46
|
:validating="validating"
|
|
31
47
|
:customComponentsPerColumn="editComponentsPerColumn"
|
|
32
48
|
>
|
|
33
49
|
</ResourceForm>
|
|
50
|
+
|
|
51
|
+
<component
|
|
52
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.bottom || []"
|
|
53
|
+
:is="getCustomComponent(c)"
|
|
54
|
+
:record="coreStore.record"
|
|
55
|
+
:resource="coreStore.resource"
|
|
56
|
+
:adminUser="coreStore.adminUser"
|
|
57
|
+
/>
|
|
58
|
+
|
|
34
59
|
</div>
|
|
35
60
|
</template>
|
|
36
61
|
|
|
@@ -92,8 +117,8 @@ onMounted(async () => {
|
|
|
92
117
|
checkAcessByAllowedActions(coreStore.resourceOptions.allowedActions,'edit');
|
|
93
118
|
|
|
94
119
|
editComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
|
|
95
|
-
if (column.
|
|
96
|
-
acc[column.name] = getCustomComponent(column.
|
|
120
|
+
if (column.components?.edit) {
|
|
121
|
+
acc[column.name] = getCustomComponent(column.components.edit);
|
|
97
122
|
}
|
|
98
123
|
return acc;
|
|
99
124
|
}, {});
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
/>
|
|
10
10
|
</Teleport>
|
|
11
11
|
|
|
12
|
+
<component
|
|
13
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeBreadcrumbs || []"
|
|
14
|
+
:is="getCustomComponent(c)"
|
|
15
|
+
:resource="coreStore.resource"
|
|
16
|
+
:adminUser="coreStore.adminUser"
|
|
17
|
+
/>
|
|
18
|
+
|
|
12
19
|
<BreadcrumbsWithButtons>
|
|
13
20
|
<button
|
|
14
21
|
@click="()=>{checkboxes = []}"
|
|
@@ -64,6 +71,13 @@
|
|
|
64
71
|
</button>
|
|
65
72
|
</BreadcrumbsWithButtons>
|
|
66
73
|
|
|
74
|
+
<component
|
|
75
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.afterBreadcrumbs || []"
|
|
76
|
+
:is="getCustomComponent(c)"
|
|
77
|
+
:resource="coreStore.resource"
|
|
78
|
+
:adminUser="coreStore.adminUser"
|
|
79
|
+
/>
|
|
80
|
+
|
|
67
81
|
<!-- table -->
|
|
68
82
|
<div class="relative overflow-x-auto shadow-list-table-shadow dark:shadow-black overflow-y-hidden rounded-default">
|
|
69
83
|
|
|
@@ -202,7 +216,9 @@
|
|
|
202
216
|
<component
|
|
203
217
|
:is="listComponentsPerColumn[c.name] || ValueRenderer"
|
|
204
218
|
:column="c"
|
|
205
|
-
:
|
|
219
|
+
:record="row"
|
|
220
|
+
:adminUser="coreStore.adminUser"
|
|
221
|
+
:resource="coreStore.resource"
|
|
206
222
|
/>
|
|
207
223
|
</td>
|
|
208
224
|
<td class=" items-center px-6 py-4">
|
|
@@ -260,8 +276,7 @@
|
|
|
260
276
|
</div>
|
|
261
277
|
<!-- pagination -->
|
|
262
278
|
<div class="flex flex-col items-center mt-4 xs:flex-row xs:justify-between xs:items-center"
|
|
263
|
-
v-if="rows && totalRows >= pageSize && totalRows > 0"
|
|
264
|
-
>
|
|
279
|
+
v-if="rows && totalRows >= pageSize && totalRows > 0">
|
|
265
280
|
<!-- Help text -->
|
|
266
281
|
<span class="text-sm text-gray-700 dark:text-gray-400">
|
|
267
282
|
Showing <span class="font-semibold text-gray-900 dark:text-white">
|
|
@@ -313,6 +328,14 @@
|
|
|
313
328
|
</button>
|
|
314
329
|
</div>
|
|
315
330
|
</div>
|
|
331
|
+
|
|
332
|
+
<component
|
|
333
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.bottom || []"
|
|
334
|
+
:is="getCustomComponent(c)"
|
|
335
|
+
:resource="coreStore.resource"
|
|
336
|
+
:adminUser="coreStore.adminUser"
|
|
337
|
+
/>
|
|
338
|
+
|
|
316
339
|
</div>
|
|
317
340
|
</template>
|
|
318
341
|
|
|
@@ -434,8 +457,8 @@ async function getList() {
|
|
|
434
457
|
}
|
|
435
458
|
});
|
|
436
459
|
listComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
|
|
437
|
-
if (column.
|
|
438
|
-
acc[column.name] = getCustomComponent(column.
|
|
460
|
+
if (column.components?.list) {
|
|
461
|
+
acc[column.name] = getCustomComponent(column.components.list);
|
|
439
462
|
}
|
|
440
463
|
return acc;
|
|
441
464
|
}, {});
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="relative">
|
|
3
|
+
<component
|
|
4
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.beforeBreadcrumbs || []"
|
|
5
|
+
:is="getCustomComponent(c)"
|
|
6
|
+
:record="coreStore.record"
|
|
7
|
+
:resource="coreStore.resource"
|
|
8
|
+
:adminUser="coreStore.adminUser"
|
|
9
|
+
/>
|
|
3
10
|
<BreadcrumbsWithButtons>
|
|
4
11
|
<RouterLink v-if="coreStore?.resourceOptions?.allowedActions?.edit" :to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: $route.params.primaryKey } }"
|
|
5
12
|
class="flex items-center py-1 px-3 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
@@ -16,6 +23,14 @@
|
|
|
16
23
|
</button>
|
|
17
24
|
</BreadcrumbsWithButtons>
|
|
18
25
|
|
|
26
|
+
<component
|
|
27
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.afterBreadcrumbs || []"
|
|
28
|
+
:is="getCustomComponent(c)"
|
|
29
|
+
:record="coreStore.record"
|
|
30
|
+
:resource="coreStore.resource"
|
|
31
|
+
:adminUser="coreStore.adminUser"
|
|
32
|
+
/>
|
|
33
|
+
|
|
19
34
|
<div v-if="loading" role="status" class="max-w-sm animate-pulse">
|
|
20
35
|
<div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
|
|
21
36
|
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
|
|
@@ -48,7 +63,8 @@
|
|
|
48
63
|
v-if="showRowComponentsPerColumn[column.name]"
|
|
49
64
|
:is="showRowComponentsPerColumn[column.name]"
|
|
50
65
|
:column="column"
|
|
51
|
-
:
|
|
66
|
+
:resource="coreStore.resource"
|
|
67
|
+
:record="coreStore.record"
|
|
52
68
|
/>
|
|
53
69
|
<template v-else>
|
|
54
70
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
@@ -58,18 +74,28 @@
|
|
|
58
74
|
<component
|
|
59
75
|
v-if="showComponentsPerColumn[column.name]"
|
|
60
76
|
:is="showComponentsPerColumn[column.name]"
|
|
77
|
+
:resource="coreStore.resource"
|
|
61
78
|
:column="column"
|
|
62
|
-
:
|
|
79
|
+
:record="coreStore.record"
|
|
63
80
|
/>
|
|
64
81
|
<ValueRenderer v-else
|
|
65
82
|
:column="column"
|
|
66
|
-
:
|
|
83
|
+
:record="coreStore.record"
|
|
67
84
|
/>
|
|
68
85
|
</td>
|
|
69
86
|
</template>
|
|
70
87
|
</tr>
|
|
71
88
|
</tbody>
|
|
72
89
|
</table>
|
|
90
|
+
|
|
91
|
+
<component
|
|
92
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.bottom || []"
|
|
93
|
+
:is="getCustomComponent(c)"
|
|
94
|
+
:column="column"
|
|
95
|
+
:record="coreStore.record"
|
|
96
|
+
:resource="coreStore.resource"
|
|
97
|
+
:adminUser="coreStore.adminUser"
|
|
98
|
+
/>
|
|
73
99
|
</div>
|
|
74
100
|
|
|
75
101
|
|
|
@@ -116,14 +142,14 @@ onMounted(async () => {
|
|
|
116
142
|
checkAcessByAllowedActions(coreStore.resourceOptions.allowedActions,'show');
|
|
117
143
|
|
|
118
144
|
showComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
|
|
119
|
-
if (column.
|
|
120
|
-
acc[column.name] = getCustomComponent(column.
|
|
145
|
+
if (column.components?.show) {
|
|
146
|
+
acc[column.name] = getCustomComponent(column.components.show);
|
|
121
147
|
}
|
|
122
148
|
return acc;
|
|
123
149
|
}, {});
|
|
124
150
|
showRowComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
|
|
125
|
-
if (column.
|
|
126
|
-
acc[column.name] = getCustomComponent(column.
|
|
151
|
+
if (column.components?.showRow) {
|
|
152
|
+
acc[column.name] = getCustomComponent(column.components.showRow);
|
|
127
153
|
}
|
|
128
154
|
return acc;
|
|
129
155
|
}, {});
|
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
export var AdminForthMenuTypes;
|
|
2
|
+
(function (AdminForthMenuTypes) {
|
|
3
|
+
/**
|
|
4
|
+
* HEADING is just a label in the menu.
|
|
5
|
+
* Respect `label` and `icon` property in {@link AdminForthConfigMenuItem}
|
|
6
|
+
*/
|
|
7
|
+
AdminForthMenuTypes["heading"] = "heading";
|
|
8
|
+
/**
|
|
9
|
+
* GROUP is a group of menu items.
|
|
10
|
+
* Respects `label`, `icon` and `children` properties in {@link AdminForthConfigMenuItem}
|
|
11
|
+
* use @AdminForthMenuTypes.open to set if group is open by default
|
|
12
|
+
*/
|
|
13
|
+
AdminForthMenuTypes["group"] = "group";
|
|
14
|
+
/**
|
|
15
|
+
* RESOURCE is a link to a resource.
|
|
16
|
+
* Respects `label`, `icon`, `resourceId`, `homepage`, `isStaticRoute` properties in {@link AdminForthConfigMenuItem}
|
|
17
|
+
*/
|
|
18
|
+
AdminForthMenuTypes["resource"] = "resource";
|
|
19
|
+
/**
|
|
20
|
+
* PAGE is a link to a custom page.
|
|
21
|
+
* Respects `label`, `icon`, `path`, `component`, `homepage`, `isStaticRoute`, properties in {@link AdminForthConfigMenuItem}
|
|
22
|
+
*
|
|
23
|
+
* Example:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* \{
|
|
27
|
+
* type: AdminForthMenuTypes.PAGE,
|
|
28
|
+
* label: 'Custom Page',
|
|
29
|
+
* icon: 'home',
|
|
30
|
+
* path: '/dash',
|
|
31
|
+
* component: '@@/Dashboard.vue',
|
|
32
|
+
* homepage: true,
|
|
33
|
+
* \}
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
AdminForthMenuTypes["page"] = "page";
|
|
38
|
+
/**
|
|
39
|
+
* GAP ads some space between menu items.
|
|
40
|
+
*/
|
|
41
|
+
AdminForthMenuTypes["gap"] = "gap";
|
|
42
|
+
/**
|
|
43
|
+
* DIVIDER is a divider between menu items.
|
|
44
|
+
*/
|
|
45
|
+
AdminForthMenuTypes["divider"] = "divider";
|
|
46
|
+
})(AdminForthMenuTypes || (AdminForthMenuTypes = {}));
|
|
47
|
+
export var AdminForthResourcePages;
|
|
48
|
+
(function (AdminForthResourcePages) {
|
|
49
|
+
AdminForthResourcePages["list"] = "list";
|
|
50
|
+
AdminForthResourcePages["show"] = "show";
|
|
51
|
+
AdminForthResourcePages["edit"] = "edit";
|
|
52
|
+
AdminForthResourcePages["create"] = "create";
|
|
53
|
+
AdminForthResourcePages["filter"] = "filter";
|
|
54
|
+
})(AdminForthResourcePages || (AdminForthResourcePages = {}));
|
|
1
55
|
export var AdminForthDataTypes;
|
|
2
56
|
(function (AdminForthDataTypes) {
|
|
3
57
|
AdminForthDataTypes["STRING"] = "string";
|