adminforth 1.0.49 → 1.0.50
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/modules/codeInjector.js +3 -2
- package/dist/modules/utils.js +3 -0
- package/dist/spa/spa/src/router/index.ts +0 -1
- package/dist/spa/spa/src/utils.ts +4 -2
- package/dist/spa/spa/src/views/CreateView.vue +1 -1
- package/dist/spa/spa/src/views/EditView.vue +1 -1
- package/dist/spa/spa/src/views/ListView.vue +1 -1
- package/dist/spa/spa/src/views/ShowView.vue +1 -1
- package/modules/codeInjector.ts +3 -2
- package/modules/utils.ts +5 -1
- package/package.json +1 -1
- package/spa/src/router/index.ts +0 -1
- package/spa/src/utils.ts +4 -2
- package/spa/src/views/CreateView.vue +1 -1
- package/spa/src/views/EditView.vue +1 -1
- package/spa/src/views/ListView.vue +1 -1
- package/spa/src/views/ShowView.vue +1 -1
- package/spa/src/views/HomeView.vue +0 -8
|
@@ -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
|
|
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
|
|
196
|
+
const componentName = getComponentNameFromPath(filePath);
|
|
196
197
|
customComponentsComponents += `app.component('${componentName}', ${componentName});\n`;
|
|
197
198
|
}
|
|
198
199
|
});
|
package/dist/modules/utils.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -29,8 +29,10 @@ export async function callAdminForthApi({ path, method, body=undefined }) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function getCustomComponent(
|
|
33
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
97
|
+
acc[column.name] = getCustomComponent(column.component.show);
|
|
98
98
|
}
|
|
99
99
|
return acc;
|
|
100
100
|
}, {});
|
package/modules/codeInjector.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
package/spa/src/router/index.ts
CHANGED
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(
|
|
33
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
97
|
+
acc[column.name] = getCustomComponent(column.component.show);
|
|
98
98
|
}
|
|
99
99
|
return acc;
|
|
100
100
|
}, {});
|