adminforth 4.7.1 → 4.7.2
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.d.ts +2 -3
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -10
- package/dist/auth.js.map +1 -1
- package/dist/dataConnectors/baseConnector.d.ts +0 -4
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
- package/dist/dataConnectors/baseConnector.js +0 -7
- package/dist/dataConnectors/baseConnector.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -35
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.d.ts +0 -1
- package/dist/modules/codeInjector.d.ts.map +1 -1
- package/dist/modules/codeInjector.js +3 -10
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/modules/configValidator.d.ts +2 -2
- package/dist/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +63 -103
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +11 -9
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/utils.d.ts +2 -3
- package/dist/modules/utils.d.ts.map +1 -1
- package/dist/modules/utils.js +2 -6
- package/dist/modules/utils.js.map +1 -1
- package/dist/spa/src/adminforth.ts +0 -18
- package/dist/spa/src/afcl/Button.vue +2 -5
- package/dist/spa/src/afcl/CodeInput.vue +2 -1
- package/dist/spa/src/afcl/DatePicker.vue +8 -0
- package/dist/spa/src/afcl/Dialog.vue +2 -19
- package/dist/spa/src/afcl/DropdownMenu.vue +8 -3
- package/dist/spa/src/afcl/Dropzone.vue +3 -2
- package/dist/spa/src/afcl/Modal.vue +4 -2
- package/dist/spa/src/afcl/Select.vue +7 -3
- package/dist/spa/src/afcl/Tooltip.vue +3 -1
- package/dist/spa/src/afcl/shadowRoot.ts +17 -0
- package/dist/spa/src/router/index.ts +0 -1
- package/dist/spa/src/stores/core.ts +5 -12
- package/dist/spa/src/types/Back.ts +58 -248
- package/dist/spa/src/types/Common.ts +2 -9
- package/dist/spa/src/types/FrontendAPI.ts +1 -21
- package/dist/spa/src/types/adapters/StorageAdapter.ts +0 -2
- package/dist/spa/src/views/CreateView.vue +2 -18
- package/dist/spa/src/views/ShowView.vue +3 -7
- package/dist/spa/src/websocket.ts +0 -11
- package/dist/types/Back.d.ts +26 -197
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +2 -8
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +1 -20
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/dist/types/adapters/StorageAdapter.d.ts +0 -2
- package/dist/types/adapters/StorageAdapter.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -562,7 +562,7 @@ export interface IAdminForthAuth {
|
|
|
562
562
|
|
|
563
563
|
removeCustomCookie({response, name}: {response: any, name: string}): void;
|
|
564
564
|
|
|
565
|
-
setCustomCookie({response, payload}: {response: any, payload: {name: string, value: string,
|
|
565
|
+
setCustomCookie({response, payload}: {response: any, payload: {name: string, value: string, expirySeconds?: number, httpOnly: boolean, sessionBased?: boolean}}): void;
|
|
566
566
|
|
|
567
567
|
getCustomCookie({cookies, name}: {cookies: {key: string, value: string}[], name: string}): string | null;
|
|
568
568
|
|
|
@@ -810,12 +810,8 @@ export type BeforeDataSourceRequestFunction = (params: {
|
|
|
810
810
|
filtersTools: any,
|
|
811
811
|
adminforth: IAdminForth,
|
|
812
812
|
}) => Promise<{
|
|
813
|
-
ok: boolean,
|
|
814
|
-
error?: string | null,
|
|
815
|
-
/**
|
|
816
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use redirectToRecordId instead.
|
|
817
|
-
*/
|
|
818
|
-
newRecordId?: string,
|
|
813
|
+
ok: boolean,
|
|
814
|
+
error?: string | null,
|
|
819
815
|
redirectToRecordId?: string
|
|
820
816
|
}>;
|
|
821
817
|
|
|
@@ -858,13 +854,6 @@ export type CreateResourceRecordResult = {
|
|
|
858
854
|
/** Created record as returned from the connector. */
|
|
859
855
|
createdRecord?: any;
|
|
860
856
|
|
|
861
|
-
/**
|
|
862
|
-
* Optional id of an existing record to redirect to
|
|
863
|
-
* (used when a beforeSave hook aborts creation and supplies newRecordId, allows to implement programmatic creation via API).
|
|
864
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use redirectToRecordId instead.
|
|
865
|
-
*/
|
|
866
|
-
newRecordId?: any;
|
|
867
|
-
|
|
868
857
|
/**
|
|
869
858
|
* Optional id of an existing record to redirect to
|
|
870
859
|
* (used when a beforeSave hook aborts creation and supplies redirectToRecordId, allows to implement programmatic creation via API).
|
|
@@ -892,14 +881,7 @@ export type CreateResourceRecordParams = {
|
|
|
892
881
|
adminUser: AdminUser;
|
|
893
882
|
|
|
894
883
|
/**
|
|
895
|
-
* HTTP
|
|
896
|
-
*
|
|
897
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
898
|
-
*/
|
|
899
|
-
response?: IAdminForthHttpResponse;
|
|
900
|
-
|
|
901
|
-
/**
|
|
902
|
-
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
884
|
+
* Extra HTTP information.
|
|
903
885
|
*/
|
|
904
886
|
extra?: HttpExtra;
|
|
905
887
|
};
|
|
@@ -907,97 +889,37 @@ export type CreateResourceRecordParams = {
|
|
|
907
889
|
/**
|
|
908
890
|
* Parameters for {@link IAdminForth.updateResourceRecord}.
|
|
909
891
|
*/
|
|
910
|
-
export type UpdateResourceRecordParams =
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
resource: AdminForthResource;
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* Primary key value of the record to update.
|
|
919
|
-
*/
|
|
920
|
-
recordId: any;
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Full record data with applied changes.
|
|
924
|
-
*
|
|
925
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use updates instead.
|
|
926
|
-
*/
|
|
927
|
-
record: any;
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Record data before update.
|
|
931
|
-
*/
|
|
932
|
-
oldRecord: any;
|
|
933
|
-
|
|
934
|
-
/**
|
|
935
|
-
* Admin user performing the action.
|
|
936
|
-
*/
|
|
937
|
-
adminUser: AdminUser;
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* HTTP response object.
|
|
941
|
-
*
|
|
942
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
943
|
-
*/
|
|
944
|
-
response?: IAdminForthHttpResponse;
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
948
|
-
*/
|
|
949
|
-
extra?: HttpExtra;
|
|
950
|
-
|
|
951
|
-
/**
|
|
952
|
-
* Partial record data with only changed fields. Mutually exclusive with record.
|
|
953
|
-
*/
|
|
954
|
-
updates?: never;
|
|
955
|
-
}
|
|
956
|
-
| {
|
|
957
|
-
/**
|
|
958
|
-
* Resource configuration used to update a record.
|
|
959
|
-
*/
|
|
960
|
-
resource: AdminForthResource;
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* Primary key value of the record to update.
|
|
964
|
-
*/
|
|
965
|
-
recordId: any;
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* Full record data with applied changes.
|
|
969
|
-
*
|
|
970
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use updates instead.
|
|
971
|
-
*/
|
|
972
|
-
record?: never;
|
|
892
|
+
export type UpdateResourceRecordParams = {
|
|
893
|
+
/**
|
|
894
|
+
* Resource configuration used to update a record.
|
|
895
|
+
*/
|
|
896
|
+
resource: AdminForthResource;
|
|
973
897
|
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
898
|
+
/**
|
|
899
|
+
* Primary key value of the record to update.
|
|
900
|
+
*/
|
|
901
|
+
recordId: any;
|
|
978
902
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
903
|
+
/**
|
|
904
|
+
* Record data before update.
|
|
905
|
+
*/
|
|
906
|
+
oldRecord: any;
|
|
983
907
|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
*/
|
|
989
|
-
response?: IAdminForthHttpResponse;
|
|
908
|
+
/**
|
|
909
|
+
* Admin user performing the action.
|
|
910
|
+
*/
|
|
911
|
+
adminUser: AdminUser;
|
|
990
912
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
913
|
+
/**
|
|
914
|
+
* Extra HTTP information.
|
|
915
|
+
*/
|
|
916
|
+
extra?: HttpExtra;
|
|
995
917
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
918
|
+
/**
|
|
919
|
+
* Partial record data with only changed fields.
|
|
920
|
+
*/
|
|
921
|
+
updates: any;
|
|
922
|
+
};
|
|
1001
923
|
|
|
1002
924
|
/**
|
|
1003
925
|
* Parameters for {@link IAdminForth.deleteResourceRecord}.
|
|
@@ -1024,14 +946,7 @@ export type DeleteResourceRecordParams = {
|
|
|
1024
946
|
record: any;
|
|
1025
947
|
|
|
1026
948
|
/**
|
|
1027
|
-
* HTTP
|
|
1028
|
-
*
|
|
1029
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1030
|
-
*/
|
|
1031
|
-
response?: IAdminForthHttpResponse;
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
949
|
+
* Extra HTTP information.
|
|
1035
950
|
*/
|
|
1036
951
|
extra?: HttpExtra;
|
|
1037
952
|
};
|
|
@@ -1071,19 +986,13 @@ export type BeforeDeleteSaveFunction = (params: {
|
|
|
1071
986
|
/**
|
|
1072
987
|
* Record data before deletion.
|
|
1073
988
|
*/
|
|
1074
|
-
record: any,
|
|
989
|
+
record: any,
|
|
1075
990
|
/**
|
|
1076
991
|
* Adminforth instance.
|
|
1077
992
|
*/
|
|
1078
993
|
adminforth: IAdminForth,
|
|
1079
994
|
/**
|
|
1080
|
-
* HTTP
|
|
1081
|
-
*
|
|
1082
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1083
|
-
*/
|
|
1084
|
-
response?: IAdminForthHttpResponse,
|
|
1085
|
-
/**
|
|
1086
|
-
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
995
|
+
* Extra HTTP information.
|
|
1087
996
|
*/
|
|
1088
997
|
extra?: HttpExtra,
|
|
1089
998
|
}) => Promise<{ok: boolean, error?: string}>;
|
|
@@ -1106,12 +1015,6 @@ export type BeforeEditSaveFunction = (params: {
|
|
|
1106
1015
|
* Fields to update in record.
|
|
1107
1016
|
*/
|
|
1108
1017
|
updates: any,
|
|
1109
|
-
/**
|
|
1110
|
-
* Record with updates
|
|
1111
|
-
*
|
|
1112
|
-
* @deprecated. Will be removed in 4.0.0. Use updates instead.
|
|
1113
|
-
*/
|
|
1114
|
-
record: any, // legacy, 'updates' should be used instead
|
|
1115
1018
|
/**
|
|
1116
1019
|
* Record data before update.
|
|
1117
1020
|
*/
|
|
@@ -1121,13 +1024,7 @@ export type BeforeEditSaveFunction = (params: {
|
|
|
1121
1024
|
*/
|
|
1122
1025
|
adminforth: IAdminForth,
|
|
1123
1026
|
/**
|
|
1124
|
-
* HTTP
|
|
1125
|
-
*
|
|
1126
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1127
|
-
*/
|
|
1128
|
-
response: IAdminForthHttpResponse,
|
|
1129
|
-
/**
|
|
1130
|
-
* Extra HTTP information. Prefer using extra.response over the top-level response field.
|
|
1027
|
+
* Extra HTTP information.
|
|
1131
1028
|
*/
|
|
1132
1029
|
extra?: HttpExtra,
|
|
1133
1030
|
}) => Promise<{ok: boolean, error?: string | null}>;
|
|
@@ -1144,26 +1041,18 @@ export type BeforeCreateSaveFunction = (params: {
|
|
|
1144
1041
|
/**
|
|
1145
1042
|
* Record data to create.
|
|
1146
1043
|
*/
|
|
1147
|
-
record: any,
|
|
1044
|
+
record: any,
|
|
1148
1045
|
/**
|
|
1149
1046
|
* Adminforth instance.
|
|
1150
1047
|
*/
|
|
1151
1048
|
adminforth: IAdminForth,
|
|
1152
1049
|
/**
|
|
1153
|
-
* HTTP
|
|
1154
|
-
*
|
|
1155
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1050
|
+
* Extra HTTP information.
|
|
1156
1051
|
*/
|
|
1157
|
-
response: IAdminForthHttpResponse,
|
|
1158
|
-
|
|
1159
1052
|
extra?: HttpExtra,
|
|
1160
1053
|
}) => Promise<{
|
|
1161
|
-
ok: boolean,
|
|
1162
|
-
error?: string | null,
|
|
1163
|
-
/**
|
|
1164
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use redirectToRecordId instead.
|
|
1165
|
-
*/
|
|
1166
|
-
newRecordId?: string,
|
|
1054
|
+
ok: boolean,
|
|
1055
|
+
error?: string | null,
|
|
1167
1056
|
redirectToRecordId?: string
|
|
1168
1057
|
}>;
|
|
1169
1058
|
|
|
@@ -1192,14 +1081,8 @@ export type AfterCreateSaveFunction = (params: {
|
|
|
1192
1081
|
* Record with virtual columns after creation.
|
|
1193
1082
|
*/
|
|
1194
1083
|
recordWithVirtualColumns?: any,
|
|
1195
|
-
/**
|
|
1196
|
-
* HTTP response object.
|
|
1197
|
-
*
|
|
1198
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1199
|
-
*/
|
|
1200
|
-
response: IAdminForthHttpResponse,
|
|
1201
1084
|
/**
|
|
1202
|
-
* Extra HTTP information.
|
|
1085
|
+
* Extra HTTP information.
|
|
1203
1086
|
*/
|
|
1204
1087
|
extra?: HttpExtra,
|
|
1205
1088
|
}) => Promise<{ok: boolean, error?: string}>;
|
|
@@ -1224,19 +1107,13 @@ export type AfterDeleteSaveFunction = (params: {
|
|
|
1224
1107
|
/**
|
|
1225
1108
|
* Record data, that was deleted.
|
|
1226
1109
|
*/
|
|
1227
|
-
record: any,
|
|
1110
|
+
record: any,
|
|
1228
1111
|
/**
|
|
1229
1112
|
* Adminforth instance.
|
|
1230
1113
|
*/
|
|
1231
1114
|
adminforth: IAdminForth,
|
|
1232
|
-
/**
|
|
1233
|
-
* HTTP response object.
|
|
1234
|
-
*
|
|
1235
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1236
|
-
*/
|
|
1237
|
-
response: IAdminForthHttpResponse,
|
|
1238
1115
|
/**
|
|
1239
|
-
* Extra HTTP information.
|
|
1116
|
+
* Extra HTTP information.
|
|
1240
1117
|
*/
|
|
1241
1118
|
extra?: HttpExtra,
|
|
1242
1119
|
}) => Promise<{ok: boolean, error?: string}>;
|
|
@@ -1258,13 +1135,7 @@ export type AfterEditSaveFunction = (params: {
|
|
|
1258
1135
|
/**
|
|
1259
1136
|
* Record updates.
|
|
1260
1137
|
*/
|
|
1261
|
-
updates: any,
|
|
1262
|
-
/**
|
|
1263
|
-
* Record after update.
|
|
1264
|
-
*
|
|
1265
|
-
* @deprecated. Will be removed in 4.0.0. Use updates instead.
|
|
1266
|
-
*/
|
|
1267
|
-
record: any, // legacy, 'updates' should be used instead
|
|
1138
|
+
updates: any,
|
|
1268
1139
|
/**
|
|
1269
1140
|
* Record data before update.
|
|
1270
1141
|
*/
|
|
@@ -1273,14 +1144,8 @@ export type AfterEditSaveFunction = (params: {
|
|
|
1273
1144
|
* Adminforth instance.
|
|
1274
1145
|
*/
|
|
1275
1146
|
adminforth: IAdminForth,
|
|
1276
|
-
/**
|
|
1277
|
-
* HTTP response object.
|
|
1278
|
-
*
|
|
1279
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1280
|
-
*/
|
|
1281
|
-
response: IAdminForthHttpResponse,
|
|
1282
1147
|
/**
|
|
1283
|
-
* Extra HTTP information.
|
|
1148
|
+
* Extra HTTP information.
|
|
1284
1149
|
*/
|
|
1285
1150
|
extra?: HttpExtra,
|
|
1286
1151
|
}) => Promise<{ok: boolean, error?: string}>;
|
|
@@ -1293,18 +1158,12 @@ export type BeforeLoginConfirmationFunction = (params?: {
|
|
|
1293
1158
|
* Admin user performing the action.
|
|
1294
1159
|
*/
|
|
1295
1160
|
adminUser: AdminUser,
|
|
1296
|
-
/**
|
|
1297
|
-
* HTTP response object.
|
|
1298
|
-
*
|
|
1299
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1300
|
-
*/
|
|
1301
|
-
response: IAdminForthHttpResponse,
|
|
1302
1161
|
/**
|
|
1303
1162
|
* Adminforth instance.
|
|
1304
1163
|
*/
|
|
1305
1164
|
adminforth: IAdminForth,
|
|
1306
1165
|
/**
|
|
1307
|
-
* Extra HTTP information.
|
|
1166
|
+
* Extra HTTP information.
|
|
1308
1167
|
*/
|
|
1309
1168
|
extra?: HttpExtra,
|
|
1310
1169
|
/**
|
|
@@ -1412,18 +1271,12 @@ export type AdminUserAuthorizeFunction = ((params?: {
|
|
|
1412
1271
|
* Admin user performing the action.
|
|
1413
1272
|
*/
|
|
1414
1273
|
adminUser: AdminUser,
|
|
1415
|
-
/**
|
|
1416
|
-
* HTTP response object.
|
|
1417
|
-
*
|
|
1418
|
-
* @deprecated Since 1.2.9. Will be removed in 4.0.0. Use extra.response instead.
|
|
1419
|
-
*/
|
|
1420
|
-
response: IAdminForthHttpResponse,
|
|
1421
1274
|
/**
|
|
1422
1275
|
* Adminforth instance.
|
|
1423
1276
|
*/
|
|
1424
1277
|
adminforth: IAdminForth,
|
|
1425
1278
|
/**
|
|
1426
|
-
* Extra HTTP information.
|
|
1279
|
+
* Extra HTTP information.
|
|
1427
1280
|
*/
|
|
1428
1281
|
extra?: HttpExtra,
|
|
1429
1282
|
}) => Promise<{
|
|
@@ -1868,11 +1721,6 @@ export interface AdminForthInputConfig {
|
|
|
1868
1721
|
*/
|
|
1869
1722
|
usersResourceId?: string,
|
|
1870
1723
|
|
|
1871
|
-
/**
|
|
1872
|
-
* Legacy field left for backward compatibility. Use usersResourceId instead.
|
|
1873
|
-
*/
|
|
1874
|
-
resourceId?: string,
|
|
1875
|
-
|
|
1876
1724
|
/**
|
|
1877
1725
|
* Field name (column name) in user resource which will be used as username for searching user in database during login.
|
|
1878
1726
|
* Can be e.g. 'email' or 'username'
|
|
@@ -2007,12 +1855,6 @@ export interface AdminForthInputConfig {
|
|
|
2007
1855
|
*/
|
|
2008
1856
|
rememberMeDuration?: string,
|
|
2009
1857
|
|
|
2010
|
-
/**
|
|
2011
|
-
* Old variable for remember me duration. Use rememberMeDuration instead.
|
|
2012
|
-
* @deprecated Use rememberMeDuration instead.
|
|
2013
|
-
*/
|
|
2014
|
-
rememberMeDays?: number,
|
|
2015
|
-
|
|
2016
1858
|
/**
|
|
2017
1859
|
* Rate limits for login attempts.
|
|
2018
1860
|
* Format: "requests/period", where period is "1s", "1m", "1h", or "1d".
|
|
@@ -2413,15 +2255,7 @@ export type AllowedActions = {
|
|
|
2413
2255
|
/**
|
|
2414
2256
|
* General options for resource.
|
|
2415
2257
|
*/
|
|
2416
|
-
export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourceInputCommon['options']>, 'allowedActions' | '
|
|
2417
|
-
|
|
2418
|
-
/**
|
|
2419
|
-
* Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
|
|
2420
|
-
* using checkboxes.
|
|
2421
|
-
* @deprecated Since 2.26.5. Will be removed in 4.0.0. Use `actions` instead.
|
|
2422
|
-
|
|
2423
|
-
*/
|
|
2424
|
-
bulkActions?: Array<AdminForthBulkAction>,
|
|
2258
|
+
export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourceInputCommon['options']>, 'allowedActions' | 'actions'> {
|
|
2425
2259
|
|
|
2426
2260
|
/**
|
|
2427
2261
|
* Allowed actions for resource.
|
|
@@ -2472,6 +2306,11 @@ export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourc
|
|
|
2472
2306
|
export interface ResourceOptions extends Omit<ResourceOptionsInput, 'allowedActions'> {
|
|
2473
2307
|
allowedActions: AllowedActions,
|
|
2474
2308
|
actions?: Array<AdminForthActionInput>,
|
|
2309
|
+
|
|
2310
|
+
/**
|
|
2311
|
+
* Built-in bulk actions (e.g. "Delete checked"). Filled by AdminForth, not configurable by user.
|
|
2312
|
+
*/
|
|
2313
|
+
bulkActions: Array<AdminForthBulkAction>,
|
|
2475
2314
|
}
|
|
2476
2315
|
|
|
2477
2316
|
/**
|
|
@@ -2526,7 +2365,7 @@ export interface AdminForthResource extends Omit<AdminForthResourceInput, 'optio
|
|
|
2526
2365
|
* If you need to show error on UI, set `error: \<error message\>` in response.
|
|
2527
2366
|
*
|
|
2528
2367
|
* Typical use-cases:
|
|
2529
|
-
* - Create record by custom code (return `{ ok: false,
|
|
2368
|
+
* - Create record by custom code (return `{ ok: false, redirectToRecordId: <id of created record from custom code> }`)
|
|
2530
2369
|
* - Validate record before saving to database and interrupt execution if validation failed (return `{ ok: false, error: <validation error> }`), though `allowedActions.create` should be preferred in most cases
|
|
2531
2370
|
* - fill-in adminUser as creator of record (set `record.<some field> = x; return \{ ok: true \}`)
|
|
2532
2371
|
* - Attach additional data to record before saving to database (mostly fillOnCreate should be used instead)
|
|
@@ -2585,8 +2424,8 @@ export interface AdminForthBulkAction extends AdminForthBulkActionCommon {
|
|
|
2585
2424
|
* Callback which will be called on backend when user clicks on action button.
|
|
2586
2425
|
* It should return Promise which will be resolved when action is done.
|
|
2587
2426
|
*/
|
|
2588
|
-
action: ({ resource, selectedIds, adminUser,
|
|
2589
|
-
resource: AdminForthResource, selectedIds: Array<any>, adminUser: AdminUser,
|
|
2427
|
+
action: ({ resource, selectedIds, adminUser, extra, tr }: {
|
|
2428
|
+
resource: AdminForthResource, selectedIds: Array<any>, adminUser: AdminUser, extra: HttpExtra, tr: ITranslateFunction
|
|
2590
2429
|
}) => Promise<{ ok: boolean, error?: string, successMessage?: string }>,
|
|
2591
2430
|
|
|
2592
2431
|
/**
|
|
@@ -2623,31 +2462,6 @@ export interface AdminForthBulkAction extends AdminForthBulkActionCommon {
|
|
|
2623
2462
|
|
|
2624
2463
|
/**
|
|
2625
2464
|
* Allowed standard actions for current user resolved by calling allowedActions callbacks if they are passed.
|
|
2626
|
-
* You can use this variable to rely on standard actions permissions. E.g. if you have custom actions "Mark as read", you
|
|
2627
|
-
* might want to allow it only for users who have "edit" action allowed:
|
|
2628
|
-
*
|
|
2629
|
-
* Example:
|
|
2630
|
-
*
|
|
2631
|
-
* ```ts
|
|
2632
|
-
*
|
|
2633
|
-
* options: \{
|
|
2634
|
-
* bulkActions: [
|
|
2635
|
-
* \{
|
|
2636
|
-
* label: 'Mark as read',
|
|
2637
|
-
* action: async (\{ resource, recordIds \}) => \{
|
|
2638
|
-
* await markAsRead(recordIds);
|
|
2639
|
-
* \},
|
|
2640
|
-
* allowed: (\{ allowedActions \}) => allowedActions.edit,
|
|
2641
|
-
* \}
|
|
2642
|
-
* ],
|
|
2643
|
-
* allowedActions: \{
|
|
2644
|
-
* edit: (\{ resource, adminUser, recordIds \}) => \{
|
|
2645
|
-
* return adminUser.dbUser.role === 'superadmin';
|
|
2646
|
-
* \}
|
|
2647
|
-
* \}
|
|
2648
|
-
* \}
|
|
2649
|
-
* ```
|
|
2650
|
-
*
|
|
2651
2465
|
*/
|
|
2652
2466
|
allowedActions: AllowedActionsResolved,
|
|
2653
2467
|
}) => Promise<boolean>,
|
|
@@ -2664,19 +2478,15 @@ export interface AdminForthForeignResource extends AdminForthForeignResourceComm
|
|
|
2664
2478
|
onDelete?: 'cascade' | 'setNull'
|
|
2665
2479
|
}
|
|
2666
2480
|
|
|
2667
|
-
|
|
2481
|
+
/**
|
|
2482
|
+
* Object which describes on what pages should column be displayed on.
|
|
2483
|
+
*/
|
|
2484
|
+
export type ShowInInput = {
|
|
2668
2485
|
[key in AdminForthResourcePages]?: AllowedActionValue
|
|
2669
2486
|
} & {
|
|
2670
2487
|
all?: AllowedActionValue;
|
|
2671
2488
|
}
|
|
2672
2489
|
|
|
2673
|
-
export type ShowInLegacyInput = Array<AdminForthResourcePages | keyof typeof AdminForthResourcePages>;
|
|
2674
|
-
|
|
2675
|
-
/**
|
|
2676
|
-
* Object which describes on what pages should column be displayed on.
|
|
2677
|
-
*/
|
|
2678
|
-
export type ShowInInput = ShowInModernInput | ShowInLegacyInput;
|
|
2679
|
-
|
|
2680
2490
|
export type ShowIn = {
|
|
2681
2491
|
[key in AdminForthResourcePages]: AllowedActionValue
|
|
2682
2492
|
}
|
|
@@ -66,7 +66,7 @@ export enum ActionCheckSource {
|
|
|
66
66
|
EditRequest = 'editRequest',
|
|
67
67
|
CreateRequest = 'createRequest',
|
|
68
68
|
DeleteRequest = 'deleteRequest',
|
|
69
|
-
BulkActionRequest = 'bulkActionRequest', //
|
|
69
|
+
BulkActionRequest = 'bulkActionRequest', // used only by built-in bulk actions (e.g. "Delete checked")
|
|
70
70
|
CustomActionRequest = 'customActionRequest',
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -364,7 +364,7 @@ export interface AdminForthBulkActionFront extends Omit<AdminForthBulkActionComm
|
|
|
364
364
|
|
|
365
365
|
type AdminforthOptionsCommon = NonNullable<AdminForthResourceCommon['options']>;
|
|
366
366
|
|
|
367
|
-
export interface AdminForthOptionsForFrontend extends Omit<AdminforthOptionsCommon, 'actions'
|
|
367
|
+
export interface AdminForthOptionsForFrontend extends Omit<AdminforthOptionsCommon, 'actions'> {
|
|
368
368
|
actions?: AdminForthActionFront[],
|
|
369
369
|
bulkActions?: AdminForthBulkActionFront[],
|
|
370
370
|
showNextButton?: boolean,
|
|
@@ -473,13 +473,6 @@ export interface AdminForthResourceInputCommon {
|
|
|
473
473
|
* Custom actions list. Actions available in show, edit and create views.
|
|
474
474
|
*/
|
|
475
475
|
actions?: AdminForthActionInput[],
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
|
|
479
|
-
* using checkboxes.
|
|
480
|
-
* @deprecated in favor of defining .
|
|
481
|
-
*/
|
|
482
|
-
bulkActions?: AdminForthBulkActionCommon[],
|
|
483
476
|
|
|
484
477
|
/**
|
|
485
478
|
* Allowed actions for resource.
|
|
@@ -89,32 +89,12 @@ export interface FrontendAPIInterface {
|
|
|
89
89
|
* ```
|
|
90
90
|
*
|
|
91
91
|
* Please note that you can set/update filter even for fields which have showIn.filter=false in resource configuration.
|
|
92
|
-
* Also you can set filter for virtual columns. For example Universal search plugin calls
|
|
92
|
+
* Also you can set filter for virtual columns. For example Universal search plugin calls setFilter for virtual column which has showIn.filter=false (because we dont want to show this column in filter dropdown, plugin renders its own filter UI)
|
|
93
93
|
*
|
|
94
94
|
* @param filter - The filter to set
|
|
95
95
|
*/
|
|
96
96
|
setFilter(filter: FilterParams): void;
|
|
97
97
|
|
|
98
|
-
/**
|
|
99
|
-
* @deprecated does the same as setFilter, kept for backward compatibility, will be removed in 4.0.0
|
|
100
|
-
*
|
|
101
|
-
* Update a filter in the list
|
|
102
|
-
*
|
|
103
|
-
* Filters visibility in badge is automatically determined by column configuration:
|
|
104
|
-
* - Hidden if column has showIn.filter: false
|
|
105
|
-
*
|
|
106
|
-
* Example:
|
|
107
|
-
*
|
|
108
|
-
* ```ts
|
|
109
|
-
* import { useAdminforth } from '@/adminforth';
|
|
110
|
-
* const { list } = useAdminforth();
|
|
111
|
-
* list.updateFilter({field: 'name', operator: 'ilike', value: 'john'})
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* @param filter - The filter to update
|
|
115
|
-
*/
|
|
116
|
-
updateFilter(filter: FilterParams): void;
|
|
117
|
-
|
|
118
98
|
/**
|
|
119
99
|
* Clear all filters from the list
|
|
120
100
|
*/
|
|
@@ -39,7 +39,6 @@ export interface StorageAdapter {
|
|
|
39
39
|
* This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
|
|
40
40
|
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
41
41
|
*/
|
|
42
|
-
markKeyForDeletation(key: string): Promise<void>; //TODO delete after one year
|
|
43
42
|
markKeyForDeletion(key: string): Promise<void>;
|
|
44
43
|
|
|
45
44
|
|
|
@@ -48,7 +47,6 @@ export interface StorageAdapter {
|
|
|
48
47
|
* This method should be used to cancel the deletion of the file if it was marked for deletion.
|
|
49
48
|
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
50
49
|
*/
|
|
51
|
-
markKeyForNotDeletation(key: string): Promise<void>; //TODO delete after one year
|
|
52
50
|
markKeyForNotDeletion(key: string): Promise<void>;
|
|
53
51
|
|
|
54
52
|
|
|
@@ -167,27 +167,11 @@ onMounted(async () => {
|
|
|
167
167
|
}
|
|
168
168
|
return acc;
|
|
169
169
|
}, {});
|
|
170
|
-
let userUseMultipleEncoding = true; //TODO remove this in future versions
|
|
171
170
|
if (route.query.values) {
|
|
172
|
-
|
|
173
|
-
JSON.parse(decodeURIComponent(route.query.values as string));
|
|
174
|
-
console.warn('You are using an outdated format for the query vales. Please update your links and don`t use multiple URL encoding.');
|
|
175
|
-
} catch (e) {
|
|
176
|
-
userUseMultipleEncoding = false;
|
|
177
|
-
console.warn('You are using an outdated format for the query vales. Please update your links and don`t use multiple URL encoding.');
|
|
178
|
-
}
|
|
179
|
-
if (userUseMultipleEncoding) {
|
|
180
|
-
initialValues.value = { ...initialValues.value, ...JSON.parse(decodeURIComponent((route.query.values as string))) };
|
|
181
|
-
} else {
|
|
182
|
-
initialValues.value = { ...initialValues.value, ...JSON.parse(atob_function(route.query.values as string)) };
|
|
183
|
-
}
|
|
171
|
+
initialValues.value = { ...initialValues.value, ...JSON.parse(atob_function(route.query.values as string)) };
|
|
184
172
|
}
|
|
185
173
|
if (route.query.readonlyColumns) {
|
|
186
|
-
|
|
187
|
-
readonlyColumns.value = JSON.parse(decodeURIComponent((route.query.readonlyColumns as string)));
|
|
188
|
-
} else {
|
|
189
|
-
readonlyColumns.value = JSON.parse(atob_function(route.query.readonlyColumns as string));
|
|
190
|
-
}
|
|
174
|
+
readonlyColumns.value = JSON.parse(atob_function(route.query.readonlyColumns as string));
|
|
191
175
|
}
|
|
192
176
|
record.value = initialValues.value;
|
|
193
177
|
loading.value = false;
|
|
@@ -221,7 +221,7 @@ const coreStore = useCoreStore();
|
|
|
221
221
|
const SHOW_PAGE_TOPIC_PREFIX = '/showPage/';
|
|
222
222
|
|
|
223
223
|
const actionLoadingStates = ref<Record<string, boolean>>({});
|
|
224
|
-
|
|
224
|
+
let unsubscribeFromShowPageUpdates: () => void;
|
|
225
225
|
|
|
226
226
|
const customActions = computed(() => {
|
|
227
227
|
return coreStore.resource?.options?.actions?.filter((a: any) => a.showIn?.showThreeDotsMenu) || [];
|
|
@@ -261,8 +261,7 @@ function applyShowPageUpdates(data: { resourceId: string; recordId: string; upda
|
|
|
261
261
|
|
|
262
262
|
function subscribeToShowPageUpdates() {
|
|
263
263
|
websocket.unsubscribeByPrefix(SHOW_PAGE_TOPIC_PREFIX);
|
|
264
|
-
|
|
265
|
-
websocket.subscribe(subscribedShowPageTopic.value, applyShowPageUpdates);
|
|
264
|
+
unsubscribeFromShowPageUpdates = websocket.subscribe(showPageTopic.value, applyShowPageUpdates);
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
onMounted(async () => {
|
|
@@ -283,10 +282,7 @@ onMounted(async () => {
|
|
|
283
282
|
});
|
|
284
283
|
|
|
285
284
|
onUnmounted(() => {
|
|
286
|
-
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
websocket.unsubscribe(subscribedShowPageTopic.value);
|
|
285
|
+
unsubscribeFromShowPageUpdates();
|
|
290
286
|
});
|
|
291
287
|
|
|
292
288
|
const groups = computed(() => {
|
|
@@ -166,17 +166,6 @@ export default {
|
|
|
166
166
|
};
|
|
167
167
|
},
|
|
168
168
|
|
|
169
|
-
unsubscribe(topic: string): void {
|
|
170
|
-
console.warn('This method is deprecated because it removes all subscriptions for the topic. Use the unsubscribe function returned by subscribe(), or use unsubscribeByPrefix() when you explicitly need to unsubscribe by topic prefix.');
|
|
171
|
-
if (!subscriptions[topic]) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
delete subscriptions[topic];
|
|
175
|
-
if (state.ready) {
|
|
176
|
-
doPhysicalUnsubscribe(topic);
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
|
|
180
169
|
unsubscribeByPrefix(prefix: string): void {
|
|
181
170
|
Object.keys(subscriptions)
|
|
182
171
|
.filter((topic) => topic.startsWith(prefix))
|