ngx-material-entity 15.1.5 → 15.1.6

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.
@@ -4,15 +4,14 @@ import { NgModel } from '@angular/forms';
4
4
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
5
5
  import { MatTableDataSource } from '@angular/material/table';
6
6
  import { BaseEntityType } from '../../classes/entity.model';
7
- import { EntityArrayDecoratorConfigInternal } from '../../decorators/array/array-decorator-internal.data';
7
+ import { EditArrayItemDialogDataInternal, EntityArrayDecoratorConfigInternal } from '../../decorators/array/array-decorator-internal.data';
8
8
  import { DecoratorTypes } from '../../decorators/base/decorator-types.enum';
9
9
  import { PropertyDecoratorConfigInternal } from '../../decorators/base/property-decorator-internal.data';
10
10
  import { DefaultObjectDecoratorConfigInternal } from '../../decorators/object/object-decorator-internal.data';
11
11
  import { DateUtilities } from '../../utilities/date.utilities';
12
12
  import { EntityTab, EntityUtilities } from '../../utilities/entity.utilities';
13
13
  import { SelectionUtilities } from '../../utilities/selection.utilities';
14
- import { AddArrayItemDialogData } from './add-array-item-dialog-data';
15
- import { AddArrayItemDialogDataInternal } from './add-array-item-dialog-data.builder';
14
+ import { CreateDialogDataInternal } from '../table/create-dialog/create-dialog-data.builder';
16
15
  import * as i0 from "@angular/core";
17
16
  /**
18
17
  * The default input component. It gets the metadata of the property from the given @Input "entity" and @Input "propertyKey"
@@ -66,6 +65,8 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
66
65
  inputChangeEvent: EventEmitter<void>;
67
66
  addArrayItemDialog: TemplateRef<unknown>;
68
67
  addArrayItemDialogRef: MatDialogRef<unknown>;
68
+ editArrayItemDialog: TemplateRef<unknown>;
69
+ editArrayItemDialogRef: MatDialogRef<unknown>;
69
70
  type: DecoratorTypes;
70
71
  metadata: PropertyDecoratorConfigInternal;
71
72
  metadataDefaultObject: DefaultObjectDecoratorConfigInternal<EntityType>;
@@ -74,16 +75,17 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
74
75
  metadataEntityArray: EntityArrayDecoratorConfigInternal<EntityType>;
75
76
  entityArrayValues: EntityType[];
76
77
  arrayItem: EntityType;
77
- private arrayItemPriorChanges;
78
+ arrayItemPriorChanges: EntityType;
78
79
  arrayItemInlineTabs: EntityTab<EntityType>[];
79
80
  dataSource: MatTableDataSource<EntityType>;
80
81
  selection: SelectionModel<EntityType>;
81
82
  displayedColumns: string[];
82
83
  isArrayItemValid: boolean;
83
- dialogInputData: AddArrayItemDialogData<EntityType>;
84
- dialogData: AddArrayItemDialogDataInternal<EntityType>;
84
+ isArrayItemDirty: boolean;
85
+ indexOfEditedArrayItem: number;
86
+ addArrayItemDialogData: CreateDialogDataInternal;
85
87
  arrayItemDialogTabs: EntityTab<EntityType>[];
86
- isDialogArrayItemValid: boolean;
88
+ editArrayItemDialogData: EditArrayItemDialogDataInternal<EntityType>;
87
89
  readonly DecoratorTypes: typeof DecoratorTypes;
88
90
  EntityUtilities: typeof EntityUtilities;
89
91
  DateUtilities: typeof DateUtilities;
@@ -100,13 +102,17 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
100
102
  private initEntityArray;
101
103
  private initObjectInput;
102
104
  /**
103
- * Checks if the arrayItem is valid.
105
+ * Checks whether the array item is valid and if the array item is dirty.
104
106
  */
105
- checkIsArrayItemValid(): void;
107
+ checkArrayItem(): void;
106
108
  /**
107
- * Checks if the arrayItem inside the dialog is valid.
109
+ * Checks if the array item is dirty.
108
110
  */
109
- checkIsDialogArrayItemValid(): void;
111
+ checkIsArrayItemDirty(): Promise<void>;
112
+ /**
113
+ * Checks if the arrayItem is valid.
114
+ */
115
+ checkIsArrayItemValid(): void;
110
116
  /**
111
117
  * Emits that a the value has been changed.
112
118
  */
@@ -124,7 +130,21 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
124
130
  /**
125
131
  * Cancels adding the array item defined in the dialog.
126
132
  */
127
- cancelAddArrayItem(): void;
133
+ closeAddArrayItemDialog(): void;
134
+ /**
135
+ * Edits an entity array item.
136
+ *
137
+ * @param entity - The entity that has been clicked.
138
+ */
139
+ editArrayItem(entity: EntityType): void;
140
+ /**
141
+ * Saves changes on the array item in the dialog.
142
+ */
143
+ saveArrayItem(): void;
144
+ /**
145
+ * Closes the edit array item dialog and resets changes.
146
+ */
147
+ closeEditArrayItemDialog(): void;
128
148
  /**
129
149
  * Removes all selected entries from the entity array.
130
150
  */
@@ -7,7 +7,17 @@ import { DecoratorTypes } from '../base/decorator-types.enum';
7
7
  import { DropdownValue } from '../base/dropdown-value.interface';
8
8
  import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
9
9
  import { DateRange } from '../date/date-decorator.data';
10
- import { AutocompleteStringChipsArrayDecoratorConfig, DateArrayDecoratorConfig, DateRangeArrayDecoratorConfig, DateTimeArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
10
+ import { AutocompleteStringChipsArrayDecoratorConfig, DateArrayDecoratorConfig, DateRangeArrayDecoratorConfig, DateTimeArrayDecoratorConfig, EditArrayItemDialogData, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
11
+ /**
12
+ * The internal dialog data for the entities array edit dialog.
13
+ * Sets default values.
14
+ */
15
+ export declare class EditArrayItemDialogDataInternal<EntityType extends BaseEntityType<EntityType>> implements EditArrayItemDialogData<EntityType> {
16
+ title: (entity: EntityType) => string;
17
+ confirmButtonLabel: string;
18
+ cancelButtonLabel: string;
19
+ constructor(data?: EditArrayItemDialogData<EntityType>);
20
+ }
11
21
  /**
12
22
  * The internal EntityArrayDecoratorConfig. Sets default values.
13
23
  */
@@ -18,6 +28,7 @@ export declare class EntityArrayDecoratorConfigInternal<EntityType extends BaseE
18
28
  EntityClass: EntityClassNewable<EntityType>;
19
29
  displayColumns: DisplayColumn<EntityType>[];
20
30
  createDialogData?: CreateDialogData;
31
+ editDialogData: EditArrayItemDialogDataInternal<EntityType>;
21
32
  createInline: boolean;
22
33
  missingErrorMessage: string;
23
34
  addButtonLabel: string;
@@ -1,12 +1,12 @@
1
- import { CreateDialogData, DisplayColumn } from '../../components/table/table-data';
1
+ import { Time } from '@angular/common';
2
+ import { DateFilterFn } from '@angular/material/datepicker';
2
3
  import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
4
+ import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
5
+ import { CreateDialogData, DisplayColumn } from '../../components/table/table-data';
3
6
  import { DecoratorTypes } from '../base/decorator-types.enum';
4
- import { PropertyDecoratorConfig } from '../base/property-decorator.data';
5
- import { DateFilterFn } from '@angular/material/datepicker';
6
- import { Time } from '@angular/common';
7
7
  import { DropdownValue } from '../base/dropdown-value.interface';
8
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
8
9
  import { DateRange } from '../date/date-decorator.data';
9
- import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
10
10
  /**
11
11
  * Interface definition for the @array metadata.
12
12
  */
@@ -26,6 +26,23 @@ export declare abstract class ArrayDecoratorConfig extends PropertyDecoratorConf
26
26
  */
27
27
  duplicatesErrorDialog?: ConfirmDialogData;
28
28
  }
29
+ /**
30
+ * The dialog data for the entities array edit dialog.
31
+ */
32
+ export interface EditArrayItemDialogData<EntityType extends BaseEntityType<EntityType>> {
33
+ /**
34
+ * The title of the default edit-dialog.
35
+ */
36
+ title?: (entity: EntityType) => string;
37
+ /**
38
+ * The label on the confirm-button of the default edit-dialog or page. Defaults to "Save".
39
+ */
40
+ confirmButtonLabel?: string;
41
+ /**
42
+ * The label on the cancel-button for the default edit-dialog or page. Defaults to "Cancel".
43
+ */
44
+ cancelButtonLabel?: string;
45
+ }
29
46
  /**
30
47
  * Definition for an array of Entities.
31
48
  */
@@ -45,6 +62,11 @@ export interface EntityArrayDecoratorConfig<EntityType extends BaseEntityType<En
45
62
  * Can be omitted when adding items inline.
46
63
  */
47
64
  createDialogData?: CreateDialogData;
65
+ /**
66
+ * The data for the edit-item-dialog.
67
+ * Can be omitted when adding items inline.
68
+ */
69
+ editDialogData?: EditArrayItemDialogData<EntityType>;
48
70
  /**
49
71
  * Whether or not the form for adding items to the array
50
72
  * should be displayed inline.