ngx-material-entity 16.0.2 → 16.0.4

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.
Files changed (139) hide show
  1. package/classes/base.builder.d.ts +6 -1
  2. package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +2 -1
  3. package/components/confirm-dialog/confirm-dialog.component.d.ts +3 -1
  4. package/components/edit-page/edit-page.component.d.ts +15 -2
  5. package/components/edit-page/page-edit-data.builder.d.ts +2 -1
  6. package/components/input/array/array-date-input/array-date-input.component.d.ts +7 -1
  7. package/components/input/array/array-date-range-input/array-date-range-input.component.d.ts +6 -1
  8. package/components/input/array/array-date-time-input/array-date-time-input.component.d.ts +6 -1
  9. package/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.d.ts +1 -0
  10. package/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.d.ts +4 -0
  11. package/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.d.ts +2 -1
  12. package/components/input/date/date-range-input/date-range-input.component.d.ts +3 -0
  13. package/components/input/date/date-time-input/date-time-input.component.d.ts +3 -0
  14. package/components/input/input.component.d.ts +10 -3
  15. package/components/input/input.module.d.ts +6 -2
  16. package/components/input/number/number-slider-input/number-slider-input.component.d.ts +2 -1
  17. package/components/input/relations/references-many-input/references-many-input.component.d.ts +3 -1
  18. package/components/table/create-dialog/create-dialog-data.builder.d.ts +2 -1
  19. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +2 -1
  20. package/components/table/create-dialog/create-entity-dialog.component.d.ts +6 -1
  21. package/components/table/edit-dialog/edit-data.builder.d.ts +5 -3
  22. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +7 -1
  23. package/components/table/edit-dialog/edit-entity.builder.d.ts +2 -1
  24. package/components/table/table-data.builder.d.ts +9 -5
  25. package/components/table/table.component.d.ts +3 -1
  26. package/components/tooltip/tooltip.component.d.ts +9 -0
  27. package/decorators/array/array-decorator-internal.data.d.ts +14 -13
  28. package/decorators/array/array-decorator.data.d.ts +7 -7
  29. package/decorators/base/property-decorator-internal.data.d.ts +11 -2
  30. package/decorators/base/property-decorator.data.d.ts +9 -1
  31. package/decorators/boolean/boolean-decorator-internal.data.d.ts +5 -4
  32. package/decorators/boolean/boolean-decorator.data.d.ts +1 -1
  33. package/decorators/custom/custom-decorator-internal.data.d.ts +2 -2
  34. package/decorators/custom/custom-decorator.data.d.ts +4 -4
  35. package/decorators/date/date-decorator-internal.data.d.ts +7 -6
  36. package/decorators/date/date-decorator.data.d.ts +5 -5
  37. package/decorators/file/file-decorator-internal.data.d.ts +3 -3
  38. package/decorators/file/file-decorator.data.d.ts +1 -1
  39. package/decorators/has-many/has-many-decorator-internal.data.d.ts +3 -2
  40. package/decorators/has-many/has-many-decorator.data.d.ts +1 -1
  41. package/decorators/number/number-decorator-internal.data.d.ts +3 -3
  42. package/decorators/number/number-decorator.data.d.ts +1 -1
  43. package/decorators/object/object-decorator-internal.data.d.ts +1 -1
  44. package/decorators/object/object-decorator.data.d.ts +1 -1
  45. package/decorators/references-many/references-many-decorator-internal.data.d.ts +3 -2
  46. package/decorators/references-many/references-many-decorator.data.d.ts +1 -1
  47. package/decorators/references-one/references-one-decorator-internal.data.d.ts +1 -1
  48. package/decorators/references-one/references-one-decorator.data.d.ts +1 -1
  49. package/decorators/string/string-decorator-internal.data.d.ts +5 -6
  50. package/decorators/string/string-decorator.data.d.ts +1 -7
  51. package/default-global-configuration-values.d.ts +6 -0
  52. package/directives/number.directive.d.ts +17 -0
  53. package/directives/password-match.directive.d.ts +14 -0
  54. package/directives/tooltip.directive.d.ts +32 -0
  55. package/esm2022/classes/base.builder.mjs +9 -3
  56. package/esm2022/components/confirm-dialog/confirm-dialog-data.builder.mjs +7 -5
  57. package/esm2022/components/confirm-dialog/confirm-dialog.component.mjs +13 -7
  58. package/esm2022/components/edit-page/edit-page.component.mjs +75 -25
  59. package/esm2022/components/edit-page/page-edit-data.builder.mjs +9 -9
  60. package/esm2022/components/input/array/array-date-input/array-date-input.component.mjs +33 -13
  61. package/esm2022/components/input/array/array-date-range-input/array-date-range-input.component.mjs +29 -12
  62. package/esm2022/components/input/array/array-date-time-input/array-date-time-input.component.mjs +32 -15
  63. package/esm2022/components/input/base-input.component.mjs +2 -1
  64. package/esm2022/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.mjs +6 -3
  65. package/esm2022/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.mjs +18 -4
  66. package/esm2022/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.mjs +6 -3
  67. package/esm2022/components/input/date/date-range-input/date-range-input.component.mjs +18 -4
  68. package/esm2022/components/input/date/date-time-input/date-time-input.component.mjs +17 -5
  69. package/esm2022/components/input/file/file-image-input/file-image-input.component.mjs +3 -3
  70. package/esm2022/components/input/file/file-input/file-input.component.mjs +1 -1
  71. package/esm2022/components/input/input.component.mjs +91 -61
  72. package/esm2022/components/input/input.module.mjs +18 -5
  73. package/esm2022/components/input/number/number-input/number-input.component.mjs +4 -3
  74. package/esm2022/components/input/number/number-slider-input/number-slider-input.component.mjs +6 -3
  75. package/esm2022/components/input/relations/references-many-input/references-many-input.component.mjs +15 -5
  76. package/esm2022/components/input/string/string-password-input/string-password-input.component.mjs +4 -3
  77. package/esm2022/components/table/create-dialog/create-dialog-data.builder.mjs +10 -8
  78. package/esm2022/components/table/create-dialog/create-entity-dialog-data.builder.mjs +5 -4
  79. package/esm2022/components/table/create-dialog/create-entity-dialog.component.mjs +32 -14
  80. package/esm2022/components/table/edit-dialog/edit-data.builder.mjs +35 -21
  81. package/esm2022/components/table/edit-dialog/edit-entity-dialog.component.mjs +46 -25
  82. package/esm2022/components/table/edit-dialog/edit-entity.builder.mjs +4 -4
  83. package/esm2022/components/table/table-data.builder.mjs +54 -30
  84. package/esm2022/components/table/table.component.mjs +24 -15
  85. package/esm2022/components/tooltip/tooltip.component.mjs +20 -0
  86. package/esm2022/decorators/array/array-decorator-internal.data.mjs +42 -43
  87. package/esm2022/decorators/array/array-decorator.data.mjs +1 -1
  88. package/esm2022/decorators/array/array.decorator.mjs +8 -7
  89. package/esm2022/decorators/base/property-decorator-internal.data.mjs +25 -4
  90. package/esm2022/decorators/base/property-decorator.data.mjs +10 -1
  91. package/esm2022/decorators/boolean/boolean-decorator-internal.data.mjs +5 -4
  92. package/esm2022/decorators/boolean/boolean-decorator.data.mjs +1 -1
  93. package/esm2022/decorators/boolean/boolean.decorator.mjs +3 -2
  94. package/esm2022/decorators/custom/custom-decorator-internal.data.mjs +2 -2
  95. package/esm2022/decorators/custom/custom-decorator.data.mjs +1 -1
  96. package/esm2022/decorators/date/date-decorator-internal.data.mjs +8 -6
  97. package/esm2022/decorators/date/date-decorator.data.mjs +1 -1
  98. package/esm2022/decorators/date/date.decorator.mjs +4 -3
  99. package/esm2022/decorators/file/file-decorator-internal.data.mjs +1 -1
  100. package/esm2022/decorators/file/file-decorator.data.mjs +1 -1
  101. package/esm2022/decorators/has-many/has-many-decorator-internal.data.mjs +4 -4
  102. package/esm2022/decorators/has-many/has-many-decorator.data.mjs +1 -1
  103. package/esm2022/decorators/has-many/has-many.decorator.mjs +3 -2
  104. package/esm2022/decorators/number/number-decorator-internal.data.mjs +1 -1
  105. package/esm2022/decorators/number/number-decorator.data.mjs +1 -1
  106. package/esm2022/decorators/object/object-decorator-internal.data.mjs +1 -1
  107. package/esm2022/decorators/object/object-decorator.data.mjs +1 -1
  108. package/esm2022/decorators/references-many/references-many-decorator-internal.data.mjs +7 -6
  109. package/esm2022/decorators/references-many/references-many-decorator.data.mjs +1 -1
  110. package/esm2022/decorators/references-many/references-many.decorator.mjs +3 -2
  111. package/esm2022/decorators/references-one/references-one-decorator-internal.data.mjs +1 -1
  112. package/esm2022/decorators/references-one/references-one-decorator.data.mjs +1 -1
  113. package/esm2022/decorators/string/string-decorator-internal.data.mjs +1 -4
  114. package/esm2022/decorators/string/string-decorator.data.mjs +1 -1
  115. package/esm2022/default-global-configuration-values.mjs +89 -0
  116. package/esm2022/directives/drag-drop.directive.mjs +62 -0
  117. package/esm2022/directives/number.directive.mjs +38 -0
  118. package/esm2022/directives/password-match.directive.mjs +30 -0
  119. package/esm2022/directives/tooltip.directive.mjs +106 -0
  120. package/esm2022/functions/get-config-value.function.mjs +15 -0
  121. package/esm2022/functions/get-validation-error-message.function.mjs +49 -0
  122. package/esm2022/functions/get-validation-errors-tooltip-content.function.ts.mjs +21 -0
  123. package/esm2022/global-configuration-values.mjs +10 -0
  124. package/esm2022/public-api.mjs +8 -2
  125. package/esm2022/utilities/entity.utilities.mjs +80 -405
  126. package/esm2022/utilities/validation.utilities.mjs +455 -0
  127. package/fesm2022/ngx-material-entity.mjs +2119 -1412
  128. package/fesm2022/ngx-material-entity.mjs.map +1 -1
  129. package/functions/get-config-value.function.d.ts +8 -0
  130. package/functions/get-validation-errors-tooltip-content.function.ts.d.ts +10 -0
  131. package/global-configuration-values.d.ts +216 -0
  132. package/package.json +1 -1
  133. package/public-api.d.ts +5 -1
  134. package/utilities/entity.utilities.d.ts +30 -34
  135. package/utilities/validation.utilities.d.ts +56 -0
  136. package/esm2022/components/get-validation-error-message.function.mjs +0 -42
  137. package/esm2022/components/input/file/file-input/dragDrop.directive.mjs +0 -62
  138. /package/{components/input/file/file-input/dragDrop.directive.d.ts → directives/drag-drop.directive.d.ts} +0 -0
  139. /package/{components → functions}/get-validation-error-message.function.d.ts +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Gets either the provided value or the default value, depending on if and what has been provided.
3
+ *
4
+ * @param defaultValue - The default value to fallback when nothing has been provided.
5
+ * @param value - The specific value configured by the user.
6
+ * @returns Value if it is not null and not the CONFIG_NEEDS_UPDATE_KEY, defaultValue otherwise.
7
+ */
8
+ export declare function getConfigValue<ValueType>(defaultValue: ValueType, value?: ValueType): ValueType;
@@ -0,0 +1,10 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ValidationError } from '../utilities/validation.utilities';
3
+ export declare const NGX_VALIDATION_ERRORS_TOOLTIP_TITLE: InjectionToken<string>;
4
+ /**
5
+ * The default function that gets the validation errors tooltip content.
6
+ *
7
+ * @param validationErrors - All validation errors for which the tooltip content should be generated.
8
+ * @returns A html string, containing a list of the name of each invalid property.
9
+ */
10
+ export declare function getValidationErrorsTooltipContent(validationErrors: ValidationError[]): string;
@@ -0,0 +1,216 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * All configurable default values.
4
+ */
5
+ export interface NgxGlobalDefaultValues {
6
+ /**
7
+ * The label for create buttons.
8
+ *
9
+ * @default 'Create'
10
+ */
11
+ createLabel: string;
12
+ /**
13
+ * The label for edit buttons.
14
+ *
15
+ * @default 'Edit'
16
+ */
17
+ editLabel: string;
18
+ /**
19
+ * The label for save buttons.
20
+ *
21
+ * @default 'Save'
22
+ */
23
+ saveLabel: string;
24
+ /**
25
+ * The label for cancel buttons.
26
+ *
27
+ * @default 'Cancel'
28
+ */
29
+ cancelLabel: string;
30
+ /**
31
+ * The label for add buttons.
32
+ *
33
+ * @default 'Add'
34
+ */
35
+ addLabel: string;
36
+ /**
37
+ * The label for delete buttons.
38
+ *
39
+ * @default 'Delete'
40
+ */
41
+ deleteLabel: string;
42
+ /**
43
+ * The label for back buttons.
44
+ *
45
+ * @default 'Back'
46
+ */
47
+ backLabel: string;
48
+ /**
49
+ * The label for actions.
50
+ *
51
+ * @default 'Actions'
52
+ */
53
+ actionsLabel: string;
54
+ /**
55
+ * The label for searches.
56
+ *
57
+ * @default 'Search'
58
+ */
59
+ searchLabel: string;
60
+ /**
61
+ * The display value for the "true" value in dropdowns.
62
+ *
63
+ * @default 'Yes'
64
+ */
65
+ dropdownTrue: string;
66
+ /**
67
+ * The display value for the "false" value in dropdowns.
68
+ *
69
+ * @default 'No'
70
+ */
71
+ dropdownFalse: string;
72
+ /**
73
+ * The label for confirm buttons.
74
+ *
75
+ * @default 'Confirm'
76
+ */
77
+ confirmLabel: string;
78
+ /**
79
+ * The title for a confirm dialog.
80
+ *
81
+ * @default 'Confirmation'
82
+ */
83
+ defaultConfirmDialogTitle: string;
84
+ /**
85
+ * The text for a confirm dialog.
86
+ *
87
+ * @default ['Do you really want to do this?']
88
+ */
89
+ defaultConfirmDialogText: string[];
90
+ /**
91
+ * The text for confirming a save action.
92
+ *
93
+ * @default ['Do you really want to save all changes?']
94
+ */
95
+ confirmSaveText: string[];
96
+ /**
97
+ * The text for confirming a delete action.
98
+ *
99
+ * @default ['Do you really want to delete this entity?']
100
+ */
101
+ confirmDeleteText: string[];
102
+ /**
103
+ * The label for the button to leave without changes.
104
+ *
105
+ * @default 'Leave'
106
+ */
107
+ confirmUnsavedChangesLabel: string;
108
+ /**
109
+ * The title for confirming to leave without changes.
110
+ *
111
+ * @default 'Unsaved Changes'
112
+ */
113
+ confirmUnsavedChangesTitle: string;
114
+ /**
115
+ * The text for confirming to leave without changes.
116
+ *
117
+ * @default ['You have unsaved changes that will be deleted when you leave this page.', 'Continue?']
118
+ */
119
+ confirmUnsavedChangesText: string[];
120
+ /**
121
+ * The title for the add array item dialog.
122
+ *
123
+ * @default 'Add to array'
124
+ */
125
+ addArrayItemTitle: string;
126
+ /**
127
+ * The text for confirming a create action.
128
+ *
129
+ * @default ['Do you really want to create this entity?']
130
+ */
131
+ confirmCreateText: string[];
132
+ /**
133
+ * The text for confirming a multi select action.
134
+ *
135
+ * @default selectedEntries => [`Do you really want to run this action on ${selectedEntries.length} entries?`]
136
+ */
137
+ confirmMultiSelectActionText: (selectedEntries: unknown[]) => string[];
138
+ /**
139
+ * The text for confirming a base action.
140
+ *
141
+ * @default ['Do you really want to run this action?']
142
+ */
143
+ confirmBaseActionText: string[];
144
+ /**
145
+ * The text for confirming the json import.
146
+ *
147
+ * @default ['Do you really want to import entities from the provided file?']
148
+ */
149
+ confirmImportJsonText: string[];
150
+ /**
151
+ * How table entities are edited by default.
152
+ *
153
+ * @default 'dialog'
154
+ */
155
+ defaultEditMethod: 'dialog' | 'page';
156
+ /**
157
+ * The error message to display when an array property is required and empty.
158
+ */
159
+ emptyArrayErrorMessage: string;
160
+ /**
161
+ * The label for remove actions.
162
+ *
163
+ * @default 'Remove'
164
+ */
165
+ removeLabel: string;
166
+ /**
167
+ * The label for time values.
168
+ * Mainly used inside date properties.
169
+ *
170
+ * @default 'Time'
171
+ */
172
+ timeLabel: string;
173
+ /**
174
+ * The label for the date range start.
175
+ *
176
+ * @default 'Start'
177
+ */
178
+ startLabel: string;
179
+ /**
180
+ * The label for the date range end.
181
+ *
182
+ * @default 'End'
183
+ */
184
+ endLabel: string;
185
+ /**
186
+ * The error text for duplicate entries inside an array.
187
+ *
188
+ * @default ['Adding duplicate entries to the array is not allowed.']
189
+ */
190
+ duplicateErrorText: string[];
191
+ /**
192
+ * The error title for duplicate entries inside an array.
193
+ *
194
+ * @default 'Error adding duplicate item'
195
+ */
196
+ duplicateErrorTitle: string;
197
+ /**
198
+ * The title for editing an entities.
199
+ *
200
+ * @default () => 'Edit'
201
+ */
202
+ editTitle: (entity: unknown) => string;
203
+ /**
204
+ * The label for an select action, eg. Dropdowns.
205
+ *
206
+ * @default 'Select'
207
+ */
208
+ selectLabel: string;
209
+ /**
210
+ * The label for an "Add all" button.
211
+ *
212
+ * @default 'Add all'
213
+ */
214
+ addAllLabel: string;
215
+ }
216
+ export declare const NGX_GLOBAL_DEFAULT_VALUES: InjectionToken<Partial<NgxGlobalDefaultValues>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-material-entity",
3
- "version": "16.0.2",
3
+ "version": "16.0.4",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "angular",
package/public-api.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './components/confirm-dialog/confirm-dialog-data';
6
6
  export * from './components/confirm-dialog/confirm-dialog.component';
7
7
  export * from './components/edit-page/edit-data.route';
8
8
  export * from './components/edit-page/edit-page.component';
9
- export * from './components/get-validation-error-message.function';
10
9
  export * from './components/input/base-input.component';
11
10
  export * from './components/input/input.component';
12
11
  export * from './components/input/input.module';
@@ -18,6 +17,7 @@ export * from './components/table/edit-dialog/edit-entity-data';
18
17
  export * from './components/table/edit-dialog/edit-entity-dialog.component';
19
18
  export * from './components/table/table-data';
20
19
  export * from './components/table/table.component';
20
+ export * from './components/tooltip/tooltip.component';
21
21
  export * from './decorators/array/array-decorator.data';
22
22
  export * from './decorators/array/array.decorator';
23
23
  export * from './decorators/base/decorator-types.enum';
@@ -43,8 +43,12 @@ export * from './decorators/references-one/references-one-decorator.data';
43
43
  export * from './decorators/references-one/references-one.decorator';
44
44
  export * from './decorators/string/string-decorator.data';
45
45
  export * from './decorators/string/string.decorator';
46
+ export * from './functions/get-validation-error-message.function';
47
+ export * from './functions/get-validation-errors-tooltip-content.function.ts';
46
48
  export * from './services/entity.service';
47
49
  export * from './services/unsaved-changes.guard';
48
50
  export * from './utilities/date.utilities';
49
51
  export * from './utilities/entity.utilities';
50
52
  export * from './utilities/file.utilities';
53
+ export * from './utilities/validation.utilities';
54
+ export * from './global-configuration-values';
@@ -2,6 +2,23 @@ import { HttpClient } from '@angular/common/http';
2
2
  import { BaseEntityType } from '../classes/entity.model';
3
3
  import { DecoratorType, DecoratorTypes } from '../decorators/base/decorator-types.enum';
4
4
  import { PropertyDecoratorConfigInternal } from '../decorators/base/property-decorator-internal.data';
5
+ /**
6
+ * Shows information about differences between two entities.
7
+ */
8
+ export interface Difference<EntityType extends BaseEntityType<EntityType>> {
9
+ /**
10
+ * The key where the two entities have different values.
11
+ */
12
+ key: keyof EntityType;
13
+ /**
14
+ * The value before any changes.
15
+ */
16
+ before: unknown;
17
+ /**
18
+ * The current value after changes.
19
+ */
20
+ after: unknown;
21
+ }
5
22
  /**
6
23
  * Contains HelperMethods around handling Entities and their property-metadata.
7
24
  */
@@ -73,6 +90,12 @@ export declare abstract class EntityUtilities {
73
90
  * @returns The reduced entity object.
74
91
  */
75
92
  static getWithoutOmitUpdateValues<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient): Promise<Partial<EntityType>>;
93
+ /**
94
+ * Sets all default values on the given entity.
95
+ *
96
+ * @param entity - The entity to set the default values on.
97
+ */
98
+ static setDefaultValues<EntityType extends BaseEntityType<EntityType>>(entity: EntityType): void;
76
99
  /**
77
100
  * Gets all properties on the given entity which are files.
78
101
  *
@@ -112,34 +135,6 @@ export declare abstract class EntityUtilities {
112
135
  static new<EntityType extends BaseEntityType<EntityType>>(target: EntityType, entity?: EntityType): void;
113
136
  static construct: typeof EntityUtilities.new;
114
137
  static build: typeof EntityUtilities.new;
115
- /**
116
- * Checks if the values on an entity are valid.
117
- * Also checks all the validators given by the metadata ("required", "maxLength" etc.).
118
- *
119
- * @param entity - The entity to validate.
120
- * @param omit - Whether to check for creating or editing validity.
121
- * @returns Whether or not the entity is valid.
122
- */
123
- static isEntityValid<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, omit: 'create' | 'update'): boolean;
124
- /**
125
- * Checks if a single property value is valid.
126
- *
127
- * @param entity - The entity where the property is from.
128
- * @param key - The name of the property.
129
- * @param omit - Whether to check if the given entity is valid for creation or updating.
130
- * @returns Whether or not the property value is valid.
131
- * @throws Throws when it extracts an unknown metadata type.
132
- */
133
- private static isPropertyValid;
134
- private static isBooleanValid;
135
- private static isStringValid;
136
- private static isTextboxValid;
137
- private static isPasswordValid;
138
- private static isNumberValid;
139
- private static isDateValid;
140
- private static isDateRangeValid;
141
- private static isDateTimeValid;
142
- private static isFileDataValid;
143
138
  /**
144
139
  * Checks if an entity is "dirty" (if its values have changed).
145
140
  *
@@ -149,14 +144,15 @@ export declare abstract class EntityUtilities {
149
144
  * @returns Whether or not the entity is dirty.
150
145
  */
151
146
  static isDirty<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient): Promise<boolean>;
152
- private static differencesForDirty;
153
147
  /**
154
- * Compares two Entities and returns their difference in an object.
148
+ * Gets the differences between the two given entities.
155
149
  *
156
- * @param entity - The first entity to compare.
157
- * @param entityPriorChanges - The second entity to compare.
158
- * @returns The difference between the two Entities in form of a Partial.
150
+ * @param entity - The entity as is.
151
+ * @param entityPriorChanges - The entity before any changes have been made.
152
+ * @param http - The angular http client, is needed to check if files are equal.
153
+ * @returns The differences as an array consisting of key, before and after.
159
154
  */
155
+ static getDifferencesBetweenEntities<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient): Promise<Difference<EntityType>[]>;
160
156
  /**
161
157
  * Checks if two given values are equal.
162
158
  * It uses the isEqual method from LodashUtilities and extends it with functionality regarding Dates.
@@ -168,7 +164,7 @@ export declare abstract class EntityUtilities {
168
164
  * @param http - The angular HttpClient. Used to fetch files.
169
165
  * @returns Whether or not the given values are equal.
170
166
  */
171
- static isEqual(value: unknown, valuePriorChanges: unknown, metadata: PropertyDecoratorConfigInternal, type: DecoratorTypes, http: HttpClient): Promise<boolean>;
167
+ static isEqual(value: unknown, valuePriorChanges: unknown, metadata: PropertyDecoratorConfigInternal<unknown>, type: DecoratorTypes, http: HttpClient): Promise<boolean>;
172
168
  private static isEqualArrayString;
173
169
  private static isEqualArrayDate;
174
170
  private static isEqualArrayDateRange;
@@ -0,0 +1,56 @@
1
+ import { BaseEntityType } from '../classes/entity.model';
2
+ /**
3
+ * A validation error reported by the validation utilities.
4
+ * Consists of the property name where the error originated from and a message.
5
+ */
6
+ export interface ValidationError {
7
+ /**
8
+ * The property name on which the error occurred. This is the displayName value.
9
+ */
10
+ property: string;
11
+ /**
12
+ * The validation error message.
13
+ */
14
+ message: string;
15
+ }
16
+ /**
17
+ * Contains HelperMethods around handling Validation of entities and properties.
18
+ */
19
+ export declare abstract class ValidationUtilities {
20
+ /**
21
+ * Checks if the values on an entity are valid.
22
+ * Also checks all the validators given by the metadata ("required", "maxLength" etc.).
23
+ *
24
+ * @param entity - The entity to validate.
25
+ * @param omit - Whether to check for creating or editing validity.
26
+ * @returns Whether or not the entity is valid.
27
+ */
28
+ static isEntityValid<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, omit?: 'create' | 'update'): boolean;
29
+ /**
30
+ * Gets all validation errors on the given entity.
31
+ *
32
+ * @param entity - The entity to validate.
33
+ * @param omit - What keys not to check. An empty value means no keys are omitted.
34
+ * @returns An array of validation errors on the provided entity.
35
+ */
36
+ static getEntityValidationErrors<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, omit?: 'create' | 'update'): ValidationError[];
37
+ /**
38
+ * Validates the property on the given entity with the given key.
39
+ *
40
+ * @param entity - The entity on which the property to check is.
41
+ * @param key - The key of the property to validate.
42
+ * @param omit - What keys not to check. An empty value means no keys are omitted.
43
+ * @returns A validation error when the property is not valid, undefined otherwise.
44
+ * @throws When the type of the property is not known.
45
+ */
46
+ static getPropertyValidationError<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, key: keyof EntityType, omit?: 'create' | 'update'): ValidationError | undefined;
47
+ private static getBooleanValidationError;
48
+ private static getStringValidationError;
49
+ private static getTextboxValidationError;
50
+ private static getPasswordValidationError;
51
+ private static getNumberValidationError;
52
+ private static getDateValidationError;
53
+ private static getDateRangeValidationError;
54
+ private static getDateTimeValidationError;
55
+ private static getFileDataValidationError;
56
+ }
@@ -1,42 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- export const NGX_GET_VALIDATION_ERROR_MESSAGE = new InjectionToken('Provider for the default getValidationErrorMessage.', {
3
- providedIn: 'root',
4
- factory: () => getValidationErrorMessage
5
- });
6
- /**
7
- * Generates a default error message for most validation errors.
8
- *
9
- * @param model - The ngModel to get the error from.
10
- * @returns The Validation Error Message to display.
11
- */
12
- function getValidationErrorMessage(model) {
13
- if (model.hasError('matDatepickerParse')) {
14
- return 'not a valid date';
15
- }
16
- else if (model.hasError('email')) {
17
- return 'not a valid email';
18
- }
19
- else if (model.hasError('minlength')) {
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
21
- return `needs to be at least ${model.getError('minlength').requiredLength} characters long`;
22
- }
23
- else if (model.hasError('min')) {
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
25
- return `needs to be equal or bigger than ${model.getError('min').min}`;
26
- }
27
- else if (model.hasError('max')) {
28
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
29
- return `needs to be equal or smaller than ${model.getError('max').max}`;
30
- }
31
- else if (model.hasError('required')) {
32
- return 'required';
33
- }
34
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
35
- else if (model.hasError('pattern') && model.getError('pattern').requiredPattern === '^true$') {
36
- return 'needs to be selected';
37
- }
38
- else {
39
- return 'invalid input';
40
- }
41
- }
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZhbGlkYXRpb24tZXJyb3ItbWVzc2FnZS5mdW5jdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1tYXRlcmlhbC1lbnRpdHkvc3JjL2NvbXBvbmVudHMvZ2V0LXZhbGlkYXRpb24tZXJyb3ItbWVzc2FnZS5mdW5jdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRy9DLE1BQU0sQ0FBQyxNQUFNLGdDQUFnQyxHQUFpQyxJQUFJLGNBQWMsQ0FDNUYscURBQXFELEVBQ3JEO0lBQ0ksVUFBVSxFQUFFLE1BQU07SUFDbEIsT0FBTyxFQUFFLEdBQUcsRUFBRSxDQUFDLHlCQUF5QjtDQUMzQyxDQUNKLENBQUM7QUFFRjs7Ozs7R0FLRztBQUNILFNBQVMseUJBQXlCLENBQUMsS0FBYztJQUM3QyxJQUFJLEtBQUssQ0FBQyxRQUFRLENBQUMsb0JBQW9CLENBQUMsRUFBRTtRQUN0QyxPQUFPLGtCQUFrQixDQUFDO0tBQzdCO1NBQ0ksSUFBSSxLQUFLLENBQUMs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XG4gICAgICAgIHJldHVybiAnbmVlZHMgdG8gYmUgc2VsZWN0ZWQnO1xuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgICAgcmV0dXJuICdpbnZhbGlkIGlucHV0JztcbiAgICB9XG59Il19
@@ -1,62 +0,0 @@
1
- import { Directive, EventEmitter, HostListener, Output } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Adds drag and drop functionality to an element.
5
- */
6
- export class DragDropDirective {
7
- /**
8
- * Emits the dropped files to the parent.
9
- */
10
- files = new EventEmitter();
11
- constructor() { }
12
- /**
13
- * Prevents the event default.
14
- *
15
- * @param evt - The Event when dragged files hover over the parent.
16
- */
17
- onDragOver(evt) {
18
- evt.preventDefault();
19
- evt.stopPropagation();
20
- }
21
- /**
22
- * Prevents the event default.
23
- *
24
- * @param evt - The Event when dragged files leave the parent.
25
- */
26
- onDragLeave(evt) {
27
- evt.preventDefault();
28
- evt.stopPropagation();
29
- }
30
- /**
31
- * Prevents the event default and emits the dropped files with the output.
32
- *
33
- * @param evt - The Event when files are dropped.
34
- */
35
- onDrop(evt) {
36
- evt.preventDefault();
37
- evt.stopPropagation();
38
- if (evt.dataTransfer && evt.dataTransfer.files.length > 0) {
39
- this.files.emit(Array.from(evt.dataTransfer.files));
40
- }
41
- }
42
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: DragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
43
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.0", type: DragDropDirective, selector: "[dragDrop]", outputs: { files: "files" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" } }, ngImport: i0 });
44
- }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: DragDropDirective, decorators: [{
46
- type: Directive,
47
- args: [{
48
- selector: '[dragDrop]'
49
- }]
50
- }], ctorParameters: function () { return []; }, propDecorators: { files: [{
51
- type: Output
52
- }], onDragOver: [{
53
- type: HostListener,
54
- args: ['dragover', ['$event']]
55
- }], onDragLeave: [{
56
- type: HostListener,
57
- args: ['dragleave', ['$event']]
58
- }], onDrop: [{
59
- type: HostListener,
60
- args: ['drop', ['$event']]
61
- }] } });
62
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZ0Ryb3AuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hdGVyaWFsLWVudGl0eS9zcmMvY29tcG9uZW50cy9pbnB1dC9maWxlL2ZpbGUtaW5wdXQvZHJhZ0Ryb3AuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7O0FBRTlFOztHQUVHO0FBSUgsTUFBTSxPQUFPLGlCQUFpQjtJQUMxQjs7T0FFRztJQUVILEtBQUssR0FBeUIsSUFBSSxZQUFZLEVBQVUsQ0FBQztJQUV6RCxnQkFBZ0IsQ0FBQztJQUVqQjs7OztPQUlHO0lBRUgsVUFBVSxDQUFDLEdBQWM7UUFDckIsR0FBRyxDQUFDLGNBQWMsRUFBRSxDQUFDO1FBQ3JCLEdBQUcsQ0FBQyxlQUFlLEVBQUUsQ0FBQztJQUMxQixDQUFDO0lBRUQ7Ozs7T0FJRztJQUVILFdBQVcsQ0FBQyxHQUFjO1FBQ3RCLEdBQUcsQ0FBQyxjQUFjLEVBQUUsQ0FBQztRQUNyQixHQUFHLENBQUMsZUFBZSxFQUFFLENBQUM7SUFDMUIsQ0FBQztJQUVEOzs7O09BSUc7SUFFSCxNQUFNLENBQUMsR0FBYztRQUNqQ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