@galadrim/galadmin 0.1.141 → 0.1.144

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.
@@ -1,404 +1,406 @@
1
1
  export type Filter = {};
2
2
 
3
3
  export type BaseTypeColumn = {
4
- label: string;
5
- hideInTable?: boolean;
6
- canEditOnCreation?: boolean;
7
- includedInCreatePayload?: boolean;
8
- canEdit?: boolean;
9
- hidden?: boolean;
10
- formattedValue?: string;
11
- formatValue?: (record: any) => string | Promise<string>;
12
- formatValueForExport?: (record: any) => string | Promise<string>;
13
- searchable?: boolean;
14
- searchableName?: string;
15
- labelTooltip?: string;
16
- required?: boolean;
17
- includeInExport?: boolean;
18
- displayCondition?: (record: any) => boolean;
4
+ label: string;
5
+ hideInTable?: boolean;
6
+ canEditOnCreation?: boolean;
7
+ includedInCreatePayload?: boolean;
8
+ canEdit?: boolean;
9
+ hidden?: boolean;
10
+ formattedValue?: string;
11
+ formatValue?: (record: any) => string | Promise<string>;
12
+ formatValueForExport?: (record: any) => string | Promise<string>;
13
+ searchable?: boolean;
14
+ searchableName?: string;
15
+ labelTooltip?: string;
16
+ required?: boolean;
17
+ includeInExport?: boolean;
18
+ displayCondition?: (record: any) => boolean;
19
19
  };
20
20
 
21
21
  export type ColorColumn = {
22
- dataType: 'color';
23
- name: string;
22
+ dataType: 'color';
23
+ name: string;
24
24
  };
25
25
 
26
26
  export type StandardColumn = {
27
- name?: string;
28
- dataType?: string;
27
+ name?: string;
28
+ dataType?: string;
29
29
  };
30
30
 
31
31
  export type SelectColumn = {
32
- dataType: 'select';
33
- name: string;
34
- options: string[] | { [key: string]: string };
35
- defaultOption: string;
36
- optional?: boolean;
32
+ dataType: 'select';
33
+ name: string;
34
+ options: string[] | { [key: string]: string };
35
+ defaultOption: string;
36
+ optional?: boolean;
37
37
  };
38
38
 
39
39
  export type AddressColumn = {
40
- dataType: 'address';
41
- latitudeField?: string;
42
- longitudeField?: string;
43
- addressField?: string;
44
- streetNumberField?: string;
45
- routeField?: string;
46
- localityField?: string;
47
- administrativeAreaLevel2Field?: string;
48
- administrativeAreaLevel1Field?: string;
49
- countryField?: string;
50
- postalCodeField?: string;
40
+ dataType: 'address';
41
+ latitudeField?: string;
42
+ longitudeField?: string;
43
+ addressField?: string;
44
+ streetNumberField?: string;
45
+ routeField?: string;
46
+ localityField?: string;
47
+ administrativeAreaLevel2Field?: string;
48
+ administrativeAreaLevel1Field?: string;
49
+ countryField?: string;
50
+ postalCodeField?: string;
51
51
  };
52
52
 
53
53
  export type DateColumn = {
54
- dataType: 'date';
55
- name: string;
54
+ dataType: 'date';
55
+ name: string;
56
56
  };
57
57
 
58
58
  export type DatetimeColumn = {
59
- dataType: 'datetime';
60
- name: string;
59
+ dataType: 'datetime';
60
+ name: string;
61
61
  };
62
62
 
63
63
  export type ForeignSelectColumn = {
64
- dataType: 'foreign';
65
- name: string;
66
- table: string;
67
- foreignName?: string;
68
- limit?: number;
69
- selectExpression?: string;
70
- join?: string;
71
- filters?: Filter[];
72
- orderBy?: string;
73
- optional?: boolean;
74
- formatForeignValue?: (record: any) => string;
75
- };
64
+ dataType: 'foreign',
65
+ name: string,
66
+ table: string,
67
+ foreignName?: string,
68
+ limit?: number,
69
+ selectExpression?: string,
70
+ join?: string,
71
+ filters?: Filter[],
72
+ filtersFromUser?: (userId: number) => string,
73
+ orderBy?: string,
74
+ optional?: boolean,
75
+ formatForeignValue?: (record: any) => string,
76
+ }
76
77
 
77
78
  export type ForeignDatalistColumn = {
78
- dataType: 'datalist';
79
- name: string;
80
- table: string;
81
- foreignName?: string;
82
- wholeSearch?: boolean;
83
- limit?: number;
84
- selectExpression?: string;
85
- join?: string;
86
- filters?: Filter[];
87
- orderBy?: string;
88
- optional?: boolean;
89
- formatForeignValue?: (record: any) => string;
90
- };
79
+ dataType: 'datalist',
80
+ name: string,
81
+ table: string,
82
+ foreignName?: string,
83
+ wholeSearch?: boolean,
84
+ limit?: number,
85
+ selectExpression?: string,
86
+ join?: string,
87
+ filters?: Filter[],
88
+ filtersFromUser?: (userId: number) => string,
89
+ orderBy?: string,
90
+ optional?: boolean,
91
+ formatForeignValue?: (record: any) => string,
92
+ }
91
93
 
92
94
  export type TextareaColumn = {
93
- dataType: 'textarea';
94
- name: string;
95
+ dataType: 'textarea';
96
+ name: string;
95
97
  };
96
98
 
97
99
  export type RichTextColumn = {
98
- dataType: 'richText';
99
- htmlField: string;
100
- contentField?: string;
100
+ dataType: 'richText';
101
+ htmlField: string;
102
+ contentField?: string;
101
103
  };
102
104
 
103
105
  export type BetterRichTextColumn = {
104
- dataType: 'betterRichText';
105
- htmlField: string;
106
- fileUploadProperties?: FileUploadProperties;
106
+ dataType: 'betterRichText';
107
+ htmlField: string;
108
+ fileUploadProperties?: FileUploadProperties;
107
109
  };
108
110
 
109
111
  export type FileColumn = {
110
- dataType: 'file';
111
- name: string;
112
+ dataType: 'file';
113
+ name: string;
112
114
  } & FileUploadProperties;
113
115
 
114
116
  export type FileUploadProperties = {
115
- publicPath?: string;
116
- subdirectory?: string;
117
- aspectRatioField?: string;
118
- originalNameField?: string;
119
- s3Config?: {
120
- host: string;
121
- accessKeyId: string;
122
- secretAccessKey: string;
123
- bucket: string;
124
- subfolder?: string;
125
- signedUrlNeeded?: boolean;
126
- region?: string;
127
- };
128
- sftpConfig?: {
129
- host: string;
130
- user: string;
131
- password: string;
132
- };
117
+ publicPath?: string;
118
+ subdirectory?: string;
119
+ aspectRatioField?: string;
120
+ originalNameField?: string;
121
+ s3Config?: {
122
+ host: string;
123
+ accessKeyId: string;
124
+ secretAccessKey: string;
125
+ bucket: string;
126
+ subfolder?: string;
127
+ signedUrlNeeded?: boolean;
128
+ region?: string;
129
+ };
130
+ sftpConfig?: {
131
+ host: string;
132
+ user: string;
133
+ password: string;
134
+ };
133
135
  };
134
136
 
135
137
  export type Column = BaseTypeColumn &
136
- (
137
- | StandardColumn
138
- | ColorColumn
139
- | SelectColumn
140
- | AddressColumn
141
- | DateColumn
142
- | DatetimeColumn
143
- | ForeignSelectColumn
144
- | ForeignDatalistColumn
145
- | RichTextColumn
146
- | BetterRichTextColumn
147
- | TextareaColumn
148
- | FileColumn
149
- );
138
+ (
139
+ | StandardColumn
140
+ | ColorColumn
141
+ | SelectColumn
142
+ | AddressColumn
143
+ | DateColumn
144
+ | DatetimeColumn
145
+ | ForeignSelectColumn
146
+ | ForeignDatalistColumn
147
+ | RichTextColumn
148
+ | BetterRichTextColumn
149
+ | TextareaColumn
150
+ | FileColumn
151
+ );
150
152
 
151
153
  export type CreateType = {
152
- canCreate: true;
153
- aNewSingular: string;
154
- createFilters?: { [key: string]: string };
155
- createConfig?: {
156
- redirectToCreatedItems?: boolean;
157
- };
154
+ canCreate: true;
155
+ aNewSingular: string;
156
+ createFilters?: { [key: string]: string };
157
+ createConfig?: {
158
+ redirectToCreatedItems?: boolean;
159
+ };
158
160
  };
159
161
 
160
162
  export type CustomAction = {
161
- label: string;
162
- action: (record: any) => void;
163
- successMessage?: string;
163
+ label: string;
164
+ action: (record: any) => void;
165
+ successMessage?: string;
164
166
  };
165
167
 
166
168
  export type FormDataFile = {
167
- fieldName: string;
168
- originalFilename: string;
169
- path: string;
170
- headers: { [key: string]: string };
171
- size: number;
169
+ fieldName: string;
170
+ originalFilename: string;
171
+ path: string;
172
+ headers: { [key: string]: string };
173
+ size: number;
172
174
  };
173
175
 
174
176
  export type TableView = {
175
- type: 'table';
176
- icon?: string;
177
- label: string;
178
- tableName: string;
179
- primaryId?: string;
180
- customQuery?: string;
181
- selectExpression?: string;
182
- join?: string;
183
- groupBy?: string;
184
- orderBy?: string;
185
- isDesc?: boolean;
186
- limit?: number;
187
- filters?: string;
188
- filtersFromUser?: (userId: number) => string;
189
- notClickable?: boolean;
190
- clickToEdit?: boolean;
191
- openInNewTab?: boolean;
192
- customActions?: CustomAction[];
193
- /** Rendre possible à l'utilisateur de créer des enregistrements */
194
- /** Rendre possible à l'utilisateur de supprimer des enregistrements */
195
- canDelete?: boolean;
196
- /** Rendre possible à l'utilisateur de modifier des enregistrements */
197
- canEdit?: boolean;
198
- /** Rendre possible à l'utilisateur de télécharger les enregistrements (par défaut : true) */
199
- canExport?: boolean;
200
- /** Rendre possible à l'utilisateur d'importer des enregistrements (par défaut : false) */
201
- canImport?: boolean;
202
- /**
203
- * Types de fichier acceptés pour l'import, au format de l'attribut {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers accept}.
204
- * @example [".xlsx", ".xls", ".csv"]
205
- */
206
- importFileTypes?: string[];
207
- /** Obligatoire si `canImport` est `true`. Prend le fichier d'import en paramètre et renvoie une liste d'entités. */
208
- parseImportFile?: (file: FormDataFile) => Promise<any[]>;
209
- createCallback?: string;
210
- createCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
211
- editCallback?: string;
212
- editCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
213
- deleteCallback?: string;
214
- deleteCallbackFunction?: ({ id }: { id: number }) => void;
215
- columns: Column[];
216
- subviews?: Subview[];
217
- recordViewPanels?: ViewPanel[];
218
- importFileUniqueField?: string;
177
+ type: 'table';
178
+ icon?: string;
179
+ label: string;
180
+ tableName: string;
181
+ primaryId?: string;
182
+ customQuery?: string;
183
+ selectExpression?: string;
184
+ join?: string;
185
+ groupBy?: string;
186
+ orderBy?: string;
187
+ isDesc?: boolean;
188
+ limit?: number;
189
+ filters?: string;
190
+ filtersFromUser?: (userId: number) => string;
191
+ notClickable?: boolean;
192
+ clickToEdit?: boolean;
193
+ openInNewTab?: boolean;
194
+ customActions?: CustomAction[];
195
+ /** Rendre possible à l'utilisateur de créer des enregistrements */
196
+ /** Rendre possible à l'utilisateur de supprimer des enregistrements */
197
+ canDelete?: boolean;
198
+ /** Rendre possible à l'utilisateur de modifier des enregistrements */
199
+ canEdit?: boolean;
200
+ /** Rendre possible à l'utilisateur de télécharger les enregistrements (par défaut : true) */
201
+ canExport?: boolean;
202
+ /** Rendre possible à l'utilisateur d'importer des enregistrements (par défaut : false) */
203
+ canImport?: boolean;
204
+ /**
205
+ * Types de fichier acceptés pour l'import, au format de l'attribut {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers accept}.
206
+ * @example [".xlsx", ".xls", ".csv"]
207
+ */
208
+ importFileTypes?: string[];
209
+ /** Obligatoire si `canImport` est `true`. Prend le fichier d'import en paramètre et renvoie une liste d'entités. */
210
+ parseImportFile?: (file: FormDataFile) => Promise<any[]>;
211
+ createCallback?: string;
212
+ createCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
213
+ editCallback?: string;
214
+ editCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
215
+ deleteCallback?: string;
216
+ deleteCallbackFunction?: ({ id }: { id: number }) => void;
217
+ columns: Column[];
218
+ subviews?: Subview[];
219
+ recordViewPanels?: ViewPanel[];
220
+ importFileUniqueField?: string;
219
221
  } & (CreateType | { canCreate?: false });
220
222
 
221
223
  export type Subview = {
222
- label: string;
223
- filters: string;
224
- orderBy?: string;
224
+ label: string;
225
+ filters: string;
226
+ orderBy?: string;
225
227
  };
226
228
 
227
229
  export type BaseTypePanel = {
228
- label: string;
229
- folded?: boolean;
230
- displayCondition?: (record: any) => boolean;
230
+ label: string;
231
+ folded?: boolean;
232
+ displayCondition?: (record: any) => boolean;
231
233
  };
232
234
 
233
235
  export type CreateConfig = {
234
- label: string;
235
- recordIdKey: string;
236
- columns: Column[];
237
- redirectToCreatedItems?: boolean;
236
+ label: string;
237
+ recordIdKey: string;
238
+ columns: Column[];
239
+ redirectToCreatedItems?: boolean;
238
240
  };
239
241
 
240
242
  export type TablePanel = {
241
- type: 'table';
242
- query: string;
243
- formattedQuery?: string;
244
- canDownload?: boolean;
245
- canShow?: boolean;
246
- canDelete?: boolean;
247
- canCreate?: boolean;
248
- canImport?: boolean;
249
- /**
250
- * Types de fichier acceptés pour l'import, au format de l'attribut {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers accept}.
251
- * @example [".xlsx", ".xls", ".csv"]
252
- */
253
- importFileTypes?: string[];
254
- /** Obligatoire si `canImport` est `true`. Prend le fichier d'import en paramètre et renvoie une liste d'entités. id correspond a l'identité du parent */
255
- parseImportFile?: (file: FormDataFile, id?: any) => Promise<any[]>;
256
- /** Obligatoire si `canImport` est `true`. */
257
- createConfig?: CreateConfig;
258
- tableName?: string;
259
- primaryId?: string;
260
- formatValue?: {
261
- [key: string]: (record: any) => string | Promise<string>;
262
- };
263
- formattedValues?: { [key: string]: string };
264
- createCallback?: string;
265
- createCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
266
- deleteCallback?: string;
267
- deleteCallbackFunction?: ({ id }: { id: number }) => void;
243
+ type: 'table';
244
+ query: string;
245
+ formattedQuery?: string;
246
+ canDownload?: boolean;
247
+ canShow?: boolean;
248
+ canDelete?: boolean;
249
+ canCreate?: boolean;
250
+ canImport?: boolean;
251
+ /**
252
+ * Types de fichier acceptés pour l'import, au format de l'attribut {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers accept}.
253
+ * @example [".xlsx", ".xls", ".csv"]
254
+ */
255
+ importFileTypes?: string[];
256
+ /** Obligatoire si `canImport` est `true`. Prend le fichier d'import en paramètre et renvoie une liste d'entités. id correspond a l'identité du parent */
257
+ parseImportFile?: (file: FormDataFile, id?: any) => Promise<any[]>;
258
+ /** Obligatoire si `canImport` est `true`. */
259
+ createConfig?: CreateConfig;
260
+ tableName?: string;
261
+ primaryId?: string;
262
+ formatValue?: {
263
+ [key: string]: (record: any) => string | Promise<string>;
264
+ };
265
+ formattedValues?: { [key: string]: string };
266
+ createCallback?: string;
267
+ createCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
268
+ deleteCallback?: string;
269
+ deleteCallbackFunction?: ({ id }: { id: number }) => void;
268
270
  };
269
271
 
270
272
  export type MapPanel = {
271
- type: 'map';
272
- query: string;
273
- latitudeField: string;
274
- longitudeField: string;
275
- zoom?: number;
273
+ type: 'map';
274
+ query: string;
275
+ latitudeField: string;
276
+ longitudeField: string;
277
+ zoom?: number;
276
278
  };
277
279
 
278
280
  export type GalleryPanel = {
279
- type: 'gallery';
280
- query: string;
281
- canDelete?: boolean;
282
- canCreate?: boolean;
283
- createConfig?: CreateConfig;
284
- tableName?: string;
285
- primaryId?: string;
286
- baseUrl?: string;
287
- pathField?: string;
288
- objectFit?: 'cover' | 'contain';
289
- createCallback?: string;
290
- createCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
291
- deleteCallback?: string;
292
- deleteCallbackFunction?: ({
293
- id,
294
- deletedRecord,
295
- }: {
296
- id: number;
297
- deletedRecord?: any;
298
- }) => void;
281
+ type: 'gallery';
282
+ query: string;
283
+ canDelete?: boolean;
284
+ canCreate?: boolean;
285
+ createConfig?: CreateConfig;
286
+ tableName?: string;
287
+ primaryId?: string;
288
+ baseUrl?: string;
289
+ pathField?: string;
290
+ objectFit?: 'cover' | 'contain';
291
+ createCallback?: string;
292
+ createCallbackFunction?: ({ id, data }: { id: number; data: any }) => void;
293
+ deleteCallback?: string;
294
+ deleteCallbackFunction?: ({
295
+ id,
296
+ deletedRecord,
297
+ }: {
298
+ id: number;
299
+ deletedRecord?: any;
300
+ }) => void;
299
301
  };
300
302
 
301
303
  export type ChatPanel = {
302
- type: 'chat';
303
- /* Requête SQL pour récupérer les messages échangés */
304
- getMessagesQuery: string;
305
- /* URL pour envoyer un message */
306
- postMessageUrl: string;
307
- messageField: string;
308
- isAdminField: string;
309
- datetimeField: string;
310
- /* Clé secrète transmise à la route d'envoi de message */
311
- secretKey?: string;
304
+ type: 'chat';
305
+ /* Requête SQL pour récupérer les messages échangés */
306
+ getMessagesQuery: string;
307
+ /* URL pour envoyer un message */
308
+ postMessageUrl: string;
309
+ messageField: string;
310
+ isAdminField: string;
311
+ datetimeField: string;
312
+ /* Clé secrète transmise à la route d'envoi de message */
313
+ secretKey?: string;
312
314
  };
313
315
 
314
316
  export type ViewPanel = BaseTypePanel &
315
- (TablePanel | MapPanel | GalleryPanel | ChatPanel);
317
+ (TablePanel | MapPanel | GalleryPanel | ChatPanel);
316
318
 
317
319
  export type IframeView = {
318
- type: 'iframe';
319
- src: string;
320
- icon?: string;
321
- label: string;
320
+ type: 'iframe';
321
+ src: string;
322
+ icon?: string;
323
+ label: string;
322
324
  };
323
325
 
324
326
  export type LinkView = {
325
- type: 'link';
326
- src: string;
327
- icon?: string;
328
- label: string;
327
+ type: 'link';
328
+ src: string;
329
+ icon?: string;
330
+ label: string;
329
331
  };
330
332
 
331
333
  export type CustomView = {
332
- type: 'custom';
333
- icon?: string;
334
- label: string;
335
- componentPath: string;
336
- componentProps?: any;
334
+ type: 'custom';
335
+ icon?: string;
336
+ label: string;
337
+ componentPath: string;
338
+ componentProps?: any;
337
339
  };
338
340
 
339
341
  export type BaseTypeView = {
340
- /** Cache la vue dans le menu latéral */
341
- hidden?: boolean;
342
- roles?: string[];
342
+ /** Cache la vue dans le menu latéral */
343
+ hidden?: boolean;
344
+ roles?: string[];
343
345
  };
344
346
 
345
347
  export type View = BaseTypeView &
346
- (TableView | IframeView | LinkView | CustomView);
348
+ (TableView | IframeView | LinkView | CustomView);
347
349
 
348
350
  export type AuthRole = {
349
- role: string;
350
- table: string;
351
- usernameField: string;
352
- passwordField: string;
353
- idField: string;
351
+ role: string;
352
+ table: string;
353
+ usernameField: string;
354
+ passwordField: string;
355
+ idField: string;
354
356
  };
355
357
 
356
358
  export type Config = {
357
- /** Nom du projet */
358
- name: string;
359
+ /** Nom du projet */
360
+ name: string;
359
361
 
360
- /** Chaîne de caractères aléatoires qui permet de chiffrer les cookies de session */
361
- sessionSecret: string;
362
+ /** Chaîne de caractères aléatoires qui permet de chiffrer les cookies de session */
363
+ sessionSecret: string;
362
364
 
363
- useMysql2?: boolean;
365
+ useMysql2?: boolean;
364
366
 
365
- /** Identifiants permettant d'accéder au back-office */
366
- auth: {
367
- /** Nom d'utilisateur */
368
- username: string;
367
+ /** Identifiants permettant d'accéder au back-office */
368
+ auth: {
369
+ /** Nom d'utilisateur */
370
+ username: string;
369
371
 
370
- /** Password */
371
- password: string;
372
- };
372
+ /** Password */
373
+ password: string;
374
+ };
373
375
 
374
- authRoles?: AuthRole[];
376
+ authRoles?: AuthRole[];
375
377
 
376
- /** Identifiants de connexion à la base de données */
377
- mysql?: {
378
- host: string;
379
- user: string;
380
- password: string;
381
- database: string;
382
- port?: number;
383
- };
378
+ /** Identifiants de connexion à la base de données */
379
+ mysql?: {
380
+ host: string;
381
+ user: string;
382
+ password: string;
383
+ database: string;
384
+ port?: number;
385
+ };
384
386
 
385
- postgresql?: {
386
- host: string;
387
- user: string;
388
- password: string;
389
- database: string;
390
- port?: number;
391
- ssl?: any;
392
- };
387
+ postgresql?: {
388
+ host: string;
389
+ user: string;
390
+ password: string;
391
+ database: string;
392
+ port?: number;
393
+ ssl?: any;
394
+ };
393
395
 
394
- /** Clé API Google Maps pour les champs adresses et l'affichage de cartes */
395
- googleMapsKey?: string;
396
+ /** Clé API Google Maps pour les champs adresses et l'affichage de cartes */
397
+ googleMapsKey?: string;
396
398
 
397
- /** Désactiver la sélection multiple dans les vues de type table */
398
- hideMultiselect?: boolean;
399
+ /** Désactiver la sélection multiple dans les vues de type table */
400
+ hideMultiselect?: boolean;
399
401
 
400
- /** Cache l'inscription Made with love by Galadrim */
401
- hideBranding?: boolean;
402
+ /** Cache l'inscription Made with love by Galadrim */
403
+ hideBranding?: boolean;
402
404
 
403
- views: View[];
405
+ views: View[];
404
406
  };