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
|
create(entity) {
|
|
503
522
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -509,8 +528,9 @@ class EntityService {
|
|
|
509
528
|
});
|
|
510
529
|
}
|
|
511
530
|
/**
|
|
512
|
-
* Gets all existing entities and pushes them to the entites array
|
|
513
|
-
*
|
|
531
|
+
* Gets all existing entities and pushes them to the entites array.
|
|
532
|
+
*
|
|
533
|
+
* @returns A Promise of all received Entities.
|
|
514
534
|
*/
|
|
515
535
|
read() {
|
|
516
536
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -520,11 +540,12 @@ class EntityService {
|
|
|
520
540
|
});
|
|
521
541
|
}
|
|
522
542
|
/**
|
|
523
|
-
* Updates a specific Entity
|
|
524
|
-
*
|
|
543
|
+
* Updates a specific Entity.
|
|
544
|
+
*
|
|
545
|
+
* @param entity - The updated Entity
|
|
525
546
|
* All values that should be omitted will be removed from it inside this method.
|
|
526
|
-
* @param entityPriorChanges The current Entity.
|
|
527
|
-
* It Is used to get changed values and only update them instead of sending the whole entity data
|
|
547
|
+
* @param entityPriorChanges - The current Entity.
|
|
548
|
+
* It Is used to get changed values and only update them instead of sending the whole entity data.
|
|
528
549
|
*/
|
|
529
550
|
update(entity, entityPriorChanges) {
|
|
530
551
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -535,8 +556,9 @@ class EntityService {
|
|
|
535
556
|
});
|
|
536
557
|
}
|
|
537
558
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
559
|
+
* Deletes a specific Entity.
|
|
560
|
+
*
|
|
561
|
+
* @param id - The id of the element to delete.
|
|
540
562
|
*/
|
|
541
563
|
delete(id) {
|
|
542
564
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -547,30 +569,98 @@ class EntityService {
|
|
|
547
569
|
}
|
|
548
570
|
}
|
|
549
571
|
|
|
550
|
-
class
|
|
551
|
-
constructor(
|
|
552
|
-
this.
|
|
553
|
-
this.
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
this.
|
|
572
|
+
class ConfirmDialogDataInternal {
|
|
573
|
+
constructor(text, type, confirmButtonLabel, cancelButtonLabel, title, requireConfirmation, confirmationText) {
|
|
574
|
+
this.text = text;
|
|
575
|
+
this.type = type;
|
|
576
|
+
this.confirmButtonLabel = confirmButtonLabel;
|
|
577
|
+
this.cancelButtonLabel = cancelButtonLabel;
|
|
578
|
+
this.title = title;
|
|
579
|
+
this.requireConfirmation = requireConfirmation;
|
|
580
|
+
this.confirmationText = confirmationText;
|
|
558
581
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
582
|
+
}
|
|
583
|
+
class ConfirmDialogDataBuilder {
|
|
584
|
+
constructor(data) {
|
|
585
|
+
this.validateInput(data);
|
|
586
|
+
this.dataInput = data;
|
|
587
|
+
this.confirmDialogData = new ConfirmDialogDataInternal((data === null || data === void 0 ? void 0 : data.text) ? data.text : ['Do you really want to do this?'], (data === null || data === void 0 ? void 0 : data.type) ? data.type : 'default', (data === null || data === void 0 ? void 0 : data.confirmButtonLabel) ? data.confirmButtonLabel : 'Confirm', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.title) ? data.title : 'Confirmation', (data === null || data === void 0 ? void 0 : data.requireConfirmation) ? data.requireConfirmation : false, data === null || data === void 0 ? void 0 : data.confirmationText);
|
|
588
|
+
return this;
|
|
589
|
+
}
|
|
590
|
+
validateInput(data) {
|
|
591
|
+
if (!data) {
|
|
592
|
+
return;
|
|
564
593
|
}
|
|
565
|
-
if (
|
|
566
|
-
throw new Error(
|
|
594
|
+
if (data.requireConfirmation && !data.confirmationText) {
|
|
595
|
+
throw new Error(`Missing required Input data "confirmationText".
|
|
596
|
+
You can only omit this value when "requireConfirmation" is false.`);
|
|
567
597
|
}
|
|
568
|
-
if (
|
|
569
|
-
|
|
598
|
+
if (!data.requireConfirmation && data.confirmationText) {
|
|
599
|
+
throw new Error('The "confirmationText" will never be shown because "requireConfirmation" is not set to true');
|
|
570
600
|
}
|
|
571
|
-
if (
|
|
601
|
+
if (data.type === 'info-only' && data.cancelButtonLabel) {
|
|
572
602
|
throw new Error('The "cancelButtonLabel" will never be shown because "type" is set to "info-only"');
|
|
573
603
|
}
|
|
604
|
+
}
|
|
605
|
+
withDefaultText(text) {
|
|
606
|
+
var _a;
|
|
607
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.text)) {
|
|
608
|
+
this.confirmDialogData.text = text;
|
|
609
|
+
}
|
|
610
|
+
return this;
|
|
611
|
+
}
|
|
612
|
+
withDefaultType(type) {
|
|
613
|
+
var _a;
|
|
614
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
615
|
+
this.confirmDialogData.type = type;
|
|
616
|
+
}
|
|
617
|
+
return this;
|
|
618
|
+
}
|
|
619
|
+
withDefaultConfirmButtonLabel(label) {
|
|
620
|
+
var _a;
|
|
621
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmButtonLabel)) {
|
|
622
|
+
this.confirmDialogData.confirmButtonLabel = label;
|
|
623
|
+
}
|
|
624
|
+
return this;
|
|
625
|
+
}
|
|
626
|
+
withDefaultCancelButtonLabel(label) {
|
|
627
|
+
var _a;
|
|
628
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.cancelButtonLabel)) {
|
|
629
|
+
this.confirmDialogData.cancelButtonLabel = label;
|
|
630
|
+
}
|
|
631
|
+
return this;
|
|
632
|
+
}
|
|
633
|
+
withDefaultTitle(title) {
|
|
634
|
+
var _a;
|
|
635
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
636
|
+
this.confirmDialogData.title = title;
|
|
637
|
+
}
|
|
638
|
+
return this;
|
|
639
|
+
}
|
|
640
|
+
withDefaultRequireConfirmation(requireConfirmation) {
|
|
641
|
+
var _a;
|
|
642
|
+
if (((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.requireConfirmation) === undefined) {
|
|
643
|
+
this.confirmDialogData.requireConfirmation = requireConfirmation;
|
|
644
|
+
}
|
|
645
|
+
return this;
|
|
646
|
+
}
|
|
647
|
+
withDefaultConfirmationText(confirmationText) {
|
|
648
|
+
var _a;
|
|
649
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmationText)) {
|
|
650
|
+
this.confirmDialogData.confirmationText = confirmationText;
|
|
651
|
+
}
|
|
652
|
+
return this;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
class NgxMatEntityConfirmDialogComponent {
|
|
657
|
+
constructor(dialogRef, inputData) {
|
|
658
|
+
this.dialogRef = dialogRef;
|
|
659
|
+
this.inputData = inputData;
|
|
660
|
+
this.confirm = false;
|
|
661
|
+
}
|
|
662
|
+
ngOnInit() {
|
|
663
|
+
this.data = new ConfirmDialogDataBuilder(this.inputData).confirmDialogData;
|
|
574
664
|
this.dialogRef.disableClose = true;
|
|
575
665
|
}
|
|
576
666
|
confirmAction() {
|
|
@@ -581,10 +671,10 @@ class NgxMatEntityConfirmDialogComponent {
|
|
|
581
671
|
}
|
|
582
672
|
}
|
|
583
673
|
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 });
|
|
584
|
-
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
|
|
674
|
+
NgxMatEntityConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityConfirmDialogComponent, selector: "ngx-mat-entity-confirm-dialog", ngImport: i0, template: "<h2 mat-dialog-title *ngIf=\"data.title\">{{data.title}}</h2>\n\n<mat-dialog-content>\n <p *ngFor=\"let paragraph of data.text\">{{paragraph}}</p>\n <div *ngIf=\"data.requireConfirmation\" class=\"checkbox-wrapper\">\n <mat-checkbox [(ngModel)]=\"confirm\" name=\"confirm\">\n {{data.confirmationText}}\n </mat-checkbox>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button *ngIf=\"data.type === 'delete'\" mat-raised-button color=\"warn\" (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button *ngIf=\"data.type !== 'delete'\" mat-raised-button (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.cancelButtonLabel}}\n </button>\n</mat-dialog-actions>\n", styles: [".checkbox-wrapper{min-height:50px;display:flex}.checkbox-wrapper>mat-checkbox{align-self:center}mat-dialog-actions{display:flex;justify-content:space-between}\n"], components: [{ type: 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]" }] });
|
|
585
675
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogComponent, decorators: [{
|
|
586
676
|
type: Component,
|
|
587
|
-
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
|
|
677
|
+
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"] }]
|
|
588
678
|
}], ctorParameters: function () {
|
|
589
679
|
return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
590
680
|
type: Inject,
|
|
@@ -608,8 +698,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
608
698
|
|
|
609
699
|
/**
|
|
610
700
|
* Generates a default error message for most validation errors.
|
|
611
|
-
*
|
|
612
|
-
* @
|
|
701
|
+
*
|
|
702
|
+
* @param model - The ngModel to get the error from.
|
|
703
|
+
* @returns The Validation Error Message to display.
|
|
613
704
|
*/
|
|
614
705
|
function getValidationErrorMessage(model) {
|
|
615
706
|
if (model.hasError('matDatepickerParse')) {
|
|
@@ -638,14 +729,100 @@ function getValidationErrorMessage(model) {
|
|
|
638
729
|
}
|
|
639
730
|
}
|
|
640
731
|
|
|
732
|
+
class CreateDialogDataInternal {
|
|
733
|
+
constructor(title, createButtonLabel, cancelButtonLabel, createRequiresConfirmDialog, confirmCreateDialogData) {
|
|
734
|
+
this.title = title;
|
|
735
|
+
this.createButtonLabel = createButtonLabel;
|
|
736
|
+
this.cancelButtonLabel = cancelButtonLabel;
|
|
737
|
+
this.createRequiresConfirmDialog = createRequiresConfirmDialog;
|
|
738
|
+
this.confirmCreateDialogData = confirmCreateDialogData;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
class CreateDialogDataBuilder {
|
|
742
|
+
constructor(data) {
|
|
743
|
+
// this.validateInput(data);
|
|
744
|
+
this.dataInput = data;
|
|
745
|
+
const confirmCreateDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmCreateDialogData)
|
|
746
|
+
.withDefaultConfirmButtonLabel('Create')
|
|
747
|
+
.withDefaultText(['Do you really want to create this entity?'])
|
|
748
|
+
.withDefaultTitle('Create')
|
|
749
|
+
.confirmDialogData;
|
|
750
|
+
this.createDialogData = new CreateDialogDataInternal((data === null || data === void 0 ? void 0 : data.title) ? data.title : 'Create', (data === null || data === void 0 ? void 0 : data.createButtonLabel) ? data.createButtonLabel : 'Create', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.createRequiresConfirmDialog) ? data.createRequiresConfirmDialog : false, confirmCreateDialogData);
|
|
751
|
+
return this;
|
|
752
|
+
}
|
|
753
|
+
withDefaultTitle(title) {
|
|
754
|
+
var _a;
|
|
755
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
756
|
+
this.createDialogData.title = title;
|
|
757
|
+
}
|
|
758
|
+
return this;
|
|
759
|
+
}
|
|
760
|
+
withDefaultCreateButtonLabel(label) {
|
|
761
|
+
var _a;
|
|
762
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.createButtonLabel)) {
|
|
763
|
+
this.createDialogData.createButtonLabel = label;
|
|
764
|
+
}
|
|
765
|
+
return this;
|
|
766
|
+
}
|
|
767
|
+
withDefaultCancelButtonLabel(label) {
|
|
768
|
+
var _a;
|
|
769
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.cancelButtonLabel)) {
|
|
770
|
+
this.createDialogData.cancelButtonLabel = label;
|
|
771
|
+
}
|
|
772
|
+
return this;
|
|
773
|
+
}
|
|
774
|
+
withDefaultCreateRequiresConfirmDialog(createRequiresConfirmDialog) {
|
|
775
|
+
var _a;
|
|
776
|
+
if (((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.createRequiresConfirmDialog) === undefined) {
|
|
777
|
+
this.createDialogData.createRequiresConfirmDialog = createRequiresConfirmDialog;
|
|
778
|
+
}
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
withDefaultConfirmCreateDialogData(confirmCreateDialogData) {
|
|
782
|
+
var _a;
|
|
783
|
+
if (((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmCreateDialogData) === undefined) {
|
|
784
|
+
this.createDialogData.confirmCreateDialogData = confirmCreateDialogData;
|
|
785
|
+
}
|
|
786
|
+
return this;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
class AddArrayItemDialogDataInternal {
|
|
791
|
+
constructor(entity, createDialogData, getValidationErrorMessage) {
|
|
792
|
+
this.entity = entity;
|
|
793
|
+
this.createDialogData = createDialogData;
|
|
794
|
+
this.getValidationErrorMessage = getValidationErrorMessage;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
class AddArrayItemDialogDataBuilder {
|
|
798
|
+
constructor(data) {
|
|
799
|
+
this.dataInput = data;
|
|
800
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData)
|
|
801
|
+
.withDefaultCreateButtonLabel('Add')
|
|
802
|
+
.withDefaultTitle('Add to array')
|
|
803
|
+
.createDialogData;
|
|
804
|
+
this.addArrayItemDialogData = new AddArrayItemDialogDataInternal(data.entity, createDialogData, data.getValidationErrorMessage ? data.getValidationErrorMessage : getValidationErrorMessage);
|
|
805
|
+
return this;
|
|
806
|
+
}
|
|
807
|
+
withDefaultCreateDialogData(createDialogData) {
|
|
808
|
+
if (!this.dataInput.createDialogData) {
|
|
809
|
+
this.addArrayItemDialogData.createDialogData = createDialogData;
|
|
810
|
+
}
|
|
811
|
+
return this;
|
|
812
|
+
}
|
|
813
|
+
withDefaultGetValidationErrorMessage(getValidationErrorMessage) {
|
|
814
|
+
if (!this.dataInput.getValidationErrorMessage) {
|
|
815
|
+
this.addArrayItemDialogData.getValidationErrorMessage = getValidationErrorMessage;
|
|
816
|
+
}
|
|
817
|
+
return this;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
641
821
|
class NgxMatEntityInternalInputComponent {
|
|
642
822
|
constructor() {
|
|
643
823
|
this.DecoratorTypes = DecoratorTypes;
|
|
644
824
|
this.getWidth = EntityUtilities.getWidth;
|
|
645
825
|
}
|
|
646
|
-
/**
|
|
647
|
-
* Helper method needed to recursively generate property input components (used eg. with the object)
|
|
648
|
-
*/
|
|
649
826
|
trackByFn(index) {
|
|
650
827
|
return index;
|
|
651
828
|
}
|
|
@@ -698,13 +875,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
698
875
|
}] } });
|
|
699
876
|
|
|
700
877
|
class NgxMatEntityAddArrayItemDialogComponent {
|
|
701
|
-
constructor(
|
|
702
|
-
this.
|
|
878
|
+
constructor(inputData, dialogRef) {
|
|
879
|
+
this.inputData = inputData;
|
|
703
880
|
this.dialogRef = dialogRef;
|
|
704
881
|
this.EntityUtilities = EntityUtilities;
|
|
705
882
|
this.getWidth = EntityUtilities.getWidth;
|
|
706
883
|
}
|
|
707
884
|
ngOnInit() {
|
|
885
|
+
this.data = new AddArrayItemDialogDataBuilder(this.inputData).addArrayItemDialogData;
|
|
708
886
|
this.dialogRef.disableClose = true;
|
|
709
887
|
this.setEntityKeys();
|
|
710
888
|
}
|
|
@@ -722,10 +900,10 @@ class NgxMatEntityAddArrayItemDialogComponent {
|
|
|
722
900
|
}
|
|
723
901
|
}
|
|
724
902
|
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 });
|
|
725
|
-
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
|
|
903
|
+
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]" }] });
|
|
726
904
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogComponent, decorators: [{
|
|
727
905
|
type: Component,
|
|
728
|
-
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
|
|
906
|
+
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"] }]
|
|
729
907
|
}], ctorParameters: function () {
|
|
730
908
|
return [{ type: undefined, decorators: [{
|
|
731
909
|
type: Inject,
|
|
@@ -744,19 +922,19 @@ class NgxMatEntityArrayTableComponent {
|
|
|
744
922
|
return index;
|
|
745
923
|
}
|
|
746
924
|
ngOnInit() {
|
|
747
|
-
this.validateInput();
|
|
748
925
|
const givenDisplayColumns = this.metadata.displayColumns.map((v) => v.displayName);
|
|
749
|
-
|
|
750
|
-
throw new Error(`The name "select" for a display column is reserved.
|
|
751
|
-
Please choose a different name.`);
|
|
752
|
-
}
|
|
926
|
+
this.validateInput(givenDisplayColumns);
|
|
753
927
|
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
754
928
|
this.dataSource = new MatTableDataSource();
|
|
755
929
|
this.dataSource.data = this.arrayItems;
|
|
756
930
|
this.arrayItem = new this.metadata.EntityClass();
|
|
757
931
|
this.arrayItemPriorChanges = cloneDeep(this.arrayItem);
|
|
758
932
|
}
|
|
759
|
-
validateInput() {
|
|
933
|
+
validateInput(givenDisplayColumns) {
|
|
934
|
+
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
935
|
+
throw new Error(`The name "select" for a display column is reserved.
|
|
936
|
+
Please choose a different name.`);
|
|
937
|
+
}
|
|
760
938
|
if (!this.metadata.createInline && !this.metadata.createDialogData) {
|
|
761
939
|
throw new Error(`Missing required Input data "createDialogData".
|
|
762
940
|
You can only omit this value when the creation is inline.`);
|
|
@@ -769,11 +947,13 @@ class NgxMatEntityArrayTableComponent {
|
|
|
769
947
|
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
770
948
|
}
|
|
771
949
|
else {
|
|
772
|
-
const
|
|
950
|
+
const dialogInputData = {
|
|
773
951
|
entity: this.arrayItem,
|
|
774
952
|
createDialogData: this.metadata.createDialogData,
|
|
775
953
|
getValidationErrorMessage: this.getValidationErrorMessage
|
|
776
954
|
};
|
|
955
|
+
const dialogData = new AddArrayItemDialogDataBuilder(dialogInputData)
|
|
956
|
+
.addArrayItemDialogData;
|
|
777
957
|
firstValueFrom(this.dialog.open(NgxMatEntityAddArrayItemDialogComponent, {
|
|
778
958
|
data: dialogData,
|
|
779
959
|
autoFocus: false,
|
|
@@ -819,10 +999,10 @@ class NgxMatEntityArrayTableComponent {
|
|
|
819
999
|
}
|
|
820
1000
|
}
|
|
821
1001
|
NgxMatEntityArrayTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
822
|
-
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
|
|
1002
|
+
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"] }] });
|
|
823
1003
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableComponent, decorators: [{
|
|
824
1004
|
type: Component,
|
|
825
|
-
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
|
|
1005
|
+
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"] }]
|
|
826
1006
|
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { arrayItems: [{
|
|
827
1007
|
type: Input
|
|
828
1008
|
}], metadata: [{
|
|
@@ -839,9 +1019,6 @@ class NgxMatEntityInputComponent {
|
|
|
839
1019
|
this.DecoratorTypes = DecoratorTypes;
|
|
840
1020
|
this.getWidth = EntityUtilities.getWidth;
|
|
841
1021
|
}
|
|
842
|
-
/**
|
|
843
|
-
* Helper method needed to recursively generate property input components (used eg. with the object)
|
|
844
|
-
*/
|
|
845
1022
|
trackByFn(index) {
|
|
846
1023
|
return index;
|
|
847
1024
|
}
|
|
@@ -957,10 +1134,10 @@ class NgxMatEntityInputComponent {
|
|
|
957
1134
|
}
|
|
958
1135
|
}
|
|
959
1136
|
NgxMatEntityInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
960
|
-
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]" }] });
|
|
1137
|
+
NgxMatEntityInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: { entity: "entity", propertyKey: "propertyKey", getValidationErrorMessage: "getValidationErrorMessage", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit" }, ngImport: i0, template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"filterAutocompleteStrings(entity[propertyKey])\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Array-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY\">\n <ngx-mat-entity-array-table\n [arrayItems]=\"entityArrayValues\"\n [metadata]=\"metadataEntityArray\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [omit]=\"hideOmitForCreate ? 'create' : 'update'\"\n >\n </ngx-mat-entity-array-table>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n (keyup)=\"filterAutocompleteStrings(chipsInput)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n #chipsElement\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event, chipsElement)\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"], components: [{ type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i4.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit"] }, { type: NgxMatEntityArrayTableComponent, selector: "ngx-mat-entity-array-table", inputs: ["arrayItems", "metadata", "getValidationErrorMessage", "omit"] }, { type: i8$1.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i9.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$1.MatLabel, selector: "mat-label" }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i12.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i12.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i12.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i12.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i10.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.MatCheckboxRequiredValidator, selector: "mat-checkbox[required][formControlName], mat-checkbox[required][formControl], mat-checkbox[required][ngModel]" }, { type: i6.MatSlideToggleRequiredValidator, selector: "mat-slide-toggle[required][formControlName], mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]" }, { type: i12.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i12.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i12.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i8$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i8$1.MatChipRemove, selector: "[matChipRemove]" }, { type: i8$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i7.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
961
1138
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, decorators: [{
|
|
962
1139
|
type: Component,
|
|
963
|
-
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"] }]
|
|
1140
|
+
args: [{ selector: 'ngx-mat-entity-input', template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"filterAutocompleteStrings(entity[propertyKey])\"\n [required]=\"metadata.required\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [required]=\"metadata.required\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\" [required]=\"metadata.required\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-input>\n </div>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Array-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY\">\n <ngx-mat-entity-array-table\n [arrayItems]=\"entityArrayValues\"\n [metadata]=\"metadataEntityArray\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [omit]=\"hideOmitForCreate ? 'create' : 'update'\"\n >\n </ngx-mat-entity-array-table>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-list #chipList\n [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip *ngFor=\"let value of stringChipsArrayValues\" (removed)=\"removeStringChipArrayValue(value)\">\n {{value}}\n <button matChipRemove *ngIf=\"metadataStringChipsArray.deleteHtml\" [innerHtml]=\"metadataStringChipsArray.deleteHtml\">\n </button>\n <button matChipRemove *ngIf=\"!metadataStringChipsArray.deleteHtml\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip>\n <input matInput\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addStringChipArrayValue($event)\"\n (keyup)=\"filterAutocompleteStrings(chipsInput)\"\n [(ngModel)]=\"chipsInput\" [name]=\"propertyKey.toString()\" #chipsModel=\"ngModel\"\n #chipsElement\n [minlength]='metadataStringChipsArray.minLength ? metadataStringChipsArray.minLength : null'\n [maxlength]='metadataStringChipsArray.maxLength ? metadataStringChipsArray.maxLength : null'\n [pattern]=\"metadataStringChipsArray.regex ? metadataStringChipsArray.regex : '[\\\\s\\\\S]*'\"\n >\n <mat-error *ngIf=\"chipsModel.errors\">{{getValidationErrorMessage(chipsModel)}}</mat-error>\n </mat-chip-list>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event, chipsElement)\">\n <mat-option *ngFor=\"let value of filteredAutocompleteStrings\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error *ngIf=\"!chipsModel.errors\">{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"] }]
|
|
964
1141
|
}], ctorParameters: function () { return []; }, propDecorators: { entity: [{
|
|
965
1142
|
type: Input
|
|
966
1143
|
}], propertyKey: [{
|
|
@@ -973,123 +1150,383 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
973
1150
|
type: Input
|
|
974
1151
|
}] } });
|
|
975
1152
|
|
|
976
|
-
class
|
|
977
|
-
constructor(data, dialogRef, injector, dialog) {
|
|
978
|
-
this.data = data;
|
|
979
|
-
this.dialogRef = dialogRef;
|
|
980
|
-
this.injector = injector;
|
|
981
|
-
this.dialog = dialog;
|
|
982
|
-
this.EntityUtilities = EntityUtilities;
|
|
983
|
-
this.getWidth = EntityUtilities.getWidth;
|
|
984
|
-
}
|
|
985
|
-
ngOnInit() {
|
|
986
|
-
this.dialogRef.disableClose = true;
|
|
987
|
-
this.setEntityKeys();
|
|
988
|
-
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
989
|
-
}
|
|
990
|
-
setEntityKeys() {
|
|
991
|
-
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
992
|
-
const omitCreateKeys = EntityUtilities.getOmitForCreate(this.data.entity);
|
|
993
|
-
this.entityKeys = this.entityKeys.filter((k) => !omitCreateKeys.includes(k))
|
|
994
|
-
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
995
|
-
}
|
|
996
|
-
create() {
|
|
997
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
998
|
-
if (this.data.createDialogData.createRequiresConfirmDialog === false) {
|
|
999
|
-
return this.confirmCreate();
|
|
1000
|
-
}
|
|
1001
|
-
const dialogData = {
|
|
1002
|
-
// eslint-disable-next-line max-len
|
|
1003
|
-
text: ((_a = this.data.createDialogData.confirmCreateDialogData) === null || _a === void 0 ? void 0 : _a.text) ? (_b = this.data.createDialogData.confirmCreateDialogData) === null || _b === void 0 ? void 0 : _b.text : ['Do you really want to create this entity?'],
|
|
1004
|
-
type: 'default',
|
|
1005
|
-
// eslint-disable-next-line max-len
|
|
1006
|
-
confirmButtonLabel: ((_c = this.data.createDialogData.confirmCreateDialogData) === null || _c === void 0 ? void 0 : _c.confirmButtonLabel) ? (_d = this.data.createDialogData.confirmCreateDialogData) === null || _d === void 0 ? void 0 : _d.confirmButtonLabel : 'Create',
|
|
1007
|
-
// eslint-disable-next-line max-len
|
|
1008
|
-
cancelButtonLabel: ((_e = this.data.createDialogData.confirmCreateDialogData) === null || _e === void 0 ? void 0 : _e.cancelButtonLabel) ? (_f = this.data.createDialogData.confirmCreateDialogData) === null || _f === void 0 ? void 0 : _f.cancelButtonLabel : 'Cancel',
|
|
1009
|
-
// eslint-disable-next-line max-len
|
|
1010
|
-
title: ((_g = this.data.createDialogData.confirmCreateDialogData) === null || _g === void 0 ? void 0 : _g.title) ? (_h = this.data.createDialogData.confirmCreateDialogData) === null || _h === void 0 ? void 0 : _h.title : 'Create',
|
|
1011
|
-
// eslint-disable-next-line max-len
|
|
1012
|
-
requireConfirmation: ((_j = this.data.createDialogData.confirmCreateDialogData) === null || _j === void 0 ? void 0 : _j.requireConfirmation) ? (_k = this.data.createDialogData.confirmCreateDialogData) === null || _k === void 0 ? void 0 : _k.requireConfirmation : false,
|
|
1013
|
-
// eslint-disable-next-line max-len
|
|
1014
|
-
confirmationText: ((_l = this.data.createDialogData.confirmCreateDialogData) === null || _l === void 0 ? void 0 : _l.confirmationText) ? (_m = this.data.createDialogData.confirmCreateDialogData) === null || _m === void 0 ? void 0 : _m.confirmationText : undefined,
|
|
1015
|
-
};
|
|
1016
|
-
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1017
|
-
data: dialogData,
|
|
1018
|
-
autoFocus: false,
|
|
1019
|
-
restoreFocus: false
|
|
1020
|
-
});
|
|
1021
|
-
dialogref.afterClosed().subscribe((res) => {
|
|
1022
|
-
if (res === 1) {
|
|
1023
|
-
this.confirmCreate();
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
confirmCreate() {
|
|
1028
|
-
this.entityService.create(this.data.entity).then(() => this.dialogRef.close());
|
|
1029
|
-
}
|
|
1030
|
-
cancel() {
|
|
1031
|
-
this.dialogRef.close();
|
|
1032
|
-
}
|
|
1153
|
+
class NgxMatEntityInternalInputModule {
|
|
1033
1154
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1155
|
+
NgxMatEntityInternalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1156
|
+
NgxMatEntityInternalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, declarations: [NgxMatEntityInternalInputComponent], imports: [CommonModule,
|
|
1157
|
+
MatInputModule,
|
|
1158
|
+
FormsModule,
|
|
1159
|
+
MatFormFieldModule,
|
|
1160
|
+
MatSelectModule,
|
|
1161
|
+
MatAutocompleteModule,
|
|
1162
|
+
MatCheckboxModule,
|
|
1163
|
+
MatSlideToggleModule,
|
|
1164
|
+
MatTableModule], exports: [NgxMatEntityInternalInputComponent] });
|
|
1165
|
+
NgxMatEntityInternalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, imports: [[
|
|
1166
|
+
CommonModule,
|
|
1167
|
+
MatInputModule,
|
|
1168
|
+
FormsModule,
|
|
1169
|
+
MatFormFieldModule,
|
|
1170
|
+
MatSelectModule,
|
|
1171
|
+
MatAutocompleteModule,
|
|
1172
|
+
MatCheckboxModule,
|
|
1173
|
+
MatSlideToggleModule,
|
|
1174
|
+
MatTableModule
|
|
1175
|
+
]] });
|
|
1176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, decorators: [{
|
|
1177
|
+
type: NgModule,
|
|
1178
|
+
args: [{
|
|
1179
|
+
declarations: [NgxMatEntityInternalInputComponent],
|
|
1180
|
+
imports: [
|
|
1181
|
+
CommonModule,
|
|
1182
|
+
MatInputModule,
|
|
1183
|
+
FormsModule,
|
|
1184
|
+
MatFormFieldModule,
|
|
1185
|
+
MatSelectModule,
|
|
1186
|
+
MatAutocompleteModule,
|
|
1187
|
+
MatCheckboxModule,
|
|
1188
|
+
MatSlideToggleModule,
|
|
1189
|
+
MatTableModule
|
|
1190
|
+
],
|
|
1191
|
+
exports: [NgxMatEntityInternalInputComponent]
|
|
1192
|
+
}]
|
|
1193
|
+
}] });
|
|
1045
1194
|
|
|
1046
|
-
class
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1195
|
+
class NgxMatEntityAddArrayItemDialogModule {
|
|
1196
|
+
}
|
|
1197
|
+
NgxMatEntityAddArrayItemDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1198
|
+
NgxMatEntityAddArrayItemDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, declarations: [NgxMatEntityAddArrayItemDialogComponent], imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule], exports: [NgxMatEntityAddArrayItemDialogComponent] });
|
|
1199
|
+
NgxMatEntityAddArrayItemDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, imports: [[CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, decorators: [{
|
|
1201
|
+
type: NgModule,
|
|
1202
|
+
args: [{
|
|
1203
|
+
declarations: [NgxMatEntityAddArrayItemDialogComponent],
|
|
1204
|
+
imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1205
|
+
exports: [NgxMatEntityAddArrayItemDialogComponent]
|
|
1206
|
+
}]
|
|
1207
|
+
}] });
|
|
1208
|
+
|
|
1209
|
+
class NgxMatEntityArrayTableModule {
|
|
1210
|
+
}
|
|
1211
|
+
NgxMatEntityArrayTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1212
|
+
NgxMatEntityArrayTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, declarations: [NgxMatEntityArrayTableComponent], imports: [CommonModule,
|
|
1213
|
+
MatInputModule,
|
|
1214
|
+
FormsModule,
|
|
1215
|
+
MatFormFieldModule,
|
|
1216
|
+
MatSelectModule,
|
|
1217
|
+
MatAutocompleteModule,
|
|
1218
|
+
MatCheckboxModule,
|
|
1219
|
+
MatSlideToggleModule,
|
|
1220
|
+
MatTableModule,
|
|
1221
|
+
NgxMatEntityInternalInputModule,
|
|
1222
|
+
MatButtonModule,
|
|
1223
|
+
NgxMatEntityAddArrayItemDialogModule], exports: [NgxMatEntityArrayTableComponent] });
|
|
1224
|
+
NgxMatEntityArrayTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, imports: [[
|
|
1225
|
+
CommonModule,
|
|
1226
|
+
MatInputModule,
|
|
1227
|
+
FormsModule,
|
|
1228
|
+
MatFormFieldModule,
|
|
1229
|
+
MatSelectModule,
|
|
1230
|
+
MatAutocompleteModule,
|
|
1231
|
+
MatCheckboxModule,
|
|
1232
|
+
MatSlideToggleModule,
|
|
1233
|
+
MatTableModule,
|
|
1234
|
+
NgxMatEntityInternalInputModule,
|
|
1235
|
+
MatButtonModule,
|
|
1236
|
+
NgxMatEntityAddArrayItemDialogModule
|
|
1237
|
+
]] });
|
|
1238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, decorators: [{
|
|
1239
|
+
type: NgModule,
|
|
1240
|
+
args: [{
|
|
1241
|
+
declarations: [NgxMatEntityArrayTableComponent],
|
|
1242
|
+
imports: [
|
|
1243
|
+
CommonModule,
|
|
1244
|
+
MatInputModule,
|
|
1245
|
+
FormsModule,
|
|
1246
|
+
MatFormFieldModule,
|
|
1247
|
+
MatSelectModule,
|
|
1248
|
+
MatAutocompleteModule,
|
|
1249
|
+
MatCheckboxModule,
|
|
1250
|
+
MatSlideToggleModule,
|
|
1251
|
+
MatTableModule,
|
|
1252
|
+
NgxMatEntityInternalInputModule,
|
|
1253
|
+
MatButtonModule,
|
|
1254
|
+
NgxMatEntityAddArrayItemDialogModule
|
|
1255
|
+
],
|
|
1256
|
+
exports: [NgxMatEntityArrayTableComponent]
|
|
1257
|
+
}]
|
|
1258
|
+
}] });
|
|
1259
|
+
|
|
1260
|
+
class NgxMatEntityInputModule {
|
|
1261
|
+
}
|
|
1262
|
+
NgxMatEntityInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1263
|
+
NgxMatEntityInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, declarations: [NgxMatEntityInputComponent], imports: [CommonModule,
|
|
1264
|
+
MatInputModule,
|
|
1265
|
+
FormsModule,
|
|
1266
|
+
MatFormFieldModule,
|
|
1267
|
+
MatSelectModule,
|
|
1268
|
+
MatAutocompleteModule,
|
|
1269
|
+
MatCheckboxModule,
|
|
1270
|
+
MatSlideToggleModule,
|
|
1271
|
+
NgxMatEntityArrayTableModule,
|
|
1272
|
+
MatChipsModule,
|
|
1273
|
+
MatIconModule], exports: [NgxMatEntityInputComponent] });
|
|
1274
|
+
NgxMatEntityInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, imports: [[
|
|
1275
|
+
CommonModule,
|
|
1276
|
+
MatInputModule,
|
|
1277
|
+
FormsModule,
|
|
1278
|
+
MatFormFieldModule,
|
|
1279
|
+
MatSelectModule,
|
|
1280
|
+
MatAutocompleteModule,
|
|
1281
|
+
MatCheckboxModule,
|
|
1282
|
+
MatSlideToggleModule,
|
|
1283
|
+
NgxMatEntityArrayTableModule,
|
|
1284
|
+
MatChipsModule,
|
|
1285
|
+
MatIconModule
|
|
1286
|
+
]] });
|
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, decorators: [{
|
|
1288
|
+
type: NgModule,
|
|
1289
|
+
args: [{
|
|
1290
|
+
declarations: [NgxMatEntityInputComponent],
|
|
1291
|
+
imports: [
|
|
1292
|
+
CommonModule,
|
|
1293
|
+
MatInputModule,
|
|
1294
|
+
FormsModule,
|
|
1295
|
+
MatFormFieldModule,
|
|
1296
|
+
MatSelectModule,
|
|
1297
|
+
MatAutocompleteModule,
|
|
1298
|
+
MatCheckboxModule,
|
|
1299
|
+
MatSlideToggleModule,
|
|
1300
|
+
NgxMatEntityArrayTableModule,
|
|
1301
|
+
MatChipsModule,
|
|
1302
|
+
MatIconModule
|
|
1303
|
+
],
|
|
1304
|
+
exports: [NgxMatEntityInputComponent]
|
|
1305
|
+
}]
|
|
1306
|
+
}] });
|
|
1307
|
+
|
|
1308
|
+
class CreateEntityDialogDataInternal {
|
|
1309
|
+
constructor(entity, EntityServiceClass, createDialogData) {
|
|
1310
|
+
this.entity = entity;
|
|
1311
|
+
this.EntityServiceClass = EntityServiceClass;
|
|
1312
|
+
this.createDialogData = createDialogData;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
class CreateEntityDialogDataBuilder {
|
|
1316
|
+
constructor(data) {
|
|
1317
|
+
// this.validateInput(data);
|
|
1318
|
+
this.dataInput = data;
|
|
1319
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).createDialogData;
|
|
1320
|
+
this.createDialogData = new CreateEntityDialogDataInternal(data.entity, data.EntityServiceClass, createDialogData);
|
|
1321
|
+
return this;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
class NgxMatEntityCreateDialogComponent {
|
|
1326
|
+
constructor(inputData, dialogRef, injector, dialog) {
|
|
1327
|
+
this.inputData = inputData;
|
|
1328
|
+
this.dialogRef = dialogRef;
|
|
1329
|
+
this.injector = injector;
|
|
1330
|
+
this.dialog = dialog;
|
|
1331
|
+
this.EntityUtilities = EntityUtilities;
|
|
1332
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
1333
|
+
}
|
|
1334
|
+
ngOnInit() {
|
|
1335
|
+
this.data = new CreateEntityDialogDataBuilder(this.inputData).createDialogData;
|
|
1336
|
+
this.dialogRef.disableClose = true;
|
|
1337
|
+
this.setEntityKeys();
|
|
1338
|
+
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1339
|
+
}
|
|
1340
|
+
setEntityKeys() {
|
|
1341
|
+
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
1342
|
+
const omitCreateKeys = EntityUtilities.getOmitForCreate(this.data.entity);
|
|
1343
|
+
this.entityKeys = this.entityKeys.filter((k) => !omitCreateKeys.includes(k))
|
|
1344
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1345
|
+
}
|
|
1346
|
+
create() {
|
|
1347
|
+
var _a, _b;
|
|
1348
|
+
if (!((_a = this.data.createDialogData) === null || _a === void 0 ? void 0 : _a.createRequiresConfirmDialog)) {
|
|
1349
|
+
return this.confirmCreate();
|
|
1350
|
+
}
|
|
1351
|
+
const dialogData = new ConfirmDialogDataBuilder((_b = this.data.createDialogData) === null || _b === void 0 ? void 0 : _b.confirmCreateDialogData)
|
|
1352
|
+
.withDefaultText(['Do you really want to create this entity?'])
|
|
1353
|
+
.withDefaultConfirmButtonLabel('Create')
|
|
1354
|
+
.withDefaultTitle('Create')
|
|
1355
|
+
.confirmDialogData;
|
|
1356
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1357
|
+
data: dialogData,
|
|
1358
|
+
autoFocus: false,
|
|
1359
|
+
restoreFocus: false
|
|
1360
|
+
});
|
|
1361
|
+
dialogref.afterClosed().subscribe((res) => {
|
|
1362
|
+
if (res === 1) {
|
|
1363
|
+
this.confirmCreate();
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
confirmCreate() {
|
|
1368
|
+
this.entityService.create(this.data.entity).then(() => this.dialogRef.close());
|
|
1369
|
+
}
|
|
1370
|
+
cancel() {
|
|
1371
|
+
this.dialogRef.close();
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
NgxMatEntityCreateDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i0.Injector }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
1375
|
+
NgxMatEntityCreateDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityCreateDialogComponent, selector: "ngx-mat-entity-create-dialog", ngImport: i0, template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <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]" }] });
|
|
1376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogComponent, decorators: [{
|
|
1377
|
+
type: Component,
|
|
1378
|
+
args: [{ selector: 'ngx-mat-entity-create-dialog', template: "<h2 mat-dialog-title>{{data.createDialogData.title}}</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <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"] }]
|
|
1379
|
+
}], ctorParameters: function () {
|
|
1380
|
+
return [{ type: undefined, decorators: [{
|
|
1381
|
+
type: Inject,
|
|
1382
|
+
args: [MAT_DIALOG_DATA]
|
|
1383
|
+
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }];
|
|
1384
|
+
} });
|
|
1385
|
+
|
|
1386
|
+
class EditDialogDataInternal {
|
|
1387
|
+
constructor(title, confirmButtonLabel, deleteButtonLabel, cancelButtonLabel, deleteRequiresConfirmDialog, editRequiresConfirmDialog, confirmDeleteDialogData, confirmEditDialogData) {
|
|
1388
|
+
this.title = title;
|
|
1389
|
+
this.confirmButtonLabel = confirmButtonLabel;
|
|
1390
|
+
this.deleteButtonLabel = deleteButtonLabel;
|
|
1391
|
+
this.cancelButtonLabel = cancelButtonLabel;
|
|
1392
|
+
this.deleteRequiresConfirmDialog = deleteRequiresConfirmDialog;
|
|
1393
|
+
this.editRequiresConfirmDialog = editRequiresConfirmDialog;
|
|
1394
|
+
this.confirmDeleteDialogData = confirmDeleteDialogData;
|
|
1395
|
+
this.confirmEditDialogData = confirmEditDialogData;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
class EditDialogDataBuilder {
|
|
1399
|
+
constructor(data) {
|
|
1400
|
+
// this.validateInput(data);
|
|
1401
|
+
this.dataInput = data;
|
|
1402
|
+
const confirmEditDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmEditDialogData)
|
|
1403
|
+
.withDefaultConfirmButtonLabel('Save')
|
|
1404
|
+
.withDefaultText(['Do you really want to save all changes?'])
|
|
1405
|
+
.withDefaultTitle('Edit')
|
|
1406
|
+
.confirmDialogData;
|
|
1407
|
+
const confirmDeleteDialogData = new ConfirmDialogDataBuilder(data === null || data === void 0 ? void 0 : data.confirmDeleteDialogData)
|
|
1408
|
+
.withDefaultConfirmButtonLabel('Delete')
|
|
1409
|
+
.withDefaultType('delete')
|
|
1410
|
+
.withDefaultText(['Do you really want to delete this entity?'])
|
|
1411
|
+
.withDefaultTitle('Delete')
|
|
1412
|
+
.confirmDialogData;
|
|
1413
|
+
this.editDialogData = new EditDialogDataInternal((data === null || data === void 0 ? void 0 : data.title) ? data.title : () => 'Edit', (data === null || data === void 0 ? void 0 : data.confirmButtonLabel) ? data.confirmButtonLabel : 'Save', (data === null || data === void 0 ? void 0 : data.deleteButtonLabel) ? data.deleteButtonLabel : 'Delete', (data === null || data === void 0 ? void 0 : data.cancelButtonLabel) ? data.cancelButtonLabel : 'Cancel', (data === null || data === void 0 ? void 0 : data.deleteRequiresConfirmDialog) ? data.deleteRequiresConfirmDialog : true, (data === null || data === void 0 ? void 0 : data.editRequiresConfirmDialog) ? data.editRequiresConfirmDialog : false, confirmDeleteDialogData, confirmEditDialogData);
|
|
1414
|
+
return this;
|
|
1415
|
+
}
|
|
1416
|
+
withDefaultTitle(title) {
|
|
1417
|
+
var _a;
|
|
1418
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
1419
|
+
this.editDialogData.title = title;
|
|
1420
|
+
}
|
|
1421
|
+
return this;
|
|
1422
|
+
}
|
|
1423
|
+
withDefaultConfirmButtonLabel(label) {
|
|
1424
|
+
var _a;
|
|
1425
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmButtonLabel)) {
|
|
1426
|
+
this.editDialogData.confirmButtonLabel = label;
|
|
1427
|
+
}
|
|
1428
|
+
return this;
|
|
1429
|
+
}
|
|
1430
|
+
withDefaultDeleteButtonLabel(label) {
|
|
1431
|
+
var _a;
|
|
1432
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.deleteButtonLabel)) {
|
|
1433
|
+
this.editDialogData.deleteButtonLabel = label;
|
|
1434
|
+
}
|
|
1435
|
+
return this;
|
|
1436
|
+
}
|
|
1437
|
+
withDefaultCancelButtonLabel(label) {
|
|
1438
|
+
var _a;
|
|
1439
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.cancelButtonLabel)) {
|
|
1440
|
+
this.editDialogData.cancelButtonLabel = label;
|
|
1441
|
+
}
|
|
1442
|
+
return this;
|
|
1443
|
+
}
|
|
1444
|
+
withDefaultDeleteRequiresConfirmDialog(deleteRequiresConfirmDialog) {
|
|
1445
|
+
var _a;
|
|
1446
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.deleteRequiresConfirmDialog)) {
|
|
1447
|
+
this.editDialogData.deleteRequiresConfirmDialog = deleteRequiresConfirmDialog;
|
|
1448
|
+
}
|
|
1449
|
+
return this;
|
|
1450
|
+
}
|
|
1451
|
+
withDefaultEditRequiresConfirmDialog(editRequiresConfirmDialog) {
|
|
1452
|
+
var _a;
|
|
1453
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.editRequiresConfirmDialog)) {
|
|
1454
|
+
this.editDialogData.editRequiresConfirmDialog = editRequiresConfirmDialog;
|
|
1455
|
+
}
|
|
1456
|
+
return this;
|
|
1457
|
+
}
|
|
1458
|
+
withDefaultConfirmDeleteDialogData(confirmDeleteDialogData) {
|
|
1459
|
+
var _a;
|
|
1460
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmDeleteDialogData)) {
|
|
1461
|
+
this.editDialogData.confirmDeleteDialogData = confirmDeleteDialogData;
|
|
1462
|
+
}
|
|
1463
|
+
return this;
|
|
1464
|
+
}
|
|
1465
|
+
withDefaultConfirmEditDialogData(confirmEditDialogData) {
|
|
1466
|
+
var _a;
|
|
1467
|
+
if (!((_a = this.dataInput) === null || _a === void 0 ? void 0 : _a.confirmEditDialogData)) {
|
|
1468
|
+
this.editDialogData.confirmEditDialogData = confirmEditDialogData;
|
|
1469
|
+
}
|
|
1470
|
+
return this;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
class EditEntityDialogDataInternal {
|
|
1475
|
+
constructor(entity, EntityServiceClass, editDialogData, allowDelete) {
|
|
1476
|
+
this.entity = entity;
|
|
1477
|
+
this.EntityServiceClass = EntityServiceClass;
|
|
1478
|
+
this.editDialogData = editDialogData;
|
|
1479
|
+
this.allowDelete = allowDelete;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
class EditEntityDialogDataBuilder {
|
|
1483
|
+
constructor(data) {
|
|
1484
|
+
// this.validateInput(data);
|
|
1485
|
+
this.dataInput = data;
|
|
1486
|
+
const editDialogData = new EditDialogDataBuilder(data.editDialogData).editDialogData;
|
|
1487
|
+
this.editDialogData = new EditEntityDialogDataInternal(data.entity, data.EntityServiceClass, editDialogData, data.allowDelete ? data.allowDelete : () => true);
|
|
1488
|
+
return this;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
class NgxMatEntityEditDialogComponent {
|
|
1493
|
+
constructor(inputData, dialogRef, injector, dialog) {
|
|
1494
|
+
this.inputData = inputData;
|
|
1495
|
+
this.dialogRef = dialogRef;
|
|
1496
|
+
this.injector = injector;
|
|
1497
|
+
this.dialog = dialog;
|
|
1498
|
+
this.EntityUtilities = EntityUtilities;
|
|
1499
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
1500
|
+
}
|
|
1501
|
+
ngOnInit() {
|
|
1502
|
+
this.data = new EditEntityDialogDataBuilder(this.inputData).editDialogData;
|
|
1503
|
+
this.dialogRef.disableClose = true;
|
|
1504
|
+
this.setEntityKeys();
|
|
1505
|
+
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1506
|
+
this.entityPriorChanges = cloneDeep(this.data.entity);
|
|
1507
|
+
}
|
|
1508
|
+
setEntityKeys() {
|
|
1509
|
+
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
1510
|
+
const omitUpdateKeys = EntityUtilities.getOmitForUpdate(this.data.entity);
|
|
1511
|
+
this.entityKeys = this.entityKeys.filter((k) => !omitUpdateKeys.includes(k))
|
|
1512
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1513
|
+
}
|
|
1514
|
+
edit() {
|
|
1515
|
+
if (!this.data.editDialogData.editRequiresConfirmDialog) {
|
|
1516
|
+
return this.confirmEdit();
|
|
1517
|
+
}
|
|
1518
|
+
const dialogData = new ConfirmDialogDataBuilder(this.data.editDialogData.confirmEditDialogData)
|
|
1519
|
+
.withDefaultText(['Do you really want to save all changes?'])
|
|
1520
|
+
.withDefaultConfirmButtonLabel('Save')
|
|
1521
|
+
.withDefaultTitle('Edit')
|
|
1522
|
+
.confirmDialogData;
|
|
1523
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1524
|
+
data: dialogData,
|
|
1525
|
+
autoFocus: false,
|
|
1526
|
+
restoreFocus: false
|
|
1527
|
+
});
|
|
1528
|
+
dialogref.afterClosed().subscribe((res) => {
|
|
1529
|
+
if (res === 1) {
|
|
1093
1530
|
this.confirmEdit();
|
|
1094
1531
|
}
|
|
1095
1532
|
});
|
|
@@ -1098,25 +1535,15 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1098
1535
|
this.entityService.update(this.data.entity, this.entityPriorChanges).then(() => this.dialogRef.close(1));
|
|
1099
1536
|
}
|
|
1100
1537
|
delete() {
|
|
1101
|
-
|
|
1102
|
-
if (this.data.editDialogData.deleteRequiresConfirmDialog === false) {
|
|
1538
|
+
if (!this.data.editDialogData.deleteRequiresConfirmDialog) {
|
|
1103
1539
|
return this.confirmDelete();
|
|
1104
1540
|
}
|
|
1105
|
-
const dialogData =
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
// eslint-disable-next-line max-len
|
|
1112
|
-
cancelButtonLabel: ((_e = this.data.editDialogData.confirmDeleteDialogData) === null || _e === void 0 ? void 0 : _e.cancelButtonLabel) ? (_f = this.data.editDialogData.confirmDeleteDialogData) === null || _f === void 0 ? void 0 : _f.cancelButtonLabel : 'Cancel',
|
|
1113
|
-
// eslint-disable-next-line max-len
|
|
1114
|
-
title: ((_g = this.data.editDialogData.confirmDeleteDialogData) === null || _g === void 0 ? void 0 : _g.title) ? (_h = this.data.editDialogData.confirmDeleteDialogData) === null || _h === void 0 ? void 0 : _h.title : 'Delete',
|
|
1115
|
-
// eslint-disable-next-line max-len
|
|
1116
|
-
requireConfirmation: ((_j = this.data.editDialogData.confirmDeleteDialogData) === null || _j === void 0 ? void 0 : _j.requireConfirmation) ? (_k = this.data.editDialogData.confirmDeleteDialogData) === null || _k === void 0 ? void 0 : _k.requireConfirmation : false,
|
|
1117
|
-
// eslint-disable-next-line max-len
|
|
1118
|
-
confirmationText: ((_l = this.data.editDialogData.confirmDeleteDialogData) === null || _l === void 0 ? void 0 : _l.confirmationText) ? (_m = this.data.editDialogData.confirmDeleteDialogData) === null || _m === void 0 ? void 0 : _m.confirmationText : undefined,
|
|
1119
|
-
};
|
|
1541
|
+
const dialogData = new ConfirmDialogDataBuilder(this.data.editDialogData.confirmDeleteDialogData)
|
|
1542
|
+
.withDefaultText(['Do you really want to delete this entity?'])
|
|
1543
|
+
.withDefaultType('delete')
|
|
1544
|
+
.withDefaultConfirmButtonLabel('Delete')
|
|
1545
|
+
.withDefaultTitle('Delete')
|
|
1546
|
+
.confirmDialogData;
|
|
1120
1547
|
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1121
1548
|
data: dialogData,
|
|
1122
1549
|
autoFocus: false,
|
|
@@ -1137,10 +1564,10 @@ class NgxMatEntityEditDialogComponent {
|
|
|
1137
1564
|
}
|
|
1138
1565
|
}
|
|
1139
1566
|
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 });
|
|
1140
|
-
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
|
|
1567
|
+
NgxMatEntityEditDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityEditDialogComponent, selector: "ngx-mat-entity-edit-dialog", ngImport: i0, template: "<h2 mat-dialog-title>\n {{data.editDialogData.title(data.entity)}}\n <button *ngIf=\"data.allowDelete(data.entity)\" mat-raised-button (click)=\"delete()\" color=\"warn\" class=\"delete-button\" tabindex=\"-1\">\n {{data.editDialogData.deleteButtonLabel}}\n </button>\n</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-input\n *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]" }] });
|
|
1141
1568
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogComponent, decorators: [{
|
|
1142
1569
|
type: Component,
|
|
1143
|
-
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
|
|
1570
|
+
args: [{ selector: 'ngx-mat-entity-edit-dialog', template: "<h2 mat-dialog-title>\n {{data.editDialogData.title(data.entity)}}\n <button *ngIf=\"data.allowDelete(data.entity)\" mat-raised-button (click)=\"delete()\" color=\"warn\" class=\"delete-button\" tabindex=\"-1\">\n {{data.editDialogData.deleteButtonLabel}}\n </button>\n</h2>\n\n<mat-dialog-content>\n <form #form=\"ngForm\" class=\"row\">\n <ngx-mat-entity-input\n *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"] }]
|
|
1144
1571
|
}], ctorParameters: function () {
|
|
1145
1572
|
return [{ type: undefined, decorators: [{
|
|
1146
1573
|
type: Inject,
|
|
@@ -1148,6 +1575,94 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1148
1575
|
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }];
|
|
1149
1576
|
} });
|
|
1150
1577
|
|
|
1578
|
+
class TableDataInternal {
|
|
1579
|
+
constructor(baseData, createDialogData, editDialogData) {
|
|
1580
|
+
this.baseData = baseData;
|
|
1581
|
+
this.createDialogData = createDialogData;
|
|
1582
|
+
this.editDialogData = editDialogData;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
class BaseDataBuilder {
|
|
1586
|
+
constructor(data) {
|
|
1587
|
+
//this.validateInput(data);
|
|
1588
|
+
this.dataInput = data;
|
|
1589
|
+
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);
|
|
1590
|
+
return this;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
class BaseDataInternal {
|
|
1594
|
+
constructor(title, displayColumns, EntityServiceClass, searchLabel, createButtonLabel, searchString, allowCreate, allowEdit, allowDelete, multiSelectActions, multiSelectLabel, EntityClass, edit, create) {
|
|
1595
|
+
this.title = title;
|
|
1596
|
+
this.displayColumns = displayColumns;
|
|
1597
|
+
this.EntityServiceClass = EntityServiceClass;
|
|
1598
|
+
this.EntityClass = EntityClass;
|
|
1599
|
+
this.searchLabel = searchLabel;
|
|
1600
|
+
this.createButtonLabel = createButtonLabel;
|
|
1601
|
+
this.searchString = searchString;
|
|
1602
|
+
this.allowCreate = allowCreate;
|
|
1603
|
+
this.allowEdit = allowEdit;
|
|
1604
|
+
this.allowDelete = allowDelete;
|
|
1605
|
+
this.multiSelectActions = multiSelectActions;
|
|
1606
|
+
this.multiSelectLabel = multiSelectLabel;
|
|
1607
|
+
this.edit = edit;
|
|
1608
|
+
this.create = create;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
class TableDataBuilder {
|
|
1612
|
+
constructor(data) {
|
|
1613
|
+
this.validateInput(data);
|
|
1614
|
+
this.dataInput = data;
|
|
1615
|
+
const createDialogData = new CreateDialogDataBuilder(data.createDialogData).createDialogData;
|
|
1616
|
+
const editDialogData = new EditDialogDataBuilder(data.editDialogData).editDialogData;
|
|
1617
|
+
const baseData = new BaseDataBuilder(data.baseData).baseData;
|
|
1618
|
+
this.tableData = new TableDataInternal(baseData, createDialogData, editDialogData);
|
|
1619
|
+
return this;
|
|
1620
|
+
}
|
|
1621
|
+
validateInput(data) {
|
|
1622
|
+
var _a;
|
|
1623
|
+
if (((_a = data.baseData.multiSelectActions) === null || _a === void 0 ? void 0 : _a.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
|
+
|
|
1151
1666
|
class NgxMatEntityTableComponent {
|
|
1152
1667
|
constructor(dialog, injector) {
|
|
1153
1668
|
this.dialog = dialog;
|
|
@@ -1157,15 +1672,10 @@ class NgxMatEntityTableComponent {
|
|
|
1157
1672
|
this.selection = new SelectionModel(true, []);
|
|
1158
1673
|
}
|
|
1159
1674
|
ngOnInit() {
|
|
1160
|
-
|
|
1161
|
-
this.
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
if ((_a = this.entitiesData.baseData.multiSelectActions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1165
|
-
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
1166
|
-
throw new Error(`The name "select" for a display column is reserved for the multi-select action functionality.
|
|
1167
|
-
Please choose a different name.`);
|
|
1168
|
-
}
|
|
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) {
|
|
1169
1679
|
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
1170
1680
|
}
|
|
1171
1681
|
else {
|
|
@@ -1173,13 +1683,12 @@ class NgxMatEntityTableComponent {
|
|
|
1173
1683
|
}
|
|
1174
1684
|
this.dataSource.sortingDataAccessor = (entity, header) => {
|
|
1175
1685
|
var _a;
|
|
1176
|
-
return (_a = this.
|
|
1686
|
+
return (_a = this.data.baseData.displayColumns.find((dp) => dp.displayName === header)) === null || _a === void 0 ? void 0 : _a.value(entity);
|
|
1177
1687
|
};
|
|
1178
1688
|
this.dataSource.sort = this.sort;
|
|
1179
|
-
if (this.
|
|
1689
|
+
if (this.data.baseData.searchString) {
|
|
1180
1690
|
this.dataSource.filterPredicate = (entity, filter) => {
|
|
1181
|
-
|
|
1182
|
-
const searchStr = (_b = (_a = this.entitiesData.baseData).searchString) === null || _b === void 0 ? void 0 : _b.call(_a, entity);
|
|
1691
|
+
const searchStr = this.data.baseData.searchString(entity);
|
|
1183
1692
|
const formattedSearchString = searchStr.toLowerCase();
|
|
1184
1693
|
const formattedFilterString = filter.toLowerCase();
|
|
1185
1694
|
return formattedSearchString.includes(formattedFilterString);
|
|
@@ -1193,63 +1702,27 @@ class NgxMatEntityTableComponent {
|
|
|
1193
1702
|
});
|
|
1194
1703
|
this.entityService.read();
|
|
1195
1704
|
}
|
|
1196
|
-
validateInput() {
|
|
1197
|
-
if (!this.entitiesData.baseData.displayColumns) {
|
|
1198
|
-
throw new Error('Missing required Input data "displayColumns"');
|
|
1199
|
-
}
|
|
1200
|
-
if (!this.entitiesData.baseData.title) {
|
|
1201
|
-
throw new Error('Missing required Input data "title"');
|
|
1202
|
-
}
|
|
1203
|
-
if (!this.entitiesData.baseData.EntityServiceClass) {
|
|
1204
|
-
throw new Error('Missing required Input data "EntityServiceClass"');
|
|
1205
|
-
}
|
|
1206
|
-
if (this.entitiesData.baseData.allowCreate === undefined) {
|
|
1207
|
-
this.entitiesData.baseData.allowCreate = true;
|
|
1208
|
-
}
|
|
1209
|
-
if (this.entitiesData.baseData.allowEdit === undefined) {
|
|
1210
|
-
this.entitiesData.baseData.allowEdit = () => true;
|
|
1211
|
-
}
|
|
1212
|
-
if (this.entitiesData.baseData.allowDelete === undefined) {
|
|
1213
|
-
this.entitiesData.baseData.allowDelete = () => true;
|
|
1214
|
-
}
|
|
1215
|
-
if ((this.entitiesData.baseData.allowEdit !== (() => false)
|
|
1216
|
-
|| this.entitiesData.baseData.allowDelete !== (() => false)
|
|
1217
|
-
|| this.entitiesData.baseData.allowCreate)
|
|
1218
|
-
&& !this.entitiesData.baseData.EntityClass) {
|
|
1219
|
-
throw new Error(`
|
|
1220
|
-
Missing required Input data "EntityClass".
|
|
1221
|
-
You can only omit this value if you can neither create or update entities.`);
|
|
1222
|
-
}
|
|
1223
|
-
if (this.entitiesData.baseData.allowCreate && !this.entitiesData.baseData.create && !this.entitiesData.createDialogData) {
|
|
1224
|
-
throw new Error(`Missing required Input data "createDialogData".
|
|
1225
|
-
You can only omit this value when creation is disallowed or done with a custom create method.`);
|
|
1226
|
-
}
|
|
1227
|
-
if ((this.entitiesData.baseData.allowEdit !== (() => false)
|
|
1228
|
-
|| this.entitiesData.baseData.allowDelete !== (() => false))
|
|
1229
|
-
&& !this.entitiesData.baseData.edit
|
|
1230
|
-
&& !this.entitiesData.editDialogData) {
|
|
1231
|
-
throw new Error(`Missing required Input data "editDialogData".
|
|
1232
|
-
You can only omit this value when editing and deleting is disallowed or done with a custom edit method.`);
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
1705
|
editEntity(entity) {
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1706
|
+
if (this.data.baseData.allowEdit(entity)) {
|
|
1707
|
+
if (!this.data.baseData.EntityClass) {
|
|
1708
|
+
throw new Error('No "EntityClass" specified for this table');
|
|
1709
|
+
}
|
|
1710
|
+
if (this.data.baseData.edit) {
|
|
1711
|
+
this.data.baseData.edit(new this.data.baseData.EntityClass(entity));
|
|
1240
1712
|
}
|
|
1241
1713
|
else {
|
|
1242
|
-
this.editDefault(new this.
|
|
1714
|
+
this.editDefault(new this.data.baseData.EntityClass(entity));
|
|
1243
1715
|
}
|
|
1244
1716
|
}
|
|
1245
1717
|
}
|
|
1246
1718
|
editDefault(entity) {
|
|
1247
|
-
const
|
|
1719
|
+
const inputDialogData = {
|
|
1248
1720
|
entity: entity,
|
|
1249
|
-
EntityServiceClass: this.
|
|
1250
|
-
allowDelete: this.
|
|
1251
|
-
editDialogData: this.
|
|
1721
|
+
EntityServiceClass: this.data.baseData.EntityServiceClass,
|
|
1722
|
+
allowDelete: this.data.baseData.allowDelete,
|
|
1723
|
+
editDialogData: this.data.editDialogData
|
|
1252
1724
|
};
|
|
1725
|
+
const dialogData = new EditEntityDialogDataBuilder(inputDialogData).editDialogData;
|
|
1253
1726
|
firstValueFrom(this.dialog.open(NgxMatEntityEditDialogComponent, {
|
|
1254
1727
|
data: dialogData,
|
|
1255
1728
|
minWidth: '60%',
|
|
@@ -1265,21 +1738,24 @@ class NgxMatEntityTableComponent {
|
|
|
1265
1738
|
});
|
|
1266
1739
|
}
|
|
1267
1740
|
createEntity() {
|
|
1268
|
-
if (this.
|
|
1269
|
-
if (this.
|
|
1270
|
-
|
|
1741
|
+
if (this.data.baseData.allowCreate) {
|
|
1742
|
+
if (!this.data.baseData.EntityClass) {
|
|
1743
|
+
throw new Error('No "EntityClass" specified for this table');
|
|
1744
|
+
}
|
|
1745
|
+
if (this.data.baseData.create) {
|
|
1746
|
+
this.data.baseData.create(new this.data.baseData.EntityClass());
|
|
1271
1747
|
}
|
|
1272
1748
|
else {
|
|
1273
|
-
this.createDefault(new this.
|
|
1749
|
+
this.createDefault(new this.data.baseData.EntityClass());
|
|
1274
1750
|
}
|
|
1275
1751
|
}
|
|
1276
1752
|
}
|
|
1277
1753
|
createDefault(entity) {
|
|
1278
|
-
const dialogData = {
|
|
1754
|
+
const dialogData = new CreateEntityDialogDataBuilder({
|
|
1279
1755
|
entity: entity,
|
|
1280
|
-
EntityServiceClass: this.
|
|
1281
|
-
createDialogData: this.
|
|
1282
|
-
};
|
|
1756
|
+
EntityServiceClass: this.data.baseData.EntityServiceClass,
|
|
1757
|
+
createDialogData: this.data.createDialogData
|
|
1758
|
+
}).createDialogData;
|
|
1283
1759
|
this.dialog.open(NgxMatEntityCreateDialogComponent, {
|
|
1284
1760
|
data: dialogData,
|
|
1285
1761
|
minWidth: '60%',
|
|
@@ -1288,20 +1764,12 @@ class NgxMatEntityTableComponent {
|
|
|
1288
1764
|
});
|
|
1289
1765
|
}
|
|
1290
1766
|
runMultiAction(action) {
|
|
1291
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1292
1767
|
if (!action.requireConfirmDialog || !action.requireConfirmDialog(this.selection.selected)) {
|
|
1293
1768
|
return this.confirmRunMultiAction(action);
|
|
1294
1769
|
}
|
|
1295
|
-
const dialogData =
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
type: 'default',
|
|
1299
|
-
confirmButtonLabel: ((_c = action.confirmDialogData) === null || _c === void 0 ? void 0 : _c.confirmButtonLabel) ? (_d = action.confirmDialogData) === null || _d === void 0 ? void 0 : _d.confirmButtonLabel : 'Confirm',
|
|
1300
|
-
cancelButtonLabel: ((_e = action.confirmDialogData) === null || _e === void 0 ? void 0 : _e.cancelButtonLabel) ? (_f = action.confirmDialogData) === null || _f === void 0 ? void 0 : _f.cancelButtonLabel : 'Cancel',
|
|
1301
|
-
title: ((_g = action.confirmDialogData) === null || _g === void 0 ? void 0 : _g.title) ? (_h = action.confirmDialogData) === null || _h === void 0 ? void 0 : _h.title : action.displayName,
|
|
1302
|
-
requireConfirmation: ((_j = action.confirmDialogData) === null || _j === void 0 ? void 0 : _j.requireConfirmation) ? (_k = action.confirmDialogData) === null || _k === void 0 ? void 0 : _k.requireConfirmation : false,
|
|
1303
|
-
confirmationText: ((_l = action.confirmDialogData) === null || _l === void 0 ? void 0 : _l.confirmationText) ? (_m = action.confirmDialogData) === null || _m === void 0 ? void 0 : _m.confirmationText : undefined
|
|
1304
|
-
};
|
|
1770
|
+
const dialogData = new ConfirmDialogDataBuilder(action.confirmDialogData)
|
|
1771
|
+
.withDefaultText([`Do you really want to run this action on ${this.selection.selected.length} entries?`])
|
|
1772
|
+
.withDefaultTitle(action.displayName).confirmDialogData;
|
|
1305
1773
|
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1306
1774
|
data: dialogData,
|
|
1307
1775
|
autoFocus: false,
|
|
@@ -1349,11 +1817,11 @@ class NgxMatEntityTableComponent {
|
|
|
1349
1817
|
}
|
|
1350
1818
|
}
|
|
1351
1819
|
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 });
|
|
1352
|
-
NgxMatEntityTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityTableComponent, selector: "ngx-mat-entity-table", inputs: {
|
|
1820
|
+
NgxMatEntityTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityTableComponent, selector: "ngx-mat-entity-table", inputs: { tableData: "tableData" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }, { propertyName: "filter", first: true, predicate: ["filter"], descendants: true, static: true }], ngImport: i0, template: "<h1 class=\"title\">{{data.baseData.title}}</h1>\n\n<div class=\"row\">\n <mat-form-field class=\"col-lg-8 col-md-6 col-sm-12\">\n <mat-label>{{data.baseData.searchLabel}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-2]=\"data.baseData.allowCreate\"\n [class.col-lg-4]=\"!data.baseData.allowCreate\"\n [class.col-md-3]=\"data.baseData.allowCreate\"\n [class.col-md-6]=\"!data.baseData.allowCreate\"\n [class.col-sm-6]=\"data.baseData.allowCreate\"\n [class.col-sm-12]=\"!data.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{data.baseData.multiSelectLabel}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of data.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"data.baseData.allowCreate\"\n [class.col-lg-2]=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-4]=\"!data.baseData.multiSelectActions.length\"\n [class.col-md-3]=\"data.baseData.multiSelectActions.length\"\n [class.col-md-6]=\"!data.baseData.multiSelectActions.length\"\n [class.col-sm-6]=\"data.baseData.multiSelectActions.length\"\n [class.col-sm-12]=\"!data.baseData.multiSelectActions.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{data.baseData.createButtonLabel}}\n </button>\n </div>\n</div>\n\n<div class=\"mat-elevation-z8\">\n <mat-table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" matSort>\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"> </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngFor=\"let dCol of data.baseData.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" [class.enabled]=\"data.baseData.allowEdit(entity)\" (click)=\"editEntity(entity)\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n\n <mat-paginator *ngIf=\"dataSource\" id=\"paginator\" [length]=\"dataSource.filteredData.length\" [pageIndex]=\"0\" [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25, 50]\"> </mat-paginator>\n</div>\n", styles: [".title{text-align:center}button{width:100%}.mat-column-select{flex:0 0 75px}.enabled:hover{cursor:pointer}@media (max-width: 767px){.actions-button{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"] }] });
|
|
1353
1821
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableComponent, decorators: [{
|
|
1354
1822
|
type: Component,
|
|
1355
|
-
args: [{ selector: 'ngx-mat-entity-table', template: "<h1 class=\"title\">{{
|
|
1356
|
-
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.Injector }]; }, propDecorators: {
|
|
1823
|
+
args: [{ selector: 'ngx-mat-entity-table', template: "<h1 class=\"title\">{{data.baseData.title}}</h1>\n\n<div class=\"row\">\n <mat-form-field class=\"col-lg-8 col-md-6 col-sm-12\">\n <mat-label>{{data.baseData.searchLabel}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-2]=\"data.baseData.allowCreate\"\n [class.col-lg-4]=\"!data.baseData.allowCreate\"\n [class.col-md-3]=\"data.baseData.allowCreate\"\n [class.col-md-6]=\"!data.baseData.allowCreate\"\n [class.col-sm-6]=\"data.baseData.allowCreate\"\n [class.col-sm-12]=\"!data.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{data.baseData.multiSelectLabel}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of data.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"data.baseData.allowCreate\"\n [class.col-lg-2]=\"data.baseData.multiSelectActions.length\"\n [class.col-lg-4]=\"!data.baseData.multiSelectActions.length\"\n [class.col-md-3]=\"data.baseData.multiSelectActions.length\"\n [class.col-md-6]=\"!data.baseData.multiSelectActions.length\"\n [class.col-sm-6]=\"data.baseData.multiSelectActions.length\"\n [class.col-sm-12]=\"!data.baseData.multiSelectActions.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{data.baseData.createButtonLabel}}\n </button>\n </div>\n</div>\n\n<div class=\"mat-elevation-z8\">\n <mat-table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" matSort>\n <!-- select Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let module\" class=\"module\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(module) : null\" [checked]=\"selection.isSelected(module)\"> </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngFor=\"let dCol of data.baseData.displayColumns\" [matColumnDef]=\"dCol.displayName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n {{dCol.displayName}}\n </mat-header-cell>\n <mat-cell class=\"entity\" [class.enabled]=\"data.baseData.allowEdit(entity)\" (click)=\"editEntity(entity)\" *matCellDef=\"let entity\">\n {{dCol.value(entity)}}\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n\n <mat-paginator *ngIf=\"dataSource\" id=\"paginator\" [length]=\"dataSource.filteredData.length\" [pageIndex]=\"0\" [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25, 50]\"> </mat-paginator>\n</div>\n", styles: [".title{text-align:center}button{width:100%}.mat-column-select{flex:0 0 75px}.enabled:hover{cursor:pointer}@media (max-width: 767px){.actions-button{margin-bottom:15px}}@media (max-width: 575px){.create-button{margin-bottom:15px}}\n"] }]
|
|
1824
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.Injector }]; }, propDecorators: { tableData: [{
|
|
1357
1825
|
type: Input
|
|
1358
1826
|
}], paginator: [{
|
|
1359
1827
|
type: ViewChild,
|
|
@@ -1411,161 +1879,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1411
1879
|
}]
|
|
1412
1880
|
}] });
|
|
1413
1881
|
|
|
1414
|
-
class NgxMatEntityInternalInputModule {
|
|
1415
|
-
}
|
|
1416
|
-
NgxMatEntityInternalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1417
|
-
NgxMatEntityInternalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, declarations: [NgxMatEntityInternalInputComponent], imports: [CommonModule,
|
|
1418
|
-
MatInputModule,
|
|
1419
|
-
FormsModule,
|
|
1420
|
-
MatFormFieldModule,
|
|
1421
|
-
MatSelectModule,
|
|
1422
|
-
MatAutocompleteModule,
|
|
1423
|
-
MatCheckboxModule,
|
|
1424
|
-
MatSlideToggleModule,
|
|
1425
|
-
MatTableModule], exports: [NgxMatEntityInternalInputComponent] });
|
|
1426
|
-
NgxMatEntityInternalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, imports: [[
|
|
1427
|
-
CommonModule,
|
|
1428
|
-
MatInputModule,
|
|
1429
|
-
FormsModule,
|
|
1430
|
-
MatFormFieldModule,
|
|
1431
|
-
MatSelectModule,
|
|
1432
|
-
MatAutocompleteModule,
|
|
1433
|
-
MatCheckboxModule,
|
|
1434
|
-
MatSlideToggleModule,
|
|
1435
|
-
MatTableModule
|
|
1436
|
-
]] });
|
|
1437
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputModule, decorators: [{
|
|
1438
|
-
type: NgModule,
|
|
1439
|
-
args: [{
|
|
1440
|
-
declarations: [NgxMatEntityInternalInputComponent],
|
|
1441
|
-
imports: [
|
|
1442
|
-
CommonModule,
|
|
1443
|
-
MatInputModule,
|
|
1444
|
-
FormsModule,
|
|
1445
|
-
MatFormFieldModule,
|
|
1446
|
-
MatSelectModule,
|
|
1447
|
-
MatAutocompleteModule,
|
|
1448
|
-
MatCheckboxModule,
|
|
1449
|
-
MatSlideToggleModule,
|
|
1450
|
-
MatTableModule
|
|
1451
|
-
],
|
|
1452
|
-
exports: [NgxMatEntityInternalInputComponent]
|
|
1453
|
-
}]
|
|
1454
|
-
}] });
|
|
1455
|
-
|
|
1456
|
-
class NgxMatEntityAddArrayItemDialogModule {
|
|
1457
|
-
}
|
|
1458
|
-
NgxMatEntityAddArrayItemDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1459
|
-
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] });
|
|
1460
|
-
NgxMatEntityAddArrayItemDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, imports: [[CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1461
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogModule, decorators: [{
|
|
1462
|
-
type: NgModule,
|
|
1463
|
-
args: [{
|
|
1464
|
-
declarations: [NgxMatEntityAddArrayItemDialogComponent],
|
|
1465
|
-
imports: [CommonModule, NgxMatEntityInternalInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1466
|
-
exports: [NgxMatEntityAddArrayItemDialogComponent]
|
|
1467
|
-
}]
|
|
1468
|
-
}] });
|
|
1469
|
-
|
|
1470
|
-
class NgxMatEntityArrayTableModule {
|
|
1471
|
-
}
|
|
1472
|
-
NgxMatEntityArrayTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1473
|
-
NgxMatEntityArrayTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, declarations: [NgxMatEntityArrayTableComponent], imports: [CommonModule,
|
|
1474
|
-
MatInputModule,
|
|
1475
|
-
FormsModule,
|
|
1476
|
-
MatFormFieldModule,
|
|
1477
|
-
MatSelectModule,
|
|
1478
|
-
MatAutocompleteModule,
|
|
1479
|
-
MatCheckboxModule,
|
|
1480
|
-
MatSlideToggleModule,
|
|
1481
|
-
MatTableModule,
|
|
1482
|
-
NgxMatEntityInternalInputModule,
|
|
1483
|
-
MatButtonModule,
|
|
1484
|
-
NgxMatEntityAddArrayItemDialogModule], exports: [NgxMatEntityArrayTableComponent] });
|
|
1485
|
-
NgxMatEntityArrayTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, imports: [[
|
|
1486
|
-
CommonModule,
|
|
1487
|
-
MatInputModule,
|
|
1488
|
-
FormsModule,
|
|
1489
|
-
MatFormFieldModule,
|
|
1490
|
-
MatSelectModule,
|
|
1491
|
-
MatAutocompleteModule,
|
|
1492
|
-
MatCheckboxModule,
|
|
1493
|
-
MatSlideToggleModule,
|
|
1494
|
-
MatTableModule,
|
|
1495
|
-
NgxMatEntityInternalInputModule,
|
|
1496
|
-
MatButtonModule,
|
|
1497
|
-
NgxMatEntityAddArrayItemDialogModule
|
|
1498
|
-
]] });
|
|
1499
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableModule, decorators: [{
|
|
1500
|
-
type: NgModule,
|
|
1501
|
-
args: [{
|
|
1502
|
-
declarations: [NgxMatEntityArrayTableComponent],
|
|
1503
|
-
imports: [
|
|
1504
|
-
CommonModule,
|
|
1505
|
-
MatInputModule,
|
|
1506
|
-
FormsModule,
|
|
1507
|
-
MatFormFieldModule,
|
|
1508
|
-
MatSelectModule,
|
|
1509
|
-
MatAutocompleteModule,
|
|
1510
|
-
MatCheckboxModule,
|
|
1511
|
-
MatSlideToggleModule,
|
|
1512
|
-
MatTableModule,
|
|
1513
|
-
NgxMatEntityInternalInputModule,
|
|
1514
|
-
MatButtonModule,
|
|
1515
|
-
NgxMatEntityAddArrayItemDialogModule
|
|
1516
|
-
],
|
|
1517
|
-
exports: [NgxMatEntityArrayTableComponent]
|
|
1518
|
-
}]
|
|
1519
|
-
}] });
|
|
1520
|
-
|
|
1521
|
-
class NgxMatEntityInputModule {
|
|
1522
|
-
}
|
|
1523
|
-
NgxMatEntityInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1524
|
-
NgxMatEntityInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, declarations: [NgxMatEntityInputComponent], imports: [CommonModule,
|
|
1525
|
-
MatInputModule,
|
|
1526
|
-
FormsModule,
|
|
1527
|
-
MatFormFieldModule,
|
|
1528
|
-
MatSelectModule,
|
|
1529
|
-
MatAutocompleteModule,
|
|
1530
|
-
MatCheckboxModule,
|
|
1531
|
-
MatSlideToggleModule,
|
|
1532
|
-
NgxMatEntityArrayTableModule,
|
|
1533
|
-
MatChipsModule,
|
|
1534
|
-
MatIconModule], exports: [NgxMatEntityInputComponent] });
|
|
1535
|
-
NgxMatEntityInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, imports: [[
|
|
1536
|
-
CommonModule,
|
|
1537
|
-
MatInputModule,
|
|
1538
|
-
FormsModule,
|
|
1539
|
-
MatFormFieldModule,
|
|
1540
|
-
MatSelectModule,
|
|
1541
|
-
MatAutocompleteModule,
|
|
1542
|
-
MatCheckboxModule,
|
|
1543
|
-
MatSlideToggleModule,
|
|
1544
|
-
NgxMatEntityArrayTableModule,
|
|
1545
|
-
MatChipsModule,
|
|
1546
|
-
MatIconModule
|
|
1547
|
-
]] });
|
|
1548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputModule, decorators: [{
|
|
1549
|
-
type: NgModule,
|
|
1550
|
-
args: [{
|
|
1551
|
-
declarations: [NgxMatEntityInputComponent],
|
|
1552
|
-
imports: [
|
|
1553
|
-
CommonModule,
|
|
1554
|
-
MatInputModule,
|
|
1555
|
-
FormsModule,
|
|
1556
|
-
MatFormFieldModule,
|
|
1557
|
-
MatSelectModule,
|
|
1558
|
-
MatAutocompleteModule,
|
|
1559
|
-
MatCheckboxModule,
|
|
1560
|
-
MatSlideToggleModule,
|
|
1561
|
-
NgxMatEntityArrayTableModule,
|
|
1562
|
-
MatChipsModule,
|
|
1563
|
-
MatIconModule
|
|
1564
|
-
],
|
|
1565
|
-
exports: [NgxMatEntityInputComponent]
|
|
1566
|
-
}]
|
|
1567
|
-
}] });
|
|
1568
|
-
|
|
1569
1882
|
class NgxMatEntityCreateDialogModule {
|
|
1570
1883
|
}
|
|
1571
1884
|
NgxMatEntityCreateDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1613,174 +1926,197 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1613
1926
|
}]
|
|
1614
1927
|
}] });
|
|
1615
1928
|
|
|
1929
|
+
class EntityArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1930
|
+
constructor(data) {
|
|
1931
|
+
super(data);
|
|
1932
|
+
this.createDialogData = data.createDialogData;
|
|
1933
|
+
this.displayStyle = data.displayStyle;
|
|
1934
|
+
this.itemType = data.itemType;
|
|
1935
|
+
this.EntityClass = data.EntityClass;
|
|
1936
|
+
this.displayColumns = data.displayColumns;
|
|
1937
|
+
this.createInline = data.createInline != undefined ? data.createInline : true;
|
|
1938
|
+
this.missingErrorMessage = data.missingErrorMessage ? data.missingErrorMessage : 'Needs to contain at least one value';
|
|
1939
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [12, 12, 12];
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
class StringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1943
|
+
constructor(data) {
|
|
1944
|
+
super(data);
|
|
1945
|
+
this.deleteHtml = data.deleteHtml;
|
|
1946
|
+
this.displayStyle = data.displayStyle;
|
|
1947
|
+
this.itemType = data.itemType;
|
|
1948
|
+
this.maxLength = data.maxLength;
|
|
1949
|
+
this.minLength = data.minLength;
|
|
1950
|
+
this.regex = data.regex;
|
|
1951
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 12, 12];
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
class AutocompleteStringChipsArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1955
|
+
constructor(data) {
|
|
1956
|
+
super(data);
|
|
1957
|
+
this.autocompleteValues = data.autocompleteValues;
|
|
1958
|
+
this.deleteHtml = data.deleteHtml;
|
|
1959
|
+
this.displayStyle = data.displayStyle;
|
|
1960
|
+
this.itemType = data.itemType;
|
|
1961
|
+
this.maxLength = data.maxLength;
|
|
1962
|
+
this.minLength = data.minLength;
|
|
1963
|
+
this.regex = data.regex;
|
|
1964
|
+
this.defaultWidths = data.defaultWidths ? data.defaultWidths : [6, 12, 12];
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1616
1968
|
/**
|
|
1617
|
-
* Decorator for setting and getting array propery metadata
|
|
1618
|
-
*
|
|
1969
|
+
* Decorator for setting and getting array propery metadata.
|
|
1970
|
+
*
|
|
1971
|
+
* @param metadata - The metadata of the array property.
|
|
1972
|
+
* @returns The method that defines the metadata.
|
|
1973
|
+
* @throws When the given type of the array-items is unknown.
|
|
1619
1974
|
*/
|
|
1620
1975
|
function array(metadata) {
|
|
1621
1976
|
switch (metadata.itemType) {
|
|
1622
1977
|
case DecoratorTypes.OBJECT:
|
|
1623
|
-
return baseProperty(new
|
|
1978
|
+
return baseProperty(new EntityArrayDecoratorConfigInternal(metadata), DecoratorTypes.ARRAY);
|
|
1624
1979
|
case DecoratorTypes.STRING:
|
|
1625
|
-
return baseProperty(new
|
|
1980
|
+
return baseProperty(new StringChipsArrayDecoratorConfigInternal(metadata), DecoratorTypes.ARRAY_STRING_CHIPS);
|
|
1626
1981
|
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
1627
|
-
return baseProperty(new
|
|
1982
|
+
return baseProperty(new AutocompleteStringChipsArrayDecoratorConfigInternal(metadata), DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS);
|
|
1628
1983
|
default:
|
|
1629
1984
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1630
1985
|
throw new Error(`Unknown itemType ${metadata.itemType}`);
|
|
1631
1986
|
}
|
|
1632
1987
|
}
|
|
1988
|
+
|
|
1633
1989
|
/**
|
|
1634
|
-
*
|
|
1990
|
+
* The base options for all propertyDecorators.
|
|
1635
1991
|
*/
|
|
1636
|
-
class
|
|
1992
|
+
class PropertyDecoratorConfig {
|
|
1637
1993
|
}
|
|
1994
|
+
|
|
1638
1995
|
/**
|
|
1639
|
-
*
|
|
1996
|
+
* Interface definition for the @array metadata.
|
|
1640
1997
|
*/
|
|
1641
|
-
class
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
this.
|
|
1648
|
-
this.
|
|
1649
|
-
this.
|
|
1650
|
-
this.displayColumns = metadata.displayColumns;
|
|
1998
|
+
class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
class DropdownBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2002
|
+
constructor(data) {
|
|
2003
|
+
super(data);
|
|
2004
|
+
this.displayStyle = data.displayStyle;
|
|
2005
|
+
this.dropdownTrue = data.dropdownTrue;
|
|
2006
|
+
this.dropdownFalse = data.dropdownFalse;
|
|
1651
2007
|
}
|
|
1652
2008
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
constructor(metadata) {
|
|
1658
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1659
|
-
this.itemType = metadata.itemType;
|
|
1660
|
-
this.displayStyle = metadata.displayStyle;
|
|
1661
|
-
this.deleteHtml = metadata.deleteHtml;
|
|
1662
|
-
this.minLength = metadata.minLength;
|
|
1663
|
-
this.maxLength = metadata.maxLength;
|
|
1664
|
-
this.regex = metadata.regex;
|
|
2009
|
+
class CheckboxBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2010
|
+
constructor(data) {
|
|
2011
|
+
super(data);
|
|
2012
|
+
this.displayStyle = data.displayStyle;
|
|
1665
2013
|
}
|
|
1666
2014
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
constructor(metadata) {
|
|
1672
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1673
|
-
this.itemType = metadata.itemType;
|
|
1674
|
-
this.displayStyle = metadata.displayStyle;
|
|
1675
|
-
this.deleteHtml = metadata.deleteHtml;
|
|
1676
|
-
this.autocompleteValues = metadata.autocompleteValues;
|
|
1677
|
-
this.minLength = metadata.minLength;
|
|
1678
|
-
this.maxLength = metadata.maxLength;
|
|
1679
|
-
this.regex = metadata.regex;
|
|
2015
|
+
class ToggleBooleanDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2016
|
+
constructor(data) {
|
|
2017
|
+
super(data);
|
|
2018
|
+
this.displayStyle = data.displayStyle;
|
|
1680
2019
|
}
|
|
1681
2020
|
}
|
|
1682
2021
|
|
|
1683
2022
|
/**
|
|
1684
|
-
* Decorator for setting and getting
|
|
1685
|
-
*
|
|
2023
|
+
* Decorator for setting and getting boolean propery metadata.
|
|
2024
|
+
*
|
|
2025
|
+
* @param metadata - The metadata of the boolean property.
|
|
2026
|
+
* @returns The method that defines the metadata.
|
|
1686
2027
|
*/
|
|
1687
2028
|
function boolean(metadata) {
|
|
1688
2029
|
if (metadata.displayStyle === 'dropdown') {
|
|
1689
|
-
return baseProperty(new
|
|
2030
|
+
return baseProperty(new DropdownBooleanDecoratorConfigInternal(metadata), DecoratorTypes.BOOLEAN_DROPDOWN);
|
|
1690
2031
|
}
|
|
1691
2032
|
else if (metadata.displayStyle === 'checkbox') {
|
|
1692
|
-
return baseProperty(new
|
|
2033
|
+
return baseProperty(new CheckboxBooleanDecoratorConfigInternal(metadata), DecoratorTypes.BOOLEAN_CHECKBOX);
|
|
1693
2034
|
}
|
|
1694
2035
|
else {
|
|
1695
|
-
return baseProperty(new
|
|
2036
|
+
return baseProperty(new ToggleBooleanDecoratorConfigInternal(metadata), DecoratorTypes.BOOLEAN_TOGGLE);
|
|
1696
2037
|
}
|
|
1697
2038
|
}
|
|
2039
|
+
|
|
1698
2040
|
/**
|
|
1699
|
-
* The Definition for the @boolean metadata
|
|
2041
|
+
* The Definition for the @boolean metadata.
|
|
1700
2042
|
*/
|
|
1701
2043
|
class BooleanDecoratorConfig extends PropertyDecoratorConfig {
|
|
1702
2044
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
this.
|
|
1708
|
-
this.
|
|
1709
|
-
|
|
1710
|
-
}
|
|
1711
|
-
class CheckboxBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
1712
|
-
constructor(metadata) {
|
|
1713
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1714
|
-
this.displayStyle = metadata.displayStyle;
|
|
2045
|
+
|
|
2046
|
+
class DefaultNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2047
|
+
constructor(data) {
|
|
2048
|
+
super(data);
|
|
2049
|
+
this.displayStyle = data.displayStyle;
|
|
2050
|
+
this.max = data.max;
|
|
2051
|
+
this.min = data.min;
|
|
1715
2052
|
}
|
|
1716
2053
|
}
|
|
1717
|
-
class
|
|
1718
|
-
constructor(
|
|
1719
|
-
super(
|
|
1720
|
-
this.displayStyle =
|
|
2054
|
+
class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2055
|
+
constructor(data) {
|
|
2056
|
+
super(data);
|
|
2057
|
+
this.displayStyle = data.displayStyle;
|
|
2058
|
+
this.dropdownValues = data.dropdownValues;
|
|
1721
2059
|
}
|
|
1722
2060
|
}
|
|
1723
2061
|
|
|
1724
2062
|
/**
|
|
1725
|
-
* Decorator for setting and getting string propery metadata
|
|
1726
|
-
*
|
|
2063
|
+
* Decorator for setting and getting string propery metadata.
|
|
2064
|
+
*
|
|
2065
|
+
* @param metadata - The metadata of the string property.
|
|
2066
|
+
* @returns The method that defines the metadata.
|
|
1727
2067
|
*/
|
|
1728
2068
|
function number(metadata) {
|
|
1729
2069
|
if (metadata.displayStyle === 'dropdown') {
|
|
1730
|
-
return baseProperty(new
|
|
2070
|
+
return baseProperty(new DropdownNumberDecoratorConfigInternal(metadata), DecoratorTypes.NUMBER_DROPDOWN);
|
|
1731
2071
|
}
|
|
1732
2072
|
else {
|
|
1733
|
-
return baseProperty(new
|
|
2073
|
+
return baseProperty(new DefaultNumberDecoratorConfigInternal(metadata), DecoratorTypes.NUMBER);
|
|
1734
2074
|
}
|
|
1735
2075
|
}
|
|
2076
|
+
|
|
1736
2077
|
/**
|
|
1737
|
-
*
|
|
2078
|
+
* Definition for the @number metadata.
|
|
1738
2079
|
*/
|
|
1739
2080
|
class NumberDecoratorConfig extends PropertyDecoratorConfig {
|
|
1740
2081
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
this.
|
|
1746
|
-
this.
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
class DropdownNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
1750
|
-
constructor(metadata) {
|
|
1751
|
-
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1752
|
-
this.displayStyle = metadata.displayStyle;
|
|
1753
|
-
this.dropdownValues = metadata.dropdownValues;
|
|
2082
|
+
|
|
2083
|
+
class DefaultObjectDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
2084
|
+
constructor(data) {
|
|
2085
|
+
super(data);
|
|
2086
|
+
this.displayStyle = data.displayStyle;
|
|
2087
|
+
this.type = data.type;
|
|
1754
2088
|
}
|
|
1755
2089
|
}
|
|
1756
2090
|
|
|
1757
2091
|
/**
|
|
1758
2092
|
* Decorator for setting and getting object propery metadata.
|
|
1759
|
-
*
|
|
2093
|
+
*
|
|
2094
|
+
* @param metadata - The metadata of the object property.
|
|
2095
|
+
* @returns The method that defines the metadata.
|
|
1760
2096
|
*/
|
|
1761
2097
|
function object(metadata) {
|
|
1762
|
-
return baseProperty(new
|
|
2098
|
+
return baseProperty(new DefaultObjectDecoratorConfigInternal(metadata), DecoratorTypes.OBJECT);
|
|
1763
2099
|
}
|
|
2100
|
+
|
|
1764
2101
|
/**
|
|
1765
|
-
*
|
|
2102
|
+
* Definition for the @object metadata.
|
|
1766
2103
|
*/
|
|
1767
2104
|
class ObjectDecoratorConfig extends PropertyDecoratorConfig {
|
|
1768
2105
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
}
|
|
2106
|
+
|
|
2107
|
+
/**
|
|
2108
|
+
* Definition for the @string metadata.
|
|
2109
|
+
*/
|
|
2110
|
+
class StringDecoratorConfig extends PropertyDecoratorConfig {
|
|
1775
2111
|
}
|
|
1776
2112
|
|
|
1777
|
-
|
|
1778
|
-
* Public API Surface of ngx-material-entity
|
|
2113
|
+
/**
|
|
2114
|
+
* Public API Surface of ngx-material-entity.
|
|
1779
2115
|
*/
|
|
1780
2116
|
|
|
1781
2117
|
/**
|
|
1782
2118
|
* Generated bundle index. Do not edit.
|
|
1783
2119
|
*/
|
|
1784
2120
|
|
|
1785
|
-
export {
|
|
2121
|
+
export { DecoratorTypes, Entity, EntityService, EntityUtilities, NgxMatEntityConfirmDialogComponent, NgxMatEntityConfirmDialogModule, NgxMatEntityCreateDialogComponent, NgxMatEntityCreateDialogModule, NgxMatEntityEditDialogComponent, NgxMatEntityEditDialogModule, NgxMatEntityInputComponent, NgxMatEntityInputModule, NgxMatEntityTableComponent, NgxMatEntityTableModule, array, boolean, getValidationErrorMessage, number, object, string };
|
|
1786
2122
|
//# sourceMappingURL=ngx-material-entity.mjs.map
|