ngx-material-entity 0.1.2 → 0.1.3
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/classes/base-builder.class.d.ts +35 -0
- package/classes/entity-service.class.d.ts +1 -1
- package/classes/entity-utilities.class.d.ts +36 -3
- package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +10 -11
- package/components/confirm-dialog/confirm-dialog-data.d.ts +4 -0
- package/components/confirm-dialog/confirm-dialog.component.d.ts +11 -0
- package/components/input/{array-table/add-array-item-dialog/add-array-item-dialog-data.builder.d.ts → add-array-item-dialog-data.builder.d.ts} +11 -7
- package/components/input/{array-table/add-array-item-dialog/add-array-item-dialog-data.d.ts → add-array-item-dialog-data.d.ts} +5 -2
- package/components/input/input.component.d.ts +100 -7
- package/components/input/input.module.d.ts +6 -4
- package/components/table/create-dialog/create-dialog-data.builder.d.ts +9 -8
- package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +9 -3
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +15 -3
- package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +9 -11
- package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +9 -3
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +19 -3
- package/components/table/table-data.builder.d.ts +20 -9
- package/components/table/table-data.d.ts +14 -2
- package/components/table/table.component.d.ts +46 -0
- package/components/table/table.module.d.ts +3 -1
- package/decorators/array/array-decorator-internal.data.d.ts +13 -2
- package/decorators/array/array-decorator.data.d.ts +21 -12
- package/decorators/array/array.decorator.d.ts +1 -1
- package/decorators/base/property-decorator-internal.data.d.ts +16 -3
- package/decorators/base/property-decorator.data.d.ts +26 -5
- package/decorators/boolean/boolean-decorator-internal.data.d.ts +9 -0
- package/decorators/boolean/boolean-decorator.data.d.ts +9 -0
- package/decorators/boolean/boolean.decorator.d.ts +1 -1
- package/decorators/number/number-decorator-internal.data.d.ts +6 -0
- package/decorators/number/number-decorator.data.d.ts +6 -0
- package/decorators/number/number.decorator.d.ts +1 -1
- package/decorators/object/object-decorator-internal.data.d.ts +3 -0
- package/decorators/object/object-decorator.data.d.ts +3 -0
- package/decorators/object/object.decorator.d.ts +1 -1
- package/decorators/string/string-decorator-internal.data.d.ts +12 -0
- package/decorators/string/string-decorator.data.d.ts +12 -0
- package/decorators/string/string.decorator.d.ts +1 -1
- package/esm2020/classes/base-builder.class.mjs +43 -0
- package/esm2020/classes/entity-service.class.mjs +2 -2
- package/esm2020/classes/entity-utilities.class.mjs +81 -33
- package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +15 -48
- package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +1 -1
- package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +13 -2
- package/esm2020/components/get-validation-error-message.function.mjs +5 -1
- 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 +170 -31
- package/esm2020/components/input/input.module.mjs +19 -9
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +18 -40
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +15 -7
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +24 -17
- package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +20 -4
- package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +23 -63
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +15 -7
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +35 -24
- package/esm2020/components/table/table-data.builder.mjs +30 -14
- package/esm2020/components/table/table-data.mjs +1 -1
- package/esm2020/components/table/table.component.mjs +57 -10
- package/esm2020/components/table/table.module.mjs +12 -4
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +15 -4
- package/esm2020/decorators/array/array-decorator.data.mjs +1 -1
- package/esm2020/decorators/array/array.decorator.mjs +2 -2
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +28 -5
- package/esm2020/decorators/base/property-decorator.data.mjs +1 -1
- package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +12 -1
- package/esm2020/decorators/boolean/boolean-decorator.data.mjs +1 -1
- package/esm2020/decorators/boolean/boolean.decorator.mjs +2 -2
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +7 -1
- package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
- package/esm2020/decorators/number/number.decorator.mjs +2 -2
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +4 -1
- package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
- package/esm2020/decorators/object/object.decorator.mjs +2 -2
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +13 -1
- package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
- package/esm2020/decorators/string/string.decorator.mjs +2 -2
- package/esm2020/public-api.mjs +1 -1
- package/fesm2015/ngx-material-entity.mjs +708 -703
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +750 -723
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +0 -1
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +0 -22
- 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 -54
- package/components/input/internal-input/internal-input.module.d.ts +0 -16
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.builder.mjs +0 -33
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.mjs +0 -2
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +0 -45
- 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 -119
- package/esm2020/components/input/array-table/array-table.module.mjs +0 -66
- package/esm2020/components/input/internal-input/internal-input.component.mjs +0 -70
- package/esm2020/components/input/internal-input/internal-input.module.mjs +0 -54
|
@@ -6,37 +6,36 @@ import * as i0 from '@angular/core';
|
|
|
6
6
|
import { Component, Inject, NgModule, Input, ViewChild } from '@angular/core';
|
|
7
7
|
import * as i1 from '@angular/material/dialog';
|
|
8
8
|
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i6 from '@angular/material/checkbox';
|
|
10
10
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
11
11
|
import * as i3 from '@angular/material/button';
|
|
12
12
|
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
-
import * as
|
|
13
|
+
import * as i11 from '@angular/common';
|
|
14
14
|
import { CommonModule } from '@angular/common';
|
|
15
|
-
import * as
|
|
15
|
+
import * as i13 from '@angular/forms';
|
|
16
16
|
import { FormsModule } from '@angular/forms';
|
|
17
|
-
import * as
|
|
17
|
+
import * as i9 from '@angular/material/table';
|
|
18
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
19
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
20
|
+
import * as i2 from '@angular/material/form-field';
|
|
18
21
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
19
|
-
import * as
|
|
22
|
+
import * as i3$1 from '@angular/material/autocomplete';
|
|
20
23
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
21
|
-
import * as
|
|
22
|
-
import * as
|
|
24
|
+
import * as i4 from '@angular/material/core';
|
|
25
|
+
import * as i5 from '@angular/material/select';
|
|
23
26
|
import { MatSelectModule } from '@angular/material/select';
|
|
24
|
-
import * as
|
|
27
|
+
import * as i7 from '@angular/material/slide-toggle';
|
|
25
28
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
26
|
-
import
|
|
27
|
-
import * as i4$1 from '@angular/material/table';
|
|
28
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
29
|
-
import * as i8 from '@angular/material/input';
|
|
30
|
-
import { MatInputModule } from '@angular/material/input';
|
|
31
|
-
import * as i10 from '@angular/cdk/text-field';
|
|
32
|
-
import * as i8$1 from '@angular/material/chips';
|
|
29
|
+
import * as i10 from '@angular/material/chips';
|
|
33
30
|
import { MatChipsModule } from '@angular/material/chips';
|
|
34
|
-
import * as
|
|
31
|
+
import * as i12 from '@angular/material/input';
|
|
32
|
+
import { MatInputModule } from '@angular/material/input';
|
|
33
|
+
import * as i14 from '@angular/cdk/text-field';
|
|
35
34
|
import { MatIconModule } from '@angular/material/icon';
|
|
36
35
|
import * as i7$1 from '@angular/material/paginator';
|
|
37
36
|
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
38
37
|
import { MatSort } from '@angular/material/sort';
|
|
39
|
-
import * as i4$
|
|
38
|
+
import * as i4$1 from '@angular/material/menu';
|
|
40
39
|
import { MatMenuModule } from '@angular/material/menu';
|
|
41
40
|
|
|
42
41
|
/**
|
|
@@ -73,21 +72,47 @@ var DecoratorTypes;
|
|
|
73
72
|
DecoratorTypes["ARRAY_STRING_AUTOCOMPLETE_CHIPS"] = "arrayStringAutocompleteChips";
|
|
74
73
|
})(DecoratorTypes || (DecoratorTypes = {}));
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
/**
|
|
76
|
+
* The internal Position. Sets default values and validates user input.
|
|
77
|
+
*/
|
|
78
|
+
class PositionInternal {
|
|
77
79
|
constructor(data) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
this.validateInput(data);
|
|
81
|
+
this.row = (data === null || data === void 0 ? void 0 : data.row) ? data.row : -1;
|
|
82
|
+
this.order = (data === null || data === void 0 ? void 0 : data.order) ? data.order : -1;
|
|
83
|
+
}
|
|
84
|
+
validateInput(data) {
|
|
85
|
+
if (data === null || data === void 0 ? void 0 : data.order) {
|
|
86
|
+
if (data.order < 1) {
|
|
87
|
+
throw new Error('order must be at least 1');
|
|
88
|
+
}
|
|
89
|
+
if (data.order > 12) {
|
|
90
|
+
throw new Error('order cannot be bigger than 12 (the minimum value for a bootstrap column)');
|
|
91
|
+
}
|
|
80
92
|
}
|
|
93
|
+
if ((data === null || data === void 0 ? void 0 : data.row) && (data.row < 1)) {
|
|
94
|
+
throw new Error('row must be at least 1');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The internal PropertyDecoratorConfig. Sets default values.
|
|
100
|
+
*/
|
|
101
|
+
class PropertyDecoratorConfigInternal {
|
|
102
|
+
constructor(data) {
|
|
81
103
|
this.display = data.display != undefined ? data.display : true;
|
|
82
104
|
this.displayName = data.displayName;
|
|
83
105
|
this.required = data.required != undefined ? data.required : true;
|
|
84
106
|
this.omitForCreate = data.omitForCreate != undefined ? data.omitForCreate : false;
|
|
85
107
|
this.omitForUpdate = data.omitForUpdate != undefined ? data.omitForUpdate : false;
|
|
86
108
|
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 6, 12];
|
|
87
|
-
this.
|
|
109
|
+
this.position = new PositionInternal(data.position);
|
|
88
110
|
}
|
|
89
111
|
}
|
|
90
112
|
|
|
113
|
+
/**
|
|
114
|
+
* The internal DropdownStringDecoratorConfig. Sets default values.
|
|
115
|
+
*/
|
|
91
116
|
class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
92
117
|
constructor(data) {
|
|
93
118
|
super(data);
|
|
@@ -95,6 +120,9 @@ class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInter
|
|
|
95
120
|
this.dropdownValues = data.dropdownValues;
|
|
96
121
|
}
|
|
97
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* The internal DefaultStringDecoratorConfig. Sets default values.
|
|
125
|
+
*/
|
|
98
126
|
class DefaultStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
99
127
|
constructor(data) {
|
|
100
128
|
super(data);
|
|
@@ -104,6 +132,9 @@ class DefaultStringDecoratorConfigInternal extends PropertyDecoratorConfigIntern
|
|
|
104
132
|
this.regex = data.regex;
|
|
105
133
|
}
|
|
106
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* The internal TextboxStringDecoratorConfig. Sets default values.
|
|
137
|
+
*/
|
|
107
138
|
class TextboxStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
108
139
|
constructor(data) {
|
|
109
140
|
super(data);
|
|
@@ -112,6 +143,9 @@ class TextboxStringDecoratorConfigInternal extends PropertyDecoratorConfigIntern
|
|
|
112
143
|
this.maxLength = data.maxLength;
|
|
113
144
|
}
|
|
114
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The internal AutocompleteStringDecoratorConfig. Sets default values.
|
|
148
|
+
*/
|
|
115
149
|
class AutocompleteStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
116
150
|
constructor(data) {
|
|
117
151
|
super(data);
|
|
@@ -124,7 +158,7 @@ class AutocompleteStringDecoratorConfigInternal extends PropertyDecoratorConfigI
|
|
|
124
158
|
}
|
|
125
159
|
|
|
126
160
|
/**
|
|
127
|
-
* Decorator for setting and getting string
|
|
161
|
+
* Decorator for setting and getting string Property metadata.
|
|
128
162
|
*
|
|
129
163
|
* @param metadata - The metadata of the string property.
|
|
130
164
|
* @returns The method that defines the metadata.
|
|
@@ -174,8 +208,8 @@ class EntityUtilities {
|
|
|
174
208
|
*/
|
|
175
209
|
static getOmitForUpdate(entity) {
|
|
176
210
|
const res = [];
|
|
177
|
-
for (const key of
|
|
178
|
-
const metadata =
|
|
211
|
+
for (const key of EntityUtilities.keysOf(entity)) {
|
|
212
|
+
const metadata = EntityUtilities.getPropertyMetadata(entity, key);
|
|
179
213
|
if (metadata.omitForUpdate) {
|
|
180
214
|
res.push(key);
|
|
181
215
|
}
|
|
@@ -190,8 +224,8 @@ class EntityUtilities {
|
|
|
190
224
|
*/
|
|
191
225
|
static getOmitForCreate(entity) {
|
|
192
226
|
const res = [];
|
|
193
|
-
for (const key of
|
|
194
|
-
const metadata =
|
|
227
|
+
for (const key of EntityUtilities.keysOf(entity)) {
|
|
228
|
+
const metadata = EntityUtilities.getPropertyMetadata(entity, key);
|
|
195
229
|
if (metadata.omitForCreate) {
|
|
196
230
|
res.push(key);
|
|
197
231
|
}
|
|
@@ -284,7 +318,7 @@ class EntityUtilities {
|
|
|
284
318
|
* Also checks all the validators given by the metadata ("required", "maxLength" etc.).
|
|
285
319
|
*
|
|
286
320
|
* @param entity - The entity to validate.
|
|
287
|
-
* @param omit - Whether to check for
|
|
321
|
+
* @param omit - Whether to check for creating or editing validity.
|
|
288
322
|
* @returns Whether or not the entity is valid.
|
|
289
323
|
*/
|
|
290
324
|
static isEntityValid(entity, omit) {
|
|
@@ -309,7 +343,6 @@ class EntityUtilities {
|
|
|
309
343
|
const metadata = this.getPropertyMetadata(entity, key, type);
|
|
310
344
|
const metadataDefaultString = metadata;
|
|
311
345
|
const metadataTextboxString = metadata;
|
|
312
|
-
const metadataAutocompleteString = metadata;
|
|
313
346
|
const metadataDefaultNumber = metadata;
|
|
314
347
|
const objectProperty = entity[key];
|
|
315
348
|
const metadataEntityArray = metadata;
|
|
@@ -324,7 +357,14 @@ class EntityUtilities {
|
|
|
324
357
|
return false;
|
|
325
358
|
}
|
|
326
359
|
switch (type) {
|
|
360
|
+
case DecoratorTypes.BOOLEAN_DROPDOWN:
|
|
361
|
+
case DecoratorTypes.BOOLEAN_CHECKBOX:
|
|
362
|
+
case DecoratorTypes.BOOLEAN_TOGGLE:
|
|
363
|
+
return true;
|
|
364
|
+
case DecoratorTypes.STRING_DROPDOWN:
|
|
365
|
+
return true;
|
|
327
366
|
case DecoratorTypes.STRING:
|
|
367
|
+
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
328
368
|
if (metadataDefaultString.maxLength
|
|
329
369
|
&& entity[key].length > metadataDefaultString.maxLength) {
|
|
330
370
|
return false;
|
|
@@ -338,20 +378,6 @@ class EntityUtilities {
|
|
|
338
378
|
return false;
|
|
339
379
|
}
|
|
340
380
|
break;
|
|
341
|
-
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
342
|
-
if (metadataAutocompleteString.maxLength
|
|
343
|
-
&& entity[key].length > metadataAutocompleteString.maxLength) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
if (metadataAutocompleteString.minLength
|
|
347
|
-
&& entity[key].length < metadataAutocompleteString.minLength) {
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
if (metadataAutocompleteString.regex
|
|
351
|
-
&& !entity[key].match(metadataAutocompleteString.regex)) {
|
|
352
|
-
return false;
|
|
353
|
-
}
|
|
354
|
-
break;
|
|
355
381
|
case DecoratorTypes.STRING_TEXTBOX:
|
|
356
382
|
if (metadataTextboxString.maxLength
|
|
357
383
|
&& entity[key].length > metadataTextboxString.maxLength) {
|
|
@@ -362,6 +388,8 @@ class EntityUtilities {
|
|
|
362
388
|
return false;
|
|
363
389
|
}
|
|
364
390
|
break;
|
|
391
|
+
case DecoratorTypes.NUMBER_DROPDOWN:
|
|
392
|
+
return true;
|
|
365
393
|
case DecoratorTypes.NUMBER:
|
|
366
394
|
if (metadataDefaultNumber.max && entity[key] > metadataDefaultNumber.max) {
|
|
367
395
|
return false;
|
|
@@ -436,31 +464,29 @@ class EntityUtilities {
|
|
|
436
464
|
* @returns 0 if both values have the same order, a negative value if X, a positive value if Y.
|
|
437
465
|
*/
|
|
438
466
|
static compareOrder(a, b, entity) {
|
|
439
|
-
const metadataA = EntityUtilities.getPropertyMetadata(entity, a
|
|
440
|
-
const metadataB = EntityUtilities.getPropertyMetadata(entity, b
|
|
441
|
-
if (metadataA.order === -1) {
|
|
442
|
-
if (metadataB.order === -1) {
|
|
467
|
+
const metadataA = EntityUtilities.getPropertyMetadata(entity, a);
|
|
468
|
+
const metadataB = EntityUtilities.getPropertyMetadata(entity, b);
|
|
469
|
+
if (metadataA.position.order === -1) {
|
|
470
|
+
if (metadataB.position.order === -1) {
|
|
443
471
|
return 0;
|
|
444
472
|
}
|
|
445
473
|
return 1;
|
|
446
474
|
}
|
|
447
|
-
else if (metadataB.order === -1) {
|
|
475
|
+
else if (metadataB.position.order === -1) {
|
|
448
476
|
return -1;
|
|
449
477
|
}
|
|
450
|
-
return ((metadataA.order) - (metadataB.order));
|
|
478
|
+
return ((metadataA.position.order) - (metadataB.position.order));
|
|
451
479
|
}
|
|
452
480
|
/**
|
|
453
481
|
* Gets the bootstrap column values for "lg", "md", "sm".
|
|
454
482
|
*
|
|
455
483
|
* @param entity - Entity to get the bootstrap column values of the key.
|
|
456
484
|
* @param key - Key of the property to get bootstrap column values from.
|
|
457
|
-
* @param type - Defines for which
|
|
485
|
+
* @param type - Defines for which screen size the column values should be returned.
|
|
458
486
|
* @returns Bootstrap column value.
|
|
459
487
|
*/
|
|
460
488
|
static getWidth(entity, key, type) {
|
|
461
|
-
const
|
|
462
|
-
const metadata = EntityUtilities.getPropertyMetadata(entity, key, propertyType);
|
|
463
|
-
metadata.defaultWidths = metadata.defaultWidths;
|
|
489
|
+
const metadata = EntityUtilities.getPropertyMetadata(entity, key);
|
|
464
490
|
switch (type) {
|
|
465
491
|
case 'lg':
|
|
466
492
|
return metadata.defaultWidths[0];
|
|
@@ -481,11 +507,67 @@ class EntityUtilities {
|
|
|
481
507
|
Reflect.set(entity, key, Reflect.get(entityPriorChanges, key));
|
|
482
508
|
}
|
|
483
509
|
}
|
|
510
|
+
/**
|
|
511
|
+
* Gets the rows that are used to display the given entity.
|
|
512
|
+
*
|
|
513
|
+
* @param entity - The entity to get the rows from.
|
|
514
|
+
* @param hideOmitForCreate - Whether or not keys with the metadata omitForCreate should be filtered out.
|
|
515
|
+
* @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
|
|
516
|
+
* @returns The sorted Rows containing the row number and the keys to display in that row.
|
|
517
|
+
*/
|
|
518
|
+
static getEntityRows(entity, hideOmitForCreate = false, hideOmitForEdit = false) {
|
|
519
|
+
const res = [];
|
|
520
|
+
const keys = EntityUtilities.keysOf(entity, hideOmitForCreate, hideOmitForEdit);
|
|
521
|
+
const numberOfRows = EntityUtilities.getNumberOfRows(keys, entity);
|
|
522
|
+
for (let i = 1; i <= numberOfRows; i++) {
|
|
523
|
+
const row = {
|
|
524
|
+
row: i,
|
|
525
|
+
keys: EntityUtilities.getKeysForRow(keys, entity, i)
|
|
526
|
+
};
|
|
527
|
+
res.push(row);
|
|
528
|
+
}
|
|
529
|
+
const lastRow = {
|
|
530
|
+
row: numberOfRows + 1,
|
|
531
|
+
keys: EntityUtilities.getKeysForRow(keys, entity, -1)
|
|
532
|
+
};
|
|
533
|
+
res.push(lastRow);
|
|
534
|
+
return res;
|
|
535
|
+
}
|
|
536
|
+
static getKeysForRow(keys, entity, i) {
|
|
537
|
+
return keys
|
|
538
|
+
.filter(k => EntityUtilities.getPropertyMetadata(entity, k).position.row === i)
|
|
539
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, entity));
|
|
540
|
+
}
|
|
541
|
+
static getNumberOfRows(keys, entity) {
|
|
542
|
+
return keys
|
|
543
|
+
.map(k => EntityUtilities.getPropertyMetadata(entity, k).position.row)
|
|
544
|
+
.sort((a, b) => (a > b ? -1 : 1))[0];
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Gets the keys of the provided entity correctly typed.
|
|
548
|
+
*
|
|
549
|
+
* @param entity - The entity to get the keys of.
|
|
550
|
+
* @param hideOmitForCreate - Whether or not keys with the metadata omitForCreate should be filtered out.
|
|
551
|
+
* @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
|
|
552
|
+
* @returns An array of keys of the entity.
|
|
553
|
+
*/
|
|
554
|
+
static keysOf(entity, hideOmitForCreate = false, hideOmitForEdit = false) {
|
|
555
|
+
let keys = Reflect.ownKeys(entity);
|
|
556
|
+
if (hideOmitForCreate) {
|
|
557
|
+
const omitForCreateKeys = EntityUtilities.getOmitForCreate(entity);
|
|
558
|
+
keys = keys.filter(k => !omitForCreateKeys.includes(k));
|
|
559
|
+
}
|
|
560
|
+
if (hideOmitForEdit) {
|
|
561
|
+
const omitForUpdateKeys = EntityUtilities.getOmitForUpdate(entity);
|
|
562
|
+
keys = keys.filter(k => !omitForUpdateKeys.includes(k));
|
|
563
|
+
}
|
|
564
|
+
return keys;
|
|
565
|
+
}
|
|
484
566
|
}
|
|
485
567
|
_a = EntityUtilities;
|
|
486
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
568
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering, jsdoc/require-jsdoc
|
|
487
569
|
EntityUtilities.construct = _a.new;
|
|
488
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
570
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering, jsdoc/require-jsdoc
|
|
489
571
|
EntityUtilities.build = _a.new;
|
|
490
572
|
|
|
491
573
|
/**
|
|
@@ -528,7 +610,7 @@ class EntityService {
|
|
|
528
610
|
});
|
|
529
611
|
}
|
|
530
612
|
/**
|
|
531
|
-
* Gets all existing entities and pushes them to the
|
|
613
|
+
* Gets all existing entities and pushes them to the entities array.
|
|
532
614
|
*
|
|
533
615
|
* @returns A Promise of all received Entities.
|
|
534
616
|
*/
|
|
@@ -569,6 +651,52 @@ class EntityService {
|
|
|
569
651
|
}
|
|
570
652
|
}
|
|
571
653
|
|
|
654
|
+
/**
|
|
655
|
+
* The abstract BaseBuilder class.
|
|
656
|
+
*/
|
|
657
|
+
class BaseBuilder {
|
|
658
|
+
constructor(data) {
|
|
659
|
+
this.validateInput(data);
|
|
660
|
+
this.inputData = data;
|
|
661
|
+
this.data = this.generateBaseData(data);
|
|
662
|
+
return this;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Used to validate the user input in the constructor.
|
|
666
|
+
*
|
|
667
|
+
* @param data - The user input.
|
|
668
|
+
*/
|
|
669
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
670
|
+
validateInput(data) {
|
|
671
|
+
// By default, no validation is done
|
|
672
|
+
}
|
|
673
|
+
;
|
|
674
|
+
/**
|
|
675
|
+
* Sets the value for the given key if no user value was provided.
|
|
676
|
+
*
|
|
677
|
+
* @param key - The key to set the default value for.
|
|
678
|
+
* @param value - The value to set when nothing was provided.
|
|
679
|
+
* @returns The Builder.
|
|
680
|
+
*/
|
|
681
|
+
withDefault(key, value) {
|
|
682
|
+
if (!this.inputData || !this.inputData[key]) {
|
|
683
|
+
this.data[key] = value;
|
|
684
|
+
}
|
|
685
|
+
return this;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Method used to get the final build value after applying all chaining.
|
|
689
|
+
*
|
|
690
|
+
* @returns The build value.
|
|
691
|
+
*/
|
|
692
|
+
getResult() {
|
|
693
|
+
return this.data;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* The internal ConfirmDialogData. Requires all default values the user can leave out.
|
|
699
|
+
*/
|
|
572
700
|
class ConfirmDialogDataInternal {
|
|
573
701
|
constructor(text, type, confirmButtonLabel, cancelButtonLabel, title, requireConfirmation, confirmationText) {
|
|
574
702
|
this.text = text;
|
|
@@ -580,13 +708,18 @@ class ConfirmDialogDataInternal {
|
|
|
580
708
|
this.confirmationText = confirmationText;
|
|
581
709
|
}
|
|
582
710
|
}
|
|
583
|
-
|
|
711
|
+
/**
|
|
712
|
+
* The Builder for the ConfirmDialogData. Sets default values.
|
|
713
|
+
*/
|
|
714
|
+
class ConfirmDialogDataBuilder extends BaseBuilder {
|
|
584
715
|
constructor(data) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
716
|
+
super(data);
|
|
717
|
+
}
|
|
718
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
719
|
+
generateBaseData(data) {
|
|
720
|
+
return new ConfirmDialogDataInternal((data === null || data === void 0 ? void 0 : data.text) ? data.text : ['Do you really want to do this?'], (data === null || data === void 0 ? void 0 : data.type) ? data.type : 'default', (data === null || data === void 0 ? void 0 : data.confirmButtonLabel) ? data.confirmButtonLabel : 'Confirm', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.title) ? data.title : 'Confirmation', (data === null || data === void 0 ? void 0 : data.requireConfirmation) ? data.requireConfirmation : false, data === null || data === void 0 ? void 0 : data.confirmationText);
|
|
589
721
|
}
|
|
722
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
590
723
|
validateInput(data) {
|
|
591
724
|
if (!data) {
|
|
592
725
|
return;
|
|
@@ -602,57 +735,13 @@ class ConfirmDialogDataBuilder {
|
|
|
602
735
|
throw new Error('The "cancelButtonLabel" will never be shown because "type" is set to "info-only"');
|
|
603
736
|
}
|
|
604
737
|
}
|
|
605
|
-
withDefaultText(text) {
|
|
606
|
-
var _a;
|
|
607
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.text)) {
|
|
608
|
-
this.confirmDialogData.text = text;
|
|
609
|
-
}
|
|
610
|
-
return this;
|
|
611
|
-
}
|
|
612
|
-
withDefaultType(type) {
|
|
613
|
-
var _a;
|
|
614
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
615
|
-
this.confirmDialogData.type = type;
|
|
616
|
-
}
|
|
617
|
-
return this;
|
|
618
|
-
}
|
|
619
|
-
withDefaultConfirmButtonLabel(label) {
|
|
620
|
-
var _a;
|
|
621
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmButtonLabel)) {
|
|
622
|
-
this.confirmDialogData.confirmButtonLabel = label;
|
|
623
|
-
}
|
|
624
|
-
return this;
|
|
625
|
-
}
|
|
626
|
-
withDefaultCancelButtonLabel(label) {
|
|
627
|
-
var _a;
|
|
628
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.cancelButtonLabel)) {
|
|
629
|
-
this.confirmDialogData.cancelButtonLabel = label;
|
|
630
|
-
}
|
|
631
|
-
return this;
|
|
632
|
-
}
|
|
633
|
-
withDefaultTitle(title) {
|
|
634
|
-
var _a;
|
|
635
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
636
|
-
this.confirmDialogData.title = title;
|
|
637
|
-
}
|
|
638
|
-
return this;
|
|
639
|
-
}
|
|
640
|
-
withDefaultRequireConfirmation(requireConfirmation) {
|
|
641
|
-
var _a;
|
|
642
|
-
if (((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.requireConfirmation) === undefined) {
|
|
643
|
-
this.confirmDialogData.requireConfirmation = requireConfirmation;
|
|
644
|
-
}
|
|
645
|
-
return this;
|
|
646
|
-
}
|
|
647
|
-
withDefaultConfirmationText(confirmationText) {
|
|
648
|
-
var _a;
|
|
649
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmationText)) {
|
|
650
|
-
this.confirmDialogData.confirmationText = confirmationText;
|
|
651
|
-
}
|
|
652
|
-
return this;
|
|
653
|
-
}
|
|
654
738
|
}
|
|
655
739
|
|
|
740
|
+
/**
|
|
741
|
+
* The Dialog used whenever confirmation by the user is required (e.g. When the user tries to delete an entity).
|
|
742
|
+
*
|
|
743
|
+
* Can be customized with the MAT_DIALOG_DATA "inputData". Customization options are defined in "ConfirmDialogData".
|
|
744
|
+
*/
|
|
656
745
|
class NgxMatEntityConfirmDialogComponent {
|
|
657
746
|
constructor(dialogRef, inputData) {
|
|
658
747
|
this.dialogRef = dialogRef;
|
|
@@ -660,18 +749,24 @@ class NgxMatEntityConfirmDialogComponent {
|
|
|
660
749
|
this.confirm = false;
|
|
661
750
|
}
|
|
662
751
|
ngOnInit() {
|
|
663
|
-
this.data = new ConfirmDialogDataBuilder(this.inputData).
|
|
752
|
+
this.data = new ConfirmDialogDataBuilder(this.inputData).getResult();
|
|
664
753
|
this.dialogRef.disableClose = true;
|
|
665
754
|
}
|
|
755
|
+
/**
|
|
756
|
+
* Closes the dialog with value 1 to signal that the action should be run.
|
|
757
|
+
*/
|
|
666
758
|
confirmAction() {
|
|
667
759
|
this.dialogRef.close(1);
|
|
668
760
|
}
|
|
761
|
+
/**
|
|
762
|
+
* Closes the dialog.
|
|
763
|
+
*/
|
|
669
764
|
cancel() {
|
|
670
765
|
this.dialogRef.close();
|
|
671
766
|
}
|
|
672
767
|
}
|
|
673
768
|
NgxMatEntityConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
674
|
-
NgxMatEntityConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityConfirmDialogComponent, selector: "ngx-mat-entity-confirm-dialog", ngImport: i0, template: "<h2 mat-dialog-title *ngIf=\"data.title\">{{data.title}}</h2>\n\n<mat-dialog-content>\n <p *ngFor=\"let paragraph of data.text\">{{paragraph}}</p>\n <div *ngIf=\"data.requireConfirmation\" class=\"checkbox-wrapper\">\n <mat-checkbox [(ngModel)]=\"confirm\" name=\"confirm\">\n {{data.confirmationText}}\n </mat-checkbox>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button *ngIf=\"data.type === 'delete'\" mat-raised-button color=\"warn\" (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button *ngIf=\"data.type !== 'delete'\" mat-raised-button (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: [".checkbox-wrapper{min-height:50px;display:flex}.checkbox-wrapper>mat-checkbox{align-self:center}mat-dialog-actions{display:flex;justify-content:space-between}\n"], components: [{ type:
|
|
769
|
+
NgxMatEntityConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityConfirmDialogComponent, selector: "ngx-mat-entity-confirm-dialog", ngImport: i0, template: "<h2 mat-dialog-title *ngIf=\"data.title\">{{data.title}}</h2>\n\n<mat-dialog-content>\n <p *ngFor=\"let paragraph of data.text\">{{paragraph}}</p>\n <div *ngIf=\"data.requireConfirmation\" class=\"checkbox-wrapper\">\n <mat-checkbox [(ngModel)]=\"confirm\" name=\"confirm\">\n {{data.confirmationText}}\n </mat-checkbox>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button *ngIf=\"data.type === 'delete'\" mat-raised-button color=\"warn\" (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button *ngIf=\"data.type !== 'delete'\" mat-raised-button (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: [".checkbox-wrapper{min-height:50px;display:flex}.checkbox-wrapper>mat-checkbox{align-self:center}mat-dialog-actions{display:flex;justify-content:space-between}\n"], components: [{ type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i13.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
675
770
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogComponent, decorators: [{
|
|
676
771
|
type: Component,
|
|
677
772
|
args: [{ selector: 'ngx-mat-entity-confirm-dialog', template: "<h2 mat-dialog-title *ngIf=\"data.title\">{{data.title}}</h2>\n\n<mat-dialog-content>\n <p *ngFor=\"let paragraph of data.text\">{{paragraph}}</p>\n <div *ngIf=\"data.requireConfirmation\" class=\"checkbox-wrapper\">\n <mat-checkbox [(ngModel)]=\"confirm\" name=\"confirm\">\n {{data.confirmationText}}\n </mat-checkbox>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button *ngIf=\"data.type === 'delete'\" mat-raised-button color=\"warn\" (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button *ngIf=\"data.type !== 'delete'\" mat-raised-button (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: [".checkbox-wrapper{min-height:50px;display:flex}.checkbox-wrapper>mat-checkbox{align-self:center}mat-dialog-actions{display:flex;justify-content:space-between}\n"] }]
|
|
@@ -724,11 +819,18 @@ function getValidationErrorMessage(model) {
|
|
|
724
819
|
else if (model.hasError('required')) {
|
|
725
820
|
return 'required';
|
|
726
821
|
}
|
|
822
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
823
|
+
else if (model.hasError('pattern') && model.getError('pattern').requiredPattern === '^true$') {
|
|
824
|
+
return 'needs to be selected';
|
|
825
|
+
}
|
|
727
826
|
else {
|
|
728
827
|
return 'invalid input';
|
|
729
828
|
}
|
|
730
829
|
}
|
|
731
830
|
|
|
831
|
+
/**
|
|
832
|
+
* The internal CreateDialogData. Requires all default values the user can leave out.
|
|
833
|
+
*/
|
|
732
834
|
class CreateDialogDataInternal {
|
|
733
835
|
constructor(title, createButtonLabel, cancelButtonLabel, createRequiresConfirmDialog, confirmCreateDialogData) {
|
|
734
836
|
this.title = title;
|
|
@@ -738,55 +840,27 @@ class CreateDialogDataInternal {
|
|
|
738
840
|
this.confirmCreateDialogData = confirmCreateDialogData;
|
|
739
841
|
}
|
|
740
842
|
}
|
|
741
|
-
|
|
843
|
+
/**
|
|
844
|
+
* The Builder for the CreateDialogData. Sets default values.
|
|
845
|
+
*/
|
|
846
|
+
class CreateDialogDataBuilder extends BaseBuilder {
|
|
742
847
|
constructor(data) {
|
|
743
|
-
|
|
744
|
-
this.dataInput = data;
|
|
745
|
-
const confirmCreateDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmCreateDialogData)
|
|
746
|
-
.withDefaultConfirmButtonLabel('Create')
|
|
747
|
-
.withDefaultText(['Do you really want to create this entity?'])
|
|
748
|
-
.withDefaultTitle('Create')
|
|
749
|
-
.confirmDialogData;
|
|
750
|
-
this.createDialogData = new CreateDialogDataInternal((data === null || data === void 0 ? void 0 : data.title) ? data.title : 'Create', (data === null || data === void 0 ? void 0 : data.createButtonLabel) ? data.createButtonLabel : 'Create', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.createRequiresConfirmDialog) ? data.createRequiresConfirmDialog : false, confirmCreateDialogData);
|
|
751
|
-
return this;
|
|
752
|
-
}
|
|
753
|
-
withDefaultTitle(title) {
|
|
754
|
-
var _a;
|
|
755
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
756
|
-
this.createDialogData.title = title;
|
|
757
|
-
}
|
|
758
|
-
return this;
|
|
759
|
-
}
|
|
760
|
-
withDefaultCreateButtonLabel(label) {
|
|
761
|
-
var _a;
|
|
762
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.createButtonLabel)) {
|
|
763
|
-
this.createDialogData.createButtonLabel = label;
|
|
764
|
-
}
|
|
765
|
-
return this;
|
|
766
|
-
}
|
|
767
|
-
withDefaultCancelButtonLabel(label) {
|
|
768
|
-
var _a;
|
|
769
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.cancelButtonLabel)) {
|
|
770
|
-
this.createDialogData.cancelButtonLabel = label;
|
|
771
|
-
}
|
|
772
|
-
return this;
|
|
773
|
-
}
|
|
774
|
-
withDefaultCreateRequiresConfirmDialog(createRequiresConfirmDialog) {
|
|
775
|
-
var _a;
|
|
776
|
-
if (((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.createRequiresConfirmDialog) === undefined) {
|
|
777
|
-
this.createDialogData.createRequiresConfirmDialog = createRequiresConfirmDialog;
|
|
778
|
-
}
|
|
779
|
-
return this;
|
|
848
|
+
super(data);
|
|
780
849
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
850
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
851
|
+
generateBaseData(data) {
|
|
852
|
+
const confirmCreateDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmCreateDialogData)
|
|
853
|
+
.withDefault('confirmButtonLabel', 'create')
|
|
854
|
+
.withDefault('text', ['Do you really want to create this entity?'])
|
|
855
|
+
.withDefault('title', 'Create')
|
|
856
|
+
.getResult();
|
|
857
|
+
return new CreateDialogDataInternal((data === null || data === void 0 ? void 0 : data.title) ? data.title : 'Create', (data === null || data === void 0 ? void 0 : data.createButtonLabel) ? data.createButtonLabel : 'Create', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.createRequiresConfirmDialog) ? data.createRequiresConfirmDialog : false, confirmCreateDialogData);
|
|
787
858
|
}
|
|
788
859
|
}
|
|
789
860
|
|
|
861
|
+
/**
|
|
862
|
+
* The internal AddArrayItemDialogData. Requires all default values the user can leave out.
|
|
863
|
+
*/
|
|
790
864
|
class AddArrayItemDialogDataInternal {
|
|
791
865
|
constructor(entity, createDialogData, getValidationErrorMessage) {
|
|
792
866
|
this.entity = entity;
|
|
@@ -794,39 +868,51 @@ class AddArrayItemDialogDataInternal {
|
|
|
794
868
|
this.getValidationErrorMessage = getValidationErrorMessage;
|
|
795
869
|
}
|
|
796
870
|
}
|
|
797
|
-
|
|
871
|
+
/**
|
|
872
|
+
* The Builder for the AddArrayItemDialogData. Sets default values.
|
|
873
|
+
*/
|
|
874
|
+
class AddArrayItemDialogDataBuilder extends BaseBuilder {
|
|
798
875
|
constructor(data) {
|
|
799
|
-
|
|
800
|
-
const createDialogData = new CreateDialogDataBuilder(data.createDialogData)
|
|
801
|
-
.withDefaultCreateButtonLabel('Add')
|
|
802
|
-
.withDefaultTitle('Add to array')
|
|
803
|
-
.createDialogData;
|
|
804
|
-
this.addArrayItemDialogData = new AddArrayItemDialogDataInternal(data.entity, createDialogData, data.getValidationErrorMessage ? data.getValidationErrorMessage : getValidationErrorMessage);
|
|
805
|
-
return this;
|
|
806
|
-
}
|
|
807
|
-
withDefaultCreateDialogData(createDialogData) {
|
|
808
|
-
if (!this.dataInput.createDialogData) {
|
|
809
|
-
this.addArrayItemDialogData.createDialogData = createDialogData;
|
|
810
|
-
}
|
|
811
|
-
return this;
|
|
876
|
+
super(data);
|
|
812
877
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
878
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
879
|
+
generateBaseData(data) {
|
|
880
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData)
|
|
881
|
+
.withDefault('createButtonLabel', 'Add')
|
|
882
|
+
.withDefault('title', 'Add to array')
|
|
883
|
+
.getResult();
|
|
884
|
+
return new AddArrayItemDialogDataInternal(data.entity, createDialogData, data.getValidationErrorMessage ? data.getValidationErrorMessage : getValidationErrorMessage);
|
|
818
885
|
}
|
|
819
886
|
}
|
|
820
887
|
|
|
821
|
-
|
|
822
|
-
|
|
888
|
+
/**
|
|
889
|
+
* The default input component. It gets the metadata of the property from the given @Input "entity" and @Input "propertyKey"
|
|
890
|
+
* and displays the input field accordingly.
|
|
891
|
+
*
|
|
892
|
+
* You can also define a method that generates error-messages and if the input should be hidden when its metadata says
|
|
893
|
+
* that it should be omitted for creating or updating.
|
|
894
|
+
* The last part being mostly relevant if you want to use this component inside an ngFor.
|
|
895
|
+
*/
|
|
896
|
+
class NgxMatEntityInputComponent {
|
|
897
|
+
constructor(dialog) {
|
|
898
|
+
this.dialog = dialog;
|
|
899
|
+
this.chipsInput = '';
|
|
900
|
+
this.selection = new SelectionModel(true, []);
|
|
823
901
|
this.DecoratorTypes = DecoratorTypes;
|
|
902
|
+
this.EntityUtilities = EntityUtilities;
|
|
824
903
|
this.getWidth = EntityUtilities.getWidth;
|
|
825
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* This is needed for the inputs to work inside an ngFor.
|
|
907
|
+
*
|
|
908
|
+
* @param index - The index of the element in the ngFor.
|
|
909
|
+
* @returns The index.
|
|
910
|
+
*/
|
|
826
911
|
trackByFn(index) {
|
|
827
912
|
return index;
|
|
828
913
|
}
|
|
829
914
|
ngOnInit() {
|
|
915
|
+
var _a;
|
|
830
916
|
if (!this.entity) {
|
|
831
917
|
throw new Error('Missing required Input data "entity"');
|
|
832
918
|
}
|
|
@@ -838,152 +924,113 @@ class NgxMatEntityInternalInputComponent {
|
|
|
838
924
|
this.metadataDefaultString = this.metadata;
|
|
839
925
|
this.metadataTextboxString = this.metadata;
|
|
840
926
|
this.metadataAutocompleteString = this.metadata;
|
|
927
|
+
this.autocompleteStrings = this.metadataAutocompleteString.autocompleteValues;
|
|
928
|
+
this.filteredAutocompleteStrings = cloneDeep(this.autocompleteStrings);
|
|
841
929
|
this.metadataDropdownString = this.metadata;
|
|
842
930
|
this.metadataDropdownBoolean = this.metadata;
|
|
931
|
+
if ((this.type === DecoratorTypes.BOOLEAN_CHECKBOX || this.type === DecoratorTypes.BOOLEAN_TOGGLE)
|
|
932
|
+
&& this.entity[this.propertyKey] === undefined) {
|
|
933
|
+
this.entity[this.propertyKey] = false;
|
|
934
|
+
}
|
|
843
935
|
this.metadataDefaultNumber = this.metadata;
|
|
844
936
|
this.metadataDropdownNumber = this.metadata;
|
|
845
937
|
this.metadataDefaultObject = this.metadata;
|
|
846
938
|
this.objectProperty = this.entity[this.propertyKey];
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
if (!
|
|
853
|
-
|
|
854
|
-
|
|
939
|
+
if (this.type === DecoratorTypes.OBJECT) {
|
|
940
|
+
this.objectPropertyRows = EntityUtilities.getEntityRows(this.objectProperty, this.hideOmitForCreate, this.hideOmitForEdit);
|
|
941
|
+
}
|
|
942
|
+
this.metadataEntityArray = this.metadata;
|
|
943
|
+
if (this.type === DecoratorTypes.ARRAY) {
|
|
944
|
+
if (!this.entity[this.propertyKey]) {
|
|
945
|
+
this.entity[this.propertyKey] = [];
|
|
946
|
+
}
|
|
947
|
+
this.entityArrayValues = this.entity[this.propertyKey];
|
|
948
|
+
if (this.metadataEntityArray.createInline === undefined) {
|
|
949
|
+
this.metadataEntityArray.createInline = true;
|
|
855
950
|
}
|
|
951
|
+
if (!this.metadataEntityArray.createInline && !this.metadataEntityArray.createDialogData) {
|
|
952
|
+
this.metadataEntityArray.createDialogData = {
|
|
953
|
+
title: 'Add'
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
// TODO
|
|
957
|
+
const givenDisplayColumns = this.metadataEntityArray.displayColumns.map((v) => v.displayName);
|
|
958
|
+
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
959
|
+
throw new Error(`The name "select" for a display column is reserved.
|
|
960
|
+
Please choose a different name.`);
|
|
961
|
+
}
|
|
962
|
+
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
963
|
+
this.dataSource = new MatTableDataSource();
|
|
964
|
+
this.dataSource.data = this.entityArrayValues;
|
|
965
|
+
this.arrayItem = new this.metadataEntityArray.EntityClass();
|
|
966
|
+
this.arrayItemInlineRows = EntityUtilities.getEntityRows(this.arrayItem, this.hideOmitForCreate === false ? false : true, this.hideOmitForEdit ? true : false);
|
|
967
|
+
this.arrayItemPriorChanges = cloneDeep(this.arrayItem);
|
|
968
|
+
this.dialogInputData = {
|
|
969
|
+
entity: this.arrayItem,
|
|
970
|
+
createDialogData: this.metadataEntityArray.createDialogData,
|
|
971
|
+
getValidationErrorMessage: this.getValidationErrorMessage
|
|
972
|
+
};
|
|
973
|
+
this.dialogData = new AddArrayItemDialogDataBuilder(this.dialogInputData).getResult();
|
|
974
|
+
this.arrayItemDialogRows = EntityUtilities.getEntityRows(this.dialogData.entity, true);
|
|
975
|
+
}
|
|
976
|
+
this.metadataStringChipsArray = this.metadata;
|
|
977
|
+
if ((this.type === DecoratorTypes.ARRAY_STRING_CHIPS || this.type === DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS)
|
|
978
|
+
&& ((_a = this.entity[this.propertyKey]) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
979
|
+
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
980
|
+
}
|
|
981
|
+
this.metadataAutocompleteStringChipsArray = this.metadata;
|
|
982
|
+
if (!this.getValidationErrorMessage) {
|
|
983
|
+
this.getValidationErrorMessage = getValidationErrorMessage;
|
|
856
984
|
}
|
|
857
|
-
return res.sort((a, b) => EntityUtilities.compareOrder(a, b, this.objectProperty));
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
NgxMatEntityInternalInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
861
|
-
NgxMatEntityInternalInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityInternalInputComponent, selector: "ngx-mat-entity-internal-input", inputs: { entity: "entity", propertyKey: "propertyKey", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit", getValidationErrorMessage: "getValidationErrorMessage" }, ngImport: i0, template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of metadataAutocompleteString.autocompleteValues\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-internal-input>\n </div>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"], components: [{ type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i4.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { type: NgxMatEntityInternalInputComponent, selector: "ngx-mat-entity-internal-input", inputs: ["entity", "propertyKey", "hideOmitForCreate", "hideOmitForEdit", "getValidationErrorMessage"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$1.MatLabel, selector: "mat-label" }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i12.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i12.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i12.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i10.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i12.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i12.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i12.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i7.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
862
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputComponent, decorators: [{
|
|
863
|
-
type: Component,
|
|
864
|
-
args: [{ selector: 'ngx-mat-entity-internal-input', template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of metadataAutocompleteString.autocompleteValues\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-internal-input>\n </div>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"] }]
|
|
865
|
-
}], propDecorators: { entity: [{
|
|
866
|
-
type: Input
|
|
867
|
-
}], propertyKey: [{
|
|
868
|
-
type: Input
|
|
869
|
-
}], hideOmitForCreate: [{
|
|
870
|
-
type: Input
|
|
871
|
-
}], hideOmitForEdit: [{
|
|
872
|
-
type: Input
|
|
873
|
-
}], getValidationErrorMessage: [{
|
|
874
|
-
type: Input
|
|
875
|
-
}] } });
|
|
876
|
-
|
|
877
|
-
class NgxMatEntityAddArrayItemDialogComponent {
|
|
878
|
-
constructor(inputData, dialogRef) {
|
|
879
|
-
this.inputData = inputData;
|
|
880
|
-
this.dialogRef = dialogRef;
|
|
881
|
-
this.EntityUtilities = EntityUtilities;
|
|
882
|
-
this.getWidth = EntityUtilities.getWidth;
|
|
883
985
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
986
|
+
/**
|
|
987
|
+
* Tries to add an item to the array.
|
|
988
|
+
* Does this either inline if the "createInline"-metadata is set to true
|
|
989
|
+
* or in a separate dialog if it is set to false.
|
|
990
|
+
*/
|
|
991
|
+
add() {
|
|
992
|
+
if (this.metadataEntityArray.createInline) {
|
|
993
|
+
this.entityArrayValues.push(cloneDeep(this.arrayItem));
|
|
994
|
+
this.dataSource.data = this.entityArrayValues;
|
|
995
|
+
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
996
|
+
}
|
|
997
|
+
else {
|
|
998
|
+
this.addArrayItemDialogRef = this.dialog.open(this.addArrayItemDialog, {
|
|
999
|
+
data: this.dialogData,
|
|
1000
|
+
autoFocus: false,
|
|
1001
|
+
restoreFocus: false
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
888
1004
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1005
|
+
/**
|
|
1006
|
+
* Adds the array item defined in the dialog.
|
|
1007
|
+
*/
|
|
1008
|
+
addArrayItem() {
|
|
1009
|
+
this.addArrayItemDialogRef.close();
|
|
1010
|
+
this.entityArrayValues.push(cloneDeep(this.arrayItem));
|
|
1011
|
+
this.dataSource.data = this.entityArrayValues;
|
|
1012
|
+
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
894
1013
|
}
|
|
895
|
-
|
|
896
|
-
|
|
1014
|
+
/**
|
|
1015
|
+
* Cancels adding the array item defined in the dialog.
|
|
1016
|
+
*/
|
|
1017
|
+
cancelAddArrayItem() {
|
|
1018
|
+
this.addArrayItemDialogRef.close();
|
|
1019
|
+
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
897
1020
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}], ctorParameters: function () {
|
|
908
|
-
return [{ type: undefined, decorators: [{
|
|
909
|
-
type: Inject,
|
|
910
|
-
args: [MAT_DIALOG_DATA]
|
|
911
|
-
}] }, { type: i1.MatDialogRef }];
|
|
912
|
-
} });
|
|
913
|
-
|
|
914
|
-
class NgxMatEntityArrayTableComponent {
|
|
915
|
-
constructor(dialog) {
|
|
916
|
-
this.dialog = dialog;
|
|
917
|
-
this.selection = new SelectionModel(true, []);
|
|
918
|
-
this.getWidth = EntityUtilities.getWidth;
|
|
919
|
-
this.EntityUtilities = EntityUtilities;
|
|
920
|
-
}
|
|
921
|
-
trackByFn(index) {
|
|
922
|
-
return index;
|
|
923
|
-
}
|
|
924
|
-
ngOnInit() {
|
|
925
|
-
const givenDisplayColumns = this.metadata.displayColumns.map((v) => v.displayName);
|
|
926
|
-
this.validateInput(givenDisplayColumns);
|
|
927
|
-
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
928
|
-
this.dataSource = new MatTableDataSource();
|
|
929
|
-
this.dataSource.data = this.arrayItems;
|
|
930
|
-
this.arrayItem = new this.metadata.EntityClass();
|
|
931
|
-
this.arrayItemPriorChanges = cloneDeep(this.arrayItem);
|
|
932
|
-
}
|
|
933
|
-
validateInput(givenDisplayColumns) {
|
|
934
|
-
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
935
|
-
throw new Error(`The name "select" for a display column is reserved.
|
|
936
|
-
Please choose a different name.`);
|
|
937
|
-
}
|
|
938
|
-
if (!this.metadata.createInline && !this.metadata.createDialogData) {
|
|
939
|
-
throw new Error(`Missing required Input data "createDialogData".
|
|
940
|
-
You can only omit this value when the creation is inline.`);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
add() {
|
|
944
|
-
if (this.metadata.createInline) {
|
|
945
|
-
this.arrayItems.push(cloneDeep(this.arrayItem));
|
|
946
|
-
this.dataSource.data = this.arrayItems;
|
|
947
|
-
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
948
|
-
}
|
|
949
|
-
else {
|
|
950
|
-
const dialogInputData = {
|
|
951
|
-
entity: this.arrayItem,
|
|
952
|
-
createDialogData: this.metadata.createDialogData,
|
|
953
|
-
getValidationErrorMessage: this.getValidationErrorMessage
|
|
954
|
-
};
|
|
955
|
-
const dialogData = new AddArrayItemDialogDataBuilder(dialogInputData)
|
|
956
|
-
.addArrayItemDialogData;
|
|
957
|
-
firstValueFrom(this.dialog.open(NgxMatEntityAddArrayItemDialogComponent, {
|
|
958
|
-
data: dialogData,
|
|
959
|
-
autoFocus: false,
|
|
960
|
-
restoreFocus: false
|
|
961
|
-
}).afterClosed()).then((res) => {
|
|
962
|
-
if (res === 1) {
|
|
963
|
-
this.arrayItems.push(cloneDeep(this.arrayItem));
|
|
964
|
-
this.dataSource.data = this.arrayItems;
|
|
965
|
-
}
|
|
966
|
-
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
remove() {
|
|
971
|
-
this.selection.selected.forEach(s => {
|
|
972
|
-
this.arrayItems.splice(this.arrayItems.indexOf(s), 1);
|
|
973
|
-
});
|
|
974
|
-
this.dataSource.data = this.arrayItems;
|
|
975
|
-
this.selection.clear();
|
|
976
|
-
}
|
|
977
|
-
getObjectProperties() {
|
|
978
|
-
const res = [];
|
|
979
|
-
for (const property in this.arrayItem) {
|
|
980
|
-
const metadata = EntityUtilities.getPropertyMetadata(this.arrayItem, property, EntityUtilities.getPropertyType(this.arrayItem, property));
|
|
981
|
-
if (!(metadata.omitForCreate)) {
|
|
982
|
-
res.push(property);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
return res.sort((a, b) => EntityUtilities.compareOrder(a, b, this.arrayItem));
|
|
1021
|
+
/**
|
|
1022
|
+
* Removes all selected entries from the array.
|
|
1023
|
+
*/
|
|
1024
|
+
remove() {
|
|
1025
|
+
this.selection.selected.forEach(s => {
|
|
1026
|
+
this.entityArrayValues.splice(this.entityArrayValues.indexOf(s), 1);
|
|
1027
|
+
});
|
|
1028
|
+
this.dataSource.data = this.entityArrayValues;
|
|
1029
|
+
this.selection.clear();
|
|
986
1030
|
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Toggles all array-items in the table.
|
|
1033
|
+
*/
|
|
987
1034
|
masterToggle() {
|
|
988
1035
|
if (this.isAllSelected()) {
|
|
989
1036
|
this.selection.clear();
|
|
@@ -992,93 +1039,28 @@ class NgxMatEntityArrayTableComponent {
|
|
|
992
1039
|
this.dataSource.data.forEach((row) => this.selection.select(row));
|
|
993
1040
|
}
|
|
994
1041
|
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Checks if all array-items in the table have been selected.
|
|
1044
|
+
* This is needed to display the "masterToggle"-checkbox correctly.
|
|
1045
|
+
*
|
|
1046
|
+
* @returns Whether or not all array-items in the table have been selected.
|
|
1047
|
+
*/
|
|
995
1048
|
isAllSelected() {
|
|
996
1049
|
const numSelected = this.selection.selected.length;
|
|
997
1050
|
const numRows = this.dataSource.data.length;
|
|
998
1051
|
return numSelected === numRows;
|
|
999
1052
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
type: Input
|
|
1012
|
-
}], omit: [{
|
|
1013
|
-
type: Input
|
|
1014
|
-
}] } });
|
|
1015
|
-
|
|
1016
|
-
class NgxMatEntityInputComponent {
|
|
1017
|
-
constructor() {
|
|
1018
|
-
this.chipsInput = '';
|
|
1019
|
-
this.DecoratorTypes = DecoratorTypes;
|
|
1020
|
-
this.getWidth = EntityUtilities.getWidth;
|
|
1021
|
-
}
|
|
1022
|
-
trackByFn(index) {
|
|
1023
|
-
return index;
|
|
1024
|
-
}
|
|
1025
|
-
ngOnInit() {
|
|
1026
|
-
var _a;
|
|
1027
|
-
if (!this.entity) {
|
|
1028
|
-
throw new Error('Missing required Input data "entity"');
|
|
1029
|
-
}
|
|
1030
|
-
if (!this.propertyKey) {
|
|
1031
|
-
throw new Error('Missing required Input data "propertyKey"');
|
|
1032
|
-
}
|
|
1033
|
-
this.type = EntityUtilities.getPropertyType(this.entity, this.propertyKey);
|
|
1034
|
-
this.metadata = EntityUtilities.getPropertyMetadata(this.entity, this.propertyKey, this.type);
|
|
1035
|
-
this.metadataDefaultString = this.metadata;
|
|
1036
|
-
this.metadataTextboxString = this.metadata;
|
|
1037
|
-
this.metadataAutocompleteString = this.metadata;
|
|
1038
|
-
this.autocompleteStrings = this.metadataAutocompleteString.autocompleteValues;
|
|
1039
|
-
this.filteredAutocompleteStrings = cloneDeep(this.autocompleteStrings);
|
|
1040
|
-
this.metadataDropdownString = this.metadata;
|
|
1041
|
-
this.metadataDropdownBoolean = this.metadata;
|
|
1042
|
-
this.metadataDefaultNumber = this.metadata;
|
|
1043
|
-
this.metadataDropdownNumber = this.metadata;
|
|
1044
|
-
this.metadataDefaultObject = this.metadata;
|
|
1045
|
-
this.objectProperty = this.entity[this.propertyKey];
|
|
1046
|
-
this.metadataEntityArray = this.metadata;
|
|
1047
|
-
if (this.metadataEntityArray.EntityClass) {
|
|
1048
|
-
if (!this.entity[this.propertyKey]) {
|
|
1049
|
-
this.entity[this.propertyKey] = [];
|
|
1050
|
-
}
|
|
1051
|
-
this.entityArrayValues = this.entity[this.propertyKey];
|
|
1052
|
-
if (this.metadataEntityArray.createInline === undefined) {
|
|
1053
|
-
this.metadataEntityArray.createInline = true;
|
|
1054
|
-
}
|
|
1055
|
-
if (!this.metadataEntityArray.createInline && !this.metadataEntityArray.createDialogData) {
|
|
1056
|
-
this.metadataEntityArray.createDialogData = {
|
|
1057
|
-
title: 'Add'
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
this.metadataStringChipsArray = this.metadata;
|
|
1062
|
-
if (this.metadataStringChipsArray.itemType
|
|
1063
|
-
&& ((_a = this.entity[this.propertyKey]) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1064
|
-
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
1065
|
-
}
|
|
1066
|
-
this.metadataAutocompleteStringChipsArray = this.metadata;
|
|
1067
|
-
if (!this.getValidationErrorMessage) {
|
|
1068
|
-
this.getValidationErrorMessage = getValidationErrorMessage;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
getObjectProperties() {
|
|
1072
|
-
const res = [];
|
|
1073
|
-
for (const property in this.objectProperty) {
|
|
1074
|
-
const metadata = EntityUtilities.getPropertyMetadata(this.objectProperty, property, EntityUtilities.getPropertyType(this.objectProperty, property));
|
|
1075
|
-
if (!(this.hideOmitForCreate && metadata.omitForCreate)
|
|
1076
|
-
&& !(this.hideOmitForEdit && metadata.omitForUpdate)) {
|
|
1077
|
-
res.push(property);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
return res.sort((a, b) => EntityUtilities.compareOrder(a, b, this.objectProperty));
|
|
1081
|
-
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Handles adding strings to the chipsArray.
|
|
1055
|
+
* Checks validation and also creates a new array if it is undefined.
|
|
1056
|
+
* This is needed because two things are validated: The array itself
|
|
1057
|
+
* and the contents of the array. And we need a way to display an
|
|
1058
|
+
* mat-error. As the only validation for the array is whether or not
|
|
1059
|
+
* it contains values, we can set it to undefined when the last element is removed
|
|
1060
|
+
* (removeStringChipArrayValue). That way we can use the "required" validator.
|
|
1061
|
+
*
|
|
1062
|
+
* @param event - The event that fires when a new chip is completed.
|
|
1063
|
+
*/
|
|
1082
1064
|
addStringChipArrayValue(event) {
|
|
1083
1065
|
const value = (event.value || '').trim();
|
|
1084
1066
|
if (value) {
|
|
@@ -1101,6 +1083,16 @@ class NgxMatEntityInputComponent {
|
|
|
1101
1083
|
}
|
|
1102
1084
|
event.chipInput.clear();
|
|
1103
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Removes the given value from the array.
|
|
1088
|
+
* Sets the array to undefined if it is now empty.
|
|
1089
|
+
* This is needed because two things are validated: The array itself
|
|
1090
|
+
* and the contents of the array. And we need a way to display an
|
|
1091
|
+
* mat-error. As the only validation for the array is whether or not
|
|
1092
|
+
* it is empty, setting it to undefined here enables us to use the "required" validator.
|
|
1093
|
+
*
|
|
1094
|
+
* @param value - The string to remove from the array.
|
|
1095
|
+
*/
|
|
1104
1096
|
removeStringChipArrayValue(value) {
|
|
1105
1097
|
this.stringChipsArrayValues.splice(this.stringChipsArrayValues.indexOf(value), 1);
|
|
1106
1098
|
if (!this.stringChipsArrayValues.length) {
|
|
@@ -1108,6 +1100,12 @@ class NgxMatEntityInputComponent {
|
|
|
1108
1100
|
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
1109
1101
|
}
|
|
1110
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Handles adding a string to the array when an autocomplete value has been selected.
|
|
1105
|
+
*
|
|
1106
|
+
* @param event - The autocomplete selected event.
|
|
1107
|
+
* @param chipsInput - The element where the user typed the value.
|
|
1108
|
+
*/
|
|
1111
1109
|
selected(event, chipsInput) {
|
|
1112
1110
|
const value = (event.option.viewValue || '').trim();
|
|
1113
1111
|
if (this.metadataStringChipsArray.minLength && value.length < this.metadataStringChipsArray.minLength) {
|
|
@@ -1128,17 +1126,22 @@ class NgxMatEntityInputComponent {
|
|
|
1128
1126
|
this.stringChipsArrayValues.push(value);
|
|
1129
1127
|
chipsInput.value = '';
|
|
1130
1128
|
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Dynamically filters the Autocomplete options when the user inputs something.
|
|
1131
|
+
*
|
|
1132
|
+
* @param input - The input of the user.
|
|
1133
|
+
*/
|
|
1131
1134
|
filterAutocompleteStrings(input) {
|
|
1132
1135
|
const filterValue = input.toLowerCase();
|
|
1133
1136
|
this.filteredAutocompleteStrings = this.autocompleteStrings.filter(s => s.toLowerCase().includes(filterValue));
|
|
1134
1137
|
}
|
|
1135
1138
|
}
|
|
1136
|
-
NgxMatEntityInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1137
|
-
NgxMatEntityInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: { entity: "entity", propertyKey: "propertyKey", getValidationErrorMessage: "getValidationErrorMessage", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit" }, ngImport: i0, template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"filterAutocompleteStrings(entity[propertyKey])\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Array-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY\">\n <ngx-mat-entity-array-table\n [arrayItems]=\"entityArrayValues\"\n [metadata]=\"metadataEntityArray\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [omit]=\"hideOmitForCreate ? 'create' : 'update'\"\n >\n </ngx-mat-entity-array-table>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n (keyup)=\"filterAutocompleteStrings(chipsInput)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n #chipsElement\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event, chipsElement)\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"], components: [{ type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i4.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit"] }, { type: NgxMatEntityArrayTableComponent, selector: "ngx-mat-entity-array-table", inputs: ["arrayItems", "metadata", "getValidationErrorMessage", "omit"] }, { type: i8$1.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i9.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$1.MatLabel, selector: "mat-label" }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i12.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i12.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i12.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i12.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i10.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.MatCheckboxRequiredValidator, selector: "mat-checkbox[required][formControlName], mat-checkbox[required][formControl], mat-checkbox[required][ngModel]" }, { type: i6.MatSlideToggleRequiredValidator, selector: "mat-slide-toggle[required][formControlName], mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]" }, { type: i12.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i12.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i12.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i8$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i8$1.MatChipRemove, selector: "[matChipRemove]" }, { type: i8$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i7.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
1139
|
+
NgxMatEntityInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
1140
|
+
NgxMatEntityInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: { entity: "entity", propertyKey: "propertyKey", getValidationErrorMessage: "getValidationErrorMessage", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit" }, viewQueries: [{ propertyName: "addArrayItemDialog", first: true, predicate: ["addArrayItemDialog"], descendants: true }], ngImport: i0, template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"filterAutocompleteStrings(entity[propertyKey])\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field class=\"hideUnderline\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-checkbox (click)=\"model.control.markAsTouched()\" [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\"></mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <input matInput hidden\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString() + 'Helper'\"\n #model=\"ngModel\"\n [pattern]=\"metadata.required ? 'true' : '[\\\\s\\\\S]*'\"\n [required]=\"metadata.required\">\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field class=\"hideUnderline\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-slide-toggle (click)=\"model.control.markAsTouched()\" [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\"></mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <input matInput hidden\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString() + 'Helper'\"\n #model=\"ngModel\"\n [pattern]=\"metadata.required ? 'true' : '[\\\\s\\\\S]*'\"\n [required]=\"metadata.required\">\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n\n <div class=\"row\" *ngFor=\"let row of objectPropertyRows\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys; let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Array-------------------->\n <!-------------------------------------------->\n <div class=\"entityArray\" *ngSwitchCase=\"DecoratorTypes.ARRAY\">\n <div class=\"mat-elevation-z8\" style=\"border-radius: 5px;padding: 15px;margin-bottom: 15px;margin-top: 15px;\">\n\n <div style=\"padding-bottom: 10px\">\n <b>{{metadataEntityArray.displayName}}</b>\n </div>\n <div *ngIf=\"metadataEntityArray.createInline\">\n <div class=\"row\" *ngFor=\"let row of arrayItemInlineRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys; let i = index; trackBy: trackByFn\"\n [entity]=\"arrayItem\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n class=\"col-lg-{{getWidth(arrayItem, key, 'lg')}} col-md-{{getWidth(arrayItem, key, 'md')}} col-sm-{{getWidth(arrayItem, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n \n <div class=\"buttons\">\n <button mat-raised-button\n [disabled]=\"metadataEntityArray.createInline && !EntityUtilities.isEntityValid(arrayItem, 'create')\"\n (click)=\"add()\">\n {{metadataEntityArray.addButtonLabel}}\n </button>\n <button mat-raised-button\n [disabled]=\"!selection.selected.length\"\n (click)=\"remove()\">\n {{metadataEntityArray.removeButtonLabel}}\n </button>\n </div>\n \n <mat-table [dataSource]=\"dataSource\">\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox [disabled]=\"!dataSource.data.length\" (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"></mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n \n <ng-container *ngFor=\"let dCol of metadataEntityArray.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n \n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n \n <div class=\"array-error\" *ngIf=\"metadataEntityArray.required && !dataSource.data.length\">\n {{metadataEntityArray.missingErrorMessage}}\n </div>\n </div>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove>\n <i class=\"{{metadataStringChipsArray.deleteIcon}}\"></i>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove>\n <i class=\"{{metadataStringChipsArray.deleteIcon}}\"></i>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n (keyup)=\"filterAutocompleteStrings(chipsInput)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n #chipsElement\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event, chipsElement)\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}} is not known.</div>\n</div>\n\n<!--------------------------------------------------------->\n<!--------------------Add Array Item Dialog---------------->\n<!--------------------------------------------------------->\n<ng-template #addArrayItemDialog>\n <h2 mat-dialog-title>{{dialogData.createDialogData.title}}</h2>\n\n <mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <div class=\"row\" *ngFor=\"let row of arrayItemDialogRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"dialogData.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"dialogData.getValidationErrorMessage\"\n class=\"col-lg-{{getWidth(dialogData.entity, key, 'lg')}} col-md-{{getWidth(dialogData.entity, key, 'md')}} col-sm-{{getWidth(dialogData.entity, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </form>\n </mat-dialog-content>\n\n <mat-dialog-actions>\n <button mat-raised-button (click)=\"addArrayItem()\" [disabled]=\"!EntityUtilities.isEntityValid(dialogData.entity, 'create')\">\n {{dialogData.createDialogData.createButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancelAddArrayItem()\" class=\"cancel-button\">\n {{dialogData.createDialogData.cancelButtonLabel}}\n </button>\n </mat-dialog-actions>\n\n</ng-template>", styles: ["mat-form-field{width:100%}::ng-deep .hideUnderline .mat-form-field-underline{opacity:0%}.entityArray .buttons{display:flex;justify-content:space-between;margin-bottom:10px;margin-top:5px}.entityArray mat-table{border:1px solid #E0E0E0;border-radius:5px;padding-top:5px;padding-bottom:25px}.entityArray .mat-column-select{flex:0 0 75px}.entityArray .array-error{display:flex;align-items:center;justify-content:center;margin-top:-25.8px;border:1px solid #E0E0E0;background-color:#f8d3d7;color:#721c24;height:25.8px;border-bottom-left-radius:5px;border-bottom-right-radius:5px}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i4.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i7.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i9.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: i9.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i9.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { type: i10.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }], directives: [{ type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i11.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i13.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i13.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i13.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i13.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i13.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i13.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i13.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i2.MatError, selector: "mat-error", inputs: ["id"] }, { type: i14.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i13.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i13.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i9.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i9.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i9.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i9.MatCellDef, selector: "[matCellDef]" }, { type: i9.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i9.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i9.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i10.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i10.MatChipRemove, selector: "[matChipRemove]" }, { type: i10.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i11.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i13.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i13.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i13.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
1138
1141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, decorators: [{
|
|
1139
1142
|
type: Component,
|
|
1140
|
-
args: [{ selector: 'ngx-mat-entity-input', template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"filterAutocompleteStrings(entity[propertyKey])\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Array-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY\">\n <ngx-mat-entity-array-table\n [arrayItems]=\"entityArrayValues\"\n [metadata]=\"metadataEntityArray\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [omit]=\"hideOmitForCreate ? 'create' : 'update'\"\n >\n </ngx-mat-entity-array-table>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n (keyup)=\"filterAutocompleteStrings(chipsInput)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n #chipsElement\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event, chipsElement)\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"] }]
|
|
1141
|
-
}], ctorParameters: function () { return []; }, propDecorators: { entity: [{
|
|
1143
|
+
args: [{ selector: 'ngx-mat-entity-input', template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"filterAutocompleteStrings(entity[propertyKey])\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field class=\"hideUnderline\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-checkbox (click)=\"model.control.markAsTouched()\" [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\"></mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <input matInput hidden\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString() + 'Helper'\"\n #model=\"ngModel\"\n [pattern]=\"metadata.required ? 'true' : '[\\\\s\\\\S]*'\"\n [required]=\"metadata.required\">\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field class=\"hideUnderline\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-slide-toggle (click)=\"model.control.markAsTouched()\" [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\"></mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <input matInput hidden\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString() + 'Helper'\"\n #model=\"ngModel\"\n [pattern]=\"metadata.required ? 'true' : '[\\\\s\\\\S]*'\"\n [required]=\"metadata.required\">\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n\n <div class=\"row\" *ngFor=\"let row of objectPropertyRows\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys; let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Array-------------------->\n <!-------------------------------------------->\n <div class=\"entityArray\" *ngSwitchCase=\"DecoratorTypes.ARRAY\">\n <div class=\"mat-elevation-z8\" style=\"border-radius: 5px;padding: 15px;margin-bottom: 15px;margin-top: 15px;\">\n\n <div style=\"padding-bottom: 10px\">\n <b>{{metadataEntityArray.displayName}}</b>\n </div>\n <div *ngIf=\"metadataEntityArray.createInline\">\n <div class=\"row\" *ngFor=\"let row of arrayItemInlineRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys; let i = index; trackBy: trackByFn\"\n [entity]=\"arrayItem\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n class=\"col-lg-{{getWidth(arrayItem, key, 'lg')}} col-md-{{getWidth(arrayItem, key, 'md')}} col-sm-{{getWidth(arrayItem, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n \n <div class=\"buttons\">\n <button mat-raised-button\n [disabled]=\"metadataEntityArray.createInline && !EntityUtilities.isEntityValid(arrayItem, 'create')\"\n (click)=\"add()\">\n {{metadataEntityArray.addButtonLabel}}\n </button>\n <button mat-raised-button\n [disabled]=\"!selection.selected.length\"\n (click)=\"remove()\">\n {{metadataEntityArray.removeButtonLabel}}\n </button>\n </div>\n \n <mat-table [dataSource]=\"dataSource\">\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox [disabled]=\"!dataSource.data.length\" (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"></mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n \n <ng-container *ngFor=\"let dCol of metadataEntityArray.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n \n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n \n <div class=\"array-error\" *ngIf=\"metadataEntityArray.required && !dataSource.data.length\">\n {{metadataEntityArray.missingErrorMessage}}\n </div>\n </div>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove>\n <i class=\"{{metadataStringChipsArray.deleteIcon}}\"></i>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove>\n <i class=\"{{metadataStringChipsArray.deleteIcon}}\"></i>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n (keyup)=\"filterAutocompleteStrings(chipsInput)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n #chipsElement\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event, chipsElement)\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}} is not known.</div>\n</div>\n\n<!--------------------------------------------------------->\n<!--------------------Add Array Item Dialog---------------->\n<!--------------------------------------------------------->\n<ng-template #addArrayItemDialog>\n <h2 mat-dialog-title>{{dialogData.createDialogData.title}}</h2>\n\n <mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <div class=\"row\" *ngFor=\"let row of arrayItemDialogRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"dialogData.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"dialogData.getValidationErrorMessage\"\n class=\"col-lg-{{getWidth(dialogData.entity, key, 'lg')}} col-md-{{getWidth(dialogData.entity, key, 'md')}} col-sm-{{getWidth(dialogData.entity, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </form>\n </mat-dialog-content>\n\n <mat-dialog-actions>\n <button mat-raised-button (click)=\"addArrayItem()\" [disabled]=\"!EntityUtilities.isEntityValid(dialogData.entity, 'create')\">\n {{dialogData.createDialogData.createButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancelAddArrayItem()\" class=\"cancel-button\">\n {{dialogData.createDialogData.cancelButtonLabel}}\n </button>\n </mat-dialog-actions>\n\n</ng-template>", styles: ["mat-form-field{width:100%}::ng-deep .hideUnderline .mat-form-field-underline{opacity:0%}.entityArray .buttons{display:flex;justify-content:space-between;margin-bottom:10px;margin-top:5px}.entityArray mat-table{border:1px solid #E0E0E0;border-radius:5px;padding-top:5px;padding-bottom:25px}.entityArray .mat-column-select{flex:0 0 75px}.entityArray .array-error{display:flex;align-items:center;justify-content:center;margin-top:-25.8px;border:1px solid #E0E0E0;background-color:#f8d3d7;color:#721c24;height:25.8px;border-bottom-left-radius:5px;border-bottom-right-radius:5px}\n"] }]
|
|
1144
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { entity: [{
|
|
1142
1145
|
type: Input
|
|
1143
1146
|
}], propertyKey: [{
|
|
1144
1147
|
type: Input
|
|
@@ -1148,115 +1151,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1148
1151
|
type: Input
|
|
1149
1152
|
}], hideOmitForEdit: [{
|
|
1150
1153
|
type: Input
|
|
1154
|
+
}], addArrayItemDialog: [{
|
|
1155
|
+
type: ViewChild,
|
|
1156
|
+
args: ['addArrayItemDialog']
|
|
1151
1157
|
}] } });
|
|
1152
1158
|
|
|
1153
|
-
class NgxMatEntityInternalInputModule {
|
|
1154
|
-
}
|
|
1155
|
-
NgxMatEntityInternalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1156
|
-
NgxMatEntityInternalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, declarations: [NgxMatEntityInternalInputComponent], imports: [CommonModule,
|
|
1157
|
-
MatInputModule,
|
|
1158
|
-
FormsModule,
|
|
1159
|
-
MatFormFieldModule,
|
|
1160
|
-
MatSelectModule,
|
|
1161
|
-
MatAutocompleteModule,
|
|
1162
|
-
MatCheckboxModule,
|
|
1163
|
-
MatSlideToggleModule,
|
|
1164
|
-
MatTableModule], exports: [NgxMatEntityInternalInputComponent] });
|
|
1165
|
-
NgxMatEntityInternalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, imports: [[
|
|
1166
|
-
CommonModule,
|
|
1167
|
-
MatInputModule,
|
|
1168
|
-
FormsModule,
|
|
1169
|
-
MatFormFieldModule,
|
|
1170
|
-
MatSelectModule,
|
|
1171
|
-
MatAutocompleteModule,
|
|
1172
|
-
MatCheckboxModule,
|
|
1173
|
-
MatSlideToggleModule,
|
|
1174
|
-
MatTableModule
|
|
1175
|
-
]] });
|
|
1176
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, decorators: [{
|
|
1177
|
-
type: NgModule,
|
|
1178
|
-
args: [{
|
|
1179
|
-
declarations: [NgxMatEntityInternalInputComponent],
|
|
1180
|
-
imports: [
|
|
1181
|
-
CommonModule,
|
|
1182
|
-
MatInputModule,
|
|
1183
|
-
FormsModule,
|
|
1184
|
-
MatFormFieldModule,
|
|
1185
|
-
MatSelectModule,
|
|
1186
|
-
MatAutocompleteModule,
|
|
1187
|
-
MatCheckboxModule,
|
|
1188
|
-
MatSlideToggleModule,
|
|
1189
|
-
MatTableModule
|
|
1190
|
-
],
|
|
1191
|
-
exports: [NgxMatEntityInternalInputComponent]
|
|
1192
|
-
}]
|
|
1193
|
-
}] });
|
|
1194
|
-
|
|
1195
|
-
class NgxMatEntityAddArrayItemDialogModule {
|
|
1196
|
-
}
|
|
1197
|
-
NgxMatEntityAddArrayItemDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1198
|
-
NgxMatEntityAddArrayItemDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, declarations: [NgxMatEntityAddArrayItemDialogComponent], imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule], exports: [NgxMatEntityAddArrayItemDialogComponent] });
|
|
1199
|
-
NgxMatEntityAddArrayItemDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, imports: [[CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1200
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, decorators: [{
|
|
1201
|
-
type: NgModule,
|
|
1202
|
-
args: [{
|
|
1203
|
-
declarations: [NgxMatEntityAddArrayItemDialogComponent],
|
|
1204
|
-
imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1205
|
-
exports: [NgxMatEntityAddArrayItemDialogComponent]
|
|
1206
|
-
}]
|
|
1207
|
-
}] });
|
|
1208
|
-
|
|
1209
|
-
class NgxMatEntityArrayTableModule {
|
|
1210
|
-
}
|
|
1211
|
-
NgxMatEntityArrayTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1212
|
-
NgxMatEntityArrayTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, declarations: [NgxMatEntityArrayTableComponent], imports: [CommonModule,
|
|
1213
|
-
MatInputModule,
|
|
1214
|
-
FormsModule,
|
|
1215
|
-
MatFormFieldModule,
|
|
1216
|
-
MatSelectModule,
|
|
1217
|
-
MatAutocompleteModule,
|
|
1218
|
-
MatCheckboxModule,
|
|
1219
|
-
MatSlideToggleModule,
|
|
1220
|
-
MatTableModule,
|
|
1221
|
-
NgxMatEntityInternalInputModule,
|
|
1222
|
-
MatButtonModule,
|
|
1223
|
-
NgxMatEntityAddArrayItemDialogModule], exports: [NgxMatEntityArrayTableComponent] });
|
|
1224
|
-
NgxMatEntityArrayTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, imports: [[
|
|
1225
|
-
CommonModule,
|
|
1226
|
-
MatInputModule,
|
|
1227
|
-
FormsModule,
|
|
1228
|
-
MatFormFieldModule,
|
|
1229
|
-
MatSelectModule,
|
|
1230
|
-
MatAutocompleteModule,
|
|
1231
|
-
MatCheckboxModule,
|
|
1232
|
-
MatSlideToggleModule,
|
|
1233
|
-
MatTableModule,
|
|
1234
|
-
NgxMatEntityInternalInputModule,
|
|
1235
|
-
MatButtonModule,
|
|
1236
|
-
NgxMatEntityAddArrayItemDialogModule
|
|
1237
|
-
]] });
|
|
1238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, decorators: [{
|
|
1239
|
-
type: NgModule,
|
|
1240
|
-
args: [{
|
|
1241
|
-
declarations: [NgxMatEntityArrayTableComponent],
|
|
1242
|
-
imports: [
|
|
1243
|
-
CommonModule,
|
|
1244
|
-
MatInputModule,
|
|
1245
|
-
FormsModule,
|
|
1246
|
-
MatFormFieldModule,
|
|
1247
|
-
MatSelectModule,
|
|
1248
|
-
MatAutocompleteModule,
|
|
1249
|
-
MatCheckboxModule,
|
|
1250
|
-
MatSlideToggleModule,
|
|
1251
|
-
MatTableModule,
|
|
1252
|
-
NgxMatEntityInternalInputModule,
|
|
1253
|
-
MatButtonModule,
|
|
1254
|
-
NgxMatEntityAddArrayItemDialogModule
|
|
1255
|
-
],
|
|
1256
|
-
exports: [NgxMatEntityArrayTableComponent]
|
|
1257
|
-
}]
|
|
1258
|
-
}] });
|
|
1259
|
-
|
|
1260
1159
|
class NgxMatEntityInputModule {
|
|
1261
1160
|
}
|
|
1262
1161
|
NgxMatEntityInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1268,9 +1167,11 @@ NgxMatEntityInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
|
|
|
1268
1167
|
MatAutocompleteModule,
|
|
1269
1168
|
MatCheckboxModule,
|
|
1270
1169
|
MatSlideToggleModule,
|
|
1271
|
-
NgxMatEntityArrayTableModule,
|
|
1272
1170
|
MatChipsModule,
|
|
1273
|
-
MatIconModule
|
|
1171
|
+
MatIconModule,
|
|
1172
|
+
MatTableModule,
|
|
1173
|
+
MatDialogModule,
|
|
1174
|
+
MatButtonModule], exports: [NgxMatEntityInputComponent] });
|
|
1274
1175
|
NgxMatEntityInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, imports: [[
|
|
1275
1176
|
CommonModule,
|
|
1276
1177
|
MatInputModule,
|
|
@@ -1280,14 +1181,18 @@ NgxMatEntityInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
1280
1181
|
MatAutocompleteModule,
|
|
1281
1182
|
MatCheckboxModule,
|
|
1282
1183
|
MatSlideToggleModule,
|
|
1283
|
-
NgxMatEntityArrayTableModule,
|
|
1284
1184
|
MatChipsModule,
|
|
1285
|
-
MatIconModule
|
|
1185
|
+
MatIconModule,
|
|
1186
|
+
MatTableModule,
|
|
1187
|
+
MatDialogModule,
|
|
1188
|
+
MatButtonModule
|
|
1286
1189
|
]] });
|
|
1287
1190
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, decorators: [{
|
|
1288
1191
|
type: NgModule,
|
|
1289
1192
|
args: [{
|
|
1290
|
-
declarations: [
|
|
1193
|
+
declarations: [
|
|
1194
|
+
NgxMatEntityInputComponent,
|
|
1195
|
+
],
|
|
1291
1196
|
imports: [
|
|
1292
1197
|
CommonModule,
|
|
1293
1198
|
MatInputModule,
|
|
@@ -1297,14 +1202,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1297
1202
|
MatAutocompleteModule,
|
|
1298
1203
|
MatCheckboxModule,
|
|
1299
1204
|
MatSlideToggleModule,
|
|
1300
|
-
NgxMatEntityArrayTableModule,
|
|
1301
1205
|
MatChipsModule,
|
|
1302
|
-
MatIconModule
|
|
1206
|
+
MatIconModule,
|
|
1207
|
+
MatTableModule,
|
|
1208
|
+
MatDialogModule,
|
|
1209
|
+
MatButtonModule
|
|
1303
1210
|
],
|
|
1304
1211
|
exports: [NgxMatEntityInputComponent]
|
|
1305
1212
|
}]
|
|
1306
1213
|
}] });
|
|
1307
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* The internal CreateEntityDialogData. Requires all default values the user can leave out.
|
|
1217
|
+
*/
|
|
1308
1218
|
class CreateEntityDialogDataInternal {
|
|
1309
1219
|
constructor(entity, EntityServiceClass, createDialogData) {
|
|
1310
1220
|
this.entity = entity;
|
|
@@ -1312,16 +1222,26 @@ class CreateEntityDialogDataInternal {
|
|
|
1312
1222
|
this.createDialogData = createDialogData;
|
|
1313
1223
|
}
|
|
1314
1224
|
}
|
|
1315
|
-
|
|
1225
|
+
/**
|
|
1226
|
+
* The Builder for the CreateEntityDialogData. Sets default values.
|
|
1227
|
+
*/
|
|
1228
|
+
class CreateEntityDialogDataBuilder extends BaseBuilder {
|
|
1316
1229
|
constructor(data) {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1230
|
+
super(data);
|
|
1231
|
+
}
|
|
1232
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1233
|
+
generateBaseData(data) {
|
|
1234
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).getResult();
|
|
1235
|
+
return new CreateEntityDialogDataInternal(data.entity, data.EntityServiceClass, createDialogData);
|
|
1322
1236
|
}
|
|
1323
1237
|
}
|
|
1324
1238
|
|
|
1239
|
+
/**
|
|
1240
|
+
* The default dialog used to create new entities based on the configuration passed in the MAT_DIALOG_DATA "inputData".
|
|
1241
|
+
* Used by the ngx-mat-entity-table.
|
|
1242
|
+
*
|
|
1243
|
+
* It offers a lot of customization options which can be found in "CreateEntityDialogData".
|
|
1244
|
+
*/
|
|
1325
1245
|
class NgxMatEntityCreateDialogComponent {
|
|
1326
1246
|
constructor(inputData, dialogRef, injector, dialog) {
|
|
1327
1247
|
this.inputData = inputData;
|
|
@@ -1332,33 +1252,31 @@ class NgxMatEntityCreateDialogComponent {
|
|
|
1332
1252
|
this.getWidth = EntityUtilities.getWidth;
|
|
1333
1253
|
}
|
|
1334
1254
|
ngOnInit() {
|
|
1335
|
-
this.data = new CreateEntityDialogDataBuilder(this.inputData).
|
|
1255
|
+
this.data = new CreateEntityDialogDataBuilder(this.inputData).getResult();
|
|
1336
1256
|
this.dialogRef.disableClose = true;
|
|
1337
|
-
this.
|
|
1257
|
+
this.entityRows = EntityUtilities.getEntityRows(this.data.entity, true);
|
|
1338
1258
|
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1339
1259
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1345
|
-
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Tries add the new entity and close the dialog afterwards.
|
|
1262
|
+
* Also handles the confirmation if required.
|
|
1263
|
+
*/
|
|
1346
1264
|
create() {
|
|
1347
1265
|
var _a, _b;
|
|
1348
1266
|
if (!((_a = this.data.createDialogData) === null || _a === void 0 ? void 0 : _a.createRequiresConfirmDialog)) {
|
|
1349
1267
|
return this.confirmCreate();
|
|
1350
1268
|
}
|
|
1351
1269
|
const dialogData = new ConfirmDialogDataBuilder((_b = this.data.createDialogData) === null || _b === void 0 ? void 0 : _b.confirmCreateDialogData)
|
|
1352
|
-
.
|
|
1353
|
-
.
|
|
1354
|
-
.
|
|
1355
|
-
.
|
|
1356
|
-
const
|
|
1270
|
+
.withDefault('text', ['Do you really want to create this entity?'])
|
|
1271
|
+
.withDefault('confirmButtonLabel', 'Create')
|
|
1272
|
+
.withDefault('title', 'Create')
|
|
1273
|
+
.getResult();
|
|
1274
|
+
const dialogRef = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1357
1275
|
data: dialogData,
|
|
1358
1276
|
autoFocus: false,
|
|
1359
1277
|
restoreFocus: false
|
|
1360
1278
|
});
|
|
1361
|
-
|
|
1279
|
+
dialogRef.afterClosed().subscribe((res) => {
|
|
1362
1280
|
if (res === 1) {
|
|
1363
1281
|
this.confirmCreate();
|
|
1364
1282
|
}
|
|
@@ -1367,15 +1285,18 @@ class NgxMatEntityCreateDialogComponent {
|
|
|
1367
1285
|
confirmCreate() {
|
|
1368
1286
|
this.entityService.create(this.data.entity).then(() => this.dialogRef.close());
|
|
1369
1287
|
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Closes the dialog.
|
|
1290
|
+
*/
|
|
1370
1291
|
cancel() {
|
|
1371
1292
|
this.dialogRef.close();
|
|
1372
1293
|
}
|
|
1373
1294
|
}
|
|
1374
1295
|
NgxMatEntityCreateDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i0.Injector }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
1375
|
-
NgxMatEntityCreateDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityCreateDialogComponent, selector: "ngx-mat-entity-create-dialog", ngImport: i0, template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n
|
|
1296
|
+
NgxMatEntityCreateDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityCreateDialogComponent, selector: "ngx-mat-entity-create-dialog", ngImport: i0, template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\">\n <div class=\"row\" *ngFor=\"let row of entityRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n class=\"col-lg-{{getWidth(data.entity, key, 'lg')}} col-md-{{getWidth(data.entity, key, 'md')}} col-sm-{{getWidth(data.entity, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </form>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-raised-button (click)=\"create()\" [disabled]=\"!EntityUtilities.isEntityValid(data.entity, 'create')\">\n {{data.createDialogData.createButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.createDialogData.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}\n"], components: [{ type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i13.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i13.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i13.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
1376
1297
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogComponent, decorators: [{
|
|
1377
1298
|
type: Component,
|
|
1378
|
-
args: [{ selector: 'ngx-mat-entity-create-dialog', template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n
|
|
1299
|
+
args: [{ selector: 'ngx-mat-entity-create-dialog', template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\">\n <div class=\"row\" *ngFor=\"let row of entityRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n class=\"col-lg-{{getWidth(data.entity, key, 'lg')}} col-md-{{getWidth(data.entity, key, 'md')}} col-sm-{{getWidth(data.entity, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </form>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-raised-button (click)=\"create()\" [disabled]=\"!EntityUtilities.isEntityValid(data.entity, 'create')\">\n {{data.createDialogData.createButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.createDialogData.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}\n"] }]
|
|
1379
1300
|
}], ctorParameters: function () {
|
|
1380
1301
|
return [{ type: undefined, decorators: [{
|
|
1381
1302
|
type: Inject,
|
|
@@ -1383,6 +1304,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1383
1304
|
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }];
|
|
1384
1305
|
} });
|
|
1385
1306
|
|
|
1307
|
+
/**
|
|
1308
|
+
* The internal EditDialogData. Requires all default values the user can leave out.
|
|
1309
|
+
*/
|
|
1386
1310
|
class EditDialogDataInternal {
|
|
1387
1311
|
constructor(title, confirmButtonLabel, deleteButtonLabel, cancelButtonLabel, deleteRequiresConfirmDialog, editRequiresConfirmDialog, confirmDeleteDialogData, confirmEditDialogData) {
|
|
1388
1312
|
this.title = title;
|
|
@@ -1395,82 +1319,33 @@ class EditDialogDataInternal {
|
|
|
1395
1319
|
this.confirmEditDialogData = confirmEditDialogData;
|
|
1396
1320
|
}
|
|
1397
1321
|
}
|
|
1398
|
-
|
|
1322
|
+
/**
|
|
1323
|
+
* The Builder for the EditDialogData. Sets default values.
|
|
1324
|
+
*/
|
|
1325
|
+
class EditDialogDataBuilder extends BaseBuilder {
|
|
1399
1326
|
constructor(data) {
|
|
1400
|
-
|
|
1401
|
-
|
|
1327
|
+
super(data);
|
|
1328
|
+
}
|
|
1329
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1330
|
+
generateBaseData(data) {
|
|
1402
1331
|
const confirmEditDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmEditDialogData)
|
|
1403
|
-
.
|
|
1404
|
-
.
|
|
1405
|
-
.
|
|
1406
|
-
.
|
|
1332
|
+
.withDefault('confirmButtonLabel', 'Save')
|
|
1333
|
+
.withDefault('text', ['Do you really want to save all changes?'])
|
|
1334
|
+
.withDefault('title', 'Edit')
|
|
1335
|
+
.getResult();
|
|
1407
1336
|
const confirmDeleteDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmDeleteDialogData)
|
|
1408
|
-
.
|
|
1409
|
-
.
|
|
1410
|
-
.
|
|
1411
|
-
.
|
|
1412
|
-
.
|
|
1413
|
-
|
|
1414
|
-
return this;
|
|
1415
|
-
}
|
|
1416
|
-
withDefaultTitle(title) {
|
|
1417
|
-
var _a;
|
|
1418
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
1419
|
-
this.editDialogData.title = title;
|
|
1420
|
-
}
|
|
1421
|
-
return this;
|
|
1422
|
-
}
|
|
1423
|
-
withDefaultConfirmButtonLabel(label) {
|
|
1424
|
-
var _a;
|
|
1425
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmButtonLabel)) {
|
|
1426
|
-
this.editDialogData.confirmButtonLabel = label;
|
|
1427
|
-
}
|
|
1428
|
-
return this;
|
|
1429
|
-
}
|
|
1430
|
-
withDefaultDeleteButtonLabel(label) {
|
|
1431
|
-
var _a;
|
|
1432
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.deleteButtonLabel)) {
|
|
1433
|
-
this.editDialogData.deleteButtonLabel = label;
|
|
1434
|
-
}
|
|
1435
|
-
return this;
|
|
1436
|
-
}
|
|
1437
|
-
withDefaultCancelButtonLabel(label) {
|
|
1438
|
-
var _a;
|
|
1439
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.cancelButtonLabel)) {
|
|
1440
|
-
this.editDialogData.cancelButtonLabel = label;
|
|
1441
|
-
}
|
|
1442
|
-
return this;
|
|
1443
|
-
}
|
|
1444
|
-
withDefaultDeleteRequiresConfirmDialog(deleteRequiresConfirmDialog) {
|
|
1445
|
-
var _a;
|
|
1446
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.deleteRequiresConfirmDialog)) {
|
|
1447
|
-
this.editDialogData.deleteRequiresConfirmDialog = deleteRequiresConfirmDialog;
|
|
1448
|
-
}
|
|
1449
|
-
return this;
|
|
1450
|
-
}
|
|
1451
|
-
withDefaultEditRequiresConfirmDialog(editRequiresConfirmDialog) {
|
|
1452
|
-
var _a;
|
|
1453
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.editRequiresConfirmDialog)) {
|
|
1454
|
-
this.editDialogData.editRequiresConfirmDialog = editRequiresConfirmDialog;
|
|
1455
|
-
}
|
|
1456
|
-
return this;
|
|
1457
|
-
}
|
|
1458
|
-
withDefaultConfirmDeleteDialogData(confirmDeleteDialogData) {
|
|
1459
|
-
var _a;
|
|
1460
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmDeleteDialogData)) {
|
|
1461
|
-
this.editDialogData.confirmDeleteDialogData = confirmDeleteDialogData;
|
|
1462
|
-
}
|
|
1463
|
-
return this;
|
|
1464
|
-
}
|
|
1465
|
-
withDefaultConfirmEditDialogData(confirmEditDialogData) {
|
|
1466
|
-
var _a;
|
|
1467
|
-
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmEditDialogData)) {
|
|
1468
|
-
this.editDialogData.confirmEditDialogData = confirmEditDialogData;
|
|
1469
|
-
}
|
|
1470
|
-
return this;
|
|
1337
|
+
.withDefault('confirmButtonLabel', 'Delete')
|
|
1338
|
+
.withDefault('type', 'delete')
|
|
1339
|
+
.withDefault('text', ['Do you really want to delete this entity?'])
|
|
1340
|
+
.withDefault('title', 'Delete')
|
|
1341
|
+
.getResult();
|
|
1342
|
+
return new EditDialogDataInternal((data === null || data === void 0 ? void 0 : data.title) ? data.title : () => 'Edit', (data === null || data === void 0 ? void 0 : data.confirmButtonLabel) ? data.confirmButtonLabel : 'Save', (data === null || data === void 0 ? void 0 : data.deleteButtonLabel) ? data.deleteButtonLabel : 'Delete', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.deleteRequiresConfirmDialog) ? data.deleteRequiresConfirmDialog : true, (data === null || data === void 0 ? void 0 : data.editRequiresConfirmDialog) ? data.editRequiresConfirmDialog : false, confirmDeleteDialogData, confirmEditDialogData);
|
|
1471
1343
|
}
|
|
1472
1344
|
}
|
|
1473
1345
|
|
|
1346
|
+
/**
|
|
1347
|
+
* The internal EditEntityDialogData. Requires all default values the user can leave out.
|
|
1348
|
+
*/
|
|
1474
1349
|
class EditEntityDialogDataInternal {
|
|
1475
1350
|
constructor(entity, EntityServiceClass, editDialogData, allowDelete) {
|
|
1476
1351
|
this.entity = entity;
|
|
@@ -1479,16 +1354,26 @@ class EditEntityDialogDataInternal {
|
|
|
1479
1354
|
this.allowDelete = allowDelete;
|
|
1480
1355
|
}
|
|
1481
1356
|
}
|
|
1482
|
-
|
|
1357
|
+
/**
|
|
1358
|
+
* The Builder for the EditEntityDialogData. Sets default values.
|
|
1359
|
+
*/
|
|
1360
|
+
class EditEntityDialogDataBuilder extends BaseBuilder {
|
|
1483
1361
|
constructor(data) {
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1362
|
+
super(data);
|
|
1363
|
+
}
|
|
1364
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1365
|
+
generateBaseData(data) {
|
|
1366
|
+
const editDialogData = new EditDialogDataBuilder(data.editDialogData).getResult();
|
|
1367
|
+
return new EditEntityDialogDataInternal(data.entity, data.EntityServiceClass, editDialogData, data.allowDelete ? data.allowDelete : () => true);
|
|
1489
1368
|
}
|
|
1490
1369
|
}
|
|
1491
1370
|
|
|
1371
|
+
/**
|
|
1372
|
+
* The default dialog used to edit an existing entity based on the configuration passed in the MAT_DIALOG_DATA "inputData".
|
|
1373
|
+
* Used by the ngx-mat-entity-table.
|
|
1374
|
+
*
|
|
1375
|
+
* It offers a lot of customization options which can be found in "EditEntityDialogData".
|
|
1376
|
+
*/
|
|
1492
1377
|
class NgxMatEntityEditDialogComponent {
|
|
1493
1378
|
constructor(inputData, dialogRef, injector, dialog) {
|
|
1494
1379
|
this.inputData = inputData;
|
|
@@ -1499,33 +1384,31 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1499
1384
|
this.getWidth = EntityUtilities.getWidth;
|
|
1500
1385
|
}
|
|
1501
1386
|
ngOnInit() {
|
|
1502
|
-
this.data = new EditEntityDialogDataBuilder(this.inputData).
|
|
1387
|
+
this.data = new EditEntityDialogDataBuilder(this.inputData).getResult();
|
|
1503
1388
|
this.dialogRef.disableClose = true;
|
|
1504
|
-
this.
|
|
1389
|
+
this.entityRows = EntityUtilities.getEntityRows(this.data.entity, false, true);
|
|
1505
1390
|
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1506
1391
|
this.entityPriorChanges = cloneDeep(this.data.entity);
|
|
1507
1392
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1513
|
-
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Tries to save the changes and close the dialog afterwards.
|
|
1395
|
+
* Also handles the confirmation if required.
|
|
1396
|
+
*/
|
|
1514
1397
|
edit() {
|
|
1515
1398
|
if (!this.data.editDialogData.editRequiresConfirmDialog) {
|
|
1516
1399
|
return this.confirmEdit();
|
|
1517
1400
|
}
|
|
1518
1401
|
const dialogData = new ConfirmDialogDataBuilder(this.data.editDialogData.confirmEditDialogData)
|
|
1519
|
-
.
|
|
1520
|
-
.
|
|
1521
|
-
.
|
|
1522
|
-
.
|
|
1523
|
-
const
|
|
1402
|
+
.withDefault('text', ['Do you really want to save all changes?'])
|
|
1403
|
+
.withDefault('confirmButtonLabel', 'Save')
|
|
1404
|
+
.withDefault('title', 'Edit')
|
|
1405
|
+
.getResult();
|
|
1406
|
+
const dialogRef = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1524
1407
|
data: dialogData,
|
|
1525
1408
|
autoFocus: false,
|
|
1526
1409
|
restoreFocus: false
|
|
1527
1410
|
});
|
|
1528
|
-
|
|
1411
|
+
dialogRef.afterClosed().subscribe((res) => {
|
|
1529
1412
|
if (res === 1) {
|
|
1530
1413
|
this.confirmEdit();
|
|
1531
1414
|
}
|
|
@@ -1534,22 +1417,26 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1534
1417
|
confirmEdit() {
|
|
1535
1418
|
this.entityService.update(this.data.entity, this.entityPriorChanges).then(() => this.dialogRef.close(1));
|
|
1536
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Tries to delete the entity and close the dialog afterwards.
|
|
1422
|
+
* Also handles the confirmation if required.
|
|
1423
|
+
*/
|
|
1537
1424
|
delete() {
|
|
1538
1425
|
if (!this.data.editDialogData.deleteRequiresConfirmDialog) {
|
|
1539
1426
|
return this.confirmDelete();
|
|
1540
1427
|
}
|
|
1541
1428
|
const dialogData = new ConfirmDialogDataBuilder(this.data.editDialogData.confirmDeleteDialogData)
|
|
1542
|
-
.
|
|
1543
|
-
.
|
|
1544
|
-
.
|
|
1545
|
-
.
|
|
1546
|
-
.
|
|
1547
|
-
const
|
|
1429
|
+
.withDefault('text', ['Do you really want to delete this entity?'])
|
|
1430
|
+
.withDefault('type', 'delete')
|
|
1431
|
+
.withDefault('confirmButtonLabel', 'Delete')
|
|
1432
|
+
.withDefault('title', 'Delete')
|
|
1433
|
+
.getResult();
|
|
1434
|
+
const dialogRef = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1548
1435
|
data: dialogData,
|
|
1549
1436
|
autoFocus: false,
|
|
1550
1437
|
restoreFocus: false
|
|
1551
1438
|
});
|
|
1552
|
-
|
|
1439
|
+
dialogRef.afterClosed().subscribe((res) => {
|
|
1553
1440
|
if (res === 1) {
|
|
1554
1441
|
this.confirmDelete();
|
|
1555
1442
|
}
|
|
@@ -1558,16 +1445,19 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1558
1445
|
confirmDelete() {
|
|
1559
1446
|
this.entityService.delete(this.entityPriorChanges.id).then(() => this.dialogRef.close(2));
|
|
1560
1447
|
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Reverts all changes made and closes the dialog.
|
|
1450
|
+
*/
|
|
1561
1451
|
cancel() {
|
|
1562
1452
|
EntityUtilities.resetChangesOnEntity(this.data.entity, this.entityPriorChanges);
|
|
1563
1453
|
this.dialogRef.close(0);
|
|
1564
1454
|
}
|
|
1565
1455
|
}
|
|
1566
1456
|
NgxMatEntityEditDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i0.Injector }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
1567
|
-
NgxMatEntityEditDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityEditDialogComponent, selector: "ngx-mat-entity-edit-dialog", ngImport: i0, template: "<h2 mat-dialog-title>\n {{data.editDialogData.title(data.entity)}}\n <button *ngIf=\"data.allowDelete(data.entity)\" mat-raised-button (click)=\"delete()\" color=\"warn\" class=\"delete-button\" tabindex=\"-1\">\n {{data.editDialogData.deleteButtonLabel}}\n </button>\n</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-input\n
|
|
1457
|
+
NgxMatEntityEditDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityEditDialogComponent, selector: "ngx-mat-entity-edit-dialog", ngImport: i0, template: "<h2 mat-dialog-title>\n {{data.editDialogData.title(data.entity)}}\n <button *ngIf=\"data.allowDelete(data.entity)\" mat-raised-button (click)=\"delete()\" color=\"warn\" class=\"delete-button\" tabindex=\"-1\">\n {{data.editDialogData.deleteButtonLabel}}\n </button>\n</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <div class=\"row\" *ngFor=\"let row of entityRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"true\"\n class=\"col-lg-{{getWidth(data.entity, key, 'lg')}} col-md-{{getWidth(data.entity, key, 'md')}} col-sm-{{getWidth(data.entity, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </form>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-raised-button (click)=\"edit()\" [disabled]=\"!EntityUtilities.isEntityValid(data.entity, 'update') || !EntityUtilities.dirty(data.entity, entityPriorChanges)\">\n {{data.editDialogData.confirmButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.editDialogData.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}.delete-button{float:right}\n"], components: [{ type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i13.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i13.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i13.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
1568
1458
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogComponent, decorators: [{
|
|
1569
1459
|
type: Component,
|
|
1570
|
-
args: [{ selector: 'ngx-mat-entity-edit-dialog', template: "<h2 mat-dialog-title>\n {{data.editDialogData.title(data.entity)}}\n <button *ngIf=\"data.allowDelete(data.entity)\" mat-raised-button (click)=\"delete()\" color=\"warn\" class=\"delete-button\" tabindex=\"-1\">\n {{data.editDialogData.deleteButtonLabel}}\n </button>\n</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-input\n
|
|
1460
|
+
args: [{ selector: 'ngx-mat-entity-edit-dialog', template: "<h2 mat-dialog-title>\n {{data.editDialogData.title(data.entity)}}\n <button *ngIf=\"data.allowDelete(data.entity)\" mat-raised-button (click)=\"delete()\" color=\"warn\" class=\"delete-button\" tabindex=\"-1\">\n {{data.editDialogData.deleteButtonLabel}}\n </button>\n</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <div class=\"row\" *ngFor=\"let row of entityRows\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"true\"\n class=\"col-lg-{{getWidth(data.entity, key, 'lg')}} col-md-{{getWidth(data.entity, key, 'md')}} col-sm-{{getWidth(data.entity, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </form>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-raised-button (click)=\"edit()\" [disabled]=\"!EntityUtilities.isEntityValid(data.entity, 'update') || !EntityUtilities.dirty(data.entity, entityPriorChanges)\">\n {{data.editDialogData.confirmButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.editDialogData.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}.delete-button{float:right}\n"] }]
|
|
1571
1461
|
}], ctorParameters: function () {
|
|
1572
1462
|
return [{ type: undefined, decorators: [{
|
|
1573
1463
|
type: Inject,
|
|
@@ -1575,6 +1465,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1575
1465
|
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }];
|
|
1576
1466
|
} });
|
|
1577
1467
|
|
|
1468
|
+
/**
|
|
1469
|
+
* The internal TableData. Requires all default values the user can leave out.
|
|
1470
|
+
*/
|
|
1578
1471
|
class TableDataInternal {
|
|
1579
1472
|
constructor(baseData, createDialogData, editDialogData) {
|
|
1580
1473
|
this.baseData = baseData;
|
|
@@ -1582,14 +1475,21 @@ class TableDataInternal {
|
|
|
1582
1475
|
this.editDialogData = editDialogData;
|
|
1583
1476
|
}
|
|
1584
1477
|
}
|
|
1585
|
-
|
|
1478
|
+
/**
|
|
1479
|
+
* The Builder for the table BaseData. Sets default values.
|
|
1480
|
+
*/
|
|
1481
|
+
class BaseDataBuilder extends BaseBuilder {
|
|
1586
1482
|
constructor(data) {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1483
|
+
super(data);
|
|
1484
|
+
}
|
|
1485
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1486
|
+
generateBaseData(data) {
|
|
1487
|
+
return new BaseDataInternal(data.title, data.displayColumns, data.EntityServiceClass, data.searchLabel ? data.searchLabel : 'Search', data.createButtonLabel ? data.createButtonLabel : 'Create', data.searchString ? data.searchString : defaultSearchFunction, data.allowCreate === false ? data.allowCreate : true, data.allowEdit ? data.allowEdit : () => true, data.allowDelete ? data.allowDelete : () => true, data.multiSelectActions ? data.multiSelectActions : [], data.multiSelectLabel ? data.multiSelectLabel : 'Actions', data.EntityClass, data.edit, data.create);
|
|
1591
1488
|
}
|
|
1592
1489
|
}
|
|
1490
|
+
/**
|
|
1491
|
+
* The internal TableData. Requires all default values the user can leave out.
|
|
1492
|
+
*/
|
|
1593
1493
|
class BaseDataInternal {
|
|
1594
1494
|
constructor(title, displayColumns, EntityServiceClass, searchLabel, createButtonLabel, searchString, allowCreate, allowEdit, allowDelete, multiSelectActions, multiSelectLabel, EntityClass, edit, create) {
|
|
1595
1495
|
this.title = title;
|
|
@@ -1608,16 +1508,21 @@ class BaseDataInternal {
|
|
|
1608
1508
|
this.create = create;
|
|
1609
1509
|
}
|
|
1610
1510
|
}
|
|
1611
|
-
|
|
1511
|
+
/**
|
|
1512
|
+
* The Builder for the complete TableData. Sets default values and validates user input.
|
|
1513
|
+
*/
|
|
1514
|
+
class TableDataBuilder extends BaseBuilder {
|
|
1612
1515
|
constructor(data) {
|
|
1613
|
-
|
|
1614
|
-
this.dataInput = data;
|
|
1615
|
-
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).createDialogData;
|
|
1616
|
-
const editDialogData = new EditDialogDataBuilder(data.editDialogData).editDialogData;
|
|
1617
|
-
const baseData = new BaseDataBuilder(data.baseData).baseData;
|
|
1618
|
-
this.tableData = new TableDataInternal(baseData, createDialogData, editDialogData);
|
|
1619
|
-
return this;
|
|
1516
|
+
super(data);
|
|
1620
1517
|
}
|
|
1518
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1519
|
+
generateBaseData(data) {
|
|
1520
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).getResult();
|
|
1521
|
+
const editDialogData = new EditDialogDataBuilder(data.editDialogData).getResult();
|
|
1522
|
+
const baseData = new BaseDataBuilder(data.baseData).getResult();
|
|
1523
|
+
return new TableDataInternal(baseData, createDialogData, editDialogData);
|
|
1524
|
+
}
|
|
1525
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1621
1526
|
validateInput(data) {
|
|
1622
1527
|
var _a;
|
|
1623
1528
|
if (((_a = data.baseData.multiSelectActions) === null || _a === void 0 ? void 0 : _a.length) && data.baseData.displayColumns.find(dp => dp.displayName === 'select')) {
|
|
@@ -1663,6 +1568,12 @@ function defaultSearchFunction(entity) {
|
|
|
1663
1568
|
return searchString;
|
|
1664
1569
|
}
|
|
1665
1570
|
|
|
1571
|
+
/**
|
|
1572
|
+
* Generates a fully functional table for displaying, creating, updating and deleting entities
|
|
1573
|
+
* based on the configuration passed in the @Input "tableData".
|
|
1574
|
+
*
|
|
1575
|
+
* It offers a lot of customization options which can be found in "TableData".
|
|
1576
|
+
*/
|
|
1666
1577
|
class NgxMatEntityTableComponent {
|
|
1667
1578
|
constructor(dialog, injector) {
|
|
1668
1579
|
this.dialog = dialog;
|
|
@@ -1671,8 +1582,11 @@ class NgxMatEntityTableComponent {
|
|
|
1671
1582
|
this.dataSource = new MatTableDataSource();
|
|
1672
1583
|
this.selection = new SelectionModel(true, []);
|
|
1673
1584
|
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Sets up all the configuration for the table and the EntityService.
|
|
1587
|
+
*/
|
|
1674
1588
|
ngOnInit() {
|
|
1675
|
-
this.data = new TableDataBuilder(this.tableData).
|
|
1589
|
+
this.data = new TableDataBuilder(this.tableData).getResult();
|
|
1676
1590
|
this.entityService = this.injector.get(this.data.baseData.EntityServiceClass);
|
|
1677
1591
|
const givenDisplayColumns = this.data.baseData.displayColumns.map((v) => v.displayName);
|
|
1678
1592
|
if (this.data.baseData.multiSelectActions.length) {
|
|
@@ -1702,6 +1616,12 @@ class NgxMatEntityTableComponent {
|
|
|
1702
1616
|
});
|
|
1703
1617
|
this.entityService.read();
|
|
1704
1618
|
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Edits an entity. This either calls the edit-Method provided by the user or uses a default edit-dialog.
|
|
1621
|
+
*
|
|
1622
|
+
* @param entity - The entity that should be updated.
|
|
1623
|
+
* @throws When no EntityClass was provided, as a new call is needed to initialize metadata.
|
|
1624
|
+
*/
|
|
1705
1625
|
editEntity(entity) {
|
|
1706
1626
|
if (this.data.baseData.allowEdit(entity)) {
|
|
1707
1627
|
if (!this.data.baseData.EntityClass) {
|
|
@@ -1722,7 +1642,7 @@ class NgxMatEntityTableComponent {
|
|
|
1722
1642
|
allowDelete: this.data.baseData.allowDelete,
|
|
1723
1643
|
editDialogData: this.data.editDialogData
|
|
1724
1644
|
};
|
|
1725
|
-
const dialogData = new EditEntityDialogDataBuilder(inputDialogData).
|
|
1645
|
+
const dialogData = new EditEntityDialogDataBuilder(inputDialogData).getResult();
|
|
1726
1646
|
firstValueFrom(this.dialog.open(NgxMatEntityEditDialogComponent, {
|
|
1727
1647
|
data: dialogData,
|
|
1728
1648
|
minWidth: '60%',
|
|
@@ -1737,6 +1657,11 @@ class NgxMatEntityTableComponent {
|
|
|
1737
1657
|
}
|
|
1738
1658
|
});
|
|
1739
1659
|
}
|
|
1660
|
+
/**
|
|
1661
|
+
* Creates a new Entity. This either calls the create-Method provided by the user or uses a default create-dialog.
|
|
1662
|
+
*
|
|
1663
|
+
* @throws When no EntityClass was provided, as a new call is needed to initialize metadata.
|
|
1664
|
+
*/
|
|
1740
1665
|
createEntity() {
|
|
1741
1666
|
if (this.data.baseData.allowCreate) {
|
|
1742
1667
|
if (!this.data.baseData.EntityClass) {
|
|
@@ -1755,7 +1680,7 @@ class NgxMatEntityTableComponent {
|
|
|
1755
1680
|
entity: entity,
|
|
1756
1681
|
EntityServiceClass: this.data.baseData.EntityServiceClass,
|
|
1757
1682
|
createDialogData: this.data.createDialogData
|
|
1758
|
-
}).
|
|
1683
|
+
}).getResult();
|
|
1759
1684
|
this.dialog.open(NgxMatEntityCreateDialogComponent, {
|
|
1760
1685
|
data: dialogData,
|
|
1761
1686
|
minWidth: '60%',
|
|
@@ -1763,19 +1688,26 @@ class NgxMatEntityTableComponent {
|
|
|
1763
1688
|
restoreFocus: false
|
|
1764
1689
|
});
|
|
1765
1690
|
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Runs the MultiAction for all selected entries.
|
|
1693
|
+
* Also handles confirmation with an additional dialog if configured.
|
|
1694
|
+
*
|
|
1695
|
+
* @param action - The MultiAction to run.
|
|
1696
|
+
*/
|
|
1766
1697
|
runMultiAction(action) {
|
|
1767
1698
|
if (!action.requireConfirmDialog || !action.requireConfirmDialog(this.selection.selected)) {
|
|
1768
1699
|
return this.confirmRunMultiAction(action);
|
|
1769
1700
|
}
|
|
1770
1701
|
const dialogData = new ConfirmDialogDataBuilder(action.confirmDialogData)
|
|
1771
|
-
.
|
|
1772
|
-
.
|
|
1773
|
-
|
|
1702
|
+
.withDefault('text', [`Do you really want to run this action on ${this.selection.selected.length} entries?`])
|
|
1703
|
+
.withDefault('title', action.displayName)
|
|
1704
|
+
.getResult();
|
|
1705
|
+
const dialogRef = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1774
1706
|
data: dialogData,
|
|
1775
1707
|
autoFocus: false,
|
|
1776
1708
|
restoreFocus: false
|
|
1777
1709
|
});
|
|
1778
|
-
|
|
1710
|
+
dialogRef.afterClosed().subscribe((res) => {
|
|
1779
1711
|
if (res === 1) {
|
|
1780
1712
|
this.confirmRunMultiAction(action);
|
|
1781
1713
|
}
|
|
@@ -1784,6 +1716,12 @@ class NgxMatEntityTableComponent {
|
|
|
1784
1716
|
confirmRunMultiAction(action) {
|
|
1785
1717
|
action.action(this.selection.selected);
|
|
1786
1718
|
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Checks if an MultiAction is disabled (e.g. Because no entries have been selected).
|
|
1721
|
+
*
|
|
1722
|
+
* @param action - The MultiAction to check.
|
|
1723
|
+
* @returns Whether or not the Action can be used.
|
|
1724
|
+
*/
|
|
1787
1725
|
multiActionDisabled(action) {
|
|
1788
1726
|
var _a;
|
|
1789
1727
|
if (!this.selection.selected.length) {
|
|
@@ -1794,6 +1732,9 @@ class NgxMatEntityTableComponent {
|
|
|
1794
1732
|
}
|
|
1795
1733
|
return false;
|
|
1796
1734
|
}
|
|
1735
|
+
/**
|
|
1736
|
+
* Toggles all entries in the table.
|
|
1737
|
+
*/
|
|
1797
1738
|
masterToggle() {
|
|
1798
1739
|
if (this.isAllSelected()) {
|
|
1799
1740
|
this.selection.clear();
|
|
@@ -1802,6 +1743,12 @@ class NgxMatEntityTableComponent {
|
|
|
1802
1743
|
this.dataSource.data.forEach((row) => this.selection.select(row));
|
|
1803
1744
|
}
|
|
1804
1745
|
}
|
|
1746
|
+
/**
|
|
1747
|
+
* Checks if all entries in the table have been selected.
|
|
1748
|
+
* This is needed to display the "masterToggle"-checkbox correctly.
|
|
1749
|
+
*
|
|
1750
|
+
* @returns Whether or not all entries in the table have been selected.
|
|
1751
|
+
*/
|
|
1805
1752
|
isAllSelected() {
|
|
1806
1753
|
const numSelected = this.selection.selected.length;
|
|
1807
1754
|
const numRows = this.dataSource.data.length;
|
|
@@ -1811,16 +1758,21 @@ class NgxMatEntityTableComponent {
|
|
|
1811
1758
|
this.onDestroy.next(undefined);
|
|
1812
1759
|
this.onDestroy.complete();
|
|
1813
1760
|
}
|
|
1761
|
+
/**
|
|
1762
|
+
* Applies the search input to filter the table entries.
|
|
1763
|
+
*
|
|
1764
|
+
* @param event - The keyup-event which contains the search-string of the user.
|
|
1765
|
+
*/
|
|
1814
1766
|
applyFilter(event) {
|
|
1815
1767
|
const filterValue = event.target.value;
|
|
1816
1768
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
|
1817
1769
|
}
|
|
1818
1770
|
}
|
|
1819
1771
|
NgxMatEntityTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableComponent, deps: [{ token: i1.MatDialog }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
1820
|
-
NgxMatEntityTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityTableComponent, selector: "ngx-mat-entity-table", inputs: { tableData: "tableData" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }, { propertyName: "filter", first: true, predicate: ["filter"], descendants: true, static: true }], ngImport: i0, template: "<h1 class=\"title\">{{data.baseData.title}}</h1>\n\n<div class=\"row\">\n <mat-form-field class=\"col-lg-8 col-md-6 col-sm-12\">\n <mat-label>{{data.baseData.searchLabel}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-2]=\"data.baseData.allowCreate\"\n [class.col-lg-4]=\"!data.baseData.allowCreate\"\n [class.col-md-3]=\"data.baseData.allowCreate\"\n [class.col-md-6]=\"!data.baseData.allowCreate\"\n [class.col-sm-6]=\"data.baseData.allowCreate\"\n [class.col-sm-12]=\"!data.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{data.baseData.multiSelectLabel}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of data.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"data.baseData.allowCreate\"\n [class.col-lg-2]=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-4]=\"!data.baseData.multiSelectActions.length\"\n [class.col-md-3]=\"data.baseData.multiSelectActions.length\"\n [class.col-md-6]=\"!data.baseData.multiSelectActions.length\"\n [class.col-sm-6]=\"data.baseData.multiSelectActions.length\"\n [class.col-sm-12]=\"!data.baseData.multiSelectActions.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{data.baseData.createButtonLabel}}\n </button>\n </div>\n</div>\n\n<div class=\"mat-elevation-z8\">\n <mat-table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" matSort>\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"> </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngFor=\"let dCol of data.baseData.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" [class.enabled]=\"data.baseData.allowEdit(entity)\" (click)=\"editEntity(entity)\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n\n <mat-paginator *ngIf=\"dataSource\" id=\"paginator\" [length]=\"dataSource.filteredData.length\" [pageIndex]=\"0\" [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25, 50]\"> </mat-paginator>\n</div>\n", styles: [".title{text-align:center}button{width:100%}.mat-column-select{flex:0 0 75px}.enabled:hover{cursor:pointer}@media (max-width: 767px){.actions-button
|
|
1772
|
+
NgxMatEntityTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityTableComponent, selector: "ngx-mat-entity-table", inputs: { tableData: "tableData" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }, { propertyName: "filter", first: true, predicate: ["filter"], descendants: true, static: true }], ngImport: i0, template: "<h1 class=\"title\">{{data.baseData.title}}</h1>\n\n<div class=\"row\">\n <mat-form-field class=\"col-lg-8 col-md-6 col-sm-12\">\n <mat-label>{{data.baseData.searchLabel}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-2]=\"data.baseData.allowCreate\"\n [class.col-lg-4]=\"!data.baseData.allowCreate\"\n [class.col-md-3]=\"data.baseData.allowCreate\"\n [class.col-md-6]=\"!data.baseData.allowCreate\"\n [class.col-sm-6]=\"data.baseData.allowCreate\"\n [class.col-sm-12]=\"!data.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{data.baseData.multiSelectLabel}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of data.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"data.baseData.allowCreate\"\n [class.col-lg-2]=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-4]=\"!data.baseData.multiSelectActions.length\"\n [class.col-md-3]=\"data.baseData.multiSelectActions.length\"\n [class.col-md-6]=\"!data.baseData.multiSelectActions.length\"\n [class.col-sm-6]=\"data.baseData.multiSelectActions.length\"\n [class.col-sm-12]=\"!data.baseData.multiSelectActions.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{data.baseData.createButtonLabel}}\n </button>\n </div>\n</div>\n\n<div class=\"mat-elevation-z8\">\n <mat-table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" matSort>\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"> </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngFor=\"let dCol of data.baseData.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" [class.enabled]=\"data.baseData.allowEdit(entity)\" (click)=\"editEntity(entity)\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n\n <mat-paginator *ngIf=\"dataSource\" id=\"paginator\" [length]=\"dataSource.filteredData.length\" [pageIndex]=\"0\" [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25, 50]\"> </mat-paginator>\n</div>\n", styles: [".title{text-align:center}button{width:100%}.mat-column-select{flex:0 0 75px}.enabled:hover{cursor:pointer}@media (max-width: 767px){.actions-button,.create-button{margin-bottom:15px}}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i4$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i9.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i9.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i9.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { type: i7$1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }], directives: [{ type: i2.MatLabel, selector: "mat-label" }, { type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i9.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i9.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i9.MatCellDef, selector: "[matCellDef]" }, { type: i9.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i9.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i9.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }] });
|
|
1821
1773
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableComponent, decorators: [{
|
|
1822
1774
|
type: Component,
|
|
1823
|
-
args: [{ selector: 'ngx-mat-entity-table', template: "<h1 class=\"title\">{{data.baseData.title}}</h1>\n\n<div class=\"row\">\n <mat-form-field class=\"col-lg-8 col-md-6 col-sm-12\">\n <mat-label>{{data.baseData.searchLabel}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-2]=\"data.baseData.allowCreate\"\n [class.col-lg-4]=\"!data.baseData.allowCreate\"\n [class.col-md-3]=\"data.baseData.allowCreate\"\n [class.col-md-6]=\"!data.baseData.allowCreate\"\n [class.col-sm-6]=\"data.baseData.allowCreate\"\n [class.col-sm-12]=\"!data.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{data.baseData.multiSelectLabel}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of data.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"data.baseData.allowCreate\"\n [class.col-lg-2]=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-4]=\"!data.baseData.multiSelectActions.length\"\n [class.col-md-3]=\"data.baseData.multiSelectActions.length\"\n [class.col-md-6]=\"!data.baseData.multiSelectActions.length\"\n [class.col-sm-6]=\"data.baseData.multiSelectActions.length\"\n [class.col-sm-12]=\"!data.baseData.multiSelectActions.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{data.baseData.createButtonLabel}}\n </button>\n </div>\n</div>\n\n<div class=\"mat-elevation-z8\">\n <mat-table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" matSort>\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"> </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngFor=\"let dCol of data.baseData.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" [class.enabled]=\"data.baseData.allowEdit(entity)\" (click)=\"editEntity(entity)\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n\n <mat-paginator *ngIf=\"dataSource\" id=\"paginator\" [length]=\"dataSource.filteredData.length\" [pageIndex]=\"0\" [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25, 50]\"> </mat-paginator>\n</div>\n", styles: [".title{text-align:center}button{width:100%}.mat-column-select{flex:0 0 75px}.enabled:hover{cursor:pointer}@media (max-width: 767px){.actions-button
|
|
1775
|
+
args: [{ selector: 'ngx-mat-entity-table', template: "<h1 class=\"title\">{{data.baseData.title}}</h1>\n\n<div class=\"row\">\n <mat-form-field class=\"col-lg-8 col-md-6 col-sm-12\">\n <mat-label>{{data.baseData.searchLabel}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-2]=\"data.baseData.allowCreate\"\n [class.col-lg-4]=\"!data.baseData.allowCreate\"\n [class.col-md-3]=\"data.baseData.allowCreate\"\n [class.col-md-6]=\"!data.baseData.allowCreate\"\n [class.col-sm-6]=\"data.baseData.allowCreate\"\n [class.col-sm-12]=\"!data.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{data.baseData.multiSelectLabel}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of data.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"data.baseData.allowCreate\"\n [class.col-lg-2]=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-4]=\"!data.baseData.multiSelectActions.length\"\n [class.col-md-3]=\"data.baseData.multiSelectActions.length\"\n [class.col-md-6]=\"!data.baseData.multiSelectActions.length\"\n [class.col-sm-6]=\"data.baseData.multiSelectActions.length\"\n [class.col-sm-12]=\"!data.baseData.multiSelectActions.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{data.baseData.createButtonLabel}}\n </button>\n </div>\n</div>\n\n<div class=\"mat-elevation-z8\">\n <mat-table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" matSort>\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"> </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngFor=\"let dCol of data.baseData.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" [class.enabled]=\"data.baseData.allowEdit(entity)\" (click)=\"editEntity(entity)\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n\n <mat-paginator *ngIf=\"dataSource\" id=\"paginator\" [length]=\"dataSource.filteredData.length\" [pageIndex]=\"0\" [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25, 50]\"> </mat-paginator>\n</div>\n", styles: [".title{text-align:center}button{width:100%}.mat-column-select{flex:0 0 75px}.enabled:hover{cursor:pointer}@media (max-width: 767px){.actions-button,.create-button{margin-bottom:15px}}\n"] }]
|
|
1824
1776
|
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.Injector }]; }, propDecorators: { tableData: [{
|
|
1825
1777
|
type: Input
|
|
1826
1778
|
}], paginator: [{
|
|
@@ -1834,61 +1786,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1834
1786
|
args: ['filter', { static: true }]
|
|
1835
1787
|
}] } });
|
|
1836
1788
|
|
|
1837
|
-
class
|
|
1789
|
+
class NgxMatEntityCreateDialogModule {
|
|
1838
1790
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1791
|
+
NgxMatEntityCreateDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1792
|
+
NgxMatEntityCreateDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, declarations: [NgxMatEntityCreateDialogComponent], imports: [CommonModule,
|
|
1793
|
+
NgxMatEntityInputModule,
|
|
1794
|
+
MatDialogModule,
|
|
1842
1795
|
FormsModule,
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
MatTableModule,
|
|
1846
|
-
MatPaginatorModule,
|
|
1847
|
-
MatButtonModule,
|
|
1848
|
-
MatMenuModule,
|
|
1849
|
-
MatDialogModule], exports: [NgxMatEntityTableComponent] });
|
|
1850
|
-
NgxMatEntityTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, imports: [[
|
|
1796
|
+
MatButtonModule], exports: [NgxMatEntityCreateDialogComponent] });
|
|
1797
|
+
NgxMatEntityCreateDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, imports: [[
|
|
1851
1798
|
CommonModule,
|
|
1852
|
-
|
|
1799
|
+
NgxMatEntityInputModule,
|
|
1800
|
+
MatDialogModule,
|
|
1853
1801
|
FormsModule,
|
|
1854
|
-
|
|
1855
|
-
MatCheckboxModule,
|
|
1856
|
-
MatTableModule,
|
|
1857
|
-
MatPaginatorModule,
|
|
1858
|
-
MatButtonModule,
|
|
1859
|
-
MatMenuModule,
|
|
1860
|
-
MatDialogModule
|
|
1802
|
+
MatButtonModule
|
|
1861
1803
|
]] });
|
|
1862
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type:
|
|
1804
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, decorators: [{
|
|
1863
1805
|
type: NgModule,
|
|
1864
1806
|
args: [{
|
|
1865
|
-
declarations: [
|
|
1807
|
+
declarations: [NgxMatEntityCreateDialogComponent],
|
|
1866
1808
|
imports: [
|
|
1867
1809
|
CommonModule,
|
|
1868
|
-
|
|
1810
|
+
NgxMatEntityInputModule,
|
|
1811
|
+
MatDialogModule,
|
|
1869
1812
|
FormsModule,
|
|
1870
|
-
|
|
1871
|
-
MatCheckboxModule,
|
|
1872
|
-
MatTableModule,
|
|
1873
|
-
MatPaginatorModule,
|
|
1874
|
-
MatButtonModule,
|
|
1875
|
-
MatMenuModule,
|
|
1876
|
-
MatDialogModule
|
|
1813
|
+
MatButtonModule
|
|
1877
1814
|
],
|
|
1878
|
-
exports: [NgxMatEntityTableComponent]
|
|
1879
|
-
}]
|
|
1880
|
-
}] });
|
|
1881
|
-
|
|
1882
|
-
class NgxMatEntityCreateDialogModule {
|
|
1883
|
-
}
|
|
1884
|
-
NgxMatEntityCreateDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1885
|
-
NgxMatEntityCreateDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, declarations: [NgxMatEntityCreateDialogComponent], imports: [CommonModule, NgxMatEntityInputModule, MatDialogModule, FormsModule, MatButtonModule], exports: [NgxMatEntityCreateDialogComponent] });
|
|
1886
|
-
NgxMatEntityCreateDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, imports: [[CommonModule, NgxMatEntityInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1887
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, decorators: [{
|
|
1888
|
-
type: NgModule,
|
|
1889
|
-
args: [{
|
|
1890
|
-
declarations: [NgxMatEntityCreateDialogComponent],
|
|
1891
|
-
imports: [CommonModule, NgxMatEntityInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1892
1815
|
exports: [NgxMatEntityCreateDialogComponent]
|
|
1893
1816
|
}]
|
|
1894
1817
|
}] });
|
|
@@ -1926,10 +1849,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1926
1849
|
}]
|
|
1927
1850
|
}] });
|
|
1928
1851
|
|
|
1852
|
+
class NgxMatEntityTableModule {
|
|
1853
|
+
}
|
|
1854
|
+
NgxMatEntityTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1855
|
+
NgxMatEntityTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, declarations: [NgxMatEntityTableComponent], imports: [CommonModule,
|
|
1856
|
+
MatInputModule,
|
|
1857
|
+
FormsModule,
|
|
1858
|
+
MatFormFieldModule,
|
|
1859
|
+
MatCheckboxModule,
|
|
1860
|
+
MatTableModule,
|
|
1861
|
+
MatPaginatorModule,
|
|
1862
|
+
MatButtonModule,
|
|
1863
|
+
MatMenuModule,
|
|
1864
|
+
MatDialogModule,
|
|
1865
|
+
NgxMatEntityCreateDialogModule,
|
|
1866
|
+
NgxMatEntityEditDialogModule], exports: [NgxMatEntityTableComponent] });
|
|
1867
|
+
NgxMatEntityTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, imports: [[
|
|
1868
|
+
CommonModule,
|
|
1869
|
+
MatInputModule,
|
|
1870
|
+
FormsModule,
|
|
1871
|
+
MatFormFieldModule,
|
|
1872
|
+
MatCheckboxModule,
|
|
1873
|
+
MatTableModule,
|
|
1874
|
+
MatPaginatorModule,
|
|
1875
|
+
MatButtonModule,
|
|
1876
|
+
MatMenuModule,
|
|
1877
|
+
MatDialogModule,
|
|
1878
|
+
NgxMatEntityCreateDialogModule,
|
|
1879
|
+
NgxMatEntityEditDialogModule,
|
|
1880
|
+
]] });
|
|
1881
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, decorators: [{
|
|
1882
|
+
type: NgModule,
|
|
1883
|
+
args: [{
|
|
1884
|
+
declarations: [NgxMatEntityTableComponent],
|
|
1885
|
+
imports: [
|
|
1886
|
+
CommonModule,
|
|
1887
|
+
MatInputModule,
|
|
1888
|
+
FormsModule,
|
|
1889
|
+
MatFormFieldModule,
|
|
1890
|
+
MatCheckboxModule,
|
|
1891
|
+
MatTableModule,
|
|
1892
|
+
MatPaginatorModule,
|
|
1893
|
+
MatButtonModule,
|
|
1894
|
+
MatMenuModule,
|
|
1895
|
+
MatDialogModule,
|
|
1896
|
+
NgxMatEntityCreateDialogModule,
|
|
1897
|
+
NgxMatEntityEditDialogModule,
|
|
1898
|
+
],
|
|
1899
|
+
exports: [NgxMatEntityTableComponent]
|
|
1900
|
+
}]
|
|
1901
|
+
}] });
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* The internal EntityArrayDecoratorConfig. Sets default values.
|
|
1905
|
+
*/
|
|
1929
1906
|
class EntityArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1930
1907
|
constructor(data) {
|
|
1931
1908
|
super(data);
|
|
1932
|
-
this.
|
|
1909
|
+
this.createInline = data.createInline != undefined ? data.createInline : true;
|
|
1933
1910
|
this.displayStyle = data.displayStyle;
|
|
1934
1911
|
this.itemType = data.itemType;
|
|
1935
1912
|
this.EntityClass = data.EntityClass;
|
|
@@ -1937,12 +1914,17 @@ class EntityArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal
|
|
|
1937
1914
|
this.createInline = data.createInline != undefined ? data.createInline : true;
|
|
1938
1915
|
this.missingErrorMessage = data.missingErrorMessage ? data.missingErrorMessage : 'Needs to contain at least one value';
|
|
1939
1916
|
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [12, 12, 12];
|
|
1917
|
+
this.addButtonLabel = data.addButtonLabel ? data.addButtonLabel : 'Add';
|
|
1918
|
+
this.removeButtonLabel = data.removeButtonLabel ? data.removeButtonLabel : 'Remove';
|
|
1940
1919
|
}
|
|
1941
1920
|
}
|
|
1921
|
+
/**
|
|
1922
|
+
* The internal StringChipsArrayDecoratorConfig. Sets default values.
|
|
1923
|
+
*/
|
|
1942
1924
|
class StringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1943
1925
|
constructor(data) {
|
|
1944
1926
|
super(data);
|
|
1945
|
-
this.
|
|
1927
|
+
this.deleteIcon = data.deleteIcon ? data.deleteIcon : 'fas fa-circle-minus';
|
|
1946
1928
|
this.displayStyle = data.displayStyle;
|
|
1947
1929
|
this.itemType = data.itemType;
|
|
1948
1930
|
this.maxLength = data.maxLength;
|
|
@@ -1951,11 +1933,14 @@ class StringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInt
|
|
|
1951
1933
|
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 12, 12];
|
|
1952
1934
|
}
|
|
1953
1935
|
}
|
|
1936
|
+
/**
|
|
1937
|
+
* The internal AutocompleteStringChipsArrayDecoratorConfig. Sets default values.
|
|
1938
|
+
*/
|
|
1954
1939
|
class AutocompleteStringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1955
1940
|
constructor(data) {
|
|
1956
1941
|
super(data);
|
|
1957
1942
|
this.autocompleteValues = data.autocompleteValues;
|
|
1958
|
-
this.
|
|
1943
|
+
this.deleteIcon = data.deleteIcon ? data.deleteIcon : 'fas fa-circle-minus';
|
|
1959
1944
|
this.displayStyle = data.displayStyle;
|
|
1960
1945
|
this.itemType = data.itemType;
|
|
1961
1946
|
this.maxLength = data.maxLength;
|
|
@@ -1966,7 +1951,7 @@ class AutocompleteStringChipsArrayDecoratorConfigInternal extends PropertyDecora
|
|
|
1966
1951
|
}
|
|
1967
1952
|
|
|
1968
1953
|
/**
|
|
1969
|
-
* Decorator for setting and getting array
|
|
1954
|
+
* Decorator for setting and getting array property metadata.
|
|
1970
1955
|
*
|
|
1971
1956
|
* @param metadata - The metadata of the array property.
|
|
1972
1957
|
* @returns The method that defines the metadata.
|
|
@@ -1998,6 +1983,9 @@ class PropertyDecoratorConfig {
|
|
|
1998
1983
|
class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
1999
1984
|
}
|
|
2000
1985
|
|
|
1986
|
+
/**
|
|
1987
|
+
* The internal DropdownBooleanDecoratorConfig. Sets default values.
|
|
1988
|
+
*/
|
|
2001
1989
|
class DropdownBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2002
1990
|
constructor(data) {
|
|
2003
1991
|
super(data);
|
|
@@ -2006,21 +1994,29 @@ class DropdownBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInte
|
|
|
2006
1994
|
this.dropdownFalse = data.dropdownFalse;
|
|
2007
1995
|
}
|
|
2008
1996
|
}
|
|
1997
|
+
/**
|
|
1998
|
+
* The internal CheckboxBooleanDecoratorConfig. Sets default values.
|
|
1999
|
+
*/
|
|
2009
2000
|
class CheckboxBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2010
2001
|
constructor(data) {
|
|
2011
2002
|
super(data);
|
|
2012
2003
|
this.displayStyle = data.displayStyle;
|
|
2004
|
+
this.required = data.required === undefined ? false : data.required;
|
|
2013
2005
|
}
|
|
2014
2006
|
}
|
|
2007
|
+
/**
|
|
2008
|
+
* The internal ToggleBooleanDecoratorConfig. Sets default values.
|
|
2009
|
+
*/
|
|
2015
2010
|
class ToggleBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2016
2011
|
constructor(data) {
|
|
2017
2012
|
super(data);
|
|
2018
2013
|
this.displayStyle = data.displayStyle;
|
|
2014
|
+
this.required = data.required === undefined ? false : data.required;
|
|
2019
2015
|
}
|
|
2020
2016
|
}
|
|
2021
2017
|
|
|
2022
2018
|
/**
|
|
2023
|
-
* Decorator for setting and getting boolean
|
|
2019
|
+
* Decorator for setting and getting boolean property metadata.
|
|
2024
2020
|
*
|
|
2025
2021
|
* @param metadata - The metadata of the boolean property.
|
|
2026
2022
|
* @returns The method that defines the metadata.
|
|
@@ -2043,6 +2039,9 @@ function boolean(metadata) {
|
|
|
2043
2039
|
class BooleanDecoratorConfig extends PropertyDecoratorConfig {
|
|
2044
2040
|
}
|
|
2045
2041
|
|
|
2042
|
+
/**
|
|
2043
|
+
* The internal DefaultNumberDecoratorConfig. Sets default values.
|
|
2044
|
+
*/
|
|
2046
2045
|
class DefaultNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2047
2046
|
constructor(data) {
|
|
2048
2047
|
super(data);
|
|
@@ -2051,6 +2050,9 @@ class DefaultNumberDecoratorConfigInternal extends PropertyDecoratorConfigIntern
|
|
|
2051
2050
|
this.min = data.min;
|
|
2052
2051
|
}
|
|
2053
2052
|
}
|
|
2053
|
+
/**
|
|
2054
|
+
* The internal DropdownNumberDecoratorConfig. Sets default values.
|
|
2055
|
+
*/
|
|
2054
2056
|
class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2055
2057
|
constructor(data) {
|
|
2056
2058
|
super(data);
|
|
@@ -2060,7 +2062,7 @@ class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInter
|
|
|
2060
2062
|
}
|
|
2061
2063
|
|
|
2062
2064
|
/**
|
|
2063
|
-
* Decorator for setting and getting string
|
|
2065
|
+
* Decorator for setting and getting string property metadata.
|
|
2064
2066
|
*
|
|
2065
2067
|
* @param metadata - The metadata of the string property.
|
|
2066
2068
|
* @returns The method that defines the metadata.
|
|
@@ -2080,6 +2082,9 @@ function number(metadata) {
|
|
|
2080
2082
|
class NumberDecoratorConfig extends PropertyDecoratorConfig {
|
|
2081
2083
|
}
|
|
2082
2084
|
|
|
2085
|
+
/**
|
|
2086
|
+
* The internal DefaultObjectDecoratorConfig. Sets default values.
|
|
2087
|
+
*/
|
|
2083
2088
|
class DefaultObjectDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2084
2089
|
constructor(data) {
|
|
2085
2090
|
super(data);
|
|
@@ -2089,7 +2094,7 @@ class DefaultObjectDecoratorConfigInternal extends PropertyDecoratorConfigIntern
|
|
|
2089
2094
|
}
|
|
2090
2095
|
|
|
2091
2096
|
/**
|
|
2092
|
-
* Decorator for setting and getting object
|
|
2097
|
+
* Decorator for setting and getting object property metadata.
|
|
2093
2098
|
*
|
|
2094
2099
|
* @param metadata - The metadata of the object property.
|
|
2095
2100
|
* @returns The method that defines the metadata.
|