adminforth 1.1.47 → 1.1.48

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 (65) hide show
  1. package/dist/modules/codeInjector.js +13 -22
  2. package/dist/modules/styleGenerator.js +39 -0
  3. package/dist/modules/styles.js +84 -53
  4. package/dist/modules/utils.js +44 -0
  5. package/dist/plugins/AccessControl/index.js +66 -0
  6. package/dist/plugins/AccessControl/types.js +1 -0
  7. package/dist/spa/index.html +2 -2
  8. package/dist/spa/package-lock.json +4 -17
  9. package/dist/spa/package.json +1 -2
  10. package/dist/spa/public/favicon.ico +0 -0
  11. package/dist/spa/spa/index.html +1 -1
  12. package/dist/spa/spa/public/favicon.ico +0 -0
  13. package/dist/spa/spa/src/App.vue +16 -16
  14. package/dist/spa/spa/src/components/MenuLink.vue +3 -3
  15. package/dist/spa/spa/src/components/ResourceForm.vue +3 -3
  16. package/dist/spa/spa/src/components/ResourceListTable.vue +7 -64
  17. package/dist/spa/spa/src/components/SkeleteLoader.vue +23 -0
  18. package/dist/spa/spa/src/views/ListView.vue +1 -1
  19. package/dist/spa/spa/src/views/ShowView.vue +3 -3
  20. package/dist/spa/src/App.vue +45 -125
  21. package/dist/spa/src/assets/logo.svg +1 -19
  22. package/dist/spa/src/components/AcceptModal.vue +9 -2
  23. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  24. package/dist/spa/src/components/CustomDatePicker.vue +3 -16
  25. package/dist/spa/src/components/CustomDateRangePicker.vue +2 -11
  26. package/dist/spa/src/components/Dropdown.vue +1 -6
  27. package/dist/spa/src/components/Filters.vue +19 -40
  28. package/dist/spa/src/components/ResourceForm.vue +24 -26
  29. package/dist/spa/src/components/ValueRenderer.vue +8 -14
  30. package/dist/spa/src/main.ts +1 -1
  31. package/dist/spa/src/router/index.ts +20 -30
  32. package/dist/spa/src/stores/core.ts +31 -48
  33. package/dist/spa/src/stores/modal.ts +3 -13
  34. package/dist/spa/src/utils.ts +7 -62
  35. package/dist/spa/src/views/CreateView.vue +15 -67
  36. package/dist/spa/src/views/EditView.vue +11 -45
  37. package/dist/spa/src/views/ListView.vue +366 -82
  38. package/dist/spa/src/views/LoginView.vue +4 -16
  39. package/dist/spa/src/views/ShowView.vue +21 -105
  40. package/dist/spa/tailwind.config.js +1 -1
  41. package/dist/spa/vite.config.ts +0 -6
  42. package/dist/types.js +30 -0
  43. package/modules/codeInjector.ts +10 -18
  44. package/modules/styleGenerator.ts +45 -0
  45. package/modules/styles.ts +95 -48
  46. package/modules/utils.ts +48 -0
  47. package/package.json +1 -1
  48. package/spa/index.html +1 -1
  49. package/spa/src/App.vue +16 -16
  50. package/spa/src/components/MenuLink.vue +3 -3
  51. package/spa/src/components/ResourceForm.vue +3 -3
  52. package/spa/src/components/ResourceListTable.vue +7 -64
  53. package/spa/src/components/SkeleteLoader.vue +23 -0
  54. package/spa/src/views/ListView.vue +1 -1
  55. package/spa/src/views/ShowView.vue +3 -3
  56. package/types/AdminForthConfig.ts +6 -4
  57. package/dist/spa/src/components/ResourceListTable.vue +0 -419
  58. package/dist/spa/src/components/Toast.vue +0 -66
  59. package/dist/spa/src/composables/useFrontendApi.ts +0 -26
  60. package/dist/spa/src/composables/useStores.ts +0 -113
  61. package/dist/spa/src/spa_types/core.ts +0 -51
  62. package/dist/spa/src/stores/filters.ts +0 -22
  63. package/dist/spa/src/stores/toast.ts +0 -15
  64. package/dist/spa/src/stores/user.ts +0 -54
  65. /package/dist/spa/{public/assets → spa/public}/favicon.png +0 -0
@@ -1,38 +1,21 @@
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
- :meta="c.meta"
7
- :record="coreStore.record"
8
- :resource="coreStore.resource"
9
- :adminUser="coreStore.adminUser"
10
- />
11
3
  <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"
4
+ <RouterLink :to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: $route.params.primaryKey } }"
5
+ 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"
14
6
  >
15
7
  <IconPenSolid class="w-4 h-4" />
16
8
  Edit
17
9
  </RouterLink>
18
10
 
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"
11
+ <button @click="deleteRecord"
12
+ class="flex items-center py-1 px-3 mb-2 text-sm font-medium text-red-600 focus:outline-none bg-white rounded 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
13
  >
22
14
  <IconTrashBinSolid class="w-4 h-4" />
23
15
  Delete
24
16
  </button>
25
17
  </BreadcrumbsWithButtons>
26
18
 
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
19
  <div v-if="loading" role="status" class="max-w-sm animate-pulse">
37
20
  <div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
38
21
  <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
@@ -46,7 +29,7 @@
46
29
  v-else
47
30
  class="relative overflow-x-auto shadow-resourse-form-shadow "
48
31
  >
49
- <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 rounded-default">
32
+ <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
50
33
  <thead class="text-xs text-gray-700 uppercase bg-form-view-heading dark:bg-gray-700 dark:text-gray-400">
51
34
  <tr>
52
35
  <th scope="col" class="px-6 py-3">
@@ -58,49 +41,23 @@
58
41
  </tr>
59
42
  </thead>
60
43
  <tbody>
61
- <tr v-for="column in coreStore.resource?.columns.filter(c => c.showIn.includes('show'))" :key="column.name"
44
+ <tr v-for="column in coreStore.resourceColumns?.filter(c => c.showIn.includes('show'))" :key="column.name"
62
45
  class="bg-form-view-bg odd:dark:bg-gray-900 even:dark:bg-gray-800 border-b dark:border-gray-700"
63
46
  >
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 }}
47
+ <td class="px-6 py-4 whitespace-nowrap">
48
+ {{ column.label }}
75
49
  </td>
76
50
  <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
- />
51
+ <component
52
+ :is="showComponentsPerColumn[column.name] || ValueRenderer"
53
+ :column="column"
54
+ :row="coreStore.record"
55
+ />
89
56
  </td>
90
- </template>
91
57
  </tr>
58
+
92
59
  </tbody>
93
60
  </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
61
  </div>
105
62
 
106
63
 
@@ -111,78 +68,37 @@
111
68
  <script setup>
112
69
 
113
70
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
114
-
115
71
  import ValueRenderer from '@/components/ValueRenderer.vue';
116
72
  import { useCoreStore } from '@/stores/core';
117
- import { useModalStore } from '@/stores/modal';
118
- import { getCustomComponent, checkAcessByAllowedActions } from '@/utils';
73
+ import { getCustomComponent } from '@/utils';
119
74
  import { IconPenSolid, IconTrashBinSolid } from '@iconify-prerendered/vue-flowbite';
120
75
  import { onMounted, ref } from 'vue';
121
- import { useRoute,useRouter } from 'vue-router';
122
- import {callAdminForthApi} from '@/utils';
123
- import {showSuccesTost} from '@/composables/useFrontendApi';
76
+ import { useRoute } from 'vue-router';
124
77
 
125
78
 
126
79
  const item = ref(null);
127
80
  const route = useRoute();
128
- const router = useRouter();
129
81
  const loading = ref(false);
130
82
  let showComponentsPerColumn = {};
131
83
 
132
- console.log(route.params,'showWiev');
133
-
134
-
135
84
  const coreStore = useCoreStore();
136
- const modalStore = useModalStore();
137
85
 
138
86
  onMounted(async () => {
139
87
  loading.value = true;
140
- await coreStore.fetchResourceFull({
88
+ await coreStore.fetchColumns({
141
89
  resourceId: route.params.resourceId
142
90
  });
143
91
  await coreStore.fetchRecord({
144
92
  resourceId: route.params.resourceId,
145
93
  primaryKey: route.params.primaryKey,
146
94
  });
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);
95
+ showComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
96
+ if (column.component?.show) {
97
+ acc[column.name] = getCustomComponent(column.component.show);
152
98
  }
153
99
  return acc;
154
- }, {});
100
+ }, {});
155
101
  loading.value = false;
156
102
  });
157
103
 
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
104
  </script>
@@ -1,6 +1,6 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  export default {
3
- content: ["./src/**/*.{vue, js, ts, tsx}","./src/*.{vue, js, ts, tsx}", "./index.html", "./node_modules/flowbite/**/*.js"],
3
+ content: ["./src/**/*.{vue, js}","./src/*.{vue, js}", "./index.html", "./node_modules/flowbite/**/*.js"],
4
4
  theme: {
5
5
  extend: {
6
6
  /* IMPORTANT:ADMINFORTH TAILWIND STYLES */
@@ -11,12 +11,6 @@ const customLogger = {
11
11
  console.log(msg);
12
12
  }
13
13
  },
14
- warnOnce(msg: string) {
15
- console.warn('warn once', msg);
16
- if (!this.hasWarned) {
17
- this.hasWarned = true;
18
- }
19
- },
20
14
  warn(msg: string) {
21
15
  console.warn(msg);
22
16
  },
package/dist/types.js ADDED
@@ -0,0 +1,30 @@
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
+ };
@@ -7,10 +7,10 @@ import os from 'os';
7
7
  import path from 'path';
8
8
  import { promisify } from 'util';
9
9
  import AdminForth from '../index.js';
10
- import { ADMIN_FORTH_ABSOLUTE_PATH } from './utils.js';
11
- import { getComponentNameFromPath } from './utils.js';
10
+ import { ADMIN_FORTH_ABSOLUTE_PATH, getComponentNameFromPath, transformObject, deepMerge } from './utils.js';
12
11
  import { styles } from './styles.js'
13
12
  import { AdminForthComponentDeclaration, CodeInjectorType } from '../types/AdminForthConfig.js';
13
+ import { StylesGenerator } from './styleGenerator.js';
14
14
 
15
15
 
16
16
 
@@ -290,8 +290,6 @@ class CodeInjector implements CodeInjectorType {
290
290
  });
291
291
  });
292
292
  });
293
-
294
-
295
293
  });
296
294
 
297
295
  customResourceComponents.forEach((filePath) => {
@@ -340,20 +338,14 @@ class CodeInjector implements CodeInjectorType {
340
338
  }
341
339
  await fs.promises.writeFile(appVuePath, appVueContent);
342
340
 
343
- // generate tailwind extend styles
344
- if(this.adminforth.config?.styles){
345
- const tailwindStyles = this.adminforth.config?.styles
346
- const stylesText = JSON.stringify(tailwindStyles, null, 2).slice(1, -1);
347
- let tailwindConfigPath = path.join(CodeInjector.SPA_TMP_PATH, 'tailwind.config.js');
348
- let tailwindConfigContent = await fs.promises.readFile(tailwindConfigPath, 'utf-8');
349
- tailwindConfigContent = tailwindConfigContent.replace('/* IMPORTANT:ADMINFORTH TAILWIND STYLES */', stylesText);
350
- await fs.promises.writeFile(tailwindConfigPath, tailwindConfigContent);
351
- } else {
352
- let tailwindConfigPath = path.join(CodeInjector.SPA_TMP_PATH, 'tailwind.config.js');
353
- let tailwindConfigContent = await fs.promises.readFile(tailwindConfigPath, 'utf-8');
354
- tailwindConfigContent = tailwindConfigContent.replace('/* IMPORTANT:ADMINFORTH TAILWIND STYLES */',styles());
355
- await fs.promises.writeFile(tailwindConfigPath, tailwindConfigContent);
356
- }
341
+ // generate tailwind extend styles
342
+ const stylesGenerator = new StylesGenerator(this.adminforth.config.customization?.styles);
343
+ const stylesText = JSON.stringify(stylesGenerator.mergeStyles(), null, 2).slice(1, -1);
344
+ let tailwindConfigPath = path.join(CodeInjector.SPA_TMP_PATH, 'tailwind.config.js');
345
+ let tailwindConfigContent = await fs.promises.readFile(tailwindConfigPath, 'utf-8');
346
+ tailwindConfigContent = tailwindConfigContent.replace('/* IMPORTANT:ADMINFORTH TAILWIND STYLES */', stylesText);
347
+ await fs.promises.writeFile(tailwindConfigPath, tailwindConfigContent);
348
+
357
349
 
358
350
  const routerVuePath = path.join(CodeInjector.SPA_TMP_PATH, 'src', 'router', 'index.ts');
359
351
 
@@ -0,0 +1,45 @@
1
+ import { transformObject,deepMerge } from "./utils.js";
2
+ import { styles } from "./styles.js";
3
+
4
+ const aliasObject ={ lightSidebarText:'lightSidebarIcons',darkSidebarText:'darkSidebarIcons',lightSidebarTextHover:'lightSidebarIconsHover',darkSidebarTextHover:'darkSidebarIconsHover'}
5
+
6
+ export class StylesGenerator {
7
+ styleConfig: any;
8
+ defaultStyles: any;
9
+
10
+ constructor(styleConfig: any) {
11
+ if (!styleConfig) {
12
+ console.log("No styles provided using default styles.");
13
+ }
14
+ this.styleConfig = styleConfig;
15
+ this.defaultStyles = styles();
16
+ }
17
+
18
+ private generatePlainStyles(styleObj:any) {
19
+ let plainCustomStyles = {}
20
+ if (styleObj) {
21
+ Object.keys(styleObj).forEach((k)=>{
22
+ plainCustomStyles[k] = transformObject(styleObj[k])
23
+ })
24
+ }
25
+ return plainCustomStyles;
26
+ }
27
+ private changeAliases(plateStyles: any) {
28
+ if (!plateStyles || !plateStyles.colors) {
29
+ return plateStyles;
30
+ }
31
+ let colors = plateStyles.colors;
32
+ Object.keys(aliasObject).forEach((aliasName) => {
33
+ if (colors[aliasObject[aliasName]]) return;
34
+ if (!colors[aliasName]) return;
35
+ colors[aliasObject[aliasName]] = colors[aliasName];
36
+ })
37
+ return plateStyles;
38
+ }
39
+
40
+ mergeStyles() {
41
+ let mergedStyles = deepMerge(this.defaultStyles, this.changeAliases(this.generatePlainStyles(this.styleConfig)));
42
+ return mergedStyles;
43
+ }
44
+
45
+ }
package/modules/styles.ts CHANGED
@@ -1,53 +1,100 @@
1
- export const styles = () => `
2
-
3
- "colors": {
4
- "html-bg": "#FFFFFF", // Changed to white
5
- "header-bg": "#FFFFFF", // Light grey
6
- "header-bg-hover": "#D3D3D3", // Light grey hover
7
- "header-text": "#333333", // Dark grey text
8
- "header-text-hover": "#333333", // Dark grey text hover
9
- "header-icons": "#333333", // Dark grey icons
10
- "header-icons-hover": "#333333", // Dark grey icons hover
11
- "header-logo-color": "#333333", // Dark grey logo
12
- "header-border-color": "rgb(229 231 235)", // Light grey border
13
-
14
- "nav-menu-bg": "#ffffff", // Very light grey
15
- "nav-menu-border": "rgb(229 231 235)",
16
- "nav-menu-bg-hover": "rgb(243 244 246)", // Light grey hover
17
- "nav-menu-bg-active": "rgb(233, 234, 236)", // Light grey active
18
- "nav-menu-hover": "#rgb(209 213 219)", // Light grey hover
19
- "nav-menu-active": "#CCCCCC", // Light grey active
20
- "nav-menu-active-text": "#333333", // Dark grey active text
21
- "nav-menu-text": "#333333", // Dark grey text
22
- "nav-menu-text-hover": "#333333", // Dark grey text hover
23
- "nav-menu-text-active": "#333333", // Dark grey text active
24
- "nav-menu-devider": "#E0E0E0", // Light grey divider
25
- "nav-menu-icons": "#333333", // Dark grey icons
26
- "nav-menu-heading": "#333333", // Dark grey heading
27
-
28
- "list-view-bg": "#FFFFFF", // White background
29
- "list-view-table-bg": "#FFFFFF", // White table background
30
- "list-view-table-heading": "rgb(249 250 251)", // Very light grey heading
31
- "list-view-table-heading-text": "#333333", // Dark grey heading text
32
- "list-view-table-text": "#333333", // Dark grey text
33
- "list-view-table-row-hover": "rgb(249 250 251)", // Very light grey row hover
34
- "list-view-bread-crumbs-text": "#666666", // Medium grey bread crumbs
35
- "list-view-border-color": "#DDDDDD", // Light grey border
36
-
37
- "form-view-bg": "#FFFFFF", // White form background
38
- "form-view-border-color": "#F5F5F5", // Very light grey border
39
- "form-view-heading": "#EDEDED" // Dark grey heading
1
+
2
+
3
+ export const styles = () => ({
4
+ colors: {
5
+ lightHtml: "#FFFFFF", // main background
6
+
7
+ lightNavbar: "#FFFFFF", // navbar background
8
+ lightNavbarHover: "#D3D3D3", // in development
9
+ lightNavbarText: "#333333", // in development
10
+ lightNavbarTextHover: "#333333", // in development
11
+ lightNavbarIcons: "#333333", // in development
12
+ lightNavbarIconsHover: "#333333", // in development
13
+ lightNavbarLogo: "#333333", // in development
14
+ lightNavbarBorder: "rgb(229 231 235)", // border
15
+
16
+ lightSidebar: "#ffffff", // sidebar background
17
+ lightSidebarBorder: "rgb(229 231 235)", // sidebar right border
18
+ lightSidebarHover: "rgb(243 244 246)", // in development
19
+ lightSidebarActive: "rgb(233, 234, 236)", // in development
20
+ lightSidebarItemHover: "rgb(243 244 246)", // sidebar list item hover
21
+ lightSidebarItemActive: "rgb(233, 234, 236)", // sidebar list item active
22
+ lightSidebarText: "#4b5563", // sidebar list item text
23
+ lightSidebarTextHover: "#333333", // sidebar list item text hover
24
+ lightSidebarTextActive: "#333333", // sidebar list item text active
25
+ lightSidebarDevider: "#E0E0E0", // sidebar devider
26
+ lightSidebarIcons: "#6b7280", // sidebar list item icons
27
+ lightSidebarIconsHover: "#333333", // sidebar list item icons hover
28
+ lightSidebarHeading: "#333333", // sidebar heading
29
+
30
+ lightList: "#FFFFFF", // list view background
31
+ lightListTable: "#FFFFFF", // list view table background
32
+ lightListTableHeading: "rgb(249 250 251)", // list view table heading
33
+ lightListTableHeadingText: "#333333", // list view table heading text
34
+ lightListTableText: "#333333", // list view table text
35
+ lightListTableRowHover: "rgb(249 250 251)", // list view row hover
36
+ lightListBreadcrumbsText: "#666666", // list view breadcrumbs text
37
+ lightListBorder: "#DDDDDD", // list view rows border
38
+
39
+ lightForm: "#FFFFFF", // show view background
40
+ lightFormBorder: "#F5F5F5", // show view rows border
41
+ lightFormHeading: "#EDEDED", // show view heading
42
+
43
+
44
+ // colors for dark theme
45
+ darkHtml: "#111827",
46
+
47
+ darkNavbar: "#111827",
48
+ darkNavbarHover: "#444444",
49
+ darkNavbarText: "#FFFFFF",
50
+ darkNavbarTextHover: "#FFFFFF",
51
+ darkNavbarIcons: "#FFFFFF",
52
+ darkNavbarIconsHover: "#FFFFFF",
53
+ darkNavbarLogo: "#FFFFFF",
54
+ darkNavbarBorder: "#e5e7eb",
55
+
56
+ darkSidebar: "#1f2937",
57
+ darkSidebarBorder: "#374151",
58
+ darkSidebarHover: "#374151",
59
+ darkSidebarActive: "#444444",
60
+ darkSidebarItemHover: "#374151",
61
+ darkSidebarItemActive: "#52525b",
62
+ darkSidebarItemActiveText: "#FFFFFF",
63
+ darkSidebarText: "#9ca3af",
64
+ darkSidebarTextHover: "#FFFFFF",
65
+ darkSidebarTextActive: "#FFFFFF",
66
+ darkSidebarDevider: "#374151",
67
+ darkSidebarIcons: "#9ca3af",
68
+ darkSidebarIconsHover: "#FFFFFF",
69
+ darkSidebarHeading: "#FFFFFF",
70
+
71
+ darkList: "#111111",
72
+ darkListTable: "#1f2937",
73
+ darkListTableHeading: "#334155",
74
+ darkListTableHeadingText: "#9ca3af",
75
+ darkListTableText: "#9ca3af",
76
+ darkListTableRowHover: "#4b5563",
77
+ darkListBreadcrumbsText: "#BBBBBB",
78
+ darkListBorder: "#444444",
79
+
80
+ darkForm: "#111111",
81
+ darkFormBorder: "#222222",
82
+ darkFormHeading: "#333333"
83
+
40
84
  },
41
- "boxShadow": {
42
- "custom-light": "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
43
- "header-shadow": "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
44
- "list-table-shadow": "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
45
- "resourse-form-shadow": "0 4px 8px rgba(0, 0, 0, 0.1)" // Lighter shadow
85
+ boxShadow: {
86
+ customLight: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
87
+ headerShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
88
+ listTableShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
89
+ resourseFormShadow: "0 4px 8px rgba(0, 0, 0, 0.1)" // Lighter shadow
46
90
  },
47
- "fontSize": {
48
- "header-text-size": "1rem"
91
+ fontSize: {
92
+ "headerText-size": "1rem"
49
93
  },
50
- "borderRadius": {
94
+ borderRadius: {
51
95
  "default": "2px"
52
96
  }
53
- `;
97
+ });
98
+
99
+
100
+
package/modules/utils.ts CHANGED
@@ -36,4 +36,52 @@ export function getComponentNameFromPath(filePath) {
36
36
 
37
37
  export function listify(param?: Array<Function>) {
38
38
  return param || [];
39
+ }
40
+
41
+ export function deepMerge(target, source) {
42
+ if (typeof target !== 'object' || target === null) {
43
+ return source;
44
+ }
45
+
46
+ for (let key in source) {
47
+ if (source.hasOwnProperty(key)) {
48
+ if (typeof source[key] === 'object' && source[key] !== null) {
49
+ if (!target[key]) {
50
+ target[key] = {};
51
+ }
52
+ deepMerge(target[key], source[key]);
53
+ } else {
54
+ target[key] = source[key];
55
+ }
56
+ }
57
+ }
58
+
59
+ return target;
60
+ }
61
+
62
+ function toCamelCase(str) {
63
+ return str.replace(/[-_](.)/g, (_, char) => char.toUpperCase());
64
+ }
65
+
66
+ export function transformObject(obj, parentKey = '', result = {}) {
67
+ for (const key in obj) {
68
+ if (obj.hasOwnProperty(key)) {
69
+ const camelCaseKey = toCamelCase(parentKey ? `${parentKey}_${key}` : key);
70
+ if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
71
+ transformObject(obj[key], camelCaseKey, result);
72
+ } else {
73
+ result[camelCaseKey] = obj[key];
74
+ }
75
+ }
76
+ }
77
+ //remove 'Default' from keys
78
+ for (const key in result) {
79
+ if (key.includes('Main')) {
80
+ const newKey = key.replace('Main', '');
81
+ result[newKey] = result[key];
82
+ delete result[key];
83
+ }
84
+ }
85
+
86
+ return result;
39
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.1.47",
3
+ "version": "1.1.48",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/spa/index.html CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  </head>
19
19
  <body class=" ">
20
- <div id="app" class="min-h-screen bg-html-bg dark:bg-gray-800"></div>
20
+ <div id="app" class="min-h-screen bg-lightHtml dark:bg-darkHtml"></div>
21
21
  <script type="module" src="/src/main.ts"></script>
22
22
  </body>
23
23
  </html>