ngx-material-entity 0.1.0
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 +93 -0
- package/LICENSE.md +21 -0
- package/README.md +691 -0
- package/classes/entity-model.class.d.ts +9 -0
- package/classes/entity-service.class.d.ts +56 -0
- package/classes/entity-utilities.class.d.ts +95 -0
- package/components/confirm-dialog/confirm-dialog-data.d.ts +41 -0
- package/components/confirm-dialog/confirm-dialog.component.d.ts +18 -0
- package/components/confirm-dialog/confirm-dialog.module.d.ts +12 -0
- package/components/get-validation-error-message.function.d.ts +7 -0
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +35 -0
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.d.ts +12 -0
- package/components/input/array-table/array-table.component.d.ts +34 -0
- package/components/input/array-table/array-table.module.d.ts +19 -0
- package/components/input/input.component.d.ts +73 -0
- package/components/input/input.module.d.ts +18 -0
- package/components/input/internal-input/internal-input.component.d.ts +57 -0
- package/components/input/internal-input/internal-input.module.d.ts +16 -0
- package/components/table/create-dialog/create-entity-dialog-data.d.ts +21 -0
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +25 -0
- package/components/table/create-dialog/create-entity-dialog.module.d.ts +12 -0
- package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +25 -0
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +28 -0
- package/components/table/edit-dialog/edit-entity-dialog.module.d.ts +13 -0
- package/components/table/table-data.d.ts +184 -0
- package/components/table/table.component.d.ts +41 -0
- package/components/table/table.module.d.ts +17 -0
- package/decorators/array.decorator.d.ts +125 -0
- package/decorators/base/base-property.decorator.d.ts +9 -0
- package/decorators/base/decorator-types.enum.d.ts +28 -0
- package/decorators/base/property-decorator-config.interface.d.ts +50 -0
- package/decorators/boolean.decorator.d.ts +42 -0
- package/decorators/number.decorator.d.ts +40 -0
- package/decorators/object.decorator.d.ts +27 -0
- package/decorators/string.decorator.d.ts +76 -0
- package/esm2020/classes/entity-model.class.mjs +19 -0
- package/esm2020/classes/entity-service.class.mjs +70 -0
- package/esm2020/classes/entity-utilities.class.mjs +296 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +2 -0
- package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +51 -0
- package/esm2020/components/confirm-dialog/confirm-dialog.module.mjs +22 -0
- package/esm2020/components/get-validation-error-message.function.mjs +32 -0
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +43 -0
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.mjs +22 -0
- package/esm2020/components/input/array-table/array-table.component.mjs +116 -0
- package/esm2020/components/input/array-table/array-table.module.mjs +66 -0
- package/esm2020/components/input/input.component.mjs +158 -0
- package/esm2020/components/input/input.module.mjs +62 -0
- package/esm2020/components/input/internal-input/internal-input.component.mjs +73 -0
- package/esm2020/components/input/internal-input/internal-input.module.mjs +54 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +2 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +77 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +22 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +2 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +112 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.module.mjs +42 -0
- package/esm2020/components/table/table-data.mjs +2 -0
- package/esm2020/components/table/table.component.mjs +232 -0
- package/esm2020/components/table/table.module.mjs +58 -0
- package/esm2020/decorators/array.decorator.mjs +70 -0
- package/esm2020/decorators/base/base-property.decorator.mjs +13 -0
- package/esm2020/decorators/base/decorator-types.enum.mjs +20 -0
- package/esm2020/decorators/base/property-decorator-config.interface.mjs +31 -0
- package/esm2020/decorators/boolean.decorator.mjs +44 -0
- package/esm2020/decorators/number.decorator.mjs +36 -0
- package/esm2020/decorators/object.decorator.mjs +23 -0
- package/esm2020/decorators/string.decorator.mjs +61 -0
- package/esm2020/ngx-material-entity.mjs +5 -0
- package/esm2020/public-api.mjs +32 -0
- package/fesm2015/ngx-material-entity.mjs +1786 -0
- package/fesm2015/ngx-material-entity.mjs.map +1 -0
- package/fesm2020/ngx-material-entity.mjs +1760 -0
- package/fesm2020/ngx-material-entity.mjs.map +1 -0
- package/ngx-material-entity.d.ts +5 -0
- package/package.json +40 -0
- package/public-api.d.ts +25 -0
|
@@ -0,0 +1,1786 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
3
|
+
import { BehaviorSubject, firstValueFrom, Subject, takeUntil } from 'rxjs';
|
|
4
|
+
import { isEqual, omit, omitBy, isNil, cloneDeep } from 'lodash';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { Component, Inject, NgModule, Input, ViewChild } from '@angular/core';
|
|
7
|
+
import * as i1 from '@angular/material/dialog';
|
|
8
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
9
|
+
import * as i5 from '@angular/material/checkbox';
|
|
10
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
11
|
+
import * as i3 from '@angular/material/button';
|
|
12
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
+
import * as i7 from '@angular/common';
|
|
14
|
+
import { CommonModule } from '@angular/common';
|
|
15
|
+
import * as i12 from '@angular/forms';
|
|
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
|
+
import * as i1$1 from '@angular/material/form-field';
|
|
24
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
25
|
+
import * as i2 from '@angular/material/autocomplete';
|
|
26
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
27
|
+
import * as i3$1 from '@angular/material/core';
|
|
28
|
+
import * as i4 from '@angular/material/select';
|
|
29
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
30
|
+
import * as i6 from '@angular/material/slide-toggle';
|
|
31
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
32
|
+
import * as i8 from '@angular/material/input';
|
|
33
|
+
import { MatInputModule } from '@angular/material/input';
|
|
34
|
+
import * as i10 from '@angular/cdk/text-field';
|
|
35
|
+
import * as i8$1 from '@angular/material/chips';
|
|
36
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
37
|
+
import * as i9 from '@angular/material/icon';
|
|
38
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
39
|
+
import * as i4$2 from '@angular/material/menu';
|
|
40
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The base options for all propertyDecorators
|
|
44
|
+
*/
|
|
45
|
+
class PropertyDecoratorConfig {
|
|
46
|
+
/**
|
|
47
|
+
* Defines, Whether or not there should be a line break after this input.
|
|
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
|
|
78
|
+
*/
|
|
79
|
+
function baseProperty(metadata, type) {
|
|
80
|
+
return function (target, propertyKey) {
|
|
81
|
+
Reflect.defineMetadata('metadata', metadata, target, propertyKey);
|
|
82
|
+
Reflect.defineMetadata('type', type, target, propertyKey);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The enum Values for all the different DecoratorTypes.
|
|
88
|
+
*/
|
|
89
|
+
var DecoratorTypes;
|
|
90
|
+
(function (DecoratorTypes) {
|
|
91
|
+
DecoratorTypes["STRING"] = "string";
|
|
92
|
+
DecoratorTypes["STRING_DROPDOWN"] = "stringDropdown";
|
|
93
|
+
DecoratorTypes["STRING_AUTOCOMPLETE"] = "stringAutocomplete";
|
|
94
|
+
DecoratorTypes["STRING_TEXTBOX"] = "stringTextbox";
|
|
95
|
+
DecoratorTypes["NUMBER"] = "number";
|
|
96
|
+
DecoratorTypes["NUMBER_DROPDOWN"] = "numberDropdown";
|
|
97
|
+
DecoratorTypes["BOOLEAN_CHECKBOX"] = "boolean";
|
|
98
|
+
DecoratorTypes["BOOLEAN_TOGGLE"] = "booleanToggle";
|
|
99
|
+
DecoratorTypes["BOOLEAN_DROPDOWN"] = "booleanDropdown";
|
|
100
|
+
DecoratorTypes["OBJECT"] = "object";
|
|
101
|
+
DecoratorTypes["ARRAY"] = "array";
|
|
102
|
+
DecoratorTypes["ARRAY_STRING_CHIPS"] = "arrayStringChips";
|
|
103
|
+
DecoratorTypes["ARRAY_STRING_AUTOCOMPLETE_CHIPS"] = "arrayStringAutocompleteChips";
|
|
104
|
+
})(DecoratorTypes || (DecoratorTypes = {}));
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Decorator for setting and getting string propery metadata
|
|
108
|
+
* @param metadata The metadata of the string property
|
|
109
|
+
*/
|
|
110
|
+
function string(metadata) {
|
|
111
|
+
if (metadata.displayStyle === 'dropdown') {
|
|
112
|
+
return baseProperty(new DropdownStringDecoratorConfig(metadata), DecoratorTypes.STRING_DROPDOWN);
|
|
113
|
+
}
|
|
114
|
+
else if (metadata.displayStyle === 'autocomplete') {
|
|
115
|
+
return baseProperty(new AutocompleteStringDecoratorConfig(metadata), DecoratorTypes.STRING_AUTOCOMPLETE);
|
|
116
|
+
}
|
|
117
|
+
else if (metadata.displayStyle === 'textbox') {
|
|
118
|
+
return baseProperty(new TextboxStringDecoratorConfig(metadata), DecoratorTypes.STRING_TEXTBOX);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return baseProperty(new DefaultStringDecoratorConfig(metadata), DecoratorTypes.STRING);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Interface definition for the @string metadata
|
|
126
|
+
*/
|
|
127
|
+
class StringDecoratorConfig extends PropertyDecoratorConfig {
|
|
128
|
+
}
|
|
129
|
+
class DropdownStringDecoratorConfig extends StringDecoratorConfig {
|
|
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;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
class DefaultStringDecoratorConfig extends StringDecoratorConfig {
|
|
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;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
class TextboxStringDecoratorConfig extends StringDecoratorConfig {
|
|
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;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
class AutocompleteStringDecoratorConfig extends StringDecoratorConfig {
|
|
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;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The base Entity class.
|
|
166
|
+
*/
|
|
167
|
+
class Entity {
|
|
168
|
+
}
|
|
169
|
+
__decorate([
|
|
170
|
+
string({
|
|
171
|
+
omitForCreate: true,
|
|
172
|
+
omitForUpdate: true,
|
|
173
|
+
display: false,
|
|
174
|
+
displayStyle: 'line',
|
|
175
|
+
displayName: 'ID',
|
|
176
|
+
required: true
|
|
177
|
+
}),
|
|
178
|
+
__metadata("design:type", String)
|
|
179
|
+
], Entity.prototype, "id", void 0);
|
|
180
|
+
|
|
181
|
+
var _a;
|
|
182
|
+
/**
|
|
183
|
+
* Contains HelperMethods around handling Entities and their property-metadata
|
|
184
|
+
*/
|
|
185
|
+
class EntityUtilities {
|
|
186
|
+
/**
|
|
187
|
+
* Gets the properties to omit when updating the entity
|
|
188
|
+
* @returns The properties which should be left out for updating a new Entity
|
|
189
|
+
*/
|
|
190
|
+
static getOmitForUpdate(entity) {
|
|
191
|
+
const res = [];
|
|
192
|
+
for (const key of Reflect.ownKeys(entity)) {
|
|
193
|
+
const metadata = Reflect.getMetadata('metadata', entity, key);
|
|
194
|
+
if (metadata.omitForUpdate) {
|
|
195
|
+
res.push(key);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return res;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Gets the properties to omit when creating new entities
|
|
202
|
+
* @returns The properties which should be left out for creating a new Entity
|
|
203
|
+
*/
|
|
204
|
+
static getOmitForCreate(entity) {
|
|
205
|
+
const res = [];
|
|
206
|
+
for (const key of Reflect.ownKeys(entity)) {
|
|
207
|
+
const metadata = Reflect.getMetadata('metadata', entity, key);
|
|
208
|
+
if (metadata.omitForCreate) {
|
|
209
|
+
res.push(key);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return res;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Gets the metadata included in an property
|
|
216
|
+
* @param entity The entity with the property to get the metadata from
|
|
217
|
+
* @param propertyKey The property on the given Entity to get the metadata from
|
|
218
|
+
* @param type For secure Typing, defines the returned PropertyConfig
|
|
219
|
+
* @returns The metadata of the property
|
|
220
|
+
*/
|
|
221
|
+
static getPropertyMetadata(entity, propertyKey,
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
223
|
+
type) {
|
|
224
|
+
try {
|
|
225
|
+
const metadata = Reflect.getMetadata('metadata', entity, propertyKey);
|
|
226
|
+
if (!metadata) {
|
|
227
|
+
throw new Error(`Could not find metadata for property ${String(propertyKey)}
|
|
228
|
+
on the entity ${JSON.stringify(entity)}`);
|
|
229
|
+
}
|
|
230
|
+
return metadata;
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
throw new Error(`Could not find metadata for property ${String(propertyKey)}
|
|
234
|
+
on the entity ${JSON.stringify(entity)}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Gets the type of the property-metadata.
|
|
239
|
+
* @param entity The entity with the property to get the type from
|
|
240
|
+
* @param propertyKey The property on the given Entity to get the type from
|
|
241
|
+
* @returns The type of the metadata
|
|
242
|
+
*/
|
|
243
|
+
static getPropertyType(entity, propertyKey) {
|
|
244
|
+
try {
|
|
245
|
+
const propertyType = Reflect.getMetadata('type', entity, propertyKey);
|
|
246
|
+
if (!propertyType) {
|
|
247
|
+
throw new Error(`Could not find type metadata for property ${String(propertyKey)}
|
|
248
|
+
on the entity ${JSON.stringify(entity)}`);
|
|
249
|
+
}
|
|
250
|
+
return propertyType;
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
throw new Error(`Could not find type metadata for property ${String(propertyKey)}
|
|
254
|
+
on the entity ${JSON.stringify(entity)}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Sets all property values based on a given entity data-object.
|
|
259
|
+
* @param entity The data object to get the property values from.
|
|
260
|
+
* @param target
|
|
261
|
+
* the target object that needs to be constructed
|
|
262
|
+
* (if called inside a Entity constructor its usually this)
|
|
263
|
+
* @alias new
|
|
264
|
+
* @alias build
|
|
265
|
+
* @alias construct
|
|
266
|
+
*/
|
|
267
|
+
static new(target, entity) {
|
|
268
|
+
if (entity) {
|
|
269
|
+
for (const key in entity) {
|
|
270
|
+
Reflect.set(target, key, Reflect.get(entity, key));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Checks if the values on an entity are valid.
|
|
276
|
+
* Also checks all the validators given by the metadata ("required", "maxLength" etc.)
|
|
277
|
+
* @param entity The entity to validate.
|
|
278
|
+
* @param omit Whether to check for creatiung or editing validity
|
|
279
|
+
* @returns Whether or not the entity is valid.
|
|
280
|
+
*/
|
|
281
|
+
static isEntityValid(entity, omit) {
|
|
282
|
+
for (const key in entity) {
|
|
283
|
+
if (!this.isPropertyValid(entity, key, omit)) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Checks if a single property value is valid
|
|
291
|
+
* @param entity The entity where the property is from
|
|
292
|
+
* @param key The name of the property
|
|
293
|
+
* @returns Whether or not the property value is valid
|
|
294
|
+
*/
|
|
295
|
+
static isPropertyValid(entity, key, omit) {
|
|
296
|
+
const type = this.getPropertyType(entity, key);
|
|
297
|
+
const metadata = this.getPropertyMetadata(entity, key, type);
|
|
298
|
+
const metadataDefaultString = metadata;
|
|
299
|
+
const metadataTextboxString = metadata;
|
|
300
|
+
const metadataAutocompleteString = metadata;
|
|
301
|
+
const metadataDefaultNumber = metadata;
|
|
302
|
+
const objectProperty = entity[key];
|
|
303
|
+
const metadataEntityArray = metadata;
|
|
304
|
+
const arrayItems = entity[key];
|
|
305
|
+
if (metadata.omitForCreate && omit === 'create') {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
if (metadata.omitForUpdate && omit === 'edit') {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
if (metadata.required && !entity[key]) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
switch (type) {
|
|
315
|
+
case DecoratorTypes.STRING:
|
|
316
|
+
if (metadataDefaultString.maxLength
|
|
317
|
+
&& entity[key].length > metadataDefaultString.maxLength) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
if (metadataDefaultString.minLength
|
|
321
|
+
&& entity[key].length < metadataDefaultString.minLength) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (metadataDefaultString.regex
|
|
325
|
+
&& !entity[key].match(metadataDefaultString.regex)) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
break;
|
|
329
|
+
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
330
|
+
if (metadataAutocompleteString.maxLength
|
|
331
|
+
&& entity[key].length > metadataAutocompleteString.maxLength) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
if (metadataAutocompleteString.minLength
|
|
335
|
+
&& entity[key].length < metadataAutocompleteString.minLength) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
if (metadataAutocompleteString.regex
|
|
339
|
+
&& entity[key].match(metadataAutocompleteString.regex)) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
case DecoratorTypes.STRING_TEXTBOX:
|
|
344
|
+
if (metadataTextboxString.maxLength
|
|
345
|
+
&& entity[key].length > metadataTextboxString.maxLength) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
if (metadataTextboxString.minLength
|
|
349
|
+
&& entity[key].length < metadataTextboxString.minLength) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
break;
|
|
353
|
+
case DecoratorTypes.NUMBER:
|
|
354
|
+
if (metadataDefaultNumber.max && entity[key] > metadataDefaultNumber.max) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
if (metadataDefaultNumber.min && entity[key] > metadataDefaultNumber.min) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
break;
|
|
361
|
+
case DecoratorTypes.OBJECT:
|
|
362
|
+
for (const parameterKey in objectProperty) {
|
|
363
|
+
if (!this.isPropertyValid(objectProperty, parameterKey, omit)) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
case DecoratorTypes.ARRAY_STRING_CHIPS:
|
|
369
|
+
case DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS:
|
|
370
|
+
case DecoratorTypes.ARRAY:
|
|
371
|
+
if (metadataEntityArray.required && !arrayItems.length) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
break;
|
|
375
|
+
default:
|
|
376
|
+
throw new Error(`Could not validate the input because the DecoratorType ${type} is not known`);
|
|
377
|
+
}
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Checks if an entity is "dirty" (if its values have changed)
|
|
382
|
+
* @param entity The entity after all changes
|
|
383
|
+
* @param entityPriorChanges The entity before the changes
|
|
384
|
+
* @returns Whether or not the entity is dirty
|
|
385
|
+
*/
|
|
386
|
+
static dirty(entity, entityPriorChanges) {
|
|
387
|
+
if (!entityPriorChanges) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
const diff = this.difference(entity, entityPriorChanges);
|
|
392
|
+
if (JSON.stringify(diff) === '{}') {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Compares two Entities and returns their difference in an object
|
|
402
|
+
* @param entity The first entity to compare
|
|
403
|
+
* @param entityPriorChanges The second entity to compare
|
|
404
|
+
* @returns The difference between the two Entities in form of a Partial
|
|
405
|
+
*/
|
|
406
|
+
static difference(entity, entityPriorChanges) {
|
|
407
|
+
const res = {};
|
|
408
|
+
for (const key in entity) {
|
|
409
|
+
if (!isEqual(entity[key], entityPriorChanges[key])) {
|
|
410
|
+
res[key] = entity[key];
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return res;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* compare function for sorting entity keys by their order value
|
|
417
|
+
* @param a first key of entity
|
|
418
|
+
* @param b second key of entity
|
|
419
|
+
* @param entity current entity (used to get metadata of entity keys)
|
|
420
|
+
*/
|
|
421
|
+
static compareOrder(a, b, entity) {
|
|
422
|
+
const metadataA = EntityUtilities.getPropertyMetadata(entity, a, EntityUtilities.getPropertyType(entity, a));
|
|
423
|
+
const metadataB = EntityUtilities.getPropertyMetadata(entity, b, EntityUtilities.getPropertyType(entity, b));
|
|
424
|
+
if (metadataA.order === -1) {
|
|
425
|
+
return 1;
|
|
426
|
+
}
|
|
427
|
+
else if (metadataB.order === -1) {
|
|
428
|
+
return 0;
|
|
429
|
+
}
|
|
430
|
+
return (metadataA.order - metadataB.order);
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* gets the bootstrap column values for "lg", "md", "sm"
|
|
434
|
+
* @param entity entity to get the bootstrap column values of the key
|
|
435
|
+
* @param key key of the property to get bootstrap column values from
|
|
436
|
+
* @param type defines for which screensize the column values should be returned
|
|
437
|
+
* @returns bootstrap column value
|
|
438
|
+
*/
|
|
439
|
+
static getWidth(entity, key, type) {
|
|
440
|
+
const propertyType = EntityUtilities.getPropertyType(entity, key);
|
|
441
|
+
const metadata = EntityUtilities.getPropertyMetadata(entity, key, propertyType);
|
|
442
|
+
if (metadata.defaultWidths) {
|
|
443
|
+
switch (type) {
|
|
444
|
+
case 'lg':
|
|
445
|
+
return metadata.defaultWidths[0];
|
|
446
|
+
case 'md':
|
|
447
|
+
return metadata.defaultWidths[1];
|
|
448
|
+
case 'sm':
|
|
449
|
+
return metadata.defaultWidths[2];
|
|
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');
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Resets all changes on an entity
|
|
460
|
+
* @param entity The entity to reset
|
|
461
|
+
* @param entityPriorChanges The entity before any changes
|
|
462
|
+
*/
|
|
463
|
+
static resetChangesOnEntity(entity, entityPriorChanges) {
|
|
464
|
+
for (const key in entityPriorChanges) {
|
|
465
|
+
Reflect.set(entity, key, Reflect.get(entityPriorChanges, key));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
_a = EntityUtilities;
|
|
470
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
471
|
+
EntityUtilities.construct = _a.new;
|
|
472
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
473
|
+
EntityUtilities.build = _a.new;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* A generic EntityService class.
|
|
477
|
+
* Offers basic CRUD-functionality.
|
|
478
|
+
* You should create a service for every Entity you have.
|
|
479
|
+
* If you extend from this you need to make sure that the extended Service can be injected.
|
|
480
|
+
*/
|
|
481
|
+
class EntityService {
|
|
482
|
+
constructor(http) {
|
|
483
|
+
this.http = http;
|
|
484
|
+
/**
|
|
485
|
+
* a subject of all the entity values.
|
|
486
|
+
* Can be subscribed to when you want to do a specific thing whenever the entities change.
|
|
487
|
+
*/
|
|
488
|
+
this.entitiesSubject = new BehaviorSubject([]);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* gets the entities in an array from the internal entitiesSubject
|
|
492
|
+
*/
|
|
493
|
+
get entities() {
|
|
494
|
+
return this.entitiesSubject.value;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Creates a new Entity and pushes it to the entities array
|
|
498
|
+
* @param entity The data of the entity to create.
|
|
499
|
+
* All values that should be omitted will be removed from it inside this method.
|
|
500
|
+
* @returns A Promise of the created entity
|
|
501
|
+
*/
|
|
502
|
+
create(entity) {
|
|
503
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
504
|
+
const body = omit(entity, EntityUtilities.getOmitForCreate(entity));
|
|
505
|
+
const e = yield firstValueFrom(this.http.post(this.baseUrl, body));
|
|
506
|
+
this.entities.push(e);
|
|
507
|
+
this.entitiesSubject.next(this.entities);
|
|
508
|
+
return e;
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Gets all existing entities and pushes them to the entites array
|
|
513
|
+
* @returns A Promise of all received Entities
|
|
514
|
+
*/
|
|
515
|
+
read() {
|
|
516
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
517
|
+
const e = yield firstValueFrom(this.http.get(this.baseUrl));
|
|
518
|
+
this.entitiesSubject.next(e);
|
|
519
|
+
return e;
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Updates a specific Entity
|
|
524
|
+
* @param entity The updated Entity
|
|
525
|
+
* 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
|
|
528
|
+
*/
|
|
529
|
+
update(entity, entityPriorChanges) {
|
|
530
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
531
|
+
const reqBody = omit(EntityUtilities.difference(entity, entityPriorChanges), EntityUtilities.getOmitForUpdate(entity));
|
|
532
|
+
const updatedEntity = yield firstValueFrom(this.http.patch(`${this.baseUrl}/${entityPriorChanges.id}`, omitBy(reqBody, isNil)));
|
|
533
|
+
this.entities[this.entities.findIndex((e) => e.id === entityPriorChanges.id)] = updatedEntity;
|
|
534
|
+
this.entitiesSubject.next(this.entities);
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Method to delete a specific Entity
|
|
539
|
+
* @param id The id of the element to delete
|
|
540
|
+
*/
|
|
541
|
+
delete(id) {
|
|
542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
543
|
+
yield firstValueFrom(this.http.delete(`${this.baseUrl}/${id}`));
|
|
544
|
+
this.entities.splice(this.entities.findIndex((e) => e.id === id), 1);
|
|
545
|
+
this.entitiesSubject.next(this.entities);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
class NgxMatEntityConfirmDialogComponent {
|
|
551
|
+
constructor(dialogRef, data) {
|
|
552
|
+
this.dialogRef = dialogRef;
|
|
553
|
+
this.data = data;
|
|
554
|
+
/**
|
|
555
|
+
* Used for the checkbox to confirm the action
|
|
556
|
+
*/
|
|
557
|
+
this.confirm = false;
|
|
558
|
+
}
|
|
559
|
+
ngOnInit() {
|
|
560
|
+
if (this.data.requireConfirmation && !this.data.confirmationText) {
|
|
561
|
+
throw new Error(`
|
|
562
|
+
Missing required Input "confirmationText".
|
|
563
|
+
You can only omit this if you dont have "requireConfirmation" set`);
|
|
564
|
+
}
|
|
565
|
+
if (!this.data.requireConfirmation && this.data.confirmationText) {
|
|
566
|
+
throw new Error('The "confirmationText" will never be shown because "requireConfirmation" is not set to true');
|
|
567
|
+
}
|
|
568
|
+
if (this.data.requireConfirmation !== true && this.data.requireConfirmation !== false) {
|
|
569
|
+
this.data.requireConfirmation = false;
|
|
570
|
+
}
|
|
571
|
+
if (this.data.type === 'info-only' && this.data.cancelButtonLabel) {
|
|
572
|
+
throw new Error('The "cancelButtonLabel" will never be shown because "type" is set to "info-only"');
|
|
573
|
+
}
|
|
574
|
+
this.dialogRef.disableClose = true;
|
|
575
|
+
}
|
|
576
|
+
confirmAction() {
|
|
577
|
+
this.dialogRef.close(1);
|
|
578
|
+
}
|
|
579
|
+
cancel() {
|
|
580
|
+
this.dialogRef.close();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
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 ? data.confirmButtonLabel : 'Delete'}}\n </button>\n <button *ngIf=\"data.type !== 'delete'\" mat-raised-button (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel ? data.confirmButtonLabel : data.type === 'info-only' ? 'Ok' : 'Confirm'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.cancelButtonLabel ? data.cancelButtonLabel : 'Cancel'}}\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
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogComponent, decorators: [{
|
|
586
|
+
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 ? data.confirmButtonLabel : 'Delete'}}\n </button>\n <button *ngIf=\"data.type !== 'delete'\" mat-raised-button (click)=\"confirmAction()\" [disabled]=\"data.requireConfirmation && !confirm\" class=\"confirm-button\">\n {{data.confirmButtonLabel ? data.confirmButtonLabel : data.type === 'info-only' ? 'Ok' : 'Confirm'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.cancelButtonLabel ? data.cancelButtonLabel : 'Cancel'}}\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
|
+
}], ctorParameters: function () {
|
|
589
|
+
return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
590
|
+
type: Inject,
|
|
591
|
+
args: [MAT_DIALOG_DATA]
|
|
592
|
+
}] }];
|
|
593
|
+
} });
|
|
594
|
+
|
|
595
|
+
class NgxMatEntityConfirmDialogModule {
|
|
596
|
+
}
|
|
597
|
+
NgxMatEntityConfirmDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
598
|
+
NgxMatEntityConfirmDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogModule, declarations: [NgxMatEntityConfirmDialogComponent], imports: [CommonModule, MatDialogModule, FormsModule, MatCheckboxModule, MatButtonModule], exports: [NgxMatEntityConfirmDialogComponent] });
|
|
599
|
+
NgxMatEntityConfirmDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogModule, imports: [[CommonModule, MatDialogModule, FormsModule, MatCheckboxModule, MatButtonModule]] });
|
|
600
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityConfirmDialogModule, decorators: [{
|
|
601
|
+
type: NgModule,
|
|
602
|
+
args: [{
|
|
603
|
+
declarations: [NgxMatEntityConfirmDialogComponent],
|
|
604
|
+
imports: [CommonModule, MatDialogModule, FormsModule, MatCheckboxModule, MatButtonModule],
|
|
605
|
+
exports: [NgxMatEntityConfirmDialogComponent]
|
|
606
|
+
}]
|
|
607
|
+
}] });
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Generates a default error message for most validation errors.
|
|
611
|
+
* @param model The ngModel to get the error from
|
|
612
|
+
* @returns The Validation Error Message to display
|
|
613
|
+
*/
|
|
614
|
+
function getValidationErrorMessage(model) {
|
|
615
|
+
if (model.hasError('matDatepickerParse')) {
|
|
616
|
+
return 'not a valid date';
|
|
617
|
+
}
|
|
618
|
+
else if (model.hasError('email')) {
|
|
619
|
+
return 'not a valid email';
|
|
620
|
+
}
|
|
621
|
+
else if (model.hasError('minlength')) {
|
|
622
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
623
|
+
return `needs to be at least ${model.getError('minlength').requiredLength} characters long`;
|
|
624
|
+
}
|
|
625
|
+
else if (model.hasError('min')) {
|
|
626
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
627
|
+
return `needs to be equal or bigger than ${model.getError('min').min}`;
|
|
628
|
+
}
|
|
629
|
+
else if (model.hasError('max')) {
|
|
630
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
631
|
+
return `needs to be equal or smaller than ${model.getError('max').max}`;
|
|
632
|
+
}
|
|
633
|
+
else if (model.hasError('required')) {
|
|
634
|
+
return 'required';
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
return 'invalid input';
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
class NgxMatEntityInternalInputComponent {
|
|
642
|
+
constructor() {
|
|
643
|
+
this.DecoratorTypes = DecoratorTypes;
|
|
644
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Helper method needed to recursively generate property input components (used eg. with the object)
|
|
648
|
+
*/
|
|
649
|
+
trackByFn(index) {
|
|
650
|
+
return index;
|
|
651
|
+
}
|
|
652
|
+
ngOnInit() {
|
|
653
|
+
if (!this.entity) {
|
|
654
|
+
throw new Error('Missing required Input data "entity"');
|
|
655
|
+
}
|
|
656
|
+
if (!this.propertyKey) {
|
|
657
|
+
throw new Error('Missing required Input data "propertyKey"');
|
|
658
|
+
}
|
|
659
|
+
this.type = EntityUtilities.getPropertyType(this.entity, this.propertyKey);
|
|
660
|
+
this.metadata = EntityUtilities.getPropertyMetadata(this.entity, this.propertyKey, this.type);
|
|
661
|
+
this.metadataDefaultString = this.metadata;
|
|
662
|
+
this.metadataTextboxString = this.metadata;
|
|
663
|
+
this.metadataAutocompleteString = this.metadata;
|
|
664
|
+
this.metadataDropdownString = this.metadata;
|
|
665
|
+
this.metadataDropdownBoolean = this.metadata;
|
|
666
|
+
this.metadataDefaultNumber = this.metadata;
|
|
667
|
+
this.metadataDropdownNumber = this.metadata;
|
|
668
|
+
this.metadataDefaultObject = this.metadata;
|
|
669
|
+
this.objectProperty = this.entity[this.propertyKey];
|
|
670
|
+
}
|
|
671
|
+
getObjectProperties() {
|
|
672
|
+
const res = [];
|
|
673
|
+
for (const property in this.objectProperty) {
|
|
674
|
+
const metadata = EntityUtilities.getPropertyMetadata(this.objectProperty, property, EntityUtilities.getPropertyType(this.objectProperty, property));
|
|
675
|
+
if (!(this.hideOmitForCreate && metadata.omitForCreate)
|
|
676
|
+
&& !(this.hideOmitForEdit && metadata.omitForUpdate)) {
|
|
677
|
+
res.push(property);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return res.sort((a, b) => EntityUtilities.compareOrder(a, b, this.objectProperty));
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
NgxMatEntityInternalInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
684
|
+
NgxMatEntityInternalInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NgxMatEntityInternalInputComponent, selector: "ngx-mat-entity-internal-input", inputs: { entity: "entity", propertyKey: "propertyKey", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit", getValidationErrorMessage: "getValidationErrorMessage" }, ngImport: i0, template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of metadataAutocompleteString.autocompleteValues\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-internal-input>\n </div>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"], components: [{ type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i4.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { type: NgxMatEntityInternalInputComponent, selector: "ngx-mat-entity-internal-input", inputs: ["entity", "propertyKey", "hideOmitForCreate", "hideOmitForEdit", "getValidationErrorMessage"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$1.MatLabel, selector: "mat-label" }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i12.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i12.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i12.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i10.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i12.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i12.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i12.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i7.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
685
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInternalInputComponent, decorators: [{
|
|
686
|
+
type: Component,
|
|
687
|
+
args: [{ selector: 'ngx-mat-entity-internal-input', template: "<div [ngSwitch]=\"type\" *ngIf=\"!(hideOmitForCreate && metadata.omitForCreate) && !(hideOmitForEdit && metadata.omitForUpdate)\">\n <!-------------------------------------------->\n <!-----------------Strings-------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.STRING\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [pattern]=\"metadataDefaultString.regex ? metadataDefaultString.regex : '[\\\\s\\\\S]*'\"\n [minlength]=\"metadataDefaultString.minLength ? metadataDefaultString.minLength : null\"\n [maxlength]=\"metadataDefaultString.maxLength ? metadataDefaultString.maxLength : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_TEXTBOX\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <textarea\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"10\"\n [minlength]=\"metadataTextboxString.minLength ? metadataTextboxString.minLength : null\"\n [maxlength]=\"metadataTextboxString.maxLength ? metadataTextboxString.maxLength : null\"\n >\n </textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_AUTOCOMPLETE\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [matAutocomplete]=\"auto\"\n [minlength]=\"metadataAutocompleteString.minLength ? metadataAutocompleteString.minLength : null\"\n [maxlength]=\"metadataAutocompleteString.maxLength ? metadataAutocompleteString.maxLength : null\"\n [pattern]=\"metadataAutocompleteString.regex ? metadataAutocompleteString.regex : '[\\\\s\\\\S]*'\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let value of metadataAutocompleteString.autocompleteValues\" [value]=\"value\">\n {{value}}\n </mat-option>\n </mat-autocomplete>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.STRING_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownString.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-----------------Booleans------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_CHECKBOX\">\n <mat-form-field>\n <mat-checkbox [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-checkbox>\n <!-- hidden input is needed so that the checkbox can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_TOGGLE\">\n <mat-form-field>\n <mat-slide-toggle [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n {{metadata.displayName}}\n </mat-slide-toggle>\n <!-- hidden input is needed so that the toggle can be used inside a mat-form-field -->\n <textarea matInput hidden></textarea>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.BOOLEAN_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option [value]=\"undefined\">-</mat-option>\n <mat-option [value]=\"true\">{{metadataDropdownBoolean.dropdownTrue}}</mat-option>\n <mat-option [value]=\"false\">{{metadataDropdownBoolean.dropdownFalse}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!------------------Numbers------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <input\n matInput\n type=\"number\"\n [(ngModel)]=\"entity[propertyKey]\"\n [name]=\"propertyKey.toString()\"\n #model=\"ngModel\"\n [min]=\"metadataDefaultNumber.min ? metadataDefaultNumber.min : null\"\n [max]=\"metadataDefaultNumber.max ? metadataDefaultNumber.max : null\"\n />\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <div *ngSwitchCase=\"DecoratorTypes.NUMBER_DROPDOWN\">\n <mat-form-field>\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-select [(ngModel)]=\"entity[propertyKey]\" [name]=\"propertyKey.toString()\" #model=\"ngModel\">\n <mat-option *ngFor=\"let value of metadataDropdownNumber.dropdownValues\" [value]=\"value.value\">{{value.displayName}}</mat-option>\n </mat-select>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n </mat-form-field>\n </div>\n\n <!-------------------------------------------->\n <!-------------------Object------------------->\n <!-------------------------------------------->\n <div *ngSwitchCase=\"DecoratorTypes.OBJECT\">\n <b>{{metadataDefaultObject.displayName}}</b>\n <!-- iterates over the object properties -->\n <div class=\"row\">\n <!--\n displays another ngx-material-entity with the:\n object as the entity,\n the current key in the loop received by the keyvalue direction as the propertyKey\n and the getValidationErrorMessage of the current component\n -->\n <ngx-mat-entity-internal-input\n *ngFor=\"let key of getObjectProperties(); let i = index; trackBy: trackByFn\"\n [entity]=\"objectProperty\"\n [propertyKey]=\"key\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n class=\"col-lg-{{getWidth(objectProperty, key, 'lg')}} col-md-{{getWidth(objectProperty, key, 'md')}} col-sm-{{getWidth(objectProperty, key, 'sm')}}\"\n >\n </ngx-mat-entity-internal-input>\n </div>\n </div>\n\n <div *ngSwitchDefault>ERROR: The type {{type}}is not known.</div>\n</div>", styles: ["mat-form-field{width:100%}\n"] }]
|
|
688
|
+
}], propDecorators: { entity: [{
|
|
689
|
+
type: Input
|
|
690
|
+
}], propertyKey: [{
|
|
691
|
+
type: Input
|
|
692
|
+
}], hideOmitForCreate: [{
|
|
693
|
+
type: Input
|
|
694
|
+
}], hideOmitForEdit: [{
|
|
695
|
+
type: Input
|
|
696
|
+
}], getValidationErrorMessage: [{
|
|
697
|
+
type: Input
|
|
698
|
+
}] } });
|
|
699
|
+
|
|
700
|
+
class NgxMatEntityAddArrayItemDialogComponent {
|
|
701
|
+
constructor(data, dialogRef) {
|
|
702
|
+
this.data = data;
|
|
703
|
+
this.dialogRef = dialogRef;
|
|
704
|
+
this.EntityUtilities = EntityUtilities;
|
|
705
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
706
|
+
}
|
|
707
|
+
ngOnInit() {
|
|
708
|
+
this.dialogRef.disableClose = true;
|
|
709
|
+
this.setEntityKeys();
|
|
710
|
+
}
|
|
711
|
+
setEntityKeys() {
|
|
712
|
+
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
713
|
+
const omitCreateKeys = EntityUtilities.getOmitForCreate(this.data.entity);
|
|
714
|
+
this.entityKeys = this.entityKeys.filter((k) => !omitCreateKeys.includes(k))
|
|
715
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
716
|
+
}
|
|
717
|
+
create() {
|
|
718
|
+
this.dialogRef.close(1);
|
|
719
|
+
}
|
|
720
|
+
cancel() {
|
|
721
|
+
this.dialogRef.close();
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
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 ? data.createDialogData.createButtonLabel : 'Add'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.createDialogData.cancelButtonLabel ? data.createDialogData.cancelButtonLabel : 'Cancel'}}\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
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityAddArrayItemDialogComponent, decorators: [{
|
|
727
|
+
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 ? data.createDialogData.createButtonLabel : 'Add'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.createDialogData.cancelButtonLabel ? data.createDialogData.cancelButtonLabel : 'Cancel'}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}\n"] }]
|
|
729
|
+
}], ctorParameters: function () {
|
|
730
|
+
return [{ type: undefined, decorators: [{
|
|
731
|
+
type: Inject,
|
|
732
|
+
args: [MAT_DIALOG_DATA]
|
|
733
|
+
}] }, { type: i1.MatDialogRef }];
|
|
734
|
+
} });
|
|
735
|
+
|
|
736
|
+
class NgxMatEntityArrayTableComponent {
|
|
737
|
+
constructor(dialog) {
|
|
738
|
+
this.dialog = dialog;
|
|
739
|
+
this.selection = new SelectionModel(true, []);
|
|
740
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
741
|
+
this.EntityUtilities = EntityUtilities;
|
|
742
|
+
}
|
|
743
|
+
trackByFn(index) {
|
|
744
|
+
return index;
|
|
745
|
+
}
|
|
746
|
+
ngOnInit() {
|
|
747
|
+
this.validateInput();
|
|
748
|
+
const givenDisplayColumns = this.metadata.displayColumns.map((v) => v.displayName);
|
|
749
|
+
if (givenDisplayColumns.find((s) => s === 'select')) {
|
|
750
|
+
throw new Error(`The name "select" for a display column is reserved.
|
|
751
|
+
Please choose a different name.`);
|
|
752
|
+
}
|
|
753
|
+
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
754
|
+
this.dataSource = new MatTableDataSource();
|
|
755
|
+
this.dataSource.data = this.arrayItems;
|
|
756
|
+
this.arrayItem = new this.metadata.EntityClass();
|
|
757
|
+
this.arrayItemPriorChanges = cloneDeep(this.arrayItem);
|
|
758
|
+
}
|
|
759
|
+
validateInput() {
|
|
760
|
+
if (!this.metadata.createInline && !this.metadata.createDialogData) {
|
|
761
|
+
throw new Error(`Missing required Input data "createDialogData".
|
|
762
|
+
You can only omit this value when the creation is inline.`);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
add() {
|
|
766
|
+
if (this.metadata.createInline) {
|
|
767
|
+
this.arrayItems.push(cloneDeep(this.arrayItem));
|
|
768
|
+
this.dataSource.data = this.arrayItems;
|
|
769
|
+
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
const dialogData = {
|
|
773
|
+
entity: this.arrayItem,
|
|
774
|
+
createDialogData: this.metadata.createDialogData,
|
|
775
|
+
getValidationErrorMessage: this.getValidationErrorMessage
|
|
776
|
+
};
|
|
777
|
+
firstValueFrom(this.dialog.open(NgxMatEntityAddArrayItemDialogComponent, {
|
|
778
|
+
data: dialogData,
|
|
779
|
+
autoFocus: false,
|
|
780
|
+
restoreFocus: false
|
|
781
|
+
}).afterClosed()).then((res) => {
|
|
782
|
+
if (res === 1) {
|
|
783
|
+
this.arrayItems.push(cloneDeep(this.arrayItem));
|
|
784
|
+
this.dataSource.data = this.arrayItems;
|
|
785
|
+
}
|
|
786
|
+
EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
remove() {
|
|
791
|
+
this.selection.selected.forEach(s => {
|
|
792
|
+
this.arrayItems.splice(this.arrayItems.indexOf(s), 1);
|
|
793
|
+
});
|
|
794
|
+
this.dataSource.data = this.arrayItems;
|
|
795
|
+
this.selection.clear();
|
|
796
|
+
}
|
|
797
|
+
getObjectProperties() {
|
|
798
|
+
const res = [];
|
|
799
|
+
for (const property in this.arrayItem) {
|
|
800
|
+
const metadata = EntityUtilities.getPropertyMetadata(this.arrayItem, property, EntityUtilities.getPropertyType(this.arrayItem, property));
|
|
801
|
+
if (!(metadata.omitForCreate)) {
|
|
802
|
+
res.push(property);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
return res.sort((a, b) => EntityUtilities.compareOrder(a, b, this.arrayItem));
|
|
806
|
+
}
|
|
807
|
+
masterToggle() {
|
|
808
|
+
if (this.isAllSelected()) {
|
|
809
|
+
this.selection.clear();
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
this.dataSource.data.forEach((row) => this.selection.select(row));
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
isAllSelected() {
|
|
816
|
+
const numSelected = this.selection.selected.length;
|
|
817
|
+
const numRows = this.dataSource.data.length;
|
|
818
|
+
return numSelected === numRows;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
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 ? metadata.missingErrorMessage : 'Needs to have at least one value'}}\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.5px;border:1px solid #E0E0E0;background-color:#f8d3d7;color:#721c24;height:25px;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
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityArrayTableComponent, decorators: [{
|
|
824
|
+
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 ? metadata.missingErrorMessage : 'Needs to have at least one value'}}\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.5px;border:1px solid #E0E0E0;background-color:#f8d3d7;color:#721c24;height:25px;border-bottom-left-radius:5px;border-bottom-right-radius:5px}\n"] }]
|
|
826
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { arrayItems: [{
|
|
827
|
+
type: Input
|
|
828
|
+
}], metadata: [{
|
|
829
|
+
type: Input
|
|
830
|
+
}], getValidationErrorMessage: [{
|
|
831
|
+
type: Input
|
|
832
|
+
}], omit: [{
|
|
833
|
+
type: Input
|
|
834
|
+
}] } });
|
|
835
|
+
|
|
836
|
+
class NgxMatEntityInputComponent {
|
|
837
|
+
constructor() {
|
|
838
|
+
this.chipsInput = '';
|
|
839
|
+
this.DecoratorTypes = DecoratorTypes;
|
|
840
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Helper method needed to recursively generate property input components (used eg. with the object)
|
|
844
|
+
*/
|
|
845
|
+
trackByFn(index) {
|
|
846
|
+
return index;
|
|
847
|
+
}
|
|
848
|
+
ngOnInit() {
|
|
849
|
+
var _a;
|
|
850
|
+
if (!this.entity) {
|
|
851
|
+
throw new Error('Missing required Input data "entity"');
|
|
852
|
+
}
|
|
853
|
+
if (!this.propertyKey) {
|
|
854
|
+
throw new Error('Missing required Input data "propertyKey"');
|
|
855
|
+
}
|
|
856
|
+
this.type = EntityUtilities.getPropertyType(this.entity, this.propertyKey);
|
|
857
|
+
this.metadata = EntityUtilities.getPropertyMetadata(this.entity, this.propertyKey, this.type);
|
|
858
|
+
this.metadataDefaultString = this.metadata;
|
|
859
|
+
this.metadataTextboxString = this.metadata;
|
|
860
|
+
this.metadataAutocompleteString = this.metadata;
|
|
861
|
+
this.autocompleteStrings = this.metadataAutocompleteString.autocompleteValues;
|
|
862
|
+
this.filteredAutocompleteStrings = cloneDeep(this.autocompleteStrings);
|
|
863
|
+
this.metadataDropdownString = this.metadata;
|
|
864
|
+
this.metadataDropdownBoolean = this.metadata;
|
|
865
|
+
this.metadataDefaultNumber = this.metadata;
|
|
866
|
+
this.metadataDropdownNumber = this.metadata;
|
|
867
|
+
this.metadataDefaultObject = this.metadata;
|
|
868
|
+
this.objectProperty = this.entity[this.propertyKey];
|
|
869
|
+
this.metadataEntityArray = this.metadata;
|
|
870
|
+
if (this.metadataEntityArray.EntityClass) {
|
|
871
|
+
if (!this.entity[this.propertyKey]) {
|
|
872
|
+
this.entity[this.propertyKey] = [];
|
|
873
|
+
}
|
|
874
|
+
this.entityArrayValues = this.entity[this.propertyKey];
|
|
875
|
+
if (this.metadataEntityArray.createInline === undefined) {
|
|
876
|
+
this.metadataEntityArray.createInline = true;
|
|
877
|
+
}
|
|
878
|
+
if (!this.metadataEntityArray.createInline && !this.metadataEntityArray.createDialogData) {
|
|
879
|
+
this.metadataEntityArray.createDialogData = {
|
|
880
|
+
title: 'Add'
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
this.metadataStringChipsArray = this.metadata;
|
|
885
|
+
if (this.metadataStringChipsArray.itemType
|
|
886
|
+
&& ((_a = this.entity[this.propertyKey]) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
887
|
+
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
888
|
+
}
|
|
889
|
+
this.metadataAutocompleteStringChipsArray = this.metadata;
|
|
890
|
+
if (!this.getValidationErrorMessage) {
|
|
891
|
+
this.getValidationErrorMessage = getValidationErrorMessage;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
getObjectProperties() {
|
|
895
|
+
const res = [];
|
|
896
|
+
for (const property in this.objectProperty) {
|
|
897
|
+
const metadata = EntityUtilities.getPropertyMetadata(this.objectProperty, property, EntityUtilities.getPropertyType(this.objectProperty, property));
|
|
898
|
+
if (!(this.hideOmitForCreate && metadata.omitForCreate)
|
|
899
|
+
&& !(this.hideOmitForEdit && metadata.omitForUpdate)) {
|
|
900
|
+
res.push(property);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return res.sort((a, b) => EntityUtilities.compareOrder(a, b, this.objectProperty));
|
|
904
|
+
}
|
|
905
|
+
addStringChipArrayValue(event) {
|
|
906
|
+
const value = (event.value || '').trim();
|
|
907
|
+
if (value) {
|
|
908
|
+
if (this.metadataStringChipsArray.minLength && value.length < this.metadataStringChipsArray.minLength) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
if (this.metadataStringChipsArray.maxLength && value.length > this.metadataStringChipsArray.maxLength) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
if (this.metadataStringChipsArray.regex && !value.match(this.metadataStringChipsArray.regex)) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
if (!this.stringChipsArrayValues) {
|
|
918
|
+
if (!this.entity[this.propertyKey]) {
|
|
919
|
+
this.entity[this.propertyKey] = [];
|
|
920
|
+
}
|
|
921
|
+
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
922
|
+
}
|
|
923
|
+
this.stringChipsArrayValues.push(value);
|
|
924
|
+
}
|
|
925
|
+
event.chipInput.clear();
|
|
926
|
+
}
|
|
927
|
+
removeStringChipArrayValue(value) {
|
|
928
|
+
this.stringChipsArrayValues.splice(this.stringChipsArrayValues.indexOf(value), 1);
|
|
929
|
+
if (!this.stringChipsArrayValues.length) {
|
|
930
|
+
this.entity[this.propertyKey] = undefined;
|
|
931
|
+
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
selected(event, chipsInput) {
|
|
935
|
+
const value = (event.option.viewValue || '').trim();
|
|
936
|
+
if (this.metadataStringChipsArray.minLength && value.length < this.metadataStringChipsArray.minLength) {
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (this.metadataStringChipsArray.maxLength && value.length > this.metadataStringChipsArray.maxLength) {
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
if (this.metadataStringChipsArray.regex && !value.match(this.metadataStringChipsArray.regex)) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (!this.stringChipsArrayValues) {
|
|
946
|
+
if (!this.entity[this.propertyKey]) {
|
|
947
|
+
this.entity[this.propertyKey] = [];
|
|
948
|
+
}
|
|
949
|
+
this.stringChipsArrayValues = this.entity[this.propertyKey];
|
|
950
|
+
}
|
|
951
|
+
this.stringChipsArrayValues.push(value);
|
|
952
|
+
chipsInput.value = '';
|
|
953
|
+
}
|
|
954
|
+
filterAutocompleteStrings(input) {
|
|
955
|
+
const filterValue = input.toLowerCase();
|
|
956
|
+
this.filteredAutocompleteStrings = this.autocompleteStrings.filter(s => s.toLowerCase().includes(filterValue));
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
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]" }] });
|
|
961
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityInputComponent, decorators: [{
|
|
962
|
+
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"] }]
|
|
964
|
+
}], ctorParameters: function () { return []; }, propDecorators: { entity: [{
|
|
965
|
+
type: Input
|
|
966
|
+
}], propertyKey: [{
|
|
967
|
+
type: Input
|
|
968
|
+
}], getValidationErrorMessage: [{
|
|
969
|
+
type: Input
|
|
970
|
+
}], hideOmitForCreate: [{
|
|
971
|
+
type: Input
|
|
972
|
+
}], hideOmitForEdit: [{
|
|
973
|
+
type: Input
|
|
974
|
+
}] } });
|
|
975
|
+
|
|
976
|
+
class NgxMatEntityCreateDialogComponent {
|
|
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
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
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 });
|
|
1035
|
+
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 ? data.createDialogData.createButtonLabel : 'Create'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.createDialogData.cancelButtonLabel ? data.createDialogData.cancelButtonLabel : 'Cancel'}}\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]" }] });
|
|
1036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogComponent, decorators: [{
|
|
1037
|
+
type: Component,
|
|
1038
|
+
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 ? data.createDialogData.createButtonLabel : 'Create'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.createDialogData.cancelButtonLabel ? data.createDialogData.cancelButtonLabel : 'Cancel'}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}\n"] }]
|
|
1039
|
+
}], ctorParameters: function () {
|
|
1040
|
+
return [{ type: undefined, decorators: [{
|
|
1041
|
+
type: Inject,
|
|
1042
|
+
args: [MAT_DIALOG_DATA]
|
|
1043
|
+
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }];
|
|
1044
|
+
} });
|
|
1045
|
+
|
|
1046
|
+
class NgxMatEntityEditDialogComponent {
|
|
1047
|
+
constructor(data, dialogRef, injector, dialog) {
|
|
1048
|
+
this.data = data;
|
|
1049
|
+
this.dialogRef = dialogRef;
|
|
1050
|
+
this.injector = injector;
|
|
1051
|
+
this.dialog = dialog;
|
|
1052
|
+
this.EntityUtilities = EntityUtilities;
|
|
1053
|
+
this.getWidth = EntityUtilities.getWidth;
|
|
1054
|
+
}
|
|
1055
|
+
ngOnInit() {
|
|
1056
|
+
this.dialogRef.disableClose = true;
|
|
1057
|
+
this.setEntityKeys();
|
|
1058
|
+
this.entityService = this.injector.get(this.data.EntityServiceClass);
|
|
1059
|
+
this.entityPriorChanges = cloneDeep(this.data.entity);
|
|
1060
|
+
}
|
|
1061
|
+
setEntityKeys() {
|
|
1062
|
+
this.entityKeys = Reflect.ownKeys(this.data.entity);
|
|
1063
|
+
const omitUpdateKeys = EntityUtilities.getOmitForUpdate(this.data.entity);
|
|
1064
|
+
this.entityKeys = this.entityKeys.filter((k) => !omitUpdateKeys.includes(k))
|
|
1065
|
+
.sort((a, b) => EntityUtilities.compareOrder(a, b, this.data.entity));
|
|
1066
|
+
}
|
|
1067
|
+
edit() {
|
|
1068
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1069
|
+
if (this.data.editDialogData.editRequiresConfirmDialog === false) {
|
|
1070
|
+
return this.confirmEdit();
|
|
1071
|
+
}
|
|
1072
|
+
const dialogData = {
|
|
1073
|
+
// eslint-disable-next-line max-len
|
|
1074
|
+
text: ((_a = this.data.editDialogData.confirmEditDialogData) === null || _a === void 0 ? void 0 : _a.text) ? (_b = this.data.editDialogData.confirmEditDialogData) === null || _b === void 0 ? void 0 : _b.text : ['Do you really want to save all changes?'],
|
|
1075
|
+
type: 'default',
|
|
1076
|
+
// eslint-disable-next-line max-len
|
|
1077
|
+
confirmButtonLabel: ((_c = this.data.editDialogData.confirmEditDialogData) === null || _c === void 0 ? void 0 : _c.confirmButtonLabel) ? (_d = this.data.editDialogData.confirmEditDialogData) === null || _d === void 0 ? void 0 : _d.confirmButtonLabel : 'Confirm',
|
|
1078
|
+
// eslint-disable-next-line max-len
|
|
1079
|
+
cancelButtonLabel: ((_e = this.data.editDialogData.confirmEditDialogData) === null || _e === void 0 ? void 0 : _e.cancelButtonLabel) ? (_f = this.data.editDialogData.confirmEditDialogData) === null || _f === void 0 ? void 0 : _f.cancelButtonLabel : 'Cancel',
|
|
1080
|
+
title: ((_g = this.data.editDialogData.confirmEditDialogData) === null || _g === void 0 ? void 0 : _g.title) ? (_h = this.data.editDialogData.confirmEditDialogData) === null || _h === void 0 ? void 0 : _h.title : 'Edit',
|
|
1081
|
+
// eslint-disable-next-line max-len
|
|
1082
|
+
requireConfirmation: ((_j = this.data.editDialogData.confirmEditDialogData) === null || _j === void 0 ? void 0 : _j.requireConfirmation) ? (_k = this.data.editDialogData.confirmEditDialogData) === null || _k === void 0 ? void 0 : _k.requireConfirmation : false,
|
|
1083
|
+
// eslint-disable-next-line max-len
|
|
1084
|
+
confirmationText: ((_l = this.data.editDialogData.confirmEditDialogData) === null || _l === void 0 ? void 0 : _l.confirmationText) ? (_m = this.data.editDialogData.confirmEditDialogData) === null || _m === void 0 ? void 0 : _m.confirmationText : undefined,
|
|
1085
|
+
};
|
|
1086
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1087
|
+
data: dialogData,
|
|
1088
|
+
autoFocus: false,
|
|
1089
|
+
restoreFocus: false
|
|
1090
|
+
});
|
|
1091
|
+
dialogref.afterClosed().subscribe((res) => {
|
|
1092
|
+
if (res === 1) {
|
|
1093
|
+
this.confirmEdit();
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
confirmEdit() {
|
|
1098
|
+
this.entityService.update(this.data.entity, this.entityPriorChanges).then(() => this.dialogRef.close(1));
|
|
1099
|
+
}
|
|
1100
|
+
delete() {
|
|
1101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1102
|
+
if (this.data.editDialogData.deleteRequiresConfirmDialog === false) {
|
|
1103
|
+
return this.confirmDelete();
|
|
1104
|
+
}
|
|
1105
|
+
const dialogData = {
|
|
1106
|
+
// eslint-disable-next-line max-len
|
|
1107
|
+
text: ((_a = this.data.editDialogData.confirmDeleteDialogData) === null || _a === void 0 ? void 0 : _a.text) ? (_b = this.data.editDialogData.confirmDeleteDialogData) === null || _b === void 0 ? void 0 : _b.text : ['Do you really want to delete this entity?'],
|
|
1108
|
+
type: 'delete',
|
|
1109
|
+
// eslint-disable-next-line max-len
|
|
1110
|
+
confirmButtonLabel: ((_c = this.data.editDialogData.confirmDeleteDialogData) === null || _c === void 0 ? void 0 : _c.confirmButtonLabel) ? (_d = this.data.editDialogData.confirmDeleteDialogData) === null || _d === void 0 ? void 0 : _d.confirmButtonLabel : 'Delete',
|
|
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
|
+
};
|
|
1120
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1121
|
+
data: dialogData,
|
|
1122
|
+
autoFocus: false,
|
|
1123
|
+
restoreFocus: false
|
|
1124
|
+
});
|
|
1125
|
+
dialogref.afterClosed().subscribe((res) => {
|
|
1126
|
+
if (res === 1) {
|
|
1127
|
+
this.confirmDelete();
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
confirmDelete() {
|
|
1132
|
+
this.entityService.delete(this.entityPriorChanges.id).then(() => this.dialogRef.close(2));
|
|
1133
|
+
}
|
|
1134
|
+
cancel() {
|
|
1135
|
+
EntityUtilities.resetChangesOnEntity(this.data.entity, this.entityPriorChanges);
|
|
1136
|
+
this.dialogRef.close(0);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
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 ? data.editDialogData.deleteButtonLabel : 'Delete'}}\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, 'edit') || !EntityUtilities.dirty(data.entity, entityPriorChanges)\">\n {{data.editDialogData.confirmButtonLabel ? data.editDialogData.confirmButtonLabel : 'Save'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.editDialogData.cancelButtonLabel ? data.editDialogData.cancelButtonLabel : 'Cancel'}}\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
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogComponent, decorators: [{
|
|
1142
|
+
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 ? data.editDialogData.deleteButtonLabel : 'Delete'}}\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, 'edit') || !EntityUtilities.dirty(data.entity, entityPriorChanges)\">\n {{data.editDialogData.confirmButtonLabel ? data.editDialogData.confirmButtonLabel : 'Save'}}\n </button>\n <button mat-raised-button (click)=\"cancel()\" class=\"cancel-button\">\n {{data.editDialogData.cancelButtonLabel ? data.editDialogData.cancelButtonLabel : 'Cancel'}}\n </button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;justify-content:space-between}.delete-button{float:right}\n"] }]
|
|
1144
|
+
}], ctorParameters: function () {
|
|
1145
|
+
return [{ type: undefined, decorators: [{
|
|
1146
|
+
type: Inject,
|
|
1147
|
+
args: [MAT_DIALOG_DATA]
|
|
1148
|
+
}] }, { type: i1.MatDialogRef }, { type: i0.Injector }, { type: i1.MatDialog }];
|
|
1149
|
+
} });
|
|
1150
|
+
|
|
1151
|
+
class NgxMatEntityTableComponent {
|
|
1152
|
+
constructor(dialog, injector) {
|
|
1153
|
+
this.dialog = dialog;
|
|
1154
|
+
this.injector = injector;
|
|
1155
|
+
this.onDestroy = new Subject();
|
|
1156
|
+
this.dataSource = new MatTableDataSource();
|
|
1157
|
+
this.selection = new SelectionModel(true, []);
|
|
1158
|
+
}
|
|
1159
|
+
ngOnInit() {
|
|
1160
|
+
var _a;
|
|
1161
|
+
this.validateInput();
|
|
1162
|
+
this.entityService = this.injector.get(this.entitiesData.baseData.EntityServiceClass);
|
|
1163
|
+
const givenDisplayColumns = this.entitiesData.baseData.displayColumns.map((v) => v.displayName);
|
|
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
|
+
}
|
|
1169
|
+
this.displayedColumns = ['select'].concat(givenDisplayColumns);
|
|
1170
|
+
}
|
|
1171
|
+
else {
|
|
1172
|
+
this.displayedColumns = givenDisplayColumns;
|
|
1173
|
+
}
|
|
1174
|
+
this.dataSource.sortingDataAccessor = (entity, header) => {
|
|
1175
|
+
var _a;
|
|
1176
|
+
return (_a = this.entitiesData.baseData.displayColumns.find((dp) => dp.displayName === header)) === null || _a === void 0 ? void 0 : _a.value(entity);
|
|
1177
|
+
};
|
|
1178
|
+
this.dataSource.sort = this.sort;
|
|
1179
|
+
if (this.entitiesData.baseData.searchString) {
|
|
1180
|
+
this.dataSource.filterPredicate = (entity, filter) => {
|
|
1181
|
+
var _a, _b;
|
|
1182
|
+
const searchStr = (_b = (_a = this.entitiesData.baseData).searchString) === null || _b === void 0 ? void 0 : _b.call(_a, entity);
|
|
1183
|
+
const formattedSearchString = searchStr.toLowerCase();
|
|
1184
|
+
const formattedFilterString = filter.toLowerCase();
|
|
1185
|
+
return formattedSearchString.includes(formattedFilterString);
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
this.dataSource.filter = this.filter;
|
|
1189
|
+
this.dataSource.paginator = this.paginator;
|
|
1190
|
+
this.entityService.entitiesSubject.pipe(takeUntil(this.onDestroy)).subscribe((entities) => {
|
|
1191
|
+
this.dataSource.data = entities;
|
|
1192
|
+
this.selection.clear();
|
|
1193
|
+
});
|
|
1194
|
+
this.entityService.read();
|
|
1195
|
+
}
|
|
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
|
+
editEntity(entity) {
|
|
1236
|
+
var _a, _b;
|
|
1237
|
+
if ((_b = (_a = this.entitiesData.baseData).allowEdit) === null || _b === void 0 ? void 0 : _b.call(_a, entity)) {
|
|
1238
|
+
if (this.entitiesData.baseData.edit) {
|
|
1239
|
+
this.entitiesData.baseData.edit(new this.entitiesData.baseData.EntityClass(entity));
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
this.editDefault(new this.entitiesData.baseData.EntityClass(entity));
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
editDefault(entity) {
|
|
1247
|
+
const dialogData = {
|
|
1248
|
+
entity: entity,
|
|
1249
|
+
EntityServiceClass: this.entitiesData.baseData.EntityServiceClass,
|
|
1250
|
+
allowDelete: this.entitiesData.baseData.allowDelete,
|
|
1251
|
+
editDialogData: this.entitiesData.editDialogData
|
|
1252
|
+
};
|
|
1253
|
+
firstValueFrom(this.dialog.open(NgxMatEntityEditDialogComponent, {
|
|
1254
|
+
data: dialogData,
|
|
1255
|
+
minWidth: '60%',
|
|
1256
|
+
autoFocus: false,
|
|
1257
|
+
restoreFocus: false
|
|
1258
|
+
}).afterClosed()).then((res) => {
|
|
1259
|
+
if (res === 0) {
|
|
1260
|
+
const data = this.dataSource.data;
|
|
1261
|
+
data[this.dataSource.data.findIndex((e) => e.id === entity.id)] = entity;
|
|
1262
|
+
this.dataSource.data = data;
|
|
1263
|
+
this.selection.clear();
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
createEntity() {
|
|
1268
|
+
if (this.entitiesData.baseData.allowCreate) {
|
|
1269
|
+
if (this.entitiesData.baseData.create) {
|
|
1270
|
+
this.entitiesData.baseData.create(new this.entitiesData.baseData.EntityClass());
|
|
1271
|
+
}
|
|
1272
|
+
else {
|
|
1273
|
+
this.createDefault(new this.entitiesData.baseData.EntityClass());
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
createDefault(entity) {
|
|
1278
|
+
const dialogData = {
|
|
1279
|
+
entity: entity,
|
|
1280
|
+
EntityServiceClass: this.entitiesData.baseData.EntityServiceClass,
|
|
1281
|
+
createDialogData: this.entitiesData.createDialogData
|
|
1282
|
+
};
|
|
1283
|
+
this.dialog.open(NgxMatEntityCreateDialogComponent, {
|
|
1284
|
+
data: dialogData,
|
|
1285
|
+
minWidth: '60%',
|
|
1286
|
+
autoFocus: false,
|
|
1287
|
+
restoreFocus: false
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
runMultiAction(action) {
|
|
1291
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1292
|
+
if (!action.requireConfirmDialog || !action.requireConfirmDialog(this.selection.selected)) {
|
|
1293
|
+
return this.confirmRunMultiAction(action);
|
|
1294
|
+
}
|
|
1295
|
+
const dialogData = {
|
|
1296
|
+
// eslint-disable-next-line max-len
|
|
1297
|
+
text: ((_a = action.confirmDialogData) === null || _a === void 0 ? void 0 : _a.text) ? (_b = action.confirmDialogData) === null || _b === void 0 ? void 0 : _b.text : [`Do you really want to run this action on ${this.selection.selected.length} entries?`],
|
|
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
|
+
};
|
|
1305
|
+
const dialogref = this.dialog.open(NgxMatEntityConfirmDialogComponent, {
|
|
1306
|
+
data: dialogData,
|
|
1307
|
+
autoFocus: false,
|
|
1308
|
+
restoreFocus: false
|
|
1309
|
+
});
|
|
1310
|
+
dialogref.afterClosed().subscribe((res) => {
|
|
1311
|
+
if (res === 1) {
|
|
1312
|
+
this.confirmRunMultiAction(action);
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
confirmRunMultiAction(action) {
|
|
1317
|
+
action.action(this.selection.selected);
|
|
1318
|
+
}
|
|
1319
|
+
multiActionDisabled(action) {
|
|
1320
|
+
var _a;
|
|
1321
|
+
if (!this.selection.selected.length) {
|
|
1322
|
+
return true;
|
|
1323
|
+
}
|
|
1324
|
+
if (((_a = action.enabled) === null || _a === void 0 ? void 0 : _a.call(action, this.selection.selected)) === false) {
|
|
1325
|
+
return true;
|
|
1326
|
+
}
|
|
1327
|
+
return false;
|
|
1328
|
+
}
|
|
1329
|
+
masterToggle() {
|
|
1330
|
+
if (this.isAllSelected()) {
|
|
1331
|
+
this.selection.clear();
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
this.dataSource.data.forEach((row) => this.selection.select(row));
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
isAllSelected() {
|
|
1338
|
+
const numSelected = this.selection.selected.length;
|
|
1339
|
+
const numRows = this.dataSource.data.length;
|
|
1340
|
+
return numSelected === numRows;
|
|
1341
|
+
}
|
|
1342
|
+
ngOnDestroy() {
|
|
1343
|
+
this.onDestroy.next(undefined);
|
|
1344
|
+
this.onDestroy.complete();
|
|
1345
|
+
}
|
|
1346
|
+
applyFilter(event) {
|
|
1347
|
+
const filterValue = event.target.value;
|
|
1348
|
+
this.dataSource.filter = filterValue.trim().toLowerCase();
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
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: { entitiesData: "entitiesData" }, 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\">{{entitiesData.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>{{entitiesData.baseData.searchLabel ? entitiesData.baseData.searchLabel : 'Search'}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-lg-2]=\"entitiesData.baseData.allowCreate\"\n [class.col-lg-4]=\"!entitiesData.baseData.allowCreate\"\n [class.col-md-3]=\"entitiesData.baseData.allowCreate\"\n [class.col-md-6]=\"!entitiesData.baseData.allowCreate\"\n [class.col-sm-6]=\"entitiesData.baseData.allowCreate\"\n [class.col-sm-12]=\"!entitiesData.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{entitiesData.baseData.multiSelectLabel ? entitiesData.baseData.multiSelectLabel : 'Actions'}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of entitiesData.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"entitiesData.baseData.allowCreate\"\n [class.col-lg-2]=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-lg-4]=\"!entitiesData.baseData.multiSelectActions?.length\"\n [class.col-md-3]=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-md-6]=\"!entitiesData.baseData.multiSelectActions?.length\"\n [class.col-sm-6]=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-sm-12]=\"!entitiesData.baseData.multiSelectActions?.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{entitiesData.baseData.createButtonLabel ? entitiesData.baseData.createButtonLabel : 'Create'}}\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 entitiesData.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]=\"entitiesData.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
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableComponent, decorators: [{
|
|
1354
|
+
type: Component,
|
|
1355
|
+
args: [{ selector: 'ngx-mat-entity-table', template: "<h1 class=\"title\">{{entitiesData.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>{{entitiesData.baseData.searchLabel ? entitiesData.baseData.searchLabel : 'Search'}}</mat-label>\n <input matInput (keyup)=\"applyFilter($event)\" />\n </mat-form-field>\n <div\n *ngIf=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-lg-2]=\"entitiesData.baseData.allowCreate\"\n [class.col-lg-4]=\"!entitiesData.baseData.allowCreate\"\n [class.col-md-3]=\"entitiesData.baseData.allowCreate\"\n [class.col-md-6]=\"!entitiesData.baseData.allowCreate\"\n [class.col-sm-6]=\"entitiesData.baseData.allowCreate\"\n [class.col-sm-12]=\"!entitiesData.baseData.allowCreate\"\n >\n <button class=\"actions-button\" [matMenuTriggerFor]=\"menu\" mat-raised-button>\n {{entitiesData.baseData.multiSelectLabel ? entitiesData.baseData.multiSelectLabel : 'Actions'}}\n </button>\n </div>\n <mat-menu #menu=\"matMenu\">\n <button *ngFor=\"let action of entitiesData.baseData.multiSelectActions\" [disabled]=\"multiActionDisabled(action)\" (click)=\"runMultiAction(action)\" mat-menu-item>\n {{action.displayName}}\n </button>\n </mat-menu>\n\n <div\n *ngIf=\"entitiesData.baseData.allowCreate\"\n [class.col-lg-2]=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-lg-4]=\"!entitiesData.baseData.multiSelectActions?.length\"\n [class.col-md-3]=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-md-6]=\"!entitiesData.baseData.multiSelectActions?.length\"\n [class.col-sm-6]=\"entitiesData.baseData.multiSelectActions?.length\"\n [class.col-sm-12]=\"!entitiesData.baseData.multiSelectActions?.length\"\n >\n <button class=\"create-button\" (click)=\"createEntity()\" mat-raised-button>\n {{entitiesData.baseData.createButtonLabel ? entitiesData.baseData.createButtonLabel : 'Create'}}\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 entitiesData.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]=\"entitiesData.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"] }]
|
|
1356
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.Injector }]; }, propDecorators: { entitiesData: [{
|
|
1357
|
+
type: Input
|
|
1358
|
+
}], paginator: [{
|
|
1359
|
+
type: ViewChild,
|
|
1360
|
+
args: [MatPaginator, { static: true }]
|
|
1361
|
+
}], sort: [{
|
|
1362
|
+
type: ViewChild,
|
|
1363
|
+
args: [MatSort, { static: true }]
|
|
1364
|
+
}], filter: [{
|
|
1365
|
+
type: ViewChild,
|
|
1366
|
+
args: ['filter', { static: true }]
|
|
1367
|
+
}] } });
|
|
1368
|
+
|
|
1369
|
+
class NgxMatEntityTableModule {
|
|
1370
|
+
}
|
|
1371
|
+
NgxMatEntityTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1372
|
+
NgxMatEntityTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, declarations: [NgxMatEntityTableComponent], imports: [CommonModule,
|
|
1373
|
+
MatInputModule,
|
|
1374
|
+
FormsModule,
|
|
1375
|
+
MatFormFieldModule,
|
|
1376
|
+
MatCheckboxModule,
|
|
1377
|
+
MatTableModule,
|
|
1378
|
+
MatPaginatorModule,
|
|
1379
|
+
MatButtonModule,
|
|
1380
|
+
MatMenuModule,
|
|
1381
|
+
MatDialogModule], exports: [NgxMatEntityTableComponent] });
|
|
1382
|
+
NgxMatEntityTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, imports: [[
|
|
1383
|
+
CommonModule,
|
|
1384
|
+
MatInputModule,
|
|
1385
|
+
FormsModule,
|
|
1386
|
+
MatFormFieldModule,
|
|
1387
|
+
MatCheckboxModule,
|
|
1388
|
+
MatTableModule,
|
|
1389
|
+
MatPaginatorModule,
|
|
1390
|
+
MatButtonModule,
|
|
1391
|
+
MatMenuModule,
|
|
1392
|
+
MatDialogModule
|
|
1393
|
+
]] });
|
|
1394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityTableModule, decorators: [{
|
|
1395
|
+
type: NgModule,
|
|
1396
|
+
args: [{
|
|
1397
|
+
declarations: [NgxMatEntityTableComponent],
|
|
1398
|
+
imports: [
|
|
1399
|
+
CommonModule,
|
|
1400
|
+
MatInputModule,
|
|
1401
|
+
FormsModule,
|
|
1402
|
+
MatFormFieldModule,
|
|
1403
|
+
MatCheckboxModule,
|
|
1404
|
+
MatTableModule,
|
|
1405
|
+
MatPaginatorModule,
|
|
1406
|
+
MatButtonModule,
|
|
1407
|
+
MatMenuModule,
|
|
1408
|
+
MatDialogModule
|
|
1409
|
+
],
|
|
1410
|
+
exports: [NgxMatEntityTableComponent]
|
|
1411
|
+
}]
|
|
1412
|
+
}] });
|
|
1413
|
+
|
|
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
|
+
class NgxMatEntityCreateDialogModule {
|
|
1570
|
+
}
|
|
1571
|
+
NgxMatEntityCreateDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1572
|
+
NgxMatEntityCreateDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, declarations: [NgxMatEntityCreateDialogComponent], imports: [CommonModule, NgxMatEntityInputModule, MatDialogModule, FormsModule, MatButtonModule], exports: [NgxMatEntityCreateDialogComponent] });
|
|
1573
|
+
NgxMatEntityCreateDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, imports: [[CommonModule, NgxMatEntityInputModule, MatDialogModule, FormsModule, MatButtonModule]] });
|
|
1574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityCreateDialogModule, decorators: [{
|
|
1575
|
+
type: NgModule,
|
|
1576
|
+
args: [{
|
|
1577
|
+
declarations: [NgxMatEntityCreateDialogComponent],
|
|
1578
|
+
imports: [CommonModule, NgxMatEntityInputModule, MatDialogModule, FormsModule, MatButtonModule],
|
|
1579
|
+
exports: [NgxMatEntityCreateDialogComponent]
|
|
1580
|
+
}]
|
|
1581
|
+
}] });
|
|
1582
|
+
|
|
1583
|
+
class NgxMatEntityEditDialogModule {
|
|
1584
|
+
}
|
|
1585
|
+
NgxMatEntityEditDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1586
|
+
NgxMatEntityEditDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogModule, declarations: [NgxMatEntityEditDialogComponent], imports: [CommonModule,
|
|
1587
|
+
NgxMatEntityInputModule,
|
|
1588
|
+
MatDialogModule,
|
|
1589
|
+
FormsModule,
|
|
1590
|
+
MatButtonModule,
|
|
1591
|
+
NgxMatEntityConfirmDialogModule], exports: [NgxMatEntityEditDialogComponent] });
|
|
1592
|
+
NgxMatEntityEditDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogModule, imports: [[
|
|
1593
|
+
CommonModule,
|
|
1594
|
+
NgxMatEntityInputModule,
|
|
1595
|
+
MatDialogModule,
|
|
1596
|
+
FormsModule,
|
|
1597
|
+
MatButtonModule,
|
|
1598
|
+
NgxMatEntityConfirmDialogModule
|
|
1599
|
+
]] });
|
|
1600
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatEntityEditDialogModule, decorators: [{
|
|
1601
|
+
type: NgModule,
|
|
1602
|
+
args: [{
|
|
1603
|
+
declarations: [NgxMatEntityEditDialogComponent],
|
|
1604
|
+
imports: [
|
|
1605
|
+
CommonModule,
|
|
1606
|
+
NgxMatEntityInputModule,
|
|
1607
|
+
MatDialogModule,
|
|
1608
|
+
FormsModule,
|
|
1609
|
+
MatButtonModule,
|
|
1610
|
+
NgxMatEntityConfirmDialogModule
|
|
1611
|
+
],
|
|
1612
|
+
exports: [NgxMatEntityEditDialogComponent]
|
|
1613
|
+
}]
|
|
1614
|
+
}] });
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Decorator for setting and getting array propery metadata
|
|
1618
|
+
* @param metadata The metadata of the array property
|
|
1619
|
+
*/
|
|
1620
|
+
function array(metadata) {
|
|
1621
|
+
switch (metadata.itemType) {
|
|
1622
|
+
case DecoratorTypes.OBJECT:
|
|
1623
|
+
return baseProperty(new EntityArrayDecoratorConfig(metadata), DecoratorTypes.ARRAY);
|
|
1624
|
+
case DecoratorTypes.STRING:
|
|
1625
|
+
return baseProperty(new StringChipsArrayDecoratorConfig(metadata), DecoratorTypes.ARRAY_STRING_CHIPS);
|
|
1626
|
+
case DecoratorTypes.STRING_AUTOCOMPLETE:
|
|
1627
|
+
return baseProperty(new AutocompleteStringChipsArrayDecoratorConfig(metadata), DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS);
|
|
1628
|
+
default:
|
|
1629
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1630
|
+
throw new Error(`Unknown itemType ${metadata.itemType}`);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Interface definition for the @array metadata
|
|
1635
|
+
*/
|
|
1636
|
+
class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Definition for an array of Entities
|
|
1640
|
+
*/
|
|
1641
|
+
class EntityArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
1642
|
+
constructor(metadata) {
|
|
1643
|
+
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1644
|
+
this.itemType = metadata.itemType;
|
|
1645
|
+
this.displayStyle = metadata.displayStyle;
|
|
1646
|
+
this.EntityClass = metadata.EntityClass;
|
|
1647
|
+
this.createDialogData = metadata.createDialogData;
|
|
1648
|
+
this.missingErrorMessage = metadata.missingErrorMessage;
|
|
1649
|
+
this.createInline = metadata.createInline;
|
|
1650
|
+
this.displayColumns = metadata.displayColumns;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Definition for an array of strings displayed as a chips list
|
|
1655
|
+
*/
|
|
1656
|
+
class StringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
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;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Definition for an array of autocomplete strings displayed as a chips list
|
|
1669
|
+
*/
|
|
1670
|
+
class AutocompleteStringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
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;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Decorator for setting and getting string propery metadata
|
|
1685
|
+
* @param metadata The metadata of the string property
|
|
1686
|
+
*/
|
|
1687
|
+
function boolean(metadata) {
|
|
1688
|
+
if (metadata.displayStyle === 'dropdown') {
|
|
1689
|
+
return baseProperty(new DropdownBooleanDecoratorConfig(metadata), DecoratorTypes.BOOLEAN_DROPDOWN);
|
|
1690
|
+
}
|
|
1691
|
+
else if (metadata.displayStyle === 'checkbox') {
|
|
1692
|
+
return baseProperty(new CheckboxBooleanDecoratorConfig(metadata), DecoratorTypes.BOOLEAN_CHECKBOX);
|
|
1693
|
+
}
|
|
1694
|
+
else {
|
|
1695
|
+
return baseProperty(new ToggleBooleanDecoratorConfig(metadata), DecoratorTypes.BOOLEAN_TOGGLE);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* The Definition for the @boolean metadata
|
|
1700
|
+
*/
|
|
1701
|
+
class BooleanDecoratorConfig extends PropertyDecoratorConfig {
|
|
1702
|
+
}
|
|
1703
|
+
class DropdownBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
1704
|
+
constructor(metadata) {
|
|
1705
|
+
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1706
|
+
this.displayStyle = metadata.displayStyle;
|
|
1707
|
+
this.dropdownTrue = metadata.dropdownTrue;
|
|
1708
|
+
this.dropdownFalse = metadata.dropdownFalse;
|
|
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;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
class ToggleBooleanDecoratorConfig extends BooleanDecoratorConfig {
|
|
1718
|
+
constructor(metadata) {
|
|
1719
|
+
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1720
|
+
this.displayStyle = metadata.displayStyle;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Decorator for setting and getting string propery metadata
|
|
1726
|
+
* @param metadata The metadata of the string property
|
|
1727
|
+
*/
|
|
1728
|
+
function number(metadata) {
|
|
1729
|
+
if (metadata.displayStyle === 'dropdown') {
|
|
1730
|
+
return baseProperty(new DropdownNumberDecoratorConfig(metadata), DecoratorTypes.NUMBER_DROPDOWN);
|
|
1731
|
+
}
|
|
1732
|
+
else {
|
|
1733
|
+
return baseProperty(new DefaultNumberDecoratorConfig(metadata), DecoratorTypes.NUMBER);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
/**
|
|
1737
|
+
* Interface definition for the @number metadata
|
|
1738
|
+
*/
|
|
1739
|
+
class NumberDecoratorConfig extends PropertyDecoratorConfig {
|
|
1740
|
+
}
|
|
1741
|
+
class DefaultNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
1742
|
+
constructor(metadata) {
|
|
1743
|
+
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1744
|
+
this.displayStyle = metadata.displayStyle;
|
|
1745
|
+
this.min = metadata.min;
|
|
1746
|
+
this.max = metadata.max;
|
|
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;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Decorator for setting and getting object propery metadata.
|
|
1759
|
+
* @param metadata The metadata of the object property
|
|
1760
|
+
*/
|
|
1761
|
+
function object(metadata) {
|
|
1762
|
+
return baseProperty(new DefaultObjectDecoratorConfig(metadata), DecoratorTypes.OBJECT);
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Interface definition for the @object metadata
|
|
1766
|
+
*/
|
|
1767
|
+
class ObjectDecoratorConfig extends PropertyDecoratorConfig {
|
|
1768
|
+
}
|
|
1769
|
+
class DefaultObjectDecoratorConfig extends ObjectDecoratorConfig {
|
|
1770
|
+
constructor(metadata) {
|
|
1771
|
+
super(metadata.displayName, metadata.display, metadata.required, metadata.omitForCreate, metadata.omitForUpdate, metadata.defaultWidths, metadata.order);
|
|
1772
|
+
this.displayStyle = metadata.displayStyle;
|
|
1773
|
+
this.type = metadata.type;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
/*
|
|
1778
|
+
* Public API Surface of ngx-material-entity
|
|
1779
|
+
*/
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Generated bundle index. Do not edit.
|
|
1783
|
+
*/
|
|
1784
|
+
|
|
1785
|
+
export { AutocompleteStringChipsArrayDecoratorConfig, AutocompleteStringDecoratorConfig, CheckboxBooleanDecoratorConfig, DecoratorTypes, DefaultNumberDecoratorConfig, DefaultObjectDecoratorConfig, DefaultStringDecoratorConfig, DropdownBooleanDecoratorConfig, DropdownNumberDecoratorConfig, DropdownStringDecoratorConfig, Entity, EntityArrayDecoratorConfig, EntityService, EntityUtilities, NgxMatEntityConfirmDialogComponent, NgxMatEntityConfirmDialogModule, NgxMatEntityCreateDialogComponent, NgxMatEntityCreateDialogModule, NgxMatEntityEditDialogComponent, NgxMatEntityEditDialogModule, NgxMatEntityInputComponent, NgxMatEntityInputModule, NgxMatEntityTableComponent, NgxMatEntityTableModule, StringChipsArrayDecoratorConfig, TextboxStringDecoratorConfig, ToggleBooleanDecoratorConfig, array, boolean, getValidationErrorMessage, number, object, string };
|
|
1786
|
+
//# sourceMappingURL=ngx-material-entity.mjs.map
|