adminforth 1.1.11 → 1.1.13
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/index.js
CHANGED
|
@@ -63,7 +63,7 @@ class AdminForth {
|
|
|
63
63
|
}
|
|
64
64
|
return [];
|
|
65
65
|
}
|
|
66
|
-
validateComponent(component, errors) {
|
|
66
|
+
validateComponent(component, errors, ignoreExistsCheck = false) {
|
|
67
67
|
if (!component) {
|
|
68
68
|
return component;
|
|
69
69
|
}
|
|
@@ -74,7 +74,9 @@ class AdminForth {
|
|
|
74
74
|
else {
|
|
75
75
|
obj = component;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
if (!ignoreExistsCheck) {
|
|
78
|
+
errors.push(...this.checkCustomFileExists(obj.file));
|
|
79
|
+
}
|
|
78
80
|
return obj;
|
|
79
81
|
}
|
|
80
82
|
validateConfig() {
|
|
@@ -314,13 +316,14 @@ class AdminForth {
|
|
|
314
316
|
for (const column of resource.columns) {
|
|
315
317
|
if (column.components) {
|
|
316
318
|
console.log('🔧🔧🔧 Validating components for resource', column.components);
|
|
317
|
-
for (const comp of Object.
|
|
319
|
+
for (const [key, comp] of Object.entries(column.components)) {
|
|
320
|
+
let ignoreExistsCheck = false;
|
|
318
321
|
if (this.codeInjector.allComponentNames[comp.file]) {
|
|
319
322
|
// not obvious, but if we are in this if, it means that this is plugin component
|
|
320
323
|
// and there is no sense to check if it exists in users folder
|
|
321
|
-
|
|
324
|
+
ignoreExistsCheck = true;
|
|
322
325
|
}
|
|
323
|
-
this.validateComponent(comp, errors);
|
|
326
|
+
column.components[key] = this.validateComponent(comp, errors, ignoreExistsCheck);
|
|
324
327
|
}
|
|
325
328
|
}
|
|
326
329
|
}
|
|
@@ -229,10 +229,13 @@ class CodeInjector {
|
|
|
229
229
|
const customResourceComponents = [];
|
|
230
230
|
this.adminforth.config.resources.forEach((resource) => {
|
|
231
231
|
var _a;
|
|
232
|
-
resource.columns.forEach((
|
|
233
|
-
if (
|
|
234
|
-
Object.values(
|
|
232
|
+
resource.columns.forEach((column) => {
|
|
233
|
+
if (column.components) {
|
|
234
|
+
Object.values(column.components).forEach(({ file }) => {
|
|
235
235
|
if (!customResourceComponents.includes(file)) {
|
|
236
|
+
if (file === undefined) {
|
|
237
|
+
throw new Error('file is undefined from field.components, field:' + JSON.stringify(column));
|
|
238
|
+
}
|
|
236
239
|
customResourceComponents.push(file);
|
|
237
240
|
}
|
|
238
241
|
});
|
|
@@ -242,12 +245,16 @@ class CodeInjector {
|
|
|
242
245
|
Object.values(injection).forEach((filePathes) => {
|
|
243
246
|
filePathes.forEach(({ file }) => {
|
|
244
247
|
if (!customResourceComponents.includes(file)) {
|
|
248
|
+
if (file === undefined) {
|
|
249
|
+
throw new Error('file is undefined');
|
|
250
|
+
}
|
|
245
251
|
customResourceComponents.push(file);
|
|
246
252
|
}
|
|
247
253
|
});
|
|
248
254
|
});
|
|
249
255
|
});
|
|
250
256
|
});
|
|
257
|
+
console.log('🔧 🔧 Injecting code into Vue sources...', customResourceComponents);
|
|
251
258
|
customResourceComponents.forEach((filePath) => {
|
|
252
259
|
const componentName = getComponentNameFromPath(filePath);
|
|
253
260
|
this.allComponentNames[filePath] = componentName;
|
package/index.ts
CHANGED
|
@@ -83,7 +83,7 @@ class AdminForth implements AdminForthClass {
|
|
|
83
83
|
return [];
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
validateComponent(component: AdminForthComponentDeclaration, errors: Array<string
|
|
86
|
+
validateComponent(component: AdminForthComponentDeclaration, errors: Array<string>, ignoreExistsCheck: boolean = false): AdminForthComponentDeclaration {
|
|
87
87
|
if (!component) {
|
|
88
88
|
return component;
|
|
89
89
|
}
|
|
@@ -93,7 +93,9 @@ class AdminForth implements AdminForthClass {
|
|
|
93
93
|
} else {
|
|
94
94
|
obj = component;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
if (!ignoreExistsCheck) {
|
|
97
|
+
errors.push(...this.checkCustomFileExists(obj.file));
|
|
98
|
+
}
|
|
97
99
|
|
|
98
100
|
return obj;
|
|
99
101
|
}
|
|
@@ -373,13 +375,14 @@ class AdminForth implements AdminForthClass {
|
|
|
373
375
|
if (column.components) {
|
|
374
376
|
console.log('🔧🔧🔧 Validating components for resource', column.components);
|
|
375
377
|
|
|
376
|
-
for (const comp of Object.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
378
|
+
for (const [key, comp] of Object.entries(column.components as Record<string, AdminForthComponentDeclarationFull>)) {
|
|
379
|
+
let ignoreExistsCheck = false;
|
|
380
|
+
if (this.codeInjector.allComponentNames[comp.file]) {
|
|
381
|
+
// not obvious, but if we are in this if, it means that this is plugin component
|
|
382
|
+
// and there is no sense to check if it exists in users folder
|
|
383
|
+
ignoreExistsCheck = true;
|
|
384
|
+
}
|
|
385
|
+
column.components[key] = this.validateComponent(comp, errors, ignoreExistsCheck);
|
|
383
386
|
}
|
|
384
387
|
}
|
|
385
388
|
}
|
package/modules/codeInjector.ts
CHANGED
|
@@ -254,10 +254,13 @@ class CodeInjector implements CodeInjectorType {
|
|
|
254
254
|
// for each custom component generate import statement
|
|
255
255
|
const customResourceComponents = [];
|
|
256
256
|
this.adminforth.config.resources.forEach((resource) => {
|
|
257
|
-
resource.columns.forEach((
|
|
258
|
-
if (
|
|
259
|
-
Object.values(
|
|
257
|
+
resource.columns.forEach((column) => {
|
|
258
|
+
if (column.components) {
|
|
259
|
+
Object.values(column.components).forEach(({ file }: {file: string}) => {
|
|
260
260
|
if (!customResourceComponents.includes(file)) {
|
|
261
|
+
if (file === undefined) {
|
|
262
|
+
throw new Error('file is undefined from field.components, field:' + JSON.stringify(column));
|
|
263
|
+
}
|
|
261
264
|
customResourceComponents.push(file);
|
|
262
265
|
}
|
|
263
266
|
});
|
|
@@ -267,6 +270,9 @@ class CodeInjector implements CodeInjectorType {
|
|
|
267
270
|
Object.values(injection).forEach((filePathes: {file: string}[]) => {
|
|
268
271
|
filePathes.forEach(({ file }) => {
|
|
269
272
|
if (!customResourceComponents.includes(file)) {
|
|
273
|
+
if (file === undefined) {
|
|
274
|
+
throw new Error('file is undefined');
|
|
275
|
+
}
|
|
270
276
|
customResourceComponents.push(file);
|
|
271
277
|
}
|
|
272
278
|
});
|
|
@@ -276,6 +282,7 @@ class CodeInjector implements CodeInjectorType {
|
|
|
276
282
|
|
|
277
283
|
});
|
|
278
284
|
|
|
285
|
+
console.log('🔧 🔧 Injecting code into Vue sources...', customResourceComponents);
|
|
279
286
|
customResourceComponents.forEach((filePath) => {
|
|
280
287
|
const componentName = getComponentNameFromPath(filePath);
|
|
281
288
|
this.allComponentNames[filePath] = componentName;
|
package/package.json
CHANGED
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
:totalRows="totalRows"
|
|
91
91
|
:checkboxes="checkboxes"
|
|
92
92
|
/>
|
|
93
|
+
|
|
93
94
|
</td>
|
|
94
95
|
</template>
|
|
95
96
|
|
|
@@ -114,7 +115,7 @@ const loading = ref(true);
|
|
|
114
115
|
const page = ref(1);
|
|
115
116
|
const sort = ref([]);
|
|
116
117
|
const checkboxes = ref([]);
|
|
117
|
-
const pageSize = computed(() => listResource.value?.options?.
|
|
118
|
+
const pageSize = computed(() => listResource.value?.options?.listPageSize || 10);
|
|
118
119
|
|
|
119
120
|
const rows = ref(null);
|
|
120
121
|
const totalRows = ref(0);
|