ngx-material-entity 0.1.1 → 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/CONTRIBUTING.md +7 -1
- package/README.md +536 -328
- package/classes/base.builder.d.ts +35 -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} +35 -20
- package/classes/entity.utilities.d.ts +153 -0
- package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +23 -0
- package/components/confirm-dialog/confirm-dialog-data.d.ts +18 -8
- package/components/confirm-dialog/confirm-dialog.component.d.ts +15 -5
- package/components/get-validation-error-message.function.d.ts +3 -2
- package/components/input/add-array-item-dialog-data.builder.d.ts +20 -0
- package/components/input/add-array-item-dialog-data.d.ts +19 -0
- package/components/input/input.component.d.ts +151 -30
- package/components/input/input.module.d.ts +7 -4
- package/components/table/create-dialog/create-dialog-data.builder.d.ts +21 -0
- package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +21 -0
- package/components/table/create-dialog/create-entity-dialog-data.d.ts +4 -5
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +21 -8
- package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +24 -0
- package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +7 -8
- package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +22 -0
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +25 -8
- package/components/table/table-data.builder.d.ts +51 -0
- package/components/table/table-data.d.ts +46 -30
- package/components/table/table.component.d.ts +53 -7
- package/components/table/table.module.d.ts +3 -1
- package/decorators/array/array-decorator-internal.data.d.ts +45 -0
- package/decorators/array/array-decorator.data.d.ts +129 -0
- package/decorators/array/array.decorator.d.ts +9 -0
- package/decorators/base/base-property.decorator.d.ts +7 -6
- package/decorators/base/decorator-types.enum.d.ts +12 -9
- package/decorators/base/dropdown-value.interface.d.ts +14 -0
- package/decorators/base/property-decorator-internal.data.d.ts +24 -0
- package/decorators/base/property-decorator.data.d.ts +70 -0
- package/decorators/boolean/boolean-decorator-internal.data.d.ts +25 -0
- package/decorators/boolean/boolean-decorator.data.d.ts +37 -0
- package/decorators/boolean/boolean.decorator.d.ts +8 -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 +20 -0
- package/decorators/number/number-decorator.data.d.ts +36 -0
- package/decorators/number/number.decorator.d.ts +8 -0
- package/decorators/object/object-decorator-internal.data.d.ts +11 -0
- package/decorators/object/object-decorator.data.d.ts +25 -0
- package/decorators/object/object.decorator.d.ts +8 -0
- package/decorators/string/string-decorator-internal.data.d.ts +41 -0
- package/decorators/string/string-decorator.data.d.ts +77 -0
- package/decorators/string/string.decorator.d.ts +8 -0
- 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 +44 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +1 -1
- package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +18 -22
- package/esm2020/components/get-validation-error-message.function.mjs +8 -3
- package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +30 -0
- package/esm2020/components/input/add-array-item-dialog-data.mjs +2 -0
- package/esm2020/components/input/input.component.mjs +240 -36
- package/esm2020/components/input/input.module.mjs +23 -9
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +32 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +26 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +31 -31
- package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +20 -4
- package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +41 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +27 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +45 -49
- package/esm2020/components/table/table-data.builder.mjs +105 -0
- package/esm2020/components/table/table-data.mjs +1 -1
- package/esm2020/components/table/table.component.mjs +91 -83
- package/esm2020/components/table/table.module.mjs +12 -4
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +51 -0
- package/esm2020/decorators/array/array-decorator.data.mjs +7 -0
- package/esm2020/decorators/array/array.decorator.mjs +24 -0
- package/esm2020/decorators/base/base-property.decorator.mjs +6 -5
- package/esm2020/decorators/base/decorator-types.enum.mjs +4 -1
- package/esm2020/decorators/base/dropdown-value.interface.mjs +2 -0
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +38 -0
- package/esm2020/decorators/base/property-decorator.data.mjs +6 -0
- package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +33 -0
- package/esm2020/decorators/boolean/boolean-decorator.data.mjs +7 -0
- package/esm2020/decorators/boolean/boolean.decorator.mjs +21 -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 +23 -0
- package/esm2020/decorators/number/number-decorator.data.mjs +7 -0
- package/esm2020/decorators/number/number.decorator.mjs +18 -0
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +12 -0
- package/esm2020/decorators/object/object-decorator.data.mjs +7 -0
- package/esm2020/decorators/object/object.decorator.mjs +13 -0
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +48 -0
- package/esm2020/decorators/string/string-decorator.data.mjs +7 -0
- package/esm2020/decorators/string/string.decorator.mjs +24 -0
- package/esm2020/public-api.mjs +20 -13
- package/fesm2015/ngx-material-entity.mjs +1664 -944
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +1667 -941
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +7 -1
- package/public-api.d.ts +21 -10
- package/classes/entity-model.class.d.ts +0 -9
- package/classes/entity-utilities.class.d.ts +0 -95
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +0 -35
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.d.ts +0 -12
- package/components/input/array-table/array-table.component.d.ts +0 -34
- package/components/input/array-table/array-table.module.d.ts +0 -19
- package/components/input/internal-input/internal-input.component.d.ts +0 -57
- package/components/input/internal-input/internal-input.module.d.ts +0 -16
- package/decorators/array.decorator.d.ts +0 -125
- package/decorators/base/property-decorator-config.interface.d.ts +0 -50
- package/decorators/boolean.decorator.d.ts +0 -42
- package/decorators/number.decorator.d.ts +0 -40
- package/decorators/object.decorator.d.ts +0 -27
- package/decorators/string.decorator.d.ts +0 -76
- package/esm2020/classes/entity-model.class.mjs +0 -19
- package/esm2020/classes/entity-service.class.mjs +0 -70
- package/esm2020/classes/entity-utilities.class.mjs +0 -296
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +0 -43
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.mjs +0 -22
- package/esm2020/components/input/array-table/array-table.component.mjs +0 -116
- package/esm2020/components/input/array-table/array-table.module.mjs +0 -66
- package/esm2020/components/input/internal-input/internal-input.component.mjs +0 -73
- package/esm2020/components/input/internal-input/internal-input.module.mjs +0 -54
- package/esm2020/decorators/array.decorator.mjs +0 -70
- package/esm2020/decorators/base/property-decorator-config.interface.mjs +0 -31
- package/esm2020/decorators/boolean.decorator.mjs +0 -44
- package/esm2020/decorators/number.decorator.mjs +0 -36
- package/esm2020/decorators/object.decorator.mjs +0 -23
- package/esm2020/decorators/string.decorator.mjs +0 -61
package/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# NgxMaterialEntity
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.
|
|
5
7
|
|
|
6
8
|
[](https://github.com/tim-fabian/ngx-material-entity/actions/workflows/main.yml)
|
|
9
|
+
[](https://badge.fury.io/js/ngx-material-entity)
|
|
10
|
+
[](https://snyk.io/test/npm/ngx-material-entity)
|
|
11
|
+
[](https://codecov.io/gh/tim-fabian/ngx-material-entity)
|
|
7
12
|
|
|
8
13
|
# Table of Contents
|
|
9
14
|
- [NgxMaterialEntity](#ngxmaterialentity)
|
|
@@ -26,6 +31,9 @@ Can even generate complete and highly customizable CRUD-Tables for them.
|
|
|
26
31
|
- [@boolean toggle](#boolean-toggle)
|
|
27
32
|
- [@boolean checkbox](#boolean-checkbox)
|
|
28
33
|
- [@boolean dropdown](#boolean-dropdown)
|
|
34
|
+
- [@date default](#date-default)
|
|
35
|
+
- [@date dateRange](#date-daterange)
|
|
36
|
+
- [@date datetime](#date-datetime)
|
|
29
37
|
- [@object default](#object-default)
|
|
30
38
|
- [@array](#array)
|
|
31
39
|
- [@array entity](#array-entity)
|
|
@@ -52,6 +60,8 @@ Create your entity and define Metadata directly on the properties:
|
|
|
52
60
|
```typescript
|
|
53
61
|
import { Entity, EntityUtilities, string } from 'ngx-material-entity';
|
|
54
62
|
|
|
63
|
+
// The "extends Entity" can be left out.
|
|
64
|
+
// The abstract Entity-Class provides an id out of the box.
|
|
55
65
|
export class MyEntity extends Entity {
|
|
56
66
|
|
|
57
67
|
/**
|
|
@@ -67,12 +77,14 @@ export class MyEntity extends Entity {
|
|
|
67
77
|
|
|
68
78
|
constructor(entity?: MyEntity) {
|
|
69
79
|
super();
|
|
80
|
+
// this helper-method sets all values from the provided entity.
|
|
81
|
+
// It can be used universally.
|
|
70
82
|
EntityUtilities.new(this, entity);
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
}
|
|
74
86
|
```
|
|
75
|
-
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).
|
|
76
88
|
|
|
77
89
|
## Use the input for your entity property
|
|
78
90
|
You can import the ```NgxMatEntityInputModule``` anywhere in your code:
|
|
@@ -90,19 +102,29 @@ import { NgxMatEntityInputModule } from 'ngx-material-entity';
|
|
|
90
102
|
In the html you can then define:
|
|
91
103
|
|
|
92
104
|
```html
|
|
93
|
-
<ngx-mat-entity-input
|
|
94
|
-
[entity]="myEntity"
|
|
95
|
-
[propertyKey]="myString">
|
|
105
|
+
<ngx-mat-entity-input [entity]="myEntity" [propertyKey]="myString">
|
|
96
106
|
</ngx-mat-entity-input>
|
|
97
107
|
```
|
|
98
108
|
|
|
109
|
+
That's it!
|
|
110
|
+
|
|
99
111
|
This snippet automatically generates an material input for "myString" based on the metadata you defined earlier.
|
|
100
112
|
<br>
|
|
101
|
-
For a list of
|
|
113
|
+
For a list of further configuration options for the input see [PropertyInput Configuration](#propertyinput-configuration).
|
|
102
114
|
|
|
103
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
|
+
|
|
104
126
|
### Create a Service for your entity
|
|
105
|
-
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:
|
|
106
128
|
|
|
107
129
|
```typescript
|
|
108
130
|
// ↓ It's required that the service can be injected
|
|
@@ -111,6 +133,7 @@ In order to use the ngx-material-entites component you have to define a service
|
|
|
111
133
|
})
|
|
112
134
|
export class MyEntityService extends EntityService<MyEntity> {
|
|
113
135
|
baseUrl: string = `${environment.apiUrl}/my-entity`;
|
|
136
|
+
idKey: keyof MyEntity;
|
|
114
137
|
|
|
115
138
|
constructor(private readonly httpClient: HttpClient) {
|
|
116
139
|
super(httpClient);
|
|
@@ -152,44 +175,50 @@ The property decorators contain all the metadata of an entity property.
|
|
|
152
175
|
Contains information that is universally defined on every property.
|
|
153
176
|
|
|
154
177
|
```typescript
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
193
222
|
```
|
|
194
223
|
For more information regarding the defaultWidths see the bootstrap guide about the [Grid system](https://getbootstrap.com/docs/5.0/layout/grid/).
|
|
195
224
|
|
|
@@ -197,262 +226,421 @@ For more information regarding the defaultWidths see the bootstrap guide about t
|
|
|
197
226
|
The "default" display of a string value. Inside a single line mat-input.
|
|
198
227
|
|
|
199
228
|
```typescript
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
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
|
+
}
|
|
213
245
|
```
|
|
214
246
|
|
|
215
247
|
## @string dropdown
|
|
216
248
|
Displays a string as a dropdown where the user can input one of the defined dropdownValues.
|
|
217
249
|
|
|
218
250
|
```typescript
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
+
}
|
|
225
261
|
```
|
|
226
262
|
|
|
227
263
|
## @string textbox
|
|
228
264
|
Displays a string as a textbox.
|
|
229
265
|
|
|
230
266
|
```typescript
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
+
}
|
|
240
279
|
```
|
|
241
280
|
|
|
242
281
|
## @string autocomplete
|
|
243
282
|
Just like the default @string, but the user has additional autocomplete values to quickly input data.
|
|
244
283
|
|
|
245
284
|
```typescript
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
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
|
+
}
|
|
263
305
|
```
|
|
264
306
|
|
|
265
307
|
## @number default
|
|
266
308
|
The "default" display of a number value. Inside a single line mat-input.
|
|
267
309
|
|
|
268
310
|
```typescript
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
+
}
|
|
278
323
|
```
|
|
279
324
|
|
|
280
325
|
## @number dropdown
|
|
281
326
|
Displays the numbers in a dropdown
|
|
282
327
|
|
|
283
328
|
```typescript
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
+
}
|
|
290
338
|
```
|
|
291
339
|
|
|
292
340
|
## @boolean toggle
|
|
293
341
|
Displays the boolean value as a MatSlideToggle
|
|
294
342
|
|
|
295
343
|
```typescript
|
|
296
|
-
|
|
344
|
+
export interface ToggleBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
345
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
346
|
+
displayStyle: 'toggle'
|
|
347
|
+
}
|
|
297
348
|
```
|
|
298
349
|
|
|
299
350
|
## @boolean checkbox
|
|
300
351
|
Displays the boolean value as a MatCheckbox
|
|
301
352
|
|
|
302
353
|
```typescript
|
|
303
|
-
|
|
354
|
+
export interface CheckboxBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
355
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
356
|
+
displayStyle: 'checkbox'
|
|
357
|
+
}
|
|
304
358
|
```
|
|
305
359
|
|
|
306
360
|
## @boolean dropdown
|
|
307
361
|
Displays the boolean value as a MatCheckbox
|
|
308
362
|
|
|
309
363
|
```typescript
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
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
|
+
}
|
|
321
483
|
```
|
|
322
484
|
|
|
323
485
|
## @object default
|
|
324
486
|
Displays an entity object inline.
|
|
325
487
|
|
|
326
488
|
```typescript
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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
|
+
}
|
|
332
503
|
```
|
|
333
504
|
|
|
334
505
|
## @array
|
|
335
506
|
```typescript
|
|
336
507
|
/**
|
|
337
|
-
*
|
|
508
|
+
* Interface definition for the @array metadata.
|
|
338
509
|
*/
|
|
339
510
|
abstract class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
340
511
|
/**
|
|
341
|
-
* How to display the
|
|
512
|
+
* How to display the string.
|
|
342
513
|
*/
|
|
343
514
|
displayStyle!: 'table' | 'chips';
|
|
344
515
|
|
|
345
516
|
/**
|
|
346
|
-
* The type of the items inside the array
|
|
517
|
+
* The type of the items inside the array.
|
|
347
518
|
*/
|
|
348
519
|
itemType!: DecoratorTypes;
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* The error-message to display when the array is required but contains no values
|
|
352
|
-
*/
|
|
353
|
-
missingErrorMessage?: string;
|
|
354
520
|
}
|
|
355
521
|
```
|
|
356
522
|
## @array entity
|
|
357
523
|
```typescript
|
|
358
524
|
/**
|
|
359
|
-
* Definition for an array of Entities
|
|
525
|
+
* Definition for an array of Entities.
|
|
360
526
|
*/
|
|
361
|
-
export
|
|
362
|
-
|
|
363
|
-
|
|
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',
|
|
364
532
|
|
|
365
533
|
/**
|
|
366
|
-
* The EntityClass used for generating the create inputs
|
|
534
|
+
* The EntityClass used for generating the create inputs.
|
|
367
535
|
*/
|
|
368
|
-
EntityClass
|
|
536
|
+
EntityClass: EntityClassNewable<EntityType>,
|
|
369
537
|
|
|
370
538
|
/**
|
|
371
539
|
* 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
|
|
540
|
+
* and the value, which is a function that generates the value to display inside a column.
|
|
373
541
|
*/
|
|
374
|
-
displayColumns: ArrayTableDisplayColumn<EntityType>[]
|
|
542
|
+
displayColumns: ArrayTableDisplayColumn<EntityType>[],
|
|
375
543
|
|
|
376
544
|
/**
|
|
377
545
|
* The data for the add-item-dialog.
|
|
378
546
|
* Can be omitted when adding items inline.
|
|
379
547
|
*/
|
|
380
|
-
createDialogData?: CreateDialogData
|
|
548
|
+
createDialogData?: CreateDialogData,
|
|
381
549
|
|
|
382
550
|
/**
|
|
383
551
|
* Whether or not the form for adding items to the array
|
|
384
552
|
* should be displayed inline.
|
|
553
|
+
*
|
|
385
554
|
* @default true
|
|
386
555
|
*/
|
|
387
|
-
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
|
|
388
576
|
}
|
|
389
577
|
```
|
|
390
578
|
|
|
391
579
|
## @array string chips
|
|
392
580
|
```typescript
|
|
393
581
|
/**
|
|
394
|
-
* Definition for an array of strings displayed as a chips list
|
|
582
|
+
* Definition for an array of strings displayed as a chips list.
|
|
395
583
|
*/
|
|
396
|
-
export
|
|
397
|
-
|
|
398
|
-
|
|
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',
|
|
399
589
|
|
|
400
590
|
/**
|
|
401
|
-
* The
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* You can however work around this by using `<span class="material-icons"></span>`
|
|
405
|
-
* @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'
|
|
406
594
|
*/
|
|
407
|
-
|
|
595
|
+
deleteIcon?: string,
|
|
408
596
|
/**
|
|
409
|
-
*
|
|
597
|
+
* The minimum required length of the string.
|
|
410
598
|
*/
|
|
411
|
-
minLength?: number
|
|
599
|
+
minLength?: number,
|
|
412
600
|
/**
|
|
413
|
-
*
|
|
601
|
+
* The maximum required length of the string.
|
|
414
602
|
*/
|
|
415
|
-
maxLength?: number
|
|
603
|
+
maxLength?: number,
|
|
416
604
|
/**
|
|
417
|
-
*
|
|
605
|
+
* A regex used for validation.
|
|
418
606
|
*/
|
|
419
|
-
regex?: RegExp
|
|
607
|
+
regex?: RegExp
|
|
420
608
|
}
|
|
421
609
|
```
|
|
422
610
|
|
|
423
611
|
## @array string chips autocomplete
|
|
424
612
|
```typescript
|
|
425
613
|
/**
|
|
426
|
-
* 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.
|
|
427
615
|
*/
|
|
428
|
-
export
|
|
429
|
-
|
|
430
|
-
|
|
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',
|
|
431
621
|
|
|
432
622
|
/**
|
|
433
|
-
* The
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* You can however work around this by using `<span class="material-icons"></span>`
|
|
437
|
-
* @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'
|
|
438
626
|
*/
|
|
439
|
-
|
|
627
|
+
deleteIcon?: string,
|
|
440
628
|
/**
|
|
441
|
-
* The autocomplete values
|
|
629
|
+
* The autocomplete values.
|
|
442
630
|
*/
|
|
443
|
-
autocompleteValues: string[]
|
|
631
|
+
autocompleteValues: string[],
|
|
444
632
|
/**
|
|
445
|
-
*
|
|
633
|
+
* The minimum required length of the string.
|
|
446
634
|
*/
|
|
447
|
-
minLength?: number
|
|
635
|
+
minLength?: number,
|
|
448
636
|
/**
|
|
449
|
-
*
|
|
637
|
+
* The maximum required length of the string.
|
|
450
638
|
*/
|
|
451
|
-
maxLength?: number
|
|
639
|
+
maxLength?: number,
|
|
452
640
|
/**
|
|
453
|
-
*
|
|
641
|
+
* A regex used for validation.
|
|
454
642
|
*/
|
|
455
|
-
regex?: RegExp
|
|
643
|
+
regex?: RegExp
|
|
456
644
|
}
|
|
457
645
|
```
|
|
458
646
|
|
|
@@ -463,14 +651,14 @@ Configuration options are:
|
|
|
463
651
|
|
|
464
652
|
```typescript
|
|
465
653
|
/**
|
|
466
|
-
* The entity on which the property exists. Used in
|
|
654
|
+
* The entity on which the property exists. Used in conjunction with the "propertyKey"
|
|
467
655
|
* to determine the property for which the input should be generated.
|
|
468
656
|
*/
|
|
469
657
|
@Input()
|
|
470
658
|
entity!: EntityType;
|
|
471
659
|
|
|
472
660
|
/**
|
|
473
|
-
* 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".
|
|
474
662
|
*/
|
|
475
663
|
@Input()
|
|
476
664
|
propertyKey!: keyof EntityType;
|
|
@@ -503,168 +691,178 @@ As this component is highly configurable and allows you to either create your ow
|
|
|
503
691
|
|
|
504
692
|
```typescript
|
|
505
693
|
/**
|
|
506
|
-
* The
|
|
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".
|
|
694
|
+
* The base data of the ngx-mat-entity-table.
|
|
518
695
|
*/
|
|
519
|
-
|
|
520
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
584
765
|
|
|
585
766
|
/**
|
|
586
|
-
* The
|
|
767
|
+
* The data of the default create-dialog.
|
|
587
768
|
*/
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
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
|
+
|
|
595
792
|
/**
|
|
596
|
-
* The
|
|
793
|
+
* The data of the default edit-dialog.
|
|
597
794
|
*/
|
|
598
|
-
|
|
599
|
-
|
|
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,
|
|
600
820
|
|
|
821
|
+
/**
|
|
822
|
+
* The data used to generate a confirmation dialog for the delete action.
|
|
823
|
+
*/
|
|
824
|
+
confirmDeleteDialogData?: ConfirmDialogData,
|
|
601
825
|
|
|
826
|
+
/**
|
|
827
|
+
* The data used to generate a confirmation dialog for the delete action.
|
|
828
|
+
*/
|
|
829
|
+
confirmEditDialogData?: ConfirmDialogData
|
|
830
|
+
}
|
|
602
831
|
|
|
603
832
|
/**
|
|
604
|
-
*
|
|
833
|
+
* All the configuration data required to display a ngx-mat-entity-table.
|
|
605
834
|
*/
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
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
|
|
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
|
+
}
|
|
654
852
|
```
|
|
655
853
|
|
|
656
854
|
## Display Columns
|
|
657
855
|
The definition of a column inside the table.
|
|
658
856
|
```typescript
|
|
659
|
-
export interface DisplayColumn<EntityType extends
|
|
857
|
+
export interface DisplayColumn<EntityType extends object> {
|
|
660
858
|
/**
|
|
661
859
|
* The name inside the header.
|
|
662
860
|
*/
|
|
663
|
-
displayName: string
|
|
861
|
+
displayName: string,
|
|
664
862
|
/**
|
|
665
|
-
* A method to get the value inside an
|
|
863
|
+
* A method to get the value inside an row.
|
|
666
864
|
*/
|
|
667
|
-
value: (entity: EntityType) => string
|
|
865
|
+
value: (entity: EntityType) => string
|
|
668
866
|
}
|
|
669
867
|
```
|
|
670
868
|
|
|
@@ -672,20 +870,30 @@ export interface DisplayColumn<EntityType extends Entity> {
|
|
|
672
870
|
Multiselect Actions appear on the right upper corner and allow you to do actions on all selected entries.
|
|
673
871
|
|
|
674
872
|
```typescript
|
|
675
|
-
export interface MultiSelectAction<EntityType extends
|
|
873
|
+
export interface MultiSelectAction<EntityType extends object> {
|
|
676
874
|
/**
|
|
677
|
-
* The name of the action
|
|
875
|
+
* The name of the action.
|
|
678
876
|
*/
|
|
679
|
-
displayName: string
|
|
877
|
+
displayName: string,
|
|
680
878
|
/**
|
|
681
|
-
* The action itself
|
|
879
|
+
* The action itself.
|
|
682
880
|
*/
|
|
683
|
-
action: (
|
|
881
|
+
action: (selectedEntities: EntityType[]) => unknown,
|
|
684
882
|
/**
|
|
685
883
|
* A method that defines whether or not the action can be used.
|
|
686
|
-
*
|
|
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.
|
|
687
896
|
*/
|
|
688
|
-
|
|
897
|
+
confirmDialogData?: ConfirmDialogData
|
|
689
898
|
}
|
|
690
899
|
```
|
|
691
|
-
//TODO
|