adminforth 1.0.49 → 1.0.51

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.
@@ -16,6 +16,7 @@ import os from 'os';
16
16
  import path from 'path';
17
17
  import { promisify } from 'util';
18
18
  import { ADMIN_FORTH_ABSOLUTE_PATH } from './utils.js';
19
+ import { getComponentNameFromPath } from './utils.js';
19
20
  let TMP_DIR;
20
21
  try {
21
22
  TMP_DIR = os.tmpdir();
@@ -167,7 +168,7 @@ class CodeInjector {
167
168
  return;
168
169
  }
169
170
  if (data.isFile()) {
170
- const componentName = filePath.split('.')[0].replace('/', '');
171
+ const componentName = getComponentNameFromPath(filePath);
171
172
  customComponentsImports += `import ${componentName} from '@/custom/${filePath}';\n`;
172
173
  }
173
174
  });
@@ -192,7 +193,7 @@ class CodeInjector {
192
193
  return;
193
194
  }
194
195
  if (data.isFile()) {
195
- const componentName = filePath.split('.')[0].replace('/', '');
196
+ const componentName = getComponentNameFromPath(filePath);
196
197
  customComponentsComponents += `app.component('${componentName}', ${componentName});\n`;
197
198
  }
198
199
  });
@@ -22,3 +22,6 @@ if (__dirname.endsWith('dist')) {
22
22
  export const ADMIN_FORTH_ABSOLUTE_PATH = __dirname;
23
23
  const package_json = JSON.parse(fs.readFileSync(path.join(ADMIN_FORTH_ABSOLUTE_PATH, 'package.json'), 'utf8'));
24
24
  export const ADMINFORTH_VERSION = package_json.version;
25
+ export function getComponentNameFromPath(filePath) {
26
+ return filePath.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
27
+ }
@@ -74,7 +74,7 @@
74
74
  <template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
75
75
  <div v-if="item.type === 'divider'" class="border-t border-gray-200 dark:border-gray-700"></div>
76
76
  <div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
77
- <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 opacity-40
77
+ <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-gray-400 dark:text-gray-400
78
78
  ">{{ item.label }}</div>
79
79
 
80
80
 
@@ -1,5 +1,4 @@
1
1
  import { createRouter, createWebHistory } from 'vue-router'
2
- import HomeView from '../views/HomeView.vue'
3
2
  import ResourceParent from '@/views/ResourceParent.vue'
4
3
  import ListView from '@/views/ListView.vue'
5
4
  import ShowView from '@/views/ShowView.vue'
@@ -29,8 +29,10 @@ export async function callAdminForthApi({ path, method, body=undefined }) {
29
29
  }
30
30
  }
31
31
 
32
- export function getCustomComponent(name) {
33
- return resolveComponent(name);
32
+ export function getCustomComponent(filePath: string) {
33
+ const name = filePath.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
34
+ console.log('resolving name', name);
35
+ return resolveComponent(name);
34
36
  }
35
37
 
36
38
  export function getIcon(icon: string) {
@@ -76,7 +76,7 @@ onMounted(async () => {
76
76
  });
77
77
  createComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
78
78
  if (column.component?.create) {
79
- acc[column.name] = getCustomComponent(column.component.create.replace('@@', '').replace('./custom/', '')).split('.')[0];
79
+ acc[column.name] = getCustomComponent(column.component.create);
80
80
  }
81
81
  return acc;
82
82
  }, {});
@@ -91,7 +91,7 @@ onMounted(async () => {
91
91
 
92
92
  editComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
93
93
  if (column.component?.edit) {
94
- acc[column.name] = getCustomComponent(column.component.edit.replace('@@', '').replace('./custom/', '')).split('.')[0];
94
+ acc[column.name] = getCustomComponent(column.component.edit);
95
95
  }
96
96
  return acc;
97
97
  }, {});
@@ -433,7 +433,7 @@ async function getList() {
433
433
  });
434
434
  listComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
435
435
  if (column.component?.list) {
436
- acc[column.name] = getCustomComponent(column.component.list.replace('@@', '').replace('./custom/', '')).split('.')[0];
436
+ acc[column.name] = getCustomComponent(column.component.list);
437
437
  }
438
438
  return acc;
439
439
  }, {});
@@ -94,7 +94,7 @@ onMounted(async () => {
94
94
  });
95
95
  showComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
96
96
  if (column.component?.show) {
97
- acc[column.name] = getCustomComponent(column.component.show.replace('@@', '').replace('./custom/', '')).split('.')[0];
97
+ acc[column.name] = getCustomComponent(column.component.show);
98
98
  }
99
99
  return acc;
100
100
  }, {});
@@ -8,6 +8,7 @@ import path from 'path';
8
8
  import { promisify } from 'util';
9
9
  import AdminForth from '../index.js';
10
10
  import { ADMIN_FORTH_ABSOLUTE_PATH } from './utils.js';
11
+ import { getComponentNameFromPath } from './utils.js';
11
12
 
12
13
 
13
14
  let TMP_DIR;
@@ -185,7 +186,7 @@ class CodeInjector {
185
186
  return;
186
187
  }
187
188
  if (data.isFile()) {
188
- const componentName = filePath.split('.')[0].replace('/', '');
189
+ const componentName = getComponentNameFromPath(filePath);
189
190
  customComponentsImports += `import ${componentName} from '@/custom/${filePath}';\n`;
190
191
  }
191
192
  })
@@ -212,7 +213,7 @@ class CodeInjector {
212
213
  return;
213
214
  }
214
215
  if (data.isFile()) {
215
- const componentName = filePath.split('.')[0].replace('/', '');
216
+ const componentName = getComponentNameFromPath(filePath);
216
217
  customComponentsComponents += `app.component('${componentName}', ${componentName});\n`;
217
218
  }
218
219
  })
package/modules/utils.ts CHANGED
@@ -26,4 +26,8 @@ export const ADMIN_FORTH_ABSOLUTE_PATH = __dirname;
26
26
 
27
27
  const package_json = JSON.parse(fs.readFileSync(path.join(ADMIN_FORTH_ABSOLUTE_PATH, 'package.json'), 'utf8'));
28
28
 
29
- export const ADMINFORTH_VERSION = package_json.version;
29
+ export const ADMINFORTH_VERSION: string = package_json.version;
30
+
31
+ export function getComponentNameFromPath(filePath) {
32
+ return filePath.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
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/src/App.vue CHANGED
@@ -74,7 +74,7 @@
74
74
  <template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
75
75
  <div v-if="item.type === 'divider'" class="border-t border-gray-200 dark:border-gray-700"></div>
76
76
  <div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
77
- <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 opacity-40
77
+ <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-gray-400 dark:text-gray-400
78
78
  ">{{ item.label }}</div>
79
79
 
80
80
 
@@ -1,5 +1,4 @@
1
1
  import { createRouter, createWebHistory } from 'vue-router'
2
- import HomeView from '../views/HomeView.vue'
3
2
  import ResourceParent from '@/views/ResourceParent.vue'
4
3
  import ListView from '@/views/ListView.vue'
5
4
  import ShowView from '@/views/ShowView.vue'
package/spa/src/utils.ts CHANGED
@@ -29,8 +29,10 @@ export async function callAdminForthApi({ path, method, body=undefined }) {
29
29
  }
30
30
  }
31
31
 
32
- export function getCustomComponent(name) {
33
- return resolveComponent(name);
32
+ export function getCustomComponent(filePath: string) {
33
+ const name = filePath.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
34
+ console.log('resolving name', name);
35
+ return resolveComponent(name);
34
36
  }
35
37
 
36
38
  export function getIcon(icon: string) {
@@ -76,7 +76,7 @@ onMounted(async () => {
76
76
  });
77
77
  createComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
78
78
  if (column.component?.create) {
79
- acc[column.name] = getCustomComponent(column.component.create.replace('@@', '').replace('./custom/', '')).split('.')[0];
79
+ acc[column.name] = getCustomComponent(column.component.create);
80
80
  }
81
81
  return acc;
82
82
  }, {});
@@ -91,7 +91,7 @@ onMounted(async () => {
91
91
 
92
92
  editComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
93
93
  if (column.component?.edit) {
94
- acc[column.name] = getCustomComponent(column.component.edit.replace('@@', '').replace('./custom/', '')).split('.')[0];
94
+ acc[column.name] = getCustomComponent(column.component.edit);
95
95
  }
96
96
  return acc;
97
97
  }, {});
@@ -433,7 +433,7 @@ async function getList() {
433
433
  });
434
434
  listComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
435
435
  if (column.component?.list) {
436
- acc[column.name] = getCustomComponent(column.component.list.replace('@@', '').replace('./custom/', '')).split('.')[0];
436
+ acc[column.name] = getCustomComponent(column.component.list);
437
437
  }
438
438
  return acc;
439
439
  }, {});
@@ -94,7 +94,7 @@ onMounted(async () => {
94
94
  });
95
95
  showComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
96
96
  if (column.component?.show) {
97
- acc[column.name] = getCustomComponent(column.component.show.replace('@@', '').replace('./custom/', '')).split('.')[0];
97
+ acc[column.name] = getCustomComponent(column.component.show);
98
98
  }
99
99
  return acc;
100
100
  }, {});
@@ -1,8 +0,0 @@
1
- <script setup lang="ts">
2
- </script>
3
-
4
- <template>
5
- <main>
6
- 123
7
- </main>
8
- </template>