ngx-material-entity 0.1.3 → 0.1.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 (85) hide show
  1. package/README.md +533 -326
  2. package/classes/{base-builder.class.d.ts → base.builder.d.ts} +0 -0
  3. package/classes/date.utilities.d.ts +58 -0
  4. package/classes/entity.model.d.ts +13 -0
  5. package/classes/{entity-service.class.d.ts → entity.service.d.ts} +9 -4
  6. package/classes/{entity-utilities.class.d.ts → entity.utilities.d.ts} +24 -16
  7. package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +1 -1
  8. package/components/input/add-array-item-dialog-data.builder.d.ts +3 -4
  9. package/components/input/add-array-item-dialog-data.d.ts +1 -2
  10. package/components/input/input.component.d.ts +38 -7
  11. package/components/input/input.module.d.ts +2 -1
  12. package/components/table/create-dialog/create-dialog-data.builder.d.ts +1 -1
  13. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +4 -5
  14. package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -3
  15. package/components/table/create-dialog/create-entity-dialog.component.d.ts +3 -4
  16. package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +3 -4
  17. package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +2 -3
  18. package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +4 -5
  19. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +3 -4
  20. package/components/table/table-data.builder.d.ts +9 -9
  21. package/components/table/table-data.d.ts +8 -8
  22. package/components/table/table.component.d.ts +1 -2
  23. package/decorators/array/array-decorator-internal.data.d.ts +3 -3
  24. package/decorators/array/array-decorator.data.d.ts +4 -4
  25. package/decorators/array/array.decorator.d.ts +1 -2
  26. package/decorators/base/decorator-types.enum.d.ts +6 -3
  27. package/decorators/base/dropdown-value.interface.d.ts +14 -0
  28. package/decorators/date/date-decorator-internal.data.d.ts +44 -0
  29. package/decorators/date/date-decorator.data.d.ts +129 -0
  30. package/decorators/number/number-decorator-internal.data.d.ts +2 -4
  31. package/decorators/number/number-decorator.data.d.ts +2 -4
  32. package/decorators/number/number.decorator.d.ts +2 -2
  33. package/decorators/object/object-decorator-internal.data.d.ts +3 -3
  34. package/decorators/object/object-decorator.data.d.ts +5 -5
  35. package/decorators/object/object.decorator.d.ts +1 -2
  36. package/decorators/string/string-decorator-internal.data.d.ts +2 -4
  37. package/decorators/string/string-decorator.data.d.ts +2 -4
  38. package/esm2020/classes/base.builder.mjs +43 -0
  39. package/esm2020/classes/date.utilities.mjs +138 -0
  40. package/esm2020/classes/entity.model.mjs +19 -0
  41. package/esm2020/classes/entity.service.mjs +83 -0
  42. package/esm2020/classes/entity.utilities.mjs +538 -0
  43. package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +2 -2
  44. package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +4 -4
  45. package/esm2020/components/input/add-array-item-dialog-data.mjs +1 -1
  46. package/esm2020/components/input/input.component.mjs +82 -14
  47. package/esm2020/components/input/input.module.mjs +8 -4
  48. package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +2 -2
  49. package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +2 -2
  50. package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
  51. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +2 -2
  52. package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +2 -2
  53. package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
  54. package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +2 -2
  55. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +3 -3
  56. package/esm2020/components/table/table-data.builder.mjs +2 -2
  57. package/esm2020/components/table/table-data.mjs +1 -1
  58. package/esm2020/components/table/table.component.mjs +2 -2
  59. package/esm2020/decorators/array/array-decorator-internal.data.mjs +1 -1
  60. package/esm2020/decorators/array/array-decorator.data.mjs +1 -1
  61. package/esm2020/decorators/array/array.decorator.mjs +1 -1
  62. package/esm2020/decorators/base/decorator-types.enum.mjs +4 -1
  63. package/esm2020/decorators/base/dropdown-value.interface.mjs +2 -0
  64. package/esm2020/decorators/date/date-decorator-internal.data.mjs +48 -0
  65. package/esm2020/decorators/date/date-decorator.data.mjs +7 -0
  66. package/esm2020/decorators/number/number-decorator-internal.data.mjs +1 -1
  67. package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
  68. package/esm2020/decorators/number/number.decorator.mjs +3 -3
  69. package/esm2020/decorators/object/object-decorator-internal.data.mjs +2 -2
  70. package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
  71. package/esm2020/decorators/object/object.decorator.mjs +1 -1
  72. package/esm2020/decorators/string/string-decorator-internal.data.mjs +1 -1
  73. package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
  74. package/esm2020/public-api.mjs +7 -5
  75. package/fesm2015/ngx-material-entity.mjs +461 -82
  76. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  77. package/fesm2020/ngx-material-entity.mjs +460 -82
  78. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  79. package/package.json +7 -1
  80. package/public-api.d.ts +7 -4
  81. package/classes/entity-model.class.d.ts +0 -9
  82. package/esm2020/classes/base-builder.class.mjs +0 -43
  83. package/esm2020/classes/entity-model.class.mjs +0 -19
  84. package/esm2020/classes/entity-service.class.mjs +0 -76
  85. package/esm2020/classes/entity-utilities.class.mjs +0 -377
@@ -0,0 +1,58 @@
1
+ import { Time } from '@angular/common';
2
+ import { DropdownValue } from '../decorators/base/dropdown-value.interface';
3
+ import { DateRangeDateDecoratorConfigInternal } from '../decorators/date/date-decorator-internal.data';
4
+ /**
5
+ * Valid steps from one time value to the next. Needs to be able to divide 60 minutes without remainder.
6
+ */
7
+ declare type MinuteSteps = 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30 | 60;
8
+ /**
9
+ * Contains Helper Functions for handling date properties.
10
+ */
11
+ export declare abstract class DateUtilities {
12
+ /**
13
+ * Gets the given value as a date value.
14
+ *
15
+ * @param value - The value to get as a date.
16
+ * @returns The given value as a date.
17
+ */
18
+ static asDate(value: unknown): Date;
19
+ /**
20
+ * Gets the default times used by the DateTime picker when nothing is specified by the user.
21
+ *
22
+ * @param format - The time format. Defaults to 24.
23
+ * @param minuteSteps - The steps from one time value to the next. Defaults to 30.
24
+ * @returns Times in the 24 hour format from 0:00 until 23:30 in 30 minute steps.
25
+ */
26
+ static getDefaultTimes(format?: 12 | 24, minuteSteps?: MinuteSteps): DropdownValue<Time>[];
27
+ private static getTimeDropdownValue;
28
+ private static getFormattedHour;
29
+ private static getFormattedMinute;
30
+ /**
31
+ * Gets the Time object from the given date.
32
+ *
33
+ * @param value - The date to get the time object from.
34
+ * @returns The Time object build from the date value.
35
+ */
36
+ static getTimeFromDate(value: Date): Time;
37
+ /**
38
+ * Gets the dates between the two given gates. Does additional filtering based on the provided DateRange metadata.
39
+ *
40
+ * @param startDate - The start date.
41
+ * @param endDate - The end date.
42
+ * @param metadataDateRangeDate - The metadata.
43
+ * @returns All dates between the two provided dates. Includes start and end date.
44
+ */
45
+ static getDatesBetween(startDate: Date, endDate: Date, metadataDateRangeDate: DateRangeDateDecoratorConfigInternal): Date[];
46
+ /**
47
+ * Get all valid times for the dropdown of a datetime property.
48
+ *
49
+ * @param date - The date of the datetime.
50
+ * @param times - All given times to filter.
51
+ * @param min - The function that defines the minimum time.
52
+ * @param max - The function that defines the maximum time.
53
+ * @param filter - A filter function to do more specific time filtering. This could be e.g. The removal of lunch breaks.
54
+ * @returns All valid dropdown values for the datetime property.
55
+ */
56
+ static getValidTimesForDropdown(date: Date, times: DropdownValue<Time>[], min?: (date?: Date) => Time, max?: (date?: Date) => Time, filter?: ((time: Time) => boolean) | (() => boolean)): DropdownValue<Time>[];
57
+ }
58
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The newable type used whenever an entity class is passed to create an entity and initialize its metadata.
3
+ */
4
+ export declare type EntityClassNewable<EntityType extends object> = new (data?: EntityType) => EntityType;
5
+ /**
6
+ * A base Entity class with a builtin id.
7
+ */
8
+ export declare abstract class Entity {
9
+ /**
10
+ * A unique identifier for the Entity.
11
+ */
12
+ id: string;
13
+ }
@@ -1,4 +1,3 @@
1
- import { Entity } from './entity-model.class';
2
1
  import { HttpClient } from '@angular/common/http';
3
2
  import { BehaviorSubject } from 'rxjs';
4
3
  /**
@@ -7,7 +6,7 @@ import { BehaviorSubject } from 'rxjs';
7
6
  * You should create a service for every Entity you have.
8
7
  * If you extend from this you need to make sure that the extended Service can be injected.
9
8
  */
10
- export declare abstract class EntityService<EntityType extends Entity> {
9
+ export declare abstract class EntityService<EntityType extends object> {
11
10
  private readonly http;
12
11
  /**
13
12
  * The base url used for api requests. If u want to have more control over this,
@@ -22,6 +21,12 @@ export declare abstract class EntityService<EntityType extends Entity> {
22
21
  * Delete Sends a DEL-Request to baseUrl/{id}.
23
22
  */
24
23
  abstract readonly baseUrl: string;
24
+ /**
25
+ * The key which holds the id value.
26
+ *
27
+ * @default 'id'
28
+ */
29
+ readonly idKey: keyof EntityType;
25
30
  /**
26
31
  * A subject of all the entity values.
27
32
  * Can be subscribed to when you want to do a specific thing whenever the entities change.
@@ -60,7 +65,7 @@ export declare abstract class EntityService<EntityType extends Entity> {
60
65
  /**
61
66
  * Deletes a specific Entity.
62
67
  *
63
- * @param id - The id of the element to delete.
68
+ * @param entity - The entity to delete.
64
69
  */
65
- delete(id: string): Promise<void>;
70
+ delete(entity: EntityType): Promise<void>;
66
71
  }
@@ -1,5 +1,4 @@
1
1
  import { DecoratorType, DecoratorTypes } from '../decorators/base/decorator-types.enum';
2
- import { Entity } from './entity-model.class';
3
2
  /**
4
3
  * Contains HelperMethods around handling Entities and their property-metadata.
5
4
  */
@@ -10,14 +9,14 @@ export declare abstract class EntityUtilities {
10
9
  * @param entity - The entity to get the properties which should be left out for updating from.
11
10
  * @returns The properties which should be left out for updating an Entity.
12
11
  */
13
- static getOmitForUpdate<EntityType extends Entity>(entity: EntityType): (keyof EntityType)[];
12
+ static getOmitForUpdate<EntityType extends object>(entity: EntityType): (keyof EntityType)[];
14
13
  /**
15
14
  * Gets the properties to omit when creating new entities.
16
15
  *
17
16
  * @param entity - The entity to get the properties which should be left out for creating from.
18
17
  * @returns The properties which should be left out for creating a new Entity.
19
18
  */
20
- static getOmitForCreate<EntityType extends Entity>(entity: EntityType): (keyof EntityType)[];
19
+ static getOmitForCreate<EntityType extends object>(entity: EntityType): (keyof EntityType)[];
21
20
  /**
22
21
  * Gets the metadata included in an property.
23
22
  *
@@ -27,7 +26,7 @@ export declare abstract class EntityUtilities {
27
26
  * @returns The metadata of the property.
28
27
  * @throws When no metadata can be found for the given property.
29
28
  */
30
- static getPropertyMetadata<EntityType extends Entity, T extends DecoratorTypes>(entity: EntityType, propertyKey: keyof EntityType, type?: T): DecoratorType<T>;
29
+ static getPropertyMetadata<EntityType extends object, T extends DecoratorTypes>(entity: EntityType, propertyKey: keyof EntityType, type?: T): DecoratorType<T>;
31
30
  /**
32
31
  * Gets the type of the property-metadata.
33
32
  *
@@ -36,7 +35,7 @@ export declare abstract class EntityUtilities {
36
35
  * @returns The type of the metadata.
37
36
  * @throws Will throw an error if no metadata can be found for the given property.
38
37
  */
39
- static getPropertyType<EntityType extends Entity>(entity: EntityType, propertyKey: keyof EntityType): DecoratorTypes;
38
+ static getPropertyType<EntityType extends object>(entity: EntityType, propertyKey: keyof EntityType): DecoratorTypes;
40
39
  /**
41
40
  * Sets all property values based on a given entity data-object.
42
41
  *
@@ -46,7 +45,7 @@ export declare abstract class EntityUtilities {
46
45
  * @alias build
47
46
  * @alias construct
48
47
  */
49
- static new<EntityType extends Entity>(target: EntityType, entity?: EntityType): void;
48
+ static new<EntityType extends object>(target: EntityType, entity?: EntityType): void;
50
49
  static construct: typeof EntityUtilities.new;
51
50
  static build: typeof EntityUtilities.new;
52
51
  /**
@@ -57,7 +56,7 @@ export declare abstract class EntityUtilities {
57
56
  * @param omit - Whether to check for creating or editing validity.
58
57
  * @returns Whether or not the entity is valid.
59
58
  */
60
- static isEntityValid<EntityType extends Entity>(entity: EntityType, omit: 'create' | 'update'): boolean;
59
+ static isEntityValid<EntityType extends object>(entity: EntityType, omit: 'create' | 'update'): boolean;
61
60
  /**
62
61
  * Checks if a single property value is valid.
63
62
  *
@@ -68,6 +67,12 @@ export declare abstract class EntityUtilities {
68
67
  * @throws Throws when it extracts an unknown metadata type.
69
68
  */
70
69
  private static isPropertyValid;
70
+ private static isStringValid;
71
+ private static isTextboxValid;
72
+ private static isNumberValid;
73
+ private static isDateValid;
74
+ private static isDateRangeValid;
75
+ private static isDateTimeValid;
71
76
  /**
72
77
  * Checks if an entity is "dirty" (if its values have changed).
73
78
  *
@@ -75,7 +80,8 @@ export declare abstract class EntityUtilities {
75
80
  * @param entityPriorChanges - The entity before the changes.
76
81
  * @returns Whether or not the entity is dirty.
77
82
  */
78
- static dirty(entity: Entity, entityPriorChanges: Entity): boolean;
83
+ static dirty<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): boolean;
84
+ private static differencesForDirty;
79
85
  /**
80
86
  * Compares two Entities and returns their difference in an object.
81
87
  *
@@ -83,16 +89,18 @@ export declare abstract class EntityUtilities {
83
89
  * @param entityPriorChanges - The second entity to compare.
84
90
  * @returns The difference between the two Entities in form of a Partial.
85
91
  */
86
- static difference<EntityType extends Entity>(entity: EntityType, entityPriorChanges: EntityType): Partial<EntityType>;
92
+ static difference<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): Partial<EntityType>;
93
+ private static isEqual;
94
+ private static isDateRange;
87
95
  /**
88
96
  * Compare function for sorting entity keys by their order value.
89
97
  *
90
98
  * @param a - First key of entity.
91
99
  * @param b - Second key of entity.
92
100
  * @param entity - Current entity (used to get metadata of entity keys).
93
- * @returns 0 if both values have the same order, a negative value if X, a positive value if Y.
101
+ * @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'.
94
102
  */
95
- static compareOrder<EntityType extends Entity>(a: keyof EntityType, b: keyof EntityType, entity: EntityType): number;
103
+ static compareOrder<EntityType extends object>(a: keyof EntityType, b: keyof EntityType, entity: EntityType): number;
96
104
  /**
97
105
  * Gets the bootstrap column values for "lg", "md", "sm".
98
106
  *
@@ -101,14 +109,14 @@ export declare abstract class EntityUtilities {
101
109
  * @param type - Defines for which screen size the column values should be returned.
102
110
  * @returns Bootstrap column value.
103
111
  */
104
- static getWidth<EntityType extends Entity>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
112
+ static getWidth<EntityType extends object>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
105
113
  /**
106
114
  * Resets all changes on an entity.
107
115
  *
108
116
  * @param entity - The entity to reset.
109
117
  * @param entityPriorChanges - The entity before any changes.
110
118
  */
111
- static resetChangesOnEntity<EntityType extends Entity>(entity: EntityType, entityPriorChanges: EntityType): void;
119
+ static resetChangesOnEntity<EntityType extends object>(entity: EntityType, entityPriorChanges: EntityType): void;
112
120
  /**
113
121
  * Gets the rows that are used to display the given entity.
114
122
  *
@@ -117,7 +125,7 @@ export declare abstract class EntityUtilities {
117
125
  * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
118
126
  * @returns The sorted Rows containing the row number and the keys to display in that row.
119
127
  */
120
- static getEntityRows<EntityType extends Entity>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
128
+ static getEntityRows<EntityType extends object>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
121
129
  private static getKeysForRow;
122
130
  private static getNumberOfRows;
123
131
  /**
@@ -128,12 +136,12 @@ export declare abstract class EntityUtilities {
128
136
  * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
129
137
  * @returns An array of keys of the entity.
130
138
  */
131
- static keysOf<EntityType extends Entity>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
139
+ static keysOf<EntityType extends object>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
132
140
  }
133
141
  /**
134
142
  * A row that contains all the information about how to display an entity.
135
143
  */
136
- export interface EntityRow<EntityType extends Entity> {
144
+ export interface EntityRow<EntityType extends object> {
137
145
  /**
138
146
  * The row in which this should be displayed.
139
147
  */
@@ -1,4 +1,4 @@
1
- import { BaseBuilder } from '../../classes/base-builder.class';
1
+ import { BaseBuilder } from '../../classes/base.builder';
2
2
  import { ConfirmDialogData, ConfirmDialogTypes } from './confirm-dialog-data';
3
3
  /**
4
4
  * The internal ConfirmDialogData. Requires all default values the user can leave out.
@@ -1,12 +1,11 @@
1
1
  import { NgModel } from '@angular/forms';
2
- import { BaseBuilder } from '../../classes/base-builder.class';
3
- import { Entity } from '../../classes/entity-model.class';
2
+ import { BaseBuilder } from '../../classes/base.builder';
4
3
  import { CreateDialogDataInternal } from '../table/create-dialog/create-dialog-data.builder';
5
4
  import { AddArrayItemDialogData } from './add-array-item-dialog-data';
6
5
  /**
7
6
  * The internal AddArrayItemDialogData. Requires all default values the user can leave out.
8
7
  */
9
- export declare class AddArrayItemDialogDataInternal<EntityType extends Entity> implements AddArrayItemDialogData<EntityType> {
8
+ export declare class AddArrayItemDialogDataInternal<EntityType extends object> implements AddArrayItemDialogData<EntityType> {
10
9
  entity: EntityType;
11
10
  createDialogData: CreateDialogDataInternal;
12
11
  getValidationErrorMessage: (model: NgModel) => string;
@@ -15,7 +14,7 @@ export declare class AddArrayItemDialogDataInternal<EntityType extends Entity> i
15
14
  /**
16
15
  * The Builder for the AddArrayItemDialogData. Sets default values.
17
16
  */
18
- export declare class AddArrayItemDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<AddArrayItemDialogDataInternal<EntityType>, AddArrayItemDialogData<EntityType>> {
17
+ export declare class AddArrayItemDialogDataBuilder<EntityType extends object> extends BaseBuilder<AddArrayItemDialogDataInternal<EntityType>, AddArrayItemDialogData<EntityType>> {
19
18
  constructor(data: AddArrayItemDialogData<EntityType>);
20
19
  protected generateBaseData(data: AddArrayItemDialogData<EntityType>): AddArrayItemDialogDataInternal<EntityType>;
21
20
  }
@@ -1,10 +1,9 @@
1
1
  import { NgModel } from '@angular/forms';
2
- import { Entity } from '../../classes/entity-model.class';
3
2
  import { CreateDialogData } from '../table/table-data';
4
3
  /**
5
4
  * The configuration options for the dialog that adds items to an array.
6
5
  */
7
- export interface AddArrayItemDialogData<EntityType extends Entity> {
6
+ export interface AddArrayItemDialogData<EntityType extends object> {
8
7
  /**
9
8
  * An empty entity that is used as the data model.
10
9
  */
@@ -1,7 +1,6 @@
1
1
  import { OnInit, TemplateRef } from '@angular/core';
2
2
  import { NgModel } from '@angular/forms';
3
- import { EntityRow, EntityUtilities } from '../../classes/entity-utilities.class';
4
- import { Entity } from '../../classes/entity-model.class';
3
+ import { EntityRow, EntityUtilities } from '../../classes/entity.utilities';
5
4
  import { DecoratorTypes } from '../../decorators/base/decorator-types.enum';
6
5
  import { MatChipInputEvent } from '@angular/material/chips';
7
6
  import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
@@ -16,6 +15,12 @@ import { SelectionModel } from '@angular/cdk/collections';
16
15
  import { AddArrayItemDialogDataInternal } from './add-array-item-dialog-data.builder';
17
16
  import { AddArrayItemDialogData } from './add-array-item-dialog-data';
18
17
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
18
+ import { DateRangeDateDecoratorConfigInternal, DateTimeDateDecoratorConfigInternal, DefaultDateDecoratorConfigInternal } from '../../decorators/date/date-decorator-internal.data';
19
+ import { DateUtilities } from '../../classes/date.utilities';
20
+ import { DateFilterFn } from '@angular/material/datepicker';
21
+ import { DateRange } from '../../decorators/date/date-decorator.data';
22
+ import { Time } from '@angular/common';
23
+ import { DropdownValue } from '../../decorators/base/dropdown-value.interface';
19
24
  import * as i0 from "@angular/core";
20
25
  /**
21
26
  * The default input component. It gets the metadata of the property from the given @Input "entity" and @Input "propertyKey"
@@ -25,7 +30,7 @@ import * as i0 from "@angular/core";
25
30
  * that it should be omitted for creating or updating.
26
31
  * The last part being mostly relevant if you want to use this component inside an ngFor.
27
32
  */
28
- export declare class NgxMatEntityInputComponent<EntityType extends Entity> implements OnInit {
33
+ export declare class NgxMatEntityInputComponent<EntityType extends object> implements OnInit {
29
34
  private readonly dialog;
30
35
  /**
31
36
  * The entity on which the property exists. Used in conjunction with the "propertyKey"
@@ -64,14 +69,23 @@ export declare class NgxMatEntityInputComponent<EntityType extends Entity> imple
64
69
  metadataDefaultNumber: DefaultNumberDecoratorConfigInternal;
65
70
  metadataDropdownNumber: DropdownNumberDecoratorConfigInternal;
66
71
  metadataDefaultObject: DefaultObjectDecoratorConfigInternal<EntityType>;
67
- objectProperty: Entity;
68
- objectPropertyRows: EntityRow<Entity>[];
69
- metadataEntityArray: EntityArrayDecoratorConfigInternal<Entity>;
72
+ objectProperty: EntityType;
73
+ objectPropertyRows: EntityRow<EntityType>[];
74
+ metadataEntityArray: EntityArrayDecoratorConfigInternal<EntityType>;
70
75
  entityArrayValues: EntityType[];
71
76
  metadataStringChipsArray: StringChipsArrayDecoratorConfigInternal;
72
77
  stringChipsArrayValues: string[];
73
78
  chipsInput: string;
74
79
  metadataAutocompleteStringChipsArray: AutocompleteStringChipsArrayDecoratorConfigInternal;
80
+ metadataDefaultDate: DefaultDateDecoratorConfigInternal;
81
+ metadataDateRangeDate: DateRangeDateDecoratorConfigInternal;
82
+ metadataDateTimeDate: DateTimeDateDecoratorConfigInternal;
83
+ dateRange: DateRange;
84
+ dateRangeStart: Date;
85
+ dateRangeEnd: Date;
86
+ dateTime: Date;
87
+ time: Time;
88
+ timeDropdownValues: DropdownValue<Time>[];
75
89
  arrayItem: EntityType;
76
90
  private arrayItemPriorChanges;
77
91
  arrayItemInlineRows: EntityRow<EntityType>[];
@@ -83,8 +97,9 @@ export declare class NgxMatEntityInputComponent<EntityType extends Entity> imple
83
97
  arrayItemDialogRows: EntityRow<EntityType>[];
84
98
  readonly DecoratorTypes: typeof DecoratorTypes;
85
99
  EntityUtilities: typeof EntityUtilities;
86
- getWidth: typeof EntityUtilities.getWidth;
100
+ DateUtilities: typeof DateUtilities;
87
101
  constructor(dialog: MatDialog);
102
+ defaultDateFilter: DateFilterFn<Date | null | undefined>;
88
103
  /**
89
104
  * This is needed for the inputs to work inside an ngFor.
90
105
  *
@@ -93,6 +108,22 @@ export declare class NgxMatEntityInputComponent<EntityType extends Entity> imple
93
108
  */
94
109
  trackByFn(index: unknown): unknown;
95
110
  ngOnInit(): void;
111
+ /**
112
+ * Checks if two times are equal. Is needed for the dropdown.
113
+ *
114
+ * @param time1 - The first time to compare.
115
+ * @param time2 - The second time to compare.
116
+ * @returns Whether or not the time objects are the same.
117
+ */
118
+ compareTimes(time1: Time, time2: Time): boolean;
119
+ /**
120
+ * Updates the date range values based on the start and end date.
121
+ */
122
+ setDateRangeValues(): void;
123
+ /**
124
+ * Sets the time on a datetime property.
125
+ */
126
+ setTime(): void;
96
127
  /**
97
128
  * Tries to add an item to the array.
98
129
  * Does this either inline if the "createInline"-metadata is set to true
@@ -13,8 +13,9 @@ import * as i11 from "@angular/material/icon";
13
13
  import * as i12 from "@angular/material/table";
14
14
  import * as i13 from "@angular/material/dialog";
15
15
  import * as i14 from "@angular/material/button";
16
+ import * as i15 from "@angular/material/datepicker";
16
17
  export declare class NgxMatEntityInputModule {
17
18
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityInputModule, never>;
18
- static ɵmod: i0.ɵɵNgModuleDeclaration<NgxMatEntityInputModule, [typeof i1.NgxMatEntityInputComponent], [typeof i2.CommonModule, typeof i3.MatInputModule, typeof i4.FormsModule, typeof i5.MatFormFieldModule, typeof i6.MatSelectModule, typeof i7.MatAutocompleteModule, typeof i8.MatCheckboxModule, typeof i9.MatSlideToggleModule, typeof i10.MatChipsModule, typeof i11.MatIconModule, typeof i12.MatTableModule, typeof i13.MatDialogModule, typeof i14.MatButtonModule], [typeof i1.NgxMatEntityInputComponent]>;
19
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxMatEntityInputModule, [typeof i1.NgxMatEntityInputComponent], [typeof i2.CommonModule, typeof i3.MatInputModule, typeof i4.FormsModule, typeof i5.MatFormFieldModule, typeof i6.MatSelectModule, typeof i7.MatAutocompleteModule, typeof i8.MatCheckboxModule, typeof i9.MatSlideToggleModule, typeof i10.MatChipsModule, typeof i11.MatIconModule, typeof i12.MatTableModule, typeof i13.MatDialogModule, typeof i14.MatButtonModule, typeof i15.MatDatepickerModule], [typeof i1.NgxMatEntityInputComponent]>;
19
20
  static ɵinj: i0.ɵɵInjectorDeclaration<NgxMatEntityInputModule>;
20
21
  }
@@ -1,4 +1,4 @@
1
- import { BaseBuilder } from '../../../classes/base-builder.class';
1
+ import { BaseBuilder } from '../../../classes/base.builder';
2
2
  import { ConfirmDialogDataInternal } from '../../confirm-dialog/confirm-dialog-data.builder';
3
3
  import { CreateDialogData } from '../table-data';
4
4
  /**
@@ -1,13 +1,12 @@
1
- import { EntityService } from '../../../classes/entity-service.class';
2
- import { Entity } from '../../../classes/entity-model.class';
1
+ import { EntityService } from '../../../classes/entity.service';
3
2
  import { CreateEntityDialogData } from './create-entity-dialog-data';
4
3
  import { HttpClient } from '@angular/common/http';
5
4
  import { CreateDialogDataInternal } from './create-dialog-data.builder';
6
- import { BaseBuilder } from '../../../classes/base-builder.class';
5
+ import { BaseBuilder } from '../../../classes/base.builder';
7
6
  /**
8
7
  * The internal CreateEntityDialogData. Requires all default values the user can leave out.
9
8
  */
10
- export declare class CreateEntityDialogDataInternal<EntityType extends Entity> implements CreateEntityDialogData<EntityType> {
9
+ export declare class CreateEntityDialogDataInternal<EntityType extends object> implements CreateEntityDialogData<EntityType> {
11
10
  entity: EntityType;
12
11
  EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
13
12
  createDialogData: CreateDialogDataInternal;
@@ -16,7 +15,7 @@ export declare class CreateEntityDialogDataInternal<EntityType extends Entity> i
16
15
  /**
17
16
  * The Builder for the CreateEntityDialogData. Sets default values.
18
17
  */
19
- export declare class CreateEntityDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<CreateEntityDialogDataInternal<EntityType>, CreateEntityDialogData<EntityType>> {
18
+ export declare class CreateEntityDialogDataBuilder<EntityType extends object> extends BaseBuilder<CreateEntityDialogDataInternal<EntityType>, CreateEntityDialogData<EntityType>> {
20
19
  constructor(data: CreateEntityDialogData<EntityType>);
21
20
  protected generateBaseData(data: CreateEntityDialogData<EntityType>): CreateEntityDialogDataInternal<EntityType>;
22
21
  }
@@ -1,11 +1,10 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
- import { EntityService } from '../../../classes/entity-service.class';
3
- import { Entity } from '../../../classes/entity-model.class';
2
+ import { EntityService } from '../../../classes/entity.service';
4
3
  import { CreateDialogData } from '../table-data';
5
4
  /**
6
5
  * The Definition of the Create Entity Dialog Data.
7
6
  */
8
- export interface CreateEntityDialogData<EntityType extends Entity> {
7
+ export interface CreateEntityDialogData<EntityType extends object> {
9
8
  /**
10
9
  * An empty entity that is used as the data model.
11
10
  */
@@ -1,8 +1,7 @@
1
1
  import { Injector, OnInit } from '@angular/core';
2
2
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
3
- import { EntityService } from '../../../classes/entity-service.class';
4
- import { Entity } from '../../../classes/entity-model.class';
5
- import { EntityRow, EntityUtilities } from '../../../classes/entity-utilities.class';
3
+ import { EntityService } from '../../../classes/entity.service';
4
+ import { EntityRow, EntityUtilities } from '../../../classes/entity.utilities';
6
5
  import { CreateEntityDialogDataInternal } from './create-entity-dialog-data.builder';
7
6
  import { CreateEntityDialogData } from './create-entity-dialog-data';
8
7
  import * as i0 from "@angular/core";
@@ -12,7 +11,7 @@ import * as i0 from "@angular/core";
12
11
  *
13
12
  * It offers a lot of customization options which can be found in "CreateEntityDialogData".
14
13
  */
15
- export declare class NgxMatEntityCreateDialogComponent<EntityType extends Entity> implements OnInit {
14
+ export declare class NgxMatEntityCreateDialogComponent<EntityType extends object> implements OnInit {
16
15
  private readonly inputData;
17
16
  dialogRef: MatDialogRef<NgxMatEntityCreateDialogComponent<EntityType>>;
18
17
  private readonly injector;
@@ -1,11 +1,10 @@
1
- import { BaseBuilder } from '../../../classes/base-builder.class';
2
- import { Entity } from '../../../classes/entity-model.class';
1
+ import { BaseBuilder } from '../../../classes/base.builder';
3
2
  import { ConfirmDialogData } from '../../confirm-dialog/confirm-dialog-data';
4
3
  import { EditDialogData } from '../table-data';
5
4
  /**
6
5
  * The internal EditDialogData. Requires all default values the user can leave out.
7
6
  */
8
- export declare class EditDialogDataInternal<EntityType extends Entity> implements EditDialogData<EntityType> {
7
+ export declare class EditDialogDataInternal<EntityType extends object> implements EditDialogData<EntityType> {
9
8
  title: (entity: EntityType) => string;
10
9
  confirmButtonLabel: string;
11
10
  deleteButtonLabel: string;
@@ -19,7 +18,7 @@ export declare class EditDialogDataInternal<EntityType extends Entity> implement
19
18
  /**
20
19
  * The Builder for the EditDialogData. Sets default values.
21
20
  */
22
- export declare class EditDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<EditDialogDataInternal<EntityType>, EditDialogData<EntityType>> {
21
+ export declare class EditDialogDataBuilder<EntityType extends object> extends BaseBuilder<EditDialogDataInternal<EntityType>, EditDialogData<EntityType>> {
23
22
  constructor(data?: EditDialogData<EntityType>);
24
23
  protected generateBaseData(data?: EditDialogData<EntityType>): EditDialogDataInternal<EntityType>;
25
24
  }
@@ -1,11 +1,10 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
- import { EntityService } from '../../../classes/entity-service.class';
3
- import { Entity } from '../../../classes/entity-model.class';
2
+ import { EntityService } from '../../../classes/entity.service';
4
3
  import { EditDialogData } from '../table-data';
5
4
  /**
6
5
  * The Definition of the Edit Entity Dialog Data.
7
6
  */
8
- export interface EditEntityDialogData<EntityType extends Entity> {
7
+ export interface EditEntityDialogData<EntityType extends object> {
9
8
  /**
10
9
  * The entity to edit.
11
10
  */
@@ -1,13 +1,12 @@
1
- import { EntityService } from '../../../classes/entity-service.class';
2
- import { Entity } from '../../../classes/entity-model.class';
1
+ import { EntityService } from '../../../classes/entity.service';
3
2
  import { HttpClient } from '@angular/common/http';
4
3
  import { EditEntityDialogData } from './edit-entity-dialog-data';
5
4
  import { EditDialogDataInternal } from './edit-dialog-data.builder';
6
- import { BaseBuilder } from '../../../classes/base-builder.class';
5
+ import { BaseBuilder } from '../../../classes/base.builder';
7
6
  /**
8
7
  * The internal EditEntityDialogData. Requires all default values the user can leave out.
9
8
  */
10
- export declare class EditEntityDialogDataInternal<EntityType extends Entity> implements EditEntityDialogData<EntityType> {
9
+ export declare class EditEntityDialogDataInternal<EntityType extends object> implements EditEntityDialogData<EntityType> {
11
10
  entity: EntityType;
12
11
  EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
13
12
  editDialogData: EditDialogDataInternal<EntityType>;
@@ -17,7 +16,7 @@ export declare class EditEntityDialogDataInternal<EntityType extends Entity> imp
17
16
  /**
18
17
  * The Builder for the EditEntityDialogData. Sets default values.
19
18
  */
20
- export declare class EditEntityDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<EditEntityDialogDataInternal<EntityType>, EditEntityDialogData<EntityType>> {
19
+ export declare class EditEntityDialogDataBuilder<EntityType extends object> extends BaseBuilder<EditEntityDialogDataInternal<EntityType>, EditEntityDialogData<EntityType>> {
21
20
  constructor(data: EditEntityDialogData<EntityType>);
22
21
  protected generateBaseData(data: EditEntityDialogData<EntityType>): EditEntityDialogDataInternal<EntityType>;
23
22
  }
@@ -1,8 +1,7 @@
1
1
  import { Injector, OnInit } from '@angular/core';
2
2
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
3
- import { EntityService } from '../../../classes/entity-service.class';
4
- import { Entity } from '../../../classes/entity-model.class';
5
- import { EntityRow, EntityUtilities } from '../../../classes/entity-utilities.class';
3
+ import { EntityService } from '../../../classes/entity.service';
4
+ import { EntityRow, EntityUtilities } from '../../../classes/entity.utilities';
6
5
  import { EditEntityDialogData } from './edit-entity-dialog-data';
7
6
  import { EditEntityDialogDataInternal } from './edit-entity-dialog.builder';
8
7
  import * as i0 from "@angular/core";
@@ -12,7 +11,7 @@ import * as i0 from "@angular/core";
12
11
  *
13
12
  * It offers a lot of customization options which can be found in "EditEntityDialogData".
14
13
  */
15
- export declare class NgxMatEntityEditDialogComponent<EntityType extends Entity> implements OnInit {
14
+ export declare class NgxMatEntityEditDialogComponent<EntityType extends object> implements OnInit {
16
15
  private readonly inputData;
17
16
  dialogRef: MatDialogRef<NgxMatEntityEditDialogComponent<EntityType>>;
18
17
  private readonly injector;
@@ -1,14 +1,14 @@
1
- import { EntityService } from '../../classes/entity-service.class';
2
- import { Entity } from '../../classes/entity-model.class';
1
+ import { EntityService } from '../../classes/entity.service';
3
2
  import { CreateDialogDataInternal } from './create-dialog/create-dialog-data.builder';
4
3
  import { EditDialogDataInternal } from './edit-dialog/edit-dialog-data.builder';
5
4
  import { BaseData, DisplayColumn, MultiSelectAction, TableData } from './table-data';
6
5
  import { HttpClient } from '@angular/common/http';
7
- import { BaseBuilder } from '../../classes/base-builder.class';
6
+ import { BaseBuilder } from '../../classes/base.builder';
7
+ import { EntityClassNewable } from '../../classes/entity.model';
8
8
  /**
9
9
  * The internal TableData. Requires all default values the user can leave out.
10
10
  */
11
- export declare class TableDataInternal<EntityType extends Entity> implements TableData<EntityType> {
11
+ export declare class TableDataInternal<EntityType extends object> implements TableData<EntityType> {
12
12
  baseData: BaseDataInternal<EntityType>;
13
13
  createDialogData: CreateDialogDataInternal;
14
14
  editDialogData: EditDialogDataInternal<EntityType>;
@@ -17,14 +17,14 @@ export declare class TableDataInternal<EntityType extends Entity> implements Tab
17
17
  /**
18
18
  * The Builder for the table BaseData. Sets default values.
19
19
  */
20
- export declare class BaseDataBuilder<EntityType extends Entity> extends BaseBuilder<BaseDataInternal<EntityType>, BaseData<EntityType>> {
20
+ export declare class BaseDataBuilder<EntityType extends object> extends BaseBuilder<BaseDataInternal<EntityType>, BaseData<EntityType>> {
21
21
  constructor(data: BaseData<EntityType>);
22
22
  protected generateBaseData(data: BaseData<EntityType>): BaseDataInternal<EntityType>;
23
23
  }
24
24
  /**
25
25
  * The internal TableData. Requires all default values the user can leave out.
26
26
  */
27
- export declare class BaseDataInternal<EntityType extends Entity> implements BaseData<EntityType> {
27
+ export declare class BaseDataInternal<EntityType extends object> implements BaseData<EntityType> {
28
28
  title: string;
29
29
  displayColumns: DisplayColumn<EntityType>[];
30
30
  EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
@@ -36,15 +36,15 @@ export declare class BaseDataInternal<EntityType extends Entity> implements Base
36
36
  allowDelete: (entity: EntityType) => boolean;
37
37
  multiSelectActions: MultiSelectAction<EntityType>[];
38
38
  multiSelectLabel: string;
39
- EntityClass?: new (entity?: EntityType) => EntityType;
39
+ EntityClass?: EntityClassNewable<EntityType>;
40
40
  edit?: (entity: EntityType) => unknown;
41
41
  create?: (entity: EntityType) => unknown;
42
- constructor(title: string, displayColumns: DisplayColumn<EntityType>[], EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>, searchLabel: string, createButtonLabel: string, searchString: (entity: EntityType) => string, allowCreate: boolean, allowEdit: (entity: EntityType) => boolean, allowDelete: (entity: EntityType) => boolean, multiSelectActions: MultiSelectAction<EntityType>[], multiSelectLabel: string, EntityClass?: new (entity?: EntityType) => EntityType, edit?: (entity: EntityType) => unknown, create?: (entity: EntityType) => unknown);
42
+ constructor(title: string, displayColumns: DisplayColumn<EntityType>[], EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>, searchLabel: string, createButtonLabel: string, searchString: (entity: EntityType) => string, allowCreate: boolean, allowEdit: (entity: EntityType) => boolean, allowDelete: (entity: EntityType) => boolean, multiSelectActions: MultiSelectAction<EntityType>[], multiSelectLabel: string, EntityClass?: EntityClassNewable<EntityType>, edit?: (entity: EntityType) => unknown, create?: (entity: EntityType) => unknown);
43
43
  }
44
44
  /**
45
45
  * The Builder for the complete TableData. Sets default values and validates user input.
46
46
  */
47
- export declare class TableDataBuilder<EntityType extends Entity> extends BaseBuilder<TableDataInternal<EntityType>, TableData<EntityType>> {
47
+ export declare class TableDataBuilder<EntityType extends object> extends BaseBuilder<TableDataInternal<EntityType>, TableData<EntityType>> {
48
48
  constructor(data: TableData<EntityType>);
49
49
  protected generateBaseData(data: TableData<EntityType>): TableDataInternal<EntityType>;
50
50
  protected validateInput(data: TableData<EntityType>): void;