adminforth 2.13.0-next.46 → 2.13.0-next.48
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/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +13 -0
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/utils.d.ts +2 -1
- package/dist/modules/utils.d.ts.map +1 -1
- package/dist/modules/utils.js +51 -1
- package/dist/modules/utils.js.map +1 -1
- package/dist/spa/src/utils.ts +55 -1
- package/package.json +1 -1
- package/dist/spa/src/types/Back.d.ts +0 -1469
- package/dist/spa/src/types/Back.d.ts.map +0 -1
- package/dist/spa/src/types/Back.js +0 -74
- package/dist/spa/src/types/Back.js.map +0 -1
- package/dist/spa/src/types/Common.d.ts +0 -1067
- package/dist/spa/src/types/Common.d.ts.map +0 -1
- package/dist/spa/src/types/Common.js +0 -114
- package/dist/spa/src/types/Common.js.map +0 -1
- package/dist/spa/src/utilsCommon.d.ts +0 -3
- package/dist/spa/src/utilsCommon.d.ts.map +0 -1
- package/dist/spa/src/utilsCommon.js +0 -52
- package/dist/spa/src/utilsCommon.js.map +0 -1
- package/dist/spa/src/utilsCommon.ts +0 -56
|
@@ -1,1067 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types that are common for both frontend side (SPA) and backend side (server).
|
|
3
|
-
*/
|
|
4
|
-
export declare enum AdminForthDataTypes {
|
|
5
|
-
STRING = "string",
|
|
6
|
-
INTEGER = "integer",
|
|
7
|
-
FLOAT = "float",
|
|
8
|
-
DECIMAL = "decimal",
|
|
9
|
-
BOOLEAN = "boolean",
|
|
10
|
-
DATE = "date",
|
|
11
|
-
DATETIME = "datetime",
|
|
12
|
-
TIME = "time",
|
|
13
|
-
TEXT = "text",
|
|
14
|
-
JSON = "json"
|
|
15
|
-
}
|
|
16
|
-
export declare enum AdminForthFilterOperators {
|
|
17
|
-
EQ = "eq",
|
|
18
|
-
NE = "ne",
|
|
19
|
-
GT = "gt",
|
|
20
|
-
LT = "lt",
|
|
21
|
-
GTE = "gte",
|
|
22
|
-
LTE = "lte",
|
|
23
|
-
LIKE = "like",
|
|
24
|
-
ILIKE = "ilike",
|
|
25
|
-
IN = "in",
|
|
26
|
-
NIN = "nin",
|
|
27
|
-
AND = "and",
|
|
28
|
-
OR = "or"
|
|
29
|
-
}
|
|
30
|
-
export type FilterParams = {
|
|
31
|
-
/**
|
|
32
|
-
* Field of resource to filter
|
|
33
|
-
*/
|
|
34
|
-
field: string;
|
|
35
|
-
/**
|
|
36
|
-
* Operator of filter
|
|
37
|
-
*/
|
|
38
|
-
operator: AdminForthFilterOperators;
|
|
39
|
-
/**
|
|
40
|
-
* Value of filter
|
|
41
|
-
*/
|
|
42
|
-
value: string | number | boolean;
|
|
43
|
-
};
|
|
44
|
-
export declare enum AdminForthSortDirections {
|
|
45
|
-
asc = "asc",
|
|
46
|
-
desc = "desc"
|
|
47
|
-
}
|
|
48
|
-
export interface AdminForthColumnEnumItem {
|
|
49
|
-
value: any | null;
|
|
50
|
-
label: string;
|
|
51
|
-
}
|
|
52
|
-
export declare enum ActionCheckSource {
|
|
53
|
-
DisplayButtons = "displayButtons",
|
|
54
|
-
ListRequest = "listRequest",
|
|
55
|
-
ShowRequest = "showRequest",
|
|
56
|
-
EditLoadRequest = "editLoadRequest",// when data for edit page is loaded
|
|
57
|
-
EditRequest = "editRequest",
|
|
58
|
-
CreateRequest = "createRequest",
|
|
59
|
-
DeleteRequest = "deleteRequest",
|
|
60
|
-
BulkActionRequest = "bulkActionRequest",
|
|
61
|
-
CustomActionRequest = "customActionRequest"
|
|
62
|
-
}
|
|
63
|
-
export declare enum AllowedActionsEnum {
|
|
64
|
-
show = "show",
|
|
65
|
-
list = "list",
|
|
66
|
-
edit = "edit",
|
|
67
|
-
create = "create",
|
|
68
|
-
delete = "delete",
|
|
69
|
-
filter = "filter"
|
|
70
|
-
}
|
|
71
|
-
export type AllowedActionsResolved = {
|
|
72
|
-
[key in AllowedActionsEnum]: boolean;
|
|
73
|
-
};
|
|
74
|
-
type Value = any;
|
|
75
|
-
type Operators = {
|
|
76
|
-
$eq: Value;
|
|
77
|
-
} | {
|
|
78
|
-
$not: Value;
|
|
79
|
-
} | {
|
|
80
|
-
$gt: Value;
|
|
81
|
-
} | {
|
|
82
|
-
$gte: Value;
|
|
83
|
-
} | {
|
|
84
|
-
$lt: Value;
|
|
85
|
-
} | {
|
|
86
|
-
$lte: Value;
|
|
87
|
-
} | {
|
|
88
|
-
$in: Value[];
|
|
89
|
-
} | {
|
|
90
|
-
$nin: Value[];
|
|
91
|
-
} | {
|
|
92
|
-
$includes: Value;
|
|
93
|
-
} | {
|
|
94
|
-
$nincludes: Value;
|
|
95
|
-
};
|
|
96
|
-
export type Predicate = {
|
|
97
|
-
$and: Predicate[];
|
|
98
|
-
} | {
|
|
99
|
-
$or: Predicate[];
|
|
100
|
-
} | {
|
|
101
|
-
[key: string]: Operators | Value;
|
|
102
|
-
};
|
|
103
|
-
export interface AdminUser {
|
|
104
|
-
/**
|
|
105
|
-
* primaryKey field value of user in table which is defined by {@link AdminForthConfig.auth.usersResourceId}
|
|
106
|
-
*/
|
|
107
|
-
pk: string | null;
|
|
108
|
-
/**
|
|
109
|
-
* Username which taken from {@link AdminForthConfig.auth.usernameField} field in user resource {@link AdminForthConfig.auth.usersResourceId}
|
|
110
|
-
*/
|
|
111
|
-
username: string;
|
|
112
|
-
/**
|
|
113
|
-
* User record fetched from database, from resource defined in {@link AdminForthConfig.auth.usersResourceId}
|
|
114
|
-
*/
|
|
115
|
-
dbUser: any;
|
|
116
|
-
}
|
|
117
|
-
export interface AdminForthBulkActionCommon {
|
|
118
|
-
id?: string;
|
|
119
|
-
/**
|
|
120
|
-
* Label for action button which will be displayed in the list view
|
|
121
|
-
*/
|
|
122
|
-
label: string;
|
|
123
|
-
/**
|
|
124
|
-
* Add custom class
|
|
125
|
-
**/
|
|
126
|
-
buttonCustomCssClass?: string;
|
|
127
|
-
/**
|
|
128
|
-
* Optional small badge for button which will be displayed in the list view
|
|
129
|
-
*/
|
|
130
|
-
badge?: string;
|
|
131
|
-
/**
|
|
132
|
-
* Icon for action button which will be displayed in the list view
|
|
133
|
-
*/
|
|
134
|
-
icon?: string;
|
|
135
|
-
/**
|
|
136
|
-
* Confirmation message which will be displayed to user before action is executed.
|
|
137
|
-
*/
|
|
138
|
-
confirm?: string;
|
|
139
|
-
/**
|
|
140
|
-
* Success message which will be displayed to user after action is executed.
|
|
141
|
-
*/
|
|
142
|
-
successMessage?: string;
|
|
143
|
-
/**
|
|
144
|
-
* Show in three dots dropdown menu in list view.
|
|
145
|
-
*/
|
|
146
|
-
showInThreeDotsDropdown?: boolean;
|
|
147
|
-
}
|
|
148
|
-
export interface AdminForthFieldComponents {
|
|
149
|
-
/**
|
|
150
|
-
* Show component is used to redefine cell which renders field value in show view.
|
|
151
|
-
* Component accepts next properties: [record, column, resource, adminUser, meta].
|
|
152
|
-
*
|
|
153
|
-
* Example: `FullName.vue`
|
|
154
|
-
*
|
|
155
|
-
* ```html
|
|
156
|
-
* <template>
|
|
157
|
-
* {{ record.firstName }} {{ record.lastName }}
|
|
158
|
-
* </template>
|
|
159
|
-
*
|
|
160
|
-
* <script setup>
|
|
161
|
-
* defineProps(['record']);
|
|
162
|
-
* </script>
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* {
|
|
166
|
-
* label: 'Full Name',
|
|
167
|
-
* virtual: true,
|
|
168
|
-
* showIn: {
|
|
169
|
-
* [AdminForthResourcePages.edit]: false,
|
|
170
|
-
* [AdminForthResourcePages.create]: false,
|
|
171
|
-
* [AdminForthResourcePages.filter]: false,
|
|
172
|
-
* },
|
|
173
|
-
* components: {
|
|
174
|
-
* show: '@@/FullName.vue',
|
|
175
|
-
* list: '@@/FullName.vue',
|
|
176
|
-
* },
|
|
177
|
-
* }
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
show?: AdminForthComponentDeclaration;
|
|
182
|
-
/**
|
|
183
|
-
* showRow component is similar to {@link AdminForthFieldComponent.show} but rewrites full table row (both \<td\> tags)
|
|
184
|
-
* Accepts next properties: [record, column, resource, adminUser]
|
|
185
|
-
*/
|
|
186
|
-
showRow?: AdminForthComponentDeclaration;
|
|
187
|
-
/**
|
|
188
|
-
* Create component is used to redefine input field in create view.
|
|
189
|
-
* Component accepts next properties: [record, column, resource, adminUser].
|
|
190
|
-
*/
|
|
191
|
-
create?: AdminForthComponentDeclaration;
|
|
192
|
-
/**
|
|
193
|
-
* Edit component is used to redefine input field in edit view.
|
|
194
|
-
* Component accepts next properties: [record, column, resource, adminUser].
|
|
195
|
-
*/
|
|
196
|
-
edit?: AdminForthComponentDeclaration;
|
|
197
|
-
/**
|
|
198
|
-
* List component is used to redefine cell which renders field value in list view.
|
|
199
|
-
* Component accepts next properties: [record, column, resource, adminUser].
|
|
200
|
-
* Component can emit events:
|
|
201
|
-
* - `update:value` - to update record value.
|
|
202
|
-
* - `update:inValidity` - emit true once entered value became not valid (e.g. emit('update:inValidity', true) ). Emit false once entered value became valid. Emit default value in mounted hook.
|
|
203
|
-
* - `update:emptiness` - emit true once entered value became empty (e.g. emit('update:emptiness', true) ). Emit false once entered value became not empty. Emit default value in mounted hook.
|
|
204
|
-
* emptiness emit is optional and required for complex cases. For example for virtual columns where initial value is not set.
|
|
205
|
-
*/
|
|
206
|
-
list?: AdminForthComponentDeclaration;
|
|
207
|
-
/**
|
|
208
|
-
* Filter component is used to redefine input field in filter view.
|
|
209
|
-
* Component accepts next properties: [record, column, resource, adminUser].
|
|
210
|
-
*/
|
|
211
|
-
filter?: AdminForthComponentDeclaration;
|
|
212
|
-
}
|
|
213
|
-
export interface AdminForthComponentDeclarationFull {
|
|
214
|
-
/**
|
|
215
|
-
* Path to custom component which will be used to render field in the admin panel.
|
|
216
|
-
* e.g. `@@/MyCustomComponent.vue`
|
|
217
|
-
*/
|
|
218
|
-
file: string;
|
|
219
|
-
/**
|
|
220
|
-
* Optional Meta object which will be passed to custom component as props. For example used by plugins
|
|
221
|
-
* to pass plugin options to custom components.
|
|
222
|
-
*
|
|
223
|
-
* Example:
|
|
224
|
-
*
|
|
225
|
-
* ```ts
|
|
226
|
-
* {
|
|
227
|
-
* name: 'Country Flag',
|
|
228
|
-
* virtual: true,
|
|
229
|
-
* showIn: {
|
|
230
|
-
* [AdminForthResourcePages.list]: false,
|
|
231
|
-
* [AdminForthResourcePages.edit]: false,
|
|
232
|
-
* [AdminForthResourcePages.create]: false,
|
|
233
|
-
* [AdminForthResourcePages.filter]: false,
|
|
234
|
-
* },
|
|
235
|
-
* components: {
|
|
236
|
-
* show: {
|
|
237
|
-
* file: '@@/Flag.vue',
|
|
238
|
-
* meta: {
|
|
239
|
-
* flagType: 'country',
|
|
240
|
-
* },
|
|
241
|
-
* },
|
|
242
|
-
* },
|
|
243
|
-
* },
|
|
244
|
-
* {
|
|
245
|
-
* name: 'Team Flag',
|
|
246
|
-
* virtual: true,
|
|
247
|
-
* showIn: {
|
|
248
|
-
* [AdminForthResourcePages.list]: false,
|
|
249
|
-
* [AdminForthResourcePages.edit]: false,
|
|
250
|
-
* [AdminForthResourcePages.create]: false,
|
|
251
|
-
* [AdminForthResourcePages.filter]: false,
|
|
252
|
-
* },
|
|
253
|
-
* components: {
|
|
254
|
-
* show: {
|
|
255
|
-
* file: '@@/Flag.vue',
|
|
256
|
-
* meta: {
|
|
257
|
-
* flagType: 'team',
|
|
258
|
-
* },
|
|
259
|
-
* },
|
|
260
|
-
* },
|
|
261
|
-
* }
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* In Flag.vue you can access this meta object like this:
|
|
265
|
-
*
|
|
266
|
-
* ```html
|
|
267
|
-
* <template>
|
|
268
|
-
* <img :src="loadFile(`@@/flags/${meta.flagType}/${meta.flagType === 'country' ? record.countryIso : record.teamCode}.png`)" />
|
|
269
|
-
* </template>
|
|
270
|
-
*
|
|
271
|
-
* <script setup>
|
|
272
|
-
* import { loadFile } from '@/utils';
|
|
273
|
-
* defineProps(['meta', 'record']);
|
|
274
|
-
* </script>
|
|
275
|
-
*
|
|
276
|
-
*/
|
|
277
|
-
meta?: {
|
|
278
|
-
/**
|
|
279
|
-
* Controls sidebar and header visibility for custom pages
|
|
280
|
-
* - 'default': Show both sidebar and header (default behavior)
|
|
281
|
-
* - 'none': Hide both sidebar and header (full custom layout)
|
|
282
|
-
* - 'preferIconOnly': Show header but prefer icon-only sidebar
|
|
283
|
-
* - 'headerOnly': Show only header (full custom layout)
|
|
284
|
-
*/
|
|
285
|
-
sidebarAndHeader?: 'default' | 'none' | 'preferIconOnly' | 'headerOnly';
|
|
286
|
-
[key: string]: any;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
import { type AdminForthActionInput } from './Back.js';
|
|
290
|
-
export { type AdminForthActionInput } from './Back.js';
|
|
291
|
-
export type AdminForthComponentDeclaration = AdminForthComponentDeclarationFull | string;
|
|
292
|
-
export type FieldGroup = {
|
|
293
|
-
groupName: string;
|
|
294
|
-
columns: string[];
|
|
295
|
-
noTitle?: boolean;
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Resource describes one table or collection in database.
|
|
299
|
-
* AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
|
|
300
|
-
*/
|
|
301
|
-
export interface AdminForthResourceInputCommon {
|
|
302
|
-
/**
|
|
303
|
-
* Unique identifier of resource. By default it equals to table name in database.
|
|
304
|
-
* If you wish you can explicitly set it to any string.
|
|
305
|
-
* We added to support cases when 2 datasources have tables with the same name.
|
|
306
|
-
*/
|
|
307
|
-
resourceId?: string;
|
|
308
|
-
/**
|
|
309
|
-
* Label for resource which will be displayed in the admin panel.
|
|
310
|
-
* By default it equals to table name in database.
|
|
311
|
-
*/
|
|
312
|
-
label?: string;
|
|
313
|
-
/**
|
|
314
|
-
* Table name in database which will be used to fetch data from. Might be case sensitive.
|
|
315
|
-
*/
|
|
316
|
-
table: string;
|
|
317
|
-
/**
|
|
318
|
-
* ID of datasource which will be used to fetch data from.
|
|
319
|
-
*/
|
|
320
|
-
dataSource: string;
|
|
321
|
-
/**
|
|
322
|
-
* Array of columns which will be displayed in the admin panel.
|
|
323
|
-
* Each column has its own configuration.
|
|
324
|
-
*/
|
|
325
|
-
columns: Array<AdminForthResourceColumnInputCommon>;
|
|
326
|
-
/**
|
|
327
|
-
* Hook which allow you to modify record label
|
|
328
|
-
*
|
|
329
|
-
* Example:
|
|
330
|
-
*
|
|
331
|
-
* ```ts
|
|
332
|
-
* recordLabel: (record) => `${record.name} - ${record.id}`,
|
|
333
|
-
* ```
|
|
334
|
-
*
|
|
335
|
-
*/
|
|
336
|
-
recordLabel?: (item: any) => string;
|
|
337
|
-
/**
|
|
338
|
-
* General options for resource.
|
|
339
|
-
*/
|
|
340
|
-
options?: {
|
|
341
|
-
/**
|
|
342
|
-
* Default sort for list view.
|
|
343
|
-
* Example:
|
|
344
|
-
*
|
|
345
|
-
* ```ts
|
|
346
|
-
* import { AdminForthSortDirections } from 'adminforth';
|
|
347
|
-
*
|
|
348
|
-
* ...
|
|
349
|
-
*
|
|
350
|
-
* defaultSort: {
|
|
351
|
-
* columnName: 'created_at',
|
|
352
|
-
* direction: AdminForthSortDirections.ASC,
|
|
353
|
-
* }
|
|
354
|
-
* ```
|
|
355
|
-
*
|
|
356
|
-
*/
|
|
357
|
-
defaultSort?: {
|
|
358
|
-
/**
|
|
359
|
-
* Column name which will be used to sort records.
|
|
360
|
-
*/
|
|
361
|
-
columnName: string;
|
|
362
|
-
/**
|
|
363
|
-
* Direction of sorting. Can be 'asc' or 'desc'.
|
|
364
|
-
*/
|
|
365
|
-
direction: AdminForthSortDirections | string;
|
|
366
|
-
};
|
|
367
|
-
actions?: AdminForthActionInput[];
|
|
368
|
-
/**
|
|
369
|
-
* Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
|
|
370
|
-
* using checkboxes.
|
|
371
|
-
*/
|
|
372
|
-
bulkActions?: AdminForthBulkActionCommon[];
|
|
373
|
-
/**
|
|
374
|
-
* Allowed actions for resource.
|
|
375
|
-
*
|
|
376
|
-
* Example:
|
|
377
|
-
*
|
|
378
|
-
* ```ts
|
|
379
|
-
* allowedActions: {
|
|
380
|
-
* create: ({ resource, adminUser }) => {
|
|
381
|
-
* // Allow only superadmin to create records
|
|
382
|
-
* return adminUser.dbUser.role === 'superadmin';
|
|
383
|
-
* },
|
|
384
|
-
* delete: false, // disable delete action for all users
|
|
385
|
-
* }
|
|
386
|
-
* ```
|
|
387
|
-
*
|
|
388
|
-
*/
|
|
389
|
-
allowedActions?: AllowedActionsResolved;
|
|
390
|
-
/**
|
|
391
|
-
* Allows to make groups of columns in show, create and edit resource pages.
|
|
392
|
-
*/
|
|
393
|
-
fieldGroups?: FieldGroup[];
|
|
394
|
-
createFieldGroups?: FieldGroup[];
|
|
395
|
-
editFieldGroups?: FieldGroup[];
|
|
396
|
-
showFieldGroups?: FieldGroup[];
|
|
397
|
-
/**
|
|
398
|
-
* Page size for list view
|
|
399
|
-
*/
|
|
400
|
-
listPageSize?: number;
|
|
401
|
-
/**
|
|
402
|
-
* Whether to use virtual scroll in list view.
|
|
403
|
-
*/
|
|
404
|
-
listVirtualScrollEnabled?: boolean;
|
|
405
|
-
/**
|
|
406
|
-
* Buffer size for virtual scroll in list view.
|
|
407
|
-
*/
|
|
408
|
-
listBufferSize?: number;
|
|
409
|
-
/**
|
|
410
|
-
* Callback to define what happens when user clicks on record in list view.
|
|
411
|
-
* By default show view will be opened.
|
|
412
|
-
* If you wish to open custom page, return URL to the custom page (can start with https://, or relative adminforth path)
|
|
413
|
-
* If you wish to open page in new tab, add `target=_blank` get param to returned URL, example:
|
|
414
|
-
*
|
|
415
|
-
* ```ts
|
|
416
|
-
* listTableClickUrl: async (record, adminUser) => {
|
|
417
|
-
* return `https://google.com/search?q=${record.name}&target=_blank`;
|
|
418
|
-
* }
|
|
419
|
-
* ```
|
|
420
|
-
*
|
|
421
|
-
* If you wish to do nothing on click, return null.
|
|
422
|
-
*
|
|
423
|
-
* Example:
|
|
424
|
-
*
|
|
425
|
-
* ```ts
|
|
426
|
-
* listTableClickUrl: async (record, adminUser) => {
|
|
427
|
-
* return null;
|
|
428
|
-
* }
|
|
429
|
-
* ```
|
|
430
|
-
*
|
|
431
|
-
* @param record - record which was clicked
|
|
432
|
-
* @param adminUser - user who clicked
|
|
433
|
-
* @returns
|
|
434
|
-
*/
|
|
435
|
-
listTableClickUrl?: (record: any, adminUser: AdminUser) => Promise<string | null>;
|
|
436
|
-
/**
|
|
437
|
-
* Whether to refresh existing list rows automatically every N seconds.
|
|
438
|
-
*/
|
|
439
|
-
listRowsAutoRefreshSeconds?: number;
|
|
440
|
-
/**
|
|
441
|
-
* Custom components which can be injected into AdminForth CRUD pages.
|
|
442
|
-
* Each injection is a path to a custom component which will be displayed in the admin panel.
|
|
443
|
-
* Can be also array to render multiple injections one after another.
|
|
444
|
-
*
|
|
445
|
-
* Example:
|
|
446
|
-
*
|
|
447
|
-
* ```ts
|
|
448
|
-
* pageInjections: {
|
|
449
|
-
* list: {
|
|
450
|
-
* beforeBreadcrumbs: '@@/Announcement.vue',
|
|
451
|
-
* }
|
|
452
|
-
* }
|
|
453
|
-
* ```
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*/
|
|
457
|
-
pageInjections?: {
|
|
458
|
-
/**
|
|
459
|
-
* Custom components which can be injected into resource list page.
|
|
460
|
-
*
|
|
461
|
-
* Component accepts next props: [resource, adminUser, meta]
|
|
462
|
-
*/
|
|
463
|
-
list?: {
|
|
464
|
-
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
465
|
-
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
466
|
-
beforeActionButtons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
467
|
-
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
468
|
-
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
469
|
-
customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
470
|
-
tableBodyStart?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
471
|
-
tableRowReplace?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
472
|
-
};
|
|
473
|
-
/**
|
|
474
|
-
* Custom components which can be injected into resource show page.
|
|
475
|
-
*
|
|
476
|
-
* Component accepts next props: [record, resource, adminUser, meta]
|
|
477
|
-
*/
|
|
478
|
-
show?: {
|
|
479
|
-
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
480
|
-
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
481
|
-
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
482
|
-
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
483
|
-
};
|
|
484
|
-
/**
|
|
485
|
-
* Custom components which can be injected into resource edit page.
|
|
486
|
-
*
|
|
487
|
-
* Component accepts next props: [record, resource, adminUser, meta]
|
|
488
|
-
*/
|
|
489
|
-
edit?: {
|
|
490
|
-
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
491
|
-
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
492
|
-
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
493
|
-
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
494
|
-
/**
|
|
495
|
-
* Custom Save button component for Edit page.
|
|
496
|
-
* Accepts props: [record, resource, adminUser, meta, saving, validating, isValid, disabled, saveRecord]
|
|
497
|
-
*/
|
|
498
|
-
saveButton?: AdminForthComponentDeclaration;
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* Custom components which can be injected into resource create page.
|
|
502
|
-
*
|
|
503
|
-
* Component accepts next props: [resource, adminUser, meta]
|
|
504
|
-
*/
|
|
505
|
-
create?: {
|
|
506
|
-
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
507
|
-
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
508
|
-
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
509
|
-
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>;
|
|
510
|
-
/**
|
|
511
|
-
* Custom Save button component for Create page.
|
|
512
|
-
* Accepts props: [record, resource, adminUser, meta, saving, validating, isValid, disabled, saveRecord]
|
|
513
|
-
*/
|
|
514
|
-
saveButton?: AdminForthComponentDeclaration;
|
|
515
|
-
};
|
|
516
|
-
};
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
export interface AdminForthResourceCommon extends AdminForthResourceInputCommon {
|
|
520
|
-
resourceId: string;
|
|
521
|
-
label: string;
|
|
522
|
-
columns: Array<AdminForthResourceColumnCommon>;
|
|
523
|
-
}
|
|
524
|
-
export type ValidationObject = {
|
|
525
|
-
/**
|
|
526
|
-
* Should be pure string (not RegExp string)
|
|
527
|
-
*
|
|
528
|
-
* Example:
|
|
529
|
-
*
|
|
530
|
-
* ```ts
|
|
531
|
-
* // regex for email
|
|
532
|
-
* regExp: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
|
|
533
|
-
* ```
|
|
534
|
-
*
|
|
535
|
-
*/
|
|
536
|
-
regExp: string;
|
|
537
|
-
/**
|
|
538
|
-
* Error message shown to user if validation fails
|
|
539
|
-
*
|
|
540
|
-
* Example: "Invalid email format"
|
|
541
|
-
*/
|
|
542
|
-
message: string;
|
|
543
|
-
/**
|
|
544
|
-
* Whether to check case sensitivity (i flag)
|
|
545
|
-
*/
|
|
546
|
-
caseSensitive?: boolean;
|
|
547
|
-
/**
|
|
548
|
-
* Whether to check Multiline strings (m flag)
|
|
549
|
-
*/
|
|
550
|
-
multiline?: boolean;
|
|
551
|
-
/**
|
|
552
|
-
* Whether to check global strings (g flag)
|
|
553
|
-
*/
|
|
554
|
-
global?: boolean;
|
|
555
|
-
};
|
|
556
|
-
export declare enum AdminForthResourcePages {
|
|
557
|
-
list = "list",
|
|
558
|
-
show = "show",
|
|
559
|
-
edit = "edit",
|
|
560
|
-
create = "create",
|
|
561
|
-
filter = "filter"
|
|
562
|
-
}
|
|
563
|
-
export type ShowInResolved = {
|
|
564
|
-
[key in AdminForthResourcePages]: boolean;
|
|
565
|
-
};
|
|
566
|
-
export interface AdminForthPolymorphicForeignResource {
|
|
567
|
-
resourceId: string;
|
|
568
|
-
whenValue: string;
|
|
569
|
-
}
|
|
570
|
-
export interface AdminForthForeignResourceCommon {
|
|
571
|
-
resourceId?: string;
|
|
572
|
-
polymorphicResources?: Array<AdminForthPolymorphicForeignResource>;
|
|
573
|
-
polymorphicOn?: string;
|
|
574
|
-
unsetLabel?: string;
|
|
575
|
-
searchableFields?: string | string[];
|
|
576
|
-
searchIsCaseSensitive?: boolean;
|
|
577
|
-
}
|
|
578
|
-
export type FillOnCreateFunction = (params: {
|
|
579
|
-
initialRecord: any;
|
|
580
|
-
adminUser: AdminUser;
|
|
581
|
-
}) => any;
|
|
582
|
-
/**
|
|
583
|
-
* Column describes one field in the table or collection in database.
|
|
584
|
-
*/
|
|
585
|
-
export interface AdminForthResourceColumnInputCommon {
|
|
586
|
-
/**
|
|
587
|
-
* Column name in database.
|
|
588
|
-
*/
|
|
589
|
-
name: string;
|
|
590
|
-
/**
|
|
591
|
-
* How column can be labled in the admin panel.
|
|
592
|
-
* Use it for renaming columns. Defaulted to column name with Uppercased first letter.
|
|
593
|
-
*/
|
|
594
|
-
label?: string;
|
|
595
|
-
/**
|
|
596
|
-
* Type of data in column.
|
|
597
|
-
* AdminForth will use this information to render proper input fields in the admin panel.
|
|
598
|
-
* AdminForth tries to guess type of data from database column type automatically for typed databases like SQL-based.
|
|
599
|
-
* However you can explicitly set it to any value. E.g. set AdminForthDataTypes.DATETIME for your string column in SQLite, which stores ISO date strings.
|
|
600
|
-
*/
|
|
601
|
-
type?: AdminForthDataTypes;
|
|
602
|
-
/**
|
|
603
|
-
* Defines whether column is array and what type of items it contains.
|
|
604
|
-
* AdminForth will use this information to render proper input fields in the admin panel with control buttons to add and remove items.
|
|
605
|
-
* If enabled, requires column type to be JSON.
|
|
606
|
-
* Cannot be used with masked columns, columns with foreignResource or primary key columns.
|
|
607
|
-
*/
|
|
608
|
-
isArray?: {
|
|
609
|
-
enabled: boolean;
|
|
610
|
-
/**
|
|
611
|
-
* Type of items in array. Cannot be JSON or RICHTEXT.
|
|
612
|
-
*/
|
|
613
|
-
itemType: AdminForthDataTypes;
|
|
614
|
-
/**
|
|
615
|
-
* If enabled, AdminForth will allow to add items with the same value.
|
|
616
|
-
*/
|
|
617
|
-
allowDuplicateItems?: boolean;
|
|
618
|
-
};
|
|
619
|
-
/**
|
|
620
|
-
* An optional configuration object for extra settings.
|
|
621
|
-
*/
|
|
622
|
-
extra?: {
|
|
623
|
-
/**
|
|
624
|
-
* How many levels of JSON should be collapsed.
|
|
625
|
-
* `0` means - root level will be already collapsed e.g. `{a:1}` will show `{...}` where `'...'` is clickable
|
|
626
|
-
* `1` means - root level will be shown, but next sub-level will be collapsed e.g. `{a: {b: 1}}` will show `{a: ...}` where `'...'` is clickable
|
|
627
|
-
*
|
|
628
|
-
* Default is 1.
|
|
629
|
-
*/
|
|
630
|
-
jsonCollapsedLevel?: number;
|
|
631
|
-
};
|
|
632
|
-
/**
|
|
633
|
-
* Whether to use this column as record identifier.
|
|
634
|
-
* Only one column can be primary key.
|
|
635
|
-
* AdminForth tries to guess primary key automatically first.
|
|
636
|
-
*/
|
|
637
|
-
primaryKey?: boolean;
|
|
638
|
-
/**
|
|
639
|
-
* Whether AdminForth will require this field to be filled in create and edit forms.
|
|
640
|
-
* Can be set to boolean or object with create and edit properties.
|
|
641
|
-
* If boolean, it will be used for both create and edit forms.
|
|
642
|
-
*/
|
|
643
|
-
required?: boolean | {
|
|
644
|
-
create?: boolean;
|
|
645
|
-
edit?: boolean;
|
|
646
|
-
};
|
|
647
|
-
/**
|
|
648
|
-
* Prefix and suffix for input field on create and edit pages.
|
|
649
|
-
*/
|
|
650
|
-
inputPrefix?: string;
|
|
651
|
-
inputSuffix?: string;
|
|
652
|
-
/**
|
|
653
|
-
* Whether AdminForth will show editing note near the field in edit/create form.
|
|
654
|
-
*/
|
|
655
|
-
editingNote?: string | {
|
|
656
|
-
create?: string;
|
|
657
|
-
edit?: string;
|
|
658
|
-
};
|
|
659
|
-
/**
|
|
660
|
-
* Whether AdminForth will allow to edit this field in editing mode.
|
|
661
|
-
*/
|
|
662
|
-
editReadonly?: boolean;
|
|
663
|
-
/**
|
|
664
|
-
* Defines on which AdminForth pages this field will be shown. By default all.
|
|
665
|
-
* Example: if you want to show field only in create and edit pages, set it to
|
|
666
|
-
*
|
|
667
|
-
* ```ts
|
|
668
|
-
* showIn: { create: true, edit: true }
|
|
669
|
-
* ```
|
|
670
|
-
*
|
|
671
|
-
* If you wish show only in list view, set it to:
|
|
672
|
-
*
|
|
673
|
-
* ```ts
|
|
674
|
-
* showIn: { all: false, list: true }
|
|
675
|
-
* ```
|
|
676
|
-
*
|
|
677
|
-
* If you wish to hide only in list you can use:
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* ```ts
|
|
681
|
-
* showIn: { all: true, list: false }
|
|
682
|
-
* ```
|
|
683
|
-
*
|
|
684
|
-
* or
|
|
685
|
-
*
|
|
686
|
-
* ```ts
|
|
687
|
-
* showIn: { list: false } // all: true is by default already
|
|
688
|
-
* ```
|
|
689
|
-
*
|
|
690
|
-
* Also might have callback which will be called with same syntax as allowedActions.
|
|
691
|
-
*
|
|
692
|
-
* ```ts
|
|
693
|
-
* showIn: {
|
|
694
|
-
* list: ({ resource, adminUser }) => {
|
|
695
|
-
* return adminUser.dbUser.role === 'superadmin';
|
|
696
|
-
* },
|
|
697
|
-
* show: true,
|
|
698
|
-
* }
|
|
699
|
-
* ```
|
|
700
|
-
*
|
|
701
|
-
*/
|
|
702
|
-
showIn?: ShowInResolved;
|
|
703
|
-
/**
|
|
704
|
-
* Called on the backend when the record is saved to a database. Value returned by `fillOnCreate` will be saved to the database.
|
|
705
|
-
*/
|
|
706
|
-
fillOnCreate?: FillOnCreateFunction;
|
|
707
|
-
/**
|
|
708
|
-
* Single value that will be substituted in create form. User can change it before saving the record.
|
|
709
|
-
*/
|
|
710
|
-
suggestOnCreate?: string | number | boolean | object;
|
|
711
|
-
/**
|
|
712
|
-
* Whether AdminForth will request user to enter unique value during creating or editing record.
|
|
713
|
-
* This option causes AdminForth to make a request to database to check if value is unique.
|
|
714
|
-
* (Constraints are not used, so for large-tables performance make sure you have unique index in database if you set this option to true)
|
|
715
|
-
*/
|
|
716
|
-
isUnique?: boolean;
|
|
717
|
-
/**
|
|
718
|
-
* Will automatically convert any capital letters to lowercase in input during editing
|
|
719
|
-
*/
|
|
720
|
-
enforceLowerCase?: boolean;
|
|
721
|
-
/**
|
|
722
|
-
* Runtime validation Regexp rules for this field.
|
|
723
|
-
*/
|
|
724
|
-
validation?: Array<ValidationObject>;
|
|
725
|
-
/**
|
|
726
|
-
* Allows to make the field which does not exist in database table.
|
|
727
|
-
* Examples: add custom show field with user country flag:
|
|
728
|
-
*
|
|
729
|
-
* ```ts
|
|
730
|
-
* {
|
|
731
|
-
* label: 'Country Flag',
|
|
732
|
-
* type: AdminForthDataTypes.STRING,
|
|
733
|
-
* virtual: true,
|
|
734
|
-
* showIn: {
|
|
735
|
-
* [AdminForthResourcePages.edit]: false,
|
|
736
|
-
* [AdminForthResourcePages.create]: false,
|
|
737
|
-
* [AdminForthResourcePages.filter]: false,
|
|
738
|
-
* },
|
|
739
|
-
* components: {
|
|
740
|
-
* show: '@@/CountryFlag.vue',
|
|
741
|
-
* list: '@@/CountryFlag.vue',
|
|
742
|
-
* },
|
|
743
|
-
* }
|
|
744
|
-
* ```
|
|
745
|
-
*
|
|
746
|
-
* This field will be displayed in show and list views with custom component `CountryFlag.vue`. CountryFlag.vue should be placed in custom folder and can be next:
|
|
747
|
-
*
|
|
748
|
-
* ```html
|
|
749
|
-
* <template>
|
|
750
|
-
* {{ getFlagEmojiFromIso(record.ipCountry) }}
|
|
751
|
-
* </template>
|
|
752
|
-
*
|
|
753
|
-
* <script setup>
|
|
754
|
-
* const props = defineProps(['record']);
|
|
755
|
-
*
|
|
756
|
-
* function getFlagEmojiFromIso(iso) {
|
|
757
|
-
* return iso.toUpperCase().replace(/./g, (char) => String.fromCodePoint(char.charCodeAt(0) + 127397));
|
|
758
|
-
* }
|
|
759
|
-
* </script>
|
|
760
|
-
* ```
|
|
761
|
-
*
|
|
762
|
-
*/
|
|
763
|
-
virtual?: boolean;
|
|
764
|
-
/**
|
|
765
|
-
* Allow AdminForth to execute SELECT min(column) and SELECT max(column) queries to get min and max values for this column.
|
|
766
|
-
* This would improve UX of filters by adding sliders for numeric columns.
|
|
767
|
-
*
|
|
768
|
-
* NOTE: By default is option is `false` to prevent performance issues on large tables.
|
|
769
|
-
* If you are going to set it to `true`, make sure you have a one-item index on this column (one index for each column which has it) or ensure your table will not have a large number of records.
|
|
770
|
-
*
|
|
771
|
-
*/
|
|
772
|
-
allowMinMaxQuery?: boolean;
|
|
773
|
-
/**
|
|
774
|
-
* Custom components which will be used to render this field in the admin panel.
|
|
775
|
-
*/
|
|
776
|
-
components?: AdminForthFieldComponents;
|
|
777
|
-
/**
|
|
778
|
-
* Maximum length of string that can be entered in this field.
|
|
779
|
-
*/
|
|
780
|
-
maxLength?: number;
|
|
781
|
-
/**
|
|
782
|
-
* Minimum length of string that can be entered in this field.
|
|
783
|
-
*/
|
|
784
|
-
minLength?: number;
|
|
785
|
-
/**
|
|
786
|
-
* Minimum value that can be entered in this field.
|
|
787
|
-
*/
|
|
788
|
-
minValue?: number;
|
|
789
|
-
/**
|
|
790
|
-
* Maximum value that can be entered in this field.
|
|
791
|
-
*/
|
|
792
|
-
maxValue?: number;
|
|
793
|
-
/**
|
|
794
|
-
* Enum of possible values for this field.
|
|
795
|
-
*/
|
|
796
|
-
enum?: Array<AdminForthColumnEnumItem>;
|
|
797
|
-
/**
|
|
798
|
-
* Foreign resource which has pk column with values same that written in this column.
|
|
799
|
-
*/
|
|
800
|
-
foreignResource?: AdminForthForeignResourceCommon;
|
|
801
|
-
/**
|
|
802
|
-
* Whether to allow this column to be sortable in list view.
|
|
803
|
-
* If true, AdminForth will add sorting buttons to the column header in list view and clicking on it will change sorting state of the column.
|
|
804
|
-
*/
|
|
805
|
-
sortable?: boolean;
|
|
806
|
-
filterOptions?: {
|
|
807
|
-
/**
|
|
808
|
-
* Decrease number of requests by adding debounce time to filter requests.
|
|
809
|
-
*/
|
|
810
|
-
debounceTimeMs?: number;
|
|
811
|
-
/**
|
|
812
|
-
* If false - will force EQ operator for filter instead of ILIKE.
|
|
813
|
-
*/
|
|
814
|
-
substringSearch?: boolean;
|
|
815
|
-
/**
|
|
816
|
-
* Boolean value that determines what select input type to display on filter page.
|
|
817
|
-
*/
|
|
818
|
-
multiselect?: boolean;
|
|
819
|
-
};
|
|
820
|
-
/**
|
|
821
|
-
* if true field will !not be passed to UI under no circumstances, but will be presented in hooks
|
|
822
|
-
*/
|
|
823
|
-
backendOnly?: boolean;
|
|
824
|
-
/**
|
|
825
|
-
* Masked fields will be displayed as `*****` on Edit and Create pages.
|
|
826
|
-
*/
|
|
827
|
-
masked?: boolean;
|
|
828
|
-
/**
|
|
829
|
-
* Sticky position for column
|
|
830
|
-
*/
|
|
831
|
-
listSticky?: boolean;
|
|
832
|
-
/**
|
|
833
|
-
* Show field only if certain conditions are met.
|
|
834
|
-
*/
|
|
835
|
-
showIf?: Predicate;
|
|
836
|
-
}
|
|
837
|
-
export interface AdminForthResourceColumnCommon extends AdminForthResourceColumnInputCommon {
|
|
838
|
-
/**
|
|
839
|
-
* Internal type which indicates original type of column in database.
|
|
840
|
-
*/
|
|
841
|
-
_underlineType?: string;
|
|
842
|
-
required?: {
|
|
843
|
-
create?: boolean;
|
|
844
|
-
edit?: boolean;
|
|
845
|
-
};
|
|
846
|
-
editingNote?: {
|
|
847
|
-
create?: string;
|
|
848
|
-
edit?: string;
|
|
849
|
-
};
|
|
850
|
-
/**
|
|
851
|
-
* Minimal value stored in this field.
|
|
852
|
-
*/
|
|
853
|
-
min?: number;
|
|
854
|
-
/**
|
|
855
|
-
* Maximum value stored in this field.
|
|
856
|
-
*/
|
|
857
|
-
max?: number;
|
|
858
|
-
}
|
|
859
|
-
export declare enum AdminForthMenuTypes {
|
|
860
|
-
/**
|
|
861
|
-
* HEADING is just a label in the menu.
|
|
862
|
-
* Respect `label` and `icon` property in {@link AdminForthConfigMenuItem}
|
|
863
|
-
*/
|
|
864
|
-
heading = "heading",
|
|
865
|
-
/**
|
|
866
|
-
* GROUP is a group of menu items.
|
|
867
|
-
* Respects `label`, `icon` and `children` properties in {@link AdminForthConfigMenuItem}
|
|
868
|
-
* use @AdminForthMenuTypes.open to set if group is open by default
|
|
869
|
-
*/
|
|
870
|
-
group = "group",
|
|
871
|
-
/**
|
|
872
|
-
* RESOURCE is a link to a resource.
|
|
873
|
-
* Respects `label`, `icon`, `resourceId`, `homepage`, `isStaticRoute` properties in {@link AdminForthConfigMenuItem}
|
|
874
|
-
*/
|
|
875
|
-
resource = "resource",
|
|
876
|
-
/**
|
|
877
|
-
* PAGE is a link to a custom page.
|
|
878
|
-
* Respects `label`, `icon`, `path`, `component`, `homepage`, `isStaticRoute`, properties in {@link AdminForthConfigMenuItem}
|
|
879
|
-
*
|
|
880
|
-
* Example:
|
|
881
|
-
*
|
|
882
|
-
* ```ts
|
|
883
|
-
* \{
|
|
884
|
-
* type: AdminForthMenuTypes.PAGE,
|
|
885
|
-
* label: 'Custom Page',
|
|
886
|
-
* icon: 'home',
|
|
887
|
-
* path: '/dash',
|
|
888
|
-
* component: '@@/Dashboard.vue',
|
|
889
|
-
* homepage: true,
|
|
890
|
-
* \}
|
|
891
|
-
* ```
|
|
892
|
-
*
|
|
893
|
-
*/
|
|
894
|
-
page = "page",
|
|
895
|
-
/**
|
|
896
|
-
* GAP ads some space between menu items.
|
|
897
|
-
*/
|
|
898
|
-
gap = "gap",
|
|
899
|
-
/**
|
|
900
|
-
* DIVIDER is a divider between menu items.
|
|
901
|
-
*/
|
|
902
|
-
divider = "divider"
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Menu item which displayed in the left sidebar of the admin panel.
|
|
906
|
-
*/
|
|
907
|
-
export interface AdminForthConfigMenuItem {
|
|
908
|
-
type?: AdminForthMenuTypes | keyof typeof AdminForthMenuTypes;
|
|
909
|
-
/**
|
|
910
|
-
* Label for menu item which will be displayed in the admin panel.
|
|
911
|
-
*/
|
|
912
|
-
label?: string;
|
|
913
|
-
/**
|
|
914
|
-
* Icon for menu item which will be displayed in the admin panel.
|
|
915
|
-
* Supports iconify icons in format `<icon set name>:<icon name>`
|
|
916
|
-
* Browse available icons here: https://icon-sets.iconify.design/
|
|
917
|
-
*
|
|
918
|
-
* Example:
|
|
919
|
-
*
|
|
920
|
-
* ```ts
|
|
921
|
-
* icon: 'flowbite:brain-solid',
|
|
922
|
-
* ```
|
|
923
|
-
*
|
|
924
|
-
*/
|
|
925
|
-
icon?: string;
|
|
926
|
-
/**
|
|
927
|
-
* Path to custom component which will be displayed in the admin panel.
|
|
928
|
-
*
|
|
929
|
-
*/
|
|
930
|
-
path?: string;
|
|
931
|
-
/**
|
|
932
|
-
* Component to be used for this menu item. Component should be placed in custom folder and referenced with `@@/` prefix.
|
|
933
|
-
* Supported for AdminForthMenuTypes.PAGE only!
|
|
934
|
-
* Example:
|
|
935
|
-
*
|
|
936
|
-
* ```ts
|
|
937
|
-
* component: '@@/Dashboard.vue',
|
|
938
|
-
* ```
|
|
939
|
-
*
|
|
940
|
-
*/
|
|
941
|
-
component?: string;
|
|
942
|
-
/**
|
|
943
|
-
* Resource ID which will be used to fetch data from.
|
|
944
|
-
* Supported for AdminForthMenuTypes.RESOURCE only!
|
|
945
|
-
*
|
|
946
|
-
*/
|
|
947
|
-
resourceId?: string;
|
|
948
|
-
/**
|
|
949
|
-
* If true, group will be open by default after user login to the admin panel.
|
|
950
|
-
* Also will be used to redirect from root path.
|
|
951
|
-
*/
|
|
952
|
-
homepage?: boolean;
|
|
953
|
-
/**
|
|
954
|
-
* Where Group is open by default
|
|
955
|
-
* Supported for AdminForthMenuTypes.GROUP only!
|
|
956
|
-
*
|
|
957
|
-
*/
|
|
958
|
-
open?: boolean;
|
|
959
|
-
/**
|
|
960
|
-
* Children menu items which will be displayed in this group.
|
|
961
|
-
* Supported for AdminForthMenuTypes.GROUP only!
|
|
962
|
-
*/
|
|
963
|
-
children?: Array<AdminForthConfigMenuItem>;
|
|
964
|
-
/**
|
|
965
|
-
* By default all pages are imported dynamically with lazy import().
|
|
966
|
-
* If you wish to import page statically, set this option to true.
|
|
967
|
-
* Homepage will be imported statically by default. but you can override it with this option.
|
|
968
|
-
*/
|
|
969
|
-
isStaticRoute?: boolean;
|
|
970
|
-
meta?: {
|
|
971
|
-
title?: string;
|
|
972
|
-
};
|
|
973
|
-
/**
|
|
974
|
-
* Optional callback which will be called before rendering the menu for each item.
|
|
975
|
-
* You can use it to hide menu items depending on some user
|
|
976
|
-
*/
|
|
977
|
-
visible?: (user: AdminUser) => boolean;
|
|
978
|
-
/**
|
|
979
|
-
* Optional callback which will be called before rendering the menu for each item.
|
|
980
|
-
* Result of callback if not null will be used as a small badge near the menu item.
|
|
981
|
-
*/
|
|
982
|
-
badge?: string | ((user: AdminUser) => Promise<string>);
|
|
983
|
-
/**
|
|
984
|
-
* Tooltip shown on hover for badge
|
|
985
|
-
*/
|
|
986
|
-
badgeTooltip?: string;
|
|
987
|
-
/**
|
|
988
|
-
* Item id will be automatically generated from hashed resourceId+Path+label
|
|
989
|
-
*/
|
|
990
|
-
itemId?: string;
|
|
991
|
-
}
|
|
992
|
-
export interface ResourceVeryShort {
|
|
993
|
-
resourceId: string;
|
|
994
|
-
label: string;
|
|
995
|
-
}
|
|
996
|
-
export interface UserData {
|
|
997
|
-
pk: string;
|
|
998
|
-
[key: string]: any;
|
|
999
|
-
}
|
|
1000
|
-
export type AnnouncementBadgeResponse = {
|
|
1001
|
-
text?: string;
|
|
1002
|
-
html?: string;
|
|
1003
|
-
closable?: boolean;
|
|
1004
|
-
title?: string;
|
|
1005
|
-
};
|
|
1006
|
-
export interface AdminForthConfigForFrontend {
|
|
1007
|
-
brandName: string;
|
|
1008
|
-
usernameFieldName: string;
|
|
1009
|
-
loginBackgroundImage: string;
|
|
1010
|
-
loginBackgroundPosition: string;
|
|
1011
|
-
removeBackgroundBlendMode: boolean;
|
|
1012
|
-
title?: string;
|
|
1013
|
-
demoCredentials?: string;
|
|
1014
|
-
loginPromptHTML?: string | (() => string | Promise<string> | void | Promise<void> | Promise<undefined>) | undefined;
|
|
1015
|
-
loginPageInjections: {
|
|
1016
|
-
underInputs: Array<AdminForthComponentDeclaration>;
|
|
1017
|
-
panelHeader: Array<AdminForthComponentDeclaration>;
|
|
1018
|
-
};
|
|
1019
|
-
rememberMeDays: number;
|
|
1020
|
-
showBrandNameInSidebar: boolean;
|
|
1021
|
-
showBrandLogoInSidebar: boolean;
|
|
1022
|
-
brandLogo?: string;
|
|
1023
|
-
iconOnlySidebar?: {
|
|
1024
|
-
logo?: string;
|
|
1025
|
-
enabled?: boolean;
|
|
1026
|
-
expandedSidebarWidth?: string;
|
|
1027
|
-
};
|
|
1028
|
-
singleTheme?: 'light' | 'dark';
|
|
1029
|
-
datesFormat: string;
|
|
1030
|
-
timeFormat: string;
|
|
1031
|
-
auth: any;
|
|
1032
|
-
userFullnameField: string;
|
|
1033
|
-
usernameField: string;
|
|
1034
|
-
emptyFieldPlaceholder?: string | {
|
|
1035
|
-
show?: string;
|
|
1036
|
-
list?: string;
|
|
1037
|
-
};
|
|
1038
|
-
announcementBadge?: AnnouncementBadgeResponse | null;
|
|
1039
|
-
globalInjections: {
|
|
1040
|
-
userMenu: Array<AdminForthComponentDeclarationFull>;
|
|
1041
|
-
header: Array<AdminForthComponentDeclarationFull>;
|
|
1042
|
-
sidebar: Array<AdminForthComponentDeclarationFull>;
|
|
1043
|
-
sidebarTop: Array<AdminForthComponentDeclarationFull>;
|
|
1044
|
-
everyPageBottom: Array<AdminForthComponentDeclarationFull>;
|
|
1045
|
-
};
|
|
1046
|
-
customHeadItems?: {
|
|
1047
|
-
tagName: string;
|
|
1048
|
-
attributes: Record<string, string | boolean>;
|
|
1049
|
-
innerCode?: string;
|
|
1050
|
-
}[];
|
|
1051
|
-
settingPages?: {
|
|
1052
|
-
icon?: string;
|
|
1053
|
-
pageLabel: string;
|
|
1054
|
-
slug?: string;
|
|
1055
|
-
component: string;
|
|
1056
|
-
isVisible?: boolean;
|
|
1057
|
-
}[];
|
|
1058
|
-
}
|
|
1059
|
-
export interface GetBaseConfigResponse {
|
|
1060
|
-
user: UserData;
|
|
1061
|
-
resources: ResourceVeryShort[];
|
|
1062
|
-
menu: AdminForthConfigMenuItem[];
|
|
1063
|
-
config: AdminForthConfigForFrontend;
|
|
1064
|
-
adminUser: AdminUser;
|
|
1065
|
-
version: string;
|
|
1066
|
-
}
|
|
1067
|
-
//# sourceMappingURL=Common.d.ts.map
|