ngx-material-entity 0.1.2 → 0.1.3

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 (97) hide show
  1. package/classes/base-builder.class.d.ts +35 -0
  2. package/classes/entity-service.class.d.ts +1 -1
  3. package/classes/entity-utilities.class.d.ts +36 -3
  4. package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +10 -11
  5. package/components/confirm-dialog/confirm-dialog-data.d.ts +4 -0
  6. package/components/confirm-dialog/confirm-dialog.component.d.ts +11 -0
  7. package/components/input/{array-table/add-array-item-dialog/add-array-item-dialog-data.builder.d.ts → add-array-item-dialog-data.builder.d.ts} +11 -7
  8. package/components/input/{array-table/add-array-item-dialog/add-array-item-dialog-data.d.ts → add-array-item-dialog-data.d.ts} +5 -2
  9. package/components/input/input.component.d.ts +100 -7
  10. package/components/input/input.module.d.ts +6 -4
  11. package/components/table/create-dialog/create-dialog-data.builder.d.ts +9 -8
  12. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +9 -3
  13. package/components/table/create-dialog/create-entity-dialog.component.d.ts +15 -3
  14. package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +9 -11
  15. package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +9 -3
  16. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +19 -3
  17. package/components/table/table-data.builder.d.ts +20 -9
  18. package/components/table/table-data.d.ts +14 -2
  19. package/components/table/table.component.d.ts +46 -0
  20. package/components/table/table.module.d.ts +3 -1
  21. package/decorators/array/array-decorator-internal.data.d.ts +13 -2
  22. package/decorators/array/array-decorator.data.d.ts +21 -12
  23. package/decorators/array/array.decorator.d.ts +1 -1
  24. package/decorators/base/property-decorator-internal.data.d.ts +16 -3
  25. package/decorators/base/property-decorator.data.d.ts +26 -5
  26. package/decorators/boolean/boolean-decorator-internal.data.d.ts +9 -0
  27. package/decorators/boolean/boolean-decorator.data.d.ts +9 -0
  28. package/decorators/boolean/boolean.decorator.d.ts +1 -1
  29. package/decorators/number/number-decorator-internal.data.d.ts +6 -0
  30. package/decorators/number/number-decorator.data.d.ts +6 -0
  31. package/decorators/number/number.decorator.d.ts +1 -1
  32. package/decorators/object/object-decorator-internal.data.d.ts +3 -0
  33. package/decorators/object/object-decorator.data.d.ts +3 -0
  34. package/decorators/object/object.decorator.d.ts +1 -1
  35. package/decorators/string/string-decorator-internal.data.d.ts +12 -0
  36. package/decorators/string/string-decorator.data.d.ts +12 -0
  37. package/decorators/string/string.decorator.d.ts +1 -1
  38. package/esm2020/classes/base-builder.class.mjs +43 -0
  39. package/esm2020/classes/entity-service.class.mjs +2 -2
  40. package/esm2020/classes/entity-utilities.class.mjs +81 -33
  41. package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +15 -48
  42. package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +1 -1
  43. package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +13 -2
  44. package/esm2020/components/get-validation-error-message.function.mjs +5 -1
  45. package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +30 -0
  46. package/esm2020/components/input/add-array-item-dialog-data.mjs +2 -0
  47. package/esm2020/components/input/input.component.mjs +170 -31
  48. package/esm2020/components/input/input.module.mjs +19 -9
  49. package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +18 -40
  50. package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +15 -7
  51. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +24 -17
  52. package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +20 -4
  53. package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +23 -63
  54. package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +15 -7
  55. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +35 -24
  56. package/esm2020/components/table/table-data.builder.mjs +30 -14
  57. package/esm2020/components/table/table-data.mjs +1 -1
  58. package/esm2020/components/table/table.component.mjs +57 -10
  59. package/esm2020/components/table/table.module.mjs +12 -4
  60. package/esm2020/decorators/array/array-decorator-internal.data.mjs +15 -4
  61. package/esm2020/decorators/array/array-decorator.data.mjs +1 -1
  62. package/esm2020/decorators/array/array.decorator.mjs +2 -2
  63. package/esm2020/decorators/base/property-decorator-internal.data.mjs +28 -5
  64. package/esm2020/decorators/base/property-decorator.data.mjs +1 -1
  65. package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +12 -1
  66. package/esm2020/decorators/boolean/boolean-decorator.data.mjs +1 -1
  67. package/esm2020/decorators/boolean/boolean.decorator.mjs +2 -2
  68. package/esm2020/decorators/number/number-decorator-internal.data.mjs +7 -1
  69. package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
  70. package/esm2020/decorators/number/number.decorator.mjs +2 -2
  71. package/esm2020/decorators/object/object-decorator-internal.data.mjs +4 -1
  72. package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
  73. package/esm2020/decorators/object/object.decorator.mjs +2 -2
  74. package/esm2020/decorators/string/string-decorator-internal.data.mjs +13 -1
  75. package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
  76. package/esm2020/decorators/string/string.decorator.mjs +2 -2
  77. package/esm2020/public-api.mjs +1 -1
  78. package/fesm2015/ngx-material-entity.mjs +708 -703
  79. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  80. package/fesm2020/ngx-material-entity.mjs +750 -723
  81. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  82. package/package.json +1 -1
  83. package/public-api.d.ts +0 -1
  84. package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +0 -22
  85. package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.d.ts +0 -12
  86. package/components/input/array-table/array-table.component.d.ts +0 -34
  87. package/components/input/array-table/array-table.module.d.ts +0 -19
  88. package/components/input/internal-input/internal-input.component.d.ts +0 -54
  89. package/components/input/internal-input/internal-input.module.d.ts +0 -16
  90. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.builder.mjs +0 -33
  91. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog-data.mjs +0 -2
  92. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +0 -45
  93. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.mjs +0 -22
  94. package/esm2020/components/input/array-table/array-table.component.mjs +0 -119
  95. package/esm2020/components/input/array-table/array-table.module.mjs +0 -66
  96. package/esm2020/components/input/internal-input/internal-input.component.mjs +0 -70
  97. package/esm2020/components/input/internal-input/internal-input.module.mjs +0 -54
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The abstract BaseBuilder class.
3
+ */
4
+ export declare abstract class BaseBuilder<InternalType extends InputType, InputType extends object> {
5
+ private readonly data;
6
+ private readonly inputData?;
7
+ protected constructor(data?: InputType);
8
+ /**
9
+ * Generates the internal data from the given user inputs.
10
+ *
11
+ * @param data - The input from the user.
12
+ * @returns The internal data.
13
+ */
14
+ protected abstract generateBaseData(data?: InputType): InternalType;
15
+ /**
16
+ * Used to validate the user input in the constructor.
17
+ *
18
+ * @param data - The user input.
19
+ */
20
+ protected validateInput(data?: InputType): void;
21
+ /**
22
+ * Sets the value for the given key if no user value was provided.
23
+ *
24
+ * @param key - The key to set the default value for.
25
+ * @param value - The value to set when nothing was provided.
26
+ * @returns The Builder.
27
+ */
28
+ withDefault(key: keyof InputType, value: Omit<InternalType[keyof InputType], 'undefined'>): BaseBuilder<InternalType, InputType>;
29
+ /**
30
+ * Method used to get the final build value after applying all chaining.
31
+ *
32
+ * @returns The build value.
33
+ */
34
+ getResult(): InternalType;
35
+ }
@@ -43,7 +43,7 @@ export declare abstract class EntityService<EntityType extends Entity> {
43
43
  */
44
44
  create(entity: EntityType): Promise<EntityType>;
45
45
  /**
46
- * Gets all existing entities and pushes them to the entites array.
46
+ * Gets all existing entities and pushes them to the entities array.
47
47
  *
48
48
  * @returns A Promise of all received Entities.
49
49
  */
@@ -27,7 +27,7 @@ export declare abstract class EntityUtilities {
27
27
  * @returns The metadata of the property.
28
28
  * @throws When no metadata can be found for the given property.
29
29
  */
30
- static getPropertyMetadata<EntityType extends Entity, T extends DecoratorTypes>(entity: EntityType, propertyKey: keyof EntityType, type: T): DecoratorType<T>;
30
+ static getPropertyMetadata<EntityType extends Entity, T extends DecoratorTypes>(entity: EntityType, propertyKey: keyof EntityType, type?: T): DecoratorType<T>;
31
31
  /**
32
32
  * Gets the type of the property-metadata.
33
33
  *
@@ -54,7 +54,7 @@ export declare abstract class EntityUtilities {
54
54
  * Also checks all the validators given by the metadata ("required", "maxLength" etc.).
55
55
  *
56
56
  * @param entity - The entity to validate.
57
- * @param omit - Whether to check for creatiung or editing validity.
57
+ * @param omit - Whether to check for creating or editing validity.
58
58
  * @returns Whether or not the entity is valid.
59
59
  */
60
60
  static isEntityValid<EntityType extends Entity>(entity: EntityType, omit: 'create' | 'update'): boolean;
@@ -98,7 +98,7 @@ export declare abstract class EntityUtilities {
98
98
  *
99
99
  * @param entity - Entity to get the bootstrap column values of the key.
100
100
  * @param key - Key of the property to get bootstrap column values from.
101
- * @param type - Defines for which screensize the column values should be returned.
101
+ * @param type - Defines for which screen size the column values should be returned.
102
102
  * @returns Bootstrap column value.
103
103
  */
104
104
  static getWidth<EntityType extends Entity>(entity: EntityType, key: keyof EntityType, type: 'lg' | 'md' | 'sm'): number;
@@ -109,4 +109,37 @@ export declare abstract class EntityUtilities {
109
109
  * @param entityPriorChanges - The entity before any changes.
110
110
  */
111
111
  static resetChangesOnEntity<EntityType extends Entity>(entity: EntityType, entityPriorChanges: EntityType): void;
112
+ /**
113
+ * Gets the rows that are used to display the given entity.
114
+ *
115
+ * @param entity - The entity to get the rows from.
116
+ * @param hideOmitForCreate - Whether or not keys with the metadata omitForCreate should be filtered out.
117
+ * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
118
+ * @returns The sorted Rows containing the row number and the keys to display in that row.
119
+ */
120
+ static getEntityRows<EntityType extends Entity>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): EntityRow<EntityType>[];
121
+ private static getKeysForRow;
122
+ private static getNumberOfRows;
123
+ /**
124
+ * Gets the keys of the provided entity correctly typed.
125
+ *
126
+ * @param entity - The entity to get the keys of.
127
+ * @param hideOmitForCreate - Whether or not keys with the metadata omitForCreate should be filtered out.
128
+ * @param hideOmitForEdit - Whether or not keys with the metadata omitForUpdate should be filtered out.
129
+ * @returns An array of keys of the entity.
130
+ */
131
+ static keysOf<EntityType extends Entity>(entity: EntityType, hideOmitForCreate?: boolean, hideOmitForEdit?: boolean): (keyof EntityType)[];
132
+ }
133
+ /**
134
+ * A row that contains all the information about how to display an entity.
135
+ */
136
+ export interface EntityRow<EntityType extends Entity> {
137
+ /**
138
+ * The row in which this should be displayed.
139
+ */
140
+ row: number;
141
+ /**
142
+ * The keys of the values that should be displayed in that row.
143
+ */
144
+ keys: (keyof EntityType)[];
112
145
  }
@@ -1,4 +1,8 @@
1
+ import { BaseBuilder } from '../../classes/base-builder.class';
1
2
  import { ConfirmDialogData, ConfirmDialogTypes } from './confirm-dialog-data';
3
+ /**
4
+ * The internal ConfirmDialogData. Requires all default values the user can leave out.
5
+ */
2
6
  export declare class ConfirmDialogDataInternal implements ConfirmDialogData {
3
7
  text: string[];
4
8
  type: ConfirmDialogTypes;
@@ -9,16 +13,11 @@ export declare class ConfirmDialogDataInternal implements ConfirmDialogData {
9
13
  confirmationText?: string;
10
14
  constructor(text: string[], type: ConfirmDialogTypes, confirmButtonLabel: string, cancelButtonLabel: string, title: string, requireConfirmation: boolean, confirmationText?: string);
11
15
  }
12
- export declare class ConfirmDialogDataBuilder {
13
- confirmDialogData: ConfirmDialogDataInternal;
14
- private readonly dataInput?;
16
+ /**
17
+ * The Builder for the ConfirmDialogData. Sets default values.
18
+ */
19
+ export declare class ConfirmDialogDataBuilder extends BaseBuilder<ConfirmDialogDataInternal, ConfirmDialogData> {
15
20
  constructor(data?: ConfirmDialogData);
16
- private validateInput;
17
- withDefaultText(text: string[]): ConfirmDialogDataBuilder;
18
- withDefaultType(type: ConfirmDialogTypes): ConfirmDialogDataBuilder;
19
- withDefaultConfirmButtonLabel(label: string): ConfirmDialogDataBuilder;
20
- withDefaultCancelButtonLabel(label: string): ConfirmDialogDataBuilder;
21
- withDefaultTitle(title: string): ConfirmDialogDataBuilder;
22
- withDefaultRequireConfirmation(requireConfirmation: boolean): ConfirmDialogDataBuilder;
23
- withDefaultConfirmationText(confirmationText: string): ConfirmDialogDataBuilder;
21
+ protected generateBaseData(data?: ConfirmDialogData): ConfirmDialogDataInternal;
22
+ protected validateInput(data?: ConfirmDialogData): void;
24
23
  }
@@ -1,3 +1,7 @@
1
+ /**
2
+ * The different types of a confirm dialog.
3
+ * Is used for displaying different buttons accordingly.
4
+ */
1
5
  export declare type ConfirmDialogTypes = 'default' | 'delete' | 'info-only';
2
6
  /**
3
7
  * The Definition of the Confirm Dialog Data.
@@ -3,6 +3,11 @@ import { MatDialogRef } from '@angular/material/dialog';
3
3
  import { ConfirmDialogData } from './confirm-dialog-data';
4
4
  import { ConfirmDialogDataInternal } from './confirm-dialog-data.builder';
5
5
  import * as i0 from "@angular/core";
6
+ /**
7
+ * The Dialog used whenever confirmation by the user is required (e.g. When the user tries to delete an entity).
8
+ *
9
+ * Can be customized with the MAT_DIALOG_DATA "inputData". Customization options are defined in "ConfirmDialogData".
10
+ */
6
11
  export declare class NgxMatEntityConfirmDialogComponent implements OnInit {
7
12
  private readonly dialogRef;
8
13
  private readonly inputData;
@@ -10,7 +15,13 @@ export declare class NgxMatEntityConfirmDialogComponent implements OnInit {
10
15
  data: ConfirmDialogDataInternal;
11
16
  constructor(dialogRef: MatDialogRef<NgxMatEntityConfirmDialogComponent>, inputData: ConfirmDialogData);
12
17
  ngOnInit(): void;
18
+ /**
19
+ * Closes the dialog with value 1 to signal that the action should be run.
20
+ */
13
21
  confirmAction(): void;
22
+ /**
23
+ * Closes the dialog.
24
+ */
14
25
  cancel(): void;
15
26
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityConfirmDialogComponent, never>;
16
27
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityConfirmDialogComponent, "ngx-mat-entity-confirm-dialog", never, {}, {}, never, never>;
@@ -1,17 +1,21 @@
1
1
  import { NgModel } from '@angular/forms';
2
- import { Entity } from '../../../../classes/entity-model.class';
3
- import { CreateDialogDataInternal } from '../../../table/create-dialog/create-dialog-data.builder';
2
+ import { BaseBuilder } from '../../classes/base-builder.class';
3
+ import { Entity } from '../../classes/entity-model.class';
4
+ import { CreateDialogDataInternal } from '../table/create-dialog/create-dialog-data.builder';
4
5
  import { AddArrayItemDialogData } from './add-array-item-dialog-data';
6
+ /**
7
+ * The internal AddArrayItemDialogData. Requires all default values the user can leave out.
8
+ */
5
9
  export declare class AddArrayItemDialogDataInternal<EntityType extends Entity> implements AddArrayItemDialogData<EntityType> {
6
10
  entity: EntityType;
7
11
  createDialogData: CreateDialogDataInternal;
8
12
  getValidationErrorMessage: (model: NgModel) => string;
9
13
  constructor(entity: EntityType, createDialogData: CreateDialogDataInternal, getValidationErrorMessage: (model: NgModel) => string);
10
14
  }
11
- export declare class AddArrayItemDialogDataBuilder<EntityType extends Entity> {
12
- addArrayItemDialogData: AddArrayItemDialogDataInternal<EntityType>;
13
- private readonly dataInput;
15
+ /**
16
+ * The Builder for the AddArrayItemDialogData. Sets default values.
17
+ */
18
+ export declare class AddArrayItemDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<AddArrayItemDialogDataInternal<EntityType>, AddArrayItemDialogData<EntityType>> {
14
19
  constructor(data: AddArrayItemDialogData<EntityType>);
15
- withDefaultCreateDialogData(createDialogData: CreateDialogDataInternal): AddArrayItemDialogDataBuilder<EntityType>;
16
- withDefaultGetValidationErrorMessage(getValidationErrorMessage: (model: NgModel) => string): AddArrayItemDialogDataBuilder<EntityType>;
20
+ protected generateBaseData(data: AddArrayItemDialogData<EntityType>): AddArrayItemDialogDataInternal<EntityType>;
17
21
  }
@@ -1,6 +1,9 @@
1
1
  import { NgModel } from '@angular/forms';
2
- import { Entity } from '../../../../classes/entity-model.class';
3
- import { CreateDialogData } from '../../../table/table-data';
2
+ import { Entity } from '../../classes/entity-model.class';
3
+ import { CreateDialogData } from '../table/table-data';
4
+ /**
5
+ * The configuration options for the dialog that adds items to an array.
6
+ */
4
7
  export interface AddArrayItemDialogData<EntityType extends Entity> {
5
8
  /**
6
9
  * An empty entity that is used as the data model.
@@ -1,6 +1,6 @@
1
- import { OnInit } from '@angular/core';
1
+ import { OnInit, TemplateRef } from '@angular/core';
2
2
  import { NgModel } from '@angular/forms';
3
- import { EntityUtilities } from '../../classes/entity-utilities.class';
3
+ import { EntityRow, EntityUtilities } from '../../classes/entity-utilities.class';
4
4
  import { Entity } from '../../classes/entity-model.class';
5
5
  import { DecoratorTypes } from '../../decorators/base/decorator-types.enum';
6
6
  import { MatChipInputEvent } from '@angular/material/chips';
@@ -11,15 +11,29 @@ import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInte
11
11
  import { DefaultObjectDecoratorConfigInternal } from '../../decorators/object/object-decorator-internal.data';
12
12
  import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../../decorators/string/string-decorator-internal.data';
13
13
  import { PropertyDecoratorConfigInternal } from '../../decorators/base/property-decorator-internal.data';
14
+ import { MatTableDataSource } from '@angular/material/table';
15
+ import { SelectionModel } from '@angular/cdk/collections';
16
+ import { AddArrayItemDialogDataInternal } from './add-array-item-dialog-data.builder';
17
+ import { AddArrayItemDialogData } from './add-array-item-dialog-data';
18
+ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
14
19
  import * as i0 from "@angular/core";
20
+ /**
21
+ * The default input component. It gets the metadata of the property from the given @Input "entity" and @Input "propertyKey"
22
+ * and displays the input field accordingly.
23
+ *
24
+ * You can also define a method that generates error-messages and if the input should be hidden when its metadata says
25
+ * that it should be omitted for creating or updating.
26
+ * The last part being mostly relevant if you want to use this component inside an ngFor.
27
+ */
15
28
  export declare class NgxMatEntityInputComponent<EntityType extends Entity> implements OnInit {
29
+ private readonly dialog;
16
30
  /**
17
- * The entity on which the property exists. Used in conjuction with the "propertyKey"
31
+ * The entity on which the property exists. Used in conjunction with the "propertyKey"
18
32
  * to determine the property for which the input should be generated.
19
33
  */
20
34
  entity: EntityType;
21
35
  /**
22
- * The name of the property to generate the input for. Used in conjuction with the "entity".
36
+ * The name of the property to generate the input for. Used in conjunction with the "entity".
23
37
  */
24
38
  propertyKey: keyof EntityType;
25
39
  /**
@@ -36,6 +50,8 @@ export declare class NgxMatEntityInputComponent<EntityType extends Entity> imple
36
50
  * Is used internally for the object property.
37
51
  */
38
52
  hideOmitForEdit?: boolean;
53
+ addArrayItemDialog: TemplateRef<unknown>;
54
+ addArrayItemDialogRef: MatDialogRef<unknown>;
39
55
  type: DecoratorTypes;
40
56
  metadata: PropertyDecoratorConfigInternal;
41
57
  metadataDefaultString: DefaultStringDecoratorConfigInternal;
@@ -49,21 +65,98 @@ export declare class NgxMatEntityInputComponent<EntityType extends Entity> imple
49
65
  metadataDropdownNumber: DropdownNumberDecoratorConfigInternal;
50
66
  metadataDefaultObject: DefaultObjectDecoratorConfigInternal<EntityType>;
51
67
  objectProperty: Entity;
68
+ objectPropertyRows: EntityRow<Entity>[];
52
69
  metadataEntityArray: EntityArrayDecoratorConfigInternal<Entity>;
53
- entityArrayValues: Entity[];
70
+ entityArrayValues: EntityType[];
54
71
  metadataStringChipsArray: StringChipsArrayDecoratorConfigInternal;
55
72
  stringChipsArrayValues: string[];
56
73
  chipsInput: string;
57
74
  metadataAutocompleteStringChipsArray: AutocompleteStringChipsArrayDecoratorConfigInternal;
75
+ arrayItem: EntityType;
76
+ private arrayItemPriorChanges;
77
+ arrayItemInlineRows: EntityRow<EntityType>[];
78
+ dataSource: MatTableDataSource<EntityType>;
79
+ selection: SelectionModel<EntityType>;
80
+ displayedColumns: string[];
81
+ dialogInputData: AddArrayItemDialogData<EntityType>;
82
+ dialogData: AddArrayItemDialogDataInternal<EntityType>;
83
+ arrayItemDialogRows: EntityRow<EntityType>[];
58
84
  readonly DecoratorTypes: typeof DecoratorTypes;
85
+ EntityUtilities: typeof EntityUtilities;
59
86
  getWidth: typeof EntityUtilities.getWidth;
60
- constructor();
87
+ constructor(dialog: MatDialog);
88
+ /**
89
+ * This is needed for the inputs to work inside an ngFor.
90
+ *
91
+ * @param index - The index of the element in the ngFor.
92
+ * @returns The index.
93
+ */
61
94
  trackByFn(index: unknown): unknown;
62
95
  ngOnInit(): void;
63
- getObjectProperties(): (keyof Entity)[];
96
+ /**
97
+ * Tries to add an item to the array.
98
+ * Does this either inline if the "createInline"-metadata is set to true
99
+ * or in a separate dialog if it is set to false.
100
+ */
101
+ add(): void;
102
+ /**
103
+ * Adds the array item defined in the dialog.
104
+ */
105
+ addArrayItem(): void;
106
+ /**
107
+ * Cancels adding the array item defined in the dialog.
108
+ */
109
+ cancelAddArrayItem(): void;
110
+ /**
111
+ * Removes all selected entries from the array.
112
+ */
113
+ remove(): void;
114
+ /**
115
+ * Toggles all array-items in the table.
116
+ */
117
+ masterToggle(): void;
118
+ /**
119
+ * Checks if all array-items in the table have been selected.
120
+ * This is needed to display the "masterToggle"-checkbox correctly.
121
+ *
122
+ * @returns Whether or not all array-items in the table have been selected.
123
+ */
124
+ isAllSelected(): boolean;
125
+ /**
126
+ * Handles adding strings to the chipsArray.
127
+ * Checks validation and also creates a new array if it is undefined.
128
+ * This is needed because two things are validated: The array itself
129
+ * and the contents of the array. And we need a way to display an
130
+ * mat-error. As the only validation for the array is whether or not
131
+ * it contains values, we can set it to undefined when the last element is removed
132
+ * (removeStringChipArrayValue). That way we can use the "required" validator.
133
+ *
134
+ * @param event - The event that fires when a new chip is completed.
135
+ */
64
136
  addStringChipArrayValue(event: MatChipInputEvent): void;
137
+ /**
138
+ * Removes the given value from the array.
139
+ * Sets the array to undefined if it is now empty.
140
+ * This is needed because two things are validated: The array itself
141
+ * and the contents of the array. And we need a way to display an
142
+ * mat-error. As the only validation for the array is whether or not
143
+ * it is empty, setting it to undefined here enables us to use the "required" validator.
144
+ *
145
+ * @param value - The string to remove from the array.
146
+ */
65
147
  removeStringChipArrayValue(value: string): void;
148
+ /**
149
+ * Handles adding a string to the array when an autocomplete value has been selected.
150
+ *
151
+ * @param event - The autocomplete selected event.
152
+ * @param chipsInput - The element where the user typed the value.
153
+ */
66
154
  selected(event: MatAutocompleteSelectedEvent, chipsInput: HTMLInputElement): void;
155
+ /**
156
+ * Dynamically filters the Autocomplete options when the user inputs something.
157
+ *
158
+ * @param input - The input of the user.
159
+ */
67
160
  filterAutocompleteStrings(input: unknown): void;
68
161
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityInputComponent<any>, never>;
69
162
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityInputComponent<any>, "ngx-mat-entity-input", never, { "entity": "entity"; "propertyKey": "propertyKey"; "getValidationErrorMessage": "getValidationErrorMessage"; "hideOmitForCreate": "hideOmitForCreate"; "hideOmitForEdit": "hideOmitForEdit"; }, {}, never, never>;
@@ -8,11 +8,13 @@ import * as i6 from "@angular/material/select";
8
8
  import * as i7 from "@angular/material/autocomplete";
9
9
  import * as i8 from "@angular/material/checkbox";
10
10
  import * as i9 from "@angular/material/slide-toggle";
11
- import * as i10 from "./array-table/array-table.module";
12
- import * as i11 from "@angular/material/chips";
13
- import * as i12 from "@angular/material/icon";
11
+ import * as i10 from "@angular/material/chips";
12
+ import * as i11 from "@angular/material/icon";
13
+ import * as i12 from "@angular/material/table";
14
+ import * as i13 from "@angular/material/dialog";
15
+ import * as i14 from "@angular/material/button";
14
16
  export declare class NgxMatEntityInputModule {
15
17
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityInputModule, never>;
16
- 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.NgxMatEntityArrayTableModule, typeof i11.MatChipsModule, typeof i12.MatIconModule], [typeof i1.NgxMatEntityInputComponent]>;
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]>;
17
19
  static ɵinj: i0.ɵɵInjectorDeclaration<NgxMatEntityInputModule>;
18
20
  }
@@ -1,5 +1,9 @@
1
+ import { BaseBuilder } from '../../../classes/base-builder.class';
1
2
  import { ConfirmDialogDataInternal } from '../../confirm-dialog/confirm-dialog-data.builder';
2
3
  import { CreateDialogData } from '../table-data';
4
+ /**
5
+ * The internal CreateDialogData. Requires all default values the user can leave out.
6
+ */
3
7
  export declare class CreateDialogDataInternal implements CreateDialogData {
4
8
  title: string;
5
9
  createButtonLabel: string;
@@ -8,13 +12,10 @@ export declare class CreateDialogDataInternal implements CreateDialogData {
8
12
  confirmCreateDialogData: ConfirmDialogDataInternal;
9
13
  constructor(title: string, createButtonLabel: string, cancelButtonLabel: string, createRequiresConfirmDialog: boolean, confirmCreateDialogData: ConfirmDialogDataInternal);
10
14
  }
11
- export declare class CreateDialogDataBuilder {
12
- createDialogData: CreateDialogDataInternal;
13
- private readonly dataInput?;
15
+ /**
16
+ * The Builder for the CreateDialogData. Sets default values.
17
+ */
18
+ export declare class CreateDialogDataBuilder extends BaseBuilder<CreateDialogDataInternal, CreateDialogData> {
14
19
  constructor(data?: CreateDialogData);
15
- withDefaultTitle(title: string): CreateDialogDataBuilder;
16
- withDefaultCreateButtonLabel(label: string): CreateDialogDataBuilder;
17
- withDefaultCancelButtonLabel(label: string): CreateDialogDataBuilder;
18
- withDefaultCreateRequiresConfirmDialog(createRequiresConfirmDialog: boolean): CreateDialogDataBuilder;
19
- withDefaultConfirmCreateDialogData(confirmCreateDialogData: ConfirmDialogDataInternal): CreateDialogDataBuilder;
20
+ protected generateBaseData(data?: CreateDialogData): CreateDialogDataInternal;
20
21
  }
@@ -3,14 +3,20 @@ import { Entity } from '../../../classes/entity-model.class';
3
3
  import { CreateEntityDialogData } from './create-entity-dialog-data';
4
4
  import { HttpClient } from '@angular/common/http';
5
5
  import { CreateDialogDataInternal } from './create-dialog-data.builder';
6
+ import { BaseBuilder } from '../../../classes/base-builder.class';
7
+ /**
8
+ * The internal CreateEntityDialogData. Requires all default values the user can leave out.
9
+ */
6
10
  export declare class CreateEntityDialogDataInternal<EntityType extends Entity> implements CreateEntityDialogData<EntityType> {
7
11
  entity: EntityType;
8
12
  EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
9
13
  createDialogData: CreateDialogDataInternal;
10
14
  constructor(entity: EntityType, EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>, createDialogData: CreateDialogDataInternal);
11
15
  }
12
- export declare class CreateEntityDialogDataBuilder<EntityType extends Entity> {
13
- createDialogData: CreateEntityDialogDataInternal<EntityType>;
14
- private readonly dataInput;
16
+ /**
17
+ * The Builder for the CreateEntityDialogData. Sets default values.
18
+ */
19
+ export declare class CreateEntityDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<CreateEntityDialogDataInternal<EntityType>, CreateEntityDialogData<EntityType>> {
15
20
  constructor(data: CreateEntityDialogData<EntityType>);
21
+ protected generateBaseData(data: CreateEntityDialogData<EntityType>): CreateEntityDialogDataInternal<EntityType>;
16
22
  }
@@ -2,25 +2,37 @@ import { Injector, OnInit } from '@angular/core';
2
2
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
3
3
  import { EntityService } from '../../../classes/entity-service.class';
4
4
  import { Entity } from '../../../classes/entity-model.class';
5
- import { EntityUtilities } from '../../../classes/entity-utilities.class';
5
+ import { EntityRow, EntityUtilities } from '../../../classes/entity-utilities.class';
6
6
  import { CreateEntityDialogDataInternal } from './create-entity-dialog-data.builder';
7
7
  import { CreateEntityDialogData } from './create-entity-dialog-data';
8
8
  import * as i0 from "@angular/core";
9
+ /**
10
+ * The default dialog used to create new entities based on the configuration passed in the MAT_DIALOG_DATA "inputData".
11
+ * Used by the ngx-mat-entity-table.
12
+ *
13
+ * It offers a lot of customization options which can be found in "CreateEntityDialogData".
14
+ */
9
15
  export declare class NgxMatEntityCreateDialogComponent<EntityType extends Entity> implements OnInit {
10
16
  private readonly inputData;
11
17
  dialogRef: MatDialogRef<NgxMatEntityCreateDialogComponent<EntityType>>;
12
18
  private readonly injector;
13
19
  private readonly dialog;
14
20
  EntityUtilities: typeof EntityUtilities;
15
- entityKeys: (keyof EntityType)[];
21
+ entityRows: EntityRow<EntityType>[];
16
22
  entityService: EntityService<EntityType>;
17
23
  data: CreateEntityDialogDataInternal<EntityType>;
18
24
  getWidth: typeof EntityUtilities.getWidth;
19
25
  constructor(inputData: CreateEntityDialogData<EntityType>, dialogRef: MatDialogRef<NgxMatEntityCreateDialogComponent<EntityType>>, injector: Injector, dialog: MatDialog);
20
26
  ngOnInit(): void;
21
- private setEntityKeys;
27
+ /**
28
+ * Tries add the new entity and close the dialog afterwards.
29
+ * Also handles the confirmation if required.
30
+ */
22
31
  create(): void;
23
32
  private confirmCreate;
33
+ /**
34
+ * Closes the dialog.
35
+ */
24
36
  cancel(): void;
25
37
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityCreateDialogComponent<any>, never>;
26
38
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityCreateDialogComponent<any>, "ngx-mat-entity-create-dialog", never, {}, {}, never, never>;
@@ -1,6 +1,10 @@
1
+ import { BaseBuilder } from '../../../classes/base-builder.class';
1
2
  import { Entity } from '../../../classes/entity-model.class';
2
3
  import { ConfirmDialogData } from '../../confirm-dialog/confirm-dialog-data';
3
4
  import { EditDialogData } from '../table-data';
5
+ /**
6
+ * The internal EditDialogData. Requires all default values the user can leave out.
7
+ */
4
8
  export declare class EditDialogDataInternal<EntityType extends Entity> implements EditDialogData<EntityType> {
5
9
  title: (entity: EntityType) => string;
6
10
  confirmButtonLabel: string;
@@ -12,16 +16,10 @@ export declare class EditDialogDataInternal<EntityType extends Entity> implement
12
16
  confirmEditDialogData: ConfirmDialogData;
13
17
  constructor(title: (entity: EntityType) => string, confirmButtonLabel: string, deleteButtonLabel: string, cancelButtonLabel: string, deleteRequiresConfirmDialog: boolean, editRequiresConfirmDialog: boolean, confirmDeleteDialogData: ConfirmDialogData, confirmEditDialogData: ConfirmDialogData);
14
18
  }
15
- export declare class EditDialogDataBuilder<EntityType extends Entity> {
16
- editDialogData: EditDialogDataInternal<EntityType>;
17
- private readonly dataInput?;
19
+ /**
20
+ * The Builder for the EditDialogData. Sets default values.
21
+ */
22
+ export declare class EditDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<EditDialogDataInternal<EntityType>, EditDialogData<EntityType>> {
18
23
  constructor(data?: EditDialogData<EntityType>);
19
- withDefaultTitle(title: (entity: EntityType) => string): EditDialogDataBuilder<EntityType>;
20
- withDefaultConfirmButtonLabel(label: string): EditDialogDataBuilder<EntityType>;
21
- withDefaultDeleteButtonLabel(label: string): EditDialogDataBuilder<EntityType>;
22
- withDefaultCancelButtonLabel(label: string): EditDialogDataBuilder<EntityType>;
23
- withDefaultDeleteRequiresConfirmDialog(deleteRequiresConfirmDialog: boolean): EditDialogDataBuilder<EntityType>;
24
- withDefaultEditRequiresConfirmDialog(editRequiresConfirmDialog: boolean): EditDialogDataBuilder<EntityType>;
25
- withDefaultConfirmDeleteDialogData(confirmDeleteDialogData: ConfirmDialogData): EditDialogDataBuilder<EntityType>;
26
- withDefaultConfirmEditDialogData(confirmEditDialogData: ConfirmDialogData): EditDialogDataBuilder<EntityType>;
24
+ protected generateBaseData(data?: EditDialogData<EntityType>): EditDialogDataInternal<EntityType>;
27
25
  }
@@ -3,6 +3,10 @@ import { Entity } from '../../../classes/entity-model.class';
3
3
  import { HttpClient } from '@angular/common/http';
4
4
  import { EditEntityDialogData } from './edit-entity-dialog-data';
5
5
  import { EditDialogDataInternal } from './edit-dialog-data.builder';
6
+ import { BaseBuilder } from '../../../classes/base-builder.class';
7
+ /**
8
+ * The internal EditEntityDialogData. Requires all default values the user can leave out.
9
+ */
6
10
  export declare class EditEntityDialogDataInternal<EntityType extends Entity> implements EditEntityDialogData<EntityType> {
7
11
  entity: EntityType;
8
12
  EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
@@ -10,8 +14,10 @@ export declare class EditEntityDialogDataInternal<EntityType extends Entity> imp
10
14
  allowDelete: (entity: EntityType) => boolean;
11
15
  constructor(entity: EntityType, EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>, editDialogData: EditDialogDataInternal<EntityType>, allowDelete: (entity: EntityType) => boolean);
12
16
  }
13
- export declare class EditEntityDialogDataBuilder<EntityType extends Entity> {
14
- editDialogData: EditEntityDialogDataInternal<EntityType>;
15
- private readonly dataInput;
17
+ /**
18
+ * The Builder for the EditEntityDialogData. Sets default values.
19
+ */
20
+ export declare class EditEntityDialogDataBuilder<EntityType extends Entity> extends BaseBuilder<EditEntityDialogDataInternal<EntityType>, EditEntityDialogData<EntityType>> {
16
21
  constructor(data: EditEntityDialogData<EntityType>);
22
+ protected generateBaseData(data: EditEntityDialogData<EntityType>): EditEntityDialogDataInternal<EntityType>;
17
23
  }
@@ -2,28 +2,44 @@ import { Injector, OnInit } from '@angular/core';
2
2
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
3
3
  import { EntityService } from '../../../classes/entity-service.class';
4
4
  import { Entity } from '../../../classes/entity-model.class';
5
- import { EntityUtilities } from '../../../classes/entity-utilities.class';
5
+ import { EntityRow, EntityUtilities } from '../../../classes/entity-utilities.class';
6
6
  import { EditEntityDialogData } from './edit-entity-dialog-data';
7
7
  import { EditEntityDialogDataInternal } from './edit-entity-dialog.builder';
8
8
  import * as i0 from "@angular/core";
9
+ /**
10
+ * The default dialog used to edit an existing entity based on the configuration passed in the MAT_DIALOG_DATA "inputData".
11
+ * Used by the ngx-mat-entity-table.
12
+ *
13
+ * It offers a lot of customization options which can be found in "EditEntityDialogData".
14
+ */
9
15
  export declare class NgxMatEntityEditDialogComponent<EntityType extends Entity> implements OnInit {
10
16
  private readonly inputData;
11
17
  dialogRef: MatDialogRef<NgxMatEntityEditDialogComponent<EntityType>>;
12
18
  private readonly injector;
13
19
  private readonly dialog;
14
20
  EntityUtilities: typeof EntityUtilities;
15
- entityKeys: (keyof EntityType)[];
21
+ entityRows: EntityRow<EntityType>[];
16
22
  entityService: EntityService<EntityType>;
17
23
  entityPriorChanges: EntityType;
18
24
  data: EditEntityDialogDataInternal<EntityType>;
19
25
  getWidth: typeof EntityUtilities.getWidth;
20
26
  constructor(inputData: EditEntityDialogData<EntityType>, dialogRef: MatDialogRef<NgxMatEntityEditDialogComponent<EntityType>>, injector: Injector, dialog: MatDialog);
21
27
  ngOnInit(): void;
22
- private setEntityKeys;
28
+ /**
29
+ * Tries to save the changes and close the dialog afterwards.
30
+ * Also handles the confirmation if required.
31
+ */
23
32
  edit(): void;
24
33
  private confirmEdit;
34
+ /**
35
+ * Tries to delete the entity and close the dialog afterwards.
36
+ * Also handles the confirmation if required.
37
+ */
25
38
  delete(): void;
26
39
  private confirmDelete;
40
+ /**
41
+ * Reverts all changes made and closes the dialog.
42
+ */
27
43
  cancel(): void;
28
44
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityEditDialogComponent<any>, never>;
29
45
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityEditDialogComponent<any>, "ngx-mat-entity-edit-dialog", never, {}, {}, never, never>;