adminforth 1.1.32 → 1.1.33

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.
Files changed (98) hide show
  1. package/dist/index.js +9 -0
  2. package/dist/modules/codeInjector.js +19 -7
  3. package/dist/modules/styles.js +2 -2
  4. package/dist/spa/index.html +2 -2
  5. package/dist/spa/package-lock.json +17 -4
  6. package/dist/spa/package.json +2 -1
  7. package/dist/spa/src/App.vue +125 -45
  8. package/dist/spa/src/assets/logo.svg +19 -1
  9. package/dist/spa/src/components/AcceptModal.vue +2 -9
  10. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  11. package/dist/spa/src/components/CustomDatePicker.vue +16 -3
  12. package/dist/spa/src/components/CustomDateRangePicker.vue +11 -2
  13. package/dist/spa/src/components/Dropdown.vue +6 -1
  14. package/dist/spa/src/components/Filters.vue +40 -19
  15. package/dist/spa/src/components/ResourceForm.vue +26 -24
  16. package/dist/spa/src/components/ValueRenderer.vue +14 -8
  17. package/dist/spa/src/main.ts +1 -1
  18. package/dist/spa/src/router/index.ts +30 -20
  19. package/dist/spa/src/stores/core.ts +48 -31
  20. package/dist/spa/src/stores/modal.ts +13 -3
  21. package/dist/spa/src/utils.ts +62 -7
  22. package/dist/spa/src/views/CreateView.vue +67 -15
  23. package/dist/spa/src/views/EditView.vue +45 -11
  24. package/dist/spa/src/views/ListView.vue +82 -366
  25. package/dist/spa/src/views/LoginView.vue +16 -4
  26. package/dist/spa/src/views/ShowView.vue +105 -21
  27. package/dist/spa/tailwind.config.js +1 -1
  28. package/dist/spa/vite.config.ts +6 -0
  29. package/index.ts +11 -0
  30. package/modules/codeInjector.ts +19 -1
  31. package/modules/styles.ts +2 -2
  32. package/package.json +1 -1
  33. package/spa/index.html +1 -1
  34. package/spa/src/App.vue +2 -3
  35. package/types/AdminForthConfig.ts +15 -0
  36. package/dist/plugins/AccessControl/index.js +0 -66
  37. package/dist/plugins/AccessControl/types.js +0 -1
  38. package/dist/spa/public/favicon.ico +0 -0
  39. package/dist/spa/spa/.eslintrc.cjs +0 -14
  40. package/dist/spa/spa/.vscode/extensions.json +0 -6
  41. package/dist/spa/spa/README.md +0 -39
  42. package/dist/spa/spa/env.d.ts +0 -1
  43. package/dist/spa/spa/index.html +0 -23
  44. package/dist/spa/spa/package-lock.json +0 -4359
  45. package/dist/spa/spa/package.json +0 -47
  46. package/dist/spa/spa/postcss.config.js +0 -6
  47. package/dist/spa/spa/public/favicon.ico +0 -0
  48. package/dist/spa/spa/src/App.vue +0 -272
  49. package/dist/spa/spa/src/assets/base.css +0 -0
  50. package/dist/spa/spa/src/assets/logo.svg +0 -19
  51. package/dist/spa/spa/src/components/AcceptModal.vue +0 -45
  52. package/dist/spa/spa/src/components/Breadcrumbs.vue +0 -40
  53. package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  54. package/dist/spa/spa/src/components/CustomDatePicker.vue +0 -174
  55. package/dist/spa/spa/src/components/CustomDateRangePicker.vue +0 -218
  56. package/dist/spa/spa/src/components/CustomRangePicker.vue +0 -148
  57. package/dist/spa/spa/src/components/Dropdown.vue +0 -168
  58. package/dist/spa/spa/src/components/Filters.vue +0 -211
  59. package/dist/spa/spa/src/components/HelloWorld.vue +0 -17
  60. package/dist/spa/spa/src/components/MenuLink.vue +0 -24
  61. package/dist/spa/spa/src/components/ResourceForm.vue +0 -265
  62. package/dist/spa/spa/src/components/SingleSkeletLoader.vue +0 -13
  63. package/dist/spa/spa/src/components/ValueRenderer.vue +0 -60
  64. package/dist/spa/spa/src/components/icons/IconCalendar.vue +0 -5
  65. package/dist/spa/spa/src/components/icons/IconCommunity.vue +0 -7
  66. package/dist/spa/spa/src/components/icons/IconDocumentation.vue +0 -7
  67. package/dist/spa/spa/src/components/icons/IconEcosystem.vue +0 -7
  68. package/dist/spa/spa/src/components/icons/IconSupport.vue +0 -7
  69. package/dist/spa/spa/src/components/icons/IconTime.vue +0 -5
  70. package/dist/spa/spa/src/components/icons/IconTooling.vue +0 -19
  71. package/dist/spa/spa/src/index.scss +0 -26
  72. package/dist/spa/spa/src/main.ts +0 -18
  73. package/dist/spa/spa/src/router/index.ts +0 -64
  74. package/dist/spa/spa/src/stores/core.ts +0 -144
  75. package/dist/spa/spa/src/stores/modal.ts +0 -48
  76. package/dist/spa/spa/src/utils.ts +0 -101
  77. package/dist/spa/spa/src/views/CreateView.vue +0 -163
  78. package/dist/spa/spa/src/views/EditView.vue +0 -165
  79. package/dist/spa/spa/src/views/ListView.vue +0 -257
  80. package/dist/spa/spa/src/views/LoginView.vue +0 -134
  81. package/dist/spa/spa/src/views/ResourceParent.vue +0 -18
  82. package/dist/spa/spa/src/views/ShowView.vue +0 -188
  83. package/dist/spa/spa/tailwind.config.js +0 -15
  84. package/dist/spa/spa/tsconfig.app.json +0 -14
  85. package/dist/spa/spa/tsconfig.json +0 -11
  86. package/dist/spa/spa/tsconfig.node.json +0 -19
  87. package/dist/spa/spa/vite.config.ts +0 -49
  88. package/dist/types.js +0 -30
  89. /package/dist/spa/{spa/public → public/assets}/favicon.png +0 -0
  90. /package/dist/spa/{spa/src → src}/components/ResourceListTable.vue +0 -0
  91. /package/dist/spa/{spa/src → src}/components/Toast.vue +0 -0
  92. /package/dist/spa/{spa/src → src}/composables/useFrontendApi.ts +0 -0
  93. /package/dist/spa/{spa/src → src}/composables/useStores.ts +0 -0
  94. /package/dist/spa/{spa/src → src}/spa_types/core.ts +0 -0
  95. /package/dist/spa/{spa/src → src}/stores/filters.ts +0 -0
  96. /package/dist/spa/{spa/src → src}/stores/toast.ts +0 -0
  97. /package/dist/spa/{spa/src → src}/stores/user.ts +0 -0
  98. /package/spa/public/{favicon.png → assets/favicon.png} +0 -0
@@ -1,188 +0,0 @@
1
- <template>
2
- <div class="relative">
3
- <component
4
- v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.beforeBreadcrumbs || []"
5
- :is="getCustomComponent(c)"
6
- :meta="c.meta"
7
- :record="coreStore.record"
8
- :resource="coreStore.resource"
9
- :adminUser="coreStore.adminUser"
10
- />
11
- <BreadcrumbsWithButtons>
12
- <RouterLink v-if="coreStore?.resourceOptions?.allowedActions?.edit" :to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: $route.params.primaryKey } }"
13
- 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-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"
14
- >
15
- <IconPenSolid class="w-4 h-4" />
16
- Edit
17
- </RouterLink>
18
-
19
- <button v-if="coreStore?.resourceOptions?.allowedActions?.delete" @click="deleteRecord"
20
- 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"
21
- >
22
- <IconTrashBinSolid class="w-4 h-4" />
23
- Delete
24
- </button>
25
- </BreadcrumbsWithButtons>
26
-
27
- <component
28
- v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.afterBreadcrumbs || []"
29
- :is="getCustomComponent(c)"
30
- :meta="c.meta"
31
- :record="coreStore.record"
32
- :resource="coreStore.resource"
33
- :adminUser="coreStore.adminUser"
34
- />
35
-
36
- <div v-if="loading" role="status" class="max-w-sm animate-pulse">
37
- <div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
38
- <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
39
- <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
40
- <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[330px] mb-2.5"></div>
41
- <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[300px] mb-2.5"></div>
42
- <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
43
- <span class="sr-only">Loading...</span>
44
- </div>
45
- <div
46
- v-else
47
- class="relative overflow-x-auto shadow-resourse-form-shadow "
48
- >
49
- <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 rounded-default">
50
- <thead class="text-xs text-gray-700 uppercase bg-form-view-heading dark:bg-gray-700 dark:text-gray-400">
51
- <tr>
52
- <th scope="col" class="px-6 py-3">
53
- Field
54
- </th>
55
- <th scope="col" class="px-6 py-3 w-4/6">
56
- Value
57
- </th>
58
- </tr>
59
- </thead>
60
- <tbody>
61
- <tr v-for="column in coreStore.resource?.columns.filter(c => c.showIn.includes('show'))" :key="column.name"
62
- class="bg-form-view-bg odd:dark:bg-gray-900 even:dark:bg-gray-800 border-b dark:border-gray-700"
63
- >
64
- <component
65
- v-if="column.components?.showRow"
66
- :is="getCustomComponent(column.components.showRow)"
67
- :meta="column.components.showRow.meta"
68
- :column="column"
69
- :resource="coreStore.resource"
70
- :record="coreStore.record"
71
- />
72
- <template v-else>
73
- <td class="px-6 py-4 whitespace-nowrap "> <!--align-top-->
74
- {{ column.label }}
75
- </td>
76
- <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap">
77
- <component
78
- v-if="showComponentsPerColumn[column.name]"
79
- :is="showComponentsPerColumn[column.name]"
80
- :resource="coreStore.resource"
81
- :meta="column.components.show.meta"
82
- :column="column"
83
- :record="coreStore.record"
84
- />
85
- <ValueRenderer v-else
86
- :column="column"
87
- :record="coreStore.record"
88
- />
89
- </td>
90
- </template>
91
- </tr>
92
- </tbody>
93
- </table>
94
-
95
- <component
96
- v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.bottom || []"
97
- :is="getCustomComponent(c)"
98
- :meta="c.meta"
99
- :column="column"
100
- :record="coreStore.record"
101
- :resource="coreStore.resource"
102
- :adminUser="coreStore.adminUser"
103
- />
104
- </div>
105
-
106
-
107
- </div>
108
- </template>
109
-
110
-
111
- <script setup>
112
-
113
- import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
114
-
115
- import ValueRenderer from '@/components/ValueRenderer.vue';
116
- import { useCoreStore } from '@/stores/core';
117
- import { useModalStore } from '@/stores/modal';
118
- import { getCustomComponent, checkAcessByAllowedActions } from '@/utils';
119
- import { IconPenSolid, IconTrashBinSolid } from '@iconify-prerendered/vue-flowbite';
120
- import { onMounted, ref } from 'vue';
121
- import { useRoute,useRouter } from 'vue-router';
122
- import {callAdminForthApi} from '@/utils';
123
- import {showSuccesTost} from '@/composables/useFrontendApi';
124
-
125
-
126
- const item = ref(null);
127
- const route = useRoute();
128
- const router = useRouter();
129
- const loading = ref(false);
130
- let showComponentsPerColumn = {};
131
-
132
- console.log(route.params,'showWiev');
133
-
134
-
135
- const coreStore = useCoreStore();
136
- const modalStore = useModalStore();
137
-
138
- onMounted(async () => {
139
- loading.value = true;
140
- await coreStore.fetchResourceFull({
141
- resourceId: route.params.resourceId
142
- });
143
- await coreStore.fetchRecord({
144
- resourceId: route.params.resourceId,
145
- primaryKey: route.params.primaryKey,
146
- });
147
- checkAcessByAllowedActions(coreStore.resourceOptions.allowedActions,'show');
148
-
149
- showComponentsPerColumn = coreStore.resource.columns.reduce((acc, column) => {
150
- if (column.components?.show) {
151
- acc[column.name] = getCustomComponent(column.components.show);
152
- }
153
- return acc;
154
- }, {});
155
- loading.value = false;
156
- });
157
-
158
- async function deleteRecord(row) {
159
- const data = await window.adminforth.confirm({
160
- message: 'Are you sure you want to delete this item?',
161
- yes: 'Delete',
162
- no: 'Cancel',
163
- });
164
- if (data) {
165
- try {
166
- const res = await callAdminForthApi({
167
- path: '/delete_record',
168
- method: 'POST',
169
- body: {
170
- resourceId: route.params.resourceId,
171
- primaryKey: route.params.primaryKey,
172
- }});
173
- if (!res.error){
174
- router.push({ name: 'resource-list', params: { resourceId: route.params.resourceId } });
175
- showSuccesTost('Record deleted successfully')
176
- } else {
177
- console.error(res.error)
178
- }
179
-
180
- } catch (e) {
181
- console.error(e);
182
- };
183
- }
184
-
185
-
186
- }
187
-
188
- </script>
@@ -1,15 +0,0 @@
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
- ],
14
- }
15
-
@@ -1,14 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- {
5
- "path": "./tsconfig.node.json"
6
- },
7
- {
8
- "path": "./tsconfig.app.json"
9
- }
10
- ]
11
- }
@@ -1,19 +0,0 @@
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
- }
@@ -1,49 +0,0 @@
1
- import { fileURLToPath, URL } from 'node:url'
2
-
3
- import { defineConfig } from 'vite'
4
- import vue from '@vitejs/plugin-vue'
5
-
6
-
7
- const customLogger = {
8
- info(msg: string) {
9
- // Filter out the lines containing '➜ Local:' or '➜ Network:'
10
- if (!msg.includes('➜')) {
11
- console.log(msg);
12
- }
13
- },
14
- warnOnce(msg: string) {
15
- console.warn('warn once', msg);
16
- if (!this.hasWarned) {
17
- this.hasWarned = true;
18
- }
19
- },
20
- warn(msg: string) {
21
- console.warn(msg);
22
- },
23
- error(msg: string) {
24
- console.error(msg);
25
- },
26
- clear() {
27
- console.clear();
28
- },
29
- hasWarned: false,
30
- };
31
-
32
- // https://vitejs.dev/config/
33
- export default defineConfig({
34
- base: process.env.VITE_ADMINFORTH_PUBLIC_PATH || '/',
35
- server: {
36
- port: 5173,
37
- strictPort: true, // better predictability
38
- },
39
- customLogger,
40
- plugins: [
41
- vue(),
42
- ],
43
- resolve: {
44
- alias: {
45
- '@': fileURLToPath(new URL('./src', import.meta.url)),
46
- '@@': fileURLToPath(new URL('./src/custom', import.meta.url)),
47
- }
48
- }
49
- })
package/dist/types.js DELETED
@@ -1,30 +0,0 @@
1
- // typical types which AdminForth supports
2
- //
3
- export const AdminForthTypes = {
4
- STRING: 'string',
5
- INTEGER: 'integer',
6
- FLOAT: 'float',
7
- DECIMAL: 'decimal',
8
- BOOLEAN: 'boolean',
9
- DATE: 'date',
10
- DATETIME: 'datetime',
11
- TIME: 'time',
12
- TEXT: 'text',
13
- JSON: 'json',
14
- };
15
- export const AdminForthFilterOperators = {
16
- EQ: 'eq',
17
- NE: 'ne',
18
- GT: 'gt',
19
- LT: 'lt',
20
- GTE: 'gte',
21
- LTE: 'lte',
22
- LIKE: 'like',
23
- ILIKE: 'ilike',
24
- IN: 'in',
25
- NIN: 'nin',
26
- };
27
- export const AdminForthSortDirections = {
28
- ASC: 'asc',
29
- DESC: 'desc',
30
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes