adminforth 1.1.9 → 1.1.11

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
@@ -313,20 +313,14 @@ class AdminForth {
313
313
  for (const resource of this.config.resources) {
314
314
  for (const column of resource.columns) {
315
315
  if (column.components) {
316
- Object.entries(column.components).forEach(([key, comp]) => {
317
- column.components[key] = this.validateComponent(comp, errors);
318
- });
319
316
  console.log('🔧🔧🔧 Validating components for resource', column.components);
320
- for (const [key, { file }] of Object.entries(column.components)) {
321
- if (this.codeInjector.allComponentNames[file]) {
317
+ for (const comp of Object.values(column.components)) {
318
+ if (this.codeInjector.allComponentNames[comp.file]) {
322
319
  // not obvious, but if we are in this if, it means that this is plugin component
323
320
  // and there is no sense to check if it exists in users folder
324
321
  continue;
325
322
  }
326
- const path = file.replace('@@', this.config.customization.customComponentsDir);
327
- if (!fs.existsSync(path)) {
328
- throw new Error(`Component file ${path} does not exist`);
329
- }
323
+ this.validateComponent(comp, errors);
330
324
  }
331
325
  }
332
326
  }
@@ -0,0 +1 @@
1
+ export {};
package/index.ts CHANGED
@@ -371,21 +371,15 @@ class AdminForth implements AdminForthClass {
371
371
  for (const resource of this.config.resources) {
372
372
  for (const column of resource.columns) {
373
373
  if (column.components) {
374
- Object.entries(column.components).forEach(([key, comp]) => {
375
- column.components[key] = this.validateComponent(comp, errors);
376
- });
377
374
  console.log('🔧🔧🔧 Validating components for resource', column.components);
378
375
 
379
- for (const [key, { file }] of Object.entries(column.components as {any})) {
380
- if (this.codeInjector.allComponentNames[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
- continue;
384
- }
385
- const path = file.replace('@@', this.config.customization.customComponentsDir);
386
- if (!fs.existsSync(path)) {
387
- throw new Error(`Component file ${path} does not exist`);
376
+ for (const comp of Object.values(column.components) as Array<AdminForthComponentDeclarationFull>) {
377
+ if (this.codeInjector.allComponentNames[comp.file]) {
378
+ // not obvious, but if we are in this if, it means that this is plugin component
379
+ // and there is no sense to check if it exists in users folder
380
+ continue;
388
381
  }
382
+ this.validateComponent(comp, errors);
389
383
  }
390
384
  }
391
385
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -114,7 +114,7 @@ const loading = ref(true);
114
114
  const page = ref(1);
115
115
  const sort = ref([]);
116
116
  const checkboxes = ref([]);
117
- const pageSize = computed(() => props.meta.listPageSize || 10);
117
+ const pageSize = computed(() => listResource.value?.options?.pageSize || 10);
118
118
 
119
119
  const rows = ref(null);
120
120
  const totalRows = ref(0);
@@ -1,11 +1,7 @@
1
1
  import { AdminForthResource, AdminForthResourcePages, AdminForthClass, GenericHttpServer } from "../../types/AdminForthConfig.js";
2
2
  import AdminForthPlugin from "../base.js";
3
+ import { PluginOptions } from "./types.js";
3
4
 
4
- type PluginOptions = {
5
- foreignResourceId: string;
6
- listPageSize?: number;
7
- modifyTableResourceConfig?: (resourceConfig: AdminForthResource) => void;
8
- }
9
5
 
10
6
  export default class ForeignInlineListPlugin extends AdminForthPlugin {
11
7
  foreignResource: AdminForthResource;
@@ -0,0 +1,22 @@
1
+
2
+ import { AdminForthResource } from '../../types/AdminForthConfig.js';
3
+
4
+ export type PluginOptions = {
5
+
6
+ /**
7
+ * Id of the resource to be displayed in the inline list.
8
+ *
9
+ * Resource mandatory should have one columns which defined {@link AdminForthResourceColumn.foreignResource} which
10
+ * should be equal to the resourceId of the resource where plugin is used.
11
+ */
12
+ foreignResourceId: string;
13
+
14
+ /**
15
+ * Function to modify the resource config of the table.
16
+ * Can be used to define list of columns visible in the inline list.
17
+ * Or modify listPageSize
18
+ *
19
+ * @param resourceConfig - Resource config of the table.
20
+ */
21
+ modifyTableResourceConfig?: (resourceConfig: AdminForthResource) => void;
22
+ }