adminforth 1.3.55-next.0 → 1.3.55
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/spa/.eslintrc.cjs +14 -0
- package/dist/spa/README.md +39 -0
- package/dist/spa/env.d.ts +1 -0
- package/dist/spa/index.html +23 -0
- package/dist/spa/package-lock.json +4659 -0
- package/dist/spa/package.json +52 -0
- package/dist/spa/postcss.config.js +6 -0
- package/dist/spa/public/assets/favicon.png +0 -0
- package/dist/spa/src/App.vue +418 -0
- package/dist/spa/src/assets/base.css +2 -0
- package/dist/spa/src/assets/logo.svg +19 -0
- package/dist/spa/src/components/AcceptModal.vue +45 -0
- package/dist/spa/src/components/Breadcrumbs.vue +41 -0
- package/dist/spa/src/components/BreadcrumbsWithButtons.vue +26 -0
- package/dist/spa/src/components/CustomDatePicker.vue +176 -0
- package/dist/spa/src/components/CustomDateRangePicker.vue +218 -0
- package/dist/spa/src/components/CustomRangePicker.vue +156 -0
- package/dist/spa/src/components/Dropdown.vue +168 -0
- package/dist/spa/src/components/Filters.vue +222 -0
- package/dist/spa/src/components/HelloWorld.vue +17 -0
- package/dist/spa/src/components/MenuLink.vue +27 -0
- package/dist/spa/src/components/ResourceForm.vue +325 -0
- package/dist/spa/src/components/ResourceListTable.vue +466 -0
- package/dist/spa/src/components/SingleSkeletLoader.vue +13 -0
- package/dist/spa/src/components/SkeleteLoader.vue +23 -0
- package/dist/spa/src/components/ThreeDotsMenu.vue +43 -0
- package/dist/spa/src/components/Toast.vue +78 -0
- package/dist/spa/src/components/ValueRenderer.vue +141 -0
- package/dist/spa/src/components/icons/IconCalendar.vue +5 -0
- package/dist/spa/src/components/icons/IconCommunity.vue +7 -0
- package/dist/spa/src/components/icons/IconDocumentation.vue +7 -0
- package/dist/spa/src/components/icons/IconEcosystem.vue +7 -0
- package/dist/spa/src/components/icons/IconSupport.vue +7 -0
- package/dist/spa/src/components/icons/IconTime.vue +5 -0
- package/dist/spa/src/components/icons/IconTooling.vue +19 -0
- package/dist/spa/src/composables/useFrontendApi.ts +26 -0
- package/dist/spa/src/composables/useStores.ts +131 -0
- package/dist/spa/src/index.scss +31 -0
- package/dist/spa/src/main.ts +18 -0
- package/dist/spa/src/renderers/CompactUUID.vue +48 -0
- package/dist/spa/src/renderers/CountryFlag.vue +69 -0
- package/dist/spa/src/router/index.ts +59 -0
- package/dist/spa/src/spa_types/core.ts +53 -0
- package/dist/spa/src/stores/core.ts +148 -0
- package/dist/spa/src/stores/filters.ts +27 -0
- package/dist/spa/src/stores/modal.ts +48 -0
- package/dist/spa/src/stores/toast.ts +31 -0
- package/dist/spa/src/stores/user.ts +72 -0
- package/dist/spa/src/types/AdminForthConfig.ts +1762 -0
- package/dist/spa/src/types/FrontendAPI.ts +143 -0
- package/dist/spa/src/utils.ts +160 -0
- package/dist/spa/src/views/CreateView.vue +167 -0
- package/dist/spa/src/views/EditView.vue +170 -0
- package/dist/spa/src/views/ListView.vue +352 -0
- package/dist/spa/src/views/LoginView.vue +192 -0
- package/dist/spa/src/views/ResourceParent.vue +17 -0
- package/dist/spa/src/views/ShowView.vue +194 -0
- package/dist/spa/tailwind.config.js +17 -0
- package/dist/spa/tsconfig.app.json +14 -0
- package/dist/spa/tsconfig.json +11 -0
- package/dist/spa/tsconfig.node.json +19 -0
- package/dist/spa/vite.config.ts +56 -0
- package/package.json +2 -2
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<component
|
|
4
|
+
v-if="!loading"
|
|
5
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.beforeBreadcrumbs || []"
|
|
6
|
+
:is="getCustomComponent(c)"
|
|
7
|
+
:meta="c.meta"
|
|
8
|
+
:record="coreStore.record"
|
|
9
|
+
:resource="coreStore.resource"
|
|
10
|
+
:adminUser="coreStore.adminUser"
|
|
11
|
+
/>
|
|
12
|
+
<BreadcrumbsWithButtons>
|
|
13
|
+
<RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
|
|
14
|
+
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
15
|
+
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary 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 rounded-default"
|
|
16
|
+
>
|
|
17
|
+
<IconPlusOutline class="w-4 h-4 me-2"/>
|
|
18
|
+
Add new
|
|
19
|
+
</RouterLink>
|
|
20
|
+
|
|
21
|
+
<RouterLink v-if="coreStore?.resourceOptions?.allowedActions?.edit" :to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: $route.params.primaryKey } }"
|
|
22
|
+
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-default border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary 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"
|
|
23
|
+
>
|
|
24
|
+
<IconPenSolid class="w-4 h-4" />
|
|
25
|
+
Edit
|
|
26
|
+
</RouterLink>
|
|
27
|
+
|
|
28
|
+
<button v-if="coreStore?.resourceOptions?.allowedActions?.delete" @click="deleteRecord"
|
|
29
|
+
class="flex items-center py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
30
|
+
>
|
|
31
|
+
<IconTrashBinSolid class="w-4 h-4" />
|
|
32
|
+
Delete
|
|
33
|
+
</button>
|
|
34
|
+
|
|
35
|
+
<ThreeDotsMenu
|
|
36
|
+
:threeDotsDropdownItems="coreStore.resourceOptions?.pageInjections?.show?.threeDotsDropdownItems"
|
|
37
|
+
></ThreeDotsMenu>
|
|
38
|
+
</BreadcrumbsWithButtons>
|
|
39
|
+
|
|
40
|
+
<component
|
|
41
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.afterBreadcrumbs || []"
|
|
42
|
+
:is="getCustomComponent(c)"
|
|
43
|
+
:meta="c.meta"
|
|
44
|
+
:record="coreStore.record"
|
|
45
|
+
:resource="coreStore.resource"
|
|
46
|
+
:adminUser="coreStore.adminUser"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<div v-if="loading" role="status" class="max-w-sm animate-pulse">
|
|
50
|
+
<div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
|
|
51
|
+
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
|
|
52
|
+
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
|
|
53
|
+
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[330px] mb-2.5"></div>
|
|
54
|
+
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[300px] mb-2.5"></div>
|
|
55
|
+
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
|
|
56
|
+
<span class="sr-only">Loading...</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div
|
|
59
|
+
v-else-if="coreStore.record"
|
|
60
|
+
class="relative overflow-x-auto rounded-default shadow-resourseFormShadow "
|
|
61
|
+
>
|
|
62
|
+
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 rounded-default">
|
|
63
|
+
<thead class="text-xs text-gray-700 uppercase bg-lightFormHeading dark:bg-gray-700 dark:text-gray-400">
|
|
64
|
+
<tr>
|
|
65
|
+
<th scope="col" class="px-6 py-3">
|
|
66
|
+
Field
|
|
67
|
+
</th>
|
|
68
|
+
<th scope="col" class="px-6 py-3 w-5/6">
|
|
69
|
+
Value
|
|
70
|
+
</th>
|
|
71
|
+
</tr>
|
|
72
|
+
</thead>
|
|
73
|
+
<tbody>
|
|
74
|
+
<tr v-for="column,i in coreStore.resource?.columns.filter(c => c.showIn.includes('show'))" :key="column.name"
|
|
75
|
+
class="bg-lightForm bg-darkForm odd:dark:bg-gray-900 even:dark:bg-gray-800 dark:border-gray-700"
|
|
76
|
+
:class="{ 'border-b': i !== coreStore.resource.columns.filter(c => c.showIn.includes('show')).length - 1 }"
|
|
77
|
+
>
|
|
78
|
+
<component
|
|
79
|
+
v-if="column.components?.showRow"
|
|
80
|
+
:is="getCustomComponent(column.components.showRow)"
|
|
81
|
+
:meta="column.components.showRow.meta"
|
|
82
|
+
:column="column"
|
|
83
|
+
:resource="coreStore.resource"
|
|
84
|
+
:record="coreStore.record"
|
|
85
|
+
/>
|
|
86
|
+
<template v-else>
|
|
87
|
+
<td class="px-6 py-4 whitespace-nowrap "> <!--align-top-->
|
|
88
|
+
{{ column.label }}
|
|
89
|
+
</td>
|
|
90
|
+
<td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap" :data-af-column="column.name">
|
|
91
|
+
<component
|
|
92
|
+
v-if="column?.components?.show"
|
|
93
|
+
:is="getCustomComponent(column?.components?.show)"
|
|
94
|
+
:resource="coreStore.resource"
|
|
95
|
+
:meta="column.components.show.meta"
|
|
96
|
+
:column="column"
|
|
97
|
+
:record="coreStore.record"
|
|
98
|
+
/>
|
|
99
|
+
<ValueRenderer v-else
|
|
100
|
+
:column="column"
|
|
101
|
+
:record="coreStore.record"
|
|
102
|
+
/>
|
|
103
|
+
</td>
|
|
104
|
+
</template>
|
|
105
|
+
</tr>
|
|
106
|
+
</tbody>
|
|
107
|
+
</table>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div v-else class="text-center text-gray-500 dark:text-gray-400 mt-10">
|
|
111
|
+
Ooops. Record not found
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<component
|
|
115
|
+
v-if="!loading"
|
|
116
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.bottom || []"
|
|
117
|
+
:is="getCustomComponent(c)"
|
|
118
|
+
:meta="c.meta"
|
|
119
|
+
:column="column"
|
|
120
|
+
:record="coreStore.record"
|
|
121
|
+
:resource="coreStore.resource"
|
|
122
|
+
:adminUser="coreStore.adminUser"
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<script setup>
|
|
131
|
+
|
|
132
|
+
import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
|
|
133
|
+
|
|
134
|
+
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
135
|
+
import { useCoreStore } from '@/stores/core';
|
|
136
|
+
import { getCustomComponent, checkAcessByAllowedActions, initThreeDotsDropdown } from '@/utils';
|
|
137
|
+
import { IconPenSolid, IconTrashBinSolid, IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
|
|
138
|
+
import { onMounted, ref } from 'vue';
|
|
139
|
+
import { useRoute,useRouter } from 'vue-router';
|
|
140
|
+
import {callAdminForthApi} from '@/utils';
|
|
141
|
+
import { showSuccesTost, showErrorTost } from '@/composables/useFrontendApi';
|
|
142
|
+
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
const route = useRoute();
|
|
146
|
+
const router = useRouter();
|
|
147
|
+
const loading = ref(true);
|
|
148
|
+
|
|
149
|
+
const coreStore = useCoreStore();
|
|
150
|
+
|
|
151
|
+
onMounted(async () => {
|
|
152
|
+
loading.value = true;
|
|
153
|
+
await coreStore.fetchResourceFull({
|
|
154
|
+
resourceId: route.params.resourceId
|
|
155
|
+
});
|
|
156
|
+
initThreeDotsDropdown();
|
|
157
|
+
await coreStore.fetchRecord({
|
|
158
|
+
resourceId: route.params.resourceId,
|
|
159
|
+
primaryKey: route.params.primaryKey,
|
|
160
|
+
});
|
|
161
|
+
checkAcessByAllowedActions(coreStore.resourceOptions.allowedActions,'show');
|
|
162
|
+
loading.value = false;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
async function deleteRecord(row) {
|
|
166
|
+
const data = await window.adminforth.confirm({
|
|
167
|
+
message: 'Are you sure you want to delete this item?',
|
|
168
|
+
yes: 'Delete',
|
|
169
|
+
no: 'Cancel',
|
|
170
|
+
});
|
|
171
|
+
if (data) {
|
|
172
|
+
try {
|
|
173
|
+
const res = await callAdminForthApi({
|
|
174
|
+
path: '/delete_record',
|
|
175
|
+
method: 'POST',
|
|
176
|
+
body: {
|
|
177
|
+
resourceId: route.params.resourceId,
|
|
178
|
+
primaryKey: route.params.primaryKey,
|
|
179
|
+
}});
|
|
180
|
+
if (!res.error){
|
|
181
|
+
router.push({ name: 'resource-list', params: { resourceId: route.params.resourceId } });
|
|
182
|
+
showSuccesTost('Record deleted successfully')
|
|
183
|
+
} else {
|
|
184
|
+
showErrorTost(res.error)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
} catch (e) {
|
|
188
|
+
console.error(e);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
content: ["./src/**/*.{vue, js, ts, tsx}","./src/*.{vue, js, ts, tsx}", "./index.html", "./node_modules/flowbite/**/*.js"],
|
|
4
|
+
theme: {
|
|
5
|
+
extend: {
|
|
6
|
+
/* IMPORTANT:ADMINFORTH TAILWIND STYLES */
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
darkMode: 'class',
|
|
11
|
+
plugins: [
|
|
12
|
+
require('flowbite/plugin')({
|
|
13
|
+
charts: true,
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
|
4
|
+
"exclude": ["src/**/__tests__/*"],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"composite": true,
|
|
7
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
8
|
+
|
|
9
|
+
"baseUrl": ".",
|
|
10
|
+
"paths": {
|
|
11
|
+
"@/*": ["./src/*"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/node20/tsconfig.json",
|
|
3
|
+
"include": [
|
|
4
|
+
"vite.config.*",
|
|
5
|
+
"vitest.config.*",
|
|
6
|
+
"cypress.config.*",
|
|
7
|
+
"nightwatch.conf.*",
|
|
8
|
+
"playwright.config.*"
|
|
9
|
+
],
|
|
10
|
+
"compilerOptions": {
|
|
11
|
+
"composite": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
14
|
+
|
|
15
|
+
"module": "ESNext",
|
|
16
|
+
"moduleResolution": "Bundler",
|
|
17
|
+
"types": ["node"]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import { clear, error } from 'node:console';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const customLogger = {
|
|
9
|
+
info(msg: string) {
|
|
10
|
+
// Filter out the lines containing '➜ Local:' or '➜ Network:'
|
|
11
|
+
if (!msg.includes('➜')) {
|
|
12
|
+
console.log(msg);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
warnOnce(msg: string) {
|
|
16
|
+
console.warn('warn once', msg);
|
|
17
|
+
if (!this.hasWarned) {
|
|
18
|
+
this.hasWarned = true;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
warn(msg: string) {
|
|
22
|
+
console.warn(msg);
|
|
23
|
+
},
|
|
24
|
+
error(msg: string) {
|
|
25
|
+
console.error(msg);
|
|
26
|
+
},
|
|
27
|
+
clear() {
|
|
28
|
+
console.clear();
|
|
29
|
+
},
|
|
30
|
+
clearScreen() {
|
|
31
|
+
console.clear();
|
|
32
|
+
},
|
|
33
|
+
hasWarned: false,
|
|
34
|
+
hasErrorLogged: (error: any): boolean => {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// https://vitejs.dev/config/
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
base: process.env.VITE_ADMINFORTH_PUBLIC_PATH || '/',
|
|
42
|
+
server: {
|
|
43
|
+
port: 5173,
|
|
44
|
+
strictPort: true, // better predictability
|
|
45
|
+
},
|
|
46
|
+
customLogger,
|
|
47
|
+
plugins: [
|
|
48
|
+
vue(),
|
|
49
|
+
],
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: {
|
|
52
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
53
|
+
'@@': fileURLToPath(new URL('./src/custom', import.meta.url)),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminforth",
|
|
3
|
-
"version": "1.3.55
|
|
3
|
+
"version": "1.3.55",
|
|
4
4
|
"description": "OpenSource Vue3 powered forth-generation admin panel",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
-
"build": "tsc",
|
|
12
|
+
"build": "npm run prepareDist && tsc",
|
|
13
13
|
"--comment": "to suppply the spa without symlinks which allows to not include source code in the package",
|
|
14
14
|
"prepareDist": "cp -rL spa dist/",
|
|
15
15
|
"put-git-tag": "git tag v$(node -p \"require('./package.json').version\") && git push --tags",
|