adminforth 1.5.4-next.9 → 1.5.5-next.0
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/auth.js +4 -4
- package/dist/auth.js.map +1 -1
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
- package/dist/dataConnectors/clickhouse.js +0 -1
- package/dist/dataConnectors/clickhouse.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.d.ts.map +1 -1
- package/dist/modules/codeInjector.js +7 -5
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/modules/configValidator.d.ts +11 -5
- package/dist/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +387 -379
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +32 -13
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/socketBroker.d.ts.map +1 -1
- package/dist/modules/socketBroker.js +0 -1
- package/dist/modules/socketBroker.js.map +1 -1
- package/dist/servers/express.d.ts.map +1 -1
- package/dist/servers/express.js +2 -3
- package/dist/servers/express.js.map +1 -1
- package/dist/spa/src/App.vue +8 -6
- package/dist/spa/src/afcl/Input.vue +1 -1
- package/dist/spa/src/afcl/Link.vue +9 -1
- package/dist/spa/src/afcl/LinkButton.vue +5 -3
- package/dist/spa/src/afcl/VerticalTabs.vue +1 -1
- package/dist/spa/src/components/AcceptModal.vue +1 -2
- package/dist/spa/src/components/ResourceListTable.vue +4 -3
- package/dist/spa/src/components/SkeleteLoader.vue +5 -10
- package/dist/spa/src/components/ValueRenderer.vue +13 -14
- package/dist/spa/src/spa_types/core.ts +2 -4
- package/dist/spa/src/stores/core.ts +15 -16
- package/dist/spa/src/stores/user.ts +0 -7
- package/dist/spa/src/types/Back.ts +310 -327
- package/dist/spa/src/types/Common.ts +220 -10
- package/dist/spa/src/types/FrontendAPI.ts +5 -4
- package/dist/spa/src/utils.ts +5 -1
- package/dist/spa/src/views/LoginView.vue +6 -1
- package/dist/spa/src/websocket.ts +3 -2
- package/dist/types/Back.d.ts +262 -287
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js +1 -46
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +194 -9
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js +47 -0
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +4 -4
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/package.json +4 -4
package/dist/types/Back.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Express } from 'express';
|
|
3
3
|
import type { Writable } from 'stream';
|
|
4
|
-
import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum, type AdminForthComponentDeclaration, type AdminForthResourceCommon, type AdminUser, type AllowedActionsResolved, type AdminForthBulkActionCommon, type AdminForthForeignResourceCommon, type AdminForthResourceColumnCommon } from './Common.js';
|
|
4
|
+
import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum, type AdminForthComponentDeclaration, type AdminForthResourceCommon, type AdminUser, type AllowedActionsResolved, type AdminForthBulkActionCommon, type AdminForthForeignResourceCommon, type AdminForthResourceColumnCommon, AdminForthResourceInputCommon, AdminForthComponentDeclarationFull, AdminForthConfigMenuItem, AnnouncementBadgeResponse } from './Common.js';
|
|
5
5
|
export interface ICodeInjector {
|
|
6
6
|
srcFoldersToSync: Object;
|
|
7
7
|
allComponentNames: Object;
|
|
@@ -273,7 +273,6 @@ export interface IAdminForth {
|
|
|
273
273
|
express: IHttpServer;
|
|
274
274
|
restApi: IAdminForthRestAPI;
|
|
275
275
|
activatedPlugins: Array<IAdminForthPlugin>;
|
|
276
|
-
baseUrlSlashed: string;
|
|
277
276
|
websocket: IWebSocketBroker;
|
|
278
277
|
statuses: {
|
|
279
278
|
dbDiscover: 'running' | 'done';
|
|
@@ -383,135 +382,6 @@ export interface IAdminForthPlugin {
|
|
|
383
382
|
*/
|
|
384
383
|
setupEndpoints(server: IHttpServer): void;
|
|
385
384
|
}
|
|
386
|
-
export declare enum AdminForthMenuTypes {
|
|
387
|
-
/**
|
|
388
|
-
* HEADING is just a label in the menu.
|
|
389
|
-
* Respect `label` and `icon` property in {@link AdminForthConfigMenuItem}
|
|
390
|
-
*/
|
|
391
|
-
heading = "heading",
|
|
392
|
-
/**
|
|
393
|
-
* GROUP is a group of menu items.
|
|
394
|
-
* Respects `label`, `icon` and `children` properties in {@link AdminForthConfigMenuItem}
|
|
395
|
-
* use @AdminForthMenuTypes.open to set if group is open by default
|
|
396
|
-
*/
|
|
397
|
-
group = "group",
|
|
398
|
-
/**
|
|
399
|
-
* RESOURCE is a link to a resource.
|
|
400
|
-
* Respects `label`, `icon`, `resourceId`, `homepage`, `isStaticRoute` properties in {@link AdminForthConfigMenuItem}
|
|
401
|
-
*/
|
|
402
|
-
resource = "resource",
|
|
403
|
-
/**
|
|
404
|
-
* PAGE is a link to a custom page.
|
|
405
|
-
* Respects `label`, `icon`, `path`, `component`, `homepage`, `isStaticRoute`, properties in {@link AdminForthConfigMenuItem}
|
|
406
|
-
*
|
|
407
|
-
* Example:
|
|
408
|
-
*
|
|
409
|
-
* ```ts
|
|
410
|
-
* \{
|
|
411
|
-
* type: AdminForthMenuTypes.PAGE,
|
|
412
|
-
* label: 'Custom Page',
|
|
413
|
-
* icon: 'home',
|
|
414
|
-
* path: '/dash',
|
|
415
|
-
* component: '@@/Dashboard.vue',
|
|
416
|
-
* homepage: true,
|
|
417
|
-
* \}
|
|
418
|
-
* ```
|
|
419
|
-
*
|
|
420
|
-
*/
|
|
421
|
-
page = "page",
|
|
422
|
-
/**
|
|
423
|
-
* GAP ads some space between menu items.
|
|
424
|
-
*/
|
|
425
|
-
gap = "gap",
|
|
426
|
-
/**
|
|
427
|
-
* DIVIDER is a divider between menu items.
|
|
428
|
-
*/
|
|
429
|
-
divider = "divider"
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Menu item which displayed in the left sidebar of the admin panel.
|
|
433
|
-
*/
|
|
434
|
-
export interface AdminForthConfigMenuItem {
|
|
435
|
-
type?: AdminForthMenuTypes | keyof typeof AdminForthMenuTypes;
|
|
436
|
-
/**
|
|
437
|
-
* Label for menu item which will be displayed in the admin panel.
|
|
438
|
-
*/
|
|
439
|
-
label?: string;
|
|
440
|
-
/**
|
|
441
|
-
* Icon for menu item which will be displayed in the admin panel.
|
|
442
|
-
* Supports iconify icons in format `<icon set name>:<icon name>`
|
|
443
|
-
* Browse available icons here: https://icon-sets.iconify.design/
|
|
444
|
-
*
|
|
445
|
-
* Example:
|
|
446
|
-
*
|
|
447
|
-
* ```ts
|
|
448
|
-
* icon: 'flowbite:brain-solid',
|
|
449
|
-
* ```
|
|
450
|
-
*
|
|
451
|
-
*/
|
|
452
|
-
icon?: string;
|
|
453
|
-
/**
|
|
454
|
-
* Path to custom component which will be displayed in the admin panel.
|
|
455
|
-
*
|
|
456
|
-
*/
|
|
457
|
-
path?: string;
|
|
458
|
-
/**
|
|
459
|
-
* Component to be used for this menu item. Component should be placed in custom folder and referenced with `@@/` prefix.
|
|
460
|
-
* Supported for AdminForthMenuTypes.PAGE only!
|
|
461
|
-
* Example:
|
|
462
|
-
*
|
|
463
|
-
* ```ts
|
|
464
|
-
* component: '@@/Dashboard.vue',
|
|
465
|
-
* ```
|
|
466
|
-
*
|
|
467
|
-
*/
|
|
468
|
-
component?: string;
|
|
469
|
-
/**
|
|
470
|
-
* Resource ID which will be used to fetch data from.
|
|
471
|
-
* Supported for AdminForthMenuTypes.RESOURCE only!
|
|
472
|
-
*
|
|
473
|
-
*/
|
|
474
|
-
resourceId?: string;
|
|
475
|
-
/**
|
|
476
|
-
* If true, group will be open by default after user login to the admin panel.
|
|
477
|
-
* Also will be used to redirect from root path.
|
|
478
|
-
*/
|
|
479
|
-
homepage?: boolean;
|
|
480
|
-
/**
|
|
481
|
-
* Where Group is open by default
|
|
482
|
-
* Supported for AdminForthMenuTypes.GROUP only!
|
|
483
|
-
*
|
|
484
|
-
*/
|
|
485
|
-
open?: boolean;
|
|
486
|
-
/**
|
|
487
|
-
* Children menu items which will be displayed in this group.
|
|
488
|
-
* Supported for AdminForthMenuTypes.GROUP only!
|
|
489
|
-
*/
|
|
490
|
-
children?: Array<AdminForthConfigMenuItem>;
|
|
491
|
-
/**
|
|
492
|
-
* By default all pages are imported dynamically with lazy import().
|
|
493
|
-
* If you wish to import page statically, set this option to true.
|
|
494
|
-
* Homepage will be imported statically by default. but you can override it with this option.
|
|
495
|
-
*/
|
|
496
|
-
isStaticRoute?: boolean;
|
|
497
|
-
meta?: {
|
|
498
|
-
title?: string;
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* Optional callback which will be called before rendering the menu for each item.
|
|
502
|
-
* You can use it to hide menu items depending on some user
|
|
503
|
-
*/
|
|
504
|
-
visible?: (user: AdminUser) => boolean;
|
|
505
|
-
/**
|
|
506
|
-
* Optional callback which will be called before rendering the menu for each item.
|
|
507
|
-
* Result of callback if not null will be used as a small badge near the menu item.
|
|
508
|
-
*/
|
|
509
|
-
badge?: string | ((user: AdminUser) => Promise<string>);
|
|
510
|
-
/**
|
|
511
|
-
* Item id will be automatically generated from hashed resourceId+Path+label
|
|
512
|
-
*/
|
|
513
|
-
_itemId?: string;
|
|
514
|
-
}
|
|
515
385
|
/**
|
|
516
386
|
* Modify query to change how data is fetched from database.
|
|
517
387
|
* Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
|
|
@@ -615,10 +485,227 @@ export type AdminForthDataSource = {
|
|
|
615
485
|
*/
|
|
616
486
|
url: string;
|
|
617
487
|
};
|
|
488
|
+
type AdminForthPageDeclaration = {
|
|
489
|
+
path: string;
|
|
490
|
+
component: AdminForthComponentDeclaration;
|
|
491
|
+
};
|
|
492
|
+
interface AdminForthInputConfigCustomization {
|
|
493
|
+
/**
|
|
494
|
+
* Your app name
|
|
495
|
+
*/
|
|
496
|
+
brandName?: string;
|
|
497
|
+
/**
|
|
498
|
+
* Whether to show brand name in sidebar
|
|
499
|
+
* default is true
|
|
500
|
+
*/
|
|
501
|
+
showBrandNameInSidebar?: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Path to your app logo
|
|
504
|
+
*
|
|
505
|
+
* Example:
|
|
506
|
+
* Place file `logo.svg` to `./custom` folder and set this option:
|
|
507
|
+
*
|
|
508
|
+
* ```ts
|
|
509
|
+
* brandLogo: '@@/logo.svg',
|
|
510
|
+
* ```
|
|
511
|
+
*
|
|
512
|
+
*/
|
|
513
|
+
brandLogo?: string;
|
|
514
|
+
/**
|
|
515
|
+
* Path to your app favicon
|
|
516
|
+
*
|
|
517
|
+
* Example:
|
|
518
|
+
* Place file `favicon.png` to `./custom` folder and set this option:
|
|
519
|
+
*
|
|
520
|
+
* ```ts
|
|
521
|
+
* favicon: '@@/favicon.png',
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
favicon?: string;
|
|
525
|
+
/**
|
|
526
|
+
* DayJS format string for all dates in the app.
|
|
527
|
+
* Defaulted to 'MMM D, YYYY'
|
|
528
|
+
*/
|
|
529
|
+
datesFormat?: string;
|
|
530
|
+
/**
|
|
531
|
+
* DayJS format string for all datetimes in the app.
|
|
532
|
+
* Defaulted to 'HH:mm:ss'
|
|
533
|
+
*/
|
|
534
|
+
timeFormat?: string;
|
|
535
|
+
/**
|
|
536
|
+
* HTML title tag value, defaults to brandName
|
|
537
|
+
*/
|
|
538
|
+
title?: string;
|
|
539
|
+
/**
|
|
540
|
+
* Placeholder for empty fields in lists and show views, by default empty string ''
|
|
541
|
+
*/
|
|
542
|
+
emptyFieldPlaceholder?: {
|
|
543
|
+
show?: string;
|
|
544
|
+
list?: string;
|
|
545
|
+
} | string;
|
|
546
|
+
/**
|
|
547
|
+
* Relative or absolute path to custom components directory
|
|
548
|
+
* By default equals `./custom`.
|
|
549
|
+
*
|
|
550
|
+
* Custom .vue files, images, and any other assets placed in this directory can be accessed in AdminForth components and configs with `@@/`.
|
|
551
|
+
*
|
|
552
|
+
* For example if file path is `./custom/comp/my.vue`, you can use it in AdminForth config like this:
|
|
553
|
+
*
|
|
554
|
+
* ```ts
|
|
555
|
+
* components: {
|
|
556
|
+
* show: '@@/comp/my.vue',
|
|
557
|
+
* }
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
*/
|
|
561
|
+
customComponentsDir?: string;
|
|
562
|
+
/**
|
|
563
|
+
* Path to custom .ts file which allows to inject custom Vue uses in SPA or add custom imports.
|
|
564
|
+
*
|
|
565
|
+
* Example: Create file: `./custom/vue-uses.ts` with next content:
|
|
566
|
+
*
|
|
567
|
+
* ```ts
|
|
568
|
+
* import HighchartsVue from 'highcharts-vue';
|
|
569
|
+
* // import '@@/custom.scss'; // here is how you can import custom styles
|
|
570
|
+
*
|
|
571
|
+
* export default function (app) {
|
|
572
|
+
* app.use(HighchartsVue);
|
|
573
|
+
* }
|
|
574
|
+
* ```
|
|
575
|
+
*
|
|
576
|
+
* Install HighCharts into custom folder:
|
|
577
|
+
*
|
|
578
|
+
* ```bashcreating rec
|
|
579
|
+
* cd custom
|
|
580
|
+
* npm init -y
|
|
581
|
+
* npm install highcharts highcharts-vue
|
|
582
|
+
* ```
|
|
583
|
+
*
|
|
584
|
+
* And specify vueUsesFile in AdminForth config:
|
|
585
|
+
*
|
|
586
|
+
* ```ts
|
|
587
|
+
* vueUsesFile: '@@/vue-uses.ts',
|
|
588
|
+
* ```
|
|
589
|
+
*
|
|
590
|
+
*/
|
|
591
|
+
vueUsesFile?: string;
|
|
592
|
+
/**
|
|
593
|
+
* Object to redefine default styles for AdminForth components. Use this file as reference for all possible adjustments https://github.com/devforth/adminforth/blob/main/adminforth/modules/styles.ts
|
|
594
|
+
*/
|
|
595
|
+
styles?: Object;
|
|
596
|
+
/**
|
|
597
|
+
* Description of custom pages which will let register custom pages for custom routes in AdminForth.
|
|
598
|
+
*/
|
|
599
|
+
customPages?: Array<AdminForthPageDeclaration>;
|
|
600
|
+
/**
|
|
601
|
+
* Function to return custom badge in side bar for users. Can return text or html
|
|
602
|
+
* If function is not passed or returns null, badge will not be shown.
|
|
603
|
+
* Execution is done on admin app load.
|
|
604
|
+
*/
|
|
605
|
+
announcementBadge?: (user: AdminUser) => AnnouncementBadgeResponse;
|
|
606
|
+
/**
|
|
607
|
+
* Custom panel components or array of components which will be displayed in the login form
|
|
608
|
+
* right after the inputs. Use it to add custom authorization methods like social login or other custom fields e.g. 'reset'
|
|
609
|
+
* password link.
|
|
610
|
+
*/
|
|
611
|
+
loginPageInjections?: {
|
|
612
|
+
underInputs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Custom panel components or array of components which will be displayed in different parts of the admin panel.
|
|
616
|
+
*/
|
|
617
|
+
globalInjections?: {
|
|
618
|
+
userMenu?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
619
|
+
header?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
620
|
+
sidebar?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
export interface AdminForthResourceInput extends Omit<AdminForthResourceInputCommon, 'columns' | 'hooks' | 'options'> {
|
|
624
|
+
/**
|
|
625
|
+
* Array of plugins which will be used to modify resource configuration.
|
|
626
|
+
*
|
|
627
|
+
*/
|
|
628
|
+
plugins?: Array<IAdminForthPlugin>;
|
|
629
|
+
/**
|
|
630
|
+
* Hooks allow you to change the data on different stages of resource lifecycle.
|
|
631
|
+
* Hooks are functions which will be called on backend side (only backend side).
|
|
632
|
+
*/
|
|
633
|
+
hooks?: {
|
|
634
|
+
show?: {
|
|
635
|
+
/**
|
|
636
|
+
* Typical use-cases:
|
|
637
|
+
* - request additional data from database before returning to frontend for soft-join
|
|
638
|
+
*/
|
|
639
|
+
beforeDatasourceRequest?: BeforeDataSourceRequestFunction | Array<BeforeDataSourceRequestFunction>;
|
|
640
|
+
/**
|
|
641
|
+
* Typical use-cases:
|
|
642
|
+
* - Transform value for some field for record returned from database before returning to frontend (minimize, sanitize, etc)
|
|
643
|
+
* - If some-why you can't use `backendOnly` you can cleanup sensitive fields here
|
|
644
|
+
* - Attach additional data to record before returning to frontend
|
|
645
|
+
*/
|
|
646
|
+
afterDatasourceResponse?: AfterDataSourceResponseFunction | Array<AfterDataSourceResponseFunction>;
|
|
647
|
+
};
|
|
648
|
+
list?: {
|
|
649
|
+
/**
|
|
650
|
+
* Typical use-cases:
|
|
651
|
+
* - add additional filters in addition to what user selected before fetching data from database.
|
|
652
|
+
* - same as hooks.show.beforeDatasourceRequest
|
|
653
|
+
*/
|
|
654
|
+
beforeDatasourceRequest?: BeforeDataSourceRequestFunction | Array<BeforeDataSourceRequestFunction>;
|
|
655
|
+
/**
|
|
656
|
+
* Typical use-cases:
|
|
657
|
+
* - Same as hooks.show.afterDatasourceResponse but applied for all records returned from database for
|
|
658
|
+
* showing in list view, e.g. add new field to each record in list view
|
|
659
|
+
*/
|
|
660
|
+
afterDatasourceResponse?: AfterDataSourceResponseFunction | Array<AfterDataSourceResponseFunction>;
|
|
661
|
+
};
|
|
662
|
+
create?: {
|
|
663
|
+
/**
|
|
664
|
+
* Typical use-cases:
|
|
665
|
+
* - Validate record before saving to database and interrupt execution if validation failed (`allowedActions.create` should be preferred in most cases)
|
|
666
|
+
* - fill-in adminUser as creator of record
|
|
667
|
+
* - Attach additional data to record before saving to database (mostly fillOnCreate should be used instead)
|
|
668
|
+
*/
|
|
669
|
+
beforeSave?: BeforeSaveFunction | Array<BeforeSaveFunction>;
|
|
670
|
+
/**
|
|
671
|
+
* Typical use-cases:
|
|
672
|
+
* - Initiate some trigger after record saved to database (e.g sync to another datasource)
|
|
673
|
+
*/
|
|
674
|
+
afterSave?: AfterSaveFunction | Array<AfterSaveFunction>;
|
|
675
|
+
};
|
|
676
|
+
edit?: {
|
|
677
|
+
/**
|
|
678
|
+
* Typical use-cases:
|
|
679
|
+
* - Same as hooks.create.beforeSave but for edit page
|
|
680
|
+
*/
|
|
681
|
+
beforeSave?: BeforeSaveFunction | Array<BeforeSaveFunction>;
|
|
682
|
+
/**
|
|
683
|
+
* Typical use-cases:
|
|
684
|
+
* - Same as hooks.create.afterSave but for edit page
|
|
685
|
+
*/
|
|
686
|
+
afterSave?: AfterSaveFunction | Array<AfterSaveFunction>;
|
|
687
|
+
};
|
|
688
|
+
delete?: {
|
|
689
|
+
/**
|
|
690
|
+
* Typical use-cases:
|
|
691
|
+
* - Validate that record can be deleted and interrupt execution if validation failed (`allowedActions.delete` should be preferred in most cases)
|
|
692
|
+
*/
|
|
693
|
+
beforeSave?: BeforeSaveFunction | Array<BeforeSaveFunction>;
|
|
694
|
+
/**
|
|
695
|
+
* Typical use-cases:
|
|
696
|
+
* - Initiate some trigger after record deleted from database (e.g sync to another datasource)
|
|
697
|
+
*/
|
|
698
|
+
afterSave?: BeforeSaveFunction | Array<BeforeSaveFunction>;
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
options?: ResourceOptionsInput;
|
|
702
|
+
columns: Array<AdminForthResourceColumn>;
|
|
703
|
+
dataSourceColumns?: Array<AdminForthResourceColumn>;
|
|
704
|
+
}
|
|
618
705
|
/**
|
|
619
706
|
* Main configuration object for AdminForth
|
|
620
707
|
*/
|
|
621
|
-
export interface
|
|
708
|
+
export interface AdminForthInputConfig {
|
|
622
709
|
/**
|
|
623
710
|
* Authorization module configuration
|
|
624
711
|
*/
|
|
@@ -706,7 +793,7 @@ export interface AdminForthConfig {
|
|
|
706
793
|
* Resource represents one table or collection in database.
|
|
707
794
|
* Each resource has its own configuration.
|
|
708
795
|
*/
|
|
709
|
-
resources: Array<
|
|
796
|
+
resources: Array<AdminForthResourceInput>;
|
|
710
797
|
/**
|
|
711
798
|
* Array of left sidebar menu items which will be displayed in the admin panel.
|
|
712
799
|
* Menu items can be links to resources or custom pages.
|
|
@@ -731,150 +818,7 @@ export interface AdminForthConfig {
|
|
|
731
818
|
* Settings which allow you to customize AdminForth
|
|
732
819
|
*
|
|
733
820
|
*/
|
|
734
|
-
customization?:
|
|
735
|
-
/**
|
|
736
|
-
* Your app name
|
|
737
|
-
*/
|
|
738
|
-
brandName?: string;
|
|
739
|
-
/**
|
|
740
|
-
* Slug which will be used on tech side e.g. to store cookies separately.
|
|
741
|
-
* Created automatically from brandName if not set.
|
|
742
|
-
*/
|
|
743
|
-
_brandNameSlug?: string;
|
|
744
|
-
/**
|
|
745
|
-
* Whether to show brand name in sidebar
|
|
746
|
-
* default is true
|
|
747
|
-
*/
|
|
748
|
-
showBrandNameInSidebar?: boolean;
|
|
749
|
-
/**
|
|
750
|
-
* Path to your app logo
|
|
751
|
-
*
|
|
752
|
-
* Example:
|
|
753
|
-
* Place file `logo.svg` to `./custom` folder and set this option:
|
|
754
|
-
*
|
|
755
|
-
* ```ts
|
|
756
|
-
* brandLogo: '@@/logo.svg',
|
|
757
|
-
* ```
|
|
758
|
-
*
|
|
759
|
-
*/
|
|
760
|
-
brandLogo?: string;
|
|
761
|
-
/**
|
|
762
|
-
* Path to your app favicon
|
|
763
|
-
*
|
|
764
|
-
* Example:
|
|
765
|
-
* Place file `favicon.png` to `./custom` folder and set this option:
|
|
766
|
-
*
|
|
767
|
-
* ```ts
|
|
768
|
-
* favicon: '@@/favicon.png',
|
|
769
|
-
* ```
|
|
770
|
-
*/
|
|
771
|
-
favicon?: string;
|
|
772
|
-
/**
|
|
773
|
-
* DayJS format string for all dates in the app.
|
|
774
|
-
* Defaulted to 'MMM D, YYYY'
|
|
775
|
-
*/
|
|
776
|
-
datesFormat?: string;
|
|
777
|
-
/**
|
|
778
|
-
* DayJS format string for all datetimes in the app.
|
|
779
|
-
* Defaulted to 'HH:mm:ss'
|
|
780
|
-
*/
|
|
781
|
-
timeFormat?: string;
|
|
782
|
-
/**
|
|
783
|
-
* HTML title tag value, defaults to brandName
|
|
784
|
-
*/
|
|
785
|
-
title?: string;
|
|
786
|
-
/**
|
|
787
|
-
* Placeholder for empty fields in lists and show views, by default empty string ''
|
|
788
|
-
*/
|
|
789
|
-
emptyFieldPlaceholder?: {
|
|
790
|
-
show?: string;
|
|
791
|
-
list?: string;
|
|
792
|
-
} | string;
|
|
793
|
-
/**
|
|
794
|
-
* Relative or absolute path to custom components directory
|
|
795
|
-
* By default equals `./custom`.
|
|
796
|
-
*
|
|
797
|
-
* Custom .vue files, images, and any other assets placed in this directory can be accessed in AdminForth components and configs with `@@/`.
|
|
798
|
-
*
|
|
799
|
-
* For example if file path is `./custom/comp/my.vue`, you can use it in AdminForth config like this:
|
|
800
|
-
*
|
|
801
|
-
* ```ts
|
|
802
|
-
* components: {
|
|
803
|
-
* show: '@@/comp/my.vue',
|
|
804
|
-
* }
|
|
805
|
-
* ```
|
|
806
|
-
*
|
|
807
|
-
*/
|
|
808
|
-
customComponentsDir?: string;
|
|
809
|
-
/**
|
|
810
|
-
* Path to custom .ts file which allows to inject custom Vue uses in SPA or add custom imports.
|
|
811
|
-
*
|
|
812
|
-
* Example: Create file: `./custom/vue-uses.ts` with next content:
|
|
813
|
-
*
|
|
814
|
-
* ```ts
|
|
815
|
-
* import HighchartsVue from 'highcharts-vue';
|
|
816
|
-
* // import '@@/custom.scss'; // here is how you can import custom styles
|
|
817
|
-
*
|
|
818
|
-
* export default function (app) {
|
|
819
|
-
* app.use(HighchartsVue);
|
|
820
|
-
* }
|
|
821
|
-
* ```
|
|
822
|
-
*
|
|
823
|
-
* Install HighCharts into custom folder:
|
|
824
|
-
*
|
|
825
|
-
* ```bashcreating rec
|
|
826
|
-
* cd custom
|
|
827
|
-
* npm init -y
|
|
828
|
-
* npm install highcharts highcharts-vue
|
|
829
|
-
* ```
|
|
830
|
-
*
|
|
831
|
-
* And specify vueUsesFile in AdminForth config:
|
|
832
|
-
*
|
|
833
|
-
* ```ts
|
|
834
|
-
* vueUsesFile: '@@/vue-uses.ts',
|
|
835
|
-
* ```
|
|
836
|
-
*
|
|
837
|
-
*/
|
|
838
|
-
vueUsesFile?: string;
|
|
839
|
-
/**
|
|
840
|
-
* Object to redefine default styles for AdminForth components. Use this file as reference for all possible adjustments https://github.com/devforth/adminforth/blob/main/adminforth/modules/styles.ts
|
|
841
|
-
*/
|
|
842
|
-
styles?: Object;
|
|
843
|
-
/**
|
|
844
|
-
* Description of custom pages which will let register custom pages for custom routes in AdminForth.
|
|
845
|
-
*/
|
|
846
|
-
customPages?: Array<{
|
|
847
|
-
path: string;
|
|
848
|
-
component: AdminForthComponentDeclaration;
|
|
849
|
-
}>;
|
|
850
|
-
/**
|
|
851
|
-
* Function to return custom badge in side bar for users. Can return text or html
|
|
852
|
-
* If function is not passed or returns null, badge will not be shown.
|
|
853
|
-
* Execution is done on admin app load.
|
|
854
|
-
*/
|
|
855
|
-
announcementBadge?: (user: AdminUser) => {
|
|
856
|
-
text?: string;
|
|
857
|
-
html?: string;
|
|
858
|
-
closable?: boolean;
|
|
859
|
-
title?: string;
|
|
860
|
-
} | null;
|
|
861
|
-
/**
|
|
862
|
-
* Custom panel components or array of components which will be displayed in the login form
|
|
863
|
-
* right after the inputs. Use it to add custom authorization methods like social login or other custom fields e.g. 'reset'
|
|
864
|
-
* password link.
|
|
865
|
-
*/
|
|
866
|
-
loginPageInjections?: {
|
|
867
|
-
underInputs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
868
|
-
};
|
|
869
|
-
/**
|
|
870
|
-
* Custom panel components or array of components which will be displayed in different parts of the admin panel.
|
|
871
|
-
*/
|
|
872
|
-
globalInjections?: {
|
|
873
|
-
userMenu?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
874
|
-
header?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
875
|
-
sidebar?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
876
|
-
};
|
|
877
|
-
};
|
|
821
|
+
customization?: AdminForthInputConfigCustomization;
|
|
878
822
|
/**
|
|
879
823
|
* If you want to Serve AdminForth from a subdirectory, e.g. on example.com/backoffice, you can specify it like:
|
|
880
824
|
*
|
|
@@ -884,11 +828,32 @@ export interface AdminForthConfig {
|
|
|
884
828
|
*
|
|
885
829
|
*/
|
|
886
830
|
baseUrl?: string;
|
|
831
|
+
}
|
|
832
|
+
export interface AdminForthConfigCustomization extends Omit<AdminForthInputConfigCustomization, 'loginPageInjections' | 'globalInjections'> {
|
|
833
|
+
brandName: string;
|
|
834
|
+
dateFormats: string;
|
|
835
|
+
timeFormat: string;
|
|
887
836
|
/**
|
|
888
|
-
*
|
|
889
|
-
*
|
|
837
|
+
* Slug which will be used on tech side e.g. to store cookies separately.
|
|
838
|
+
* Created automatically from brandName if not set.
|
|
890
839
|
*/
|
|
891
|
-
|
|
840
|
+
brandNameSlug: string;
|
|
841
|
+
showBrandNameInSidebar: boolean;
|
|
842
|
+
customPages: Array<AdminForthPageDeclaration>;
|
|
843
|
+
loginPageInjections: {
|
|
844
|
+
underInputs: Array<AdminForthComponentDeclarationFull>;
|
|
845
|
+
};
|
|
846
|
+
globalInjections: {
|
|
847
|
+
userMenu: Array<AdminForthComponentDeclarationFull>;
|
|
848
|
+
header: Array<AdminForthComponentDeclarationFull>;
|
|
849
|
+
sidebar: Array<AdminForthComponentDeclarationFull>;
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
export interface AdminForthConfig extends Omit<AdminForthInputConfig, 'customization' | 'resources'> {
|
|
853
|
+
baseUrl: string;
|
|
854
|
+
baseUrlSlashed: string;
|
|
855
|
+
customization: AdminForthConfigCustomization;
|
|
856
|
+
resources: Array<AdminForthResource>;
|
|
892
857
|
}
|
|
893
858
|
export type FDataFilter = (field: string, value: any) => IAdminForthFilter;
|
|
894
859
|
export declare class Filters {
|
|
@@ -943,15 +908,18 @@ export type AllowedActionValue = boolean | (({ adminUser, resource, meta, source
|
|
|
943
908
|
/**
|
|
944
909
|
* Object which describes allowed actions for user.
|
|
945
910
|
*/
|
|
946
|
-
export type
|
|
911
|
+
export type AllowedActionsInput = {
|
|
947
912
|
[key in AllowedActionsEnum]?: AllowedActionValue;
|
|
948
913
|
} & {
|
|
949
914
|
all?: AllowedActionValue;
|
|
950
915
|
};
|
|
916
|
+
export type AllowedActions = {
|
|
917
|
+
[key in AllowedActionsEnum]: AllowedActionValue;
|
|
918
|
+
};
|
|
951
919
|
/**
|
|
952
920
|
* General options for resource.
|
|
953
921
|
*/
|
|
954
|
-
export
|
|
922
|
+
export interface ResourceOptionsInput extends Omit<AdminForthResourceCommon['options'], 'allowedActions' | 'bulkActions'> {
|
|
955
923
|
/**
|
|
956
924
|
* Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
|
|
957
925
|
* using checkboxes.
|
|
@@ -973,13 +941,16 @@ export type ResourceOptions = Omit<AdminForthResourceCommon['options'], 'allowed
|
|
|
973
941
|
* ```
|
|
974
942
|
*
|
|
975
943
|
*/
|
|
976
|
-
allowedActions?:
|
|
977
|
-
}
|
|
944
|
+
allowedActions?: AllowedActionsInput;
|
|
945
|
+
}
|
|
946
|
+
export interface ResourceOptions extends Omit<ResourceOptionsInput, 'allowedActions'> {
|
|
947
|
+
allowedActions: AllowedActions;
|
|
948
|
+
}
|
|
978
949
|
/**
|
|
979
950
|
* Resource describes one table or collection in database.
|
|
980
951
|
* AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
|
|
981
952
|
*/
|
|
982
|
-
export interface AdminForthResource extends Omit<
|
|
953
|
+
export interface AdminForthResource extends Omit<AdminForthResourceInput, 'options'> {
|
|
983
954
|
/**
|
|
984
955
|
* Array of plugins which will be used to modify resource configuration.
|
|
985
956
|
*
|
|
@@ -1057,9 +1028,12 @@ export interface AdminForthResource extends Omit<AdminForthResourceCommon, 'opti
|
|
|
1057
1028
|
afterSave?: BeforeSaveFunction | Array<BeforeSaveFunction>;
|
|
1058
1029
|
};
|
|
1059
1030
|
};
|
|
1060
|
-
options
|
|
1031
|
+
options: ResourceOptions;
|
|
1061
1032
|
columns: Array<AdminForthResourceColumn>;
|
|
1062
|
-
dataSourceColumns
|
|
1033
|
+
dataSourceColumns: Array<AdminForthResourceColumn>;
|
|
1034
|
+
recordLabel: (record: any) => string;
|
|
1035
|
+
label: string;
|
|
1036
|
+
resourceId: string;
|
|
1063
1037
|
}
|
|
1064
1038
|
export interface AdminForthBulkAction extends AdminForthBulkActionCommon {
|
|
1065
1039
|
/**
|
|
@@ -1160,4 +1134,5 @@ export interface IWebSocketBroker {
|
|
|
1160
1134
|
publish: (topic: string, data: any) => void;
|
|
1161
1135
|
registerWsClient: (client: IWebSocketClient) => void;
|
|
1162
1136
|
}
|
|
1137
|
+
export {};
|
|
1163
1138
|
//# sourceMappingURL=Back.d.ts.map
|