identity-admin 1.26.4 → 1.26.5

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 (157) hide show
  1. package/README.md +126 -126
  2. package/lib/Dashboard.d.ts +14 -14
  3. package/lib/Dashboard.js +95 -95
  4. package/lib/container/helpers/HelperInversify.d.ts +6 -6
  5. package/lib/container/helpers/HelperInversify.js +10 -10
  6. package/lib/container/helpers/HelperTypes.d.ts +5 -5
  7. package/lib/container/helpers/HelperTypes.js +7 -7
  8. package/lib/container/index.d.ts +1 -1
  9. package/lib/container/index.js +14 -14
  10. package/lib/container/repositories/RepositoryInversify.d.ts +4 -4
  11. package/lib/container/repositories/RepositoryInversify.js +13 -13
  12. package/lib/container/repositories/RepositoryTypes.d.ts +4 -4
  13. package/lib/container/repositories/RepositoryTypes.js +6 -6
  14. package/lib/container/types.d.ts +8 -8
  15. package/lib/container/types.js +9 -9
  16. package/lib/controllers/ActionController.d.ts +8 -8
  17. package/lib/controllers/ActionController.js +91 -91
  18. package/lib/controllers/DashboardController.d.ts +43 -43
  19. package/lib/controllers/DashboardController.js +730 -730
  20. package/lib/controllers/ResourceController.d.ts +15 -15
  21. package/lib/controllers/ResourceController.js +134 -134
  22. package/lib/helpers/ActionsGenerator.d.ts +11 -11
  23. package/lib/helpers/ActionsGenerator.js +179 -179
  24. package/lib/helpers/FiltersHelper.d.ts +9 -9
  25. package/lib/helpers/FiltersHelper.js +113 -113
  26. package/lib/helpers/LocalesHelper.d.ts +4 -4
  27. package/lib/helpers/LocalesHelper.js +73 -73
  28. package/lib/helpers/LocalizedStringHelper.d.ts +9 -9
  29. package/lib/helpers/LocalizedStringHelper.js +57 -57
  30. package/lib/helpers/Permissions/PermissionFetcher.d.ts +7 -7
  31. package/lib/helpers/Permissions/PermissionFetcher.js +78 -78
  32. package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
  33. package/lib/helpers/Permissions/PermissionLabel.js +42 -42
  34. package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
  35. package/lib/helpers/Permissions/PermissionMapper.js +35 -35
  36. package/lib/helpers/Permissions/PermissionResource.d.ts +5 -5
  37. package/lib/helpers/Permissions/PermissionResource.js +31 -31
  38. package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
  39. package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
  40. package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
  41. package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
  42. package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
  43. package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
  44. package/lib/helpers/Permissions/types.d.ts +17 -17
  45. package/lib/helpers/Permissions/types.js +2 -2
  46. package/lib/helpers/PopulationHelper.d.ts +12 -12
  47. package/lib/helpers/PopulationHelper.js +50 -50
  48. package/lib/helpers/ReportsGenerator.d.ts +11 -11
  49. package/lib/helpers/ReportsGenerator.js +57 -57
  50. package/lib/helpers/ResourceGenerator.d.ts +9 -9
  51. package/lib/helpers/ResourceGenerator.js +172 -172
  52. package/lib/helpers/ResourceHelper.d.ts +28 -28
  53. package/lib/helpers/ResourceHelper.js +395 -395
  54. package/lib/helpers/RportsGenerator.d.ts +10 -10
  55. package/lib/helpers/RportsGenerator.js +21 -21
  56. package/lib/helpers/SchemaGenerator.d.ts +5 -5
  57. package/lib/helpers/SchemaGenerator.js +97 -97
  58. package/lib/helpers/SchemaHelper.d.ts +5 -5
  59. package/lib/helpers/SchemaHelper.js +21 -21
  60. package/lib/helpers/UserActionsLog/UserActionsLogHelper.d.ts +2 -2
  61. package/lib/helpers/UserActionsLog/UserActionsLogHelper.js +49 -49
  62. package/lib/locales/en.json +53 -53
  63. package/lib/middlewares/cache/decorator.d.ts +3 -3
  64. package/lib/middlewares/cache/decorator.js +60 -60
  65. package/lib/middlewares/cache/deletionMethods.d.ts +3 -3
  66. package/lib/middlewares/cache/deletionMethods.js +23 -23
  67. package/lib/middlewares/isAuth.d.ts +13 -13
  68. package/lib/middlewares/isAuth.js +43 -43
  69. package/lib/models/ModelNames.d.ts +8 -8
  70. package/lib/models/ModelNames.js +11 -11
  71. package/lib/models/adminpermission/AdminPermission.d.ts +6 -6
  72. package/lib/models/adminpermission/AdminPermission.js +23 -23
  73. package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
  74. package/lib/models/adminpermission/IAdminPermission.js +2 -2
  75. package/lib/models/customPage/CustomPage.d.ts +2 -2
  76. package/lib/models/customPage/CustomPage.js +38 -38
  77. package/lib/models/customPage/ICustomPage.d.ts +17 -17
  78. package/lib/models/customPage/ICustomPage.js +2 -2
  79. package/lib/models/file/File.d.ts +2 -2
  80. package/lib/models/file/File.js +23 -23
  81. package/lib/models/file/IFile.d.ts +15 -15
  82. package/lib/models/file/IFile.js +2 -2
  83. package/lib/models/location/ILocation.d.ts +14 -14
  84. package/lib/models/location/ILocation.js +2 -2
  85. package/lib/models/location/Location.d.ts +2 -2
  86. package/lib/models/location/Location.js +21 -21
  87. package/lib/models/modelConfiguration/IModelConfigurations.d.ts +29 -29
  88. package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
  89. package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
  90. package/lib/models/modelConfiguration/ModelConfiguration.js +95 -95
  91. package/lib/models/permission/IPermission.d.ts +14 -14
  92. package/lib/models/permission/IPermission.js +2 -2
  93. package/lib/models/permission/Permission.d.ts +2 -2
  94. package/lib/models/permission/Permission.js +21 -21
  95. package/lib/models/request-log/IRequestLog.d.ts +22 -22
  96. package/lib/models/request-log/IRequestLog.js +2 -2
  97. package/lib/models/request-log/RequestLog.d.ts +3 -3
  98. package/lib/models/request-log/RequestLog.js +51 -51
  99. package/lib/models/userActionsLog/IUserActionsLog.d.ts +24 -24
  100. package/lib/models/userActionsLog/IUserActionsLog.js +9 -9
  101. package/lib/models/userActionsLog/UserActionsLog.d.ts +3 -3
  102. package/lib/models/userActionsLog/UserActionsLog.js +41 -41
  103. package/lib/pdf/ReportTemplate.d.ts +71 -71
  104. package/lib/pdf/ReportTemplate.js +94 -94
  105. package/lib/repositories/DashboardRepository.d.ts +5 -5
  106. package/lib/repositories/DashboardRepository.js +12 -12
  107. package/lib/repositories/Repository.d.ts +68 -68
  108. package/lib/repositories/Repository.js +212 -212
  109. package/lib/repositories/RequestLogRepository.d.ts +10 -10
  110. package/lib/repositories/RequestLogRepository.js +54 -54
  111. package/lib/repositories/SaveResult.d.ts +14 -14
  112. package/lib/repositories/SaveResult.js +18 -18
  113. package/lib/router/index.d.ts +8 -8
  114. package/lib/router/index.js +104 -104
  115. package/lib/types/DashbordConfig.d.ts +21 -21
  116. package/lib/types/DashbordConfig.js +2 -2
  117. package/lib/types/IConfigurationFile.d.ts +9 -9
  118. package/lib/types/IConfigurationFile.js +2 -2
  119. package/lib/types/IResourceFile.d.ts +648 -643
  120. package/lib/types/IResourceFile.js +2 -2
  121. package/lib/types/IResourceResponse.d.ts +95 -95
  122. package/lib/types/IResourceResponse.js +2 -2
  123. package/lib/types/helpers.d.ts +65 -61
  124. package/lib/types/helpers.js +76 -71
  125. package/lib/utils/ResourceUtils.d.ts +2 -2
  126. package/lib/utils/ResourceUtils.js +7 -7
  127. package/lib/utils/ResponseUtils.d.ts +11 -11
  128. package/lib/utils/ResponseUtils.js +41 -41
  129. package/lib/utils/StringUtils.d.ts +9 -9
  130. package/lib/utils/StringUtils.js +46 -46
  131. package/lib/view/asset-manifest.json +18 -18
  132. package/lib/view/assets/icons/delete_icon.svg +3 -3
  133. package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
  134. package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
  135. package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
  136. package/lib/view/assets/icons/info_icon.svg +3 -3
  137. package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
  138. package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
  139. package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
  140. package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
  141. package/lib/view/assets/icons/small_info_icon.svg +3 -3
  142. package/lib/view/assets/illustrations/Group 16.svg +4 -4
  143. package/lib/view/assets/illustrations/logo.svg +5 -5
  144. package/lib/view/favicon/browserconfig.xml +9 -9
  145. package/lib/view/favicon/safari-pinned-tab.svg +182 -182
  146. package/lib/view/favicon/site.webmanifest +19 -19
  147. package/lib/view/fonts/index.css +18 -18
  148. package/lib/view/index.html +52 -52
  149. package/lib/view/manifest.json +20 -20
  150. package/lib/view/robots.txt +3 -3
  151. package/lib/view/static/css/main.54de06ef.css +1 -1
  152. package/lib/view/static/js/574.778b5963.chunk.js +1 -1
  153. package/lib/view/static/js/678.521704a3.chunk.js +1 -1
  154. package/lib/view/static/js/798.54856416.chunk.js +1 -1
  155. package/lib/view/static/js/main.4687f255.js +2 -2
  156. package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
  157. package/package.json +61 -61
@@ -1,643 +1,648 @@
1
- import { ValidationChain } from 'express-validator';
2
- import { Document, Model } from 'mongoose';
3
- import { IRequest } from '../middlewares/isAuth';
4
- import { IRepository, PageInfo, PaginateParams } from '../repositories/Repository';
5
- import SaveResult from '../repositories/SaveResult';
6
- import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, NeighborTypes, Virtuals } from './helpers';
7
- declare type orderTypes = 'asc' | 'desc';
8
- declare type VirtualFieldTypes = 'password' | 'ref' | 'Array';
9
- declare type Severity = 'success' | 'info' | 'warning' | 'error';
10
- declare type ButtonColors = 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
11
- declare type ButtonVariants = 'text' | 'outlined' | 'contained';
12
- declare type ButtonSizes = 'small' | 'medium' | 'large';
13
- declare type PopulateFunction = (populatedString: any) => Promise<any>;
14
- interface Parent {
15
- /**
16
- * Name of the parent
17
- */
18
- name: string;
19
- /**
20
- * Icon of the parent. You can get the icons from
21
- * {@link https://mui.com/material-ui/material-icons/}
22
- */
23
- icon: string;
24
- }
25
- interface IPopulate {
26
- /**
27
- * This function is called for all the endpoints to have an access over the populated string
28
- */
29
- all?: PopulateFunction;
30
- /**
31
- * This function is called for the list endpoint to have an access over the populated string
32
- */
33
- list?: PopulateFunction;
34
- /**
35
- * This function is called for the get one endpoint either in show or form an access over the populated string
36
- */
37
- show?: PopulateFunction;
38
- }
39
- interface Action {
40
- /**
41
- * Specify if this action is accessible or not.
42
- * @default True for show, edit, delete, and new.
43
- * @default false for bulk delete.
44
- * You can ovveride any of these values here.
45
- */
46
- isAccessible?: boolean;
47
- /**
48
- * Specify if the page requires to be reloaded after executing the action
49
- * @default Fale for show, edit, delete, and new.
50
- */
51
- reloadAfterAction?: boolean;
52
- /**
53
- * The property that manages which admin role can use this action.
54
- * This function's result alters the isAccessible value. So no need to use both properties.
55
- * If both are used then isAccessible has the higher priority.
56
- * @default 'Same as isAccessible'
57
- */
58
- isAllowed?: (currentUser: Document) => boolean;
59
- /**
60
- * The property that manages which action will be extracted from action menu in list.
61
- * @default true for edit and show false for others
62
- */
63
- isMainAction?: boolean;
64
- }
65
- interface ICrudOperations {
66
- index?: {
67
- /**
68
- * Before handler that gives you the access to the filter object.
69
- * You can add to the filter object any key and value that will be used in the filter query before getting the records for list.
70
- * @returns the filter object
71
- */
72
- before?: (req: IRequest, filter: {
73
- [key: string]: any;
74
- }, currentUser: Document) => Promise<{
75
- [key: string]: any;
76
- }>;
77
- /**
78
- * After handler that gives you the access to the array of documents.
79
- * @returns the array of documents
80
- */
81
- after?: (req: IRequest, documents: Document[], currentUser: Document) => Promise<Document[]>;
82
- /**
83
- * index handler that gives you the access to the run custom index method with custom query.
84
- * @returns result list of records
85
- */
86
- index?: (req: IRequest, filter: {
87
- [key: string]: any;
88
- }, sortQuery: {
89
- [key: string]: any;
90
- }, paginateParams: PaginateParams | undefined, populate: any, currentUser: Document) => Promise<{
91
- records: Document[];
92
- pageInfo?: PageInfo;
93
- }>;
94
- };
95
- create?: {
96
- /**
97
- * Before handler that is called before creating a new record.
98
- * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
99
- * @returns the params
100
- */
101
- before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
102
- /**
103
- * After handler that gives you the access to the saved document.
104
- * @returns the saved document
105
- */
106
- after?: (req: IRequest, document: Document, currentUser: Document, params: any) => Promise<Document>;
107
- /**
108
- * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the save query.
109
- */
110
- validators?: ValidationChain[];
111
- };
112
- update?: {
113
- /**
114
- * Before handler that is called before updating a record.
115
- * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
116
- * @returns the params
117
- */
118
- before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
119
- /**
120
- * After handler that gives you the access to the updated document.
121
- * @returns the updated document
122
- */
123
- after?: (req: IRequest, document: Document, params: any, currentUser: Document) => Promise<Document>;
124
- /**
125
- * update handler that gives you the access to the run custom update method with custom query.
126
- * @returns saved result with updated document
127
- */
128
- update?: (req: IRequest, record: Document, recordParams: any, currentUser: Document) => Promise<SaveResult<any>>;
129
- /**
130
- * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the update query.
131
- */
132
- validators?: ValidationChain[];
133
- };
134
- show?: {
135
- after?: (req: IRequest, record: Document) => Promise<{
136
- record: Document;
137
- [key: string]: any;
138
- }>;
139
- /**
140
- * A function that is called before getting the next or the previous record. It gives you the access to the filter object.
141
- * @returns The filter object
142
- */
143
- nextPreviousButtonHandler?: (req: IRequest, filter: {
144
- [key: string]: any;
145
- }, currentUser: Document, direction: NeighborTypes) => Promise<{
146
- [key: string]: any;
147
- }>;
148
- };
149
- }
150
- export interface ActionData {
151
- /**
152
- * Record document
153
- */
154
- record: any;
155
- /**
156
- * Current user data
157
- */
158
- currentUser: Document;
159
- /**
160
- * Resource data to which this record belongs
161
- */
162
- resource: {
163
- /**
164
- * Model name of this table.
165
- */
166
- name: string;
167
- /**
168
- * Path of the resource to which you can redirect.
169
- */
170
- path: string;
171
- /**
172
- * Repository of this resource.
173
- */
174
- repository: IRepository<Document>;
175
- };
176
- }
177
- interface IFilters {
178
- /**
179
- * Scope filter props.
180
- * Can be either auto or manual. It cannot be both.
181
- * This filter is not accessible by default
182
- */
183
- scopes?: {
184
- /**
185
- * Specify if this filter is accessible or not
186
- * @default false
187
- */
188
- isAccessible: boolean;
189
- /**
190
- * Show All tab
191
- * @default true
192
- */
193
- showAll?: boolean;
194
- /**
195
- * Automatic scope that filters by the specified key with one of the given options
196
- * This filter works automatically by mentioning the key as saved in the database along with the values that this key can has.
197
- * It doesn't need a handler
198
- */
199
- auto?: IAutoScope;
200
- /**
201
- * Manual scope by using a handler.
202
- * In this case you can put the options you like with specifying in the handler what to do with each option.
203
- */
204
- manual?: IManualScope;
205
- };
206
- /**
207
- * Search bar filter props
208
- */
209
- searchBar?: {
210
- /**
211
- * Specify if this filter is accessible or not
212
- * @default true
213
- */
214
- isAccessible: boolean;
215
- };
216
- }
217
- interface IAutoScope {
218
- /**
219
- * Key of property as specified in the database
220
- */
221
- key: string;
222
- /**
223
- * Array of values that this key can have
224
- */
225
- options: string[];
226
- }
227
- interface IManualScope {
228
- /**
229
- * Array of values that will be appeared in the scope
230
- */
231
- options: string[];
232
- /**
233
- * A handler that will be called when scope filter is used.
234
- * This handler should perform a switch case on the specified options values, each case set the filter on its way.
235
- */
236
- handler: (filter: {
237
- [key: string]: any;
238
- }, scope: string, currentUser: Document) => Promise<{
239
- [key: string]: any;
240
- }>;
241
- }
242
- export interface IFieldValue {
243
- /**
244
- * If the field is required in the schema and you don't want it to be required in the form, you can override this here.
245
- * @default 'same as schema'
246
- */
247
- required?: boolean;
248
- /**
249
- * Specify either this field can be edited or not.
250
- * @default true
251
- */
252
- isEditable?: boolean;
253
- /**
254
- * Specify the type of the field. Can be used for specifying localized string, image,... etc.
255
- * @default 'Same as schema''
256
- */
257
- type?: FieldTypes;
258
- /**
259
- * Specify the enum values if the field type is an enum.
260
- * You can give custom labels with custom background color of the chib as color and label color as labelColor
261
- * @default 'Same as schema''
262
- */
263
- enumValues?: string[] | {
264
- [key: string]: {
265
- label: string;
266
- color: string;
267
- labelColor: string;
268
- };
269
- };
270
- /**
271
- * Specify the allowed country codes.
272
- * @required if the type is phone number
273
- * ex: ["sa", "eg", ...]
274
- */
275
- countryCodes?: string[];
276
- /**
277
- * Specify the array type if the field is of type array.
278
- * @default 'Same as schema''
279
- */
280
- arrayType?: FieldTypes;
281
- /**
282
- * Specify if the array is draggable. Only used when the field type is an array.
283
- * @default 'true''
284
- */
285
- isDraggable?: boolean;
286
- /**
287
- * Can be used only if this field is a reference to the Image collection
288
- */
289
- mediaUploader?: boolean;
290
- /**
291
- * Specify the type of the file to be uploaded. Only required if the media uploader is true.
292
- * @default image
293
- */
294
- fileType?: FileTypes;
295
- /**
296
- * Specify if the date is shown with time or not. Only used if the field type is Date
297
- * @default false
298
- */
299
- withTime?: boolean;
300
- /**
301
- * Specify the api route that to be called for getting the referenced values
302
- * @default undefined
303
- */
304
- apiRoute?: string;
305
- /**
306
- * Path of the value inside the model schema
307
- * @default undefined
308
- */
309
- valuePath?: string;
310
- /**
311
- * Specify if this property is clickable or not in the list view.
312
- * @default undefined
313
- */
314
- isClickable?: boolean;
315
- /**
316
- * Specify the keys that will be shown in the nested schema. Only used when the type is nested schema
317
- * @default undefined
318
- */
319
- keys?: string[];
320
- /**
321
- * Specify the nested schema. Only used if the type is nested schema.
322
- * @default undefined
323
- */
324
- schema?: IModel | {
325
- [key: string]: IFieldValue;
326
- };
327
- /**
328
- * Specify if this field is filtered by multiple values not only one value. Only used if this value is one of the quick filters.
329
- * @default undefined
330
- */
331
- multipleInFilter?: boolean;
332
- }
333
- export interface IVirtualValue {
334
- /**
335
- * For now we have some virtual fields that can be added
336
- * 1) Password: If you want to add password field in the creation form for example
337
- * 2) ref: If it is a one to many realtion. For example, if you want to get all subCatogeries that belong to a category when you show the category record
338
- * 3) array: If this field is an array
339
- */
340
- type: VirtualFieldTypes;
341
- /**
342
- * Specify the key that should be filtered by in case of 1 to many realtionship
343
- */
344
- filterBy?: string;
345
- /**
346
- * Array type exists only if the type is array
347
- */
348
- arrayType?: string;
349
- /**
350
- * Defines where this virtaul field need to be appeared
351
- */
352
- showIn: Virtuals;
353
- required: boolean;
354
- /**
355
- * Define Virtual field's resource in case of ref type or array of ref type
356
- */
357
- resource?: Model<any, any>;
358
- /**
359
- * Define Filter query creator required in case of showIn Filter
360
- */
361
- handler?: (filterQuery: {
362
- [key: string]: any;
363
- }, value: any | any[]) => Promise<{
364
- [key: string]: any;
365
- }>;
366
- }
367
- export interface IModel {
368
- /**
369
- * virtual data props
370
- */
371
- virtuals?: {
372
- [key: string]: IVirtualValue;
373
- };
374
- }
375
- interface ActionOptions {
376
- show?: Action;
377
- new?: Action;
378
- edit?: Action;
379
- delete?: Action;
380
- bulkDelete?: Action;
381
- /**
382
- * Any extra action to be added.
383
- */
384
- extras?: ExtraAction[];
385
- }
386
- export interface ExtraAction {
387
- /**
388
- * Key of this action.
389
- * Should be unique in the same resource file
390
- */
391
- key: string;
392
- /**
393
- * Name of this action
394
- */
395
- name: string;
396
- /**
397
- * Icon of this action.
398
- * {@link https://mui.com/material-ui/material-icons/}
399
- */
400
- icon: string;
401
- /**
402
- * Color of the action button
403
- * In case of bulk actions it is one of the button colors. @default inherit
404
- * In case of record actions it is any color like red, green, ... @default black
405
- */
406
- color?: string | ButtonColors;
407
- /**
408
- * Size of the action button. Only used in case of bulk actions
409
- * @default small
410
- */
411
- size?: ButtonSizes;
412
- /**
413
- * Variant of the action button. Only used in case of bulk actions
414
- * @default contained
415
- */
416
- variant?: ButtonVariants;
417
- /**
418
- * Action type if it is record action or resource action.
419
- */
420
- actionType: ActionTypes;
421
- /**
422
- * Guard message title that appears before executing the action to confirm execution.
423
- * @default 'No guard message'
424
- */
425
- guardTitle?: string;
426
- /**
427
- * Guard message body that appears before executing the action to confirm execution.
428
- * @default 'No guard message'
429
- */
430
- guard?: string;
431
- /**
432
- * Alert message appear after executing this action.
433
- * @default 'Action was executed successfully'
434
- */
435
- message?: string;
436
- /**
437
- * The severity of the alert. This defines the color and icon used.
438
- * @default 'success'
439
- */
440
- severity?: Severity;
441
- /**
442
- * Specify if you need the dialog to be in full screen or not. Used only in case of custom component strategy
443
- * @default 'false'
444
- */
445
- fullScreen?: boolean;
446
- /**
447
- * @returns boolean value.
448
- * This value Specifies to which records should this action appears.
449
- * @default 'Action is shown to all records'
450
- */
451
- isVisible?: (data: ActionData) => Promise<boolean>;
452
- /**
453
- * Handler function that is executed after clicking the action.
454
- */
455
- handler: (req: IRequest, res: any, data: ActionData) => Promise<IActionHandlerResponse>;
456
- /**
457
- * Icon of this action.
458
- * {@link https://mui.com/material-ui/material-icons/}
459
- */
460
- handlerStrategy?: HandlerStrategy;
461
- /**
462
- * The property that manages which action will be extracted from action menu in list.
463
- * @default true for edit and show false for others
464
- */
465
- isMainAction?: boolean;
466
- }
467
- export interface IActionHandlerResponse {
468
- /**
469
- * The action taken after executing the action.
470
- * For example, if you would like to go to list after executing the action, just set this value by list
471
- */
472
- action: ActionNames;
473
- /**
474
- * Path of the resource that is intended to redirect.
475
- * Is set to resource.path if you would like to be in the same table
476
- */
477
- path: string;
478
- /**
479
- * Id of the record that is used in actions that needs record id like show or edit
480
- */
481
- recordId?: string;
482
- /**
483
- * Path of the uploaded file in case of file download handling strategy
484
- */
485
- filePath?: string;
486
- }
487
- export interface IResourceFile {
488
- properties: {
489
- /**
490
- * The model
491
- */
492
- resource: Model<any, any>;
493
- /**
494
- * Model name as saved in the data base.
495
- */
496
- modelName: string;
497
- /**
498
- * Name of this model appeared on the nav bar.
499
- * @default 'Model name'
500
- */
501
- name?: string;
502
- /**
503
- * Property of this table that is shown as the link for the record.
504
- * Used to be searched by in the search bar.
505
- * If not mentioned explicitly, a search is done on the schema to check for property title, name, or email.
506
- * If these properties are not found, _id is taken.
507
- */
508
- title?: string;
509
- /**
510
- * The property to be sorted by the documents.
511
- * @default 'The schema title'
512
- */
513
- defaultOrderBy?: string;
514
- /**
515
- * The property that controls the permission of this model according to the current user role.
516
- * Specify either this user is allowed to see this model or not.
517
- * @default true
518
- */
519
- isAllowed?: (currentUser: Document) => Promise<boolean>;
520
- /**
521
- * The property that controls the visibility of this resource in the nav bar
522
- * @default true
523
- */
524
- isVisible?: (currentUser: Document) => Promise<boolean>;
525
- /**
526
- * The property that controls the ability of logging changes of this resource.
527
- * @default false
528
- */
529
- enableLog?: (currentUser: Document) => Promise<boolean>;
530
- /**
531
- * The default order
532
- * @default asc
533
- */
534
- defaultOrder?: orderTypes;
535
- /**
536
- * Number of rows per page
537
- * @default 10
538
- */
539
- defaultrowsPerPage?: number;
540
- /**
541
- * The parent that this model is belong to in the nav bar.
542
- * @default 'Set up parent'
543
- */
544
- parent?: Parent;
545
- /**
546
- * Array of fields that are completely hidden from all pages
547
- */
548
- hiddenProperties?: string[];
549
- /**
550
- * Action options for overriding existing actions accessibility or adding custom actions
551
- */
552
- actions?: ActionOptions;
553
- /**
554
- * Filters options
555
- */
556
- filters?: IFilters;
557
- /**
558
- * Using before or after handlers of any crud operation
559
- */
560
- crudOperations?: ICrudOperations;
561
- /**
562
- * Translation object of the fields' names.
563
- */
564
- keysTranslations?: {
565
- [key: string]: any;
566
- };
567
- /**
568
- * Translation object of the actions' names.
569
- */
570
- actionsTranslations?: {
571
- [key: string]: any;
572
- };
573
- /**
574
- * Override some props of a field's schema structure
575
- * Add a new virtual property
576
- */
577
- model?: {
578
- [key: string]: IFieldValue;
579
- } | IModel;
580
- /**
581
- * Override the populated object
582
- */
583
- populate?: IPopulate;
584
- /**
585
- * Disable the display of next and previous buttons in the show page
586
- * @default false
587
- */
588
- disableNextPreviousButtonsInShowPage?: boolean;
589
- /**
590
- * Disable the display of next and previous buttons in the edit page
591
- * @default false
592
- */
593
- disableNextPreviousButtonsInEditPage?: boolean;
594
- /**
595
- * The option to display the edit page instead of the show page
596
- * @default false
597
- */
598
- displayEditPageInShowPage?: boolean;
599
- /**
600
- * Specify the path of image to be shown beside the name in the reference options
601
- * @default undefined
602
- */
603
- imageOnReferencePath?: string;
604
- /**
605
- * The option to disable displaying the image beside the name in the reference options
606
- * @default false
607
- */
608
- disableImageOnReference?: boolean;
609
- /**
610
- * An object for any extra data need to be sent with the resource file
611
- * @default undefined
612
- */
613
- extras?: {
614
- [key: string]: any;
615
- };
616
- };
617
- /**
618
- * Array of properties that should be appeared in the list action.
619
- * @default 'The whole fields'
620
- */
621
- listProperties?: string[];
622
- /**
623
- * Arrays of properties that should be appeared in the show action.
624
- * @default 'The whole fields'
625
- */
626
- showProperties?: string[];
627
- /**
628
- * Array of properties that should be appeared in the create/edit form.
629
- * @default 'The whole fields'
630
- */
631
- formProperties?: string[];
632
- /**
633
- * Array of properties that should be appeared in the filter.
634
- * @default 'The whole fields'
635
- */
636
- filterProperties?: string[];
637
- /**
638
- * Array of properties that should be appeared in the quick filters.
639
- * @default 'Empty array'
640
- */
641
- quickFilterProperties?: string[];
642
- }
643
- export {};
1
+ import { ValidationChain } from 'express-validator';
2
+ import { Document, Model } from 'mongoose';
3
+ import { IRequest } from '../middlewares/isAuth';
4
+ import { IRepository, PageInfo, PaginateParams } from '../repositories/Repository';
5
+ import SaveResult from '../repositories/SaveResult';
6
+ import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, ImageOptimizingCategories, NeighborTypes, Virtuals } from './helpers';
7
+ declare type orderTypes = 'asc' | 'desc';
8
+ declare type VirtualFieldTypes = 'password' | 'ref' | 'Array';
9
+ declare type Severity = 'success' | 'info' | 'warning' | 'error';
10
+ declare type ButtonColors = 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
11
+ declare type ButtonVariants = 'text' | 'outlined' | 'contained';
12
+ declare type ButtonSizes = 'small' | 'medium' | 'large';
13
+ declare type PopulateFunction = (populatedString: any) => Promise<any>;
14
+ interface Parent {
15
+ /**
16
+ * Name of the parent
17
+ */
18
+ name: string;
19
+ /**
20
+ * Icon of the parent. You can get the icons from
21
+ * {@link https://mui.com/material-ui/material-icons/}
22
+ */
23
+ icon: string;
24
+ }
25
+ interface IPopulate {
26
+ /**
27
+ * This function is called for all the endpoints to have an access over the populated string
28
+ */
29
+ all?: PopulateFunction;
30
+ /**
31
+ * This function is called for the list endpoint to have an access over the populated string
32
+ */
33
+ list?: PopulateFunction;
34
+ /**
35
+ * This function is called for the get one endpoint either in show or form an access over the populated string
36
+ */
37
+ show?: PopulateFunction;
38
+ }
39
+ interface Action {
40
+ /**
41
+ * Specify if this action is accessible or not.
42
+ * @default True for show, edit, delete, and new.
43
+ * @default false for bulk delete.
44
+ * You can ovveride any of these values here.
45
+ */
46
+ isAccessible?: boolean;
47
+ /**
48
+ * Specify if the page requires to be reloaded after executing the action
49
+ * @default Fale for show, edit, delete, and new.
50
+ */
51
+ reloadAfterAction?: boolean;
52
+ /**
53
+ * The property that manages which admin role can use this action.
54
+ * This function's result alters the isAccessible value. So no need to use both properties.
55
+ * If both are used then isAccessible has the higher priority.
56
+ * @default 'Same as isAccessible'
57
+ */
58
+ isAllowed?: (currentUser: Document) => boolean;
59
+ /**
60
+ * The property that manages which action will be extracted from action menu in list.
61
+ * @default true for edit and show false for others
62
+ */
63
+ isMainAction?: boolean;
64
+ }
65
+ interface ICrudOperations {
66
+ index?: {
67
+ /**
68
+ * Before handler that gives you the access to the filter object.
69
+ * You can add to the filter object any key and value that will be used in the filter query before getting the records for list.
70
+ * @returns the filter object
71
+ */
72
+ before?: (req: IRequest, filter: {
73
+ [key: string]: any;
74
+ }, currentUser: Document) => Promise<{
75
+ [key: string]: any;
76
+ }>;
77
+ /**
78
+ * After handler that gives you the access to the array of documents.
79
+ * @returns the array of documents
80
+ */
81
+ after?: (req: IRequest, documents: Document[], currentUser: Document) => Promise<Document[]>;
82
+ /**
83
+ * index handler that gives you the access to the run custom index method with custom query.
84
+ * @returns result list of records
85
+ */
86
+ index?: (req: IRequest, filter: {
87
+ [key: string]: any;
88
+ }, sortQuery: {
89
+ [key: string]: any;
90
+ }, paginateParams: PaginateParams | undefined, populate: any, currentUser: Document) => Promise<{
91
+ records: Document[];
92
+ pageInfo?: PageInfo;
93
+ }>;
94
+ };
95
+ create?: {
96
+ /**
97
+ * Before handler that is called before creating a new record.
98
+ * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
99
+ * @returns the params
100
+ */
101
+ before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
102
+ /**
103
+ * After handler that gives you the access to the saved document.
104
+ * @returns the saved document
105
+ */
106
+ after?: (req: IRequest, document: Document, currentUser: Document, params: any) => Promise<Document>;
107
+ /**
108
+ * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the save query.
109
+ */
110
+ validators?: ValidationChain[];
111
+ };
112
+ update?: {
113
+ /**
114
+ * Before handler that is called before updating a record.
115
+ * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
116
+ * @returns the params
117
+ */
118
+ before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
119
+ /**
120
+ * After handler that gives you the access to the updated document.
121
+ * @returns the updated document
122
+ */
123
+ after?: (req: IRequest, document: Document, params: any, currentUser: Document) => Promise<Document>;
124
+ /**
125
+ * update handler that gives you the access to the run custom update method with custom query.
126
+ * @returns saved result with updated document
127
+ */
128
+ update?: (req: IRequest, record: Document, recordParams: any, currentUser: Document) => Promise<SaveResult<any>>;
129
+ /**
130
+ * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the update query.
131
+ */
132
+ validators?: ValidationChain[];
133
+ };
134
+ show?: {
135
+ after?: (req: IRequest, record: Document) => Promise<{
136
+ record: Document;
137
+ [key: string]: any;
138
+ }>;
139
+ /**
140
+ * A function that is called before getting the next or the previous record. It gives you the access to the filter object.
141
+ * @returns The filter object
142
+ */
143
+ nextPreviousButtonHandler?: (req: IRequest, filter: {
144
+ [key: string]: any;
145
+ }, currentUser: Document, direction: NeighborTypes) => Promise<{
146
+ [key: string]: any;
147
+ }>;
148
+ };
149
+ }
150
+ export interface ActionData {
151
+ /**
152
+ * Record document
153
+ */
154
+ record: any;
155
+ /**
156
+ * Current user data
157
+ */
158
+ currentUser: Document;
159
+ /**
160
+ * Resource data to which this record belongs
161
+ */
162
+ resource: {
163
+ /**
164
+ * Model name of this table.
165
+ */
166
+ name: string;
167
+ /**
168
+ * Path of the resource to which you can redirect.
169
+ */
170
+ path: string;
171
+ /**
172
+ * Repository of this resource.
173
+ */
174
+ repository: IRepository<Document>;
175
+ };
176
+ }
177
+ interface IFilters {
178
+ /**
179
+ * Scope filter props.
180
+ * Can be either auto or manual. It cannot be both.
181
+ * This filter is not accessible by default
182
+ */
183
+ scopes?: {
184
+ /**
185
+ * Specify if this filter is accessible or not
186
+ * @default false
187
+ */
188
+ isAccessible: boolean;
189
+ /**
190
+ * Show All tab
191
+ * @default true
192
+ */
193
+ showAll?: boolean;
194
+ /**
195
+ * Automatic scope that filters by the specified key with one of the given options
196
+ * This filter works automatically by mentioning the key as saved in the database along with the values that this key can has.
197
+ * It doesn't need a handler
198
+ */
199
+ auto?: IAutoScope;
200
+ /**
201
+ * Manual scope by using a handler.
202
+ * In this case you can put the options you like with specifying in the handler what to do with each option.
203
+ */
204
+ manual?: IManualScope;
205
+ };
206
+ /**
207
+ * Search bar filter props
208
+ */
209
+ searchBar?: {
210
+ /**
211
+ * Specify if this filter is accessible or not
212
+ * @default true
213
+ */
214
+ isAccessible: boolean;
215
+ };
216
+ }
217
+ interface IAutoScope {
218
+ /**
219
+ * Key of property as specified in the database
220
+ */
221
+ key: string;
222
+ /**
223
+ * Array of values that this key can have
224
+ */
225
+ options: string[];
226
+ }
227
+ interface IManualScope {
228
+ /**
229
+ * Array of values that will be appeared in the scope
230
+ */
231
+ options: string[];
232
+ /**
233
+ * A handler that will be called when scope filter is used.
234
+ * This handler should perform a switch case on the specified options values, each case set the filter on its way.
235
+ */
236
+ handler: (filter: {
237
+ [key: string]: any;
238
+ }, scope: string, currentUser: Document) => Promise<{
239
+ [key: string]: any;
240
+ }>;
241
+ }
242
+ export interface IFieldValue {
243
+ /**
244
+ * If the field is required in the schema and you don't want it to be required in the form, you can override this here.
245
+ * @default 'same as schema'
246
+ */
247
+ required?: boolean;
248
+ /**
249
+ * Specify either this field can be edited or not.
250
+ * @default true
251
+ */
252
+ isEditable?: boolean;
253
+ /**
254
+ * Specify the type of the field. Can be used for specifying localized string, image,... etc.
255
+ * @default 'Same as schema''
256
+ */
257
+ type?: FieldTypes;
258
+ /**
259
+ * Specify the enum values if the field type is an enum.
260
+ * You can give custom labels with custom background color of the chib as color and label color as labelColor
261
+ * @default 'Same as schema''
262
+ */
263
+ enumValues?: string[] | {
264
+ [key: string]: {
265
+ label: string;
266
+ color: string;
267
+ labelColor: string;
268
+ };
269
+ };
270
+ /**
271
+ * Specify the allowed country codes.
272
+ * @required if the type is phone number
273
+ * ex: ["sa", "eg", ...]
274
+ */
275
+ countryCodes?: string[];
276
+ /**
277
+ * Specify the array type if the field is of type array.
278
+ * @default 'Same as schema''
279
+ */
280
+ arrayType?: FieldTypes;
281
+ /**
282
+ * Specify if the array is draggable. Only used when the field type is an array.
283
+ * @default 'true''
284
+ */
285
+ isDraggable?: boolean;
286
+ /**
287
+ * Can be used only if this field is a reference to the Image collection
288
+ */
289
+ mediaUploader?: boolean;
290
+ /**
291
+ * Used only if this field is of type image. It specifies what is the optimizing level of an image before upload
292
+ * @default NORMAL
293
+ */
294
+ imageOptimizingCategory?: ImageOptimizingCategories;
295
+ /**
296
+ * Specify the type of the file to be uploaded. Only required if the media uploader is true.
297
+ * @default image
298
+ */
299
+ fileType?: FileTypes;
300
+ /**
301
+ * Specify if the date is shown with time or not. Only used if the field type is Date
302
+ * @default false
303
+ */
304
+ withTime?: boolean;
305
+ /**
306
+ * Specify the api route that to be called for getting the referenced values
307
+ * @default undefined
308
+ */
309
+ apiRoute?: string;
310
+ /**
311
+ * Path of the value inside the model schema
312
+ * @default undefined
313
+ */
314
+ valuePath?: string;
315
+ /**
316
+ * Specify if this property is clickable or not in the list view.
317
+ * @default undefined
318
+ */
319
+ isClickable?: boolean;
320
+ /**
321
+ * Specify the keys that will be shown in the nested schema. Only used when the type is nested schema
322
+ * @default undefined
323
+ */
324
+ keys?: string[];
325
+ /**
326
+ * Specify the nested schema. Only used if the type is nested schema.
327
+ * @default undefined
328
+ */
329
+ schema?: IModel | {
330
+ [key: string]: IFieldValue;
331
+ };
332
+ /**
333
+ * Specify if this field is filtered by multiple values not only one value. Only used if this value is one of the quick filters.
334
+ * @default undefined
335
+ */
336
+ multipleInFilter?: boolean;
337
+ }
338
+ export interface IVirtualValue {
339
+ /**
340
+ * For now we have some virtual fields that can be added
341
+ * 1) Password: If you want to add password field in the creation form for example
342
+ * 2) ref: If it is a one to many realtion. For example, if you want to get all subCatogeries that belong to a category when you show the category record
343
+ * 3) array: If this field is an array
344
+ */
345
+ type: VirtualFieldTypes;
346
+ /**
347
+ * Specify the key that should be filtered by in case of 1 to many realtionship
348
+ */
349
+ filterBy?: string;
350
+ /**
351
+ * Array type exists only if the type is array
352
+ */
353
+ arrayType?: string;
354
+ /**
355
+ * Defines where this virtaul field need to be appeared
356
+ */
357
+ showIn: Virtuals;
358
+ required: boolean;
359
+ /**
360
+ * Define Virtual field's resource in case of ref type or array of ref type
361
+ */
362
+ resource?: Model<any, any>;
363
+ /**
364
+ * Define Filter query creator required in case of showIn Filter
365
+ */
366
+ handler?: (filterQuery: {
367
+ [key: string]: any;
368
+ }, value: any | any[]) => Promise<{
369
+ [key: string]: any;
370
+ }>;
371
+ }
372
+ export interface IModel {
373
+ /**
374
+ * virtual data props
375
+ */
376
+ virtuals?: {
377
+ [key: string]: IVirtualValue;
378
+ };
379
+ }
380
+ interface ActionOptions {
381
+ show?: Action;
382
+ new?: Action;
383
+ edit?: Action;
384
+ delete?: Action;
385
+ bulkDelete?: Action;
386
+ /**
387
+ * Any extra action to be added.
388
+ */
389
+ extras?: ExtraAction[];
390
+ }
391
+ export interface ExtraAction {
392
+ /**
393
+ * Key of this action.
394
+ * Should be unique in the same resource file
395
+ */
396
+ key: string;
397
+ /**
398
+ * Name of this action
399
+ */
400
+ name: string;
401
+ /**
402
+ * Icon of this action.
403
+ * {@link https://mui.com/material-ui/material-icons/}
404
+ */
405
+ icon: string;
406
+ /**
407
+ * Color of the action button
408
+ * In case of bulk actions it is one of the button colors. @default inherit
409
+ * In case of record actions it is any color like red, green, ... @default black
410
+ */
411
+ color?: string | ButtonColors;
412
+ /**
413
+ * Size of the action button. Only used in case of bulk actions
414
+ * @default small
415
+ */
416
+ size?: ButtonSizes;
417
+ /**
418
+ * Variant of the action button. Only used in case of bulk actions
419
+ * @default contained
420
+ */
421
+ variant?: ButtonVariants;
422
+ /**
423
+ * Action type if it is record action or resource action.
424
+ */
425
+ actionType: ActionTypes;
426
+ /**
427
+ * Guard message title that appears before executing the action to confirm execution.
428
+ * @default 'No guard message'
429
+ */
430
+ guardTitle?: string;
431
+ /**
432
+ * Guard message body that appears before executing the action to confirm execution.
433
+ * @default 'No guard message'
434
+ */
435
+ guard?: string;
436
+ /**
437
+ * Alert message appear after executing this action.
438
+ * @default 'Action was executed successfully'
439
+ */
440
+ message?: string;
441
+ /**
442
+ * The severity of the alert. This defines the color and icon used.
443
+ * @default 'success'
444
+ */
445
+ severity?: Severity;
446
+ /**
447
+ * Specify if you need the dialog to be in full screen or not. Used only in case of custom component strategy
448
+ * @default 'false'
449
+ */
450
+ fullScreen?: boolean;
451
+ /**
452
+ * @returns boolean value.
453
+ * This value Specifies to which records should this action appears.
454
+ * @default 'Action is shown to all records'
455
+ */
456
+ isVisible?: (data: ActionData) => Promise<boolean>;
457
+ /**
458
+ * Handler function that is executed after clicking the action.
459
+ */
460
+ handler: (req: IRequest, res: any, data: ActionData) => Promise<IActionHandlerResponse>;
461
+ /**
462
+ * Icon of this action.
463
+ * {@link https://mui.com/material-ui/material-icons/}
464
+ */
465
+ handlerStrategy?: HandlerStrategy;
466
+ /**
467
+ * The property that manages which action will be extracted from action menu in list.
468
+ * @default true for edit and show false for others
469
+ */
470
+ isMainAction?: boolean;
471
+ }
472
+ export interface IActionHandlerResponse {
473
+ /**
474
+ * The action taken after executing the action.
475
+ * For example, if you would like to go to list after executing the action, just set this value by list
476
+ */
477
+ action: ActionNames;
478
+ /**
479
+ * Path of the resource that is intended to redirect.
480
+ * Is set to resource.path if you would like to be in the same table
481
+ */
482
+ path: string;
483
+ /**
484
+ * Id of the record that is used in actions that needs record id like show or edit
485
+ */
486
+ recordId?: string;
487
+ /**
488
+ * Path of the uploaded file in case of file download handling strategy
489
+ */
490
+ filePath?: string;
491
+ }
492
+ export interface IResourceFile {
493
+ properties: {
494
+ /**
495
+ * The model
496
+ */
497
+ resource: Model<any, any>;
498
+ /**
499
+ * Model name as saved in the data base.
500
+ */
501
+ modelName: string;
502
+ /**
503
+ * Name of this model appeared on the nav bar.
504
+ * @default 'Model name'
505
+ */
506
+ name?: string;
507
+ /**
508
+ * Property of this table that is shown as the link for the record.
509
+ * Used to be searched by in the search bar.
510
+ * If not mentioned explicitly, a search is done on the schema to check for property title, name, or email.
511
+ * If these properties are not found, _id is taken.
512
+ */
513
+ title?: string;
514
+ /**
515
+ * The property to be sorted by the documents.
516
+ * @default 'The schema title'
517
+ */
518
+ defaultOrderBy?: string;
519
+ /**
520
+ * The property that controls the permission of this model according to the current user role.
521
+ * Specify either this user is allowed to see this model or not.
522
+ * @default true
523
+ */
524
+ isAllowed?: (currentUser: Document) => Promise<boolean>;
525
+ /**
526
+ * The property that controls the visibility of this resource in the nav bar
527
+ * @default true
528
+ */
529
+ isVisible?: (currentUser: Document) => Promise<boolean>;
530
+ /**
531
+ * The property that controls the ability of logging changes of this resource.
532
+ * @default false
533
+ */
534
+ enableLog?: (currentUser: Document) => Promise<boolean>;
535
+ /**
536
+ * The default order
537
+ * @default asc
538
+ */
539
+ defaultOrder?: orderTypes;
540
+ /**
541
+ * Number of rows per page
542
+ * @default 10
543
+ */
544
+ defaultrowsPerPage?: number;
545
+ /**
546
+ * The parent that this model is belong to in the nav bar.
547
+ * @default 'Set up parent'
548
+ */
549
+ parent?: Parent;
550
+ /**
551
+ * Array of fields that are completely hidden from all pages
552
+ */
553
+ hiddenProperties?: string[];
554
+ /**
555
+ * Action options for overriding existing actions accessibility or adding custom actions
556
+ */
557
+ actions?: ActionOptions;
558
+ /**
559
+ * Filters options
560
+ */
561
+ filters?: IFilters;
562
+ /**
563
+ * Using before or after handlers of any crud operation
564
+ */
565
+ crudOperations?: ICrudOperations;
566
+ /**
567
+ * Translation object of the fields' names.
568
+ */
569
+ keysTranslations?: {
570
+ [key: string]: any;
571
+ };
572
+ /**
573
+ * Translation object of the actions' names.
574
+ */
575
+ actionsTranslations?: {
576
+ [key: string]: any;
577
+ };
578
+ /**
579
+ * Override some props of a field's schema structure
580
+ * Add a new virtual property
581
+ */
582
+ model?: {
583
+ [key: string]: IFieldValue;
584
+ } | IModel;
585
+ /**
586
+ * Override the populated object
587
+ */
588
+ populate?: IPopulate;
589
+ /**
590
+ * Disable the display of next and previous buttons in the show page
591
+ * @default false
592
+ */
593
+ disableNextPreviousButtonsInShowPage?: boolean;
594
+ /**
595
+ * Disable the display of next and previous buttons in the edit page
596
+ * @default false
597
+ */
598
+ disableNextPreviousButtonsInEditPage?: boolean;
599
+ /**
600
+ * The option to display the edit page instead of the show page
601
+ * @default false
602
+ */
603
+ displayEditPageInShowPage?: boolean;
604
+ /**
605
+ * Specify the path of image to be shown beside the name in the reference options
606
+ * @default undefined
607
+ */
608
+ imageOnReferencePath?: string;
609
+ /**
610
+ * The option to disable displaying the image beside the name in the reference options
611
+ * @default false
612
+ */
613
+ disableImageOnReference?: boolean;
614
+ /**
615
+ * An object for any extra data need to be sent with the resource file
616
+ * @default undefined
617
+ */
618
+ extras?: {
619
+ [key: string]: any;
620
+ };
621
+ };
622
+ /**
623
+ * Array of properties that should be appeared in the list action.
624
+ * @default 'The whole fields'
625
+ */
626
+ listProperties?: string[];
627
+ /**
628
+ * Arrays of properties that should be appeared in the show action.
629
+ * @default 'The whole fields'
630
+ */
631
+ showProperties?: string[];
632
+ /**
633
+ * Array of properties that should be appeared in the create/edit form.
634
+ * @default 'The whole fields'
635
+ */
636
+ formProperties?: string[];
637
+ /**
638
+ * Array of properties that should be appeared in the filter.
639
+ * @default 'The whole fields'
640
+ */
641
+ filterProperties?: string[];
642
+ /**
643
+ * Array of properties that should be appeared in the quick filters.
644
+ * @default 'Empty array'
645
+ */
646
+ quickFilterProperties?: string[];
647
+ }
648
+ export {};