ngx-material-entity 0.1.3 → 0.1.4
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/README.md +533 -326
- package/classes/{base-builder.class.d.ts → base.builder.d.ts} +0 -0
- package/classes/date.utilities.d.ts +58 -0
- package/classes/entity.model.d.ts +13 -0
- package/classes/{entity-service.class.d.ts → entity.service.d.ts} +9 -4
- package/classes/{entity-utilities.class.d.ts → entity.utilities.d.ts} +24 -16
- package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +1 -1
- package/components/input/add-array-item-dialog-data.builder.d.ts +3 -4
- package/components/input/add-array-item-dialog-data.d.ts +1 -2
- package/components/input/input.component.d.ts +38 -7
- package/components/input/input.module.d.ts +2 -1
- package/components/table/create-dialog/create-dialog-data.builder.d.ts +1 -1
- package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +4 -5
- package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -3
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +3 -4
- package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +3 -4
- package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +2 -3
- package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +4 -5
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +3 -4
- package/components/table/table-data.builder.d.ts +9 -9
- package/components/table/table-data.d.ts +8 -8
- package/components/table/table.component.d.ts +1 -2
- package/decorators/array/array-decorator-internal.data.d.ts +3 -3
- package/decorators/array/array-decorator.data.d.ts +4 -4
- package/decorators/array/array.decorator.d.ts +1 -2
- package/decorators/base/decorator-types.enum.d.ts +6 -3
- package/decorators/base/dropdown-value.interface.d.ts +14 -0
- package/decorators/date/date-decorator-internal.data.d.ts +44 -0
- package/decorators/date/date-decorator.data.d.ts +129 -0
- package/decorators/number/number-decorator-internal.data.d.ts +2 -4
- package/decorators/number/number-decorator.data.d.ts +2 -4
- package/decorators/number/number.decorator.d.ts +2 -2
- package/decorators/object/object-decorator-internal.data.d.ts +3 -3
- package/decorators/object/object-decorator.data.d.ts +5 -5
- package/decorators/object/object.decorator.d.ts +1 -2
- package/decorators/string/string-decorator-internal.data.d.ts +2 -4
- package/decorators/string/string-decorator.data.d.ts +2 -4
- package/esm2020/classes/base.builder.mjs +43 -0
- package/esm2020/classes/date.utilities.mjs +138 -0
- package/esm2020/classes/entity.model.mjs +19 -0
- package/esm2020/classes/entity.service.mjs +83 -0
- package/esm2020/classes/entity.utilities.mjs +538 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +2 -2
- package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +4 -4
- package/esm2020/components/input/add-array-item-dialog-data.mjs +1 -1
- package/esm2020/components/input/input.component.mjs +82 -14
- package/esm2020/components/input/input.module.mjs +8 -4
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +2 -2
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +2 -2
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +3 -3
- package/esm2020/components/table/table-data.builder.mjs +2 -2
- package/esm2020/components/table/table-data.mjs +1 -1
- package/esm2020/components/table/table.component.mjs +2 -2
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +1 -1
- package/esm2020/decorators/array/array-decorator.data.mjs +1 -1
- package/esm2020/decorators/array/array.decorator.mjs +1 -1
- package/esm2020/decorators/base/decorator-types.enum.mjs +4 -1
- package/esm2020/decorators/base/dropdown-value.interface.mjs +2 -0
- package/esm2020/decorators/date/date-decorator-internal.data.mjs +48 -0
- package/esm2020/decorators/date/date-decorator.data.mjs +7 -0
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +1 -1
- package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
- package/esm2020/decorators/number/number.decorator.mjs +3 -3
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +2 -2
- package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
- package/esm2020/decorators/object/object.decorator.mjs +1 -1
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +1 -1
- package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
- package/esm2020/public-api.mjs +7 -5
- package/fesm2015/ngx-material-entity.mjs +461 -82
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +460 -82
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +7 -1
- package/public-api.d.ts +7 -4
- package/classes/entity-model.class.d.ts +0 -9
- package/esm2020/classes/base-builder.class.mjs +0 -43
- package/esm2020/classes/entity-model.class.mjs +0 -19
- package/esm2020/classes/entity-service.class.mjs +0 -76
- package/esm2020/classes/entity-utilities.class.mjs +0 -377
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# NgxMaterialEntity
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
With NgxMaterialEntity you can define how to display entities directly on their properties by using a multitude of decorators for them. You can then use the input component to display the value solely based on the entity and the propertyKey.
|
|
3
|
+
|
|
4
|
+
It also offers a table component which generates complete CRUD-functionality right out of the box.
|
|
5
|
+
|
|
6
|
+
NgxMaterialEntity aims to have a fast way to get started with a lot of default options which can be overriden to allow high customization aswell.
|
|
4
7
|
|
|
5
8
|
[](https://github.com/tim-fabian/ngx-material-entity/actions/workflows/main.yml)
|
|
6
9
|
[](https://badge.fury.io/js/ngx-material-entity)
|
|
@@ -28,6 +31,9 @@ Can even generate complete and highly customizable CRUD-Tables for them.
|
|
|
28
31
|
- [@boolean toggle](#boolean-toggle)
|
|
29
32
|
- [@boolean checkbox](#boolean-checkbox)
|
|
30
33
|
- [@boolean dropdown](#boolean-dropdown)
|
|
34
|
+
- [@date default](#date-default)
|
|
35
|
+
- [@date dateRange](#date-daterange)
|
|
36
|
+
- [@date datetime](#date-datetime)
|
|
31
37
|
- [@object default](#object-default)
|
|
32
38
|
- [@array](#array)
|
|
33
39
|
- [@array entity](#array-entity)
|
|
@@ -54,6 +60,8 @@ Create your entity and define Metadata directly on the properties:
|
|
|
54
60
|
```typescript
|
|
55
61
|
import { Entity, EntityUtilities, string } from 'ngx-material-entity';
|
|
56
62
|
|
|
63
|
+
// The "extends Entity" can be left out.
|
|
64
|
+
// The abstract Entity-Class provides an id out of the box.
|
|
57
65
|
export class MyEntity extends Entity {
|
|
58
66
|
|
|
59
67
|
/**
|
|
@@ -69,12 +77,14 @@ export class MyEntity extends Entity {
|
|
|
69
77
|
|
|
70
78
|
constructor(entity?: MyEntity) {
|
|
71
79
|
super();
|
|
80
|
+
// this helper-method sets all values from the provided entity.
|
|
81
|
+
// It can be used universally.
|
|
72
82
|
EntityUtilities.new(this, entity);
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
}
|
|
76
86
|
```
|
|
77
|
-
For a list of all decorators and configuration options see [PropertyDecorators](#propertydecorators).
|
|
87
|
+
For a list of all property decorators and their configuration options see [PropertyDecorators](#propertydecorators).
|
|
78
88
|
|
|
79
89
|
## Use the input for your entity property
|
|
80
90
|
You can import the ```NgxMatEntityInputModule``` anywhere in your code:
|
|
@@ -92,19 +102,29 @@ import { NgxMatEntityInputModule } from 'ngx-material-entity';
|
|
|
92
102
|
In the html you can then define:
|
|
93
103
|
|
|
94
104
|
```html
|
|
95
|
-
<ngx-mat-entity-input
|
|
96
|
-
[entity]="myEntity"
|
|
97
|
-
[propertyKey]="myString">
|
|
105
|
+
<ngx-mat-entity-input [entity]="myEntity" [propertyKey]="myString">
|
|
98
106
|
</ngx-mat-entity-input>
|
|
99
107
|
```
|
|
100
108
|
|
|
109
|
+
That's it!
|
|
110
|
+
|
|
101
111
|
This snippet automatically generates an material input for "myString" based on the metadata you defined earlier.
|
|
102
112
|
<br>
|
|
103
|
-
For a list of
|
|
113
|
+
For a list of further configuration options for the input see [PropertyInput Configuration](#propertyinput-configuration).
|
|
104
114
|
|
|
105
115
|
## Generate a complete CRUD Table for your entity
|
|
116
|
+
It is pretty easy to use the input component inside a for-loop that iterates over every key of an entity to build a complete form for that entity.
|
|
117
|
+
<br>
|
|
118
|
+
We thought this approach a bit further and build a complete CRUD table component with support for:
|
|
119
|
+
- omitting values for creation or updating
|
|
120
|
+
- layouting
|
|
121
|
+
- responsive design
|
|
122
|
+
- multi select actions
|
|
123
|
+
|
|
124
|
+
As always is the component ready to use out of the box but offers a lot of customization aswell.
|
|
125
|
+
|
|
106
126
|
### Create a Service for your entity
|
|
107
|
-
In order to use the
|
|
127
|
+
In order to use the table component you have to define a service that handles http-Requests for the entity and extends from the abstract EntityService-Class:
|
|
108
128
|
|
|
109
129
|
```typescript
|
|
110
130
|
// ↓ It's required that the service can be injected
|
|
@@ -113,6 +133,7 @@ In order to use the ngx-material-entites component you have to define a service
|
|
|
113
133
|
})
|
|
114
134
|
export class MyEntityService extends EntityService<MyEntity> {
|
|
115
135
|
baseUrl: string = `${environment.apiUrl}/my-entity`;
|
|
136
|
+
idKey: keyof MyEntity;
|
|
116
137
|
|
|
117
138
|
constructor(private readonly httpClient: HttpClient) {
|
|
118
139
|
super(httpClient);
|
|
@@ -154,44 +175,50 @@ The property decorators contain all the metadata of an entity property.
|
|
|
154
175
|
Contains information that is universally defined on every property.
|
|
155
176
|
|
|
156
177
|
```typescript
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
178
|
+
export abstract class PropertyDecoratorConfig {
|
|
179
|
+
/**
|
|
180
|
+
* Whether or not the Property is displayed at all.
|
|
181
|
+
*
|
|
182
|
+
* @default true
|
|
183
|
+
*/
|
|
184
|
+
display?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* The name of the property used as a label for form fields.
|
|
187
|
+
*/
|
|
188
|
+
displayName!: string;
|
|
189
|
+
/**
|
|
190
|
+
* Whether or not the Property is required.
|
|
191
|
+
*
|
|
192
|
+
* @default true
|
|
193
|
+
*/
|
|
194
|
+
required?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Whether or not the property gets omitted when creating new Entities.
|
|
197
|
+
*
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
omitForCreate?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Whether or not the property gets omitted when updating Entities.
|
|
203
|
+
*
|
|
204
|
+
* @default false
|
|
205
|
+
*/
|
|
206
|
+
omitForUpdate?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Defines the width of the input property when used inside the default create or edit dialog.
|
|
209
|
+
* Has 3 bootstrap values for different breakpoints for simple responsive design.
|
|
210
|
+
* The first value sets the columns for the screen size lg, the second for md and the third for sm.
|
|
211
|
+
*
|
|
212
|
+
* @default [6, 6, 12]
|
|
213
|
+
*/
|
|
214
|
+
defaultWidths?: [Col, Col, Col];
|
|
215
|
+
/**
|
|
216
|
+
* Specifies the how to position this property when using default create/edit dialogs.
|
|
217
|
+
*
|
|
218
|
+
* @default { row: -1, order: -1} (Adds the property at the end)
|
|
219
|
+
*/
|
|
220
|
+
position?: Position
|
|
221
|
+
}
|
|
195
222
|
```
|
|
196
223
|
For more information regarding the defaultWidths see the bootstrap guide about the [Grid system](https://getbootstrap.com/docs/5.0/layout/grid/).
|
|
197
224
|
|
|
@@ -199,262 +226,421 @@ For more information regarding the defaultWidths see the bootstrap guide about t
|
|
|
199
226
|
The "default" display of a string value. Inside a single line mat-input.
|
|
200
227
|
|
|
201
228
|
```typescript
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
regex
|
|
229
|
+
export interface DefaultStringDecoratorConfig extends StringDecoratorConfig {
|
|
230
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
231
|
+
displayStyle: 'line',
|
|
232
|
+
/**
|
|
233
|
+
* The minimum required length of the string.
|
|
234
|
+
*/
|
|
235
|
+
minLength?: number,
|
|
236
|
+
/**
|
|
237
|
+
* The maximum required length of the string.
|
|
238
|
+
*/
|
|
239
|
+
maxLength?: number,
|
|
240
|
+
/**
|
|
241
|
+
* A regex used for validation.
|
|
242
|
+
*/
|
|
243
|
+
regex?: RegExp
|
|
244
|
+
}
|
|
215
245
|
```
|
|
216
246
|
|
|
217
247
|
## @string dropdown
|
|
218
248
|
Displays a string as a dropdown where the user can input one of the defined dropdownValues.
|
|
219
249
|
|
|
220
250
|
```typescript
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
251
|
+
export interface DropdownStringDecoratorConfig extends StringDecoratorConfig {
|
|
252
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
253
|
+
displayStyle: 'dropdown',
|
|
254
|
+
/**
|
|
255
|
+
* The values of the dropdown, consisting of a name to display and the actual value
|
|
256
|
+
* Can also receive a function to determine the values.
|
|
257
|
+
*/
|
|
258
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
259
|
+
dropdownValues: DropdownValue<string>[]
|
|
260
|
+
}
|
|
227
261
|
```
|
|
228
262
|
|
|
229
263
|
## @string textbox
|
|
230
264
|
Displays a string as a textbox.
|
|
231
265
|
|
|
232
266
|
```typescript
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
267
|
+
export interface TextboxStringDecoratorConfig extends StringDecoratorConfig {
|
|
268
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
269
|
+
displayStyle: 'textbox',
|
|
270
|
+
/**
|
|
271
|
+
* The minimum required length of the string.
|
|
272
|
+
*/
|
|
273
|
+
minLength?: number,
|
|
274
|
+
/**
|
|
275
|
+
* The maximum required length of the string.
|
|
276
|
+
*/
|
|
277
|
+
maxLength?: number
|
|
278
|
+
}
|
|
242
279
|
```
|
|
243
280
|
|
|
244
281
|
## @string autocomplete
|
|
245
282
|
Just like the default @string, but the user has additional autocomplete values to quickly input data.
|
|
246
283
|
|
|
247
284
|
```typescript
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
regex
|
|
285
|
+
export interface AutocompleteStringDecoratorConfig extends StringDecoratorConfig {
|
|
286
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
287
|
+
displayStyle: 'autocomplete',
|
|
288
|
+
/**
|
|
289
|
+
* The autocomplete values.
|
|
290
|
+
*/
|
|
291
|
+
autocompleteValues: string[],
|
|
292
|
+
/**
|
|
293
|
+
* The minimum required length of the string.
|
|
294
|
+
*/
|
|
295
|
+
minLength?: number,
|
|
296
|
+
/**
|
|
297
|
+
* The maximum required length of the string.
|
|
298
|
+
*/
|
|
299
|
+
maxLength?: number,
|
|
300
|
+
/**
|
|
301
|
+
* A regex used for validation.
|
|
302
|
+
*/
|
|
303
|
+
regex?: RegExp
|
|
304
|
+
}
|
|
265
305
|
```
|
|
266
306
|
|
|
267
307
|
## @number default
|
|
268
308
|
The "default" display of a number value. Inside a single line mat-input.
|
|
269
309
|
|
|
270
310
|
```typescript
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
311
|
+
export interface DefaultNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
312
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
313
|
+
displayStyle: 'line',
|
|
314
|
+
/**
|
|
315
|
+
* The minimum value of the number.
|
|
316
|
+
*/
|
|
317
|
+
min?: number,
|
|
318
|
+
/**
|
|
319
|
+
* The maximum value of the number.
|
|
320
|
+
*/
|
|
321
|
+
max?: number
|
|
322
|
+
}
|
|
280
323
|
```
|
|
281
324
|
|
|
282
325
|
## @number dropdown
|
|
283
326
|
Displays the numbers in a dropdown
|
|
284
327
|
|
|
285
328
|
```typescript
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
329
|
+
export interface DropdownNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
330
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
331
|
+
displayStyle: 'dropdown',
|
|
332
|
+
/**
|
|
333
|
+
* The values of the dropdown, consisting of a name to display and the actual value.
|
|
334
|
+
*/
|
|
335
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
336
|
+
dropdownValues: DropdownValue<number>[]
|
|
337
|
+
}
|
|
292
338
|
```
|
|
293
339
|
|
|
294
340
|
## @boolean toggle
|
|
295
341
|
Displays the boolean value as a MatSlideToggle
|
|
296
342
|
|
|
297
343
|
```typescript
|
|
298
|
-
|
|
344
|
+
export interface ToggleBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
345
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
346
|
+
displayStyle: 'toggle'
|
|
347
|
+
}
|
|
299
348
|
```
|
|
300
349
|
|
|
301
350
|
## @boolean checkbox
|
|
302
351
|
Displays the boolean value as a MatCheckbox
|
|
303
352
|
|
|
304
353
|
```typescript
|
|
305
|
-
|
|
354
|
+
export interface CheckboxBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
355
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
356
|
+
displayStyle: 'checkbox'
|
|
357
|
+
}
|
|
306
358
|
```
|
|
307
359
|
|
|
308
360
|
## @boolean dropdown
|
|
309
361
|
Displays the boolean value as a MatCheckbox
|
|
310
362
|
|
|
311
363
|
```typescript
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
dropdownFalse: string
|
|
364
|
+
export interface DropdownBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
365
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
366
|
+
displayStyle: 'dropdown',
|
|
367
|
+
/**
|
|
368
|
+
* The name of the true value if displayStyle dropdown is used.
|
|
369
|
+
*/
|
|
370
|
+
dropdownTrue: string,
|
|
371
|
+
/**
|
|
372
|
+
* The name of the false value if displayStyle dropdown is used.
|
|
373
|
+
*/
|
|
374
|
+
dropdownFalse: string
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## @date default
|
|
379
|
+
Displays a date value as an mat-datepicker.
|
|
380
|
+
```typescript
|
|
381
|
+
export interface DefaultDateDecoratorConfig extends DateDecoratorConfig {
|
|
382
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
383
|
+
displayStyle: 'date',
|
|
384
|
+
/**
|
|
385
|
+
* A function to get the minimum value of the date.
|
|
386
|
+
*/
|
|
387
|
+
min?: (date?: Date) => Date,
|
|
388
|
+
/**
|
|
389
|
+
* A function to get the maximum value of the date.
|
|
390
|
+
*/
|
|
391
|
+
max?: (date?: Date) => Date,
|
|
392
|
+
/**
|
|
393
|
+
* A filter function to do more specific filtering. This could be the removal of e.g. All weekends.
|
|
394
|
+
*/
|
|
395
|
+
filter?: DateFilterFn<Date | null | undefined>
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## @date dateRange
|
|
400
|
+
Displays the selection of a time period as the daterange-picker.
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
export interface DateRangeDateDecoratorConfig extends DateDecoratorConfig {
|
|
404
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
405
|
+
displayStyle: 'daterange',
|
|
406
|
+
/**
|
|
407
|
+
* A function to get the minimum value of the start date.
|
|
408
|
+
*/
|
|
409
|
+
minStart?: (date?: Date) => Date,
|
|
410
|
+
/**
|
|
411
|
+
* A function to get the maximum value of the start date.
|
|
412
|
+
*/
|
|
413
|
+
maxStart?: (date?: Date) => Date,
|
|
414
|
+
/**
|
|
415
|
+
* A function to get the minimum value of the end date.
|
|
416
|
+
*/
|
|
417
|
+
minEnd?: (date?: Date) => Date,
|
|
418
|
+
/**
|
|
419
|
+
* A function to get the maximum value of the end date.
|
|
420
|
+
*/
|
|
421
|
+
maxEnd?: (date?: Date) => Date,
|
|
422
|
+
/**
|
|
423
|
+
* A filter function to do more specific filtering on the disallowed end date values. This could be the removal of e.g. All weekends.
|
|
424
|
+
*/
|
|
425
|
+
filter?: DateFilterFn<Date>,
|
|
426
|
+
/**
|
|
427
|
+
* The placeholder for the start date of the date range picker.
|
|
428
|
+
*
|
|
429
|
+
* @default "Start"
|
|
430
|
+
*/
|
|
431
|
+
placeholderStart?: string,
|
|
432
|
+
/**
|
|
433
|
+
* The placeholder for the end date of the date range picker.
|
|
434
|
+
*
|
|
435
|
+
* @default "End"
|
|
436
|
+
*/
|
|
437
|
+
placeholderEnd?: string
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## @date datetime
|
|
442
|
+
Displays the date as a datetime input.
|
|
443
|
+
|
|
444
|
+
```typescript
|
|
445
|
+
export interface DateTimeDateDecoratorConfig extends DateDecoratorConfig {
|
|
446
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
447
|
+
displayStyle: 'datetime',
|
|
448
|
+
/**
|
|
449
|
+
* The selectable times.
|
|
450
|
+
*/
|
|
451
|
+
times?: DropdownValue<Time>[],
|
|
452
|
+
/**
|
|
453
|
+
* The name to use as a label for the time form field.
|
|
454
|
+
*
|
|
455
|
+
* @default 'Time'
|
|
456
|
+
*/
|
|
457
|
+
timeDisplayName?: string,
|
|
458
|
+
/**
|
|
459
|
+
* A function to get the minimum value of the date.
|
|
460
|
+
*/
|
|
461
|
+
minDate?: (date?: Date) => Date,
|
|
462
|
+
/**
|
|
463
|
+
* A function to get the maximum value of the date.
|
|
464
|
+
*/
|
|
465
|
+
maxDate?: (date?: Date) => Date,
|
|
466
|
+
/**
|
|
467
|
+
* A filter function to do more specific date filtering. This could be the removal of e.g. All weekends.
|
|
468
|
+
*/
|
|
469
|
+
filterDate?: DateFilterFn<Date | null | undefined>,
|
|
470
|
+
/**
|
|
471
|
+
* A function to get the minimum value of the time.
|
|
472
|
+
*/
|
|
473
|
+
minTime?: (date?: Date) => Time,
|
|
474
|
+
/**
|
|
475
|
+
* A function to get the maximum value of the time.
|
|
476
|
+
*/
|
|
477
|
+
maxTime?: (date?: Date) => Time,
|
|
478
|
+
/**
|
|
479
|
+
* A filter function to do more specific time filtering. This could be e.g. The removal of lunch breaks.
|
|
480
|
+
*/
|
|
481
|
+
filterTime?: ((time: Time) => boolean) | (() => boolean)
|
|
482
|
+
}
|
|
323
483
|
```
|
|
324
484
|
|
|
325
485
|
## @object default
|
|
326
486
|
Displays an entity object inline.
|
|
327
487
|
|
|
328
488
|
```typescript
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
489
|
+
export interface DefaultObjectDecoratorConfig<EntityType extends object> extends ObjectDecoratorConfig<EntityType> {
|
|
490
|
+
/**
|
|
491
|
+
* The class of the object. Is used to call the constructor so that all metadata is initialized.
|
|
492
|
+
*/
|
|
493
|
+
EntityClass!: EntityClassNewable<EntityType>;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* How to display the object.
|
|
497
|
+
*
|
|
498
|
+
* The objects properties are added as input fields in an section of the entity.
|
|
499
|
+
* Useful if the object only contains a few properties (e.g. A address on a user).
|
|
500
|
+
*/
|
|
501
|
+
displayStyle!: 'inline';
|
|
502
|
+
}
|
|
334
503
|
```
|
|
335
504
|
|
|
336
505
|
## @array
|
|
337
506
|
```typescript
|
|
338
507
|
/**
|
|
339
|
-
*
|
|
508
|
+
* Interface definition for the @array metadata.
|
|
340
509
|
*/
|
|
341
510
|
abstract class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
342
511
|
/**
|
|
343
|
-
* How to display the
|
|
512
|
+
* How to display the string.
|
|
344
513
|
*/
|
|
345
514
|
displayStyle!: 'table' | 'chips';
|
|
346
515
|
|
|
347
516
|
/**
|
|
348
|
-
* The type of the items inside the array
|
|
517
|
+
* The type of the items inside the array.
|
|
349
518
|
*/
|
|
350
519
|
itemType!: DecoratorTypes;
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* The error-message to display when the array is required but contains no values
|
|
354
|
-
*/
|
|
355
|
-
missingErrorMessage?: string;
|
|
356
520
|
}
|
|
357
521
|
```
|
|
358
522
|
## @array entity
|
|
359
523
|
```typescript
|
|
360
524
|
/**
|
|
361
|
-
* Definition for an array of Entities
|
|
525
|
+
* Definition for an array of Entities.
|
|
362
526
|
*/
|
|
363
|
-
export
|
|
364
|
-
|
|
365
|
-
|
|
527
|
+
export interface EntityArrayDecoratorConfig<EntityType extends object> extends ArrayDecoratorConfig {
|
|
528
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
529
|
+
itemType: DecoratorTypes.OBJECT,
|
|
530
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
531
|
+
displayStyle: 'table',
|
|
366
532
|
|
|
367
533
|
/**
|
|
368
|
-
* The EntityClass used for generating the create inputs
|
|
534
|
+
* The EntityClass used for generating the create inputs.
|
|
369
535
|
*/
|
|
370
|
-
EntityClass
|
|
536
|
+
EntityClass: EntityClassNewable<EntityType>,
|
|
371
537
|
|
|
372
538
|
/**
|
|
373
539
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
374
|
-
* and the value, which is a function that generates the value to display inside a column
|
|
540
|
+
* and the value, which is a function that generates the value to display inside a column.
|
|
375
541
|
*/
|
|
376
|
-
displayColumns: ArrayTableDisplayColumn<EntityType>[]
|
|
542
|
+
displayColumns: ArrayTableDisplayColumn<EntityType>[],
|
|
377
543
|
|
|
378
544
|
/**
|
|
379
545
|
* The data for the add-item-dialog.
|
|
380
546
|
* Can be omitted when adding items inline.
|
|
381
547
|
*/
|
|
382
|
-
createDialogData?: CreateDialogData
|
|
548
|
+
createDialogData?: CreateDialogData,
|
|
383
549
|
|
|
384
550
|
/**
|
|
385
551
|
* Whether or not the form for adding items to the array
|
|
386
552
|
* should be displayed inline.
|
|
553
|
+
*
|
|
387
554
|
* @default true
|
|
388
555
|
*/
|
|
389
|
-
createInline?: boolean
|
|
556
|
+
createInline?: boolean,
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* The label for the add button when createInline is true.
|
|
560
|
+
*
|
|
561
|
+
* @default 'Add'
|
|
562
|
+
*/
|
|
563
|
+
addButtonLabel?: string,
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* The label for the remove button when createInline is true.
|
|
567
|
+
*
|
|
568
|
+
* @default 'Remove'
|
|
569
|
+
*/
|
|
570
|
+
removeButtonLabel?: string,
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* The error-message to display when the array is required but contains no values.
|
|
574
|
+
*/
|
|
575
|
+
missingErrorMessage?: string
|
|
390
576
|
}
|
|
391
577
|
```
|
|
392
578
|
|
|
393
579
|
## @array string chips
|
|
394
580
|
```typescript
|
|
395
581
|
/**
|
|
396
|
-
* Definition for an array of strings displayed as a chips list
|
|
582
|
+
* Definition for an array of strings displayed as a chips list.
|
|
397
583
|
*/
|
|
398
|
-
export
|
|
399
|
-
|
|
400
|
-
|
|
584
|
+
export interface StringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
585
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
586
|
+
itemType: DecoratorTypes.STRING,
|
|
587
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
588
|
+
displayStyle: 'chips',
|
|
401
589
|
|
|
402
590
|
/**
|
|
403
|
-
* The
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* You can however work around this by using `<span class="material-icons"></span>`
|
|
407
|
-
* @default <mat-icon>cancel</mat-icon>
|
|
591
|
+
* The class for the <i> tag used to remove an entry from the array.
|
|
592
|
+
*
|
|
593
|
+
* @default 'fas fa-circle-minus'
|
|
408
594
|
*/
|
|
409
|
-
|
|
595
|
+
deleteIcon?: string,
|
|
410
596
|
/**
|
|
411
|
-
*
|
|
597
|
+
* The minimum required length of the string.
|
|
412
598
|
*/
|
|
413
|
-
minLength?: number
|
|
599
|
+
minLength?: number,
|
|
414
600
|
/**
|
|
415
|
-
*
|
|
601
|
+
* The maximum required length of the string.
|
|
416
602
|
*/
|
|
417
|
-
maxLength?: number
|
|
603
|
+
maxLength?: number,
|
|
418
604
|
/**
|
|
419
|
-
*
|
|
605
|
+
* A regex used for validation.
|
|
420
606
|
*/
|
|
421
|
-
regex?: RegExp
|
|
607
|
+
regex?: RegExp
|
|
422
608
|
}
|
|
423
609
|
```
|
|
424
610
|
|
|
425
611
|
## @array string chips autocomplete
|
|
426
612
|
```typescript
|
|
427
613
|
/**
|
|
428
|
-
* Definition for an array of autocomplete strings displayed as a chips list
|
|
614
|
+
* Definition for an array of autocomplete strings displayed as a chips list.
|
|
429
615
|
*/
|
|
430
|
-
export
|
|
431
|
-
|
|
432
|
-
|
|
616
|
+
export interface AutocompleteStringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
617
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
618
|
+
itemType: DecoratorTypes.STRING_AUTOCOMPLETE,
|
|
619
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
620
|
+
displayStyle: 'chips',
|
|
433
621
|
|
|
434
622
|
/**
|
|
435
|
-
* The
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
* You can however work around this by using `<span class="material-icons"></span>`
|
|
439
|
-
* @default <mat-icon>cancel</mat-icon>
|
|
623
|
+
* The class for the <i> tag used to remove an entry from the array.
|
|
624
|
+
*
|
|
625
|
+
* @default 'fas fa-circle-minus'
|
|
440
626
|
*/
|
|
441
|
-
|
|
627
|
+
deleteIcon?: string,
|
|
442
628
|
/**
|
|
443
|
-
* The autocomplete values
|
|
629
|
+
* The autocomplete values.
|
|
444
630
|
*/
|
|
445
|
-
autocompleteValues: string[]
|
|
631
|
+
autocompleteValues: string[],
|
|
446
632
|
/**
|
|
447
|
-
*
|
|
633
|
+
* The minimum required length of the string.
|
|
448
634
|
*/
|
|
449
|
-
minLength?: number
|
|
635
|
+
minLength?: number,
|
|
450
636
|
/**
|
|
451
|
-
*
|
|
637
|
+
* The maximum required length of the string.
|
|
452
638
|
*/
|
|
453
|
-
maxLength?: number
|
|
639
|
+
maxLength?: number,
|
|
454
640
|
/**
|
|
455
|
-
*
|
|
641
|
+
* A regex used for validation.
|
|
456
642
|
*/
|
|
457
|
-
regex?: RegExp
|
|
643
|
+
regex?: RegExp
|
|
458
644
|
}
|
|
459
645
|
```
|
|
460
646
|
|
|
@@ -465,14 +651,14 @@ Configuration options are:
|
|
|
465
651
|
|
|
466
652
|
```typescript
|
|
467
653
|
/**
|
|
468
|
-
* The entity on which the property exists. Used in
|
|
654
|
+
* The entity on which the property exists. Used in conjunction with the "propertyKey"
|
|
469
655
|
* to determine the property for which the input should be generated.
|
|
470
656
|
*/
|
|
471
657
|
@Input()
|
|
472
658
|
entity!: EntityType;
|
|
473
659
|
|
|
474
660
|
/**
|
|
475
|
-
* The name of the property to generate the input for. Used in
|
|
661
|
+
* The name of the property to generate the input for. Used in conjunction with the "entity".
|
|
476
662
|
*/
|
|
477
663
|
@Input()
|
|
478
664
|
propertyKey!: keyof EntityType;
|
|
@@ -505,168 +691,178 @@ As this component is highly configurable and allows you to either create your ow
|
|
|
505
691
|
|
|
506
692
|
```typescript
|
|
507
693
|
/**
|
|
508
|
-
* The
|
|
509
|
-
*/
|
|
510
|
-
@Input()
|
|
511
|
-
title!: string;
|
|
512
|
-
/**
|
|
513
|
-
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
514
|
-
* and the value, which is a function that generates the value to display inside a column
|
|
515
|
-
*/
|
|
516
|
-
@Input()
|
|
517
|
-
displayColumns!: DisplayColumn<EntityType>[];
|
|
518
|
-
/**
|
|
519
|
-
* The label on the search bar. Defaults to "Search".
|
|
694
|
+
* The base data of the ngx-mat-entity-table.
|
|
520
695
|
*/
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
696
|
+
export interface BaseData<EntityType extends object> {
|
|
697
|
+
/**
|
|
698
|
+
* The title of the table.
|
|
699
|
+
*/
|
|
700
|
+
title: string,
|
|
701
|
+
/**
|
|
702
|
+
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
703
|
+
* and the value, which is a function that generates the value to display inside a column.
|
|
704
|
+
*/
|
|
705
|
+
displayColumns: DisplayColumn<EntityType>[],
|
|
706
|
+
/**
|
|
707
|
+
* The Class of the service that handles the entities.
|
|
708
|
+
* Needs to be injectable and an extension of the "EntityService"-Class.
|
|
709
|
+
*/
|
|
710
|
+
EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>,
|
|
711
|
+
/**
|
|
712
|
+
* The Class of the entities to manage.
|
|
713
|
+
*/
|
|
714
|
+
EntityClass?: EntityClassNewable<EntityType>,
|
|
715
|
+
/**
|
|
716
|
+
* The label on the search bar. Defaults to "Search".
|
|
717
|
+
*/
|
|
718
|
+
searchLabel?: string,
|
|
719
|
+
/**
|
|
720
|
+
* The label on the button for adding new entities. Defaults to "Create".
|
|
721
|
+
*/
|
|
722
|
+
createButtonLabel?: string,
|
|
723
|
+
/**
|
|
724
|
+
* Takes a custom edit method which runs when you click on a entity.
|
|
725
|
+
* If you don't need any special editing of entries you can also omit this.
|
|
726
|
+
* In that case a default edit dialog is generated.
|
|
727
|
+
*/
|
|
728
|
+
edit?: (entity: EntityType) => unknown,
|
|
729
|
+
/**
|
|
730
|
+
* Takes a method to run when you click on the new button.
|
|
731
|
+
* If you don't need anything special you can also omit this.
|
|
732
|
+
* In that case a default create dialog is generated.
|
|
733
|
+
*/
|
|
734
|
+
create?: (entity: EntityType) => unknown,
|
|
735
|
+
/**
|
|
736
|
+
* Defines how the search string of entities is generated.
|
|
737
|
+
*/
|
|
738
|
+
searchString?: (entity: EntityType) => string,
|
|
739
|
+
/**
|
|
740
|
+
* Defines whether or not the user can add new entities.
|
|
741
|
+
*
|
|
742
|
+
* @default true
|
|
743
|
+
*/
|
|
744
|
+
allowCreate?: boolean,
|
|
745
|
+
/**
|
|
746
|
+
* Defines whether or not the user can edit entities.
|
|
747
|
+
*
|
|
748
|
+
* @default () => true
|
|
749
|
+
*/
|
|
750
|
+
allowEdit?: (entity: EntityType) => boolean,
|
|
751
|
+
/**
|
|
752
|
+
* Whether or not the user can delete this specific entity.
|
|
753
|
+
*/
|
|
754
|
+
allowDelete?: (entity: EntityType) => boolean,
|
|
755
|
+
/**
|
|
756
|
+
* All Actions that you want to run on multiple entities can be defined here.
|
|
757
|
+
* (e.g. Download as zip-file or mass delete).
|
|
758
|
+
*/
|
|
759
|
+
multiSelectActions?: MultiSelectAction<EntityType>[],
|
|
760
|
+
/**
|
|
761
|
+
* The Label for the button that opens all multi-actions.
|
|
762
|
+
*/
|
|
763
|
+
multiSelectLabel?: string
|
|
764
|
+
}
|
|
586
765
|
|
|
587
766
|
/**
|
|
588
|
-
* The
|
|
767
|
+
* The data of the default create-dialog.
|
|
589
768
|
*/
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
769
|
+
export interface CreateDialogData {
|
|
770
|
+
/**
|
|
771
|
+
* The title of the default create-dialog.
|
|
772
|
+
*/
|
|
773
|
+
title?: string,
|
|
774
|
+
/**
|
|
775
|
+
* The label on the create-button of the default create-dialog. Defaults to "Create".
|
|
776
|
+
*/
|
|
777
|
+
createButtonLabel?: string,
|
|
778
|
+
/**
|
|
779
|
+
* The label on the cancel-button for the default create-dialog. Defaults to "Cancel".
|
|
780
|
+
*/
|
|
781
|
+
cancelButtonLabel?: string,
|
|
782
|
+
/**
|
|
783
|
+
* Whether or not the creation of an entry should require a confirm dialog.
|
|
784
|
+
*/
|
|
785
|
+
createRequiresConfirmDialog?: boolean,
|
|
786
|
+
/**
|
|
787
|
+
* The data used to generate a confirmation dialog for the create action.
|
|
788
|
+
*/
|
|
789
|
+
confirmCreateDialogData?: ConfirmDialogData
|
|
790
|
+
}
|
|
791
|
+
|
|
597
792
|
/**
|
|
598
|
-
* The
|
|
793
|
+
* The data of the default edit-dialog.
|
|
599
794
|
*/
|
|
600
|
-
|
|
601
|
-
|
|
795
|
+
export interface EditDialogData<EntityType extends object> {
|
|
796
|
+
/**
|
|
797
|
+
* The title of the default edit-dialog.
|
|
798
|
+
*/
|
|
799
|
+
title?: (entity: EntityType) => string,
|
|
800
|
+
/**
|
|
801
|
+
* The label on the confirm-button of the default edit-dialog. Defaults to "Save".
|
|
802
|
+
*/
|
|
803
|
+
confirmButtonLabel?: string,
|
|
804
|
+
/**
|
|
805
|
+
* The label on the delete-button of the default edit-dialog. Defaults to "Delete".
|
|
806
|
+
*/
|
|
807
|
+
deleteButtonLabel?: string,
|
|
808
|
+
/**
|
|
809
|
+
* The label on the cancel-button for the default edit-dialog. Defaults to "Cancel".
|
|
810
|
+
*/
|
|
811
|
+
cancelButtonLabel?: string,
|
|
812
|
+
/**
|
|
813
|
+
* Whether or not the deletion of an entry should require a confirm dialog.
|
|
814
|
+
*/
|
|
815
|
+
deleteRequiresConfirmDialog?: boolean,
|
|
816
|
+
/**
|
|
817
|
+
* Whether or not the editing of an entry should require a confirm dialog.
|
|
818
|
+
*/
|
|
819
|
+
editRequiresConfirmDialog?: boolean,
|
|
602
820
|
|
|
821
|
+
/**
|
|
822
|
+
* The data used to generate a confirmation dialog for the delete action.
|
|
823
|
+
*/
|
|
824
|
+
confirmDeleteDialogData?: ConfirmDialogData,
|
|
603
825
|
|
|
826
|
+
/**
|
|
827
|
+
* The data used to generate a confirmation dialog for the delete action.
|
|
828
|
+
*/
|
|
829
|
+
confirmEditDialogData?: ConfirmDialogData
|
|
830
|
+
}
|
|
604
831
|
|
|
605
832
|
/**
|
|
606
|
-
*
|
|
833
|
+
* All the configuration data required to display a ngx-mat-entity-table.
|
|
607
834
|
*/
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* The text inside the confirm delete dialog.
|
|
627
|
-
* Each string inside the array is a paragraph.
|
|
628
|
-
*/
|
|
629
|
-
@Input()
|
|
630
|
-
confirmDeleteText?: string[];
|
|
631
|
-
/**
|
|
632
|
-
* The label on the button that confirms the deletion of an entity.
|
|
633
|
-
*/
|
|
634
|
-
@Input()
|
|
635
|
-
confirmDeleteButtonLabel?: string;
|
|
636
|
-
/**
|
|
637
|
-
* The label on the button that cancels the deletion of an entity.
|
|
638
|
-
*/
|
|
639
|
-
@Input()
|
|
640
|
-
cancelDeleteButtonLabel?: string;
|
|
641
|
-
/**
|
|
642
|
-
* The title of the dialog where you have to either confirm or cancel the deletion of an entity.
|
|
643
|
-
*/
|
|
644
|
-
@Input()
|
|
645
|
-
confirmDeleteDialogTitle?: string;
|
|
646
|
-
/**
|
|
647
|
-
* Whether or not a checkbox needs to be checked before being able to click on the confirm-delete-button
|
|
648
|
-
*/
|
|
649
|
-
@Input()
|
|
650
|
-
confirmDeleteRequireConfirmation?: boolean;
|
|
651
|
-
/**
|
|
652
|
-
* The text next to the checkbox
|
|
653
|
-
*/
|
|
654
|
-
@Input()
|
|
655
|
-
confirmDeleteConfirmationText?: string
|
|
835
|
+
export interface TableData<EntityType extends object> {
|
|
836
|
+
/**
|
|
837
|
+
* The base data for the table-component.
|
|
838
|
+
* Includes stuff like the title for the table, what to display inside the rows etc.
|
|
839
|
+
*/
|
|
840
|
+
baseData: BaseData<EntityType>,
|
|
841
|
+
/**
|
|
842
|
+
* The data for the default create-dialog.
|
|
843
|
+
* Can be omitted when specifying a custom "create" method inside the baseData.
|
|
844
|
+
*/
|
|
845
|
+
createDialogData?: CreateDialogData,
|
|
846
|
+
/**
|
|
847
|
+
* The data for the default edit-dialog.
|
|
848
|
+
* Can be omitted when specifying a custom "edit" method inside the baseData.
|
|
849
|
+
*/
|
|
850
|
+
editDialogData?: EditDialogData<EntityType>
|
|
851
|
+
}
|
|
656
852
|
```
|
|
657
853
|
|
|
658
854
|
## Display Columns
|
|
659
855
|
The definition of a column inside the table.
|
|
660
856
|
```typescript
|
|
661
|
-
export interface DisplayColumn<EntityType extends
|
|
857
|
+
export interface DisplayColumn<EntityType extends object> {
|
|
662
858
|
/**
|
|
663
859
|
* The name inside the header.
|
|
664
860
|
*/
|
|
665
|
-
displayName: string
|
|
861
|
+
displayName: string,
|
|
666
862
|
/**
|
|
667
|
-
* A method to get the value inside an
|
|
863
|
+
* A method to get the value inside an row.
|
|
668
864
|
*/
|
|
669
|
-
value: (entity: EntityType) => string
|
|
865
|
+
value: (entity: EntityType) => string
|
|
670
866
|
}
|
|
671
867
|
```
|
|
672
868
|
|
|
@@ -674,19 +870,30 @@ export interface DisplayColumn<EntityType extends Entity> {
|
|
|
674
870
|
Multiselect Actions appear on the right upper corner and allow you to do actions on all selected entries.
|
|
675
871
|
|
|
676
872
|
```typescript
|
|
677
|
-
export interface MultiSelectAction<EntityType extends
|
|
873
|
+
export interface MultiSelectAction<EntityType extends object> {
|
|
678
874
|
/**
|
|
679
|
-
* The name of the action
|
|
875
|
+
* The name of the action.
|
|
680
876
|
*/
|
|
681
|
-
displayName: string
|
|
877
|
+
displayName: string,
|
|
682
878
|
/**
|
|
683
|
-
* The action itself
|
|
879
|
+
* The action itself.
|
|
684
880
|
*/
|
|
685
|
-
action: (
|
|
881
|
+
action: (selectedEntities: EntityType[]) => unknown,
|
|
686
882
|
/**
|
|
687
883
|
* A method that defines whether or not the action can be used.
|
|
688
|
-
*
|
|
884
|
+
*
|
|
885
|
+
* @default true
|
|
886
|
+
*/
|
|
887
|
+
enabled?: (selectedEntities: EntityType[]) => boolean,
|
|
888
|
+
/**
|
|
889
|
+
* A method that defines whether or not a confirm dialog is needed to run the action.
|
|
890
|
+
*
|
|
891
|
+
* @default false
|
|
892
|
+
*/
|
|
893
|
+
requireConfirmDialog?: (selectedEntities: EntityType[]) => boolean,
|
|
894
|
+
/**
|
|
895
|
+
* The data used to generate a confirmation dialog for the multiSelect action.
|
|
689
896
|
*/
|
|
690
|
-
|
|
897
|
+
confirmDialogData?: ConfirmDialogData
|
|
691
898
|
}
|
|
692
899
|
```
|