ngx-material-entity 0.1.4 → 1.0.5

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 (156) hide show
  1. package/README.md +416 -39
  2. package/capsulation/lodash.utilities.d.ts +62 -0
  3. package/capsulation/reflect.utilities.d.ts +56 -0
  4. package/classes/base.builder.d.ts +2 -1
  5. package/classes/date.utilities.d.ts +18 -6
  6. package/classes/entity.model.d.ts +9 -2
  7. package/classes/entity.service.d.ts +38 -1
  8. package/classes/entity.utilities.d.ts +45 -16
  9. package/classes/file.utilities.d.ts +52 -0
  10. package/components/input/add-array-item-dialog-data.builder.d.ts +3 -2
  11. package/components/input/add-array-item-dialog-data.d.ts +2 -1
  12. package/components/input/array/array-date-input/array-date-input.component.d.ts +11 -0
  13. package/components/input/array/array-date-range-input/array-date-range-input.component.d.ts +20 -0
  14. package/components/input/array/array-date-time-input/array-date-time-input.component.d.ts +22 -0
  15. package/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.d.ts +50 -0
  16. package/components/input/array/array-string-chips-input/array-string-chips-input.component.d.ts +42 -0
  17. package/components/input/array/array-table.class.d.ts +48 -0
  18. package/components/input/base-input.component.d.ts +57 -0
  19. package/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.d.ts +10 -0
  20. package/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.d.ts +9 -0
  21. package/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.d.ts +10 -0
  22. package/components/input/custom/custom.component.d.ts +13 -0
  23. package/components/input/date/date-input/date-input.component.d.ts +11 -0
  24. package/components/input/date/date-range-input/date-range-input.component.d.ts +19 -0
  25. package/components/input/date/date-time-input/date-time-input.component.d.ts +30 -0
  26. package/components/input/file/file-default-input/file-default-input.component.d.ts +13 -0
  27. package/components/input/file/file-image-input/file-image-input.component.d.ts +22 -0
  28. package/components/input/file/file-input/dragDrop.directive.d.ts +32 -0
  29. package/components/input/file/file-input/file-input.component.d.ts +33 -0
  30. package/components/input/input.component.d.ts +49 -92
  31. package/components/input/input.module.d.ts +41 -16
  32. package/components/input/number/number-dropdown-input/number-dropdown-input.component.d.ts +9 -0
  33. package/components/input/number/number-input/number-input.component.d.ts +9 -0
  34. package/components/input/number/number-slider-input/number-slider-input.component.d.ts +9 -0
  35. package/components/input/string/string-autocomplete-input/string-autocomplete-input.component.d.ts +18 -0
  36. package/components/input/string/string-dropdown-input/string-dropdown-input.component.d.ts +9 -0
  37. package/components/input/string/string-input/string-input.component.d.ts +9 -0
  38. package/components/input/string/string-password-input/string-password-input.component.d.ts +15 -0
  39. package/components/input/string/string-textbox-input/string-textbox-input.component.d.ts +9 -0
  40. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +3 -2
  41. package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -1
  42. package/components/table/create-dialog/create-entity-dialog.component.d.ts +7 -2
  43. package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +3 -2
  44. package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +6 -1
  45. package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +5 -3
  46. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +6 -2
  47. package/components/table/table-data.builder.d.ts +9 -8
  48. package/components/table/table-data.d.ts +18 -10
  49. package/components/table/table.component.d.ts +2 -1
  50. package/decorators/array/array-decorator-internal.data.d.ts +71 -6
  51. package/decorators/array/array-decorator.data.d.ts +178 -12
  52. package/decorators/array/array.decorator.d.ts +3 -2
  53. package/decorators/base/base-property.decorator.d.ts +2 -3
  54. package/decorators/base/decorator-types.enum.d.ts +15 -5
  55. package/decorators/custom/custom-decorator-internal.data.d.ts +17 -0
  56. package/decorators/custom/custom-decorator.data.d.ts +37 -0
  57. package/decorators/custom/custom.decorator.d.ts +11 -0
  58. package/decorators/date/date-decorator-internal.data.d.ts +2 -2
  59. package/decorators/date/date.decorator.d.ts +8 -0
  60. package/decorators/file/file-decorator-internal.data.d.ts +92 -0
  61. package/decorators/file/file-decorator.data.d.ts +92 -0
  62. package/decorators/file/file.decorator.d.ts +9 -0
  63. package/decorators/number/number-decorator-internal.data.d.ts +20 -1
  64. package/decorators/number/number-decorator.data.d.ts +27 -1
  65. package/decorators/number/number.decorator.d.ts +2 -2
  66. package/decorators/object/object-decorator-internal.data.d.ts +2 -2
  67. package/decorators/object/object-decorator.data.d.ts +3 -3
  68. package/decorators/object/object.decorator.d.ts +2 -1
  69. package/decorators/string/string-decorator-internal.data.d.ts +14 -1
  70. package/decorators/string/string-decorator.data.d.ts +37 -1
  71. package/decorators/string/string.decorator.d.ts +2 -2
  72. package/esm2020/capsulation/lodash.utilities.mjs +75 -0
  73. package/esm2020/capsulation/reflect.utilities.mjs +69 -0
  74. package/esm2020/classes/base.builder.mjs +2 -3
  75. package/esm2020/classes/date.utilities.mjs +35 -15
  76. package/esm2020/classes/entity.model.mjs +5 -1
  77. package/esm2020/classes/entity.service.mjs +103 -6
  78. package/esm2020/classes/entity.utilities.mjs +241 -71
  79. package/esm2020/classes/file.utilities.mjs +124 -0
  80. package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +4 -4
  81. package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +3 -3
  82. package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +2 -2
  83. package/esm2020/components/input/add-array-item-dialog-data.mjs +1 -1
  84. package/esm2020/components/input/array/array-date-input/array-date-input.component.mjs +26 -0
  85. package/esm2020/components/input/array/array-date-range-input/array-date-range-input.component.mjs +50 -0
  86. package/esm2020/components/input/array/array-date-time-input/array-date-time-input.component.mjs +50 -0
  87. package/esm2020/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +103 -0
  88. package/esm2020/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +85 -0
  89. package/esm2020/components/input/array/array-table.class.mjs +104 -0
  90. package/esm2020/components/input/base-input.component.mjs +65 -0
  91. package/esm2020/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.mjs +21 -0
  92. package/esm2020/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.mjs +17 -0
  93. package/esm2020/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.mjs +21 -0
  94. package/esm2020/components/input/custom/custom.component.mjs +26 -0
  95. package/esm2020/components/input/date/date-input/date-input.component.mjs +22 -0
  96. package/esm2020/components/input/date/date-range-input/date-range-input.component.mjs +51 -0
  97. package/esm2020/components/input/date/date-time-input/date-time-input.component.mjs +63 -0
  98. package/esm2020/components/input/file/file-default-input/file-default-input.component.mjs +23 -0
  99. package/esm2020/components/input/file/file-image-input/file-image-input.component.mjs +84 -0
  100. package/esm2020/components/input/file/file-input/dragDrop.directive.mjs +64 -0
  101. package/esm2020/components/input/file/file-input/file-input.component.mjs +154 -0
  102. package/esm2020/components/input/input.component.mjs +137 -236
  103. package/esm2020/components/input/input.module.mjs +82 -6
  104. package/esm2020/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +18 -0
  105. package/esm2020/components/input/number/number-input/number-input.component.mjs +16 -0
  106. package/esm2020/components/input/number/number-slider-input/number-slider-input.component.mjs +17 -0
  107. package/esm2020/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +35 -0
  108. package/esm2020/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +18 -0
  109. package/esm2020/components/input/string/string-input/string-input.component.mjs +16 -0
  110. package/esm2020/components/input/string/string-password-input/string-password-input.component.mjs +36 -0
  111. package/esm2020/components/input/string/string-textbox-input/string-textbox-input.component.mjs +17 -0
  112. package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +2 -2
  113. package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +1 -1
  114. package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
  115. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +15 -8
  116. package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +2 -2
  117. package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
  118. package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +4 -3
  119. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +19 -10
  120. package/esm2020/components/table/table-data.builder.mjs +13 -10
  121. package/esm2020/components/table/table-data.mjs +1 -1
  122. package/esm2020/components/table/table.component.mjs +35 -35
  123. package/esm2020/decorators/array/array-decorator-internal.data.mjs +102 -14
  124. package/esm2020/decorators/array/array-decorator.data.mjs +2 -2
  125. package/esm2020/decorators/array/array.decorator.mjs +8 -2
  126. package/esm2020/decorators/base/base-property.decorator.mjs +4 -3
  127. package/esm2020/decorators/base/decorator-types.enum.mjs +9 -1
  128. package/esm2020/decorators/base/property-decorator-internal.data.mjs +10 -10
  129. package/esm2020/decorators/base/property-decorator.data.mjs +1 -1
  130. package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +3 -3
  131. package/esm2020/decorators/custom/custom-decorator-internal.data.mjs +26 -0
  132. package/esm2020/decorators/custom/custom-decorator.data.mjs +2 -0
  133. package/esm2020/decorators/custom/custom.decorator.mjs +13 -0
  134. package/esm2020/decorators/date/date-decorator-internal.data.mjs +5 -5
  135. package/esm2020/decorators/date/date.decorator.mjs +21 -0
  136. package/esm2020/decorators/file/file-decorator-internal.data.mjs +98 -0
  137. package/esm2020/decorators/file/file-decorator.data.mjs +7 -0
  138. package/esm2020/decorators/file/file.decorator.mjs +22 -0
  139. package/esm2020/decorators/number/number-decorator-internal.data.mjs +24 -1
  140. package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
  141. package/esm2020/decorators/number/number.decorator.mjs +9 -7
  142. package/esm2020/decorators/object/object-decorator-internal.data.mjs +1 -1
  143. package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
  144. package/esm2020/decorators/object/object.decorator.mjs +1 -1
  145. package/esm2020/decorators/string/string-decorator-internal.data.mjs +16 -1
  146. package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
  147. package/esm2020/decorators/string/string.decorator.mjs +13 -13
  148. package/esm2020/mocks/placeholder-data.png.mjs +3 -0
  149. package/esm2020/public-api.mjs +9 -1
  150. package/fesm2015/ngx-material-entity.mjs +2488 -524
  151. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  152. package/fesm2020/ngx-material-entity.mjs +2363 -493
  153. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  154. package/mocks/placeholder-data.png.d.ts +1 -0
  155. package/package.json +1 -1
  156. package/public-api.d.ts +8 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Encapsulates all functionality of Reflect.
3
+ */
4
+ export declare abstract class ReflectUtilities {
5
+ /**
6
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
7
+ *
8
+ * @param metadataKey - A key used to store and retrieve metadata.
9
+ * @param target - The target object on which the metadata is defined.
10
+ * @param propertyKey - The property key for the target.
11
+ * @returns The metadata value for the metadata key if found; otherwise, undefined.
12
+ */
13
+ static getMetadata<T extends object>(metadataKey: string, target: T, propertyKey: keyof T): unknown;
14
+ /**
15
+ * Returns the string and symbol keys of the own properties of an object. The own properties of an object
16
+ * are those that are defined directly on that object, and are not inherited from the object's prototype.
17
+ *
18
+ * @param target - Object that contains the own properties.
19
+ * @returns The keys of the given object.
20
+ */
21
+ static ownKeys<T extends object>(target: T): (keyof T)[];
22
+ /**
23
+ * Gets the property of target, equivalent to `target[propertyKey]`.
24
+ *
25
+ * @param target - Object that contains the property on itself or in its prototype chain.
26
+ * @param propertyKey - The property name.
27
+ * @returns The property of the target of the given key.
28
+ */
29
+ static get<T extends object>(target: T, propertyKey: keyof T): unknown;
30
+ /**
31
+ * Sets the property of target, equivalent to `target[propertyKey] = value`.
32
+ *
33
+ * @param target - Object that contains the property on itself or in its prototype chain.
34
+ * @param propertyKey - The property name.
35
+ * @param value - The value to set the property to.
36
+ * @returns If setting the value was successful.
37
+ */
38
+ static set<T extends object>(target: T, propertyKey: keyof T, value: unknown): boolean;
39
+ /**
40
+ * Equivalent to `propertyKey in target`.
41
+ *
42
+ * @param target - Object that contains the property on itself or in its prototype chain.
43
+ * @param propertyKey - Name of the property.
44
+ * @returns Whether or not the given target has the key.
45
+ */
46
+ static has<T extends object>(target: T, propertyKey: keyof T): boolean;
47
+ /**
48
+ * Define a unique metadata entry on the target.
49
+ *
50
+ * @param metadataKey - A key used to store and retrieve metadata.
51
+ * @param metadataValue - A value that contains attached metadata.
52
+ * @param target - The target object on which to define metadata.
53
+ * @param propertyKey - The property key for the target.
54
+ */
55
+ static defineMetadata<T extends object>(metadataKey: unknown, metadataValue: unknown, target: T, propertyKey: keyof T): void;
56
+ }
@@ -1,7 +1,8 @@
1
+ import { BaseEntityType } from './entity.model';
1
2
  /**
2
3
  * The abstract BaseBuilder class.
3
4
  */
4
- export declare abstract class BaseBuilder<InternalType extends InputType, InputType extends object> {
5
+ export declare abstract class BaseBuilder<InternalType extends InputType, InputType extends BaseEntityType<InputType>> {
5
6
  private readonly data;
6
7
  private readonly inputData?;
7
8
  protected constructor(data?: InputType);
@@ -1,6 +1,6 @@
1
1
  import { Time } from '@angular/common';
2
+ import { DateFilterFn } from '@angular/material/datepicker';
2
3
  import { DropdownValue } from '../decorators/base/dropdown-value.interface';
3
- import { DateRangeDateDecoratorConfigInternal } from '../decorators/date/date-decorator-internal.data';
4
4
  /**
5
5
  * Valid steps from one time value to the next. Needs to be able to divide 60 minutes without remainder.
6
6
  */
@@ -9,6 +9,10 @@ declare type MinuteSteps = 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30 | 60;
9
9
  * Contains Helper Functions for handling date properties.
10
10
  */
11
11
  export declare abstract class DateUtilities {
12
+ /**
13
+ * The default filter function to user when none was provided by the user.
14
+ */
15
+ static defaultDateFilter: DateFilterFn<Date | null | undefined>;
12
16
  /**
13
17
  * Gets the given value as a date value.
14
18
  *
@@ -33,26 +37,34 @@ export declare abstract class DateUtilities {
33
37
  * @param value - The date to get the time object from.
34
38
  * @returns The Time object build from the date value.
35
39
  */
36
- static getTimeFromDate(value: Date): Time;
40
+ static getTimeFromDate(value?: Date): Time | undefined;
37
41
  /**
38
42
  * Gets the dates between the two given gates. Does additional filtering based on the provided DateRange metadata.
39
43
  *
40
44
  * @param startDate - The start date.
41
45
  * @param endDate - The end date.
42
- * @param metadataDateRangeDate - The metadata.
46
+ * @param filter - The custom filter from the metadata.
43
47
  * @returns All dates between the two provided dates. Includes start and end date.
44
48
  */
45
- static getDatesBetween(startDate: Date, endDate: Date, metadataDateRangeDate: DateRangeDateDecoratorConfigInternal): Date[];
49
+ static getDatesBetween(startDate: Date, endDate: Date, filter?: DateFilterFn<Date>): Date[];
46
50
  /**
47
51
  * Get all valid times for the dropdown of a datetime property.
48
52
  *
49
- * @param date - The date of the datetime.
50
53
  * @param times - All given times to filter.
54
+ * @param date - The date of the datetime.
51
55
  * @param min - The function that defines the minimum time.
52
56
  * @param max - The function that defines the maximum time.
53
57
  * @param filter - A filter function to do more specific time filtering. This could be e.g. The removal of lunch breaks.
54
58
  * @returns All valid dropdown values for the datetime property.
55
59
  */
56
- static getValidTimesForDropdown(date: Date, times: DropdownValue<Time>[], min?: (date?: Date) => Time, max?: (date?: Date) => Time, filter?: ((time: Time) => boolean) | (() => boolean)): DropdownValue<Time>[];
60
+ static getValidTimesForDropdown(times: DropdownValue<Time>[], date?: Date, min?: (date?: Date) => Time, max?: (date?: Date) => Time, filter?: ((time: Time) => boolean) | (() => boolean)): DropdownValue<Time>[];
61
+ /**
62
+ * Checks if the time object has processable hours and minutes properties.
63
+ * Doesn't check custom validators like min/max from the metadata configuration.
64
+ *
65
+ * @param time - The time to check.
66
+ * @returns Whether or not the time object is unprocessable.
67
+ */
68
+ static timeIsUnprocessable(time?: Time): boolean;
57
69
  }
58
70
  export {};
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * The newable type used whenever an entity class is passed to create an entity and initialize its metadata.
3
3
  */
4
- export declare type EntityClassNewable<EntityType extends object> = new (data?: EntityType) => EntityType;
4
+ export declare type EntityClassNewable<EntityType extends BaseEntityType<EntityType>> = new (data?: EntityType) => EntityType;
5
+ /**
6
+ * The Generic Base EntityType.
7
+ */
8
+ export declare type BaseEntityType<T> = {
9
+ [K in keyof T]: unknown;
10
+ };
5
11
  /**
6
12
  * A base Entity class with a builtin id.
7
13
  */
@@ -9,5 +15,6 @@ export declare abstract class Entity {
9
15
  /**
10
16
  * A unique identifier for the Entity.
11
17
  */
12
- id: string;
18
+ readonly id: string;
19
+ constructor(entity?: Entity);
13
20
  }
@@ -1,12 +1,13 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { BehaviorSubject } from 'rxjs';
3
+ import { BaseEntityType } from './entity.model';
3
4
  /**
4
5
  * A generic EntityService class.
5
6
  * Offers basic CRUD-functionality.
6
7
  * You should create a service for every Entity you have.
7
8
  * If you extend from this you need to make sure that the extended Service can be injected.
8
9
  */
9
- export declare abstract class EntityService<EntityType extends object> {
10
+ export declare abstract class EntityService<EntityType extends BaseEntityType<EntityType>> {
10
11
  private readonly http;
11
12
  /**
12
13
  * The base url used for api requests. If u want to have more control over this,
@@ -47,6 +48,24 @@ export declare abstract class EntityService<EntityType extends object> {
47
48
  * @returns A Promise of the created entity.
48
49
  */
49
50
  create(entity: EntityType): Promise<EntityType>;
51
+ /**
52
+ * Creates the entity with form data when the entity contains files in contrast to creating it with a normal json body.
53
+ * All file values are stored inside their respective property key and their name.
54
+ * Form data is able to handle setting multiple files to the same key.
55
+ *
56
+ * @param body - The body Of the request.
57
+ * @param filePropertyKeys - All property keys that are files and need to be added to the form data.
58
+ * @param entity - The entity to create. This is needed in addition to the body because the body doesn't contain any metadata.
59
+ * @returns The created entity from the server.
60
+ */
61
+ protected createWithFormData(body: Partial<EntityType>, filePropertyKeys: (keyof EntityType)[], entity: EntityType): Promise<EntityType>;
62
+ /**
63
+ * Creates the entity with a normal json body in contrast to creating it with form data when the entity contains files.
64
+ *
65
+ * @param body - The body Of the request.
66
+ * @returns The created entity from the server.
67
+ */
68
+ protected createWithJson(body: Partial<EntityType>): Promise<EntityType>;
50
69
  /**
51
70
  * Gets all existing entities and pushes them to the entities array.
52
71
  *
@@ -62,6 +81,24 @@ export declare abstract class EntityService<EntityType extends object> {
62
81
  * It Is used to get changed values and only update them instead of sending the whole entity data.
63
82
  */
64
83
  update(entity: EntityType, entityPriorChanges: EntityType): Promise<void>;
84
+ /**
85
+ * Updates the entity with form data when the entity contains files in contrast to creating it with a normal json body.
86
+ * All file values are stored inside their respective property key and their name.
87
+ * Form data is able to handle setting multiple files to the same key.
88
+ *
89
+ * @param body - The request body. Already contains only properties that have changed.
90
+ * @param filePropertyKeys - The keys of all properties which are files and need to separately be appended to the form data.
91
+ * @param entity - The original entity. Is needed to get the metadata of all the files.
92
+ * @param id - The id of the entity to update.
93
+ */
94
+ protected updateWithFormData(body: Partial<EntityType>, filePropertyKeys: (keyof EntityType)[], entity: EntityType, id: EntityType[keyof EntityType]): Promise<void>;
95
+ /**
96
+ * Updates the entity with a normal json body in contrast to updating it with form data when the entity contains files.
97
+ *
98
+ * @param body - The body of the Request. Has already removed all unnecessary values.
99
+ * @param id - The id of the entity to update.
100
+ */
101
+ protected updateWithJson(body: Partial<EntityType>, id: EntityType[keyof EntityType]): Promise<void>;
65
102
  /**
66
103
  * Deletes a specific Entity.
67
104
  *
@@ -1,4 +1,6 @@
1
1
  import { DecoratorType, DecoratorTypes } from '../decorators/base/decorator-types.enum';
2
+ import { PropertyDecoratorConfigInternal } from '../decorators/base/property-decorator-internal.data';
3
+ import { BaseEntityType } from './entity.model';
2
4
  /**
3
5
  * Contains HelperMethods around handling Entities and their property-metadata.
4
6
  */
@@ -9,14 +11,22 @@ export declare abstract class EntityUtilities {
9
11
  * @param entity - The entity to get the properties which should be left out for updating from.
10
12
  * @returns The properties which should be left out for updating an Entity.
11
13
  */
12
- static getOmitForUpdate<EntityType extends object>(entity: EntityType): (keyof EntityType)[];
14
+ static getOmitForUpdate<EntityType extends BaseEntityType<EntityType>>(entity: EntityType): (keyof EntityType)[];
13
15
  /**
14
16
  * Gets the properties to omit when creating new entities.
15
17
  *
16
18
  * @param entity - The entity to get the properties which should be left out for creating from.
17
19
  * @returns The properties which should be left out for creating a new Entity.
18
20
  */
19
- static getOmitForCreate<EntityType extends object>(entity: EntityType): (keyof EntityType)[];
21
+ static getOmitForCreate<EntityType extends BaseEntityType<EntityType>>(entity: EntityType): (keyof EntityType)[];
22
+ /**
23
+ * Gets all properties on the given entity which are files.
24
+ *
25
+ * @param entity - The entity to check for file properties.
26
+ * @param omit - Whether to leave out values that are omitted for create or delete.
27
+ * @returns The keys of all file properties on the given entity.
28
+ */
29
+ static getFileProperties<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, omit?: 'create' | 'update'): (keyof EntityType)[];
20
30
  /**
21
31
  * Gets the metadata included in an property.
22
32
  *
@@ -26,7 +36,7 @@ export declare abstract class EntityUtilities {
26
36
  * @returns The metadata of the property.
27
37
  * @throws When no metadata can be found for the given property.
28
38
  */
29
- static getPropertyMetadata<EntityType extends object, T extends DecoratorTypes>(entity: EntityType, propertyKey: keyof EntityType, type?: T): DecoratorType<T>;
39
+ static getPropertyMetadata<EntityType extends BaseEntityType<EntityType>, T extends DecoratorTypes, CustomMetadataType extends Record<string, unknown>>(entity: EntityType, propertyKey: keyof EntityType, type?: T): DecoratorType<T, CustomMetadataType>;
30
40
  /**
31
41
  * Gets the type of the property-metadata.
32
42
  *
@@ -35,7 +45,7 @@ export declare abstract class EntityUtilities {
35
45
  * @returns The type of the metadata.
36
46
  * @throws Will throw an error if no metadata can be found for the given property.
37
47
  */
38
- static getPropertyType<EntityType extends object>(entity: EntityType, propertyKey: keyof EntityType): DecoratorTypes;
48
+ static getPropertyType<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, propertyKey: keyof EntityType): DecoratorTypes;
39
49
  /**
40
50
  * Sets all property values based on a given entity data-object.
41
51
  *
@@ -45,7 +55,7 @@ export declare abstract class EntityUtilities {
45
55
  * @alias build
46
56
  * @alias construct
47
57
  */
48
- static new<EntityType extends object>(target: EntityType, entity?: EntityType): void;
58
+ static new<EntityType extends BaseEntityType<EntityType>>(target: EntityType, entity?: EntityType): void;
49
59
  static construct: typeof EntityUtilities.new;
50
60
  static build: typeof EntityUtilities.new;
51
61
  /**
@@ -56,7 +66,7 @@ export declare abstract class EntityUtilities {
56
66
  * @param omit - Whether to check for creating or editing validity.
57
67
  * @returns Whether or not the entity is valid.
58
68
  */
59
- static isEntityValid<EntityType extends object>(entity: EntityType, omit: 'create' | 'update'): boolean;
69
+ static isEntityValid<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, omit: 'create' | 'update'): boolean;
60
70
  /**
61
71
  * Checks if a single property value is valid.
62
72
  *
@@ -67,12 +77,15 @@ export declare abstract class EntityUtilities {
67
77
  * @throws Throws when it extracts an unknown metadata type.
68
78
  */
69
79
  private static isPropertyValid;
80
+ private static isBooleanValid;
70
81
  private static isStringValid;
71
82
  private static isTextboxValid;
83
+ private static isPasswordValid;
72
84
  private static isNumberValid;
73
85
  private static isDateValid;
74
86
  private static isDateRangeValid;
75
87
  private static isDateTimeValid;
88
+ private static isFileDataValid;
76
89
  /**
77
90
  * Checks if an entity is "dirty" (if its values have changed).
78
91
  *
@@ -80,7 +93,7 @@ export declare abstract class EntityUtilities {
80
93
  * @param entityPriorChanges - The entity before the changes.
81
94
  * @returns Whether or not the entity is dirty.
82
95
  */
83
- static dirty<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): boolean;
96
+ static isDirty<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType): Promise<boolean>;
84
97
  private static differencesForDirty;
85
98
  /**
86
99
  * Compares two Entities and returns their difference in an object.
@@ -89,9 +102,25 @@ export declare abstract class EntityUtilities {
89
102
  * @param entityPriorChanges - The second entity to compare.
90
103
  * @returns The difference between the two Entities in form of a Partial.
91
104
  */
92
- static difference<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): Partial<EntityType>;
93
- private static isEqual;
94
- private static isDateRange;
105
+ static difference<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType): Promise<Partial<EntityType>>;
106
+ /**
107
+ * Checks if two given values are equal.
108
+ * It uses the isEqual method from LodashUtilities and extends it with functionality regarding Dates.
109
+ *
110
+ * @param value - The updated value.
111
+ * @param valuePriorChanges - The value before any changes.
112
+ * @param metadata - The metadata of the property.
113
+ * @param type - The type of the property.
114
+ * @returns Whether or not the given values are equal.
115
+ */
116
+ static isEqual(value: unknown, valuePriorChanges: unknown, metadata: PropertyDecoratorConfigInternal, type: DecoratorTypes): Promise<boolean>;
117
+ private static isEqualArrayDate;
118
+ private static isEqualArrayDateRange;
119
+ private static isEqualDateTime;
120
+ private static isEqualDate;
121
+ private static isEqualDateRange;
122
+ private static isEqualFile;
123
+ private static isEqualCustom;
95
124
  /**
96
125
  * Compare function for sorting entity keys by their order value.
97
126
  *
@@ -100,7 +129,7 @@ export declare abstract class EntityUtilities {
100
129
  * @param entity - Current entity (used to get metadata of entity keys).
101
130
  * @returns 0 if both values have the same order, a negative value if 'a' comes before 'b', a positive value if 'a' comes behind 'b'.
102
131
  */
103
- static compareOrder<EntityType extends object>(a: keyof EntityType, b: keyof EntityType, entity: EntityType): number;
132
+ static compareOrder<EntityType extends BaseEntityType<EntityType>>(a: keyof EntityType, b: keyof EntityType, entity: EntityType): number;
104
133
  /**
105
134
  * Gets the bootstrap column values for "lg", "md", "sm".
106
135
  *
@@ -109,14 +138,14 @@ export declare abstract class EntityUtilities {
109
138
  * @param type - Defines for which screen size the column values should be returned.
110
139
  * @returns Bootstrap column value.
111
140
  */
112
- static getWidth<EntityType extends object>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
141
+ static getWidth<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
113
142
  /**
114
143
  * Resets all changes on an entity.
115
144
  *
116
145
  * @param entity - The entity to reset.
117
146
  * @param entityPriorChanges - The entity before any changes.
118
147
  */
119
- static resetChangesOnEntity<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): void;
148
+ static resetChangesOnEntity<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType): void;
120
149
  /**
121
150
  * Gets the rows that are used to display the given entity.
122
151
  *
@@ -125,7 +154,7 @@ export declare abstract class EntityUtilities {
125
154
  * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
126
155
  * @returns The sorted Rows containing the row number and the keys to display in that row.
127
156
  */
128
- static getEntityRows<EntityType extends object>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
157
+ static getEntityRows<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
129
158
  private static getKeysForRow;
130
159
  private static getNumberOfRows;
131
160
  /**
@@ -136,12 +165,12 @@ export declare abstract class EntityUtilities {
136
165
  * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
137
166
  * @returns An array of keys of the entity.
138
167
  */
139
- static keysOf<EntityType extends object>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
168
+ static keysOf<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
140
169
  }
141
170
  /**
142
171
  * A row that contains all the information about how to display an entity.
143
172
  */
144
- export interface EntityRow<EntityType extends object> {
173
+ export interface EntityRow<EntityType extends BaseEntityType<EntityType>> {
145
174
  /**
146
175
  * The row in which this should be displayed.
147
176
  */
@@ -0,0 +1,52 @@
1
+ import { FileDataWithFile } from '../decorators/file/file-decorator-internal.data';
2
+ import { FileData } from '../decorators/file/file-decorator.data';
3
+ /**
4
+ * Provides functionality regarding files.
5
+ */
6
+ export declare abstract class FileUtilities {
7
+ /**
8
+ * Gets the accept value for the html input.
9
+ *
10
+ * @param mimeTypes - The mimeTypes to get the accept string from.
11
+ * @returns A comma separated string of all the provided mime types.
12
+ */
13
+ static getAcceptString(mimeTypes?: string[]): string;
14
+ /**
15
+ * Reads a url to display the given file.
16
+ *
17
+ * @param file - The file to get the url from.
18
+ * @returns A promise of the url. Undefined if no file was provided.
19
+ */
20
+ static getDataURLFromFile(file?: Blob): Promise<string | undefined>;
21
+ /**
22
+ * Gets a file from the given url.
23
+ *
24
+ * @param url - The url to get the file from.
25
+ * @returns A promise of the File.
26
+ */
27
+ private static getFileFromUrl;
28
+ /**
29
+ * Gets the file data with the blob from the given File Data.
30
+ *
31
+ * @param data - The File Data to get the file data with blob from.
32
+ * @returns FileDataWithFile.
33
+ */
34
+ static getFileData(data: FileData): Promise<FileDataWithFile>;
35
+ /**
36
+ * Checks if the given file has a valid mime type.
37
+ *
38
+ * @param type - The type of the file to check.
39
+ * @param allowedMimeTypes - The allowed mime types.
40
+ * @returns Whether or not the given file has a valid mime type.
41
+ */
42
+ static isMimeTypeValid(type: string, allowedMimeTypes: string[]): boolean;
43
+ /**
44
+ * Transform the given value to Megabytes.
45
+ *
46
+ * @param value - The original value.
47
+ * @param unit - If the value is B, KB or GB.
48
+ * @returns The given value as bytes.
49
+ */
50
+ static transformToMegaBytes(value: number, unit: 'B' | 'KB' | 'GB'): number;
51
+ private static transformToBytes;
52
+ }
@@ -1,11 +1,12 @@
1
1
  import { NgModel } from '@angular/forms';
2
2
  import { BaseBuilder } from '../../classes/base.builder';
3
+ import { BaseEntityType } from '../../classes/entity.model';
3
4
  import { CreateDialogDataInternal } from '../table/create-dialog/create-dialog-data.builder';
4
5
  import { AddArrayItemDialogData } from './add-array-item-dialog-data';
5
6
  /**
6
7
  * The internal AddArrayItemDialogData. Requires all default values the user can leave out.
7
8
  */
8
- export declare class AddArrayItemDialogDataInternal<EntityType extends object> implements AddArrayItemDialogData<EntityType> {
9
+ export declare class AddArrayItemDialogDataInternal<EntityType extends BaseEntityType<EntityType>> implements AddArrayItemDialogData<EntityType> {
9
10
  entity: EntityType;
10
11
  createDialogData: CreateDialogDataInternal;
11
12
  getValidationErrorMessage: (model: NgModel) => string;
@@ -14,7 +15,7 @@ export declare class AddArrayItemDialogDataInternal<EntityType extends object> i
14
15
  /**
15
16
  * The Builder for the AddArrayItemDialogData. Sets default values.
16
17
  */
17
- export declare class AddArrayItemDialogDataBuilder<EntityType extends object> extends BaseBuilder<AddArrayItemDialogDataInternal<EntityType>, AddArrayItemDialogData<EntityType>> {
18
+ export declare class AddArrayItemDialogDataBuilder<EntityType extends BaseEntityType<EntityType>> extends BaseBuilder<AddArrayItemDialogDataInternal<EntityType>, AddArrayItemDialogData<EntityType>> {
18
19
  constructor(data: AddArrayItemDialogData<EntityType>);
19
20
  protected generateBaseData(data: AddArrayItemDialogData<EntityType>): AddArrayItemDialogDataInternal<EntityType>;
20
21
  }
@@ -1,9 +1,10 @@
1
1
  import { NgModel } from '@angular/forms';
2
+ import { BaseEntityType } from '../../classes/entity.model';
2
3
  import { CreateDialogData } from '../table/table-data';
3
4
  /**
4
5
  * The configuration options for the dialog that adds items to an array.
5
6
  */
6
- export interface AddArrayItemDialogData<EntityType extends object> {
7
+ export interface AddArrayItemDialogData<EntityType extends BaseEntityType<EntityType>> {
7
8
  /**
8
9
  * An empty entity that is used as the data model.
9
10
  */
@@ -0,0 +1,11 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { DateUtilities } from '../../../../classes/date.utilities';
3
+ import { ArrayTableComponent } from '../array-table.class';
4
+ import { BaseEntityType } from '../../../../classes/entity.model';
5
+ import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
6
+ import * as i0 from "@angular/core";
7
+ export declare class ArrayDateInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTableComponent<Date, EntityType, DecoratorTypes.ARRAY_DATE> implements OnInit {
8
+ DateUtilities: typeof DateUtilities;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateInputComponent<any>, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateInputComponent<any>, "array-date-input", never, {}, {}, never, never>;
11
+ }
@@ -0,0 +1,20 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { BaseEntityType } from '../../../../classes/entity.model';
3
+ import { DateUtilities } from '../../../../classes/date.utilities';
4
+ import { DateRange } from '../../../../decorators/date/date-decorator.data';
5
+ import { ArrayTableComponent } from '../array-table.class';
6
+ import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
7
+ import * as i0 from "@angular/core";
8
+ export declare class ArrayDateRangeInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTableComponent<DateRange, EntityType, DecoratorTypes.ARRAY_DATE_RANGE> implements OnInit {
9
+ DateUtilities: typeof DateUtilities;
10
+ dateRangeStart?: Date;
11
+ dateRangeEnd?: Date;
12
+ ngOnInit(): void;
13
+ /**
14
+ * Adds a DateRange to the array.
15
+ */
16
+ addDateRange(): void;
17
+ protected resetInput(): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateRangeInputComponent<any>, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateRangeInputComponent<any>, "array-date-range-input", never, {}, {}, never, never>;
20
+ }
@@ -0,0 +1,22 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { DateUtilities } from '../../../../classes/date.utilities';
3
+ import { ArrayTableComponent } from '../array-table.class';
4
+ import { Time } from '@angular/common';
5
+ import { DropdownValue } from '../../../../decorators/base/dropdown-value.interface';
6
+ import { BaseEntityType } from '../../../../classes/entity.model';
7
+ import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
8
+ import * as i0 from "@angular/core";
9
+ export declare class ArrayDateTimeInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTableComponent<Date, EntityType, DecoratorTypes.ARRAY_DATE_TIME> implements OnInit {
10
+ DateUtilities: typeof DateUtilities;
11
+ dateTime?: Date;
12
+ time?: Time;
13
+ timeDropdownValues: DropdownValue<Time>[];
14
+ ngOnInit(): void;
15
+ protected resetInput(): void;
16
+ /**
17
+ * Adds a date time to the array.
18
+ */
19
+ addDateTime(): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateTimeInputComponent<any>, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateTimeInputComponent<any>, "array-date-time-input", never, {}, {}, never, never>;
22
+ }
@@ -0,0 +1,50 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
3
+ import { MatChipInputEvent } from '@angular/material/chips';
4
+ import { BaseEntityType } from '../../../../classes/entity.model';
5
+ import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
6
+ import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
7
+ import * as i0 from "@angular/core";
8
+ export declare class ArrayStringAutocompleteChipsComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS, string[]> implements OnInit {
9
+ filteredAutocompleteStrings: string[];
10
+ chipsInput: string;
11
+ ngOnInit(): void;
12
+ /**
13
+ * Handles adding strings to the chipsArray.
14
+ * Checks validation and also creates a new array if it is undefined.
15
+ * This is needed because two things are validated: The array itself
16
+ * and the contents of the array. And we need a way to display an
17
+ * mat-error. As the only validation for the array is whether or not
18
+ * it contains values, we can set it to undefined when the last element is removed
19
+ * (removeStringChipArrayValue). That way we can use the "required" validator.
20
+ *
21
+ * @param event - The event that fires when a new chip is completed.
22
+ */
23
+ addStringChipArrayValue(event: MatChipInputEvent): void;
24
+ /**
25
+ * Removes the given value from the array.
26
+ * Sets the array to undefined if it is now empty.
27
+ * This is needed because two things are validated: The array itself
28
+ * and the contents of the array. And we need a way to display an
29
+ * mat-error. As the only validation for the array is whether or not
30
+ * it is empty, setting it to undefined here enables us to use the "required" validator.
31
+ *
32
+ * @param value - The string to remove from the array.
33
+ */
34
+ removeStringChipArrayValue(value: string): void;
35
+ /**
36
+ * Handles adding a string to the array when an autocomplete value has been selected.
37
+ *
38
+ * @param event - The autocomplete selected event.
39
+ * @param chipsInput - The element where the user typed the value.
40
+ */
41
+ selected(event: MatAutocompleteSelectedEvent, chipsInput: HTMLInputElement): void;
42
+ /**
43
+ * Dynamically filters the Autocomplete options when the user inputs something.
44
+ *
45
+ * @param input - The input of the user.
46
+ */
47
+ filterAutocompleteStrings(input: unknown): void;
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayStringAutocompleteChipsComponent<any>, never>;
49
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayStringAutocompleteChipsComponent<any>, "array-string-autocomplete-chips", never, {}, {}, never, never>;
50
+ }
@@ -0,0 +1,42 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
3
+ import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
4
+ import { MatChipInputEvent } from '@angular/material/chips';
5
+ import { BaseEntityType } from '../../../../classes/entity.model';
6
+ import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
7
+ import * as i0 from "@angular/core";
8
+ export declare class ArrayStringChipsInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.ARRAY_STRING_CHIPS, string[]> implements OnInit {
9
+ chipsInput: string;
10
+ /**
11
+ * Handles adding strings to the chipsArray.
12
+ * Checks validation and also creates a new array if it is undefined.
13
+ * This is needed because two things are validated: The array itself
14
+ * and the contents of the array. And we need a way to display an
15
+ * mat-error. As the only validation for the array is whether or not
16
+ * it contains values, we can set it to undefined when the last element is removed
17
+ * (removeStringChipArrayValue). That way we can use the "required" validator.
18
+ *
19
+ * @param event - The event that fires when a new chip is completed.
20
+ */
21
+ addStringChipArrayValue(event: MatChipInputEvent): void;
22
+ /**
23
+ * Removes the given value from the array.
24
+ * Sets the array to undefined if it is now empty.
25
+ * This is needed because two things are validated: The array itself
26
+ * and the contents of the array. And we need a way to display an
27
+ * mat-error. As the only validation for the array is whether or not
28
+ * it is empty, setting it to undefined here enables us to use the "required" validator.
29
+ *
30
+ * @param value - The string to remove from the array.
31
+ */
32
+ removeStringChipArrayValue(value: string): void;
33
+ /**
34
+ * Handles adding a string to the array when an autocomplete value has been selected.
35
+ *
36
+ * @param event - The autocomplete selected event.
37
+ * @param chipsInput - The element where the user typed the value.
38
+ */
39
+ selected(event: MatAutocompleteSelectedEvent, chipsInput: HTMLInputElement): void;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayStringChipsInputComponent<any>, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayStringChipsInputComponent<any>, "array-string-chips-input", never, {}, {}, never, never>;
42
+ }