adminforth 2.26.0-test.5 → 2.26.0-test.7

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 (59) hide show
  1. package/commands/createApp/templates/package.json.hbs +1 -1
  2. package/dist/dataConnectors/qdrant.d.ts +2 -10
  3. package/dist/dataConnectors/qdrant.d.ts.map +1 -1
  4. package/dist/dataConnectors/qdrant.js +12 -38
  5. package/dist/dataConnectors/qdrant.js.map +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +18 -31
  8. package/dist/index.js.map +1 -1
  9. package/dist/modules/restApi.d.ts +1 -0
  10. package/dist/modules/restApi.d.ts.map +1 -1
  11. package/dist/modules/restApi.js +33 -16
  12. package/dist/modules/restApi.js.map +1 -1
  13. package/dist/modules/utils.d.ts +6 -0
  14. package/dist/modules/utils.d.ts.map +1 -1
  15. package/dist/modules/utils.js +13 -0
  16. package/dist/modules/utils.js.map +1 -1
  17. package/dist/servers/express.d.ts.map +1 -1
  18. package/dist/servers/express.js +7 -1
  19. package/dist/servers/express.js.map +1 -1
  20. package/dist/spa/package-lock.json +44 -7
  21. package/dist/spa/package.json +1 -1
  22. package/dist/spa/pnpm-lock.yaml +301 -299
  23. package/dist/spa/src/adminforth.ts +17 -29
  24. package/dist/spa/src/afcl/Input.vue +1 -1
  25. package/dist/spa/src/afcl/Modal.vue +12 -1
  26. package/dist/spa/src/afcl/Select.vue +4 -2
  27. package/dist/spa/src/afcl/Table.vue +27 -13
  28. package/dist/spa/src/components/AcceptModal.vue +2 -0
  29. package/dist/spa/src/components/ColumnValueInputWrapper.vue +11 -3
  30. package/dist/spa/src/components/CustomRangePicker.vue +16 -67
  31. package/dist/spa/src/components/ListActionsThreeDots.vue +10 -9
  32. package/dist/spa/src/components/RangePicker.vue +236 -0
  33. package/dist/spa/src/components/ResourceListTable.vue +283 -136
  34. package/dist/spa/src/components/Sidebar.vue +1 -1
  35. package/dist/spa/src/components/ThreeDotsMenu.vue +10 -9
  36. package/dist/spa/src/i18n.ts +1 -1
  37. package/dist/spa/src/stores/core.ts +4 -2
  38. package/dist/spa/src/types/Back.ts +7 -3
  39. package/dist/spa/src/types/Common.ts +25 -5
  40. package/dist/spa/src/types/FrontendAPI.ts +6 -1
  41. package/dist/spa/src/utils/listUtils.ts +8 -2
  42. package/dist/spa/src/utils/utils.ts +29 -10
  43. package/dist/spa/src/views/CreateView.vue +8 -8
  44. package/dist/spa/src/views/EditView.vue +8 -7
  45. package/dist/spa/src/views/ListView.vue +14 -48
  46. package/dist/spa/src/views/LoginView.vue +13 -13
  47. package/dist/spa/src/views/ShowView.vue +10 -10
  48. package/dist/spa/tsconfig.app.json +0 -1
  49. package/dist/types/Back.d.ts +4 -4
  50. package/dist/types/Back.d.ts.map +1 -1
  51. package/dist/types/Back.js.map +1 -1
  52. package/dist/types/Common.d.ts +20 -5
  53. package/dist/types/Common.d.ts.map +1 -1
  54. package/dist/types/Common.js.map +1 -1
  55. package/dist/types/FrontendAPI.d.ts +13 -1
  56. package/dist/types/FrontendAPI.d.ts.map +1 -1
  57. package/dist/types/FrontendAPI.js.map +1 -1
  58. package/package.json +2 -2
  59. package/dist/spa/src/components/ResourceListTableVirtual.vue +0 -789
@@ -4,9 +4,11 @@ import { callAdminForthApi } from '@/utils';
4
4
  import websocket from '@/websocket';
5
5
  import { useAdminforth } from '@/adminforth';
6
6
 
7
- import type { AdminForthResourceCommon, AdminForthResourceColumnCommon, GetBaseConfigResponse, ResourceVeryShort, AdminUser, UserData, AdminForthConfigMenuItem, AdminForthConfigForFrontend } from '@/types/Common';
7
+ import type { AdminForthResourceCommon, AdminForthResourceColumnCommon, GetBaseConfigResponse, ResourceVeryShort, AdminUser, UserData, AdminForthConfigMenuItem, AdminForthConfigForFrontend, AdminForthResourceFrontend } from '@/types/Common';
8
8
  import type { Ref } from 'vue'
9
9
 
10
+
11
+
10
12
  export const useCoreStore = defineStore('core', () => {
11
13
  const { alert } = useAdminforth();
12
14
  const resourceById: Ref<Record<string, ResourceVeryShort>> = ref({});
@@ -15,7 +17,7 @@ export const useCoreStore = defineStore('core', () => {
15
17
  const menu: Ref<AdminForthConfigMenuItem[]> = ref([]);
16
18
  const config: Ref<AdminForthConfigForFrontend | null> = ref(null);
17
19
  const record: Ref<any | null> = ref({});
18
- const resource: Ref<AdminForthResourceCommon | null> = ref(null);
20
+ const resource: Ref<AdminForthResourceFrontend | null> = ref(null);
19
21
  const userData: Ref<UserData | null> = ref(null);
20
22
  const isResourceFetching = ref(false);
21
23
  const isInternetError = ref(false);
@@ -1,4 +1,4 @@
1
- import type { Express, Request } from 'express';
1
+ import type { Express, Request, Response } from 'express';
2
2
  import type { Writable } from 'stream';
3
3
 
4
4
  import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum, AdminForthResourcePages,
@@ -67,6 +67,10 @@ export interface IHttpServer {
67
67
  headers: {[key: string]: string},
68
68
  cookies: {[key: string]: string},
69
69
  response: IAdminForthHttpResponse,
70
+ requestUrl: string,
71
+ abortSignal: AbortSignal,
72
+ _raw_express_req: Request,
73
+ _raw_express_res: Response,
70
74
  ) => void,
71
75
  }): void;
72
76
 
@@ -1637,7 +1641,7 @@ export interface AdminForthConfigCustomization extends Omit<AdminForthInputConfi
1637
1641
 
1638
1642
  loginPageInjections: {
1639
1643
  underInputs: Array<AdminForthComponentDeclarationFull>,
1640
- underLoginButton?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1644
+ underLoginButton: Array<AdminForthComponentDeclarationFull>,
1641
1645
  panelHeader: Array<AdminForthComponentDeclarationFull>,
1642
1646
  },
1643
1647
 
@@ -1825,7 +1829,7 @@ export type AllowedActions = {
1825
1829
  /**
1826
1830
  * General options for resource.
1827
1831
  */
1828
- export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourceInputCommon['options']>, 'allowedActions' | 'bulkActions'> {
1832
+ export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourceInputCommon['options']>, 'allowedActions' | 'bulkActions' | 'actions'> {
1829
1833
 
1830
1834
  /**
1831
1835
  * Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
@@ -314,6 +314,25 @@ export type FieldGroup = {
314
314
  noTitle?: boolean;
315
315
  };
316
316
 
317
+ export interface AdminForthActionFront extends Omit<AdminForthActionInput, 'id'> {
318
+ id: string;
319
+ }
320
+
321
+ export interface AdminForthBulkActionFront extends Omit<AdminForthBulkActionCommon, 'id'> {
322
+ id: string,
323
+ }
324
+
325
+ type AdminforthOptionsCommon = NonNullable<AdminForthResourceCommon['options']>;
326
+
327
+ export interface AdminForthOptionsForFrontend extends Omit<AdminforthOptionsCommon, 'actions' | 'bulkActions'> {
328
+ actions?: AdminForthActionFront[],
329
+ bulkActions?: AdminForthBulkActionFront[],
330
+ }
331
+
332
+ export interface AdminForthResourceFrontend extends Omit<AdminForthResourceCommon, 'options'> {
333
+ options: AdminForthOptionsForFrontend;
334
+ }
335
+
317
336
  /**
318
337
  * Resource describes one table or collection in database.
319
338
  * AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
@@ -361,17 +380,17 @@ export interface AdminForthResourceInputCommon {
361
380
  recordLabel?: (item: any) => string,
362
381
 
363
382
 
364
- /**
365
- * If true, user will not see warning about unsaved changes when tries to leave edit or create page with unsaved changes.
366
- * default is false
367
- */
368
- dontShowWarningAboutUnsavedChanges?: boolean,
369
383
 
370
384
  /**
371
385
  * General options for resource.
372
386
  */
373
387
  options?: {
374
388
 
389
+ /**
390
+ * If true, user will not see warning about unsaved changes when tries to leave edit or create page with unsaved changes.
391
+ * default is false
392
+ */
393
+ dontShowWarningAboutUnsavedChanges?: boolean,
375
394
 
376
395
  /**
377
396
  * Show quick action icons for base actions (show, edit, delete) in list view.
@@ -1172,6 +1191,7 @@ export interface AdminForthConfigForFrontend {
1172
1191
  loginPageInjections: {
1173
1192
  underInputs: Array<AdminForthComponentDeclaration>,
1174
1193
  panelHeader: Array<AdminForthComponentDeclaration>,
1194
+ underLoginButton: Array<AdminForthComponentDeclaration>,
1175
1195
  },
1176
1196
  rememberMeDuration: string,
1177
1197
  showBrandNameInSidebar: boolean,
@@ -144,7 +144,7 @@ export interface FrontendAPIInterface {
144
144
  /**
145
145
  * Run save interceptors for a specific resource or all resources if no resourceId is provided
146
146
  */
147
- runSaveInterceptors(params: { action: 'create'|'edit'; values: any; resource: any; resourceId: string; }): Promise<{ ok: boolean; error?: string | null; extra?: object; }>;
147
+ runSaveInterceptors(params: { action: 'create'|'edit'; values: any; resource: any; resourceId: string; }): Promise<{ ok: boolean; error?: string | null; extra?: any; }>;
148
148
 
149
149
  /**
150
150
  * Clear save interceptors for a specific resource or all resources if no resourceId is provided
@@ -152,6 +152,11 @@ export interface FrontendAPIInterface {
152
152
  * @param resourceId - The resource ID to clear interceptors for
153
153
  */
154
154
  clearSaveInterceptors(resourceId?: string): void;
155
+
156
+ /**
157
+ * Register a save interceptor for a specific resource
158
+ */
159
+ registerSaveInterceptor(handler: (ctx: { action: 'create'|'edit'; values: any; resource: any; }) => Promise<{ ok: boolean; error?: string | null; extra?: any; }>): void;
155
160
  }
156
161
 
157
162
  export type ConfirmParams = {
@@ -4,13 +4,18 @@ import { type AdminForthResourceCommon } from '../types/Common';
4
4
  import { useAdminforth } from '@/adminforth';
5
5
  import { showErrorTost } from '@/composables/useFrontendApi'
6
6
 
7
-
7
+ let getResourceDataLastAbortController: AbortController | null = null;
8
8
  export async function getList(resource: AdminForthResourceCommon, isPageLoaded: boolean, page: number | null , pageSize: number, sort: any, checkboxes:{ value: any[] }, filters: any = [] ) {
9
9
  let rows: any[] = [];
10
10
  let totalRows: number | null = null;
11
11
  if (!isPageLoaded) {
12
12
  return;
13
13
  }
14
+ const abortController = new AbortController();
15
+ if (getResourceDataLastAbortController) {
16
+ getResourceDataLastAbortController.abort();
17
+ }
18
+ getResourceDataLastAbortController = abortController;
14
19
  const data = await callAdminForthApi({
15
20
  path: '/get_resource_data',
16
21
  method: 'POST',
@@ -21,7 +26,8 @@ export async function getList(resource: AdminForthResourceCommon, isPageLoaded:
21
26
  offset: ((page || 1) - 1) * pageSize,
22
27
  filters: filters,
23
28
  sort: sort,
24
- }
29
+ },
30
+ abortSignal: abortController.signal
25
31
  });
26
32
  if (data.error) {
27
33
  showErrorTost(data.error);
@@ -1,6 +1,6 @@
1
1
  import { nextTick, onMounted, ref, resolveComponent } from 'vue';
2
2
  import type { CoreConfig } from '../spa_types/core';
3
- import type { ValidationObject } from '../types/Common.js';
3
+ import type { AdminForthComponentDeclaration, AdminForthComponentDeclarationFull, ValidationObject } from '../types/Common.js';
4
4
  import router from "../router";
5
5
  import { useCoreStore } from '../stores/core';
6
6
  import { useUserStore } from '../stores/user';
@@ -19,11 +19,12 @@ const LS_LANG_KEY = `afLanguage`;
19
19
  const MAX_CONSECUTIVE_EMPTY_RESULTS = 2;
20
20
  const ITEMS_PER_PAGE_LIMIT = 100;
21
21
 
22
- export async function callApi({path, method, body, headers, silentError = false}: {
22
+ export async function callApi({path, method, body, headers, silentError = false, abortSignal}: {
23
23
  path: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
24
24
  body?: any
25
25
  headers?: Record<string, string>
26
26
  silentError?: boolean
27
+ abortSignal?: AbortSignal
27
28
  }): Promise<any> {
28
29
  const t = i18nInstance?.global.t || ((s: string) => s)
29
30
  const options = {
@@ -34,6 +35,7 @@ export async function callApi({path, method, body, headers, silentError = false}
34
35
  ...headers
35
36
  },
36
37
  body: JSON.stringify(body),
38
+ signal: abortSignal
37
39
  };
38
40
  const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
39
41
  try {
@@ -68,28 +70,45 @@ export async function callApi({path, method, body, headers, silentError = false}
68
70
  return null;
69
71
  }
70
72
 
71
- if (!silentError) {
73
+ if (!silentError && !(e instanceof DOMException && e.name === 'AbortError')) {
72
74
  adminforth.alert({variant:'danger', message: t('Something went wrong, please try again later'),})
73
75
  }
74
76
  console.error(`error in callApi ${path}`, e);
75
77
  }
76
78
  }
77
79
 
78
- export async function callAdminForthApi({ path, method, body=undefined, headers=undefined, silentError = false }: {
79
- path: string,
80
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',
81
- body?: any,
82
- headers?: Record<string, string>,
83
- silentError?: boolean
80
+ export async function callAdminForthApi(
81
+ {
82
+ path,
83
+ method,
84
+ body=undefined,
85
+ headers=undefined,
86
+ silentError = false,
87
+ abortSignal = undefined
88
+ }: {
89
+ path: string,
90
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',
91
+ body?: any,
92
+ headers?: Record<string, string>,
93
+ silentError?: boolean,
94
+ abortSignal?: AbortSignal
84
95
  }): Promise<any> {
85
96
  try {
86
- return callApi({path: `/adminapi/v1${path}`, method, body, headers, silentError} );
97
+ return callApi({path: `/adminapi/v1${path}`, method, body, headers, silentError, abortSignal} );
87
98
  } catch (e) {
88
99
  console.error('error', e);
89
100
  return { error: `Unexpected error: ${e}` };
90
101
  }
91
102
  }
92
103
 
104
+ export function formatComponent(component: AdminForthComponentDeclaration): AdminForthComponentDeclarationFull {
105
+ if (typeof component === 'string') {
106
+ return { file: component, meta: {} };
107
+ } else {
108
+ return { file: component.file, meta: component.meta };
109
+ }
110
+ }
111
+
93
112
  export function getCustomComponent({ file, meta }: { file: string, meta?: any }) {
94
113
  const name = file.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
95
114
  return resolveComponent(name);
@@ -2,8 +2,8 @@
2
2
  <div class="relative w-full">
3
3
 
4
4
  <component
5
- v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.beforeBreadcrumbs || []"
6
- :is="getCustomComponent(c)"
5
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.beforeBreadcrumbs as AdminForthComponentDeclaration[] || []"
6
+ :is="getCustomComponent(formatComponent(c))"
7
7
  :meta="(c as AdminForthComponentDeclarationFull).meta"
8
8
  :record="coreStore.record"
9
9
  :resource="coreStore.resource"
@@ -36,8 +36,8 @@
36
36
  </BreadcrumbsWithButtons>
37
37
 
38
38
  <component
39
- v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.afterBreadcrumbs || []"
40
- :is="getCustomComponent(c)"
39
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.afterBreadcrumbs as AdminForthComponentDeclaration[] || []"
40
+ :is="getCustomComponent(formatComponent(c))"
41
41
  :meta="(c as AdminForthComponentDeclarationFull).meta"
42
42
  :record="coreStore.record"
43
43
  :resource="coreStore.resource"
@@ -61,8 +61,8 @@
61
61
  </ResourceForm>
62
62
 
63
63
  <component
64
- v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.bottom || []"
65
- :is="getCustomComponent(c)"
64
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.create?.bottom as AdminForthComponentDeclaration[] || []"
65
+ :is="getCustomComponent(formatComponent(c))"
66
66
  :meta="(c as AdminForthComponentDeclarationFull).meta"
67
67
  :record="coreStore.record"
68
68
  :resource="coreStore.resource"
@@ -79,7 +79,7 @@ import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
79
79
  import ResourceForm from '@/components/ResourceForm.vue';
80
80
  import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
81
81
  import { useCoreStore } from '@/stores/core';
82
- import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions, initThreeDotsDropdown, checkShowIf, compareOldAndNewRecord, onBeforeRouteLeaveCreateEditViewGuard, leaveGuardActiveClass, onBeforeRouteLeaveCreateEditView } from '@/utils';
82
+ import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions, initThreeDotsDropdown, checkShowIf, compareOldAndNewRecord, onBeforeRouteLeaveCreateEditViewGuard, leaveGuardActiveClass, formatComponent } from '@/utils';
83
83
  import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
84
84
  import { onMounted, onBeforeMount, onBeforeUnmount, ref, watch, nextTick } from 'vue';
85
85
  import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router';
@@ -88,7 +88,7 @@ import { showErrorTost } from '@/composables/useFrontendApi';
88
88
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
89
89
  import { useAdminforth } from '@/adminforth';
90
90
  import { useI18n } from 'vue-i18n';
91
- import { type AdminForthComponentDeclarationFull } from '@/types/Common.js';
91
+ import { type AdminForthComponentDeclaration, type AdminForthComponentDeclarationFull } from '@/types/Common.js';
92
92
  import type { AdminForthResourceColumn } from '@/types/Back';
93
93
 
94
94
  const isValid = ref(false);
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div class="relative w-full">
3
3
  <component
4
- v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.beforeBreadcrumbs || []"
5
- :is="getCustomComponent(c)"
4
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.beforeBreadcrumbs as AdminForthComponentDeclaration[] || []"
5
+ :is="getCustomComponent(formatComponent(c))"
6
6
  :meta="(c as AdminForthComponentDeclarationFull).meta"
7
7
  :record="editableRecord"
8
8
  :resource="coreStore.resource"
@@ -32,8 +32,8 @@
32
32
  </BreadcrumbsWithButtons>
33
33
 
34
34
  <component
35
- v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.afterBreadcrumbs || []"
36
- :is="getCustomComponent(c)"
35
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.afterBreadcrumbs as AdminForthComponentDeclaration[] || []"
36
+ :is="getCustomComponent(formatComponent(c))"
37
37
  :meta="(c as AdminForthComponentDeclarationFull).meta"
38
38
  :record="coreStore.record"
39
39
  :resource="coreStore.resource"
@@ -56,8 +56,8 @@
56
56
  </ResourceForm>
57
57
 
58
58
  <component
59
- v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.bottom || []"
60
- :is="getCustomComponent(c)"
59
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.bottom as AdminForthComponentDeclaration[] || []"
60
+ :is="getCustomComponent(formatComponent(c))"
61
61
  :meta="(c as AdminForthComponentDeclarationFull).meta"
62
62
  :record="coreStore.record"
63
63
  :resource="coreStore.resource"
@@ -82,7 +82,8 @@ import { showErrorTost } from '@/composables/useFrontendApi';
82
82
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
83
83
  import { useAdminforth } from '@/adminforth';
84
84
  import { useI18n } from 'vue-i18n';
85
- import { type AdminForthComponentDeclarationFull } from '@/types/Common.js';
85
+ import { formatComponent } from '@/utils';
86
+ import { type AdminForthComponentDeclaration, type AdminForthComponentDeclarationFull } from '@/types/Common.js';
86
87
  import type { AdminForthResourceColumn } from '@/types/Back';
87
88
 
88
89
  const { t } = useI18n();
@@ -11,8 +11,8 @@
11
11
 
12
12
  <component
13
13
  v-if="!coreStore.isResourceFetching && !initInProcess"
14
- v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeBreadcrumbs || []"
15
- :is="getCustomComponent(c)"
14
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeBreadcrumbs as AdminForthComponentDeclaration[] || []"
15
+ :is="getCustomComponent(formatComponent(c))"
16
16
  :meta="(c as AdminForthComponentDeclarationFull).meta"
17
17
  :resource="coreStore.resource"
18
18
  :adminUser="coreStore.adminUser"
@@ -21,8 +21,8 @@
21
21
  <BreadcrumbsWithButtons>
22
22
  <component
23
23
  v-if="!coreStore.isResourceFetching && !initInProcess"
24
- v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeActionButtons || []"
25
- :is="getCustomComponent(c)"
24
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeActionButtons as AdminForthComponentDeclaration[] || []"
25
+ :is="getCustomComponent(formatComponent(c))"
26
26
  :meta="(c as AdminForthComponentDeclarationFull).meta"
27
27
  :resource="coreStore.resource"
28
28
  :adminUser="coreStore.adminUser"
@@ -114,14 +114,14 @@
114
114
 
115
115
  <component
116
116
  v-if="!coreStore.isResourceFetching && !initInProcess"
117
- v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.afterBreadcrumbs || []"
118
- :is="getCustomComponent(c)"
117
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.afterBreadcrumbs as AdminForthComponentDeclaration[] || []"
118
+ :is="getCustomComponent(formatComponent(c))"
119
119
  :meta="(c as AdminForthComponentDeclarationFull).meta"
120
120
  :resource="coreStore.resource"
121
121
  :adminUser="coreStore.adminUser"
122
122
  />
123
- <ResourceListTableVirtual
124
- v-if="isVirtualScrollEnabled && !coreStore.isResourceFetching"
123
+ <ResourceListTable
124
+ v-if="!coreStore.isResourceFetching"
125
125
  :resource="coreStore.resource"
126
126
  :rows="rows"
127
127
  :page="page"
@@ -153,49 +153,16 @@
153
153
  :tableRowReplaceInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableRowReplace)
154
154
  ? coreStore.resourceOptions.pageInjections.list.tableRowReplace[0]
155
155
  : coreStore.resourceOptions?.pageInjections?.list?.tableRowReplace || undefined"
156
+
156
157
  :container-height="1100"
157
158
  :item-height="52.5"
158
159
  :buffer-size="listBufferSize"
159
- />
160
-
161
- <ResourceListTable
162
- v-else-if="!coreStore.isResourceFetching"
163
- :resource="coreStore.resource"
164
- :rows="rows"
165
- :page="page"
166
- @update:page="page = $event"
167
- @update:sort="sort = $event"
168
- @update:checkboxes="checkboxes = $event"
169
- @update:records="getListInner"
170
- :sort="sort"
171
- :pageSize="pageSize"
172
- :totalRows="totalRows"
173
- :checkboxes="checkboxes"
174
- :customActionsInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.customActionIcons)
175
- ? coreStore.resourceOptions.pageInjections.list.customActionIcons
176
- : coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
177
- ? [coreStore.resourceOptions.pageInjections.list.customActionIcons]
178
- : []
179
- "
180
- :tableBodyStartInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart)
181
- ? coreStore.resourceOptions.pageInjections.list.tableBodyStart
182
- : coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart
183
- ? [coreStore.resourceOptions.pageInjections.list.tableBodyStart]
184
- : []
185
- "
186
- :customActionIconsThreeDotsMenuItems="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.customActionIconsThreeDotsMenuItems)
187
- ? coreStore.resourceOptions.pageInjections.list.customActionIconsThreeDotsMenuItems
188
- : coreStore.resourceOptions?.pageInjections?.list?.customActionIconsThreeDotsMenuItems
189
- ? [coreStore.resourceOptions.pageInjections.list.customActionIconsThreeDotsMenuItems]
190
- : []"
191
- :tableRowReplaceInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableRowReplace)
192
- ? coreStore.resourceOptions.pageInjections.list.tableRowReplace[0]
193
- : coreStore.resourceOptions?.pageInjections?.list?.tableRowReplace || undefined"
160
+ :isVirtualScrollEnabled="isVirtualScrollEnabled"
194
161
  />
195
162
 
196
163
  <component
197
- v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.bottom || []"
198
- :is="getCustomComponent(c)"
164
+ v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.bottom as AdminForthComponentDeclaration[] || []"
165
+ :is="getCustomComponent(formatComponent(c))"
199
166
  :meta="(c as AdminForthComponentDeclarationFull).meta"
200
167
  :resource="coreStore.resource"
201
168
  :adminUser="coreStore.adminUser"
@@ -206,17 +173,16 @@
206
173
 
207
174
  <script setup lang="ts">
208
175
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
209
- import ResourceListTableVirtual from '@/components/ResourceListTableVirtual.vue';
210
176
  import ResourceListTable from '@/components/ResourceListTable.vue';
211
177
  import { useCoreStore } from '@/stores/core';
212
178
  import { useFiltersStore } from '@/stores/filters';
213
- import { callAdminForthApi, currentQuery, getIcon, setQuery } from '@/utils';
179
+ import { callAdminForthApi, currentQuery, getIcon, setQuery, formatComponent } from '@/utils';
214
180
  import { computed, onMounted, onUnmounted, ref, watch, type Ref } from 'vue';
215
181
  import { useRoute } from 'vue-router';
216
182
  import { getCustomComponent, initThreeDotsDropdown, getList, startBulkAction } from '@/utils';
217
183
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
218
184
  import { Tooltip } from '@/afcl'
219
- import type { AdminForthComponentDeclarationFull } from '@/types/Common';
185
+ import type { AdminForthComponentDeclaration, AdminForthComponentDeclarationFull } from '@/types/Common';
220
186
 
221
187
 
222
188
  import {
@@ -31,12 +31,12 @@
31
31
  <!-- Modal header -->
32
32
  <div class="af-login-modal-header flex items-center justify-between flex-col p-4 md:p-5 border-b rounded-t dark:border-gray-600">
33
33
 
34
- <template v-if="coreStore?.config?.loginPageInjections?.panelHeader.length > 0">
34
+ <template v-if="coreStore?.config?.loginPageInjections?.panelHeader.length && coreStore?.config?.loginPageInjections?.panelHeader.length > 0">
35
35
  <component
36
36
  v-for="(c, index) in coreStore?.config?.loginPageInjections?.panelHeader || []"
37
37
  :key="index"
38
- :is="getCustomComponent(c)"
39
- :meta="c.meta"
38
+ :is="getCustomComponent(formatComponent(c))"
39
+ :meta="formatComponent(c).meta"
40
40
  />
41
41
  </template>
42
42
  <h3 v-else class="text-xl font-semibold text-lightLoginViewText dark:text-darkLoginViewTextColor">
@@ -55,7 +55,7 @@
55
55
  name="username"
56
56
  id="username"
57
57
  ref="usernameInput"
58
- @keydown.enter="passwordInput.focus()"
58
+ @keydown.enter="passwordInput?.focus()"
59
59
  class="w-full"
60
60
  placeholder="name@company.com" required />
61
61
  </div>
@@ -76,7 +76,7 @@
76
76
  </Input>
77
77
  </div>
78
78
 
79
- <div v-if="coreStore.config.rememberMeDuration"
79
+ <div v-if="coreStore?.config?.rememberMeDuration"
80
80
  class="flex items-start mb-5"
81
81
  :title="$t(`Stay logged in for {days}`, {days: coreStore.config.rememberMeDuration})"
82
82
  >
@@ -88,8 +88,8 @@
88
88
 
89
89
  <component
90
90
  v-for="c in coreStore?.config?.loginPageInjections?.underInputs || []"
91
- :is="getCustomComponent(c)"
92
- :meta="c.meta"
91
+ :is="getCustomComponent(formatComponent(c))"
92
+ :meta="formatComponent(c).meta"
93
93
  @update:disableLoginButton="setDisableLoginButton($event)"
94
94
  />
95
95
 
@@ -107,8 +107,8 @@
107
107
  </Button>
108
108
  <component
109
109
  v-for="c in coreStore?.config?.loginPageInjections?.underLoginButton || []"
110
- :is="getCustomComponent(c)"
111
- :meta="c.meta"
110
+ :is="getCustomComponent(formatComponent(c))"
111
+ :meta="formatComponent(c).meta"
112
112
  @update:disableLoginButton="setDisableLoginButton($event)"
113
113
  />
114
114
  </form>
@@ -124,7 +124,7 @@
124
124
 
125
125
  <script setup lang="ts">
126
126
 
127
- import { getCustomComponent } from '@/utils';
127
+ import { getCustomComponent, formatComponent } from '@/utils';
128
128
  import { onBeforeMount, onMounted, ref, computed } from 'vue';
129
129
  import { useCoreStore } from '@/stores/core';
130
130
  import { useUserStore } from '@/stores/user';
@@ -137,8 +137,8 @@ import ErrorMessage from '@/components/ErrorMessage.vue';
137
137
 
138
138
  const { t } = useI18n();
139
139
 
140
- const passwordInput = ref(null);
141
- const usernameInput = ref(null);
140
+ const passwordInput = ref<InstanceType<typeof Input> | null>(null);
141
+ const usernameInput = ref<InstanceType<typeof Input> | null>(null);
142
142
  const rememberMeValue= ref(false);
143
143
  const username = ref('');
144
144
  const password = ref('');
@@ -179,7 +179,7 @@ onMounted(async () => {
179
179
  username.value = demoUsername;
180
180
  password.value = demoPassword;
181
181
  }
182
- usernameInput.value.focus();
182
+ usernameInput.value?.focus();
183
183
  });
184
184
 
185
185
 
@@ -3,7 +3,7 @@
3
3
  <component
4
4
  v-if="!loading"
5
5
  v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.beforeBreadcrumbs || []"
6
- :is="getCustomComponent(c)"
6
+ :is="getCustomComponent(formatComponent(c as AdminForthComponentDeclarationFull))"
7
7
  :meta="(c as AdminForthComponentDeclarationFull).meta"
8
8
  :record="coreStore.record"
9
9
  :resource="coreStore.resource"
@@ -14,9 +14,9 @@
14
14
 
15
15
  <template v-for="action in coreStore.resource.options.actions.filter(a => a.showIn?.showButton)" :key="action.id">
16
16
  <component
17
- :is="action?.customComponent ? getCustomComponent(action.customComponent) : CallActionWrapper"
18
- :meta="action.customComponent?.meta"
19
- @callAction="(payload?) => startCustomAction(action.id, payload)"
17
+ :is="action?.customComponent ? getCustomComponent(formatComponent(action.customComponent)) : CallActionWrapper"
18
+ :meta="action.customComponent ? formatComponent(action.customComponent).meta : undefined"
19
+ @callAction="(payload?: any) => startCustomAction(action.id, payload)"
20
20
  :disabled="actionLoadingStates[action.id]"
21
21
  >
22
22
  <button
@@ -65,7 +65,7 @@
65
65
  <component
66
66
  v-if="!loading"
67
67
  v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.afterBreadcrumbs || []"
68
- :is="getCustomComponent(c)"
68
+ :is="getCustomComponent(formatComponent(c as AdminForthComponentDeclarationFull))"
69
69
  :meta="(c as AdminForthComponentDeclarationFull).meta"
70
70
  :record="coreStore.record"
71
71
  :resource="coreStore.resource"
@@ -95,7 +95,7 @@
95
95
  <template v-else>
96
96
  <template v-for="group in groups" :key="group.groupName">
97
97
  <ShowTable
98
- :columns="group.columns"
98
+ :columns="group.columns as any"
99
99
  :groupName="group.groupName"
100
100
  :noTitle="group.noTitle"
101
101
  :resource="coreStore.resource"
@@ -120,7 +120,7 @@
120
120
  <component
121
121
  v-if="!loading"
122
122
  v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.bottom || []"
123
- :is="getCustomComponent(c)"
123
+ :is="getCustomComponent(formatComponent(c as AdminForthComponentDeclarationFull))"
124
124
  :meta="(c as AdminForthComponentDeclarationFull).meta"
125
125
  :record="coreStore.record"
126
126
  :resource="coreStore.resource"
@@ -137,7 +137,7 @@
137
137
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
138
138
 
139
139
  import { useCoreStore } from '@/stores/core';
140
- import { getCustomComponent, checkAcessByAllowedActions, initThreeDotsDropdown } from '@/utils';
140
+ import { getCustomComponent, checkAcessByAllowedActions, initThreeDotsDropdown, formatComponent } from '@/utils';
141
141
  import { IconPenSolid, IconTrashBinSolid, IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
142
142
  import { onMounted, ref, computed } from 'vue';
143
143
  import { useRoute,useRouter } from 'vue-router';
@@ -148,7 +148,7 @@ import ShowTable from '@/components/ShowTable.vue';
148
148
  import { useAdminforth } from '@/adminforth';
149
149
  import { useI18n } from 'vue-i18n';
150
150
  import { getIcon } from '@/utils';
151
- import { type AdminForthComponentDeclarationFull, type AdminForthResourceColumnCommon, type FieldGroup } from '@/types/Common.js';
151
+ import { type AdminForthComponentDeclarationFull, type AdminForthResourceColumnCommon, type FieldGroup} from '@/types/Common.js';
152
152
  import CallActionWrapper from '@/components/CallActionWrapper.vue'
153
153
 
154
154
  const route = useRoute();
@@ -245,7 +245,7 @@ async function deleteRecord() {
245
245
 
246
246
  }
247
247
 
248
- async function startCustomAction(actionId: string, extra: any) {
248
+ async function startCustomAction(actionId: string, extra?: any) {
249
249
  actionLoadingStates.value[actionId] = true;
250
250
 
251
251
  const data = await callAdminForthApi({
@@ -5,7 +5,6 @@
5
5
  "compilerOptions": {
6
6
  "composite": true,
7
7
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
8
-
9
8
  "baseUrl": ".",
10
9
  "paths": {
11
10
  "@/*": ["./src/*"]