adminforth 1.2.96 → 1.2.97

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 (115) hide show
  1. package/dataConnectors/baseConnector.ts +26 -14
  2. package/dataConnectors/clickhouse.ts +57 -37
  3. package/dataConnectors/mongo.ts +45 -14
  4. package/dataConnectors/postgres.ts +53 -36
  5. package/dataConnectors/sqlite.ts +37 -35
  6. package/dist/dataConnectors/baseConnector.js +16 -7
  7. package/dist/dataConnectors/clickhouse.js +58 -48
  8. package/dist/dataConnectors/mongo.js +29 -12
  9. package/dist/dataConnectors/postgres.js +62 -52
  10. package/dist/dataConnectors/sqlite.js +52 -45
  11. package/dist/index.js +5 -1
  12. package/dist/modules/operationalResource.js +88 -0
  13. package/dist/modules/restApi.js +22 -23
  14. package/dist/spa/index.html +4 -4
  15. package/dist/spa/package-lock.json +421 -6
  16. package/dist/spa/package.json +10 -2
  17. package/dist/spa/src/App.vue +236 -94
  18. package/dist/spa/src/assets/base.css +2 -0
  19. package/dist/spa/src/assets/logo.svg +19 -1
  20. package/dist/spa/src/components/AcceptModal.vue +3 -10
  21. package/dist/spa/src/components/Breadcrumbs.vue +3 -2
  22. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  23. package/dist/spa/src/components/CustomDatePicker.vue +25 -10
  24. package/dist/spa/src/components/CustomDateRangePicker.vue +14 -5
  25. package/dist/spa/src/components/Dropdown.vue +19 -5
  26. package/dist/spa/src/components/Filters.vue +103 -38
  27. package/dist/spa/src/components/MenuLink.vue +3 -3
  28. package/dist/spa/src/components/ResourceForm.vue +205 -116
  29. package/dist/spa/{spa/src → src}/components/ResourceListTable.vue +6 -3
  30. package/dist/spa/{spa/src → src}/components/Toast.vue +9 -3
  31. package/dist/spa/src/components/ValueRenderer.vue +30 -8
  32. package/dist/spa/src/index.scss +2 -1
  33. package/dist/spa/src/main.ts +2 -2
  34. package/dist/spa/src/router/index.ts +29 -19
  35. package/dist/spa/src/stores/core.ts +65 -59
  36. package/dist/spa/src/stores/modal.ts +13 -3
  37. package/dist/spa/src/types/AdminForthConfig.ts +1477 -0
  38. package/dist/spa/src/types/FrontendAPI.ts +121 -0
  39. package/dist/spa/src/utils.ts +69 -10
  40. package/dist/spa/src/views/CreateView.vue +69 -16
  41. package/dist/spa/src/views/EditView.vue +68 -14
  42. package/dist/spa/src/views/ListView.vue +100 -371
  43. package/dist/spa/src/views/LoginView.vue +67 -29
  44. package/dist/spa/src/views/ResourceParent.vue +1 -2
  45. package/dist/spa/src/views/ShowView.vue +116 -25
  46. package/dist/spa/tailwind.config.js +8 -3
  47. package/dist/spa/vite.config.ts +13 -0
  48. package/dist/types/AdminForthConfig.js +37 -0
  49. package/index.ts +12 -3
  50. package/modules/operationalResource.ts +97 -0
  51. package/modules/restApi.ts +27 -26
  52. package/package.json +1 -1
  53. package/types/AdminForthConfig.ts +91 -8
  54. package/dist/spa/.vscode/extensions.json +0 -6
  55. package/dist/spa/public/favicon.ico +0 -0
  56. package/dist/spa/spa/.eslintrc.cjs +0 -14
  57. package/dist/spa/spa/.vscode/extensions.json +0 -6
  58. package/dist/spa/spa/README.md +0 -39
  59. package/dist/spa/spa/env.d.ts +0 -1
  60. package/dist/spa/spa/index.html +0 -23
  61. package/dist/spa/spa/package-lock.json +0 -4573
  62. package/dist/spa/spa/package.json +0 -49
  63. package/dist/spa/spa/postcss.config.js +0 -6
  64. package/dist/spa/spa/public/favicon.ico +0 -0
  65. package/dist/spa/spa/src/App.vue +0 -314
  66. package/dist/spa/spa/src/assets/base.css +0 -0
  67. package/dist/spa/spa/src/assets/logo.svg +0 -19
  68. package/dist/spa/spa/src/components/AcceptModal.vue +0 -45
  69. package/dist/spa/spa/src/components/Breadcrumbs.vue +0 -40
  70. package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  71. package/dist/spa/spa/src/components/CustomDatePicker.vue +0 -174
  72. package/dist/spa/spa/src/components/CustomDateRangePicker.vue +0 -218
  73. package/dist/spa/spa/src/components/Dropdown.vue +0 -168
  74. package/dist/spa/spa/src/components/Filters.vue +0 -222
  75. package/dist/spa/spa/src/components/HelloWorld.vue +0 -17
  76. package/dist/spa/spa/src/components/MenuLink.vue +0 -24
  77. package/dist/spa/spa/src/components/ResourceForm.vue +0 -289
  78. package/dist/spa/spa/src/components/SingleSkeletLoader.vue +0 -13
  79. package/dist/spa/spa/src/components/ValueRenderer.vue +0 -66
  80. package/dist/spa/spa/src/components/icons/IconCalendar.vue +0 -5
  81. package/dist/spa/spa/src/components/icons/IconCommunity.vue +0 -7
  82. package/dist/spa/spa/src/components/icons/IconDocumentation.vue +0 -7
  83. package/dist/spa/spa/src/components/icons/IconEcosystem.vue +0 -7
  84. package/dist/spa/spa/src/components/icons/IconSupport.vue +0 -7
  85. package/dist/spa/spa/src/components/icons/IconTime.vue +0 -5
  86. package/dist/spa/spa/src/components/icons/IconTooling.vue +0 -19
  87. package/dist/spa/spa/src/index.scss +0 -27
  88. package/dist/spa/spa/src/main.ts +0 -18
  89. package/dist/spa/spa/src/router/index.ts +0 -63
  90. package/dist/spa/spa/src/stores/core.ts +0 -144
  91. package/dist/spa/spa/src/stores/modal.ts +0 -48
  92. package/dist/spa/spa/src/utils.ts +0 -103
  93. package/dist/spa/spa/src/views/CreateView.vue +0 -156
  94. package/dist/spa/spa/src/views/EditView.vue +0 -157
  95. package/dist/spa/spa/src/views/HomeView.vue +0 -8
  96. package/dist/spa/spa/src/views/ListView.vue +0 -258
  97. package/dist/spa/spa/src/views/LoginView.vue +0 -143
  98. package/dist/spa/spa/src/views/ResourceParent.vue +0 -17
  99. package/dist/spa/spa/src/views/ShowView.vue +0 -184
  100. package/dist/spa/spa/tailwind.config.js +0 -17
  101. package/dist/spa/spa/tsconfig.app.json +0 -14
  102. package/dist/spa/spa/tsconfig.json +0 -11
  103. package/dist/spa/spa/tsconfig.node.json +0 -19
  104. package/dist/spa/spa/vite.config.ts +0 -56
  105. package/dist/spa/src/views/HomeView.vue +0 -8
  106. package/dist/types.js +0 -30
  107. /package/dist/spa/{spa/public → public}/assets/favicon.png +0 -0
  108. /package/dist/spa/{spa/src → src}/components/CustomRangePicker.vue +0 -0
  109. /package/dist/spa/{spa/src → src}/components/SkeleteLoader.vue +0 -0
  110. /package/dist/spa/{spa/src → src}/composables/useFrontendApi.ts +0 -0
  111. /package/dist/spa/{spa/src → src}/composables/useStores.ts +0 -0
  112. /package/dist/spa/{spa/src → src}/spa_types/core.ts +0 -0
  113. /package/dist/spa/{spa/src → src}/stores/filters.ts +0 -0
  114. /package/dist/spa/{spa/src → src}/stores/toast.ts +0 -0
  115. /package/dist/spa/{spa/src → src}/stores/user.ts +0 -0
@@ -1,184 +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-if="coreStore.record"
47
- class="relative overflow-x-auto shadow-resourseFormShadow "
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-lightFormHeading 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-lightForm bg-darkForm 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="column?.components?.show"
79
- :is="getCustomComponent(column?.components?.show)"
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
- </div>
95
-
96
- <div v-else class="text-center text-gray-500 dark:text-gray-400 mt-10">
97
- Ooops. Record not found
98
- </div>
99
-
100
- <component
101
- v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.bottom || []"
102
- :is="getCustomComponent(c)"
103
- :meta="c.meta"
104
- :column="column"
105
- :record="coreStore.record"
106
- :resource="coreStore.resource"
107
- :adminUser="coreStore.adminUser"
108
- />
109
-
110
-
111
- </div>
112
- </template>
113
-
114
-
115
- <script setup>
116
-
117
- import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
118
-
119
- import ValueRenderer from '@/components/ValueRenderer.vue';
120
- import { useCoreStore } from '@/stores/core';
121
- import { useModalStore } from '@/stores/modal';
122
- import { getCustomComponent, checkAcessByAllowedActions } from '@/utils';
123
- import { IconPenSolid, IconTrashBinSolid } from '@iconify-prerendered/vue-flowbite';
124
- import { onMounted, ref } from 'vue';
125
- import { useRoute,useRouter } from 'vue-router';
126
- import {callAdminForthApi} from '@/utils';
127
- import {showSuccesTost} from '@/composables/useFrontendApi';
128
-
129
-
130
- const item = ref(null);
131
- const route = useRoute();
132
- const router = useRouter();
133
- const loading = ref(true);
134
-
135
- console.log(route.params,'showWiev');
136
-
137
-
138
- const coreStore = useCoreStore();
139
- const modalStore = useModalStore();
140
-
141
- onMounted(async () => {
142
- loading.value = true;
143
- await coreStore.fetchResourceFull({
144
- resourceId: route.params.resourceId
145
- });
146
- await coreStore.fetchRecord({
147
- resourceId: route.params.resourceId,
148
- primaryKey: route.params.primaryKey,
149
- });
150
- checkAcessByAllowedActions(coreStore.resourceOptions.allowedActions,'show');
151
- loading.value = false;
152
- });
153
-
154
- async function deleteRecord(row) {
155
- const data = await window.adminforth.confirm({
156
- message: 'Are you sure you want to delete this item?',
157
- yes: 'Delete',
158
- no: 'Cancel',
159
- });
160
- if (data) {
161
- try {
162
- const res = await callAdminForthApi({
163
- path: '/delete_record',
164
- method: 'POST',
165
- body: {
166
- resourceId: route.params.resourceId,
167
- primaryKey: route.params.primaryKey,
168
- }});
169
- if (!res.error){
170
- router.push({ name: 'resource-list', params: { resourceId: route.params.resourceId } });
171
- showSuccesTost('Record deleted successfully')
172
- } else {
173
- console.error(res.error)
174
- }
175
-
176
- } catch (e) {
177
- console.error(e);
178
- };
179
- }
180
-
181
-
182
- }
183
-
184
- </script>
@@ -1,17 +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
- charts: true,
14
- }),
15
- ],
16
- }
17
-
@@ -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,56 +0,0 @@
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
- })
@@ -1,8 +0,0 @@
1
- <script setup lang="ts">
2
- </script>
3
-
4
- <template>
5
- <main>
6
- 123
7
- </main>
8
- </template>
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