ngx-material-entity 0.1.4 → 0.1.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 (130) hide show
  1. package/capsulation/lodash.utilities.d.ts +62 -0
  2. package/capsulation/reflect.utilities.d.ts +56 -0
  3. package/classes/base.builder.d.ts +2 -1
  4. package/classes/date.utilities.d.ts +16 -4
  5. package/classes/entity.model.d.ts +7 -1
  6. package/classes/entity.service.d.ts +38 -1
  7. package/classes/entity.utilities.d.ts +43 -16
  8. package/classes/file.utilities.d.ts +52 -0
  9. package/components/input/add-array-item-dialog-data.builder.d.ts +3 -2
  10. package/components/input/add-array-item-dialog-data.d.ts +2 -1
  11. package/components/input/array/array-date-input/array-date-input.component.d.ts +22 -0
  12. package/components/input/array/array-date-range-input/array-date-range-input.component.d.ts +30 -0
  13. package/components/input/array/array-date-time-input/array-date-time-input.component.d.ts +32 -0
  14. package/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.d.ts +58 -0
  15. package/components/input/array/array-string-chips-input/array-string-chips-input.component.d.ts +51 -0
  16. package/components/input/array/array-table.class.d.ts +48 -0
  17. package/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.d.ts +17 -0
  18. package/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.d.ts +17 -0
  19. package/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.d.ts +17 -0
  20. package/components/input/date/date-input/date-input.component.d.ts +21 -0
  21. package/components/input/date/date-range-input/date-range-input.component.d.ts +27 -0
  22. package/components/input/date/date-time-input/date-time-input.component.d.ts +38 -0
  23. package/components/input/file/file-default-input/file-default-input.component.d.ts +21 -0
  24. package/components/input/file/file-image-input/file-image-input.component.d.ts +30 -0
  25. package/components/input/file/file-input/dragDrop.directive.d.ts +32 -0
  26. package/components/input/file/file-input/file-input.component.d.ts +32 -0
  27. package/components/input/input.component.d.ts +37 -92
  28. package/components/input/input.module.d.ts +37 -16
  29. package/components/input/number/number-dropdown-input/number-dropdown-input.component.d.ts +17 -0
  30. package/components/input/number/number-input/number-input.component.d.ts +17 -0
  31. package/components/input/string/string-autocomplete-input/string-autocomplete-input.component.d.ts +25 -0
  32. package/components/input/string/string-dropdown-input/string-dropdown-input.component.d.ts +17 -0
  33. package/components/input/string/string-input/string-input.component.d.ts +17 -0
  34. package/components/input/string/string-textbox-input/string-textbox-input.component.d.ts +17 -0
  35. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +3 -2
  36. package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -1
  37. package/components/table/create-dialog/create-entity-dialog.component.d.ts +7 -2
  38. package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +3 -2
  39. package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +2 -1
  40. package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +3 -2
  41. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +5 -2
  42. package/components/table/table-data.builder.d.ts +5 -5
  43. package/components/table/table-data.d.ts +6 -6
  44. package/components/table/table.component.d.ts +2 -1
  45. package/decorators/array/array-decorator-internal.data.d.ts +71 -6
  46. package/decorators/array/array-decorator.data.d.ts +178 -12
  47. package/decorators/array/array.decorator.d.ts +3 -2
  48. package/decorators/base/base-property.decorator.d.ts +2 -3
  49. package/decorators/base/decorator-types.enum.d.ts +9 -3
  50. package/decorators/date/date-decorator-internal.data.d.ts +2 -2
  51. package/decorators/date/date.decorator.d.ts +8 -0
  52. package/decorators/file/file-decorator-internal.data.d.ts +92 -0
  53. package/decorators/file/file-decorator.data.d.ts +92 -0
  54. package/decorators/file/file.decorator.d.ts +9 -0
  55. package/decorators/object/object-decorator-internal.data.d.ts +2 -2
  56. package/decorators/object/object-decorator.data.d.ts +3 -3
  57. package/decorators/object/object.decorator.d.ts +2 -1
  58. package/esm2020/capsulation/lodash.utilities.mjs +75 -0
  59. package/esm2020/capsulation/reflect.utilities.mjs +69 -0
  60. package/esm2020/classes/base.builder.mjs +2 -3
  61. package/esm2020/classes/date.utilities.mjs +33 -13
  62. package/esm2020/classes/entity.model.mjs +1 -1
  63. package/esm2020/classes/entity.service.mjs +103 -6
  64. package/esm2020/classes/entity.utilities.mjs +202 -71
  65. package/esm2020/classes/file.utilities.mjs +123 -0
  66. package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +4 -4
  67. package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +3 -3
  68. package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +2 -2
  69. package/esm2020/components/input/add-array-item-dialog-data.mjs +1 -1
  70. package/esm2020/components/input/array/array-date-input/array-date-input.component.mjs +44 -0
  71. package/esm2020/components/input/array/array-date-range-input/array-date-range-input.component.mjs +68 -0
  72. package/esm2020/components/input/array/array-date-time-input/array-date-time-input.component.mjs +65 -0
  73. package/esm2020/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +131 -0
  74. package/esm2020/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +116 -0
  75. package/esm2020/components/input/array/array-table.class.mjs +92 -0
  76. package/esm2020/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.mjs +38 -0
  77. package/esm2020/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.mjs +35 -0
  78. package/esm2020/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.mjs +38 -0
  79. package/esm2020/components/input/date/date-input/date-input.component.mjs +38 -0
  80. package/esm2020/components/input/date/date-range-input/date-range-input.component.mjs +63 -0
  81. package/esm2020/components/input/date/date-time-input/date-time-input.component.mjs +74 -0
  82. package/esm2020/components/input/file/file-default-input/file-default-input.component.mjs +39 -0
  83. package/esm2020/components/input/file/file-image-input/file-image-input.component.mjs +95 -0
  84. package/esm2020/components/input/file/file-input/dragDrop.directive.mjs +64 -0
  85. package/esm2020/components/input/file/file-input/file-input.component.mjs +152 -0
  86. package/esm2020/components/input/input.component.mjs +124 -234
  87. package/esm2020/components/input/input.module.mjs +66 -3
  88. package/esm2020/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +36 -0
  89. package/esm2020/components/input/number/number-input/number-input.component.mjs +34 -0
  90. package/esm2020/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +52 -0
  91. package/esm2020/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +36 -0
  92. package/esm2020/components/input/string/string-input/string-input.component.mjs +34 -0
  93. package/esm2020/components/input/string/string-textbox-input/string-textbox-input.component.mjs +35 -0
  94. package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +2 -2
  95. package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +1 -1
  96. package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
  97. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +15 -8
  98. package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +2 -2
  99. package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
  100. package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +2 -2
  101. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +18 -10
  102. package/esm2020/components/table/table-data.builder.mjs +3 -3
  103. package/esm2020/components/table/table-data.mjs +1 -1
  104. package/esm2020/components/table/table.component.mjs +21 -23
  105. package/esm2020/decorators/array/array-decorator-internal.data.mjs +102 -14
  106. package/esm2020/decorators/array/array-decorator.data.mjs +2 -2
  107. package/esm2020/decorators/array/array.decorator.mjs +8 -2
  108. package/esm2020/decorators/base/base-property.decorator.mjs +4 -3
  109. package/esm2020/decorators/base/decorator-types.enum.mjs +6 -1
  110. package/esm2020/decorators/base/property-decorator-internal.data.mjs +10 -10
  111. package/esm2020/decorators/base/property-decorator.data.mjs +1 -1
  112. package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +3 -3
  113. package/esm2020/decorators/date/date-decorator-internal.data.mjs +5 -5
  114. package/esm2020/decorators/date/date.decorator.mjs +21 -0
  115. package/esm2020/decorators/file/file-decorator-internal.data.mjs +98 -0
  116. package/esm2020/decorators/file/file-decorator.data.mjs +7 -0
  117. package/esm2020/decorators/file/file.decorator.mjs +22 -0
  118. package/esm2020/decorators/object/object-decorator-internal.data.mjs +1 -1
  119. package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
  120. package/esm2020/decorators/object/object.decorator.mjs +1 -1
  121. package/esm2020/decorators/string/string.decorator.mjs +1 -1
  122. package/esm2020/mocks/placeholder-data.png.mjs +3 -0
  123. package/esm2020/public-api.mjs +6 -1
  124. package/fesm2015/ngx-material-entity.mjs +2452 -459
  125. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  126. package/fesm2020/ngx-material-entity.mjs +2370 -464
  127. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  128. package/mocks/placeholder-data.png.d.ts +1 -0
  129. package/package.json +1 -1
  130. package/public-api.d.ts +5 -0
@@ -0,0 +1,62 @@
1
+ import { Dictionary, Many, ValueKeyIteratee } from 'lodash';
2
+ /**
3
+ * Encapsulates all functionality of lodash.
4
+ */
5
+ export declare abstract class LodashUtilities {
6
+ /**
7
+ * Performs a deep comparison between two values to determine if they are
8
+ * equivalent.
9
+ *
10
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
11
+ * date objects, error objects, maps, numbers, `Object` objects, regexps,
12
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
13
+ * by their own, not inherited, enumerable properties. Functions and DOM
14
+ * nodes are **not** supported.
15
+ *
16
+ * @param value - The value to compare.
17
+ * @param other - The other value to compare.
18
+ * @returns Returns `true` if the values are equivalent, else `false`.
19
+ */
20
+ static isEqual(value: unknown, other: unknown): boolean;
21
+ /**
22
+ * This method is like _.clone except that it recursively clones value.
23
+ *
24
+ * @param value - The value to recursively clone.
25
+ * @returns Returns the deep cloned value.
26
+ */
27
+ static cloneDeep<T>(value: T): T;
28
+ /**
29
+ * The opposite of `_.pick`; this method creates an object composed of the
30
+ * own and inherited enumerable properties of `object` that are not omitted.
31
+ *
32
+ * @param object - The source object.
33
+ * @param paths - The property names to omit, specified
34
+ * individually or in arrays.
35
+ * @returns Returns the new object.
36
+ */
37
+ static omit<T extends object, K extends keyof T>(object: T | null | undefined, ...paths: Many<K>[]): Omit<T, K>;
38
+ /**
39
+ * Checks if `value` is `null` or `undefined`.
40
+ *
41
+ * @param value - The value to check.
42
+ * @returns Returns `true` if `value` is nullish, else `false`.
43
+ */
44
+ static isNil(value: unknown): value is null | undefined;
45
+ /**
46
+ * The opposite of `_.pickBy`; this method creates an object composed of the
47
+ * own and inherited enumerable properties of `object` that `predicate`
48
+ * doesn't return truthy for.
49
+ *
50
+ * @param object - The source object.
51
+ * @param predicate - The function invoked per property.
52
+ * @returns Returns the new object.
53
+ */
54
+ static omitBy<T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<T>;
55
+ /**
56
+ * Checks if value is classified as an Array object.
57
+ *
58
+ * @param value - The value to check.
59
+ * @returns Returns true if value is correctly classified, else false.
60
+ */
61
+ static isArray(value?: unknown): value is unknown[];
62
+ }
@@ -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: string): 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,16 +37,16 @@ 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
  *
@@ -54,5 +58,13 @@ export declare abstract class DateUtilities {
54
58
  * @returns All valid dropdown values for the datetime property.
55
59
  */
56
60
  static getValidTimesForDropdown(date: Date, times: DropdownValue<Time>[], 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
  */
@@ -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>(entity: EntityType, propertyKey: keyof EntityType, type?: T): DecoratorType<T>;
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,14 @@ 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;
72
83
  private static isNumberValid;
73
84
  private static isDateValid;
74
85
  private static isDateRangeValid;
75
86
  private static isDateTimeValid;
87
+ private static isFileDataValid;
76
88
  /**
77
89
  * Checks if an entity is "dirty" (if its values have changed).
78
90
  *
@@ -80,7 +92,7 @@ export declare abstract class EntityUtilities {
80
92
  * @param entityPriorChanges - The entity before the changes.
81
93
  * @returns Whether or not the entity is dirty.
82
94
  */
83
- static dirty<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): boolean;
95
+ static dirty<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType): Promise<boolean>;
84
96
  private static differencesForDirty;
85
97
  /**
86
98
  * Compares two Entities and returns their difference in an object.
@@ -89,9 +101,24 @@ export declare abstract class EntityUtilities {
89
101
  * @param entityPriorChanges - The second entity to compare.
90
102
  * @returns The difference between the two Entities in form of a Partial.
91
103
  */
92
- static difference<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): Partial<EntityType>;
93
- private static isEqual;
94
- private static isDateRange;
104
+ static difference<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType): Promise<Partial<EntityType>>;
105
+ /**
106
+ * Checks if two given values are equal.
107
+ * It uses the isEqual method from LodashUtilities and extends it with functionality regarding Dates.
108
+ *
109
+ * @param value - The updated value.
110
+ * @param valuePriorChanges - The value before any changes.
111
+ * @param metadata - The metadata of the property.
112
+ * @param type - The type of the property.
113
+ * @returns Whether or not the given values are equal.
114
+ */
115
+ static isEqual(value: unknown, valuePriorChanges: unknown, metadata: PropertyDecoratorConfigInternal, type: DecoratorTypes): Promise<boolean>;
116
+ private static isEqualArrayDate;
117
+ private static isEqualArrayDateRange;
118
+ private static isEqualDateTime;
119
+ private static isEqualDate;
120
+ private static isEqualDateRange;
121
+ private static isEqualFile;
95
122
  /**
96
123
  * Compare function for sorting entity keys by their order value.
97
124
  *
@@ -100,7 +127,7 @@ export declare abstract class EntityUtilities {
100
127
  * @param entity - Current entity (used to get metadata of entity keys).
101
128
  * @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
129
  */
103
- static compareOrder<EntityType extends object>(a: keyof EntityType, b: keyof EntityType, entity: EntityType): number;
130
+ static compareOrder<EntityType extends BaseEntityType<EntityType>>(a: keyof EntityType, b: keyof EntityType, entity: EntityType): number;
104
131
  /**
105
132
  * Gets the bootstrap column values for "lg", "md", "sm".
106
133
  *
@@ -109,14 +136,14 @@ export declare abstract class EntityUtilities {
109
136
  * @param type - Defines for which screen size the column values should be returned.
110
137
  * @returns Bootstrap column value.
111
138
  */
112
- static getWidth<EntityType extends object>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
139
+ static getWidth<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
113
140
  /**
114
141
  * Resets all changes on an entity.
115
142
  *
116
143
  * @param entity - The entity to reset.
117
144
  * @param entityPriorChanges - The entity before any changes.
118
145
  */
119
- static resetChangesOnEntity<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): void;
146
+ static resetChangesOnEntity<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType): void;
120
147
  /**
121
148
  * Gets the rows that are used to display the given entity.
122
149
  *
@@ -125,7 +152,7 @@ export declare abstract class EntityUtilities {
125
152
  * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
126
153
  * @returns The sorted Rows containing the row number and the keys to display in that row.
127
154
  */
128
- static getEntityRows<EntityType extends object>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
155
+ static getEntityRows<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
129
156
  private static getKeysForRow;
130
157
  private static getNumberOfRows;
131
158
  /**
@@ -136,12 +163,12 @@ export declare abstract class EntityUtilities {
136
163
  * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
137
164
  * @returns An array of keys of the entity.
138
165
  */
139
- static keysOf<EntityType extends object>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
166
+ static keysOf<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
140
167
  }
141
168
  /**
142
169
  * A row that contains all the information about how to display an entity.
143
170
  */
144
- export interface EntityRow<EntityType extends object> {
171
+ export interface EntityRow<EntityType extends BaseEntityType<EntityType>> {
145
172
  /**
146
173
  * The row in which this should be displayed.
147
174
  */
@@ -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,22 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { DateArrayDecoratorConfigInternal } from '../../../../decorators/array/array-decorator-internal.data';
3
+ import { NgModel } from '@angular/forms';
4
+ import { DateUtilities } from '../../../../classes/date.utilities';
5
+ import { MatDialog } from '@angular/material/dialog';
6
+ import { ArrayTable } from '../array-table.class';
7
+ import { BaseEntityType } from '../../../../classes/entity.model';
8
+ import * as i0 from "@angular/core";
9
+ export declare class ArrayDateInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTable<Date, EntityType> implements OnInit {
10
+ private readonly dialog;
11
+ DateUtilities: typeof DateUtilities;
12
+ entity: EntityType;
13
+ key: keyof EntityType;
14
+ getValidationErrorMessage: (model: NgModel) => string;
15
+ inputChangeEvent: EventEmitter<void>;
16
+ metadata: DateArrayDecoratorConfigInternal;
17
+ constructor(dialog: MatDialog);
18
+ ngOnInit(): void;
19
+ protected emitChange(): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateInputComponent<any>, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateInputComponent<any>, "array-date-input", never, { "entity": "entity"; "key": "key"; "getValidationErrorMessage": "getValidationErrorMessage"; }, { "inputChangeEvent": "inputChangeEvent"; }, never, never>;
22
+ }
@@ -0,0 +1,30 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { NgModel } from '@angular/forms';
3
+ import { MatDialog } from '@angular/material/dialog';
4
+ import { BaseEntityType } from '../../../../classes/entity.model';
5
+ import { DateUtilities } from '../../../../classes/date.utilities';
6
+ import { DateRangeArrayDecoratorConfigInternal } from '../../../../decorators/array/array-decorator-internal.data';
7
+ import { DateRange } from '../../../../decorators/date/date-decorator.data';
8
+ import { ArrayTable } from '../array-table.class';
9
+ import * as i0 from "@angular/core";
10
+ export declare class ArrayDateRangeInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTable<DateRange, EntityType> implements OnInit {
11
+ private readonly dialog;
12
+ DateUtilities: typeof DateUtilities;
13
+ entity: EntityType;
14
+ key: keyof EntityType;
15
+ metadata: DateRangeArrayDecoratorConfigInternal;
16
+ getValidationErrorMessage: (model: NgModel) => string;
17
+ inputChangeEvent: EventEmitter<void>;
18
+ dateRangeStart?: Date;
19
+ dateRangeEnd?: Date;
20
+ constructor(dialog: MatDialog);
21
+ ngOnInit(): void;
22
+ /**
23
+ * Adds a DateRange to the array.
24
+ */
25
+ addDateRange(): void;
26
+ protected resetInput(): void;
27
+ protected emitChange(): void;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateRangeInputComponent<any>, never>;
29
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateRangeInputComponent<any>, "array-date-range-input", never, { "entity": "entity"; "key": "key"; "metadata": "metadata"; "getValidationErrorMessage": "getValidationErrorMessage"; }, { "inputChangeEvent": "inputChangeEvent"; }, never, never>;
30
+ }
@@ -0,0 +1,32 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { DateTimeArrayDecoratorConfigInternal } from '../../../../decorators/array/array-decorator-internal.data';
3
+ import { NgModel } from '@angular/forms';
4
+ import { DateUtilities } from '../../../../classes/date.utilities';
5
+ import { ArrayTable } from '../array-table.class';
6
+ import { MatDialog } from '@angular/material/dialog';
7
+ import { Time } from '@angular/common';
8
+ import { DropdownValue } from '../../../../decorators/base/dropdown-value.interface';
9
+ import { BaseEntityType } from '../../../../classes/entity.model';
10
+ import * as i0 from "@angular/core";
11
+ export declare class ArrayDateTimeInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTable<Date, EntityType> implements OnInit {
12
+ private readonly dialog;
13
+ DateUtilities: typeof DateUtilities;
14
+ entity: EntityType;
15
+ key: keyof EntityType;
16
+ getValidationErrorMessage: (model: NgModel) => string;
17
+ inputChangeEvent: EventEmitter<void>;
18
+ metadata: DateTimeArrayDecoratorConfigInternal;
19
+ dateTime?: Date;
20
+ time?: Time;
21
+ timeDropdownValues: DropdownValue<Time>[];
22
+ constructor(dialog: MatDialog);
23
+ ngOnInit(): void;
24
+ protected resetInput(): void;
25
+ /**
26
+ * Adds a date time to the array.
27
+ */
28
+ addDateTime(): void;
29
+ protected emitChange(): void;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateTimeInputComponent<any>, never>;
31
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateTimeInputComponent<any>, "array-date-time-input", never, { "entity": "entity"; "key": "key"; "getValidationErrorMessage": "getValidationErrorMessage"; }, { "inputChangeEvent": "inputChangeEvent"; }, never, never>;
32
+ }