ngx-material-entity 0.1.0

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 (76) hide show
  1. package/CONTRIBUTING.md +93 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +691 -0
  4. package/classes/entity-model.class.d.ts +9 -0
  5. package/classes/entity-service.class.d.ts +56 -0
  6. package/classes/entity-utilities.class.d.ts +95 -0
  7. package/components/confirm-dialog/confirm-dialog-data.d.ts +41 -0
  8. package/components/confirm-dialog/confirm-dialog.component.d.ts +18 -0
  9. package/components/confirm-dialog/confirm-dialog.module.d.ts +12 -0
  10. package/components/get-validation-error-message.function.d.ts +7 -0
  11. package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +35 -0
  12. package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.d.ts +12 -0
  13. package/components/input/array-table/array-table.component.d.ts +34 -0
  14. package/components/input/array-table/array-table.module.d.ts +19 -0
  15. package/components/input/input.component.d.ts +73 -0
  16. package/components/input/input.module.d.ts +18 -0
  17. package/components/input/internal-input/internal-input.component.d.ts +57 -0
  18. package/components/input/internal-input/internal-input.module.d.ts +16 -0
  19. package/components/table/create-dialog/create-entity-dialog-data.d.ts +21 -0
  20. package/components/table/create-dialog/create-entity-dialog.component.d.ts +25 -0
  21. package/components/table/create-dialog/create-entity-dialog.module.d.ts +12 -0
  22. package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +25 -0
  23. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +28 -0
  24. package/components/table/edit-dialog/edit-entity-dialog.module.d.ts +13 -0
  25. package/components/table/table-data.d.ts +184 -0
  26. package/components/table/table.component.d.ts +41 -0
  27. package/components/table/table.module.d.ts +17 -0
  28. package/decorators/array.decorator.d.ts +125 -0
  29. package/decorators/base/base-property.decorator.d.ts +9 -0
  30. package/decorators/base/decorator-types.enum.d.ts +28 -0
  31. package/decorators/base/property-decorator-config.interface.d.ts +50 -0
  32. package/decorators/boolean.decorator.d.ts +42 -0
  33. package/decorators/number.decorator.d.ts +40 -0
  34. package/decorators/object.decorator.d.ts +27 -0
  35. package/decorators/string.decorator.d.ts +76 -0
  36. package/esm2020/classes/entity-model.class.mjs +19 -0
  37. package/esm2020/classes/entity-service.class.mjs +70 -0
  38. package/esm2020/classes/entity-utilities.class.mjs +296 -0
  39. package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +2 -0
  40. package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +51 -0
  41. package/esm2020/components/confirm-dialog/confirm-dialog.module.mjs +22 -0
  42. package/esm2020/components/get-validation-error-message.function.mjs +32 -0
  43. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +43 -0
  44. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.mjs +22 -0
  45. package/esm2020/components/input/array-table/array-table.component.mjs +116 -0
  46. package/esm2020/components/input/array-table/array-table.module.mjs +66 -0
  47. package/esm2020/components/input/input.component.mjs +158 -0
  48. package/esm2020/components/input/input.module.mjs +62 -0
  49. package/esm2020/components/input/internal-input/internal-input.component.mjs +73 -0
  50. package/esm2020/components/input/internal-input/internal-input.module.mjs +54 -0
  51. package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +2 -0
  52. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +77 -0
  53. package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +22 -0
  54. package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +2 -0
  55. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +112 -0
  56. package/esm2020/components/table/edit-dialog/edit-entity-dialog.module.mjs +42 -0
  57. package/esm2020/components/table/table-data.mjs +2 -0
  58. package/esm2020/components/table/table.component.mjs +232 -0
  59. package/esm2020/components/table/table.module.mjs +58 -0
  60. package/esm2020/decorators/array.decorator.mjs +70 -0
  61. package/esm2020/decorators/base/base-property.decorator.mjs +13 -0
  62. package/esm2020/decorators/base/decorator-types.enum.mjs +20 -0
  63. package/esm2020/decorators/base/property-decorator-config.interface.mjs +31 -0
  64. package/esm2020/decorators/boolean.decorator.mjs +44 -0
  65. package/esm2020/decorators/number.decorator.mjs +36 -0
  66. package/esm2020/decorators/object.decorator.mjs +23 -0
  67. package/esm2020/decorators/string.decorator.mjs +61 -0
  68. package/esm2020/ngx-material-entity.mjs +5 -0
  69. package/esm2020/public-api.mjs +32 -0
  70. package/fesm2015/ngx-material-entity.mjs +1786 -0
  71. package/fesm2015/ngx-material-entity.mjs.map +1 -0
  72. package/fesm2020/ngx-material-entity.mjs +1760 -0
  73. package/fesm2020/ngx-material-entity.mjs.map +1 -0
  74. package/ngx-material-entity.d.ts +5 -0
  75. package/package.json +40 -0
  76. package/public-api.d.ts +25 -0
package/README.md ADDED
@@ -0,0 +1,691 @@
1
+ # NgxMaterialEntity
2
+ Create Entities and define how to display them directly on their properties.
3
+ <br>
4
+ Can even generate complete and highly customizable CRUD-Tables for them.
5
+
6
+ [![CI/CD](https://github.com/tim-fabian/ngx-material-entity/actions/workflows/main.yml/badge.svg?branch=release)](https://github.com/tim-fabian/ngx-material-entity/actions/workflows/main.yml)
7
+
8
+ # Table of Contents
9
+ - [NgxMaterialEntity](#ngxmaterialentity)
10
+ - [Table of Contents](#table-of-contents)
11
+ - [Requirements](#requirements)
12
+ - [Basic Usage](#basic-usage)
13
+ - [Create your entity](#create-your-entity)
14
+ - [Use the input for your entity property](#use-the-input-for-your-entity-property)
15
+ - [Generate a complete CRUD Table for your entity](#generate-a-complete-crud-table-for-your-entity)
16
+ - [Create a Service for your entity](#create-a-service-for-your-entity)
17
+ - [Define the CRUD-Element](#define-the-crud-element)
18
+ - [PropertyDecorators](#propertydecorators)
19
+ - [base](#base)
20
+ - [@string default](#string-default)
21
+ - [@string dropdown](#string-dropdown)
22
+ - [@string textbox](#string-textbox)
23
+ - [@string autocomplete](#string-autocomplete)
24
+ - [@number default](#number-default)
25
+ - [@number dropdown](#number-dropdown)
26
+ - [@boolean toggle](#boolean-toggle)
27
+ - [@boolean checkbox](#boolean-checkbox)
28
+ - [@boolean dropdown](#boolean-dropdown)
29
+ - [@object default](#object-default)
30
+ - [@array](#array)
31
+ - [@array entity](#array-entity)
32
+ - [@array string chips](#array-string-chips)
33
+ - [@array string chips autocomplete](#array-string-chips-autocomplete)
34
+ - [NgxMatEntityInput Configuration](#ngxmatentityinput-configuration)
35
+ - [NgxMatEntityTable Configuration](#ngxmatentitytable-configuration)
36
+ - [Display Columns](#display-columns)
37
+ - [Multiselect Actions](#multiselect-actions)
38
+
39
+ # Requirements
40
+ This package relies on the [angular material library](https://material.angular.io/guide/getting-started) to render its components.
41
+ <br>
42
+ It also uses [bootstrap](https://getbootstrap.com/) for responsive design.
43
+
44
+ # Basic Usage
45
+ ## Create your entity
46
+ Create your entity and define Metadata directly on the properties:
47
+ > :warning: IMPORTANT:
48
+ > <br>
49
+ > You need to always create an entity with the "new" keyword.
50
+ > Otherwise the metadata on the properties won't get generated.
51
+
52
+ ```typescript
53
+ import { Entity, EntityUtilities, string } from 'ngx-material-entity';
54
+
55
+ export class MyEntity extends Entity {
56
+
57
+ /**
58
+ * ↓ myString is a string
59
+ * ↓ which should be displayed inline
60
+ * ↓ and has the label 'My String'
61
+ */
62
+ @string({
63
+ displayName: 'My String',
64
+ displayStyle: 'line'
65
+ })
66
+ myString: string;
67
+
68
+ constructor(entity?: MyEntity) {
69
+ super();
70
+ EntityUtilities.new(this, entity);
71
+ }
72
+
73
+ }
74
+ ```
75
+ For a list of all decorators and configuration options see [PropertyDecorators](#propertydecorators).
76
+
77
+ ## Use the input for your entity property
78
+ You can import the ```NgxMatEntityInputModule``` anywhere in your code:
79
+
80
+ ```typescript
81
+ import { NgxMatEntityInputModule } from 'ngx-material-entity';
82
+
83
+ ...
84
+ imports: [
85
+ NgxMatEntityInputModule
86
+ ]
87
+ ...
88
+ ```
89
+
90
+ In the html you can then define:
91
+
92
+ ```html
93
+ <ngx-mat-entity-input
94
+ [entity]="myEntity"
95
+ [propertyKey]="myString">
96
+ </ngx-mat-entity-input>
97
+ ```
98
+
99
+ This snippet automatically generates an material input for "myString" based on the metadata you defined earlier.
100
+ <br>
101
+ For a list of all configuration options for the input see [PropertyInput Configuration](#propertyinput-configuration).
102
+
103
+ ## Generate a complete CRUD Table for your entity
104
+ ### Create a Service for your entity
105
+ In order to use the ngx-material-entites component you have to define a service that handles http-Requests for the entity and extends from the abstract EntityService-Class:
106
+
107
+ ```typescript
108
+ // ↓ It's required that the service can be injected
109
+ @Injectable({
110
+ providedIn: 'root'
111
+ })
112
+ export class MyEntityService extends EntityService<MyEntity> {
113
+ baseUrl: string = `${environment.apiUrl}/my-entity`;
114
+
115
+ constructor(private readonly httpClient: HttpClient) {
116
+ super(httpClient);
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### Define the CRUD-Element
122
+ Import the `NgxMatEntityTableModule` anywhere in your code:
123
+
124
+ ```typescript
125
+ import { NgxMatEntityTableModule } from 'ngx-material-entity';
126
+
127
+ ...
128
+ imports: [
129
+ NgxMatEntityTableModule
130
+ ]
131
+ ...
132
+ ```
133
+
134
+ In the html you can then define:
135
+
136
+ ```html
137
+ <ngx-mat-entity-table
138
+ [displayColumns]="displayColumns"
139
+ [title]="title"
140
+ [EntityServiceClass]="MyEntityService"
141
+ [EntityClass]="MyEntity"
142
+ [multiSelectActions]="multiSelectActions"
143
+ [createDialogTitle]="'Custom Create Dialog Title'">
144
+ </ngx-mat-entity-table>
145
+ ```
146
+ For a list of all configuration options see [NgxMatEntityTable Configuration](#ngxmatentitytable-configuration).
147
+
148
+ # PropertyDecorators
149
+ The property decorators contain all the metadata of an entity property.
150
+
151
+ ## base
152
+ Contains information that is universally defined on every property.
153
+
154
+ ```typescript
155
+ /**
156
+ * Whether or not the Property is displayed at all.
157
+ * @default true
158
+ */
159
+ display?: boolean;
160
+ /**
161
+ * The name of the property used as a label for form fields.
162
+ */
163
+ displayName: string;
164
+ /**
165
+ * Whether or not the Property is required.
166
+ * @default true
167
+ */
168
+ required?: boolean;
169
+ /**
170
+ * Whether or not the property gets omitted when creating new Entities.
171
+ * @default false
172
+ */
173
+ omitForCreate?: boolean;
174
+ /**
175
+ * Whether or not the property gets omitted when updating Entities.
176
+ * @default false
177
+ */
178
+ omitForUpdate?: boolean;
179
+ /**
180
+ * Defines the width of the input property when used inside the default create or edit dialog.
181
+ * Has 3 bootstrap values for different breakpoints for simple responsive design.
182
+ * @var firstValue: col-lg-{{firstValue}}
183
+ * @var secondValue: col-md-{{secondValue}}
184
+ * @var thirdValue: col-sm-{{thirdValue}}
185
+ */
186
+ defaultWidths?: [cols, cols, cols];
187
+ /**
188
+ * Specifies order of the input property when used inside the default create or edit dialog.
189
+ * Ordering is ascending
190
+ * @default -1 (sets this property at the end)
191
+ */
192
+ order?: number;
193
+ ```
194
+ For more information regarding the defaultWidths see the bootstrap guide about the [Grid system](https://getbootstrap.com/docs/5.0/layout/grid/).
195
+
196
+ ## @string default
197
+ The "default" display of a string value. Inside a single line mat-input.
198
+
199
+ ```typescript
200
+ override displayStyle: 'line';
201
+ /**
202
+ * (optional) The minimum required length of the string
203
+ */
204
+ minLength?: number;
205
+ /**
206
+ * (optional) The maximum required length of the string
207
+ */
208
+ maxLength?: number;
209
+ /**
210
+ * (optional) A regex used for validation
211
+ */
212
+ regex?: RegExp;
213
+ ```
214
+
215
+ ## @string dropdown
216
+ Displays a string as a dropdown where the user can input one of the defined dropdownValues.
217
+
218
+ ```typescript
219
+ override displayStyle: 'dropdown';
220
+ /**
221
+ * The values of the dropdown, consisting of a name to display and the actual value
222
+ * Can also receive a function to determine the values
223
+ */
224
+ dropdownValues: { displayName: string, value: string }[];
225
+ ```
226
+
227
+ ## @string textbox
228
+ Displays a string as a textbox.
229
+
230
+ ```typescript
231
+ override displayStyle: 'textbox';
232
+ /**
233
+ * (optional) The minimum required length of the string
234
+ */
235
+ minLength?: number;
236
+ /**
237
+ * (optional) The maximum required length of the string
238
+ */
239
+ maxLength?: number;
240
+ ```
241
+
242
+ ## @string autocomplete
243
+ Just like the default @string, but the user has additional autocomplete values to quickly input data.
244
+
245
+ ```typescript
246
+ override displayStyle: 'autocomplete';
247
+ /**
248
+ * The autocomplete values
249
+ */
250
+ autocompleteValues: string[];
251
+ /**
252
+ * (optional) The minimum required length of the string
253
+ */
254
+ minLength?: number;
255
+ /**
256
+ * (optional) The maximum required length of the string
257
+ */
258
+ maxLength?: number;
259
+ /**
260
+ * (optional) A regex used for validation
261
+ */
262
+ regex?: RegExp;
263
+ ```
264
+
265
+ ## @number default
266
+ The "default" display of a number value. Inside a single line mat-input.
267
+
268
+ ```typescript
269
+ override displayStyle: 'line';
270
+ /**
271
+ * (optional) The minimum value of the number
272
+ */
273
+ min?: number;
274
+ /**
275
+ * (optional) The maximum value of the number
276
+ */
277
+ max?: number;
278
+ ```
279
+
280
+ ## @number dropdown
281
+ Displays the numbers in a dropdown
282
+
283
+ ```typescript
284
+ override displayStyle: 'dropdown';
285
+ /**
286
+ * The values of the dropdown, consisting of a name to display and the actual value
287
+ * Can also receive a function to determine the values
288
+ */
289
+ dropdownValues: { displayName: string, value: number }[];
290
+ ```
291
+
292
+ ## @boolean toggle
293
+ Displays the boolean value as a MatSlideToggle
294
+
295
+ ```typescript
296
+ override displayStyle: 'toggle';
297
+ ```
298
+
299
+ ## @boolean checkbox
300
+ Displays the boolean value as a MatCheckbox
301
+
302
+ ```typescript
303
+ override displayStyle: 'checkbox';
304
+ ```
305
+
306
+ ## @boolean dropdown
307
+ Displays the boolean value as a MatCheckbox
308
+
309
+ ```typescript
310
+ override displayStyle: 'dropdown';
311
+ /**
312
+ * The name of the true value if displayStyle dropdown is used.
313
+ * Can also receive a function to determine the name.
314
+ */
315
+ dropdownTrue: string | { (args: unknown): string };
316
+ /**
317
+ * The name of the false value if displayStyle dropdown is used.
318
+ * Can also receive a function to determine the name,
319
+ */
320
+ dropdownFalse: string | { (args: unknown): string };
321
+ ```
322
+
323
+ ## @object default
324
+ Displays an entity object inline.
325
+
326
+ ```typescript
327
+ override displayStyle: 'inline';
328
+ /**
329
+ * (optional) The title of the section containing all object properties. Defaults to the display name.
330
+ */
331
+ sectionTitle?: string;
332
+ ```
333
+
334
+ ## @array
335
+ ```typescript
336
+ /**
337
+ * Base definition for the @array metadata
338
+ */
339
+ abstract class ArrayDecoratorConfig extends PropertyDecoratorConfig {
340
+ /**
341
+ * How to display the items
342
+ */
343
+ displayStyle!: 'table' | 'chips';
344
+
345
+ /**
346
+ * The type of the items inside the array
347
+ */
348
+ itemType!: DecoratorTypes;
349
+
350
+ /**
351
+ * The error-message to display when the array is required but contains no values
352
+ */
353
+ missingErrorMessage?: string;
354
+ }
355
+ ```
356
+ ## @array entity
357
+ ```typescript
358
+ /**
359
+ * Definition for an array of Entities
360
+ */
361
+ export class EntityArrayDecoratorConfig<EntityType extends Entity> extends ArrayDecoratorConfig {
362
+ override itemType: DecoratorTypes.OBJECT;
363
+ override displayStyle: 'table';
364
+
365
+ /**
366
+ * The EntityClass used for generating the create inputs
367
+ */
368
+ EntityClass!: new (entity?: EntityType) => EntityType;
369
+
370
+ /**
371
+ * The definition of the columns to display. Consists of the displayName to show in the header of the row
372
+ * and the value, which is a function that generates the value to display inside a column
373
+ */
374
+ displayColumns: ArrayTableDisplayColumn<EntityType>[];
375
+
376
+ /**
377
+ * The data for the add-item-dialog.
378
+ * Can be omitted when adding items inline.
379
+ */
380
+ createDialogData?: CreateDialogData
381
+
382
+ /**
383
+ * Whether or not the form for adding items to the array
384
+ * should be displayed inline.
385
+ * @default true
386
+ */
387
+ createInline?: boolean
388
+ }
389
+ ```
390
+
391
+ ## @array string chips
392
+ ```typescript
393
+ /**
394
+ * Definition for an array of strings displayed as a chips list
395
+ */
396
+ export class StringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
397
+ override itemType: DecoratorTypes.STRING;
398
+ override displayStyle: 'chips';
399
+
400
+ /**
401
+ * The html inside the delete-button.
402
+ * Please note that custom tags such as <mat-icon></mat-icon>
403
+ * need to be defined as known elements, otherwise the sanitizer will remove them.
404
+ * You can however work around this by using `<span class="material-icons"></span>`
405
+ * @default <mat-icon>cancel</mat-icon>
406
+ */
407
+ deleteHtml?: string
408
+ /**
409
+ * (optional) The minimum required length of the string
410
+ */
411
+ minLength?: number;
412
+ /**
413
+ * (optional) The maximum required length of the string
414
+ */
415
+ maxLength?: number;
416
+ /**
417
+ * (optional) A regex used for validation
418
+ */
419
+ regex?: RegExp;
420
+ }
421
+ ```
422
+
423
+ ## @array string chips autocomplete
424
+ ```typescript
425
+ /**
426
+ * Definition for an array of autocomplete strings displayed as a chips list
427
+ */
428
+ export class AutocompleteStringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
429
+ override itemType: DecoratorTypes.STRING_AUTOCOMPLETE;
430
+ override displayStyle: 'chips';
431
+
432
+ /**
433
+ * The html inside the delete-button.
434
+ * Please note that custom tags such as <mat-icon></mat-icon>
435
+ * need to be defined as known elements, otherwise the sanitizer will remove them.
436
+ * You can however work around this by using `<span class="material-icons"></span>`
437
+ * @default <mat-icon>cancel</mat-icon>
438
+ */
439
+ deleteHtml?: string;
440
+ /**
441
+ * The autocomplete values
442
+ */
443
+ autocompleteValues: string[];
444
+ /**
445
+ * (optional) The minimum required length of the string
446
+ */
447
+ minLength?: number;
448
+ /**
449
+ * (optional) The maximum required length of the string
450
+ */
451
+ maxLength?: number;
452
+ /**
453
+ * (optional) A regex used for validation
454
+ */
455
+ regex?: RegExp;
456
+ }
457
+ ```
458
+
459
+ # NgxMatEntityInput Configuration
460
+ With the property input you can generate an input field based on the metadata you defined on your property.
461
+ <br>
462
+ Configuration options are:
463
+
464
+ ```typescript
465
+ /**
466
+ * The entity on which the property exists. Used in conjuction with the "propertyKey"
467
+ * to determine the property for which the input should be generated.
468
+ */
469
+ @Input()
470
+ entity!: EntityType;
471
+
472
+ /**
473
+ * The name of the property to generate the input for. Used in conjuction with the "entity".
474
+ */
475
+ @Input()
476
+ propertyKey!: keyof EntityType;
477
+
478
+ /**
479
+ * (optional) A custom function to generate the error-message for invalid inputs.
480
+ */
481
+ @Input()
482
+ getValidationErrorMessage!: (model: NgModel) => string;
483
+
484
+ /**
485
+ * Whether to hide a value if it is omitted for creation.
486
+ * Is used internally for the object property.
487
+ */
488
+ @Input()
489
+ hideOmitForCreate?: boolean;
490
+
491
+ /**
492
+ * Whether to hide a value if it is omitted for editing.
493
+ * Is used internally for the object property.
494
+ */
495
+ @Input()
496
+ hideOmitForEdit?: boolean;
497
+ ```
498
+
499
+ # NgxMatEntityTable Configuration
500
+ With the `ngx-mat-entity-table` component you can create a complete CRUD functionality for your entities.
501
+ <br>
502
+ As this component is highly configurable and allows you to either create your own create and edit implementations or use the default out of the box dialogs for that.
503
+
504
+ ```typescript
505
+ /**
506
+ * The title of the table
507
+ */
508
+ @Input()
509
+ title!: string;
510
+ /**
511
+ * The definition of the columns to display. Consists of the displayName to show in the header of the row
512
+ * and the value, which is a function that generates the value to display inside a column
513
+ */
514
+ @Input()
515
+ displayColumns!: DisplayColumn<EntityType>[];
516
+ /**
517
+ * The label on the search bar. Defaults to "Search".
518
+ */
519
+ @Input()
520
+ searchLabel?: string;
521
+ /**
522
+ * The label on the button for adding new entities. Defaults to "Create".
523
+ */
524
+ @Input()
525
+ createButtonLabel?: string;
526
+ /**
527
+ * The Class of the entities to manage
528
+ */
529
+ @Input()
530
+ EntityClass!: new (entity?: EntityType) => EntityType;
531
+ /**
532
+ * The Class of the service that handles the entities.
533
+ * Needs to be injectable and an extension of the "EntityService"-Class
534
+ */
535
+ @Input()
536
+ EntityServiceClass!: new (httpClient: HttpClient) => EntityService<EntityType>;
537
+ /**
538
+ * Takes a custom edit method which runs when you click on a entity.
539
+ * If you don't need any special editing of entries you can also omit this.
540
+ * In that case a default edit dialog is generated.
541
+ */
542
+ @Input()
543
+ edit?: (entity: EntityType) => unknown;
544
+ /**
545
+ * Takes a method to run when you click on the new button.
546
+ * If you don't need anything special you can also omit this.
547
+ * In that case a default create dialog is generated.
548
+ */
549
+ @Input()
550
+ create?: (entity: EntityType) => unknown;
551
+ /**
552
+ * Defines how the search string of entities is generated.
553
+ */
554
+ @Input()
555
+ searchString?: (enity: EntityType) => string;
556
+ /**
557
+ * Defines whether or not the user can add new entities.
558
+ */
559
+ @Input()
560
+ allowCreate!: boolean;
561
+ /**
562
+ * Defines whether or not the user can edit entities.
563
+ */
564
+ @Input()
565
+ allowEdit!: boolean;
566
+ /**
567
+ * Defines whether or not the user can delete entities.
568
+ */
569
+ @Input()
570
+ allowDelete!: boolean;
571
+ /**
572
+ * All Actions that you want to run on multiple entities can be defined here.
573
+ * (e.g. download as zip-file or mass delete)
574
+ */
575
+ @Input()
576
+ multiSelectActions?: MultiSelectAction<EntityType>[];
577
+ /**
578
+ * The Label for the button that opens all multi-actions.
579
+ */
580
+ @Input()
581
+ multiSelectLabel?: string;
582
+
583
+
584
+
585
+ /**
586
+ * The title of the default create-dialog.
587
+ */
588
+ @Input()
589
+ createDialogTitle!: string;
590
+ /**
591
+ * The label on the create-button of the default create-dialog. Defaults to "Create".
592
+ */
593
+ @Input()
594
+ createDialogCreateButtonLabel?: string;
595
+ /**
596
+ * The label on the cancel-button for the default create-dialog. Defaults to "Cancel".
597
+ */
598
+ @Input()
599
+ createDialogCancelButtonLabel?: string;
600
+
601
+
602
+
603
+ /**
604
+ * The title of the default edit-dialog.
605
+ */
606
+ @Input()
607
+ editDialogTitle!: string;
608
+ /**
609
+ * The label on the confirm-button of the default edit-dialog. Defaults to "Save".
610
+ */
611
+ @Input()
612
+ editDialogConfirmButtonLabel?: string;
613
+ /**
614
+ * The label on the delete-button of the default edit-dialog. Defaults to "Delete".
615
+ */
616
+ @Input()
617
+ editDialogDeleteButtonLabel?: string;
618
+ /**
619
+ * The label on the cancel-button for the default edit-dialog. Defaults to "Cancel".
620
+ */
621
+ @Input()
622
+ editDialogCancelButtonLabel?: string;
623
+ /**
624
+ * The text inside the confirm delete dialog.
625
+ * Each string inside the array is a paragraph.
626
+ */
627
+ @Input()
628
+ confirmDeleteText?: string[];
629
+ /**
630
+ * The label on the button that confirms the deletion of an entity.
631
+ */
632
+ @Input()
633
+ confirmDeleteButtonLabel?: string;
634
+ /**
635
+ * The label on the button that cancels the deletion of an entity.
636
+ */
637
+ @Input()
638
+ cancelDeleteButtonLabel?: string;
639
+ /**
640
+ * The title of the dialog where you have to either confirm or cancel the deletion of an entity.
641
+ */
642
+ @Input()
643
+ confirmDeleteDialogTitle?: string;
644
+ /**
645
+ * Whether or not a checkbox needs to be checked before being able to click on the confirm-delete-button
646
+ */
647
+ @Input()
648
+ confirmDeleteRequireConfirmation?: boolean;
649
+ /**
650
+ * The text next to the checkbox
651
+ */
652
+ @Input()
653
+ confirmDeleteConfirmationText?: string
654
+ ```
655
+
656
+ ## Display Columns
657
+ The definition of a column inside the table.
658
+ ```typescript
659
+ export interface DisplayColumn<EntityType extends Entity> {
660
+ /**
661
+ * The name inside the header.
662
+ */
663
+ displayName: string;
664
+ /**
665
+ * A method to get the value inside an entry
666
+ */
667
+ value: (entity: EntityType) => string;
668
+ }
669
+ ```
670
+
671
+ ## Multiselect Actions
672
+ Multiselect Actions appear on the right upper corner and allow you to do actions on all selected entries.
673
+
674
+ ```typescript
675
+ export interface MultiSelectAction<EntityType extends Entity> {
676
+ /**
677
+ * The name of the action
678
+ */
679
+ displayName: string;
680
+ /**
681
+ * The action itself
682
+ */
683
+ action: (entity: EntityType[]) => unknown;
684
+ /**
685
+ * A method that defines whether or not the action can be used.
686
+ * Defaults to true.
687
+ */
688
+ enabled?: (entity: EntityType[]) => boolean;
689
+ }
690
+ ```
691
+ //TODO
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The base Entity class.
3
+ */
4
+ export declare abstract class Entity {
5
+ /**
6
+ * A unique identifier for the Entity
7
+ */
8
+ id: string;
9
+ }