ngx-material-entity 15.1.1 → 15.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/classes/entity.utilities.d.ts +36 -0
- package/components/input/date/date-range-input/date-range-input.component.d.ts +6 -3
- package/components/input/date/date-time-input/date-time-input.component.d.ts +2 -1
- package/components/input/file/file-image-input/file-image-input.component.d.ts +4 -2
- package/components/input/file/file-input/file-input.component.d.ts +5 -2
- package/components/input/string/string-password-input/string-password-input.component.d.ts +2 -1
- package/decorators/base/base-property.decorator.d.ts +2 -1
- package/decorators/custom/custom.decorator.d.ts +2 -1
- package/encapsulation/reflect.utilities.d.ts +9 -0
- package/esm2020/classes/entity.utilities.mjs +44 -1
- package/esm2020/components/input/date/date-range-input/date-range-input.component.mjs +21 -1
- package/esm2020/components/input/date/date-time-input/date-time-input.component.mjs +9 -1
- package/esm2020/components/input/file/file-default-input/file-default-input.component.mjs +3 -3
- package/esm2020/components/input/file/file-image-input/file-image-input.component.mjs +17 -3
- package/esm2020/components/input/file/file-input/file-input.component.mjs +14 -2
- package/esm2020/components/input/string/string-password-input/string-password-input.component.mjs +8 -3
- package/esm2020/decorators/base/base-property.decorator.mjs +6 -2
- package/esm2020/decorators/custom/custom.decorator.mjs +4 -3
- package/esm2020/decorators/date/date.decorator.mjs +4 -3
- package/esm2020/decorators/file/file.decorator.mjs +4 -3
- package/esm2020/decorators/string/string.decorator.mjs +3 -2
- package/esm2020/encapsulation/reflect.utilities.mjs +12 -1
- package/fesm2015/ngx-material-entity.mjs +333 -225
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +330 -222
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -45,89 +45,6 @@ import { MatSort } from '@angular/material/sort';
|
|
|
45
45
|
import * as i9 from '@angular/material/menu';
|
|
46
46
|
import { MatMenuModule } from '@angular/material/menu';
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* Encapsulates all functionality of Reflect.
|
|
50
|
-
*/
|
|
51
|
-
class ReflectUtilities {
|
|
52
|
-
/**
|
|
53
|
-
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
|
54
|
-
*
|
|
55
|
-
* @param metadataKey - A key used to store and retrieve metadata.
|
|
56
|
-
* @param target - The target object on which the metadata is defined.
|
|
57
|
-
* @param propertyKey - The property key for the target.
|
|
58
|
-
* @returns The metadata value for the metadata key if found; otherwise, undefined.
|
|
59
|
-
*/
|
|
60
|
-
static getMetadata(metadataKey, target, propertyKey) {
|
|
61
|
-
return Reflect.getMetadata(metadataKey, target, propertyKey);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns the string and symbol keys of the own properties of an object. The own properties of an object
|
|
65
|
-
* are those that are defined directly on that object, and are not inherited from the object's prototype.
|
|
66
|
-
*
|
|
67
|
-
* @param target - Object that contains the own properties.
|
|
68
|
-
* @returns The keys of the given object.
|
|
69
|
-
*/
|
|
70
|
-
static ownKeys(target) {
|
|
71
|
-
return Reflect.ownKeys(target);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Gets the property of target, equivalent to `target[propertyKey]`.
|
|
75
|
-
*
|
|
76
|
-
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
77
|
-
* @param propertyKey - The property name.
|
|
78
|
-
* @returns The property of the target of the given key.
|
|
79
|
-
*/
|
|
80
|
-
static get(target, propertyKey) {
|
|
81
|
-
return Reflect.get(target, propertyKey);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Sets the property of target, equivalent to `target[propertyKey] = value`.
|
|
85
|
-
*
|
|
86
|
-
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
87
|
-
* @param propertyKey - The property name.
|
|
88
|
-
* @param value - The value to set the property to.
|
|
89
|
-
* @returns If setting the value was successful.
|
|
90
|
-
*/
|
|
91
|
-
static set(target, propertyKey, value) {
|
|
92
|
-
return Reflect.set(target, propertyKey, value);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Equivalent to `propertyKey in target`.
|
|
96
|
-
*
|
|
97
|
-
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
98
|
-
* @param propertyKey - Name of the property.
|
|
99
|
-
* @returns Whether or not the given target has the key.
|
|
100
|
-
*/
|
|
101
|
-
static has(target, propertyKey) {
|
|
102
|
-
return Reflect.has(target, propertyKey);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Define a unique metadata entry on the target.
|
|
106
|
-
*
|
|
107
|
-
* @param metadataKey - A key used to store and retrieve metadata.
|
|
108
|
-
* @param metadataValue - A value that contains attached metadata.
|
|
109
|
-
* @param target - The target object on which to define metadata.
|
|
110
|
-
* @param propertyKey - The property key for the target.
|
|
111
|
-
*/
|
|
112
|
-
static defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
113
|
-
Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* The base decorator for setting metadata on properties.
|
|
119
|
-
*
|
|
120
|
-
* @param metadata - The metadata to define.
|
|
121
|
-
* @param type - The type of metadata.
|
|
122
|
-
* @returns The method that sets the metadata.
|
|
123
|
-
*/
|
|
124
|
-
function baseProperty(metadata, type) {
|
|
125
|
-
return function (target, propertyKey) {
|
|
126
|
-
ReflectUtilities.defineMetadata('metadata', metadata, target, propertyKey);
|
|
127
|
-
ReflectUtilities.defineMetadata('type', type, target, propertyKey);
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
48
|
/**
|
|
132
49
|
* The enum Values for all the different DecoratorTypes.
|
|
133
50
|
*/
|
|
@@ -160,132 +77,6 @@ var DecoratorTypes;
|
|
|
160
77
|
DecoratorTypes["CUSTOM"] = "custom";
|
|
161
78
|
})(DecoratorTypes || (DecoratorTypes = {}));
|
|
162
79
|
|
|
163
|
-
/**
|
|
164
|
-
* The internal Position. Sets default values and validates user input.
|
|
165
|
-
*/
|
|
166
|
-
class PositionInternal {
|
|
167
|
-
constructor(data) {
|
|
168
|
-
this.validateInput(data);
|
|
169
|
-
this.row = data?.row ?? -1;
|
|
170
|
-
this.order = data?.order ?? -1;
|
|
171
|
-
this.tab = data?.tab ?? -1;
|
|
172
|
-
this.tabName = data?.tabName;
|
|
173
|
-
}
|
|
174
|
-
validateInput(data) {
|
|
175
|
-
if (data?.order != null) {
|
|
176
|
-
if (data.order < 1) {
|
|
177
|
-
throw new Error('order must be at least 1');
|
|
178
|
-
}
|
|
179
|
-
if (data.order > 12) {
|
|
180
|
-
throw new Error('order cannot be bigger than 12 (the minimum value for a bootstrap column)');
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (data?.row != null && data.row < 1) {
|
|
184
|
-
throw new Error('row must be at least 1');
|
|
185
|
-
}
|
|
186
|
-
if (data?.tab != null && data.tab != -1 && data.tab < 2) {
|
|
187
|
-
throw new Error('tab must be either -1 for the first tab or at least 2');
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* The internal PropertyDecoratorConfig. Sets default values.
|
|
193
|
-
*/
|
|
194
|
-
class PropertyDecoratorConfigInternal {
|
|
195
|
-
constructor(data) {
|
|
196
|
-
this.display = data.display ?? true;
|
|
197
|
-
this.displayName = data.displayName;
|
|
198
|
-
this.required = data.required ?? true;
|
|
199
|
-
this.omitForCreate = data.omitForCreate ?? false;
|
|
200
|
-
this.omitForUpdate = data.omitForUpdate ?? false;
|
|
201
|
-
this.defaultWidths = data.defaultWidths ?? [6, 6, 12];
|
|
202
|
-
this.position = new PositionInternal(data.position);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* The internal DropdownStringDecoratorConfig. Sets default values.
|
|
208
|
-
*/
|
|
209
|
-
class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
210
|
-
constructor(data) {
|
|
211
|
-
super(data);
|
|
212
|
-
this.displayStyle = data.displayStyle;
|
|
213
|
-
this.dropdownValues = data.dropdownValues;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* The internal DefaultStringDecoratorConfig. Sets default values.
|
|
218
|
-
*/
|
|
219
|
-
class DefaultStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
220
|
-
constructor(data) {
|
|
221
|
-
super(data);
|
|
222
|
-
this.displayStyle = data.displayStyle;
|
|
223
|
-
this.minLength = data.minLength;
|
|
224
|
-
this.maxLength = data.maxLength;
|
|
225
|
-
this.regex = data.regex;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* The internal TextboxStringDecoratorConfig. Sets default values.
|
|
230
|
-
*/
|
|
231
|
-
class TextboxStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
232
|
-
constructor(data) {
|
|
233
|
-
super(data);
|
|
234
|
-
this.displayStyle = data.displayStyle;
|
|
235
|
-
this.minLength = data.minLength;
|
|
236
|
-
this.maxLength = data.maxLength;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* The internal AutocompleteStringDecoratorConfig. Sets default values.
|
|
241
|
-
*/
|
|
242
|
-
class AutocompleteStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
243
|
-
constructor(data) {
|
|
244
|
-
super(data);
|
|
245
|
-
this.displayStyle = data.displayStyle;
|
|
246
|
-
this.autocompleteValues = data.autocompleteValues;
|
|
247
|
-
this.minLength = data.minLength;
|
|
248
|
-
this.maxLength = data.maxLength;
|
|
249
|
-
this.regex = data.regex;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* The internal PasswordStringDecoratorConfig. Sets default values.
|
|
254
|
-
*/
|
|
255
|
-
class PasswordStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
256
|
-
constructor(data) {
|
|
257
|
-
super(data);
|
|
258
|
-
this.displayStyle = data.displayStyle;
|
|
259
|
-
this.minLength = data.minLength;
|
|
260
|
-
this.maxLength = data.maxLength;
|
|
261
|
-
this.regex = data.regex;
|
|
262
|
-
this.needsConfirmation = data.needsConfirmation ?? true;
|
|
263
|
-
this.confirmationDisplayName = data.confirmationDisplayName ?? 'Confirm Password';
|
|
264
|
-
this.passwordsDontMatchErrorMessage = data.passwordsDontMatchErrorMessage ?? 'Passwords need to match!';
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Decorator for setting and getting string Property metadata.
|
|
270
|
-
*
|
|
271
|
-
* @param metadata - The metadata of the string property.
|
|
272
|
-
* @returns The method that defines the metadata.
|
|
273
|
-
*/
|
|
274
|
-
function string(metadata) {
|
|
275
|
-
switch (metadata.displayStyle) {
|
|
276
|
-
case 'dropdown':
|
|
277
|
-
return baseProperty(new DropdownStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_DROPDOWN);
|
|
278
|
-
case 'autocomplete':
|
|
279
|
-
return baseProperty(new AutocompleteStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_AUTOCOMPLETE);
|
|
280
|
-
case 'textbox':
|
|
281
|
-
return baseProperty(new TextboxStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_TEXTBOX);
|
|
282
|
-
case 'password':
|
|
283
|
-
return baseProperty(new PasswordStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_PASSWORD);
|
|
284
|
-
default:
|
|
285
|
-
return baseProperty(new DefaultStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
80
|
/**
|
|
290
81
|
* Encapsulates all functionality of lodash.
|
|
291
82
|
*/
|
|
@@ -360,6 +151,86 @@ class LodashUtilities {
|
|
|
360
151
|
}
|
|
361
152
|
}
|
|
362
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Encapsulates all functionality of Reflect.
|
|
156
|
+
*/
|
|
157
|
+
class ReflectUtilities {
|
|
158
|
+
/**
|
|
159
|
+
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
|
160
|
+
*
|
|
161
|
+
* @param metadataKey - A key used to store and retrieve metadata.
|
|
162
|
+
* @param target - The target object on which the metadata is defined.
|
|
163
|
+
* @param propertyKey - The property key for the target.
|
|
164
|
+
* @returns The metadata value for the metadata key if found; otherwise, undefined.
|
|
165
|
+
*/
|
|
166
|
+
static getMetadata(metadataKey, target, propertyKey) {
|
|
167
|
+
return Reflect.getMetadata(metadataKey, target, propertyKey);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Returns the string and symbol keys of the own properties of an object. The own properties of an object
|
|
171
|
+
* are those that are defined directly on that object, and are not inherited from the object's prototype.
|
|
172
|
+
*
|
|
173
|
+
* @param target - Object that contains the own properties.
|
|
174
|
+
* @returns The keys of the given object.
|
|
175
|
+
*/
|
|
176
|
+
static ownKeys(target) {
|
|
177
|
+
return Reflect.ownKeys(target);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Gets the property of target, equivalent to `target[propertyKey]`.
|
|
181
|
+
*
|
|
182
|
+
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
183
|
+
* @param propertyKey - The property name.
|
|
184
|
+
* @returns The property of the target of the given key.
|
|
185
|
+
*/
|
|
186
|
+
static get(target, propertyKey) {
|
|
187
|
+
return Reflect.get(target, propertyKey);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Sets the property of target, equivalent to `target[propertyKey] = value`.
|
|
191
|
+
*
|
|
192
|
+
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
193
|
+
* @param propertyKey - The property name.
|
|
194
|
+
* @param value - The value to set the property to.
|
|
195
|
+
* @returns If setting the value was successful.
|
|
196
|
+
*/
|
|
197
|
+
static set(target, propertyKey, value) {
|
|
198
|
+
return Reflect.set(target, propertyKey, value);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Equivalent to `propertyKey in target`.
|
|
202
|
+
*
|
|
203
|
+
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
204
|
+
* @param propertyKey - Name of the property.
|
|
205
|
+
* @returns Whether or not the given target has the key.
|
|
206
|
+
*/
|
|
207
|
+
static has(target, propertyKey) {
|
|
208
|
+
return Reflect.has(target, propertyKey);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Checks if the targets key entry has a metadata value for the given metadata key.
|
|
212
|
+
*
|
|
213
|
+
* @returns Whether the metadata is null or not.
|
|
214
|
+
* @param metadataKey - The key of the metadata on the property.
|
|
215
|
+
* @param target - Object that contains the property on itself or in its prototype chain.
|
|
216
|
+
* @param propertyKey - The key of the target.
|
|
217
|
+
*/
|
|
218
|
+
static hasMetadata(metadataKey, target, propertyKey) {
|
|
219
|
+
return this.getMetadata(metadataKey, target, propertyKey) != null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Define a unique metadata entry on the target.
|
|
223
|
+
*
|
|
224
|
+
* @param metadataKey - A key used to store and retrieve metadata.
|
|
225
|
+
* @param metadataValue - A value that contains attached metadata.
|
|
226
|
+
* @param target - The target object on which to define metadata.
|
|
227
|
+
* @param propertyKey - The property key for the target.
|
|
228
|
+
*/
|
|
229
|
+
static defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
230
|
+
Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
363
234
|
const DAY_IN_MS = 1000 * 60 * 60 * 24;
|
|
364
235
|
/**
|
|
365
236
|
* Contains Helper Functions for handling date properties.
|
|
@@ -1363,6 +1234,13 @@ class EntityUtilities {
|
|
|
1363
1234
|
static resetChangesOnEntity(entity, entityPriorChanges) {
|
|
1364
1235
|
for (const key in entityPriorChanges) {
|
|
1365
1236
|
ReflectUtilities.set(entity, key, ReflectUtilities.get(entityPriorChanges, key));
|
|
1237
|
+
if (ReflectUtilities.hasMetadata(this.METADATA_KEYS_TO_RESET_KEY, entity, key)) {
|
|
1238
|
+
for (const k of ReflectUtilities.getMetadata(this.METADATA_KEYS_TO_RESET_KEY, entity, key)) {
|
|
1239
|
+
if (ReflectUtilities.hasMetadata(k, entity, key)) {
|
|
1240
|
+
ReflectUtilities.defineMetadata(k, undefined, entity, key);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1366
1244
|
}
|
|
1367
1245
|
}
|
|
1368
1246
|
static getEntityRows(entity, tab, hideOmitForCreate, hideOmitForEdit) {
|
|
@@ -1465,11 +1343,190 @@ class EntityUtilities {
|
|
|
1465
1343
|
return keys;
|
|
1466
1344
|
}
|
|
1467
1345
|
}
|
|
1346
|
+
/**
|
|
1347
|
+
* The key for all keys of metadata that should be set to undefined when the entity gets reset.
|
|
1348
|
+
*/
|
|
1349
|
+
EntityUtilities.METADATA_KEYS_TO_RESET_KEY = 'metadataKeysToReset';
|
|
1350
|
+
/**
|
|
1351
|
+
* The key for the metadata that saves the single preview image value on image properties.
|
|
1352
|
+
*/
|
|
1353
|
+
EntityUtilities.SINGLE_PREVIEW_IMAGE_KEY = 'singlePreviewImage';
|
|
1354
|
+
/**
|
|
1355
|
+
* The key for the metadata that saves the multi preview images value on image properties.
|
|
1356
|
+
*/
|
|
1357
|
+
EntityUtilities.MULTI_PREVIEW_IMAGES_KEY = 'multiPreviewImages';
|
|
1358
|
+
/**
|
|
1359
|
+
* The key for the metadata that saves the filenames value on file properties.
|
|
1360
|
+
*/
|
|
1361
|
+
EntityUtilities.FILENAMES_KEY = 'fileNames';
|
|
1362
|
+
/**
|
|
1363
|
+
* The key for the metadata that saves the confirm password value on password properties.
|
|
1364
|
+
*/
|
|
1365
|
+
EntityUtilities.CONFIRM_PASSWORD_KEY = 'confirmPassword';
|
|
1366
|
+
/**
|
|
1367
|
+
* The key for the metadata that saves the time value on date time properties.
|
|
1368
|
+
*/
|
|
1369
|
+
EntityUtilities.TIME_KEY = 'time';
|
|
1370
|
+
/**
|
|
1371
|
+
* The key for the metadata that saves the date range value on date range properties.
|
|
1372
|
+
*/
|
|
1373
|
+
EntityUtilities.DATE_RANGE_KEY = 'dateRange';
|
|
1374
|
+
/**
|
|
1375
|
+
* The key for the metadata that saves the date range start value on date range properties.
|
|
1376
|
+
*/
|
|
1377
|
+
EntityUtilities.DATE_RANGE_START_KEY = 'dateRangeStart';
|
|
1378
|
+
/**
|
|
1379
|
+
* The key for the metadata that saves the date range end value on date range properties.
|
|
1380
|
+
*/
|
|
1381
|
+
EntityUtilities.DATE_RANGE_END_KEY = 'dateRangeEnd';
|
|
1468
1382
|
// eslint-disable-next-line @typescript-eslint/member-ordering, jsdoc/require-jsdoc, @typescript-eslint/typedef
|
|
1469
1383
|
EntityUtilities.construct = EntityUtilities.new;
|
|
1470
1384
|
// eslint-disable-next-line @typescript-eslint/member-ordering, jsdoc/require-jsdoc, @typescript-eslint/typedef
|
|
1471
1385
|
EntityUtilities.build = EntityUtilities.new;
|
|
1472
1386
|
|
|
1387
|
+
/**
|
|
1388
|
+
* The base decorator for setting metadata on properties.
|
|
1389
|
+
*
|
|
1390
|
+
* @param metadata - The metadata to define.
|
|
1391
|
+
* @param type - The type of metadata.
|
|
1392
|
+
* @param metadataKeysToReset - Any metadata keys which values should be set to undefined on reset.
|
|
1393
|
+
* @returns The method that sets the metadata.
|
|
1394
|
+
*/
|
|
1395
|
+
function baseProperty(metadata, type, metadataKeysToReset) {
|
|
1396
|
+
return function (target, propertyKey) {
|
|
1397
|
+
ReflectUtilities.defineMetadata('metadata', metadata, target, propertyKey);
|
|
1398
|
+
ReflectUtilities.defineMetadata('type', type, target, propertyKey);
|
|
1399
|
+
// eslint-disable-next-line max-len
|
|
1400
|
+
ReflectUtilities.defineMetadata(EntityUtilities.METADATA_KEYS_TO_RESET_KEY, metadataKeysToReset, target, propertyKey);
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* The internal Position. Sets default values and validates user input.
|
|
1406
|
+
*/
|
|
1407
|
+
class PositionInternal {
|
|
1408
|
+
constructor(data) {
|
|
1409
|
+
this.validateInput(data);
|
|
1410
|
+
this.row = data?.row ?? -1;
|
|
1411
|
+
this.order = data?.order ?? -1;
|
|
1412
|
+
this.tab = data?.tab ?? -1;
|
|
1413
|
+
this.tabName = data?.tabName;
|
|
1414
|
+
}
|
|
1415
|
+
validateInput(data) {
|
|
1416
|
+
if (data?.order != null) {
|
|
1417
|
+
if (data.order < 1) {
|
|
1418
|
+
throw new Error('order must be at least 1');
|
|
1419
|
+
}
|
|
1420
|
+
if (data.order > 12) {
|
|
1421
|
+
throw new Error('order cannot be bigger than 12 (the minimum value for a bootstrap column)');
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
if (data?.row != null && data.row < 1) {
|
|
1425
|
+
throw new Error('row must be at least 1');
|
|
1426
|
+
}
|
|
1427
|
+
if (data?.tab != null && data.tab != -1 && data.tab < 2) {
|
|
1428
|
+
throw new Error('tab must be either -1 for the first tab or at least 2');
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* The internal PropertyDecoratorConfig. Sets default values.
|
|
1434
|
+
*/
|
|
1435
|
+
class PropertyDecoratorConfigInternal {
|
|
1436
|
+
constructor(data) {
|
|
1437
|
+
this.display = data.display ?? true;
|
|
1438
|
+
this.displayName = data.displayName;
|
|
1439
|
+
this.required = data.required ?? true;
|
|
1440
|
+
this.omitForCreate = data.omitForCreate ?? false;
|
|
1441
|
+
this.omitForUpdate = data.omitForUpdate ?? false;
|
|
1442
|
+
this.defaultWidths = data.defaultWidths ?? [6, 6, 12];
|
|
1443
|
+
this.position = new PositionInternal(data.position);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
/**
|
|
1448
|
+
* The internal DropdownStringDecoratorConfig. Sets default values.
|
|
1449
|
+
*/
|
|
1450
|
+
class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1451
|
+
constructor(data) {
|
|
1452
|
+
super(data);
|
|
1453
|
+
this.displayStyle = data.displayStyle;
|
|
1454
|
+
this.dropdownValues = data.dropdownValues;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* The internal DefaultStringDecoratorConfig. Sets default values.
|
|
1459
|
+
*/
|
|
1460
|
+
class DefaultStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1461
|
+
constructor(data) {
|
|
1462
|
+
super(data);
|
|
1463
|
+
this.displayStyle = data.displayStyle;
|
|
1464
|
+
this.minLength = data.minLength;
|
|
1465
|
+
this.maxLength = data.maxLength;
|
|
1466
|
+
this.regex = data.regex;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* The internal TextboxStringDecoratorConfig. Sets default values.
|
|
1471
|
+
*/
|
|
1472
|
+
class TextboxStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1473
|
+
constructor(data) {
|
|
1474
|
+
super(data);
|
|
1475
|
+
this.displayStyle = data.displayStyle;
|
|
1476
|
+
this.minLength = data.minLength;
|
|
1477
|
+
this.maxLength = data.maxLength;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* The internal AutocompleteStringDecoratorConfig. Sets default values.
|
|
1482
|
+
*/
|
|
1483
|
+
class AutocompleteStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1484
|
+
constructor(data) {
|
|
1485
|
+
super(data);
|
|
1486
|
+
this.displayStyle = data.displayStyle;
|
|
1487
|
+
this.autocompleteValues = data.autocompleteValues;
|
|
1488
|
+
this.minLength = data.minLength;
|
|
1489
|
+
this.maxLength = data.maxLength;
|
|
1490
|
+
this.regex = data.regex;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* The internal PasswordStringDecoratorConfig. Sets default values.
|
|
1495
|
+
*/
|
|
1496
|
+
class PasswordStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
1497
|
+
constructor(data) {
|
|
1498
|
+
super(data);
|
|
1499
|
+
this.displayStyle = data.displayStyle;
|
|
1500
|
+
this.minLength = data.minLength;
|
|
1501
|
+
this.maxLength = data.maxLength;
|
|
1502
|
+
this.regex = data.regex;
|
|
1503
|
+
this.needsConfirmation = data.needsConfirmation ?? true;
|
|
1504
|
+
this.confirmationDisplayName = data.confirmationDisplayName ?? 'Confirm Password';
|
|
1505
|
+
this.passwordsDontMatchErrorMessage = data.passwordsDontMatchErrorMessage ?? 'Passwords need to match!';
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* Decorator for setting and getting string Property metadata.
|
|
1511
|
+
*
|
|
1512
|
+
* @param metadata - The metadata of the string property.
|
|
1513
|
+
* @returns The method that defines the metadata.
|
|
1514
|
+
*/
|
|
1515
|
+
function string(metadata) {
|
|
1516
|
+
switch (metadata.displayStyle) {
|
|
1517
|
+
case 'dropdown':
|
|
1518
|
+
return baseProperty(new DropdownStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_DROPDOWN);
|
|
1519
|
+
case 'autocomplete':
|
|
1520
|
+
return baseProperty(new AutocompleteStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_AUTOCOMPLETE);
|
|
1521
|
+
case 'textbox':
|
|
1522
|
+
return baseProperty(new TextboxStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_TEXTBOX);
|
|
1523
|
+
case 'password':
|
|
1524
|
+
return baseProperty(new PasswordStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING_PASSWORD, [EntityUtilities.CONFIRM_PASSWORD_KEY]);
|
|
1525
|
+
default:
|
|
1526
|
+
return baseProperty(new DefaultStringDecoratorConfigInternal(metadata), DecoratorTypes.STRING);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1473
1530
|
/**
|
|
1474
1531
|
* A base Entity class with a builtin id.
|
|
1475
1532
|
*/
|
|
@@ -2290,6 +2347,24 @@ class DateRangeInputComponent extends NgxMatEntityBaseInputComponent {
|
|
|
2290
2347
|
super(...arguments);
|
|
2291
2348
|
this.defaultDateFilter = DateUtilities.defaultDateFilter;
|
|
2292
2349
|
}
|
|
2350
|
+
get dateRange() {
|
|
2351
|
+
return ReflectUtilities.getMetadata(EntityUtilities.DATE_RANGE_KEY, this.entity, this.key);
|
|
2352
|
+
}
|
|
2353
|
+
set dateRange(value) {
|
|
2354
|
+
ReflectUtilities.defineMetadata(EntityUtilities.DATE_RANGE_KEY, value, this.entity, this.key);
|
|
2355
|
+
}
|
|
2356
|
+
get dateRangeStart() {
|
|
2357
|
+
return ReflectUtilities.getMetadata(EntityUtilities.DATE_RANGE_START_KEY, this.entity, this.key);
|
|
2358
|
+
}
|
|
2359
|
+
set dateRangeStart(value) {
|
|
2360
|
+
ReflectUtilities.defineMetadata(EntityUtilities.DATE_RANGE_START_KEY, value, this.entity, this.key);
|
|
2361
|
+
}
|
|
2362
|
+
get dateRangeEnd() {
|
|
2363
|
+
return ReflectUtilities.getMetadata(EntityUtilities.DATE_RANGE_END_KEY, this.entity, this.key);
|
|
2364
|
+
}
|
|
2365
|
+
set dateRangeEnd(value) {
|
|
2366
|
+
ReflectUtilities.defineMetadata(EntityUtilities.DATE_RANGE_END_KEY, value, this.entity, this.key);
|
|
2367
|
+
}
|
|
2293
2368
|
ngOnInit() {
|
|
2294
2369
|
super.ngOnInit();
|
|
2295
2370
|
this.dateRange = LodashUtilities.cloneDeep(this.propertyValue) ?? EMPTY_DATERANGE;
|
|
@@ -2327,6 +2402,12 @@ class DateTimeInputComponent extends NgxMatEntityBaseInputComponent {
|
|
|
2327
2402
|
this.DateUtilities = DateUtilities;
|
|
2328
2403
|
this.defaultDateFilter = () => true;
|
|
2329
2404
|
}
|
|
2405
|
+
get time() {
|
|
2406
|
+
return ReflectUtilities.getMetadata(EntityUtilities.TIME_KEY, this.entity, this.key);
|
|
2407
|
+
}
|
|
2408
|
+
set time(value) {
|
|
2409
|
+
ReflectUtilities.defineMetadata(EntityUtilities.TIME_KEY, value, this.entity, this.key);
|
|
2410
|
+
}
|
|
2330
2411
|
ngOnInit() {
|
|
2331
2412
|
super.ngOnInit();
|
|
2332
2413
|
this.time = DateUtilities.getTimeFromDate(this.propertyValue);
|
|
@@ -2440,6 +2521,12 @@ class FileInputComponent {
|
|
|
2440
2521
|
this.FileUtilities = FileUtilities;
|
|
2441
2522
|
this.fileDataChangeEvent = new EventEmitter();
|
|
2442
2523
|
}
|
|
2524
|
+
get filenames() {
|
|
2525
|
+
return ReflectUtilities.getMetadata(EntityUtilities.FILENAMES_KEY, this.entity, this.key);
|
|
2526
|
+
}
|
|
2527
|
+
set filenames(value) {
|
|
2528
|
+
ReflectUtilities.defineMetadata(EntityUtilities.FILENAMES_KEY, value, this.entity, this.key);
|
|
2529
|
+
}
|
|
2443
2530
|
async ngOnInit() {
|
|
2444
2531
|
if (this.metadata.multiple) {
|
|
2445
2532
|
this.initMultiFile();
|
|
@@ -2587,12 +2674,16 @@ class FileInputComponent {
|
|
|
2587
2674
|
}
|
|
2588
2675
|
}
|
|
2589
2676
|
FileInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: FileInputComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
2590
|
-
FileInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: FileInputComponent, selector: "file-input", inputs: { propertyValue: "propertyValue", metadata: "metadata", getValidationErrorMessage: "getValidationErrorMessage", isReadOnly: "isReadOnly" }, outputs: { fileDataChangeEvent: "fileDataChangeEvent" }, ngImport: i0, template: "<input #fileInput\n type=\"file\" hidden\n [multiple]=\"metadata.multiple\"\n [accept]=\"FileUtilities.getAcceptString(metadata.allowedMimeTypes)\"\n (change)=\"setFileFromInput($event)\"\n>\n\n<mat-form-field floatLabel=\"always\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-grid #chipGrid\n [(ngModel)]=\"filenames\" name=\"file\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip-row *ngFor=\"let name of filenames\" (removed)=\"removeFile(name)\">\n {{name}}\n <span class=\"mat-mdc-chip-remove mat-mdc-chip-trailing-icon ngx-mat-grey\" (click)=\"downloadFile(name)\">\n <i class=\"fas fa-download\"></i>\n </span>\n <button *ngIf=\"!isReadOnly\" type=\"button\" matChipRemove>\n <i class=\"{{metadata.deleteIcon}}\"></i>\n </button>\n </mat-chip-row>\n <input [matChipInputFor]=\"chipGrid\" [readonly]=\"true\" hidden>\n </mat-chip-grid>\n <button *ngIf=\"downloadAllEnabled()\" type=\"button\" class=\"ngx-mat-grey\" mat-icon-button matSuffix (click)=\"downloadAll()\">\n <i class=\"fas fa-file-zipper\"></i>\n </button>\n <button type=\"button\" class=\"ngx-mat-grey\" mat-icon-button matSuffix [disabled]=\"isReadOnly\" (click)=\"fileInput.click()\">\n <i class=\"fas fa-upload\"></i>\n </button>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n</mat-form-field>\n\n<div *ngIf=\"metadata.dragAndDrop && !isReadOnly\" class=\"drag-drop\" dragDrop (files)=\"setFile($event)\">\n <button type=\"button\" mat-icon-button [disabled]=\"isReadOnly\" (click)=\"fileInput.click()\">\n <i class=\"fas fa-file-arrow-up ngx-mat-grey\"></i>\n </button>\n</div>", styles: ["mat-form-field{width:100%}.ngx-mat-grey{opacity:1;color:#0000008a}.drag-drop{display:flex;align-items:center;justify-content:center;height:200px;border:2px dashed rgba(0,0,0,.54);border-radius:15px;margin-top:5px;margin-bottom:5px}.drag-drop i{font-size:30px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5$3.MatChipGrid, selector: "mat-chip-grid", inputs: ["tabIndex", "disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5$3.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5$3.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5$3.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["color", "disabled", "disableRipple", "tabIndex", "editable"], outputs: ["edited"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: DragDropDirective, selector: "[dragDrop]", outputs: ["files"] }] });
|
|
2677
|
+
FileInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: FileInputComponent, selector: "file-input", inputs: { propertyValue: "propertyValue", entity: "entity", key: "key", metadata: "metadata", getValidationErrorMessage: "getValidationErrorMessage", isReadOnly: "isReadOnly" }, outputs: { fileDataChangeEvent: "fileDataChangeEvent" }, ngImport: i0, template: "<input #fileInput\n type=\"file\" hidden\n [multiple]=\"metadata.multiple\"\n [accept]=\"FileUtilities.getAcceptString(metadata.allowedMimeTypes)\"\n (change)=\"setFileFromInput($event)\"\n>\n\n<mat-form-field floatLabel=\"always\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-grid #chipGrid\n [(ngModel)]=\"filenames\" name=\"file\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip-row *ngFor=\"let name of filenames\" (removed)=\"removeFile(name)\">\n {{name}}\n <span class=\"mat-mdc-chip-remove mat-mdc-chip-trailing-icon ngx-mat-grey\" (click)=\"downloadFile(name)\">\n <i class=\"fas fa-download\"></i>\n </span>\n <button *ngIf=\"!isReadOnly\" type=\"button\" matChipRemove>\n <i class=\"{{metadata.deleteIcon}}\"></i>\n </button>\n </mat-chip-row>\n <input [matChipInputFor]=\"chipGrid\" [readonly]=\"true\" hidden>\n </mat-chip-grid>\n <button *ngIf=\"downloadAllEnabled()\" type=\"button\" class=\"ngx-mat-grey\" mat-icon-button matSuffix (click)=\"downloadAll()\">\n <i class=\"fas fa-file-zipper\"></i>\n </button>\n <button type=\"button\" class=\"ngx-mat-grey\" mat-icon-button matSuffix [disabled]=\"isReadOnly\" (click)=\"fileInput.click()\">\n <i class=\"fas fa-upload\"></i>\n </button>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n</mat-form-field>\n\n<div *ngIf=\"metadata.dragAndDrop && !isReadOnly\" class=\"drag-drop\" dragDrop (files)=\"setFile($event)\">\n <button type=\"button\" mat-icon-button [disabled]=\"isReadOnly\" (click)=\"fileInput.click()\">\n <i class=\"fas fa-file-arrow-up ngx-mat-grey\"></i>\n </button>\n</div>", styles: ["mat-form-field{width:100%}.ngx-mat-grey{opacity:1;color:#0000008a}.drag-drop{display:flex;align-items:center;justify-content:center;height:200px;border:2px dashed rgba(0,0,0,.54);border-radius:15px;margin-top:5px;margin-bottom:5px}.drag-drop i{font-size:30px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5$3.MatChipGrid, selector: "mat-chip-grid", inputs: ["tabIndex", "disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5$3.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5$3.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5$3.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["color", "disabled", "disableRipple", "tabIndex", "editable"], outputs: ["edited"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: DragDropDirective, selector: "[dragDrop]", outputs: ["files"] }] });
|
|
2591
2678
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: FileInputComponent, decorators: [{
|
|
2592
2679
|
type: Component,
|
|
2593
2680
|
args: [{ selector: 'file-input', template: "<input #fileInput\n type=\"file\" hidden\n [multiple]=\"metadata.multiple\"\n [accept]=\"FileUtilities.getAcceptString(metadata.allowedMimeTypes)\"\n (change)=\"setFileFromInput($event)\"\n>\n\n<mat-form-field floatLabel=\"always\">\n <mat-label>{{metadata.displayName}}</mat-label>\n <mat-chip-grid #chipGrid\n [(ngModel)]=\"filenames\" name=\"file\" #model=\"ngModel\"\n [required]=\"metadata.required\"\n >\n <mat-chip-row *ngFor=\"let name of filenames\" (removed)=\"removeFile(name)\">\n {{name}}\n <span class=\"mat-mdc-chip-remove mat-mdc-chip-trailing-icon ngx-mat-grey\" (click)=\"downloadFile(name)\">\n <i class=\"fas fa-download\"></i>\n </span>\n <button *ngIf=\"!isReadOnly\" type=\"button\" matChipRemove>\n <i class=\"{{metadata.deleteIcon}}\"></i>\n </button>\n </mat-chip-row>\n <input [matChipInputFor]=\"chipGrid\" [readonly]=\"true\" hidden>\n </mat-chip-grid>\n <button *ngIf=\"downloadAllEnabled()\" type=\"button\" class=\"ngx-mat-grey\" mat-icon-button matSuffix (click)=\"downloadAll()\">\n <i class=\"fas fa-file-zipper\"></i>\n </button>\n <button type=\"button\" class=\"ngx-mat-grey\" mat-icon-button matSuffix [disabled]=\"isReadOnly\" (click)=\"fileInput.click()\">\n <i class=\"fas fa-upload\"></i>\n </button>\n <mat-error>{{getValidationErrorMessage(model)}}</mat-error>\n</mat-form-field>\n\n<div *ngIf=\"metadata.dragAndDrop && !isReadOnly\" class=\"drag-drop\" dragDrop (files)=\"setFile($event)\">\n <button type=\"button\" mat-icon-button [disabled]=\"isReadOnly\" (click)=\"fileInput.click()\">\n <i class=\"fas fa-file-arrow-up ngx-mat-grey\"></i>\n </button>\n</div>", styles: ["mat-form-field{width:100%}.ngx-mat-grey{opacity:1;color:#0000008a}.drag-drop{display:flex;align-items:center;justify-content:center;height:200px;border:2px dashed rgba(0,0,0,.54);border-radius:15px;margin-top:5px;margin-bottom:5px}.drag-drop i{font-size:30px}\n"] }]
|
|
2594
2681
|
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { propertyValue: [{
|
|
2595
2682
|
type: Input
|
|
2683
|
+
}], entity: [{
|
|
2684
|
+
type: Input
|
|
2685
|
+
}], key: [{
|
|
2686
|
+
type: Input
|
|
2596
2687
|
}], metadata: [{
|
|
2597
2688
|
type: Input
|
|
2598
2689
|
}], getValidationErrorMessage: [{
|
|
@@ -2615,10 +2706,10 @@ class FileDefaultInputComponent extends NgxMatEntityBaseInputComponent {
|
|
|
2615
2706
|
}
|
|
2616
2707
|
}
|
|
2617
2708
|
FileDefaultInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: FileDefaultInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2618
|
-
FileDefaultInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: FileDefaultInputComponent, selector: "file-default-input", usesInheritance: true, ngImport: i0, template: "<div [class.file-input]=\"metadata.dragAndDrop\" [class.mat-elevation-z8]=\"metadata.dragAndDrop\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n >\n </file-input>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}\n"], dependencies: [{ kind: "component", type: FileInputComponent, selector: "file-input", inputs: ["propertyValue", "metadata", "getValidationErrorMessage", "isReadOnly"], outputs: ["fileDataChangeEvent"] }] });
|
|
2709
|
+
FileDefaultInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: FileDefaultInputComponent, selector: "file-default-input", usesInheritance: true, ngImport: i0, template: "<div [class.file-input]=\"metadata.dragAndDrop\" [class.mat-elevation-z8]=\"metadata.dragAndDrop\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n [entity]=\"entity\"\n [key]=\"key\"\n >\n </file-input>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}\n"], dependencies: [{ kind: "component", type: FileInputComponent, selector: "file-input", inputs: ["propertyValue", "entity", "key", "metadata", "getValidationErrorMessage", "isReadOnly"], outputs: ["fileDataChangeEvent"] }] });
|
|
2619
2710
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: FileDefaultInputComponent, decorators: [{
|
|
2620
2711
|
type: Component,
|
|
2621
|
-
args: [{ selector: 'file-default-input', template: "<div [class.file-input]=\"metadata.dragAndDrop\" [class.mat-elevation-z8]=\"metadata.dragAndDrop\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n >\n </file-input>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}\n"] }]
|
|
2712
|
+
args: [{ selector: 'file-default-input', template: "<div [class.file-input]=\"metadata.dragAndDrop\" [class.mat-elevation-z8]=\"metadata.dragAndDrop\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n [entity]=\"entity\"\n [key]=\"key\"\n >\n </file-input>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}\n"] }]
|
|
2622
2713
|
}] });
|
|
2623
2714
|
|
|
2624
2715
|
// eslint-disable-next-line max-len
|
|
@@ -2632,6 +2723,18 @@ class FileImageInputComponent extends NgxMatEntityBaseInputComponent {
|
|
|
2632
2723
|
this.imageIndex = 0;
|
|
2633
2724
|
this.placeHolder = placeholder;
|
|
2634
2725
|
}
|
|
2726
|
+
get multiPreviewImages() {
|
|
2727
|
+
return ReflectUtilities.getMetadata(EntityUtilities.MULTI_PREVIEW_IMAGES_KEY, this.entity, this.key);
|
|
2728
|
+
}
|
|
2729
|
+
set multiPreviewImages(value) {
|
|
2730
|
+
ReflectUtilities.defineMetadata(EntityUtilities.MULTI_PREVIEW_IMAGES_KEY, value, this.entity, this.key);
|
|
2731
|
+
}
|
|
2732
|
+
get singlePreviewImage() {
|
|
2733
|
+
return ReflectUtilities.getMetadata(EntityUtilities.SINGLE_PREVIEW_IMAGE_KEY, this.entity, this.key);
|
|
2734
|
+
}
|
|
2735
|
+
set singlePreviewImage(value) {
|
|
2736
|
+
ReflectUtilities.defineMetadata(EntityUtilities.SINGLE_PREVIEW_IMAGE_KEY, value, this.entity, this.key);
|
|
2737
|
+
}
|
|
2635
2738
|
async setSinglePreviewImage() {
|
|
2636
2739
|
if (this.propertyValue) {
|
|
2637
2740
|
this.propertyValue = await FileUtilities.getFileData(this.propertyValue);
|
|
@@ -2694,10 +2797,10 @@ class FileImageInputComponent extends NgxMatEntityBaseInputComponent {
|
|
|
2694
2797
|
}
|
|
2695
2798
|
}
|
|
2696
2799
|
FileImageInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: FileImageInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2697
|
-
FileImageInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: FileImageInputComponent, selector: "file-image-input", usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"!metadata.dragAndDrop && !metadata.preview\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n >\n </file-input>\n</div>\n\n<div *ngIf=\"metadata.dragAndDrop || metadata.preview\" class=\"file-input mat-elevation-z8\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n >\n </file-input>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && metadata.multiple\">\n <i (click)=\"prev()\" [class.disabled]=\"imageIndex === 0\" class=\"prev-button fa-solid fa-angle-left\"></i>\n <img *ngIf=\"multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"multiPreviewImages?.[imageIndex]\">\n <img *ngIf=\"!multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"metadata.previewPlaceholderUrl ?? placeHolder\">\n <i (click)=\"next()\"\n [class.disabled]=\"!multiPreviewImages || !multiPreviewImages.length || imageIndex === (multiPreviewImages.length - 1)\"\n class=\"next-button fa-solid fa-angle-right\"\n >\n </i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && metadata.multiple\">\n <button type=\"button\" (click)=\"setIndex(imageIndex-4)\" mat-icon-button *ngIf=\"\n this.multiPreviewImages\n && multiPreviewImages[imageIndex-4]\n && imageIndex === (this.multiPreviewImages.length - 1)\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 3}}</span>\n </button>\n <!-- eslint-disable-next-line @angular-eslint/template/conditional-complexity -->\n <button type=\"button\" (click)=\"setIndex(imageIndex-3)\" mat-icon-button *ngIf=\"this.multiPreviewImages\n && multiPreviewImages[imageIndex-3]\n && (\n imageIndex === (this.multiPreviewImages.length - 2)\n || imageIndex === (this.multiPreviewImages.length - 1)\n )\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-1]\">\n <i class=\"dot\"></i>\n <span class=\"image-index\">{{imageIndex}}</span>\n </button>\n <button type=\"button\" mat-icon-button disabled>\n <i class=\"dot selected\"></i>\n <span class=\"image-index\">{{imageIndex + 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+1]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 3}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+3)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+3] && imageIndex <= 1\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 4}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+4)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+4] && imageIndex === 0\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 5}}</span>\n </button>\n </div>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <i class=\"prev-button disabled fa-solid fa-angle-left\"></i>\n <img class=\"mat-elevation-z2\" [src]=\"singlePreviewImage ?? metadata.previewPlaceholderUrl ?? placeHolder\">\n <i class=\"next-button disabled fa-solid fa-angle-right\"></i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <button type=\"button\" disabled mat-icon-button>\n <span class=\"dot selected\"></span>\n <span class=\"image-index\">1</span>\n </button>\n </div>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}.image-preview{height:250px;display:flex;align-items:center;padding-top:15px;padding-bottom:15px}.image-preview .prev-button{font-size:100px;margin-left:5px;color:#0000008a}.image-preview .next-button{font-size:100px;margin-right:5px;color:#0000008a}.image-preview .prev-button:hover,.image-preview .next-button:hover{cursor:pointer;color:#000000b3;transition:all .5s ease}.image-preview .prev-button.disabled,.image-preview .next-button.disabled{color:#00000042}.image-preview .prev-button.disabled:hover,.image-preview .next-button.disabled:hover{color:#00000042;transition:none;cursor:default}.image-preview img{max-width:calc(100% - 100px);max-height:100%;margin-left:auto;margin-right:auto;border-radius:3px}.preview-nav{text-align:center}.preview-nav button{display:inline-block;width:18px;height:18px;margin-left:5px;margin-right:5px}.preview-nav button .dot{height:100%;width:100%;background-color:#00000061;border-radius:50%;display:block}.preview-nav button .dot.selected{background-color:#0000008a}.preview-nav button .image-index{position:absolute;height:100%;width:100%;display:block;top:-11.5px;color:#fff}.preview-nav button:hover .dot{background-color:#0000008a;transition:all .3s ease}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: FileInputComponent, selector: "file-input", inputs: ["propertyValue", "metadata", "getValidationErrorMessage", "isReadOnly"], outputs: ["fileDataChangeEvent"] }] });
|
|
2800
|
+
FileImageInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: FileImageInputComponent, selector: "file-image-input", usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"!metadata.dragAndDrop && !metadata.preview\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n [entity]=\"entity\"\n [key]=\"key\"\n >\n </file-input>\n</div>\n\n<div *ngIf=\"metadata.dragAndDrop || metadata.preview\" class=\"file-input mat-elevation-z8\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n [entity]=\"entity\"\n [key]=\"key\"\n >\n </file-input>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && metadata.multiple\">\n <i (click)=\"prev()\" [class.disabled]=\"imageIndex === 0\" class=\"prev-button fa-solid fa-angle-left\"></i>\n <img *ngIf=\"multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"multiPreviewImages?.[imageIndex]\">\n <img *ngIf=\"!multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"metadata.previewPlaceholderUrl ?? placeHolder\">\n <i (click)=\"next()\"\n [class.disabled]=\"!multiPreviewImages || !multiPreviewImages.length || imageIndex === (multiPreviewImages.length - 1)\"\n class=\"next-button fa-solid fa-angle-right\"\n >\n </i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && metadata.multiple\">\n <button type=\"button\" (click)=\"setIndex(imageIndex-4)\" mat-icon-button *ngIf=\"\n this.multiPreviewImages\n && multiPreviewImages[imageIndex-4]\n && imageIndex === (this.multiPreviewImages.length - 1)\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 3}}</span>\n </button>\n <!-- eslint-disable-next-line @angular-eslint/template/conditional-complexity -->\n <button type=\"button\" (click)=\"setIndex(imageIndex-3)\" mat-icon-button *ngIf=\"this.multiPreviewImages\n && multiPreviewImages[imageIndex-3]\n && (\n imageIndex === (this.multiPreviewImages.length - 2)\n || imageIndex === (this.multiPreviewImages.length - 1)\n )\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-1]\">\n <i class=\"dot\"></i>\n <span class=\"image-index\">{{imageIndex}}</span>\n </button>\n <button type=\"button\" mat-icon-button disabled>\n <i class=\"dot selected\"></i>\n <span class=\"image-index\">{{imageIndex + 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+1]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 3}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+3)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+3] && imageIndex <= 1\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 4}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+4)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+4] && imageIndex === 0\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 5}}</span>\n </button>\n </div>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <i class=\"prev-button disabled fa-solid fa-angle-left\"></i>\n <img class=\"mat-elevation-z2\" [src]=\"singlePreviewImage ?? metadata.previewPlaceholderUrl ?? placeHolder\">\n <i class=\"next-button disabled fa-solid fa-angle-right\"></i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <button type=\"button\" disabled mat-icon-button>\n <span class=\"dot selected\"></span>\n <span class=\"image-index\">1</span>\n </button>\n </div>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}.image-preview{height:250px;display:flex;align-items:center;padding-top:15px;padding-bottom:15px}.image-preview .prev-button{font-size:100px;margin-left:5px;color:#0000008a}.image-preview .next-button{font-size:100px;margin-right:5px;color:#0000008a}.image-preview .prev-button:hover,.image-preview .next-button:hover{cursor:pointer;color:#000000b3;transition:all .5s ease}.image-preview .prev-button.disabled,.image-preview .next-button.disabled{color:#00000042}.image-preview .prev-button.disabled:hover,.image-preview .next-button.disabled:hover{color:#00000042;transition:none;cursor:default}.image-preview img{max-width:calc(100% - 100px);max-height:100%;margin-left:auto;margin-right:auto;border-radius:3px}.preview-nav{text-align:center}.preview-nav button{display:inline-block;width:18px;height:18px;margin-left:5px;margin-right:5px}.preview-nav button .dot{height:100%;width:100%;background-color:#00000061;border-radius:50%;display:block}.preview-nav button .dot.selected{background-color:#0000008a}.preview-nav button .image-index{position:absolute;height:100%;width:100%;display:block;top:-11.5px;color:#fff}.preview-nav button:hover .dot{background-color:#0000008a;transition:all .3s ease}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: FileInputComponent, selector: "file-input", inputs: ["propertyValue", "entity", "key", "metadata", "getValidationErrorMessage", "isReadOnly"], outputs: ["fileDataChangeEvent"] }] });
|
|
2698
2801
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: FileImageInputComponent, decorators: [{
|
|
2699
2802
|
type: Component,
|
|
2700
|
-
args: [{ selector: 'file-image-input', template: "<div *ngIf=\"!metadata.dragAndDrop && !metadata.preview\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n >\n </file-input>\n</div>\n\n<div *ngIf=\"metadata.dragAndDrop || metadata.preview\" class=\"file-input mat-elevation-z8\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n >\n </file-input>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && metadata.multiple\">\n <i (click)=\"prev()\" [class.disabled]=\"imageIndex === 0\" class=\"prev-button fa-solid fa-angle-left\"></i>\n <img *ngIf=\"multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"multiPreviewImages?.[imageIndex]\">\n <img *ngIf=\"!multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"metadata.previewPlaceholderUrl ?? placeHolder\">\n <i (click)=\"next()\"\n [class.disabled]=\"!multiPreviewImages || !multiPreviewImages.length || imageIndex === (multiPreviewImages.length - 1)\"\n class=\"next-button fa-solid fa-angle-right\"\n >\n </i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && metadata.multiple\">\n <button type=\"button\" (click)=\"setIndex(imageIndex-4)\" mat-icon-button *ngIf=\"\n this.multiPreviewImages\n && multiPreviewImages[imageIndex-4]\n && imageIndex === (this.multiPreviewImages.length - 1)\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 3}}</span>\n </button>\n <!-- eslint-disable-next-line @angular-eslint/template/conditional-complexity -->\n <button type=\"button\" (click)=\"setIndex(imageIndex-3)\" mat-icon-button *ngIf=\"this.multiPreviewImages\n && multiPreviewImages[imageIndex-3]\n && (\n imageIndex === (this.multiPreviewImages.length - 2)\n || imageIndex === (this.multiPreviewImages.length - 1)\n )\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-1]\">\n <i class=\"dot\"></i>\n <span class=\"image-index\">{{imageIndex}}</span>\n </button>\n <button type=\"button\" mat-icon-button disabled>\n <i class=\"dot selected\"></i>\n <span class=\"image-index\">{{imageIndex + 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+1]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 3}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+3)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+3] && imageIndex <= 1\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 4}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+4)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+4] && imageIndex === 0\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 5}}</span>\n </button>\n </div>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <i class=\"prev-button disabled fa-solid fa-angle-left\"></i>\n <img class=\"mat-elevation-z2\" [src]=\"singlePreviewImage ?? metadata.previewPlaceholderUrl ?? placeHolder\">\n <i class=\"next-button disabled fa-solid fa-angle-right\"></i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <button type=\"button\" disabled mat-icon-button>\n <span class=\"dot selected\"></span>\n <span class=\"image-index\">1</span>\n </button>\n </div>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}.image-preview{height:250px;display:flex;align-items:center;padding-top:15px;padding-bottom:15px}.image-preview .prev-button{font-size:100px;margin-left:5px;color:#0000008a}.image-preview .next-button{font-size:100px;margin-right:5px;color:#0000008a}.image-preview .prev-button:hover,.image-preview .next-button:hover{cursor:pointer;color:#000000b3;transition:all .5s ease}.image-preview .prev-button.disabled,.image-preview .next-button.disabled{color:#00000042}.image-preview .prev-button.disabled:hover,.image-preview .next-button.disabled:hover{color:#00000042;transition:none;cursor:default}.image-preview img{max-width:calc(100% - 100px);max-height:100%;margin-left:auto;margin-right:auto;border-radius:3px}.preview-nav{text-align:center}.preview-nav button{display:inline-block;width:18px;height:18px;margin-left:5px;margin-right:5px}.preview-nav button .dot{height:100%;width:100%;background-color:#00000061;border-radius:50%;display:block}.preview-nav button .dot.selected{background-color:#0000008a}.preview-nav button .image-index{position:absolute;height:100%;width:100%;display:block;top:-11.5px;color:#fff}.preview-nav button:hover .dot{background-color:#0000008a;transition:all .3s ease}\n"] }]
|
|
2803
|
+
args: [{ selector: 'file-image-input', template: "<div *ngIf=\"!metadata.dragAndDrop && !metadata.preview\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n [entity]=\"entity\"\n [key]=\"key\"\n >\n </file-input>\n</div>\n\n<div *ngIf=\"metadata.dragAndDrop || metadata.preview\" class=\"file-input mat-elevation-z8\">\n <file-input\n (fileDataChangeEvent)=\"refreshFileData($event)\"\n [propertyValue]=\"propertyValue\"\n [metadata]=\"metadata\"\n [getValidationErrorMessage]=\"getValidationErrorMessage\"\n [isReadOnly]=\"isReadOnly\"\n [entity]=\"entity\"\n [key]=\"key\"\n >\n </file-input>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && metadata.multiple\">\n <i (click)=\"prev()\" [class.disabled]=\"imageIndex === 0\" class=\"prev-button fa-solid fa-angle-left\"></i>\n <img *ngIf=\"multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"multiPreviewImages?.[imageIndex]\">\n <img *ngIf=\"!multiPreviewImages?.[imageIndex]\" class=\"mat-elevation-z2\" [src]=\"metadata.previewPlaceholderUrl ?? placeHolder\">\n <i (click)=\"next()\"\n [class.disabled]=\"!multiPreviewImages || !multiPreviewImages.length || imageIndex === (multiPreviewImages.length - 1)\"\n class=\"next-button fa-solid fa-angle-right\"\n >\n </i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && metadata.multiple\">\n <button type=\"button\" (click)=\"setIndex(imageIndex-4)\" mat-icon-button *ngIf=\"\n this.multiPreviewImages\n && multiPreviewImages[imageIndex-4]\n && imageIndex === (this.multiPreviewImages.length - 1)\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 3}}</span>\n </button>\n <!-- eslint-disable-next-line @angular-eslint/template/conditional-complexity -->\n <button type=\"button\" (click)=\"setIndex(imageIndex-3)\" mat-icon-button *ngIf=\"this.multiPreviewImages\n && multiPreviewImages[imageIndex-3]\n && (\n imageIndex === (this.multiPreviewImages.length - 2)\n || imageIndex === (this.multiPreviewImages.length - 1)\n )\"\n >\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex - 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex-1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex-1]\">\n <i class=\"dot\"></i>\n <span class=\"image-index\">{{imageIndex}}</span>\n </button>\n <button type=\"button\" mat-icon-button disabled>\n <i class=\"dot selected\"></i>\n <span class=\"image-index\">{{imageIndex + 1}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+1)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+1]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 2}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+2)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+2]\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 3}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+3)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+3] && imageIndex <= 1\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 4}}</span>\n </button>\n <button type=\"button\" (click)=\"setIndex(imageIndex+4)\" mat-icon-button *ngIf=\"multiPreviewImages?.[imageIndex+4] && imageIndex === 0\">\n <span class=\"dot\"></span>\n <span class=\"image-index\">{{imageIndex + 5}}</span>\n </button>\n </div>\n\n <div class=\"image-preview\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <i class=\"prev-button disabled fa-solid fa-angle-left\"></i>\n <img class=\"mat-elevation-z2\" [src]=\"singlePreviewImage ?? metadata.previewPlaceholderUrl ?? placeHolder\">\n <i class=\"next-button disabled fa-solid fa-angle-right\"></i>\n </div>\n <div class=\"preview-nav\" *ngIf=\"metadata.preview && !metadata.multiple\">\n <button type=\"button\" disabled mat-icon-button>\n <span class=\"dot selected\"></span>\n <span class=\"image-index\">1</span>\n </button>\n </div>\n</div>", styles: [".file-input{margin-top:15px;margin-bottom:15px;padding:15px;border-radius:5px}.image-preview{height:250px;display:flex;align-items:center;padding-top:15px;padding-bottom:15px}.image-preview .prev-button{font-size:100px;margin-left:5px;color:#0000008a}.image-preview .next-button{font-size:100px;margin-right:5px;color:#0000008a}.image-preview .prev-button:hover,.image-preview .next-button:hover{cursor:pointer;color:#000000b3;transition:all .5s ease}.image-preview .prev-button.disabled,.image-preview .next-button.disabled{color:#00000042}.image-preview .prev-button.disabled:hover,.image-preview .next-button.disabled:hover{color:#00000042;transition:none;cursor:default}.image-preview img{max-width:calc(100% - 100px);max-height:100%;margin-left:auto;margin-right:auto;border-radius:3px}.preview-nav{text-align:center}.preview-nav button{display:inline-block;width:18px;height:18px;margin-left:5px;margin-right:5px}.preview-nav button .dot{height:100%;width:100%;background-color:#00000061;border-radius:50%;display:block}.preview-nav button .dot.selected{background-color:#0000008a}.preview-nav button .image-index{position:absolute;height:100%;width:100%;display:block;top:-11.5px;color:#fff}.preview-nav button:hover .dot{background-color:#0000008a;transition:all .3s ease}\n"] }]
|
|
2701
2804
|
}] });
|
|
2702
2805
|
|
|
2703
2806
|
const NGX_GET_VALIDATION_ERROR_MESSAGE = new InjectionToken('Provider for the default getValidationErrorMessage.', {
|
|
@@ -2865,15 +2968,19 @@ class StringPasswordInputComponent extends NgxMatEntityBaseInputComponent {
|
|
|
2865
2968
|
this.hide = true;
|
|
2866
2969
|
this.hideConfirm = true;
|
|
2867
2970
|
}
|
|
2971
|
+
get confirmPassword() {
|
|
2972
|
+
return ReflectUtilities.getMetadata(EntityUtilities.CONFIRM_PASSWORD_KEY, this.entity, this.key);
|
|
2973
|
+
}
|
|
2974
|
+
set confirmPassword(value) {
|
|
2975
|
+
ReflectUtilities.defineMetadata(EntityUtilities.CONFIRM_PASSWORD_KEY, value, this.entity, this.key);
|
|
2976
|
+
}
|
|
2868
2977
|
ngOnInit() {
|
|
2869
2978
|
super.ngOnInit();
|
|
2870
2979
|
this.confirmRequired = this.metadata.required;
|
|
2871
2980
|
this.confirmPassword = LodashUtilities.cloneDeep(this.propertyValue);
|
|
2872
|
-
ReflectUtilities.defineMetadata('confirmPassword', this.confirmPassword, this.entity, this.key);
|
|
2873
2981
|
}
|
|
2874
2982
|
passwordInput() {
|
|
2875
2983
|
this.confirmRequired = Boolean(this.propertyValue);
|
|
2876
|
-
ReflectUtilities.defineMetadata('confirmPassword', this.confirmPassword, this.entity, this.key);
|
|
2877
2984
|
this.emitChange();
|
|
2878
2985
|
}
|
|
2879
2986
|
}
|
|
@@ -4266,10 +4373,10 @@ function date(metadata) {
|
|
|
4266
4373
|
return baseProperty(new DefaultDateDecoratorConfigInternal(metadata), DecoratorTypes.DATE);
|
|
4267
4374
|
}
|
|
4268
4375
|
else if (metadata.displayStyle === 'datetime') {
|
|
4269
|
-
return baseProperty(new DateTimeDateDecoratorConfigInternal(metadata), DecoratorTypes.DATE_TIME);
|
|
4376
|
+
return baseProperty(new DateTimeDateDecoratorConfigInternal(metadata), DecoratorTypes.DATE_TIME, [EntityUtilities.TIME_KEY]);
|
|
4270
4377
|
}
|
|
4271
4378
|
else {
|
|
4272
|
-
return baseProperty(new DateRangeDateDecoratorConfigInternal(metadata), DecoratorTypes.DATE_RANGE);
|
|
4379
|
+
return baseProperty(new DateRangeDateDecoratorConfigInternal(metadata), DecoratorTypes.DATE_RANGE, [EntityUtilities.DATE_RANGE_END_KEY, EntityUtilities.DATE_RANGE_KEY, EntityUtilities.DATE_RANGE_START_KEY]);
|
|
4273
4380
|
}
|
|
4274
4381
|
}
|
|
4275
4382
|
|
|
@@ -4525,9 +4632,9 @@ function getDefaultMaxSizeTotalErrorDialogData(data) {
|
|
|
4525
4632
|
function file(metadata) {
|
|
4526
4633
|
switch (metadata.type) {
|
|
4527
4634
|
case 'other':
|
|
4528
|
-
return baseProperty(new DefaultFileDecoratorConfigInternal(metadata), DecoratorTypes.FILE_DEFAULT);
|
|
4635
|
+
return baseProperty(new DefaultFileDecoratorConfigInternal(metadata), DecoratorTypes.FILE_DEFAULT, [EntityUtilities.FILENAMES_KEY]);
|
|
4529
4636
|
case 'image':
|
|
4530
|
-
return baseProperty(new ImageFileDecoratorConfigInternal(metadata), DecoratorTypes.FILE_IMAGE);
|
|
4637
|
+
return baseProperty(new ImageFileDecoratorConfigInternal(metadata), DecoratorTypes.FILE_IMAGE, [EntityUtilities.FILENAMES_KEY, EntityUtilities.MULTI_PREVIEW_IMAGES_KEY, EntityUtilities.SINGLE_PREVIEW_IMAGE_KEY]);
|
|
4531
4638
|
default:
|
|
4532
4639
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
4533
4640
|
throw new Error(`Unknown metadata type ${metadata.type}`);
|
|
@@ -4568,10 +4675,11 @@ class CustomDecoratorConfigInternal extends PropertyDecoratorConfigInternal {
|
|
|
4568
4675
|
* Decorator for setting and getting custom property metadata.
|
|
4569
4676
|
*
|
|
4570
4677
|
* @param metadata - The metadata of the custom property.
|
|
4678
|
+
* @param metadataKeysToReset - Any metadata keys which values should be set to undefined on reset.
|
|
4571
4679
|
* @returns The method that defines the metadata.
|
|
4572
4680
|
*/
|
|
4573
|
-
function custom(metadata) {
|
|
4574
|
-
return baseProperty(new CustomDecoratorConfigInternal(metadata), DecoratorTypes.CUSTOM);
|
|
4681
|
+
function custom(metadata, metadataKeysToReset) {
|
|
4682
|
+
return baseProperty(new CustomDecoratorConfigInternal(metadata), DecoratorTypes.CUSTOM, metadataKeysToReset);
|
|
4575
4683
|
}
|
|
4576
4684
|
|
|
4577
4685
|
/**
|