ngx-material-entity 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +7 -1
- package/README.md +3 -2
- package/classes/entity-model.class.d.ts +1 -1
- package/classes/entity-service.class.d.ts +27 -17
- package/classes/entity-utilities.class.d.ts +62 -45
- package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +24 -0
- package/components/confirm-dialog/confirm-dialog-data.d.ts +14 -8
- package/components/confirm-dialog/confirm-dialog.component.d.ts +4 -5
- package/components/get-validation-error-message.function.d.ts +3 -2
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.builder.d.ts +17 -0
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.d.ts +17 -0
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +5 -18
- package/components/input/array-table/array-table.component.d.ts +3 -3
- package/components/input/input.component.d.ts +18 -21
- package/components/input/internal-input/internal-input.component.d.ts +14 -17
- package/components/table/create-dialog/create-dialog-data.builder.d.ts +20 -0
- package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +16 -0
- package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -2
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +4 -2
- package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +27 -0
- package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +5 -5
- package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +17 -0
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +4 -2
- package/components/table/table-data.builder.d.ts +40 -0
- package/components/table/table-data.d.ts +26 -22
- package/components/table/table.component.d.ts +6 -5
- package/decorators/array/array-decorator-internal.data.d.ts +34 -0
- package/decorators/{array.decorator.d.ts → array/array-decorator.data.d.ts} +32 -37
- package/decorators/array/array.decorator.d.ts +10 -0
- package/decorators/base/base-property.decorator.d.ts +7 -6
- package/decorators/base/decorator-types.enum.d.ts +7 -7
- package/decorators/base/property-decorator-internal.data.d.ts +11 -0
- package/decorators/base/{property-decorator-config.interface.d.ts → property-decorator.data.d.ts} +11 -12
- package/decorators/boolean/boolean-decorator-internal.data.d.ts +16 -0
- package/decorators/boolean/boolean-decorator.data.d.ts +28 -0
- package/decorators/boolean/boolean.decorator.d.ts +8 -0
- package/decorators/number/number-decorator-internal.data.d.ts +16 -0
- package/decorators/number/number-decorator.data.d.ts +32 -0
- package/decorators/number/number.decorator.d.ts +8 -0
- package/decorators/object/object-decorator-internal.data.d.ts +8 -0
- package/decorators/object/object-decorator.data.d.ts +22 -0
- package/decorators/object/object.decorator.d.ts +9 -0
- package/decorators/string/string-decorator-internal.data.d.ts +31 -0
- package/decorators/string/string-decorator.data.d.ts +67 -0
- package/decorators/string/string.decorator.d.ts +8 -0
- package/esm2020/classes/entity-model.class.mjs +2 -2
- package/esm2020/classes/entity-service.class.mjs +20 -14
- package/esm2020/classes/entity-utilities.class.mjs +108 -75
- package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +77 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +1 -1
- package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +7 -22
- package/esm2020/components/get-validation-error-message.function.mjs +4 -3
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.builder.mjs +33 -0
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.mjs +2 -0
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +7 -5
- package/esm2020/components/input/array-table/array-table.component.mjs +14 -11
- package/esm2020/components/input/input.component.mjs +3 -6
- package/esm2020/components/input/internal-input/internal-input.component.mjs +1 -4
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +54 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +18 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +14 -21
- package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +81 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +19 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +21 -36
- package/esm2020/components/table/table-data.builder.mjs +89 -0
- package/esm2020/components/table/table-data.mjs +1 -1
- package/esm2020/components/table/table.component.mjs +41 -80
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +40 -0
- package/esm2020/decorators/array/array-decorator.data.mjs +7 -0
- package/esm2020/decorators/array/array.decorator.mjs +24 -0
- package/esm2020/decorators/base/base-property.decorator.mjs +6 -5
- package/esm2020/decorators/base/decorator-types.enum.mjs +1 -1
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +15 -0
- package/esm2020/decorators/base/property-decorator.data.mjs +6 -0
- package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +22 -0
- package/esm2020/decorators/boolean/boolean-decorator.data.mjs +7 -0
- package/esm2020/decorators/boolean/boolean.decorator.mjs +21 -0
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +17 -0
- package/esm2020/decorators/number/number-decorator.data.mjs +7 -0
- package/esm2020/decorators/number/number.decorator.mjs +18 -0
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +9 -0
- package/esm2020/decorators/object/object-decorator.data.mjs +7 -0
- package/esm2020/decorators/object/object.decorator.mjs +13 -0
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +36 -0
- package/esm2020/decorators/string/string-decorator.data.mjs +7 -0
- package/esm2020/decorators/string/string.decorator.mjs +24 -0
- package/esm2020/public-api.mjs +15 -10
- package/fesm2015/ngx-material-entity.mjs +1019 -683
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +1005 -684
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +16 -7
- package/decorators/boolean.decorator.d.ts +0 -42
- package/decorators/number.decorator.d.ts +0 -40
- package/decorators/object.decorator.d.ts +0 -27
- package/decorators/string.decorator.d.ts +0 -76
- package/esm2020/decorators/array.decorator.mjs +0 -70
- package/esm2020/decorators/base/property-decorator-config.interface.mjs +0 -31
- package/esm2020/decorators/boolean.decorator.mjs +0 -44
- package/esm2020/decorators/number.decorator.mjs +0 -36
- package/esm2020/decorators/object.decorator.mjs +0 -23
- package/esm2020/decorators/string.decorator.mjs +0 -61
|
@@ -14,12 +14,6 @@ import * as i7 from '@angular/common';
|
|
|
14
14
|
import { CommonModule } from '@angular/common';
|
|
15
15
|
import * as i12 from '@angular/forms';
|
|
16
16
|
import { FormsModule } from '@angular/forms';
|
|
17
|
-
import * as i7$1 from '@angular/material/paginator';
|
|
18
|
-
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
19
|
-
import { MatSort } from '@angular/material/sort';
|
|
20
|
-
import * as i4$1 from '@angular/material/table';
|
|
21
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
22
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
23
17
|
import * as i1$1 from '@angular/material/form-field';
|
|
24
18
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
25
19
|
import * as i2 from '@angular/material/autocomplete';
|
|
@@ -29,6 +23,9 @@ import * as i4 from '@angular/material/select';
|
|
|
29
23
|
import { MatSelectModule } from '@angular/material/select';
|
|
30
24
|
import * as i6 from '@angular/material/slide-toggle';
|
|
31
25
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
26
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
27
|
+
import * as i4$1 from '@angular/material/table';
|
|
28
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
32
29
|
import * as i8 from '@angular/material/input';
|
|
33
30
|
import { MatInputModule } from '@angular/material/input';
|
|
34
31
|
import * as i10 from '@angular/cdk/text-field';
|
|
@@ -36,45 +33,18 @@ import * as i8$1 from '@angular/material/chips';
|
|
|
36
33
|
import { MatChipsModule } from '@angular/material/chips';
|
|
37
34
|
import * as i9 from '@angular/material/icon';
|
|
38
35
|
import { MatIconModule } from '@angular/material/icon';
|
|
36
|
+
import * as i7$1 from '@angular/material/paginator';
|
|
37
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
38
|
+
import { MatSort } from '@angular/material/sort';
|
|
39
39
|
import * as i4$2 from '@angular/material/menu';
|
|
40
40
|
import { MatMenuModule } from '@angular/material/menu';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* The base
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* Is used inside the default create and edit dialogs.
|
|
49
|
-
*/
|
|
50
|
-
// lineBreakAfter?: boolean;
|
|
51
|
-
constructor(displayName, display = true, required = true, omitForCreate = false, omitForUpdate = false, defaultWidths = [6, 6, 12], order
|
|
52
|
-
// lineBreakAfter: boolean = false
|
|
53
|
-
) {
|
|
54
|
-
this.displayName = displayName;
|
|
55
|
-
this.display = display;
|
|
56
|
-
this.required = required;
|
|
57
|
-
this.omitForCreate = omitForCreate;
|
|
58
|
-
this.omitForUpdate = omitForUpdate;
|
|
59
|
-
this.defaultWidths = defaultWidths;
|
|
60
|
-
if (order) {
|
|
61
|
-
if (order < 0) {
|
|
62
|
-
throw new Error('order must be at least 0');
|
|
63
|
-
}
|
|
64
|
-
this.order = order;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.order = -1;
|
|
68
|
-
}
|
|
69
|
-
// this.lineBreakAfter = lineBreakAfter;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* The base decorator for setting metadata on properties
|
|
75
|
-
* @param metadata The metadata to define
|
|
76
|
-
* @param type The type of metadata
|
|
77
|
-
* @returns The function that sets the metadata
|
|
43
|
+
* The base decorator for setting metadata on properties.
|
|
44
|
+
*
|
|
45
|
+
* @param metadata - The metadata to define.
|
|
46
|
+
* @param type - The type of metadata.
|
|
47
|
+
* @returns The method that sets the metadata.
|
|
78
48
|
*/
|
|
79
49
|
function baseProperty(metadata, type) {
|
|
80
50
|
return function (target, propertyKey) {
|
|
@@ -103,61 +73,74 @@ var DecoratorTypes;
|
|
|
103
73
|
DecoratorTypes["ARRAY_STRING_AUTOCOMPLETE_CHIPS"] = "arrayStringAutocompleteChips";
|
|
104
74
|
})(DecoratorTypes || (DecoratorTypes = {}));
|
|
105
75
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
76
|
+
class PropertyDecoratorConfigInternal {
|
|
77
|
+
constructor(data) {
|
|
78
|
+
if (data.order && (data.order < 0)) {
|
|
79
|
+
throw new Error('order must be at least 0');
|
|
80
|
+
}
|
|
81
|
+
this.display = data.display != undefined ? data.display : true;
|
|
82
|
+
this.displayName = data.displayName;
|
|
83
|
+
this.required = data.required != undefined ? data.required : true;
|
|
84
|
+
this.omitForCreate = data.omitForCreate != undefined ? data.omitForCreate : false;
|
|
85
|
+
this.omitForUpdate = data.omitForUpdate != undefined ? data.omitForUpdate : false;
|
|
86
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 6, 12];
|
|
87
|
+
this.order = data.order ? data.order : -1;
|
|
113
88
|
}
|
|
114
|
-
|
|
115
|
-
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
92
|
+
constructor(data) {
|
|
93
|
+
super(data);
|
|
94
|
+
this.displayStyle = data.displayStyle;
|
|
95
|
+
this.dropdownValues = data.dropdownValues;
|
|
116
96
|
}
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
}
|
|
98
|
+
class DefaultStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
99
|
+
constructor(data) {
|
|
100
|
+
super(data);
|
|
101
|
+
this.displayStyle = data.displayStyle;
|
|
102
|
+
this.minLength = data.minLength;
|
|
103
|
+
this.maxLength = data.maxLength;
|
|
104
|
+
this.regex = data.regex;
|
|
119
105
|
}
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
}
|
|
107
|
+
class TextboxStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
108
|
+
constructor(data) {
|
|
109
|
+
super(data);
|
|
110
|
+
this.displayStyle = data.displayStyle;
|
|
111
|
+
this.minLength = data.minLength;
|
|
112
|
+
this.maxLength = data.maxLength;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
class AutocompleteStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
116
|
+
constructor(data) {
|
|
117
|
+
super(data);
|
|
118
|
+
this.displayStyle = data.displayStyle;
|
|
119
|
+
this.autocompleteValues = data.autocompleteValues;
|
|
120
|
+
this.minLength = data.minLength;
|
|
121
|
+
this.maxLength = data.maxLength;
|
|
122
|
+
this.regex = data.regex;
|
|
122
123
|
}
|
|
123
124
|
}
|
|
125
|
+
|
|
124
126
|
/**
|
|
125
|
-
*
|
|
127
|
+
* Decorator for setting and getting string propery metadata.
|
|
128
|
+
*
|
|
129
|
+
* @param metadata - The metadata of the string property.
|
|
130
|
+
* @returns The method that defines the metadata.
|
|
126
131
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
constructor(metadata) {
|
|
131
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
132
|
-
this.displayStyle = metadata.displayStyle;
|
|
133
|
-
this.dropdownValues = metadata.dropdownValues;
|
|
132
|
+
function string(metadata) {
|
|
133
|
+
if (metadata.displayStyle === 'dropdown') {
|
|
134
|
+
return baseProperty(new DropdownStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_DROPDOWN);
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
constructor(metadata) {
|
|
138
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
139
|
-
this.displayStyle = metadata.displayStyle;
|
|
140
|
-
this.minLength = metadata.minLength;
|
|
141
|
-
this.maxLength = metadata.maxLength;
|
|
142
|
-
this.regex = metadata.regex;
|
|
136
|
+
else if (metadata.displayStyle === 'autocomplete') {
|
|
137
|
+
return baseProperty(new AutocompleteStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_AUTOCOMPLETE);
|
|
143
138
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
constructor(metadata) {
|
|
147
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
148
|
-
this.displayStyle = metadata.displayStyle;
|
|
149
|
-
this.minLength = metadata.minLength;
|
|
150
|
-
this.maxLength = metadata.maxLength;
|
|
139
|
+
else if (metadata.displayStyle === 'textbox') {
|
|
140
|
+
return baseProperty(new TextboxStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_TEXTBOX);
|
|
151
141
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
constructor(metadata) {
|
|
155
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
156
|
-
this.displayStyle = metadata.displayStyle;
|
|
157
|
-
this.autocompleteValues = metadata.autocompleteValues;
|
|
158
|
-
this.minLength = metadata.minLength;
|
|
159
|
-
this.maxLength = metadata.maxLength;
|
|
160
|
-
this.regex = metadata.regex;
|
|
142
|
+
else {
|
|
143
|
+
return baseProperty(new DefaultStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING);
|
|
161
144
|
}
|
|
162
145
|
}
|
|
163
146
|
|
|
@@ -180,12 +163,14 @@ __decorate([
|
|
|
180
163
|
|
|
181
164
|
var _a;
|
|
182
165
|
/**
|
|
183
|
-
* Contains HelperMethods around handling Entities and their property-metadata
|
|
166
|
+
* Contains HelperMethods around handling Entities and their property-metadata.
|
|
184
167
|
*/
|
|
185
168
|
class EntityUtilities {
|
|
186
169
|
/**
|
|
187
|
-
* Gets the properties to omit when updating the entity
|
|
188
|
-
*
|
|
170
|
+
* Gets the properties to omit when updating the entity.
|
|
171
|
+
*
|
|
172
|
+
* @param entity - The entity to get the properties which should be left out for updating from.
|
|
173
|
+
* @returns The properties which should be left out for updating an Entity.
|
|
189
174
|
*/
|
|
190
175
|
static getOmitForUpdate(entity) {
|
|
191
176
|
const res = [];
|
|
@@ -198,8 +183,10 @@ class EntityUtilities {
|
|
|
198
183
|
return res;
|
|
199
184
|
}
|
|
200
185
|
/**
|
|
201
|
-
* Gets the properties to omit when creating new entities
|
|
202
|
-
*
|
|
186
|
+
* Gets the properties to omit when creating new entities.
|
|
187
|
+
*
|
|
188
|
+
* @param entity - The entity to get the properties which should be left out for creating from.
|
|
189
|
+
* @returns The properties which should be left out for creating a new Entity.
|
|
203
190
|
*/
|
|
204
191
|
static getOmitForCreate(entity) {
|
|
205
192
|
const res = [];
|
|
@@ -212,11 +199,13 @@ class EntityUtilities {
|
|
|
212
199
|
return res;
|
|
213
200
|
}
|
|
214
201
|
/**
|
|
215
|
-
* Gets the metadata included in an property
|
|
216
|
-
*
|
|
217
|
-
* @param
|
|
218
|
-
* @param
|
|
219
|
-
* @
|
|
202
|
+
* Gets the metadata included in an property.
|
|
203
|
+
*
|
|
204
|
+
* @param entity - The entity with the property to get the metadata from.
|
|
205
|
+
* @param propertyKey - The property on the given Entity to get the metadata from.
|
|
206
|
+
* @param type - For secure Typing, defines the returned PropertyConfig.
|
|
207
|
+
* @returns The metadata of the property.
|
|
208
|
+
* @throws When no metadata can be found for the given property.
|
|
220
209
|
*/
|
|
221
210
|
static getPropertyMetadata(entity, propertyKey,
|
|
222
211
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -224,58 +213,78 @@ class EntityUtilities {
|
|
|
224
213
|
try {
|
|
225
214
|
const metadata = Reflect.getMetadata('metadata', entity, propertyKey);
|
|
226
215
|
if (!metadata) {
|
|
227
|
-
throw new Error(`Could not find metadata for property ${String(propertyKey)}
|
|
228
|
-
on the entity ${JSON.stringify(entity)}`);
|
|
216
|
+
throw new Error(`Could not find metadata for property ${String(propertyKey)} on the entity ${JSON.stringify(entity)}`);
|
|
229
217
|
}
|
|
230
218
|
return metadata;
|
|
231
219
|
}
|
|
232
220
|
catch (error) {
|
|
233
|
-
throw new Error(`Could not find metadata for property ${String(propertyKey)}
|
|
234
|
-
on the entity ${JSON.stringify(entity)}`);
|
|
221
|
+
throw new Error(`Could not find metadata for property ${String(propertyKey)} on the entity ${JSON.stringify(entity)}`);
|
|
235
222
|
}
|
|
236
223
|
}
|
|
237
224
|
/**
|
|
238
225
|
* Gets the type of the property-metadata.
|
|
239
|
-
*
|
|
240
|
-
* @param
|
|
241
|
-
* @
|
|
226
|
+
*
|
|
227
|
+
* @param entity - The entity with the property to get the type from.
|
|
228
|
+
* @param propertyKey - The property on the given Entity to get the type from.
|
|
229
|
+
* @returns The type of the metadata.
|
|
230
|
+
* @throws Will throw an error if no metadata can be found for the given property.
|
|
242
231
|
*/
|
|
243
232
|
static getPropertyType(entity, propertyKey) {
|
|
244
233
|
try {
|
|
245
234
|
const propertyType = Reflect.getMetadata('type', entity, propertyKey);
|
|
246
235
|
if (!propertyType) {
|
|
247
|
-
throw new Error(`Could not find type metadata for property ${String(propertyKey)}
|
|
248
|
-
on the entity ${JSON.stringify(entity)}`);
|
|
236
|
+
throw new Error(`Could not find type metadata for property ${String(propertyKey)} on the entity ${JSON.stringify(entity)}`);
|
|
249
237
|
}
|
|
250
238
|
return propertyType;
|
|
251
239
|
}
|
|
252
240
|
catch (error) {
|
|
253
|
-
throw new Error(`Could not find type metadata for property ${String(propertyKey)}
|
|
254
|
-
on the entity ${JSON.stringify(entity)}`);
|
|
241
|
+
throw new Error(`Could not find type metadata for property ${String(propertyKey)} on the entity ${JSON.stringify(entity)}`);
|
|
255
242
|
}
|
|
256
243
|
}
|
|
257
244
|
/**
|
|
258
245
|
* Sets all property values based on a given entity data-object.
|
|
259
|
-
*
|
|
260
|
-
* @param target
|
|
261
|
-
*
|
|
262
|
-
* (if called inside a Entity constructor its usually this)
|
|
246
|
+
*
|
|
247
|
+
* @param target - The target object that needs to be constructed (if called inside an Entity constructor its usually this).
|
|
248
|
+
* @param entity - The data object to get the property values from.
|
|
263
249
|
* @alias new
|
|
264
250
|
* @alias build
|
|
265
251
|
* @alias construct
|
|
266
252
|
*/
|
|
267
253
|
static new(target, entity) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
254
|
+
for (const key in target) {
|
|
255
|
+
const type = EntityUtilities.getPropertyType(target, key);
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
257
|
+
let value = entity ? Reflect.get(entity, key) : undefined;
|
|
258
|
+
switch (type) {
|
|
259
|
+
case DecoratorTypes.OBJECT:
|
|
260
|
+
const objectMetadata = EntityUtilities.getPropertyMetadata(target, key, DecoratorTypes.OBJECT);
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
262
|
+
value = new objectMetadata.type(value);
|
|
263
|
+
break;
|
|
264
|
+
case DecoratorTypes.ARRAY:
|
|
265
|
+
const inputArray = value;
|
|
266
|
+
const resArray = [];
|
|
267
|
+
if (inputArray) {
|
|
268
|
+
const arrayMetadata = EntityUtilities.getPropertyMetadata(target, key, DecoratorTypes.ARRAY);
|
|
269
|
+
for (const item of inputArray) {
|
|
270
|
+
const itemWithMetadata = new arrayMetadata.EntityClass(item);
|
|
271
|
+
resArray.push(itemWithMetadata);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
value = resArray;
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
break;
|
|
271
278
|
}
|
|
279
|
+
Reflect.set(target, key, value);
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
282
|
/**
|
|
275
283
|
* Checks if the values on an entity are valid.
|
|
276
|
-
* Also checks all the validators given by the metadata ("required", "maxLength" etc.)
|
|
277
|
-
*
|
|
278
|
-
* @param
|
|
284
|
+
* Also checks all the validators given by the metadata ("required", "maxLength" etc.).
|
|
285
|
+
*
|
|
286
|
+
* @param entity - The entity to validate.
|
|
287
|
+
* @param omit - Whether to check for creatiung or editing validity.
|
|
279
288
|
* @returns Whether or not the entity is valid.
|
|
280
289
|
*/
|
|
281
290
|
static isEntityValid(entity, omit) {
|
|
@@ -287,10 +296,13 @@ class EntityUtilities {
|
|
|
287
296
|
return true;
|
|
288
297
|
}
|
|
289
298
|
/**
|
|
290
|
-
* Checks if a single property value is valid
|
|
291
|
-
*
|
|
292
|
-
* @param
|
|
293
|
-
* @
|
|
299
|
+
* Checks if a single property value is valid.
|
|
300
|
+
*
|
|
301
|
+
* @param entity - The entity where the property is from.
|
|
302
|
+
* @param key - The name of the property.
|
|
303
|
+
* @param omit - Whether to check if the given entity is valid for creation or updating.
|
|
304
|
+
* @returns Whether or not the property value is valid.
|
|
305
|
+
* @throws Throws when it extracts an unknown metadata type.
|
|
294
306
|
*/
|
|
295
307
|
static isPropertyValid(entity, key, omit) {
|
|
296
308
|
const type = this.getPropertyType(entity, key);
|
|
@@ -305,7 +317,7 @@ class EntityUtilities {
|
|
|
305
317
|
if (metadata.omitForCreate && omit === 'create') {
|
|
306
318
|
return true;
|
|
307
319
|
}
|
|
308
|
-
if (metadata.omitForUpdate && omit === '
|
|
320
|
+
if (metadata.omitForUpdate && omit === 'update') {
|
|
309
321
|
return true;
|
|
310
322
|
}
|
|
311
323
|
if (metadata.required && !entity[key]) {
|
|
@@ -336,7 +348,7 @@ class EntityUtilities {
|
|
|
336
348
|
return false;
|
|
337
349
|
}
|
|
338
350
|
if (metadataAutocompleteString.regex
|
|
339
|
-
&& entity[key].match(metadataAutocompleteString.regex)) {
|
|
351
|
+
&& !entity[key].match(metadataAutocompleteString.regex)) {
|
|
340
352
|
return false;
|
|
341
353
|
}
|
|
342
354
|
break;
|
|
@@ -354,7 +366,7 @@ class EntityUtilities {
|
|
|
354
366
|
if (metadataDefaultNumber.max && entity[key] > metadataDefaultNumber.max) {
|
|
355
367
|
return false;
|
|
356
368
|
}
|
|
357
|
-
if (metadataDefaultNumber.min && entity[key]
|
|
369
|
+
if (metadataDefaultNumber.min && entity[key] < metadataDefaultNumber.min) {
|
|
358
370
|
return false;
|
|
359
371
|
}
|
|
360
372
|
break;
|
|
@@ -378,10 +390,11 @@ class EntityUtilities {
|
|
|
378
390
|
return true;
|
|
379
391
|
}
|
|
380
392
|
/**
|
|
381
|
-
* Checks if an entity is "dirty" (if its values have changed)
|
|
382
|
-
*
|
|
383
|
-
* @param
|
|
384
|
-
* @
|
|
393
|
+
* Checks if an entity is "dirty" (if its values have changed).
|
|
394
|
+
*
|
|
395
|
+
* @param entity - The entity after all changes.
|
|
396
|
+
* @param entityPriorChanges - The entity before the changes.
|
|
397
|
+
* @returns Whether or not the entity is dirty.
|
|
385
398
|
*/
|
|
386
399
|
static dirty(entity, entityPriorChanges) {
|
|
387
400
|
if (!entityPriorChanges) {
|
|
@@ -398,10 +411,11 @@ class EntityUtilities {
|
|
|
398
411
|
}
|
|
399
412
|
}
|
|
400
413
|
/**
|
|
401
|
-
* Compares two Entities and returns their difference in an object
|
|
402
|
-
*
|
|
403
|
-
* @param
|
|
404
|
-
* @
|
|
414
|
+
* Compares two Entities and returns their difference in an object.
|
|
415
|
+
*
|
|
416
|
+
* @param entity - The first entity to compare.
|
|
417
|
+
* @param entityPriorChanges - The second entity to compare.
|
|
418
|
+
* @returns The difference between the two Entities in form of a Partial.
|
|
405
419
|
*/
|
|
406
420
|
static difference(entity, entityPriorChanges) {
|
|
407
421
|
const res = {};
|
|
@@ -412,53 +426,55 @@ class EntityUtilities {
|
|
|
412
426
|
}
|
|
413
427
|
return res;
|
|
414
428
|
}
|
|
429
|
+
//TODO X Y
|
|
415
430
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* @param
|
|
419
|
-
* @param
|
|
431
|
+
* Compare function for sorting entity keys by their order value.
|
|
432
|
+
*
|
|
433
|
+
* @param a - First key of entity.
|
|
434
|
+
* @param b - Second key of entity.
|
|
435
|
+
* @param entity - Current entity (used to get metadata of entity keys).
|
|
436
|
+
* @returns 0 if both values have the same order, a negative value if X, a positive value if Y.
|
|
420
437
|
*/
|
|
421
438
|
static compareOrder(a, b, entity) {
|
|
422
439
|
const metadataA = EntityUtilities.getPropertyMetadata(entity, a, EntityUtilities.getPropertyType(entity, a));
|
|
423
440
|
const metadataB = EntityUtilities.getPropertyMetadata(entity, b, EntityUtilities.getPropertyType(entity, b));
|
|
424
441
|
if (metadataA.order === -1) {
|
|
442
|
+
if (metadataB.order === -1) {
|
|
443
|
+
return 0;
|
|
444
|
+
}
|
|
425
445
|
return 1;
|
|
426
446
|
}
|
|
427
447
|
else if (metadataB.order === -1) {
|
|
428
|
-
return
|
|
448
|
+
return -1;
|
|
429
449
|
}
|
|
430
|
-
return (metadataA.order - metadataB.order);
|
|
450
|
+
return ((metadataA.order) - (metadataB.order));
|
|
431
451
|
}
|
|
432
452
|
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* @param
|
|
436
|
-
* @param
|
|
437
|
-
* @
|
|
453
|
+
* Gets the bootstrap column values for "lg", "md", "sm".
|
|
454
|
+
*
|
|
455
|
+
* @param entity - Entity to get the bootstrap column values of the key.
|
|
456
|
+
* @param key - Key of the property to get bootstrap column values from.
|
|
457
|
+
* @param type - Defines for which screensize the column values should be returned.
|
|
458
|
+
* @returns Bootstrap column value.
|
|
438
459
|
*/
|
|
439
460
|
static getWidth(entity, key, type) {
|
|
440
461
|
const propertyType = EntityUtilities.getPropertyType(entity, key);
|
|
441
462
|
const metadata = EntityUtilities.getPropertyMetadata(entity, key, propertyType);
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
default:
|
|
451
|
-
throw new Error('Something went wrong getting the width');
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
throw new Error('Something went wrong getting the width');
|
|
463
|
+
metadata.defaultWidths = metadata.defaultWidths;
|
|
464
|
+
switch (type) {
|
|
465
|
+
case 'lg':
|
|
466
|
+
return metadata.defaultWidths[0];
|
|
467
|
+
case 'md':
|
|
468
|
+
return metadata.defaultWidths[1];
|
|
469
|
+
case 'sm':
|
|
470
|
+
return metadata.defaultWidths[2];
|
|
456
471
|
}
|
|
457
472
|
}
|
|
458
473
|
/**
|
|
459
|
-
* Resets all changes on an entity
|
|
460
|
-
*
|
|
461
|
-
* @param
|
|
474
|
+
* Resets all changes on an entity.
|
|
475
|
+
*
|
|
476
|
+
* @param entity - The entity to reset.
|
|
477
|
+
* @param entityPriorChanges - The entity before any changes.
|
|
462
478
|
*/
|
|
463
479
|
static resetChangesOnEntity(entity, entityPriorChanges) {
|
|
464
480
|
for (const key in entityPriorChanges) {
|
|
@@ -482,22 +498,25 @@ class EntityService {
|
|
|
482
498
|
constructor(http) {
|
|
483
499
|
this.http = http;
|
|
484
500
|
/**
|
|
485
|
-
*
|
|
501
|
+
* A subject of all the entity values.
|
|
486
502
|
* Can be subscribed to when you want to do a specific thing whenever the entities change.
|
|
487
503
|
*/
|
|
488
504
|
this.entitiesSubject = new BehaviorSubject([]);
|
|
489
505
|
}
|
|
490
506
|
/**
|
|
491
|
-
*
|
|
507
|
+
* Gets the entities in an array from the internal entitiesSubject.
|
|
508
|
+
*
|
|
509
|
+
* @returns The current entities in form of an array.
|
|
492
510
|
*/
|
|
493
511
|
get entities() {
|
|
494
512
|
return this.entitiesSubject.value;
|
|
495
513
|
}
|
|
496
514
|
/**
|
|
497
|
-
* Creates a new Entity and pushes it to the entities array
|
|
498
|
-
*
|
|
515
|
+
* Creates a new Entity and pushes it to the entities array.
|
|
516
|
+
*
|
|
517
|
+
* @param entity - The data of the entity to create.
|
|
499
518
|
* All values that should be omitted will be removed from it inside this method.
|
|
500
|
-
* @returns A Promise of the created entity
|
|
519
|
+
* @returns A Promise of the created entity.
|
|
501
520
|
*/
|
|
502
521
|
async create(entity) {
|
|
503
522
|
const body = omit(entity, EntityUtilities.getOmitForCreate(entity));
|
|
@@ -507,8 +526,9 @@ class EntityService {
|
|
|
507
526
|
return e;
|
|
508
527
|
}
|
|
509
528
|
/**
|
|
510
|
-
* Gets all existing entities and pushes them to the entites array
|
|
511
|
-
*
|
|
529
|
+
* Gets all existing entities and pushes them to the entites array.
|
|
530
|
+
*
|
|
531
|
+
* @returns A Promise of all received Entities.
|
|
512
532
|
*/
|
|
513
533
|
async read() {
|
|
514
534
|
const e = await firstValueFrom(this.http.get(this.baseUrl));
|
|
@@ -516,11 +536,12 @@ class EntityService {
|
|
|
516
536
|
return e;
|
|
517
537
|
}
|
|
518
538
|
/**
|
|
519
|
-
* Updates a specific Entity
|
|
520
|
-
*
|
|
539
|
+
* Updates a specific Entity.
|
|
540
|
+
*
|
|
541
|
+
* @param entity - The updated Entity
|
|
521
542
|
* All values that should be omitted will be removed from it inside this method.
|
|
522
|
-
* @param entityPriorChanges The current Entity.
|
|
523
|
-
* It Is used to get changed values and only update them instead of sending the whole entity data
|
|
543
|
+
* @param entityPriorChanges - The current Entity.
|
|
544
|
+
* It Is used to get changed values and only update them instead of sending the whole entity data.
|
|
524
545
|
*/
|
|
525
546
|
async update(entity, entityPriorChanges) {
|
|
526
547
|
const reqBody = omit(EntityUtilities.difference(entity, entityPriorChanges), EntityUtilities.getOmitForUpdate(entity));
|
|
@@ -529,8 +550,9 @@ class EntityService {
|
|
|
529
550
|
this.entitiesSubject.next(this.entities);
|
|
530
551
|
}
|
|
531
552
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
553
|
+
* Deletes a specific Entity.
|
|
554
|
+
*
|
|
555
|
+
* @param id - The id of the element to delete.
|
|
534
556
|
*/
|
|
535
557
|
async delete(id) {
|
|
536
558
|
await firstValueFrom(this.http.delete(`${this.baseUrl}/${id}`));
|
|
@@ -539,30 +561,91 @@ class EntityService {
|
|
|
539
561
|
}
|
|
540
562
|
}
|
|
541
563
|
|
|
542
|
-
class
|
|
543
|
-
constructor(
|
|
544
|
-
this.
|
|
545
|
-
this.
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
this.
|
|
564
|
+
class ConfirmDialogDataInternal {
|
|
565
|
+
constructor(text, type, confirmButtonLabel, cancelButtonLabel, title, requireConfirmation, confirmationText) {
|
|
566
|
+
this.text = text;
|
|
567
|
+
this.type = type;
|
|
568
|
+
this.confirmButtonLabel = confirmButtonLabel;
|
|
569
|
+
this.cancelButtonLabel = cancelButtonLabel;
|
|
570
|
+
this.title = title;
|
|
571
|
+
this.requireConfirmation = requireConfirmation;
|
|
572
|
+
this.confirmationText = confirmationText;
|
|
550
573
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
574
|
+
}
|
|
575
|
+
class ConfirmDialogDataBuilder {
|
|
576
|
+
constructor(data) {
|
|
577
|
+
this.validateInput(data);
|
|
578
|
+
this.dataInput = data;
|
|
579
|
+
this.confirmDialogData = new ConfirmDialogDataInternal(data?.text ? data.text : ['Do you really want to do this?'], data?.type ? data.type : 'default', data?.confirmButtonLabel ? data.confirmButtonLabel : 'Confirm', data?.cancelButtonLabel ? data.cancelButtonLabel : 'Cancel', data?.title ? data.title : 'Confirmation', data?.requireConfirmation ? data.requireConfirmation : false, data?.confirmationText);
|
|
580
|
+
return this;
|
|
581
|
+
}
|
|
582
|
+
validateInput(data) {
|
|
583
|
+
if (!data) {
|
|
584
|
+
return;
|
|
556
585
|
}
|
|
557
|
-
if (
|
|
558
|
-
throw new Error(
|
|
586
|
+
if (data.requireConfirmation && !data.confirmationText) {
|
|
587
|
+
throw new Error(`Missing required Input data "confirmationText".
|
|
588
|
+
You can only omit this value when "requireConfirmation" is false.`);
|
|
559
589
|
}
|
|
560
|
-
if (
|
|
561
|
-
|
|
590
|
+
if (!data.requireConfirmation && data.confirmationText) {
|
|
591
|
+
throw new Error('The "confirmationText" will never be shown because "requireConfirmation" is not set to true');
|
|
562
592
|
}
|
|
563
|
-
if (
|
|
593
|
+
if (data.type === 'info-only' && data.cancelButtonLabel) {
|
|
564
594
|
throw new Error('The "cancelButtonLabel" will never be shown because "type" is set to "info-only"');
|
|
565
595
|
}
|
|
596
|
+
}
|
|
597
|
+
withDefaultText(text) {
|
|
598
|
+
if (!this.dataInput?.text) {
|
|
599
|
+
this.confirmDialogData.text = text;
|
|
600
|
+
}
|
|
601
|
+
return this;
|
|
602
|
+
}
|
|
603
|
+
withDefaultType(type) {
|
|
604
|
+
if (!this.dataInput?.type) {
|
|
605
|
+
this.confirmDialogData.type = type;
|
|
606
|
+
}
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
withDefaultConfirmButtonLabel(label) {
|
|
610
|
+
if (!this.dataInput?.confirmButtonLabel) {
|
|
611
|
+
this.confirmDialogData.confirmButtonLabel = label;
|
|
612
|
+
}
|
|
613
|
+
return this;
|
|
614
|
+
}
|
|
615
|
+
withDefaultCancelButtonLabel(label) {
|
|
616
|
+
if (!this.dataInput?.cancelButtonLabel) {
|
|
617
|
+
this.confirmDialogData.cancelButtonLabel = label;
|
|
618
|
+
}
|
|
619
|
+
return this;
|
|
620
|
+
}
|
|
621
|
+
withDefaultTitle(title) {
|
|
622
|
+
if (!this.dataInput?.title) {
|
|
623
|
+
this.confirmDialogData.title = title;
|
|
624
|
+
}
|
|
625
|
+
return this;
|
|
626
|
+
}
|
|
627
|
+
withDefaultRequireConfirmation(requireConfirmation) {
|
|
628
|
+
if (this.dataInput?.requireConfirmation === undefined) {
|
|
629
|
+
this.confirmDialogData.requireConfirmation = requireConfirmation;
|
|
630
|
+
}
|
|
631
|
+
return this;
|
|
632
|
+
}
|
|
633
|
+
withDefaultConfirmationText(confirmationText) {
|
|
634
|
+
if (!this.dataInput?.confirmationText) {
|
|
635
|
+
this.confirmDialogData.confirmationText = confirmationText;
|
|
636
|
+
}
|
|
637
|
+
return this;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
class NgxMatEntityConfirmDialogComponent {
|
|
642
|
+
constructor(dialogRef, inputData) {
|
|
643
|
+
this.dialogRef = dialogRef;
|
|
644
|
+
this.inputData = inputData;
|
|
645
|
+
this.confirm = false;
|
|
646
|
+
}
|
|
647
|
+
ngOnInit() {
|
|
648
|
+
this.data = new ConfirmDialogDataBuilder(this.inputData).confirmDialogData;
|
|
566
649
|
this.dialogRef.disableClose = true;
|
|
567
650
|
}
|
|
568
651
|
confirmAction() {
|
|
@@ -573,10 +656,10 @@ class NgxMatEntityConfirmDialogComponent {
|
|
|
573
656
|
}
|
|
574
657
|
}
|
|
575
658
|
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 });
|
|
576
|
-
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
|
|
659
|
+
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: 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: 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: i7.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: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
577
660
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogComponent, decorators: [{
|
|
578
661
|
type: Component,
|
|
579
|
-
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
|
|
662
|
+
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"] }]
|
|
580
663
|
}], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
581
664
|
type: Inject,
|
|
582
665
|
args: [MAT_DIALOG_DATA]
|
|
@@ -598,8 +681,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
598
681
|
|
|
599
682
|
/**
|
|
600
683
|
* Generates a default error message for most validation errors.
|
|
601
|
-
*
|
|
602
|
-
* @
|
|
684
|
+
*
|
|
685
|
+
* @param model - The ngModel to get the error from.
|
|
686
|
+
* @returns The Validation Error Message to display.
|
|
603
687
|
*/
|
|
604
688
|
function getValidationErrorMessage(model) {
|
|
605
689
|
if (model.hasError('matDatepickerParse')) {
|
|
@@ -628,70 +712,87 @@ function getValidationErrorMessage(model) {
|
|
|
628
712
|
}
|
|
629
713
|
}
|
|
630
714
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
return baseProperty(new EntityArrayDecoratorConfig(metadata), DecoratorTypes.ARRAY);
|
|
639
|
-
case DecoratorTypes.STRING:
|
|
640
|
-
return baseProperty(new StringChipsArrayDecoratorConfig(metadata), DecoratorTypes.ARRAY_STRING_CHIPS);
|
|
641
|
-
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
642
|
-
return baseProperty(new AutocompleteStringChipsArrayDecoratorConfig(metadata), DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS);
|
|
643
|
-
default:
|
|
644
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
645
|
-
throw new Error(`Unknown itemType ${metadata.itemType}`);
|
|
715
|
+
class CreateDialogDataInternal {
|
|
716
|
+
constructor(title, createButtonLabel, cancelButtonLabel, createRequiresConfirmDialog, confirmCreateDialogData) {
|
|
717
|
+
this.title = title;
|
|
718
|
+
this.createButtonLabel = createButtonLabel;
|
|
719
|
+
this.cancelButtonLabel = cancelButtonLabel;
|
|
720
|
+
this.createRequiresConfirmDialog = createRequiresConfirmDialog;
|
|
721
|
+
this.confirmCreateDialogData = confirmCreateDialogData;
|
|
646
722
|
}
|
|
647
723
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
this.
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
this
|
|
665
|
-
|
|
724
|
+
class CreateDialogDataBuilder {
|
|
725
|
+
constructor(data) {
|
|
726
|
+
// this.validateInput(data);
|
|
727
|
+
this.dataInput = data;
|
|
728
|
+
const confirmCreateDialogData = new ConfirmDialogDataBuilder(data?.confirmCreateDialogData)
|
|
729
|
+
.withDefaultConfirmButtonLabel('Create')
|
|
730
|
+
.withDefaultText(['Do you really want to create this entity?'])
|
|
731
|
+
.withDefaultTitle('Create')
|
|
732
|
+
.confirmDialogData;
|
|
733
|
+
this.createDialogData = new CreateDialogDataInternal(data?.title ? data.title : 'Create', data?.createButtonLabel ? data.createButtonLabel : 'Create', data?.cancelButtonLabel ? data.cancelButtonLabel : 'Cancel', data?.createRequiresConfirmDialog ? data.createRequiresConfirmDialog : false, confirmCreateDialogData);
|
|
734
|
+
return this;
|
|
735
|
+
}
|
|
736
|
+
withDefaultTitle(title) {
|
|
737
|
+
if (!this.dataInput?.title) {
|
|
738
|
+
this.createDialogData.title = title;
|
|
739
|
+
}
|
|
740
|
+
return this;
|
|
741
|
+
}
|
|
742
|
+
withDefaultCreateButtonLabel(label) {
|
|
743
|
+
if (!this.dataInput?.createButtonLabel) {
|
|
744
|
+
this.createDialogData.createButtonLabel = label;
|
|
745
|
+
}
|
|
746
|
+
return this;
|
|
747
|
+
}
|
|
748
|
+
withDefaultCancelButtonLabel(label) {
|
|
749
|
+
if (!this.dataInput?.cancelButtonLabel) {
|
|
750
|
+
this.createDialogData.cancelButtonLabel = label;
|
|
751
|
+
}
|
|
752
|
+
return this;
|
|
753
|
+
}
|
|
754
|
+
withDefaultCreateRequiresConfirmDialog(createRequiresConfirmDialog) {
|
|
755
|
+
if (this.dataInput?.createRequiresConfirmDialog === undefined) {
|
|
756
|
+
this.createDialogData.createRequiresConfirmDialog = createRequiresConfirmDialog;
|
|
757
|
+
}
|
|
758
|
+
return this;
|
|
759
|
+
}
|
|
760
|
+
withDefaultConfirmCreateDialogData(confirmCreateDialogData) {
|
|
761
|
+
if (this.dataInput?.confirmCreateDialogData === undefined) {
|
|
762
|
+
this.createDialogData.confirmCreateDialogData = confirmCreateDialogData;
|
|
763
|
+
}
|
|
764
|
+
return this;
|
|
666
765
|
}
|
|
667
766
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
this.itemType = metadata.itemType;
|
|
675
|
-
this.displayStyle = metadata.displayStyle;
|
|
676
|
-
this.deleteHtml = metadata.deleteHtml;
|
|
677
|
-
this.minLength = metadata.minLength;
|
|
678
|
-
this.maxLength = metadata.maxLength;
|
|
679
|
-
this.regex = metadata.regex;
|
|
767
|
+
|
|
768
|
+
class AddArrayItemDialogDataInternal {
|
|
769
|
+
constructor(entity, createDialogData, getValidationErrorMessage) {
|
|
770
|
+
this.entity = entity;
|
|
771
|
+
this.createDialogData = createDialogData;
|
|
772
|
+
this.getValidationErrorMessage = getValidationErrorMessage;
|
|
680
773
|
}
|
|
681
774
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
this.
|
|
690
|
-
this
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
this.
|
|
694
|
-
|
|
775
|
+
class AddArrayItemDialogDataBuilder {
|
|
776
|
+
constructor(data) {
|
|
777
|
+
this.dataInput = data;
|
|
778
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData)
|
|
779
|
+
.withDefaultCreateButtonLabel('Add')
|
|
780
|
+
.withDefaultTitle('Add to array')
|
|
781
|
+
.createDialogData;
|
|
782
|
+
this.addArrayItemDialogData = new AddArrayItemDialogDataInternal(data.entity, createDialogData, data.getValidationErrorMessage ? data.getValidationErrorMessage : getValidationErrorMessage);
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
785
|
+
withDefaultCreateDialogData(createDialogData) {
|
|
786
|
+
if (!this.dataInput.createDialogData) {
|
|
787
|
+
this.addArrayItemDialogData.createDialogData = createDialogData;
|
|
788
|
+
}
|
|
789
|
+
return this;
|
|
790
|
+
}
|
|
791
|
+
withDefaultGetValidationErrorMessage(getValidationErrorMessage) {
|
|
792
|
+
if (!this.dataInput.getValidationErrorMessage) {
|
|
793
|
+
this.addArrayItemDialogData.getValidationErrorMessage = getValidationErrorMessage;
|
|
794
|
+
}
|
|
795
|
+
return this;
|
|
695
796
|
}
|
|
696
797
|
}
|
|
697
798
|
|
|
@@ -700,9 +801,6 @@ class NgxMatEntityInternalInputComponent {
|
|
|
700
801
|
this.DecoratorTypes = DecoratorTypes;
|
|
701
802
|
this.getWidth = EntityUtilities.getWidth;
|
|
702
803
|
}
|
|
703
|
-
/**
|
|
704
|
-
* Helper method needed to recursively generate property input components (used eg. with the object)
|
|
705
|
-
*/
|
|
706
804
|
trackByFn(index) {
|
|
707
805
|
return index;
|
|
708
806
|
}
|
|
@@ -755,13 +853,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
755
853
|
}] } });
|
|
756
854
|
|
|
757
855
|
class NgxMatEntityAddArrayItemDialogComponent {
|
|
758
|
-
constructor(
|
|
759
|
-
this.
|
|
856
|
+
constructor(inputData, dialogRef) {
|
|
857
|
+
this.inputData = inputData;
|
|
760
858
|
this.dialogRef = dialogRef;
|
|
761
859
|
this.EntityUtilities = EntityUtilities;
|
|
762
860
|
this.getWidth = EntityUtilities.getWidth;
|
|
763
861
|
}
|
|
764
862
|
ngOnInit() {
|
|
863
|
+
this.data = new AddArrayItemDialogDataBuilder(this.inputData).addArrayItemDialogData;
|
|
765
864
|
this.dialogRef.disableClose = true;
|
|
766
865
|
this.setEntityKeys();
|
|
767
866
|
}
|
|
@@ -779,15 +878,54 @@ class NgxMatEntityAddArrayItemDialogComponent {
|
|
|
779
878
|
}
|
|
780
879
|
}
|
|
781
880
|
NgxMatEntityAddArrayItemDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
782
|
-
NgxMatEntityAddArrayItemDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityAddArrayItemDialogComponent, selector: "ngx-mat-entity-add-array-item-dialog", ngImport: i0, template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of entityKeys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"data.getValidationErrorMessage\"\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-internal-input>\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
|
|
881
|
+
NgxMatEntityAddArrayItemDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityAddArrayItemDialogComponent, selector: "ngx-mat-entity-add-array-item-dialog", ngImport: i0, template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of entityKeys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"data.getValidationErrorMessage\"\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-internal-input>\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: NgxMatEntityInternalInputComponent, selector: "ngx-mat-entity-internal-input", inputs: ["entity", "propertyKey", "hideOmitForCreate", "hideOmitForEdit", "getValidationErrorMessage"] }, { 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: i12.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i12.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i12.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
783
882
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogComponent, decorators: [{
|
|
784
883
|
type: Component,
|
|
785
|
-
args: [{ selector: 'ngx-mat-entity-add-array-item-dialog', template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of entityKeys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"data.getValidationErrorMessage\"\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-internal-input>\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
|
|
884
|
+
args: [{ selector: 'ngx-mat-entity-add-array-item-dialog', template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of entityKeys\"\n [entity]=\"data.entity\"\n [propertyKey]=\"key\"\n [hideOmitForCreate]=\"true\"\n [getValidationErrorMessage]=\"data.getValidationErrorMessage\"\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-internal-input>\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"] }]
|
|
786
885
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
787
886
|
type: Inject,
|
|
788
887
|
args: [MAT_DIALOG_DATA]
|
|
789
888
|
}] }, { type: i1.MatDialogRef }]; } });
|
|
790
889
|
|
|
890
|
+
class EntityArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
891
|
+
constructor(data) {
|
|
892
|
+
super(data);
|
|
893
|
+
this.createDialogData = data.createDialogData;
|
|
894
|
+
this.displayStyle = data.displayStyle;
|
|
895
|
+
this.itemType = data.itemType;
|
|
896
|
+
this.EntityClass = data.EntityClass;
|
|
897
|
+
this.displayColumns = data.displayColumns;
|
|
898
|
+
this.createInline = data.createInline != undefined ? data.createInline : true;
|
|
899
|
+
this.missingErrorMessage = data.missingErrorMessage ? data.missingErrorMessage : 'Needs to contain at least one value';
|
|
900
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [12, 12, 12];
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
class StringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
904
|
+
constructor(data) {
|
|
905
|
+
super(data);
|
|
906
|
+
this.deleteHtml = data.deleteHtml;
|
|
907
|
+
this.displayStyle = data.displayStyle;
|
|
908
|
+
this.itemType = data.itemType;
|
|
909
|
+
this.maxLength = data.maxLength;
|
|
910
|
+
this.minLength = data.minLength;
|
|
911
|
+
this.regex = data.regex;
|
|
912
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 12, 12];
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
class AutocompleteStringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
916
|
+
constructor(data) {
|
|
917
|
+
super(data);
|
|
918
|
+
this.autocompleteValues = data.autocompleteValues;
|
|
919
|
+
this.deleteHtml = data.deleteHtml;
|
|
920
|
+
this.displayStyle = data.displayStyle;
|
|
921
|
+
this.itemType = data.itemType;
|
|
922
|
+
this.maxLength = data.maxLength;
|
|
923
|
+
this.minLength = data.minLength;
|
|
924
|
+
this.regex = data.regex;
|
|
925
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 12, 12];
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
791
929
|
class NgxMatEntityArrayTableComponent {
|
|
792
930
|
constructor(dialog) {
|
|
793
931
|
this.dialog = dialog;
|
|
@@ -799,19 +937,19 @@ class NgxMatEntityArrayTableComponent {
|
|
|
799
937
|
return index;
|
|
800
938
|
}
|
|
801
939
|
ngOnInit() {
|
|
802
|
-
this.validateInput();
|
|
803
940
|
const givenDisplayColumns = this.metadata.displayColumns.map((v) => v.displayName);
|
|
804
|
-
|
|
805
|
-
throw new Error(`The name "select" for a display column is reserved.
|
|
806
|
-
Please choose a different name.`);
|
|
807
|
-
}
|
|
941
|
+
this.validateInput(givenDisplayColumns);
|
|
808
942
|
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
809
943
|
this.dataSource = new MatTableDataSource();
|
|
810
944
|
this.dataSource.data = this.arrayItems;
|
|
811
945
|
this.arrayItem = new this.metadata.EntityClass();
|
|
812
946
|
this.arrayItemPriorChanges = cloneDeep(this.arrayItem);
|
|
813
947
|
}
|
|
814
|
-
validateInput() {
|
|
948
|
+
validateInput(givenDisplayColumns) {
|
|
949
|
+
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
950
|
+
throw new Error(`The name "select" for a display column is reserved.
|
|
951
|
+
Please choose a different name.`);
|
|
952
|
+
}
|
|
815
953
|
if (!this.metadata.createInline && !this.metadata.createDialogData) {
|
|
816
954
|
throw new Error(`Missing required Input data "createDialogData".
|
|
817
955
|
You can only omit this value when the creation is inline.`);
|
|
@@ -824,11 +962,13 @@ class NgxMatEntityArrayTableComponent {
|
|
|
824
962
|
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
825
963
|
}
|
|
826
964
|
else {
|
|
827
|
-
const
|
|
965
|
+
const dialogInputData = {
|
|
828
966
|
entity: this.arrayItem,
|
|
829
967
|
createDialogData: this.metadata.createDialogData,
|
|
830
968
|
getValidationErrorMessage: this.getValidationErrorMessage
|
|
831
969
|
};
|
|
970
|
+
const dialogData = new AddArrayItemDialogDataBuilder(dialogInputData)
|
|
971
|
+
.addArrayItemDialogData;
|
|
832
972
|
firstValueFrom(this.dialog.open(NgxMatEntityAddArrayItemDialogComponent, {
|
|
833
973
|
data: dialogData,
|
|
834
974
|
autoFocus: false,
|
|
@@ -874,10 +1014,10 @@ class NgxMatEntityArrayTableComponent {
|
|
|
874
1014
|
}
|
|
875
1015
|
}
|
|
876
1016
|
NgxMatEntityArrayTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
877
|
-
NgxMatEntityArrayTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityArrayTableComponent, selector: "ngx-mat-entity-array-table", inputs: { arrayItems: "arrayItems", metadata: "metadata", getValidationErrorMessage: "getValidationErrorMessage", omit: "omit" }, ngImport: i0, template: "<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>{{metadata.displayName}}</b>\n </div>\n <div class=\"row\" *ngIf=\"metadata.createInline\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); 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-internal-input>\n </div>\n <div class=\"buttons\">\n <button mat-raised-button\n [disabled]=\"metadata.createInline && !EntityUtilities.isEntityValid(arrayItem, 'create')\"\n (click)=\"add()\">\n Add\n </button>\n <button mat-raised-button\n [disabled]=\"!selection.selected.length\"\n (click)=\"remove()\">\n Remove\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 (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 metadata.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=\"metadata.required && !dataSource.data.length\">\n {{metadata.missingErrorMessage
|
|
1017
|
+
NgxMatEntityArrayTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityArrayTableComponent, selector: "ngx-mat-entity-array-table", inputs: { arrayItems: "arrayItems", metadata: "metadata", getValidationErrorMessage: "getValidationErrorMessage", omit: "omit" }, ngImport: i0, template: "<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>{{metadata.displayName}}</b>\n </div>\n <div class=\"row\" *ngIf=\"metadata.createInline\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); 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-internal-input>\n </div>\n <div class=\"buttons\">\n <button mat-raised-button\n [disabled]=\"metadata.createInline && !EntityUtilities.isEntityValid(arrayItem, 'create')\"\n (click)=\"add()\">\n Add\n </button>\n <button mat-raised-button\n [disabled]=\"!selection.selected.length\"\n (click)=\"remove()\">\n Remove\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 (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 metadata.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=\"metadata.required && !dataSource.data.length\">\n {{metadata.missingErrorMessage}}\n </div>\n</div>", styles: [".buttons{display:flex;justify-content:space-between;margin-bottom:10px;margin-top:5px}mat-table{border:1px solid #E0E0E0;border-radius:5px;padding-top:5px;padding-bottom:25px}.mat-column-select{flex:0 0 75px}.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: NgxMatEntityInternalInputComponent, selector: "ngx-mat-entity-internal-input", inputs: ["entity", "propertyKey", "hideOmitForCreate", "hideOmitForEdit", "getValidationErrorMessage"] }, { 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.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { 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: i4$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i4$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i4$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i4$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i4$1.MatCellDef, selector: "[matCellDef]" }, { type: i4$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i4$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i4$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }] });
|
|
878
1018
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableComponent, decorators: [{
|
|
879
1019
|
type: Component,
|
|
880
|
-
args: [{ selector: 'ngx-mat-entity-array-table', template: "<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>{{metadata.displayName}}</b>\n </div>\n <div class=\"row\" *ngIf=\"metadata.createInline\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); 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-internal-input>\n </div>\n <div class=\"buttons\">\n <button mat-raised-button\n [disabled]=\"metadata.createInline && !EntityUtilities.isEntityValid(arrayItem, 'create')\"\n (click)=\"add()\">\n Add\n </button>\n <button mat-raised-button\n [disabled]=\"!selection.selected.length\"\n (click)=\"remove()\">\n Remove\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 (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 metadata.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=\"metadata.required && !dataSource.data.length\">\n {{metadata.missingErrorMessage
|
|
1020
|
+
args: [{ selector: 'ngx-mat-entity-array-table', template: "<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>{{metadata.displayName}}</b>\n </div>\n <div class=\"row\" *ngIf=\"metadata.createInline\">\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); 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-internal-input>\n </div>\n <div class=\"buttons\">\n <button mat-raised-button\n [disabled]=\"metadata.createInline && !EntityUtilities.isEntityValid(arrayItem, 'create')\"\n (click)=\"add()\">\n Add\n </button>\n <button mat-raised-button\n [disabled]=\"!selection.selected.length\"\n (click)=\"remove()\">\n Remove\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 (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 metadata.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=\"metadata.required && !dataSource.data.length\">\n {{metadata.missingErrorMessage}}\n </div>\n</div>", styles: [".buttons{display:flex;justify-content:space-between;margin-bottom:10px;margin-top:5px}mat-table{border:1px solid #E0E0E0;border-radius:5px;padding-top:5px;padding-bottom:25px}.mat-column-select{flex:0 0 75px}.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"] }]
|
|
881
1021
|
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { arrayItems: [{
|
|
882
1022
|
type: Input
|
|
883
1023
|
}], metadata: [{
|
|
@@ -894,9 +1034,6 @@ class NgxMatEntityInputComponent {
|
|
|
894
1034
|
this.DecoratorTypes = DecoratorTypes;
|
|
895
1035
|
this.getWidth = EntityUtilities.getWidth;
|
|
896
1036
|
}
|
|
897
|
-
/**
|
|
898
|
-
* Helper method needed to recursively generate property input components (used eg. with the object)
|
|
899
|
-
*/
|
|
900
1037
|
trackByFn(index) {
|
|
901
1038
|
return index;
|
|
902
1039
|
}
|
|
@@ -1011,10 +1148,10 @@ class NgxMatEntityInputComponent {
|
|
|
1011
1148
|
}
|
|
1012
1149
|
}
|
|
1013
1150
|
NgxMatEntityInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1014
|
-
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 ? metadata.required : false\"\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 ? metadata.required : false\"\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 ? metadata.required : false\"\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 ? metadata.required : false\">\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 ? metadata.required : false\">\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 ? metadata.required : false\">\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 ? metadata.required : false\">\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 ? metadata.required : false\"\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 ? metadata.required : false\">\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' : 'edit'\"\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 ? metadata.required : false\"\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 ? metadata.required : false\"\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]" }] });
|
|
1151
|
+
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]" }] });
|
|
1015
1152
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, decorators: [{
|
|
1016
1153
|
type: Component,
|
|
1017
|
-
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 ? metadata.required : false\"\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 ? metadata.required : false\"\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 ? metadata.required : false\"\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 ? metadata.required : false\">\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 ? metadata.required : false\">\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 ? metadata.required : false\">\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 ? metadata.required : false\">\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 ? metadata.required : false\"\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 ? metadata.required : false\">\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' : 'edit'\"\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 ? metadata.required : false\"\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 ? metadata.required : false\"\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"] }]
|
|
1154
|
+
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"] }]
|
|
1018
1155
|
}], ctorParameters: function () { return []; }, propDecorators: { entity: [{
|
|
1019
1156
|
type: Input
|
|
1020
1157
|
}], propertyKey: [{
|
|
@@ -1027,114 +1164,367 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1027
1164
|
type: Input
|
|
1028
1165
|
}] } });
|
|
1029
1166
|
|
|
1030
|
-
class
|
|
1031
|
-
constructor(data, dialogRef, injector, dialog) {
|
|
1032
|
-
this.data = data;
|
|
1033
|
-
this.dialogRef = dialogRef;
|
|
1034
|
-
this.injector = injector;
|
|
1035
|
-
this.dialog = dialog;
|
|
1036
|
-
this.EntityUtilities = EntityUtilities;
|
|
1037
|
-
this.getWidth = EntityUtilities.getWidth;
|
|
1038
|
-
}
|
|
1039
|
-
ngOnInit() {
|
|
1040
|
-
this.dialogRef.disableClose = true;
|
|
1041
|
-
this.setEntityKeys();
|
|
1042
|
-
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1043
|
-
}
|
|
1044
|
-
setEntityKeys() {
|
|
1045
|
-
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
1046
|
-
const omitCreateKeys = EntityUtilities.getOmitForCreate(this.data.entity);
|
|
1047
|
-
this.entityKeys = this.entityKeys.filter((k) => !omitCreateKeys.includes(k))
|
|
1048
|
-
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1049
|
-
}
|
|
1050
|
-
create() {
|
|
1051
|
-
if (this.data.createDialogData.createRequiresConfirmDialog === false) {
|
|
1052
|
-
return this.confirmCreate();
|
|
1053
|
-
}
|
|
1054
|
-
const dialogData = {
|
|
1055
|
-
// eslint-disable-next-line max-len
|
|
1056
|
-
text: this.data.createDialogData.confirmCreateDialogData?.text ? this.data.createDialogData.confirmCreateDialogData?.text : ['Do you really want to create this entity?'],
|
|
1057
|
-
type: 'default',
|
|
1058
|
-
// eslint-disable-next-line max-len
|
|
1059
|
-
confirmButtonLabel: this.data.createDialogData.confirmCreateDialogData?.confirmButtonLabel ? this.data.createDialogData.confirmCreateDialogData?.confirmButtonLabel : 'Create',
|
|
1060
|
-
// eslint-disable-next-line max-len
|
|
1061
|
-
cancelButtonLabel: this.data.createDialogData.confirmCreateDialogData?.cancelButtonLabel ? this.data.createDialogData.confirmCreateDialogData?.cancelButtonLabel : 'Cancel',
|
|
1062
|
-
// eslint-disable-next-line max-len
|
|
1063
|
-
title: this.data.createDialogData.confirmCreateDialogData?.title ? this.data.createDialogData.confirmCreateDialogData?.title : 'Create',
|
|
1064
|
-
// eslint-disable-next-line max-len
|
|
1065
|
-
requireConfirmation: this.data.createDialogData.confirmCreateDialogData?.requireConfirmation ? this.data.createDialogData.confirmCreateDialogData?.requireConfirmation : false,
|
|
1066
|
-
// eslint-disable-next-line max-len
|
|
1067
|
-
confirmationText: this.data.createDialogData.confirmCreateDialogData?.confirmationText ? this.data.createDialogData.confirmCreateDialogData?.confirmationText : undefined,
|
|
1068
|
-
};
|
|
1069
|
-
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1070
|
-
data: dialogData,
|
|
1071
|
-
autoFocus: false,
|
|
1072
|
-
restoreFocus: false
|
|
1073
|
-
});
|
|
1074
|
-
dialogref.afterClosed().subscribe((res) => {
|
|
1075
|
-
if (res === 1) {
|
|
1076
|
-
this.confirmCreate();
|
|
1077
|
-
}
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
confirmCreate() {
|
|
1081
|
-
this.entityService.create(this.data.entity).then(() => this.dialogRef.close());
|
|
1082
|
-
}
|
|
1083
|
-
cancel() {
|
|
1084
|
-
this.dialogRef.close();
|
|
1085
|
-
}
|
|
1167
|
+
class NgxMatEntityInternalInputModule {
|
|
1086
1168
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1169
|
+
NgxMatEntityInternalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1170
|
+
NgxMatEntityInternalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, declarations: [NgxMatEntityInternalInputComponent], imports: [CommonModule,
|
|
1171
|
+
MatInputModule,
|
|
1172
|
+
FormsModule,
|
|
1173
|
+
MatFormFieldModule,
|
|
1174
|
+
MatSelectModule,
|
|
1175
|
+
MatAutocompleteModule,
|
|
1176
|
+
MatCheckboxModule,
|
|
1177
|
+
MatSlideToggleModule,
|
|
1178
|
+
MatTableModule], exports: [NgxMatEntityInternalInputComponent] });
|
|
1179
|
+
NgxMatEntityInternalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, imports: [[
|
|
1180
|
+
CommonModule,
|
|
1181
|
+
MatInputModule,
|
|
1182
|
+
FormsModule,
|
|
1183
|
+
MatFormFieldModule,
|
|
1184
|
+
MatSelectModule,
|
|
1185
|
+
MatAutocompleteModule,
|
|
1186
|
+
MatCheckboxModule,
|
|
1187
|
+
MatSlideToggleModule,
|
|
1188
|
+
MatTableModule
|
|
1189
|
+
]] });
|
|
1190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, decorators: [{
|
|
1191
|
+
type: NgModule,
|
|
1192
|
+
args: [{
|
|
1193
|
+
declarations: [NgxMatEntityInternalInputComponent],
|
|
1194
|
+
imports: [
|
|
1195
|
+
CommonModule,
|
|
1196
|
+
MatInputModule,
|
|
1197
|
+
FormsModule,
|
|
1198
|
+
MatFormFieldModule,
|
|
1199
|
+
MatSelectModule,
|
|
1200
|
+
MatAutocompleteModule,
|
|
1201
|
+
MatCheckboxModule,
|
|
1202
|
+
MatSlideToggleModule,
|
|
1203
|
+
MatTableModule
|
|
1204
|
+
],
|
|
1205
|
+
exports: [NgxMatEntityInternalInputComponent]
|
|
1206
|
+
}]
|
|
1207
|
+
}] });
|
|
1096
1208
|
|
|
1097
|
-
class
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1209
|
+
class NgxMatEntityAddArrayItemDialogModule {
|
|
1210
|
+
}
|
|
1211
|
+
NgxMatEntityAddArrayItemDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1212
|
+
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] });
|
|
1213
|
+
NgxMatEntityAddArrayItemDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, imports: [[CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, decorators: [{
|
|
1215
|
+
type: NgModule,
|
|
1216
|
+
args: [{
|
|
1217
|
+
declarations: [NgxMatEntityAddArrayItemDialogComponent],
|
|
1218
|
+
imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1219
|
+
exports: [NgxMatEntityAddArrayItemDialogComponent]
|
|
1220
|
+
}]
|
|
1221
|
+
}] });
|
|
1222
|
+
|
|
1223
|
+
class NgxMatEntityArrayTableModule {
|
|
1224
|
+
}
|
|
1225
|
+
NgxMatEntityArrayTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1226
|
+
NgxMatEntityArrayTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, declarations: [NgxMatEntityArrayTableComponent], imports: [CommonModule,
|
|
1227
|
+
MatInputModule,
|
|
1228
|
+
FormsModule,
|
|
1229
|
+
MatFormFieldModule,
|
|
1230
|
+
MatSelectModule,
|
|
1231
|
+
MatAutocompleteModule,
|
|
1232
|
+
MatCheckboxModule,
|
|
1233
|
+
MatSlideToggleModule,
|
|
1234
|
+
MatTableModule,
|
|
1235
|
+
NgxMatEntityInternalInputModule,
|
|
1236
|
+
MatButtonModule,
|
|
1237
|
+
NgxMatEntityAddArrayItemDialogModule], exports: [NgxMatEntityArrayTableComponent] });
|
|
1238
|
+
NgxMatEntityArrayTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, imports: [[
|
|
1239
|
+
CommonModule,
|
|
1240
|
+
MatInputModule,
|
|
1241
|
+
FormsModule,
|
|
1242
|
+
MatFormFieldModule,
|
|
1243
|
+
MatSelectModule,
|
|
1244
|
+
MatAutocompleteModule,
|
|
1245
|
+
MatCheckboxModule,
|
|
1246
|
+
MatSlideToggleModule,
|
|
1247
|
+
MatTableModule,
|
|
1248
|
+
NgxMatEntityInternalInputModule,
|
|
1249
|
+
MatButtonModule,
|
|
1250
|
+
NgxMatEntityAddArrayItemDialogModule
|
|
1251
|
+
]] });
|
|
1252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, decorators: [{
|
|
1253
|
+
type: NgModule,
|
|
1254
|
+
args: [{
|
|
1255
|
+
declarations: [NgxMatEntityArrayTableComponent],
|
|
1256
|
+
imports: [
|
|
1257
|
+
CommonModule,
|
|
1258
|
+
MatInputModule,
|
|
1259
|
+
FormsModule,
|
|
1260
|
+
MatFormFieldModule,
|
|
1261
|
+
MatSelectModule,
|
|
1262
|
+
MatAutocompleteModule,
|
|
1263
|
+
MatCheckboxModule,
|
|
1264
|
+
MatSlideToggleModule,
|
|
1265
|
+
MatTableModule,
|
|
1266
|
+
NgxMatEntityInternalInputModule,
|
|
1267
|
+
MatButtonModule,
|
|
1268
|
+
NgxMatEntityAddArrayItemDialogModule
|
|
1269
|
+
],
|
|
1270
|
+
exports: [NgxMatEntityArrayTableComponent]
|
|
1271
|
+
}]
|
|
1272
|
+
}] });
|
|
1273
|
+
|
|
1274
|
+
class NgxMatEntityInputModule {
|
|
1275
|
+
}
|
|
1276
|
+
NgxMatEntityInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1277
|
+
NgxMatEntityInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, declarations: [NgxMatEntityInputComponent], imports: [CommonModule,
|
|
1278
|
+
MatInputModule,
|
|
1279
|
+
FormsModule,
|
|
1280
|
+
MatFormFieldModule,
|
|
1281
|
+
MatSelectModule,
|
|
1282
|
+
MatAutocompleteModule,
|
|
1283
|
+
MatCheckboxModule,
|
|
1284
|
+
MatSlideToggleModule,
|
|
1285
|
+
NgxMatEntityArrayTableModule,
|
|
1286
|
+
MatChipsModule,
|
|
1287
|
+
MatIconModule], exports: [NgxMatEntityInputComponent] });
|
|
1288
|
+
NgxMatEntityInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, imports: [[
|
|
1289
|
+
CommonModule,
|
|
1290
|
+
MatInputModule,
|
|
1291
|
+
FormsModule,
|
|
1292
|
+
MatFormFieldModule,
|
|
1293
|
+
MatSelectModule,
|
|
1294
|
+
MatAutocompleteModule,
|
|
1295
|
+
MatCheckboxModule,
|
|
1296
|
+
MatSlideToggleModule,
|
|
1297
|
+
NgxMatEntityArrayTableModule,
|
|
1298
|
+
MatChipsModule,
|
|
1299
|
+
MatIconModule
|
|
1300
|
+
]] });
|
|
1301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, decorators: [{
|
|
1302
|
+
type: NgModule,
|
|
1303
|
+
args: [{
|
|
1304
|
+
declarations: [NgxMatEntityInputComponent],
|
|
1305
|
+
imports: [
|
|
1306
|
+
CommonModule,
|
|
1307
|
+
MatInputModule,
|
|
1308
|
+
FormsModule,
|
|
1309
|
+
MatFormFieldModule,
|
|
1310
|
+
MatSelectModule,
|
|
1311
|
+
MatAutocompleteModule,
|
|
1312
|
+
MatCheckboxModule,
|
|
1313
|
+
MatSlideToggleModule,
|
|
1314
|
+
NgxMatEntityArrayTableModule,
|
|
1315
|
+
MatChipsModule,
|
|
1316
|
+
MatIconModule
|
|
1317
|
+
],
|
|
1318
|
+
exports: [NgxMatEntityInputComponent]
|
|
1319
|
+
}]
|
|
1320
|
+
}] });
|
|
1321
|
+
|
|
1322
|
+
class CreateEntityDialogDataInternal {
|
|
1323
|
+
constructor(entity, EntityServiceClass, createDialogData) {
|
|
1324
|
+
this.entity = entity;
|
|
1325
|
+
this.EntityServiceClass = EntityServiceClass;
|
|
1326
|
+
this.createDialogData = createDialogData;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
class CreateEntityDialogDataBuilder {
|
|
1330
|
+
constructor(data) {
|
|
1331
|
+
// this.validateInput(data);
|
|
1332
|
+
this.dataInput = data;
|
|
1333
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).createDialogData;
|
|
1334
|
+
this.createDialogData = new CreateEntityDialogDataInternal(data.entity, data.EntityServiceClass, createDialogData);
|
|
1335
|
+
return this;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
class NgxMatEntityCreateDialogComponent {
|
|
1340
|
+
constructor(inputData, dialogRef, injector, dialog) {
|
|
1341
|
+
this.inputData = inputData;
|
|
1342
|
+
this.dialogRef = dialogRef;
|
|
1343
|
+
this.injector = injector;
|
|
1344
|
+
this.dialog = dialog;
|
|
1345
|
+
this.EntityUtilities = EntityUtilities;
|
|
1346
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
1347
|
+
}
|
|
1348
|
+
ngOnInit() {
|
|
1349
|
+
this.data = new CreateEntityDialogDataBuilder(this.inputData).createDialogData;
|
|
1350
|
+
this.dialogRef.disableClose = true;
|
|
1351
|
+
this.setEntityKeys();
|
|
1352
|
+
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1353
|
+
}
|
|
1354
|
+
setEntityKeys() {
|
|
1355
|
+
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
1356
|
+
const omitCreateKeys = EntityUtilities.getOmitForCreate(this.data.entity);
|
|
1357
|
+
this.entityKeys = this.entityKeys.filter((k) => !omitCreateKeys.includes(k))
|
|
1358
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1359
|
+
}
|
|
1360
|
+
create() {
|
|
1361
|
+
if (!this.data.createDialogData?.createRequiresConfirmDialog) {
|
|
1362
|
+
return this.confirmCreate();
|
|
1363
|
+
}
|
|
1364
|
+
const dialogData = new ConfirmDialogDataBuilder(this.data.createDialogData?.confirmCreateDialogData)
|
|
1365
|
+
.withDefaultText(['Do you really want to create this entity?'])
|
|
1366
|
+
.withDefaultConfirmButtonLabel('Create')
|
|
1367
|
+
.withDefaultTitle('Create')
|
|
1368
|
+
.confirmDialogData;
|
|
1369
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1370
|
+
data: dialogData,
|
|
1371
|
+
autoFocus: false,
|
|
1372
|
+
restoreFocus: false
|
|
1373
|
+
});
|
|
1374
|
+
dialogref.afterClosed().subscribe((res) => {
|
|
1375
|
+
if (res === 1) {
|
|
1376
|
+
this.confirmCreate();
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
confirmCreate() {
|
|
1381
|
+
this.entityService.create(this.data.entity).then(() => this.dialogRef.close());
|
|
1382
|
+
}
|
|
1383
|
+
cancel() {
|
|
1384
|
+
this.dialogRef.close();
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
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 });
|
|
1388
|
+
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 <ngx-mat-entity-input\n *ngFor=\"let key of entityKeys\"\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 </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: i12.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i12.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i12.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
1389
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogComponent, decorators: [{
|
|
1390
|
+
type: Component,
|
|
1391
|
+
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 <ngx-mat-entity-input\n *ngFor=\"let key of entityKeys\"\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 </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"] }]
|
|
1392
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1393
|
+
type: Inject,
|
|
1394
|
+
args: [MAT_DIALOG_DATA]
|
|
1395
|
+
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }]; } });
|
|
1396
|
+
|
|
1397
|
+
class EditDialogDataInternal {
|
|
1398
|
+
constructor(title, confirmButtonLabel, deleteButtonLabel, cancelButtonLabel, deleteRequiresConfirmDialog, editRequiresConfirmDialog, confirmDeleteDialogData, confirmEditDialogData) {
|
|
1399
|
+
this.title = title;
|
|
1400
|
+
this.confirmButtonLabel = confirmButtonLabel;
|
|
1401
|
+
this.deleteButtonLabel = deleteButtonLabel;
|
|
1402
|
+
this.cancelButtonLabel = cancelButtonLabel;
|
|
1403
|
+
this.deleteRequiresConfirmDialog = deleteRequiresConfirmDialog;
|
|
1404
|
+
this.editRequiresConfirmDialog = editRequiresConfirmDialog;
|
|
1405
|
+
this.confirmDeleteDialogData = confirmDeleteDialogData;
|
|
1406
|
+
this.confirmEditDialogData = confirmEditDialogData;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
class EditDialogDataBuilder {
|
|
1410
|
+
constructor(data) {
|
|
1411
|
+
// this.validateInput(data);
|
|
1412
|
+
this.dataInput = data;
|
|
1413
|
+
const confirmEditDialogData = new ConfirmDialogDataBuilder(data?.confirmEditDialogData)
|
|
1414
|
+
.withDefaultConfirmButtonLabel('Save')
|
|
1415
|
+
.withDefaultText(['Do you really want to save all changes?'])
|
|
1416
|
+
.withDefaultTitle('Edit')
|
|
1417
|
+
.confirmDialogData;
|
|
1418
|
+
const confirmDeleteDialogData = new ConfirmDialogDataBuilder(data?.confirmDeleteDialogData)
|
|
1419
|
+
.withDefaultConfirmButtonLabel('Delete')
|
|
1420
|
+
.withDefaultType('delete')
|
|
1421
|
+
.withDefaultText(['Do you really want to delete this entity?'])
|
|
1422
|
+
.withDefaultTitle('Delete')
|
|
1423
|
+
.confirmDialogData;
|
|
1424
|
+
this.editDialogData = new EditDialogDataInternal(data?.title ? data.title : () => 'Edit', data?.confirmButtonLabel ? data.confirmButtonLabel : 'Save', data?.deleteButtonLabel ? data.deleteButtonLabel : 'Delete', data?.cancelButtonLabel ? data.cancelButtonLabel : 'Cancel', data?.deleteRequiresConfirmDialog ? data.deleteRequiresConfirmDialog : true, data?.editRequiresConfirmDialog ? data.editRequiresConfirmDialog : false, confirmDeleteDialogData, confirmEditDialogData);
|
|
1425
|
+
return this;
|
|
1426
|
+
}
|
|
1427
|
+
withDefaultTitle(title) {
|
|
1428
|
+
if (!this.dataInput?.title) {
|
|
1429
|
+
this.editDialogData.title = title;
|
|
1430
|
+
}
|
|
1431
|
+
return this;
|
|
1432
|
+
}
|
|
1433
|
+
withDefaultConfirmButtonLabel(label) {
|
|
1434
|
+
if (!this.dataInput?.confirmButtonLabel) {
|
|
1435
|
+
this.editDialogData.confirmButtonLabel = label;
|
|
1436
|
+
}
|
|
1437
|
+
return this;
|
|
1438
|
+
}
|
|
1439
|
+
withDefaultDeleteButtonLabel(label) {
|
|
1440
|
+
if (!this.dataInput?.deleteButtonLabel) {
|
|
1441
|
+
this.editDialogData.deleteButtonLabel = label;
|
|
1442
|
+
}
|
|
1443
|
+
return this;
|
|
1444
|
+
}
|
|
1445
|
+
withDefaultCancelButtonLabel(label) {
|
|
1446
|
+
if (!this.dataInput?.cancelButtonLabel) {
|
|
1447
|
+
this.editDialogData.cancelButtonLabel = label;
|
|
1448
|
+
}
|
|
1449
|
+
return this;
|
|
1450
|
+
}
|
|
1451
|
+
withDefaultDeleteRequiresConfirmDialog(deleteRequiresConfirmDialog) {
|
|
1452
|
+
if (!this.dataInput?.deleteRequiresConfirmDialog) {
|
|
1453
|
+
this.editDialogData.deleteRequiresConfirmDialog = deleteRequiresConfirmDialog;
|
|
1454
|
+
}
|
|
1455
|
+
return this;
|
|
1456
|
+
}
|
|
1457
|
+
withDefaultEditRequiresConfirmDialog(editRequiresConfirmDialog) {
|
|
1458
|
+
if (!this.dataInput?.editRequiresConfirmDialog) {
|
|
1459
|
+
this.editDialogData.editRequiresConfirmDialog = editRequiresConfirmDialog;
|
|
1460
|
+
}
|
|
1461
|
+
return this;
|
|
1462
|
+
}
|
|
1463
|
+
withDefaultConfirmDeleteDialogData(confirmDeleteDialogData) {
|
|
1464
|
+
if (!this.dataInput?.confirmDeleteDialogData) {
|
|
1465
|
+
this.editDialogData.confirmDeleteDialogData = confirmDeleteDialogData;
|
|
1466
|
+
}
|
|
1467
|
+
return this;
|
|
1468
|
+
}
|
|
1469
|
+
withDefaultConfirmEditDialogData(confirmEditDialogData) {
|
|
1470
|
+
if (!this.dataInput?.confirmEditDialogData) {
|
|
1471
|
+
this.editDialogData.confirmEditDialogData = confirmEditDialogData;
|
|
1472
|
+
}
|
|
1473
|
+
return this;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
class EditEntityDialogDataInternal {
|
|
1478
|
+
constructor(entity, EntityServiceClass, editDialogData, allowDelete) {
|
|
1479
|
+
this.entity = entity;
|
|
1480
|
+
this.EntityServiceClass = EntityServiceClass;
|
|
1481
|
+
this.editDialogData = editDialogData;
|
|
1482
|
+
this.allowDelete = allowDelete;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
class EditEntityDialogDataBuilder {
|
|
1486
|
+
constructor(data) {
|
|
1487
|
+
// this.validateInput(data);
|
|
1488
|
+
this.dataInput = data;
|
|
1489
|
+
const editDialogData = new EditDialogDataBuilder(data.editDialogData).editDialogData;
|
|
1490
|
+
this.editDialogData = new EditEntityDialogDataInternal(data.entity, data.EntityServiceClass, editDialogData, data.allowDelete ? data.allowDelete : () => true);
|
|
1491
|
+
return this;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
class NgxMatEntityEditDialogComponent {
|
|
1496
|
+
constructor(inputData, dialogRef, injector, dialog) {
|
|
1497
|
+
this.inputData = inputData;
|
|
1498
|
+
this.dialogRef = dialogRef;
|
|
1499
|
+
this.injector = injector;
|
|
1500
|
+
this.dialog = dialog;
|
|
1501
|
+
this.EntityUtilities = EntityUtilities;
|
|
1502
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
1503
|
+
}
|
|
1504
|
+
ngOnInit() {
|
|
1505
|
+
this.data = new EditEntityDialogDataBuilder(this.inputData).editDialogData;
|
|
1506
|
+
this.dialogRef.disableClose = true;
|
|
1507
|
+
this.setEntityKeys();
|
|
1508
|
+
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1509
|
+
this.entityPriorChanges = cloneDeep(this.data.entity);
|
|
1510
|
+
}
|
|
1511
|
+
setEntityKeys() {
|
|
1512
|
+
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
1513
|
+
const omitUpdateKeys = EntityUtilities.getOmitForUpdate(this.data.entity);
|
|
1514
|
+
this.entityKeys = this.entityKeys.filter((k) => !omitUpdateKeys.includes(k))
|
|
1515
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1516
|
+
}
|
|
1517
|
+
edit() {
|
|
1518
|
+
if (!this.data.editDialogData.editRequiresConfirmDialog) {
|
|
1519
|
+
return this.confirmEdit();
|
|
1520
|
+
}
|
|
1521
|
+
const dialogData = new ConfirmDialogDataBuilder(this.data.editDialogData.confirmEditDialogData)
|
|
1522
|
+
.withDefaultText(['Do you really want to save all changes?'])
|
|
1523
|
+
.withDefaultConfirmButtonLabel('Save')
|
|
1524
|
+
.withDefaultTitle('Edit')
|
|
1525
|
+
.confirmDialogData;
|
|
1526
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1527
|
+
data: dialogData,
|
|
1138
1528
|
autoFocus: false,
|
|
1139
1529
|
restoreFocus: false
|
|
1140
1530
|
});
|
|
@@ -1148,24 +1538,15 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1148
1538
|
this.entityService.update(this.data.entity, this.entityPriorChanges).then(() => this.dialogRef.close(1));
|
|
1149
1539
|
}
|
|
1150
1540
|
delete() {
|
|
1151
|
-
if (this.data.editDialogData.deleteRequiresConfirmDialog
|
|
1541
|
+
if (!this.data.editDialogData.deleteRequiresConfirmDialog) {
|
|
1152
1542
|
return this.confirmDelete();
|
|
1153
1543
|
}
|
|
1154
|
-
const dialogData =
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
// eslint-disable-next-line max-len
|
|
1161
|
-
cancelButtonLabel: this.data.editDialogData.confirmDeleteDialogData?.cancelButtonLabel ? this.data.editDialogData.confirmDeleteDialogData?.cancelButtonLabel : 'Cancel',
|
|
1162
|
-
// eslint-disable-next-line max-len
|
|
1163
|
-
title: this.data.editDialogData.confirmDeleteDialogData?.title ? this.data.editDialogData.confirmDeleteDialogData?.title : 'Delete',
|
|
1164
|
-
// eslint-disable-next-line max-len
|
|
1165
|
-
requireConfirmation: this.data.editDialogData.confirmDeleteDialogData?.requireConfirmation ? this.data.editDialogData.confirmDeleteDialogData?.requireConfirmation : false,
|
|
1166
|
-
// eslint-disable-next-line max-len
|
|
1167
|
-
confirmationText: this.data.editDialogData.confirmDeleteDialogData?.confirmationText ? this.data.editDialogData.confirmDeleteDialogData?.confirmationText : undefined,
|
|
1168
|
-
};
|
|
1544
|
+
const dialogData = new ConfirmDialogDataBuilder(this.data.editDialogData.confirmDeleteDialogData)
|
|
1545
|
+
.withDefaultText(['Do you really want to delete this entity?'])
|
|
1546
|
+
.withDefaultType('delete')
|
|
1547
|
+
.withDefaultConfirmButtonLabel('Delete')
|
|
1548
|
+
.withDefaultTitle('Delete')
|
|
1549
|
+
.confirmDialogData;
|
|
1169
1550
|
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1170
1551
|
data: dialogData,
|
|
1171
1552
|
autoFocus: false,
|
|
@@ -1186,15 +1567,102 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1186
1567
|
}
|
|
1187
1568
|
}
|
|
1188
1569
|
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 });
|
|
1189
|
-
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
|
|
1570
|
+
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 *ngFor=\"let key of entityKeys\"\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 </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: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i12.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i12.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i12.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
1190
1571
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogComponent, decorators: [{
|
|
1191
1572
|
type: Component,
|
|
1192
|
-
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
|
|
1573
|
+
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 *ngFor=\"let key of entityKeys\"\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 </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"] }]
|
|
1193
1574
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1194
1575
|
type: Inject,
|
|
1195
1576
|
args: [MAT_DIALOG_DATA]
|
|
1196
1577
|
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }]; } });
|
|
1197
1578
|
|
|
1579
|
+
class TableDataInternal {
|
|
1580
|
+
constructor(baseData, createDialogData, editDialogData) {
|
|
1581
|
+
this.baseData = baseData;
|
|
1582
|
+
this.createDialogData = createDialogData;
|
|
1583
|
+
this.editDialogData = editDialogData;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
class BaseDataBuilder {
|
|
1587
|
+
constructor(data) {
|
|
1588
|
+
//this.validateInput(data);
|
|
1589
|
+
this.dataInput = data;
|
|
1590
|
+
this.baseData = 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 ? 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
|
+
return this;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
class BaseDataInternal {
|
|
1595
|
+
constructor(title, displayColumns, EntityServiceClass, searchLabel, createButtonLabel, searchString, allowCreate, allowEdit, allowDelete, multiSelectActions, multiSelectLabel, EntityClass, edit, create) {
|
|
1596
|
+
this.title = title;
|
|
1597
|
+
this.displayColumns = displayColumns;
|
|
1598
|
+
this.EntityServiceClass = EntityServiceClass;
|
|
1599
|
+
this.EntityClass = EntityClass;
|
|
1600
|
+
this.searchLabel = searchLabel;
|
|
1601
|
+
this.createButtonLabel = createButtonLabel;
|
|
1602
|
+
this.searchString = searchString;
|
|
1603
|
+
this.allowCreate = allowCreate;
|
|
1604
|
+
this.allowEdit = allowEdit;
|
|
1605
|
+
this.allowDelete = allowDelete;
|
|
1606
|
+
this.multiSelectActions = multiSelectActions;
|
|
1607
|
+
this.multiSelectLabel = multiSelectLabel;
|
|
1608
|
+
this.edit = edit;
|
|
1609
|
+
this.create = create;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
class TableDataBuilder {
|
|
1613
|
+
constructor(data) {
|
|
1614
|
+
this.validateInput(data);
|
|
1615
|
+
this.dataInput = data;
|
|
1616
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).createDialogData;
|
|
1617
|
+
const editDialogData = new EditDialogDataBuilder(data.editDialogData).editDialogData;
|
|
1618
|
+
const baseData = new BaseDataBuilder(data.baseData).baseData;
|
|
1619
|
+
this.tableData = new TableDataInternal(baseData, createDialogData, editDialogData);
|
|
1620
|
+
return this;
|
|
1621
|
+
}
|
|
1622
|
+
validateInput(data) {
|
|
1623
|
+
if (data.baseData.multiSelectActions?.length && data.baseData.displayColumns.find(dp => dp.displayName === 'select')) {
|
|
1624
|
+
throw new Error(`The name "select" for a display column is reserved for the multi-select action functionality.
|
|
1625
|
+
Please choose a different name.`);
|
|
1626
|
+
}
|
|
1627
|
+
if ((data.baseData.allowEdit && data.baseData.allowEdit !== (() => false)
|
|
1628
|
+
|| data.baseData.allowDelete && data.baseData.allowDelete !== (() => false)
|
|
1629
|
+
|| data.baseData.allowCreate)
|
|
1630
|
+
&& !data.baseData.EntityClass) {
|
|
1631
|
+
throw new Error(`
|
|
1632
|
+
Missing required Input data "EntityClass".
|
|
1633
|
+
You can only omit this value if you can neither create or update entities.`);
|
|
1634
|
+
}
|
|
1635
|
+
if (data.baseData.allowCreate !== false && !data.baseData.create && !data.createDialogData) {
|
|
1636
|
+
throw new Error(`Missing required Input data "createDialogData".
|
|
1637
|
+
You can only omit this value when creation is disallowed or done with a custom create method.`);
|
|
1638
|
+
}
|
|
1639
|
+
if ((data.baseData.allowEdit !== (() => false)
|
|
1640
|
+
|| data.baseData.allowDelete !== (() => false))
|
|
1641
|
+
&& !data.baseData.edit
|
|
1642
|
+
&& !data.editDialogData) {
|
|
1643
|
+
throw new Error(`Missing required Input data "editDialogData".
|
|
1644
|
+
You can only omit this value when editing and deleting is disallowed or done with a custom edit method.`);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* The default search function taken from googles mat table.
|
|
1650
|
+
* This will be used if no custom search function is provided by the configuration.
|
|
1651
|
+
*
|
|
1652
|
+
* It generates a string from an entity which is then used to compare it to the search input.
|
|
1653
|
+
*
|
|
1654
|
+
* @param entity - An entity that is in the search.
|
|
1655
|
+
* @returns The generated string of the given entity used for comparison with the search input.
|
|
1656
|
+
*/
|
|
1657
|
+
function defaultSearchFunction(entity) {
|
|
1658
|
+
const searchString = Object.keys(entity)
|
|
1659
|
+
.reduce((currentTerm, key) => {
|
|
1660
|
+
return `${currentTerm}${entity[key]}◬`;
|
|
1661
|
+
}, '')
|
|
1662
|
+
.toLowerCase();
|
|
1663
|
+
return searchString;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1198
1666
|
class NgxMatEntityTableComponent {
|
|
1199
1667
|
constructor(dialog, injector) {
|
|
1200
1668
|
this.dialog = dialog;
|
|
@@ -1204,26 +1672,22 @@ class NgxMatEntityTableComponent {
|
|
|
1204
1672
|
this.selection = new SelectionModel(true, []);
|
|
1205
1673
|
}
|
|
1206
1674
|
ngOnInit() {
|
|
1207
|
-
this.
|
|
1208
|
-
this.entityService = this.injector.get(this.
|
|
1209
|
-
const givenDisplayColumns = this.
|
|
1210
|
-
if (this.
|
|
1211
|
-
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
1212
|
-
throw new Error(`The name "select" for a display column is reserved for the multi-select action functionality.
|
|
1213
|
-
Please choose a different name.`);
|
|
1214
|
-
}
|
|
1675
|
+
this.data = new TableDataBuilder(this.tableData).tableData;
|
|
1676
|
+
this.entityService = this.injector.get(this.data.baseData.EntityServiceClass);
|
|
1677
|
+
const givenDisplayColumns = this.data.baseData.displayColumns.map((v) => v.displayName);
|
|
1678
|
+
if (this.data.baseData.multiSelectActions.length) {
|
|
1215
1679
|
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
1216
1680
|
}
|
|
1217
1681
|
else {
|
|
1218
1682
|
this.displayedColumns = givenDisplayColumns;
|
|
1219
1683
|
}
|
|
1220
1684
|
this.dataSource.sortingDataAccessor = (entity, header) => {
|
|
1221
|
-
return this.
|
|
1685
|
+
return this.data.baseData.displayColumns.find((dp) => dp.displayName === header)?.value(entity);
|
|
1222
1686
|
};
|
|
1223
1687
|
this.dataSource.sort = this.sort;
|
|
1224
|
-
if (this.
|
|
1688
|
+
if (this.data.baseData.searchString) {
|
|
1225
1689
|
this.dataSource.filterPredicate = (entity, filter) => {
|
|
1226
|
-
const searchStr = this.
|
|
1690
|
+
const searchStr = this.data.baseData.searchString(entity);
|
|
1227
1691
|
const formattedSearchString = searchStr.toLowerCase();
|
|
1228
1692
|
const formattedFilterString = filter.toLowerCase();
|
|
1229
1693
|
return formattedSearchString.includes(formattedFilterString);
|
|
@@ -1237,62 +1701,27 @@ class NgxMatEntityTableComponent {
|
|
|
1237
1701
|
});
|
|
1238
1702
|
this.entityService.read();
|
|
1239
1703
|
}
|
|
1240
|
-
validateInput() {
|
|
1241
|
-
if (!this.entitiesData.baseData.displayColumns) {
|
|
1242
|
-
throw new Error('Missing required Input data "displayColumns"');
|
|
1243
|
-
}
|
|
1244
|
-
if (!this.entitiesData.baseData.title) {
|
|
1245
|
-
throw new Error('Missing required Input data "title"');
|
|
1246
|
-
}
|
|
1247
|
-
if (!this.entitiesData.baseData.EntityServiceClass) {
|
|
1248
|
-
throw new Error('Missing required Input data "EntityServiceClass"');
|
|
1249
|
-
}
|
|
1250
|
-
if (this.entitiesData.baseData.allowCreate === undefined) {
|
|
1251
|
-
this.entitiesData.baseData.allowCreate = true;
|
|
1252
|
-
}
|
|
1253
|
-
if (this.entitiesData.baseData.allowEdit === undefined) {
|
|
1254
|
-
this.entitiesData.baseData.allowEdit = () => true;
|
|
1255
|
-
}
|
|
1256
|
-
if (this.entitiesData.baseData.allowDelete === undefined) {
|
|
1257
|
-
this.entitiesData.baseData.allowDelete = () => true;
|
|
1258
|
-
}
|
|
1259
|
-
if ((this.entitiesData.baseData.allowEdit !== (() => false)
|
|
1260
|
-
|| this.entitiesData.baseData.allowDelete !== (() => false)
|
|
1261
|
-
|| this.entitiesData.baseData.allowCreate)
|
|
1262
|
-
&& !this.entitiesData.baseData.EntityClass) {
|
|
1263
|
-
throw new Error(`
|
|
1264
|
-
Missing required Input data "EntityClass".
|
|
1265
|
-
You can only omit this value if you can neither create or update entities.`);
|
|
1266
|
-
}
|
|
1267
|
-
if (this.entitiesData.baseData.allowCreate && !this.entitiesData.baseData.create && !this.entitiesData.createDialogData) {
|
|
1268
|
-
throw new Error(`Missing required Input data "createDialogData".
|
|
1269
|
-
You can only omit this value when creation is disallowed or done with a custom create method.`);
|
|
1270
|
-
}
|
|
1271
|
-
if ((this.entitiesData.baseData.allowEdit !== (() => false)
|
|
1272
|
-
|| this.entitiesData.baseData.allowDelete !== (() => false))
|
|
1273
|
-
&& !this.entitiesData.baseData.edit
|
|
1274
|
-
&& !this.entitiesData.editDialogData) {
|
|
1275
|
-
throw new Error(`Missing required Input data "editDialogData".
|
|
1276
|
-
You can only omit this value when editing and deleting is disallowed or done with a custom edit method.`);
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
1704
|
editEntity(entity) {
|
|
1280
|
-
if (this.
|
|
1281
|
-
if (this.
|
|
1282
|
-
|
|
1705
|
+
if (this.data.baseData.allowEdit(entity)) {
|
|
1706
|
+
if (!this.data.baseData.EntityClass) {
|
|
1707
|
+
throw new Error('No "EntityClass" specified for this table');
|
|
1708
|
+
}
|
|
1709
|
+
if (this.data.baseData.edit) {
|
|
1710
|
+
this.data.baseData.edit(new this.data.baseData.EntityClass(entity));
|
|
1283
1711
|
}
|
|
1284
1712
|
else {
|
|
1285
|
-
this.editDefault(new this.
|
|
1713
|
+
this.editDefault(new this.data.baseData.EntityClass(entity));
|
|
1286
1714
|
}
|
|
1287
1715
|
}
|
|
1288
1716
|
}
|
|
1289
1717
|
editDefault(entity) {
|
|
1290
|
-
const
|
|
1718
|
+
const inputDialogData = {
|
|
1291
1719
|
entity: entity,
|
|
1292
|
-
EntityServiceClass: this.
|
|
1293
|
-
allowDelete: this.
|
|
1294
|
-
editDialogData: this.
|
|
1720
|
+
EntityServiceClass: this.data.baseData.EntityServiceClass,
|
|
1721
|
+
allowDelete: this.data.baseData.allowDelete,
|
|
1722
|
+
editDialogData: this.data.editDialogData
|
|
1295
1723
|
};
|
|
1724
|
+
const dialogData = new EditEntityDialogDataBuilder(inputDialogData).editDialogData;
|
|
1296
1725
|
firstValueFrom(this.dialog.open(NgxMatEntityEditDialogComponent, {
|
|
1297
1726
|
data: dialogData,
|
|
1298
1727
|
minWidth: '60%',
|
|
@@ -1308,21 +1737,24 @@ class NgxMatEntityTableComponent {
|
|
|
1308
1737
|
});
|
|
1309
1738
|
}
|
|
1310
1739
|
createEntity() {
|
|
1311
|
-
if (this.
|
|
1312
|
-
if (this.
|
|
1313
|
-
|
|
1740
|
+
if (this.data.baseData.allowCreate) {
|
|
1741
|
+
if (!this.data.baseData.EntityClass) {
|
|
1742
|
+
throw new Error('No "EntityClass" specified for this table');
|
|
1743
|
+
}
|
|
1744
|
+
if (this.data.baseData.create) {
|
|
1745
|
+
this.data.baseData.create(new this.data.baseData.EntityClass());
|
|
1314
1746
|
}
|
|
1315
1747
|
else {
|
|
1316
|
-
this.createDefault(new this.
|
|
1748
|
+
this.createDefault(new this.data.baseData.EntityClass());
|
|
1317
1749
|
}
|
|
1318
1750
|
}
|
|
1319
1751
|
}
|
|
1320
1752
|
createDefault(entity) {
|
|
1321
|
-
const dialogData = {
|
|
1753
|
+
const dialogData = new CreateEntityDialogDataBuilder({
|
|
1322
1754
|
entity: entity,
|
|
1323
|
-
EntityServiceClass: this.
|
|
1324
|
-
createDialogData: this.
|
|
1325
|
-
};
|
|
1755
|
+
EntityServiceClass: this.data.baseData.EntityServiceClass,
|
|
1756
|
+
createDialogData: this.data.createDialogData
|
|
1757
|
+
}).createDialogData;
|
|
1326
1758
|
this.dialog.open(NgxMatEntityCreateDialogComponent, {
|
|
1327
1759
|
data: dialogData,
|
|
1328
1760
|
minWidth: '60%',
|
|
@@ -1334,16 +1766,9 @@ class NgxMatEntityTableComponent {
|
|
|
1334
1766
|
if (!action.requireConfirmDialog || !action.requireConfirmDialog(this.selection.selected)) {
|
|
1335
1767
|
return this.confirmRunMultiAction(action);
|
|
1336
1768
|
}
|
|
1337
|
-
const dialogData =
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
type: 'default',
|
|
1341
|
-
confirmButtonLabel: action.confirmDialogData?.confirmButtonLabel ? action.confirmDialogData?.confirmButtonLabel : 'Confirm',
|
|
1342
|
-
cancelButtonLabel: action.confirmDialogData?.cancelButtonLabel ? action.confirmDialogData?.cancelButtonLabel : 'Cancel',
|
|
1343
|
-
title: action.confirmDialogData?.title ? action.confirmDialogData?.title : action.displayName,
|
|
1344
|
-
requireConfirmation: action.confirmDialogData?.requireConfirmation ? action.confirmDialogData?.requireConfirmation : false,
|
|
1345
|
-
confirmationText: action.confirmDialogData?.confirmationText ? action.confirmDialogData?.confirmationText : undefined
|
|
1346
|
-
};
|
|
1769
|
+
const dialogData = new ConfirmDialogDataBuilder(action.confirmDialogData)
|
|
1770
|
+
.withDefaultText([`Do you really want to run this action on ${this.selection.selected.length} entries?`])
|
|
1771
|
+
.withDefaultTitle(action.displayName).confirmDialogData;
|
|
1347
1772
|
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1348
1773
|
data: dialogData,
|
|
1349
1774
|
autoFocus: false,
|
|
@@ -1390,11 +1815,11 @@ class NgxMatEntityTableComponent {
|
|
|
1390
1815
|
}
|
|
1391
1816
|
}
|
|
1392
1817
|
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 });
|
|
1393
|
-
NgxMatEntityTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityTableComponent, selector: "ngx-mat-entity-table", inputs: {
|
|
1818
|
+
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{margin-bottom:15px}}@media (max-width: 575px){.create-button{margin-bottom:15px}}\n"], components: [{ type: i1$1.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$2.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i4$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i4$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { 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: i4$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i4$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { type: i7$1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }], directives: [{ 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: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i4$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i4$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i4$1.MatCellDef, selector: "[matCellDef]" }, { type: i4$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i4$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i4$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }] });
|
|
1394
1819
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableComponent, decorators: [{
|
|
1395
1820
|
type: Component,
|
|
1396
|
-
args: [{ selector: 'ngx-mat-entity-table', template: "<h1 class=\"title\">{{
|
|
1397
|
-
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.Injector }]; }, propDecorators: {
|
|
1821
|
+
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{margin-bottom:15px}}@media (max-width: 575px){.create-button{margin-bottom:15px}}\n"] }]
|
|
1822
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.Injector }]; }, propDecorators: { tableData: [{
|
|
1398
1823
|
type: Input
|
|
1399
1824
|
}], paginator: [{
|
|
1400
1825
|
type: ViewChild,
|
|
@@ -1452,161 +1877,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1452
1877
|
}]
|
|
1453
1878
|
}] });
|
|
1454
1879
|
|
|
1455
|
-
class NgxMatEntityInternalInputModule {
|
|
1456
|
-
}
|
|
1457
|
-
NgxMatEntityInternalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1458
|
-
NgxMatEntityInternalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, declarations: [NgxMatEntityInternalInputComponent], imports: [CommonModule,
|
|
1459
|
-
MatInputModule,
|
|
1460
|
-
FormsModule,
|
|
1461
|
-
MatFormFieldModule,
|
|
1462
|
-
MatSelectModule,
|
|
1463
|
-
MatAutocompleteModule,
|
|
1464
|
-
MatCheckboxModule,
|
|
1465
|
-
MatSlideToggleModule,
|
|
1466
|
-
MatTableModule], exports: [NgxMatEntityInternalInputComponent] });
|
|
1467
|
-
NgxMatEntityInternalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, imports: [[
|
|
1468
|
-
CommonModule,
|
|
1469
|
-
MatInputModule,
|
|
1470
|
-
FormsModule,
|
|
1471
|
-
MatFormFieldModule,
|
|
1472
|
-
MatSelectModule,
|
|
1473
|
-
MatAutocompleteModule,
|
|
1474
|
-
MatCheckboxModule,
|
|
1475
|
-
MatSlideToggleModule,
|
|
1476
|
-
MatTableModule
|
|
1477
|
-
]] });
|
|
1478
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, decorators: [{
|
|
1479
|
-
type: NgModule,
|
|
1480
|
-
args: [{
|
|
1481
|
-
declarations: [NgxMatEntityInternalInputComponent],
|
|
1482
|
-
imports: [
|
|
1483
|
-
CommonModule,
|
|
1484
|
-
MatInputModule,
|
|
1485
|
-
FormsModule,
|
|
1486
|
-
MatFormFieldModule,
|
|
1487
|
-
MatSelectModule,
|
|
1488
|
-
MatAutocompleteModule,
|
|
1489
|
-
MatCheckboxModule,
|
|
1490
|
-
MatSlideToggleModule,
|
|
1491
|
-
MatTableModule
|
|
1492
|
-
],
|
|
1493
|
-
exports: [NgxMatEntityInternalInputComponent]
|
|
1494
|
-
}]
|
|
1495
|
-
}] });
|
|
1496
|
-
|
|
1497
|
-
class NgxMatEntityAddArrayItemDialogModule {
|
|
1498
|
-
}
|
|
1499
|
-
NgxMatEntityAddArrayItemDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1500
|
-
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] });
|
|
1501
|
-
NgxMatEntityAddArrayItemDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, imports: [[CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1502
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, decorators: [{
|
|
1503
|
-
type: NgModule,
|
|
1504
|
-
args: [{
|
|
1505
|
-
declarations: [NgxMatEntityAddArrayItemDialogComponent],
|
|
1506
|
-
imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1507
|
-
exports: [NgxMatEntityAddArrayItemDialogComponent]
|
|
1508
|
-
}]
|
|
1509
|
-
}] });
|
|
1510
|
-
|
|
1511
|
-
class NgxMatEntityArrayTableModule {
|
|
1512
|
-
}
|
|
1513
|
-
NgxMatEntityArrayTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1514
|
-
NgxMatEntityArrayTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, declarations: [NgxMatEntityArrayTableComponent], imports: [CommonModule,
|
|
1515
|
-
MatInputModule,
|
|
1516
|
-
FormsModule,
|
|
1517
|
-
MatFormFieldModule,
|
|
1518
|
-
MatSelectModule,
|
|
1519
|
-
MatAutocompleteModule,
|
|
1520
|
-
MatCheckboxModule,
|
|
1521
|
-
MatSlideToggleModule,
|
|
1522
|
-
MatTableModule,
|
|
1523
|
-
NgxMatEntityInternalInputModule,
|
|
1524
|
-
MatButtonModule,
|
|
1525
|
-
NgxMatEntityAddArrayItemDialogModule], exports: [NgxMatEntityArrayTableComponent] });
|
|
1526
|
-
NgxMatEntityArrayTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, imports: [[
|
|
1527
|
-
CommonModule,
|
|
1528
|
-
MatInputModule,
|
|
1529
|
-
FormsModule,
|
|
1530
|
-
MatFormFieldModule,
|
|
1531
|
-
MatSelectModule,
|
|
1532
|
-
MatAutocompleteModule,
|
|
1533
|
-
MatCheckboxModule,
|
|
1534
|
-
MatSlideToggleModule,
|
|
1535
|
-
MatTableModule,
|
|
1536
|
-
NgxMatEntityInternalInputModule,
|
|
1537
|
-
MatButtonModule,
|
|
1538
|
-
NgxMatEntityAddArrayItemDialogModule
|
|
1539
|
-
]] });
|
|
1540
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, decorators: [{
|
|
1541
|
-
type: NgModule,
|
|
1542
|
-
args: [{
|
|
1543
|
-
declarations: [NgxMatEntityArrayTableComponent],
|
|
1544
|
-
imports: [
|
|
1545
|
-
CommonModule,
|
|
1546
|
-
MatInputModule,
|
|
1547
|
-
FormsModule,
|
|
1548
|
-
MatFormFieldModule,
|
|
1549
|
-
MatSelectModule,
|
|
1550
|
-
MatAutocompleteModule,
|
|
1551
|
-
MatCheckboxModule,
|
|
1552
|
-
MatSlideToggleModule,
|
|
1553
|
-
MatTableModule,
|
|
1554
|
-
NgxMatEntityInternalInputModule,
|
|
1555
|
-
MatButtonModule,
|
|
1556
|
-
NgxMatEntityAddArrayItemDialogModule
|
|
1557
|
-
],
|
|
1558
|
-
exports: [NgxMatEntityArrayTableComponent]
|
|
1559
|
-
}]
|
|
1560
|
-
}] });
|
|
1561
|
-
|
|
1562
|
-
class NgxMatEntityInputModule {
|
|
1563
|
-
}
|
|
1564
|
-
NgxMatEntityInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1565
|
-
NgxMatEntityInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, declarations: [NgxMatEntityInputComponent], imports: [CommonModule,
|
|
1566
|
-
MatInputModule,
|
|
1567
|
-
FormsModule,
|
|
1568
|
-
MatFormFieldModule,
|
|
1569
|
-
MatSelectModule,
|
|
1570
|
-
MatAutocompleteModule,
|
|
1571
|
-
MatCheckboxModule,
|
|
1572
|
-
MatSlideToggleModule,
|
|
1573
|
-
NgxMatEntityArrayTableModule,
|
|
1574
|
-
MatChipsModule,
|
|
1575
|
-
MatIconModule], exports: [NgxMatEntityInputComponent] });
|
|
1576
|
-
NgxMatEntityInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, imports: [[
|
|
1577
|
-
CommonModule,
|
|
1578
|
-
MatInputModule,
|
|
1579
|
-
FormsModule,
|
|
1580
|
-
MatFormFieldModule,
|
|
1581
|
-
MatSelectModule,
|
|
1582
|
-
MatAutocompleteModule,
|
|
1583
|
-
MatCheckboxModule,
|
|
1584
|
-
MatSlideToggleModule,
|
|
1585
|
-
NgxMatEntityArrayTableModule,
|
|
1586
|
-
MatChipsModule,
|
|
1587
|
-
MatIconModule
|
|
1588
|
-
]] });
|
|
1589
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, decorators: [{
|
|
1590
|
-
type: NgModule,
|
|
1591
|
-
args: [{
|
|
1592
|
-
declarations: [NgxMatEntityInputComponent],
|
|
1593
|
-
imports: [
|
|
1594
|
-
CommonModule,
|
|
1595
|
-
MatInputModule,
|
|
1596
|
-
FormsModule,
|
|
1597
|
-
MatFormFieldModule,
|
|
1598
|
-
MatSelectModule,
|
|
1599
|
-
MatAutocompleteModule,
|
|
1600
|
-
MatCheckboxModule,
|
|
1601
|
-
MatSlideToggleModule,
|
|
1602
|
-
NgxMatEntityArrayTableModule,
|
|
1603
|
-
MatChipsModule,
|
|
1604
|
-
MatIconModule
|
|
1605
|
-
],
|
|
1606
|
-
exports: [NgxMatEntityInputComponent]
|
|
1607
|
-
}]
|
|
1608
|
-
}] });
|
|
1609
|
-
|
|
1610
1880
|
class NgxMatEntityCreateDialogModule {
|
|
1611
1881
|
}
|
|
1612
1882
|
NgxMatEntityCreateDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1655,106 +1925,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1655
1925
|
}] });
|
|
1656
1926
|
|
|
1657
1927
|
/**
|
|
1658
|
-
* Decorator for setting and getting
|
|
1659
|
-
*
|
|
1928
|
+
* Decorator for setting and getting array propery metadata.
|
|
1929
|
+
*
|
|
1930
|
+
* @param metadata - The metadata of the array property.
|
|
1931
|
+
* @returns The method that defines the metadata.
|
|
1932
|
+
* @throws When the given type of the array-items is unknown.
|
|
1933
|
+
*/
|
|
1934
|
+
function array(metadata) {
|
|
1935
|
+
switch (metadata.itemType) {
|
|
1936
|
+
case DecoratorTypes.OBJECT:
|
|
1937
|
+
return baseProperty(new EntityArrayDecoratorConfigInternal(metadata), DecoratorTypes.ARRAY);
|
|
1938
|
+
case DecoratorTypes.STRING:
|
|
1939
|
+
return baseProperty(new StringChipsArrayDecoratorConfigInternal(metadata), DecoratorTypes.ARRAY_STRING_CHIPS);
|
|
1940
|
+
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
1941
|
+
return baseProperty(new AutocompleteStringChipsArrayDecoratorConfigInternal(metadata), DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS);
|
|
1942
|
+
default:
|
|
1943
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1944
|
+
throw new Error(`Unknown itemType ${metadata.itemType}`);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* The base options for all propertyDecorators.
|
|
1950
|
+
*/
|
|
1951
|
+
class PropertyDecoratorConfig {
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* Interface definition for the @array metadata.
|
|
1956
|
+
*/
|
|
1957
|
+
class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
class DropdownBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1961
|
+
constructor(data) {
|
|
1962
|
+
super(data);
|
|
1963
|
+
this.displayStyle = data.displayStyle;
|
|
1964
|
+
this.dropdownTrue = data.dropdownTrue;
|
|
1965
|
+
this.dropdownFalse = data.dropdownFalse;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
class CheckboxBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1969
|
+
constructor(data) {
|
|
1970
|
+
super(data);
|
|
1971
|
+
this.displayStyle = data.displayStyle;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
class ToggleBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1975
|
+
constructor(data) {
|
|
1976
|
+
super(data);
|
|
1977
|
+
this.displayStyle = data.displayStyle;
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
/**
|
|
1982
|
+
* Decorator for setting and getting boolean propery metadata.
|
|
1983
|
+
*
|
|
1984
|
+
* @param metadata - The metadata of the boolean property.
|
|
1985
|
+
* @returns The method that defines the metadata.
|
|
1660
1986
|
*/
|
|
1661
1987
|
function boolean(metadata) {
|
|
1662
1988
|
if (metadata.displayStyle === 'dropdown') {
|
|
1663
|
-
return baseProperty(new
|
|
1989
|
+
return baseProperty(new DropdownBooleanDecoratorConfigInternal(metadata), DecoratorTypes.BOOLEAN_DROPDOWN);
|
|
1664
1990
|
}
|
|
1665
1991
|
else if (metadata.displayStyle === 'checkbox') {
|
|
1666
|
-
return baseProperty(new
|
|
1992
|
+
return baseProperty(new CheckboxBooleanDecoratorConfigInternal(metadata), DecoratorTypes.BOOLEAN_CHECKBOX);
|
|
1667
1993
|
}
|
|
1668
1994
|
else {
|
|
1669
|
-
return baseProperty(new
|
|
1995
|
+
return baseProperty(new ToggleBooleanDecoratorConfigInternal(metadata), DecoratorTypes.BOOLEAN_TOGGLE);
|
|
1670
1996
|
}
|
|
1671
1997
|
}
|
|
1998
|
+
|
|
1672
1999
|
/**
|
|
1673
|
-
* The Definition for the @boolean metadata
|
|
2000
|
+
* The Definition for the @boolean metadata.
|
|
1674
2001
|
*/
|
|
1675
2002
|
class BooleanDecoratorConfig extends PropertyDecoratorConfig {
|
|
1676
2003
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
this.
|
|
1682
|
-
this.
|
|
1683
|
-
|
|
1684
|
-
}
|
|
1685
|
-
class CheckboxBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
1686
|
-
constructor(metadata) {
|
|
1687
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1688
|
-
this.displayStyle = metadata.displayStyle;
|
|
2004
|
+
|
|
2005
|
+
class DefaultNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2006
|
+
constructor(data) {
|
|
2007
|
+
super(data);
|
|
2008
|
+
this.displayStyle = data.displayStyle;
|
|
2009
|
+
this.max = data.max;
|
|
2010
|
+
this.min = data.min;
|
|
1689
2011
|
}
|
|
1690
2012
|
}
|
|
1691
|
-
class
|
|
1692
|
-
constructor(
|
|
1693
|
-
super(
|
|
1694
|
-
this.displayStyle =
|
|
2013
|
+
class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2014
|
+
constructor(data) {
|
|
2015
|
+
super(data);
|
|
2016
|
+
this.displayStyle = data.displayStyle;
|
|
2017
|
+
this.dropdownValues = data.dropdownValues;
|
|
1695
2018
|
}
|
|
1696
2019
|
}
|
|
1697
2020
|
|
|
1698
2021
|
/**
|
|
1699
|
-
* Decorator for setting and getting string propery metadata
|
|
1700
|
-
*
|
|
2022
|
+
* Decorator for setting and getting string propery metadata.
|
|
2023
|
+
*
|
|
2024
|
+
* @param metadata - The metadata of the string property.
|
|
2025
|
+
* @returns The method that defines the metadata.
|
|
1701
2026
|
*/
|
|
1702
2027
|
function number(metadata) {
|
|
1703
2028
|
if (metadata.displayStyle === 'dropdown') {
|
|
1704
|
-
return baseProperty(new
|
|
2029
|
+
return baseProperty(new DropdownNumberDecoratorConfigInternal(metadata), DecoratorTypes.NUMBER_DROPDOWN);
|
|
1705
2030
|
}
|
|
1706
2031
|
else {
|
|
1707
|
-
return baseProperty(new
|
|
2032
|
+
return baseProperty(new DefaultNumberDecoratorConfigInternal(metadata), DecoratorTypes.NUMBER);
|
|
1708
2033
|
}
|
|
1709
2034
|
}
|
|
2035
|
+
|
|
1710
2036
|
/**
|
|
1711
|
-
*
|
|
2037
|
+
* Definition for the @number metadata.
|
|
1712
2038
|
*/
|
|
1713
2039
|
class NumberDecoratorConfig extends PropertyDecoratorConfig {
|
|
1714
2040
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
this.
|
|
1720
|
-
this.
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
class DropdownNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
1724
|
-
constructor(metadata) {
|
|
1725
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1726
|
-
this.displayStyle = metadata.displayStyle;
|
|
1727
|
-
this.dropdownValues = metadata.dropdownValues;
|
|
2041
|
+
|
|
2042
|
+
class DefaultObjectDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2043
|
+
constructor(data) {
|
|
2044
|
+
super(data);
|
|
2045
|
+
this.displayStyle = data.displayStyle;
|
|
2046
|
+
this.type = data.type;
|
|
1728
2047
|
}
|
|
1729
2048
|
}
|
|
1730
2049
|
|
|
1731
2050
|
/**
|
|
1732
2051
|
* Decorator for setting and getting object propery metadata.
|
|
1733
|
-
*
|
|
2052
|
+
*
|
|
2053
|
+
* @param metadata - The metadata of the object property.
|
|
2054
|
+
* @returns The method that defines the metadata.
|
|
1734
2055
|
*/
|
|
1735
2056
|
function object(metadata) {
|
|
1736
|
-
return baseProperty(new
|
|
2057
|
+
return baseProperty(new DefaultObjectDecoratorConfigInternal(metadata), DecoratorTypes.OBJECT);
|
|
1737
2058
|
}
|
|
2059
|
+
|
|
1738
2060
|
/**
|
|
1739
|
-
*
|
|
2061
|
+
* Definition for the @object metadata.
|
|
1740
2062
|
*/
|
|
1741
2063
|
class ObjectDecoratorConfig extends PropertyDecoratorConfig {
|
|
1742
2064
|
}
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
}
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* Definition for the @string metadata.
|
|
2068
|
+
*/
|
|
2069
|
+
class StringDecoratorConfig extends PropertyDecoratorConfig {
|
|
1749
2070
|
}
|
|
1750
2071
|
|
|
1751
|
-
|
|
1752
|
-
* Public API Surface of ngx-material-entity
|
|
2072
|
+
/**
|
|
2073
|
+
* Public API Surface of ngx-material-entity.
|
|
1753
2074
|
*/
|
|
1754
2075
|
|
|
1755
2076
|
/**
|
|
1756
2077
|
* Generated bundle index. Do not edit.
|
|
1757
2078
|
*/
|
|
1758
2079
|
|
|
1759
|
-
export {
|
|
2080
|
+
export { DecoratorTypes, Entity, EntityService, EntityUtilities, NgxMatEntityConfirmDialogComponent, NgxMatEntityConfirmDialogModule, NgxMatEntityCreateDialogComponent, NgxMatEntityCreateDialogModule, NgxMatEntityEditDialogComponent, NgxMatEntityEditDialogModule, NgxMatEntityInputComponent, NgxMatEntityInputModule, NgxMatEntityTableComponent, NgxMatEntityTableModule, array, boolean, getValidationErrorMessage, number, object, string };
|
|
1760
2081
|
//# sourceMappingURL=ngx-material-entity.mjs.map
|