adminforth 2.17.0-next.6 → 2.17.0-next.61
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/commands/callTsProxy.js +2 -1
- package/commands/createApp/templates/adminuser.ts.hbs +2 -1
- package/commands/createApp/templates/index.ts.hbs +3 -2
- package/commands/createCustomComponent/main.js +0 -3
- package/commands/createCustomComponent/templates/customCrud/afterBreadcrumbs.vue.hbs +4 -2
- package/commands/createCustomComponent/templates/customCrud/beforeActionButtons.vue.hbs +3 -2
- package/commands/createCustomComponent/templates/customCrud/beforeBreadcrumbs.vue.hbs +4 -2
- package/commands/createCustomComponent/templates/customCrud/bottom.vue.hbs +4 -2
- package/commands/createCustomComponent/templates/customCrud/threeDotsDropdownItems.vue.hbs +4 -2
- package/commands/createPlugin/templates/index.ts.hbs +4 -0
- package/dist/auth.d.ts +2 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +17 -10
- package/dist/auth.js.map +1 -1
- package/dist/basePlugin.d.ts +1 -0
- package/dist/basePlugin.d.ts.map +1 -1
- package/dist/basePlugin.js +4 -2
- package/dist/basePlugin.js.map +1 -1
- package/dist/dataConnectors/baseConnector.d.ts +4 -0
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
- package/dist/dataConnectors/baseConnector.js +103 -14
- package/dist/dataConnectors/baseConnector.js.map +1 -1
- package/dist/dataConnectors/clickhouse.d.ts +2 -0
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
- package/dist/dataConnectors/clickhouse.js +15 -4
- package/dist/dataConnectors/clickhouse.js.map +1 -1
- package/dist/dataConnectors/mongo.d.ts +8 -1
- package/dist/dataConnectors/mongo.d.ts.map +1 -1
- package/dist/dataConnectors/mongo.js +72 -28
- package/dist/dataConnectors/mongo.js.map +1 -1
- package/dist/dataConnectors/mysql.d.ts +2 -0
- package/dist/dataConnectors/mysql.d.ts.map +1 -1
- package/dist/dataConnectors/mysql.js +22 -23
- package/dist/dataConnectors/mysql.js.map +1 -1
- package/dist/dataConnectors/postgres.d.ts +2 -0
- package/dist/dataConnectors/postgres.d.ts.map +1 -1
- package/dist/dataConnectors/postgres.js +23 -26
- package/dist/dataConnectors/postgres.js.map +1 -1
- package/dist/dataConnectors/sqlite.d.ts +2 -0
- package/dist/dataConnectors/sqlite.d.ts.map +1 -1
- package/dist/dataConnectors/sqlite.js +19 -19
- package/dist/dataConnectors/sqlite.js.map +1 -1
- package/dist/index.d.ts +21 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77 -54
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.d.ts.map +1 -1
- package/dist/modules/codeInjector.js +45 -63
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +14 -9
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/logger.d.ts +5 -0
- package/dist/modules/logger.d.ts.map +1 -0
- package/dist/modules/logger.js +16 -0
- package/dist/modules/logger.js.map +1 -0
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +31 -24
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/socketBroker.d.ts.map +1 -1
- package/dist/modules/socketBroker.js +6 -5
- package/dist/modules/socketBroker.js.map +1 -1
- package/dist/modules/styles.js +1 -1
- package/dist/servers/express.d.ts.map +1 -1
- package/dist/servers/express.js +11 -11
- package/dist/servers/express.js.map +1 -1
- package/dist/spa/package-lock.json +0 -13
- package/dist/spa/package.json +0 -1
- package/dist/spa/src/App.vue +6 -3
- package/dist/spa/src/adminforth.ts +60 -1
- package/dist/spa/src/afcl/DatePicker.vue +0 -1
- package/dist/spa/src/afcl/Dialog.vue +2 -2
- package/dist/spa/src/afcl/Dropzone.vue +6 -4
- package/dist/spa/src/afcl/Select.vue +1 -1
- package/dist/spa/src/afcl/Table.vue +7 -5
- package/dist/spa/src/afcl/Tooltip.vue +38 -4
- package/dist/spa/src/components/ColumnValueInput.vue +14 -1
- package/dist/spa/src/components/CustomDateRangePicker.vue +0 -2
- package/dist/spa/src/components/CustomRangePicker.vue +9 -6
- package/dist/spa/src/components/Filters.vue +4 -4
- package/dist/spa/src/components/ListActionsThreeDots.vue +235 -0
- package/dist/spa/src/components/ResourceForm.vue +4 -4
- package/dist/spa/src/components/ResourceListTable.vue +30 -16
- package/dist/spa/src/components/ResourceListTableVirtual.vue +34 -18
- package/dist/spa/src/components/Sidebar.vue +4 -2
- package/dist/spa/src/components/ThreeDotsMenu.vue +35 -20
- package/dist/spa/src/composables/useFrontendApi.ts +8 -4
- package/dist/spa/src/renderers/CompactField.vue +3 -2
- package/dist/spa/src/renderers/CompactUUID.vue +3 -2
- package/dist/spa/src/renderers/RichText.vue +15 -0
- package/dist/spa/src/stores/core.ts +3 -2
- package/dist/spa/src/stores/filters.ts +1 -1
- package/dist/spa/src/stores/toast.ts +1 -2
- package/dist/spa/src/types/Back.ts +419 -18
- package/dist/spa/src/types/Common.ts +7 -14
- package/dist/spa/src/types/FrontendAPI.ts +27 -11
- package/dist/spa/src/views/CreateView.vue +23 -31
- package/dist/spa/src/views/EditView.vue +27 -31
- package/dist/spa/src/views/ListView.vue +20 -10
- package/dist/spa/src/views/SettingsView.vue +3 -2
- package/dist/spa/src/views/ShowView.vue +7 -6
- package/dist/types/Back.d.ts +371 -44
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js +6 -0
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +8 -15
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js +2 -0
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +34 -11
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/package.json +4 -1
- package/commands/createCustomComponent/templates/customCrud/saveButton.vue.hbs +0 -28
package/dist/types/Back.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Express, Request } from 'express';
|
|
3
3
|
import type { Writable } from 'stream';
|
|
4
|
-
import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum, type AdminForthComponentDeclaration, type AdminUser, type AllowedActionsResolved, type AdminForthBulkActionCommon, type AdminForthForeignResourceCommon, type AdminForthResourceColumnCommon, type AdminForthResourceInputCommon, type AdminForthComponentDeclarationFull, type AdminForthConfigMenuItem, type AnnouncementBadgeResponse,
|
|
4
|
+
import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum, AdminForthResourcePages, type AdminForthComponentDeclaration, type AdminUser, type AllowedActionsResolved, type AdminForthBulkActionCommon, type AdminForthForeignResourceCommon, type AdminForthResourceColumnCommon, type AdminForthResourceInputCommon, type AdminForthComponentDeclarationFull, type AdminForthConfigMenuItem, type AnnouncementBadgeResponse, type AdminForthResourceColumnInputCommon } from './Common.js';
|
|
5
5
|
export interface ICodeInjector {
|
|
6
6
|
srcFoldersToSync: Object;
|
|
7
7
|
allComponentNames: Object;
|
|
@@ -87,7 +87,7 @@ export interface ITranslateExpressRequest extends Omit<Request, 'protocol' | 'pa
|
|
|
87
87
|
}
|
|
88
88
|
export interface IAdminForthSingleFilter {
|
|
89
89
|
field?: string;
|
|
90
|
-
operator?: AdminForthFilterOperators.EQ | AdminForthFilterOperators.NE | AdminForthFilterOperators.GT | AdminForthFilterOperators.LT | AdminForthFilterOperators.GTE | AdminForthFilterOperators.LTE | AdminForthFilterOperators.LIKE | AdminForthFilterOperators.ILIKE | AdminForthFilterOperators.IN | AdminForthFilterOperators.NIN;
|
|
90
|
+
operator?: AdminForthFilterOperators.EQ | AdminForthFilterOperators.NE | AdminForthFilterOperators.GT | AdminForthFilterOperators.LT | AdminForthFilterOperators.GTE | AdminForthFilterOperators.LTE | AdminForthFilterOperators.LIKE | AdminForthFilterOperators.ILIKE | AdminForthFilterOperators.IN | AdminForthFilterOperators.NIN | AdminForthFilterOperators.IS_EMPTY | AdminForthFilterOperators.IS_NOT_EMPTY;
|
|
91
91
|
value?: any;
|
|
92
92
|
rightField?: string;
|
|
93
93
|
insecureRawSQL?: string;
|
|
@@ -283,7 +283,7 @@ export interface IAdminForthAuth {
|
|
|
283
283
|
payload: {
|
|
284
284
|
name: string;
|
|
285
285
|
value: string;
|
|
286
|
-
expiry
|
|
286
|
+
expiry?: number;
|
|
287
287
|
expirySeconds: number;
|
|
288
288
|
httpOnly: boolean;
|
|
289
289
|
};
|
|
@@ -338,44 +338,9 @@ export interface IAdminForth {
|
|
|
338
338
|
};
|
|
339
339
|
formatAdminForth(): string;
|
|
340
340
|
tr(msg: string, category: string, lang: string, params: any, pluralizationNumber?: number): Promise<string>;
|
|
341
|
-
createResourceRecord(params:
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
adminUser: AdminUser;
|
|
345
|
-
extra?: HttpExtra;
|
|
346
|
-
}): Promise<{
|
|
347
|
-
error?: string;
|
|
348
|
-
createdRecord?: any;
|
|
349
|
-
newRecordId?: any;
|
|
350
|
-
}>;
|
|
351
|
-
updateResourceRecord(params: {
|
|
352
|
-
resource: AdminForthResource;
|
|
353
|
-
recordId: any;
|
|
354
|
-
record: any;
|
|
355
|
-
oldRecord: any;
|
|
356
|
-
adminUser: AdminUser;
|
|
357
|
-
extra?: HttpExtra;
|
|
358
|
-
updates?: never;
|
|
359
|
-
} | {
|
|
360
|
-
resource: AdminForthResource;
|
|
361
|
-
recordId: any;
|
|
362
|
-
record?: never;
|
|
363
|
-
oldRecord: any;
|
|
364
|
-
adminUser: AdminUser;
|
|
365
|
-
extra?: HttpExtra;
|
|
366
|
-
updates: any;
|
|
367
|
-
}): Promise<{
|
|
368
|
-
error?: string;
|
|
369
|
-
}>;
|
|
370
|
-
deleteResourceRecord(params: {
|
|
371
|
-
resource: AdminForthResource;
|
|
372
|
-
recordId: string;
|
|
373
|
-
adminUser: AdminUser;
|
|
374
|
-
record: any;
|
|
375
|
-
extra?: HttpExtra;
|
|
376
|
-
}): Promise<{
|
|
377
|
-
error?: string;
|
|
378
|
-
}>;
|
|
341
|
+
createResourceRecord(params: CreateResourceRecordParams): Promise<CreateResourceRecordResult>;
|
|
342
|
+
updateResourceRecord(params: UpdateResourceRecordParams): Promise<UpdateResourceRecordResult>;
|
|
343
|
+
deleteResourceRecord(params: DeleteResourceRecordParams): Promise<DeleteResourceRecordResult>;
|
|
379
344
|
auth: IAdminForthAuth;
|
|
380
345
|
/**
|
|
381
346
|
* Internal flag which indicates if AdminForth is running in hot reload mode.
|
|
@@ -464,6 +429,12 @@ export interface IAdminForthPlugin {
|
|
|
464
429
|
* @param pluginOptions - options of plugin
|
|
465
430
|
*/
|
|
466
431
|
instanceUniqueRepresentation(pluginOptions: any): string;
|
|
432
|
+
/**
|
|
433
|
+
* If this method returns true, AdminForth will allow only one instance of plugin per whole app
|
|
434
|
+
* (only for case when we are creating copy of resource and activating plugins)
|
|
435
|
+
* If false, multiple instances of plugin can be installed on different resources.
|
|
436
|
+
*/
|
|
437
|
+
shouldHaveSingleInstancePerWholeApp?(): boolean;
|
|
467
438
|
/**
|
|
468
439
|
* Optional method which will be called after AdminForth discovers all resources and their columns.
|
|
469
440
|
* Can be used to validate types of columns, check if some columns are missing, etc.
|
|
@@ -528,40 +499,276 @@ export interface HttpExtra {
|
|
|
528
499
|
cookies: Record<string, string>;
|
|
529
500
|
requestUrl: string;
|
|
530
501
|
meta?: any;
|
|
502
|
+
response: IAdminForthHttpResponse;
|
|
531
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Result of {@link IAdminForth.createResourceRecord}.
|
|
506
|
+
*/
|
|
507
|
+
export type CreateResourceRecordResult = {
|
|
508
|
+
/** Optional error message if creation failed. */
|
|
509
|
+
error?: string;
|
|
510
|
+
/** Created record as returned from the connector. */
|
|
511
|
+
createdRecord?: any;
|
|
512
|
+
/**
|
|
513
|
+
* Optional id of an existing record to redirect to
|
|
514
|
+
* (used when a beforeSave hook aborts creation and supplies newRecordId, allows to implement programmatic creation via API).
|
|
515
|
+
*/
|
|
516
|
+
newRecordId?: any;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Parameters for {@link IAdminForth.createResourceRecord}.
|
|
520
|
+
*/
|
|
521
|
+
export type CreateResourceRecordParams = {
|
|
522
|
+
/**
|
|
523
|
+
* Resource configuration used to create a record.
|
|
524
|
+
*/
|
|
525
|
+
resource: AdminForthResource;
|
|
526
|
+
/**
|
|
527
|
+
* Record data to create.
|
|
528
|
+
*/
|
|
529
|
+
record: any;
|
|
530
|
+
/**
|
|
531
|
+
* Admin user performing the action.
|
|
532
|
+
*/
|
|
533
|
+
adminUser: AdminUser;
|
|
534
|
+
/**
|
|
535
|
+
* HTTP response object.
|
|
536
|
+
*
|
|
537
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
538
|
+
*/
|
|
539
|
+
response?: IAdminForthHttpResponse;
|
|
540
|
+
/**
|
|
541
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
542
|
+
*/
|
|
543
|
+
extra?: HttpExtra;
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* Parameters for {@link IAdminForth.updateResourceRecord}.
|
|
547
|
+
*/
|
|
548
|
+
export type UpdateResourceRecordParams = {
|
|
549
|
+
/**
|
|
550
|
+
* Resource configuration used to update a record.
|
|
551
|
+
*/
|
|
552
|
+
resource: AdminForthResource;
|
|
553
|
+
/**
|
|
554
|
+
* Primary key value of the record to update.
|
|
555
|
+
*/
|
|
556
|
+
recordId: any;
|
|
557
|
+
/**
|
|
558
|
+
* Full record data with applied changes.
|
|
559
|
+
*
|
|
560
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use updates instead.
|
|
561
|
+
*/
|
|
562
|
+
record: any;
|
|
563
|
+
/**
|
|
564
|
+
* Record data before update.
|
|
565
|
+
*/
|
|
566
|
+
oldRecord: any;
|
|
567
|
+
/**
|
|
568
|
+
* Admin user performing the action.
|
|
569
|
+
*/
|
|
570
|
+
adminUser: AdminUser;
|
|
571
|
+
/**
|
|
572
|
+
* HTTP response object.
|
|
573
|
+
*
|
|
574
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
575
|
+
*/
|
|
576
|
+
response?: IAdminForthHttpResponse;
|
|
577
|
+
/**
|
|
578
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
579
|
+
*/
|
|
580
|
+
extra?: HttpExtra;
|
|
581
|
+
/**
|
|
582
|
+
* Partial record data with only changed fields. Mutually exclusive with record.
|
|
583
|
+
*/
|
|
584
|
+
updates?: never;
|
|
585
|
+
} | {
|
|
586
|
+
/**
|
|
587
|
+
* Resource configuration used to update a record.
|
|
588
|
+
*/
|
|
589
|
+
resource: AdminForthResource;
|
|
590
|
+
/**
|
|
591
|
+
* Primary key value of the record to update.
|
|
592
|
+
*/
|
|
593
|
+
recordId: any;
|
|
594
|
+
/**
|
|
595
|
+
* Full record data with applied changes.
|
|
596
|
+
*
|
|
597
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use updates instead.
|
|
598
|
+
*/
|
|
599
|
+
record?: never;
|
|
600
|
+
/**
|
|
601
|
+
* Record data before update.
|
|
602
|
+
*/
|
|
603
|
+
oldRecord: any;
|
|
604
|
+
/**
|
|
605
|
+
* Admin user performing the action.
|
|
606
|
+
*/
|
|
607
|
+
adminUser: AdminUser;
|
|
608
|
+
/**
|
|
609
|
+
* HTTP response object.
|
|
610
|
+
*
|
|
611
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
612
|
+
*/
|
|
613
|
+
response?: IAdminForthHttpResponse;
|
|
614
|
+
/**
|
|
615
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
616
|
+
*/
|
|
617
|
+
extra?: HttpExtra;
|
|
618
|
+
/**
|
|
619
|
+
* Partial record data with only changed fields. Mutually exclusive with record.
|
|
620
|
+
*/
|
|
621
|
+
updates: any;
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* Parameters for {@link IAdminForth.deleteResourceRecord}.
|
|
625
|
+
*/
|
|
626
|
+
export type DeleteResourceRecordParams = {
|
|
627
|
+
/**
|
|
628
|
+
* Resource configuration used to delete a record.
|
|
629
|
+
*/
|
|
630
|
+
resource: AdminForthResource;
|
|
631
|
+
/**
|
|
632
|
+
* Primary key value of the record to delete.
|
|
633
|
+
*/
|
|
634
|
+
recordId: string;
|
|
635
|
+
/**
|
|
636
|
+
* Admin user performing the action.
|
|
637
|
+
*/
|
|
638
|
+
adminUser: AdminUser;
|
|
639
|
+
/**
|
|
640
|
+
* Record data before deletion.
|
|
641
|
+
*/
|
|
642
|
+
record: any;
|
|
643
|
+
/**
|
|
644
|
+
* HTTP response object.
|
|
645
|
+
*
|
|
646
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
647
|
+
*/
|
|
648
|
+
response?: IAdminForthHttpResponse;
|
|
649
|
+
/**
|
|
650
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
651
|
+
*/
|
|
652
|
+
extra?: HttpExtra;
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* Result of {@link IAdminForth.updateResourceRecord}.
|
|
656
|
+
*/
|
|
657
|
+
export type UpdateResourceRecordResult = {
|
|
658
|
+
/** Optional error message if update failed. */
|
|
659
|
+
error?: string;
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* Result of {@link IAdminForth.deleteResourceRecord}.
|
|
663
|
+
*/
|
|
664
|
+
export type DeleteResourceRecordResult = {
|
|
665
|
+
/** Optional error message if delete failed. */
|
|
666
|
+
error?: string;
|
|
667
|
+
};
|
|
532
668
|
/**
|
|
533
669
|
* Modify record to change how data is saved to database.
|
|
534
670
|
* Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
|
|
535
671
|
*/
|
|
536
672
|
export type BeforeDeleteSaveFunction = (params: {
|
|
673
|
+
/**
|
|
674
|
+
* Resource info.
|
|
675
|
+
*/
|
|
537
676
|
resource: AdminForthResource;
|
|
677
|
+
/**
|
|
678
|
+
* Primary key value of the record to delete.
|
|
679
|
+
*/
|
|
538
680
|
recordId: any;
|
|
681
|
+
/**
|
|
682
|
+
* Admin user performing the action.
|
|
683
|
+
*/
|
|
539
684
|
adminUser: AdminUser;
|
|
685
|
+
/**
|
|
686
|
+
* Record data before deletion.
|
|
687
|
+
*/
|
|
540
688
|
record: any;
|
|
689
|
+
/**
|
|
690
|
+
* Adminforth instance.
|
|
691
|
+
*/
|
|
541
692
|
adminforth: IAdminForth;
|
|
693
|
+
/**
|
|
694
|
+
* HTTP response object.
|
|
695
|
+
*
|
|
696
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
697
|
+
*/
|
|
698
|
+
response?: IAdminForthHttpResponse;
|
|
699
|
+
/**
|
|
700
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
701
|
+
*/
|
|
542
702
|
extra?: HttpExtra;
|
|
543
703
|
}) => Promise<{
|
|
544
704
|
ok: boolean;
|
|
545
705
|
error?: string;
|
|
546
706
|
}>;
|
|
547
707
|
export type BeforeEditSaveFunction = (params: {
|
|
708
|
+
/**
|
|
709
|
+
* Resource info.
|
|
710
|
+
*/
|
|
548
711
|
resource: AdminForthResource;
|
|
712
|
+
/**
|
|
713
|
+
* Primary key value of the record to delete.
|
|
714
|
+
*/
|
|
549
715
|
recordId: any;
|
|
716
|
+
/**
|
|
717
|
+
* Admin user performing the action.
|
|
718
|
+
*/
|
|
550
719
|
adminUser: AdminUser;
|
|
551
720
|
updates: any;
|
|
721
|
+
/**
|
|
722
|
+
* Record with updates
|
|
723
|
+
*
|
|
724
|
+
* @deprecated. Will be removed in 2.0.0. Use updates instead.
|
|
725
|
+
*/
|
|
552
726
|
record: any;
|
|
727
|
+
/**
|
|
728
|
+
* Record data before update.
|
|
729
|
+
*/
|
|
553
730
|
oldRecord: any;
|
|
731
|
+
/**
|
|
732
|
+
* Adminforth instance.
|
|
733
|
+
*/
|
|
554
734
|
adminforth: IAdminForth;
|
|
735
|
+
/**
|
|
736
|
+
* HTTP response object.
|
|
737
|
+
*
|
|
738
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
739
|
+
*/
|
|
740
|
+
response: IAdminForthHttpResponse;
|
|
741
|
+
/**
|
|
742
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
743
|
+
*/
|
|
555
744
|
extra?: HttpExtra;
|
|
556
745
|
}) => Promise<{
|
|
557
746
|
ok: boolean;
|
|
558
747
|
error?: string | null;
|
|
559
748
|
}>;
|
|
560
749
|
export type BeforeCreateSaveFunction = (params: {
|
|
750
|
+
/**
|
|
751
|
+
* Resource info.
|
|
752
|
+
*/
|
|
561
753
|
resource: AdminForthResource;
|
|
754
|
+
/**
|
|
755
|
+
* Admin user performing the action.
|
|
756
|
+
*/
|
|
562
757
|
adminUser: AdminUser;
|
|
758
|
+
/**
|
|
759
|
+
* Record data to create.
|
|
760
|
+
*/
|
|
563
761
|
record: any;
|
|
762
|
+
/**
|
|
763
|
+
* Adminforth instance.
|
|
764
|
+
*/
|
|
564
765
|
adminforth: IAdminForth;
|
|
766
|
+
/**
|
|
767
|
+
* HTTP response object.
|
|
768
|
+
*
|
|
769
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
770
|
+
*/
|
|
771
|
+
response: IAdminForthHttpResponse;
|
|
565
772
|
extra?: HttpExtra;
|
|
566
773
|
}) => Promise<{
|
|
567
774
|
ok: boolean;
|
|
@@ -569,12 +776,39 @@ export type BeforeCreateSaveFunction = (params: {
|
|
|
569
776
|
newRecordId?: string;
|
|
570
777
|
}>;
|
|
571
778
|
export type AfterCreateSaveFunction = (params: {
|
|
779
|
+
/**
|
|
780
|
+
* Resource info.
|
|
781
|
+
*/
|
|
572
782
|
resource: AdminForthResource;
|
|
783
|
+
/**
|
|
784
|
+
* Primary key value of the record to delete.
|
|
785
|
+
*/
|
|
573
786
|
recordId: any;
|
|
787
|
+
/**
|
|
788
|
+
* Admin user performing the action.
|
|
789
|
+
*/
|
|
574
790
|
adminUser: AdminUser;
|
|
791
|
+
/**
|
|
792
|
+
* Record data after creation.
|
|
793
|
+
*/
|
|
575
794
|
record: any;
|
|
795
|
+
/**
|
|
796
|
+
* Adminforth instance.
|
|
797
|
+
*/
|
|
576
798
|
adminforth: IAdminForth;
|
|
799
|
+
/**
|
|
800
|
+
* Record with virtual columns after creation.
|
|
801
|
+
*/
|
|
577
802
|
recordWithVirtualColumns?: any;
|
|
803
|
+
/**
|
|
804
|
+
* HTTP response object.
|
|
805
|
+
*
|
|
806
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
807
|
+
*/
|
|
808
|
+
response: IAdminForthHttpResponse;
|
|
809
|
+
/**
|
|
810
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
811
|
+
*/
|
|
578
812
|
extra?: HttpExtra;
|
|
579
813
|
}) => Promise<{
|
|
580
814
|
ok: boolean;
|
|
@@ -585,24 +819,80 @@ export type AfterCreateSaveFunction = (params: {
|
|
|
585
819
|
* Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
|
|
586
820
|
*/
|
|
587
821
|
export type AfterDeleteSaveFunction = (params: {
|
|
822
|
+
/**
|
|
823
|
+
* Resource info.
|
|
824
|
+
*/
|
|
588
825
|
resource: AdminForthResource;
|
|
826
|
+
/**
|
|
827
|
+
* Primary key value of the record to delete.
|
|
828
|
+
*/
|
|
589
829
|
recordId: any;
|
|
830
|
+
/**
|
|
831
|
+
* Admin user performing the action.
|
|
832
|
+
*/
|
|
590
833
|
adminUser: AdminUser;
|
|
834
|
+
/**
|
|
835
|
+
* Record data, that was deleted.
|
|
836
|
+
*/
|
|
591
837
|
record: any;
|
|
838
|
+
/**
|
|
839
|
+
* Adminforth instance.
|
|
840
|
+
*/
|
|
592
841
|
adminforth: IAdminForth;
|
|
842
|
+
/**
|
|
843
|
+
* HTTP response object.
|
|
844
|
+
*
|
|
845
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
846
|
+
*/
|
|
847
|
+
response: IAdminForthHttpResponse;
|
|
848
|
+
/**
|
|
849
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
850
|
+
*/
|
|
593
851
|
extra?: HttpExtra;
|
|
594
852
|
}) => Promise<{
|
|
595
853
|
ok: boolean;
|
|
596
854
|
error?: string;
|
|
597
855
|
}>;
|
|
598
856
|
export type AfterEditSaveFunction = (params: {
|
|
857
|
+
/**
|
|
858
|
+
* Resource info.
|
|
859
|
+
*/
|
|
599
860
|
resource: AdminForthResource;
|
|
861
|
+
/**
|
|
862
|
+
* Primary key value of the record to delete.
|
|
863
|
+
*/
|
|
600
864
|
recordId: any;
|
|
865
|
+
/**
|
|
866
|
+
* Admin user performing the action.
|
|
867
|
+
*/
|
|
601
868
|
adminUser: AdminUser;
|
|
869
|
+
/**
|
|
870
|
+
* Record updates.
|
|
871
|
+
*/
|
|
602
872
|
updates: any;
|
|
873
|
+
/**
|
|
874
|
+
* Record after update.
|
|
875
|
+
*
|
|
876
|
+
* @deprecated. Will be removed in 2.0.0. Use updates instead.
|
|
877
|
+
*/
|
|
603
878
|
record: any;
|
|
879
|
+
/**
|
|
880
|
+
* Record data before update.
|
|
881
|
+
*/
|
|
604
882
|
oldRecord: any;
|
|
883
|
+
/**
|
|
884
|
+
* Adminforth instance.
|
|
885
|
+
*/
|
|
605
886
|
adminforth: IAdminForth;
|
|
887
|
+
/**
|
|
888
|
+
* HTTP response object.
|
|
889
|
+
*
|
|
890
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
891
|
+
*/
|
|
892
|
+
response: IAdminForthHttpResponse;
|
|
893
|
+
/**
|
|
894
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
895
|
+
*/
|
|
606
896
|
extra?: HttpExtra;
|
|
607
897
|
}) => Promise<{
|
|
608
898
|
ok: boolean;
|
|
@@ -612,10 +902,27 @@ export type AfterEditSaveFunction = (params: {
|
|
|
612
902
|
* Allow to get user data before login confirmation, will triger when user try to login.
|
|
613
903
|
*/
|
|
614
904
|
export type BeforeLoginConfirmationFunction = (params?: {
|
|
905
|
+
/**
|
|
906
|
+
* Admin user performing the action.
|
|
907
|
+
*/
|
|
615
908
|
adminUser: AdminUser;
|
|
909
|
+
/**
|
|
910
|
+
* HTTP response object.
|
|
911
|
+
*
|
|
912
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
913
|
+
*/
|
|
616
914
|
response: IAdminForthHttpResponse;
|
|
915
|
+
/**
|
|
916
|
+
* Adminforth instance.
|
|
917
|
+
*/
|
|
617
918
|
adminforth: IAdminForth;
|
|
919
|
+
/**
|
|
920
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
921
|
+
*/
|
|
618
922
|
extra?: HttpExtra;
|
|
923
|
+
/**
|
|
924
|
+
* Duration of session in format "1s", "1m", "1h", or "1d" (e.g., "30d" for 30 days)
|
|
925
|
+
*/
|
|
619
926
|
sessionDuration?: string;
|
|
620
927
|
}) => Promise<{
|
|
621
928
|
error?: string;
|
|
@@ -628,9 +935,23 @@ export type BeforeLoginConfirmationFunction = (params?: {
|
|
|
628
935
|
* Allow to make extra authorization
|
|
629
936
|
*/
|
|
630
937
|
export type AdminUserAuthorizeFunction = ((params?: {
|
|
938
|
+
/**
|
|
939
|
+
* Admin user performing the action.
|
|
940
|
+
*/
|
|
631
941
|
adminUser: AdminUser;
|
|
942
|
+
/**
|
|
943
|
+
* HTTP response object.
|
|
944
|
+
*
|
|
945
|
+
* @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
|
|
946
|
+
*/
|
|
632
947
|
response: IAdminForthHttpResponse;
|
|
948
|
+
/**
|
|
949
|
+
* Adminforth instance.
|
|
950
|
+
*/
|
|
633
951
|
adminforth: IAdminForth;
|
|
952
|
+
/**
|
|
953
|
+
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
954
|
+
*/
|
|
634
955
|
extra?: HttpExtra;
|
|
635
956
|
}) => Promise<{
|
|
636
957
|
error?: string;
|
|
@@ -830,6 +1151,7 @@ export interface AdminForthActionInput {
|
|
|
830
1151
|
name: string;
|
|
831
1152
|
showIn?: {
|
|
832
1153
|
list?: boolean;
|
|
1154
|
+
listThreeDotsMenu?: boolean;
|
|
833
1155
|
showButton?: boolean;
|
|
834
1156
|
showThreeDotsMenu?: boolean;
|
|
835
1157
|
};
|
|
@@ -843,6 +1165,7 @@ export interface AdminForthActionInput {
|
|
|
843
1165
|
resource: AdminForthResource;
|
|
844
1166
|
recordId: string;
|
|
845
1167
|
adminUser: AdminUser;
|
|
1168
|
+
response: IAdminForthHttpResponse;
|
|
846
1169
|
extra?: HttpExtra;
|
|
847
1170
|
tr: Function;
|
|
848
1171
|
}) => Promise<{
|
|
@@ -1014,7 +1337,7 @@ export interface AdminForthInputConfig {
|
|
|
1014
1337
|
/**
|
|
1015
1338
|
* Function to return avatar URL for user.
|
|
1016
1339
|
*/
|
|
1017
|
-
avatarUrl?: ((adminUser: AdminUser) => string | Promise<string>);
|
|
1340
|
+
avatarUrl?: ((adminUser: AdminUser) => string | Promise<string> | undefined | Promise<undefined>);
|
|
1018
1341
|
/**
|
|
1019
1342
|
* Remember me duration for "Remember Me" checkbox on login page.
|
|
1020
1343
|
* If not set or set to null/undefined, "Remember Me" checkbox will not be displayed.
|
|
@@ -1051,7 +1374,7 @@ export interface AdminForthInputConfig {
|
|
|
1051
1374
|
/**
|
|
1052
1375
|
* Add custom page to the settings page
|
|
1053
1376
|
*/
|
|
1054
|
-
userMenuSettingsPages
|
|
1377
|
+
userMenuSettingsPages?: {
|
|
1055
1378
|
icon?: string;
|
|
1056
1379
|
pageLabel: string;
|
|
1057
1380
|
slug?: string;
|
|
@@ -1153,6 +1476,8 @@ export declare class Filters {
|
|
|
1153
1476
|
static LTE_FIELD(leftField: string, rightField: string): IAdminForthSingleFilter;
|
|
1154
1477
|
static AND(...args: (IAdminForthSingleFilter | IAdminForthAndOrFilter | Array<IAdminForthSingleFilter | IAdminForthAndOrFilter>)[]): IAdminForthAndOrFilter;
|
|
1155
1478
|
static OR(...args: (IAdminForthSingleFilter | IAdminForthAndOrFilter | Array<IAdminForthSingleFilter | IAdminForthAndOrFilter>)[]): IAdminForthAndOrFilter;
|
|
1479
|
+
static IS_EMPTY(field: string): IAdminForthSingleFilter;
|
|
1480
|
+
static IS_NOT_EMPTY(field: string): IAdminForthSingleFilter;
|
|
1156
1481
|
}
|
|
1157
1482
|
export type FDataSort = (field: string, direction: AdminForthSortDirections) => IAdminForthSort;
|
|
1158
1483
|
export declare class Sorts {
|
|
@@ -1208,6 +1533,7 @@ export type AllowedActions = {
|
|
|
1208
1533
|
* General options for resource.
|
|
1209
1534
|
*/
|
|
1210
1535
|
export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourceInputCommon['options']>, 'allowedActions' | 'bulkActions'> {
|
|
1536
|
+
baseActionsAsQuickIcons?: ('show' | 'edit' | 'delete')[];
|
|
1211
1537
|
/**
|
|
1212
1538
|
* Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
|
|
1213
1539
|
* using checkboxes.
|
|
@@ -1359,10 +1685,11 @@ export interface AdminForthBulkAction extends AdminForthBulkActionCommon {
|
|
|
1359
1685
|
* Callback which will be called on backend when user clicks on action button.
|
|
1360
1686
|
* It should return Promise which will be resolved when action is done.
|
|
1361
1687
|
*/
|
|
1362
|
-
action: ({ resource, selectedIds, adminUser, tr }: {
|
|
1688
|
+
action: ({ resource, selectedIds, adminUser, response, tr }: {
|
|
1363
1689
|
resource: AdminForthResource;
|
|
1364
1690
|
selectedIds: Array<any>;
|
|
1365
1691
|
adminUser: AdminUser;
|
|
1692
|
+
response: IAdminForthHttpResponse;
|
|
1366
1693
|
tr: (key: string, category?: string, params?: any) => string;
|
|
1367
1694
|
}) => Promise<{
|
|
1368
1695
|
ok: boolean;
|