ngx-material-entity 0.1.1 → 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.
- package/CONTRIBUTING.md +7 -1
- package/README.md +536 -328
- package/classes/base.builder.d.ts +35 -0
- package/classes/date.utilities.d.ts +58 -0
- package/classes/entity.model.d.ts +13 -0
- package/classes/{entity-service.class.d.ts → entity.service.d.ts} +35 -20
- package/classes/entity.utilities.d.ts +153 -0
- package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +23 -0
- package/components/confirm-dialog/confirm-dialog-data.d.ts +18 -8
- package/components/confirm-dialog/confirm-dialog.component.d.ts +15 -5
- package/components/get-validation-error-message.function.d.ts +3 -2
- package/components/input/add-array-item-dialog-data.builder.d.ts +20 -0
- package/components/input/add-array-item-dialog-data.d.ts +19 -0
- package/components/input/input.component.d.ts +151 -30
- package/components/input/input.module.d.ts +7 -4
- package/components/table/create-dialog/create-dialog-data.builder.d.ts +21 -0
- package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +21 -0
- package/components/table/create-dialog/create-entity-dialog-data.d.ts +4 -5
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +21 -8
- package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +24 -0
- package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +7 -8
- package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +22 -0
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +25 -8
- package/components/table/table-data.builder.d.ts +51 -0
- package/components/table/table-data.d.ts +46 -30
- package/components/table/table.component.d.ts +53 -7
- package/components/table/table.module.d.ts +3 -1
- package/decorators/array/array-decorator-internal.data.d.ts +45 -0
- package/decorators/array/array-decorator.data.d.ts +129 -0
- package/decorators/array/array.decorator.d.ts +9 -0
- package/decorators/base/base-property.decorator.d.ts +7 -6
- package/decorators/base/decorator-types.enum.d.ts +12 -9
- package/decorators/base/dropdown-value.interface.d.ts +14 -0
- package/decorators/base/property-decorator-internal.data.d.ts +24 -0
- package/decorators/base/property-decorator.data.d.ts +70 -0
- package/decorators/boolean/boolean-decorator-internal.data.d.ts +25 -0
- package/decorators/boolean/boolean-decorator.data.d.ts +37 -0
- package/decorators/boolean/boolean.decorator.d.ts +8 -0
- package/decorators/date/date-decorator-internal.data.d.ts +44 -0
- package/decorators/date/date-decorator.data.d.ts +129 -0
- package/decorators/number/number-decorator-internal.data.d.ts +20 -0
- package/decorators/number/number-decorator.data.d.ts +36 -0
- package/decorators/number/number.decorator.d.ts +8 -0
- package/decorators/object/object-decorator-internal.data.d.ts +11 -0
- package/decorators/object/object-decorator.data.d.ts +25 -0
- package/decorators/object/object.decorator.d.ts +8 -0
- package/decorators/string/string-decorator-internal.data.d.ts +41 -0
- package/decorators/string/string-decorator.data.d.ts +77 -0
- package/decorators/string/string.decorator.d.ts +8 -0
- package/esm2020/classes/base.builder.mjs +43 -0
- package/esm2020/classes/date.utilities.mjs +138 -0
- package/esm2020/classes/entity.model.mjs +19 -0
- package/esm2020/classes/entity.service.mjs +83 -0
- package/esm2020/classes/entity.utilities.mjs +538 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +44 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +1 -1
- package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +18 -22
- package/esm2020/components/get-validation-error-message.function.mjs +8 -3
- package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +30 -0
- package/esm2020/components/input/add-array-item-dialog-data.mjs +2 -0
- package/esm2020/components/input/input.component.mjs +240 -36
- package/esm2020/components/input/input.module.mjs +23 -9
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +32 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +26 -0
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +31 -31
- package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +20 -4
- package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +41 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +27 -0
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +45 -49
- package/esm2020/components/table/table-data.builder.mjs +105 -0
- package/esm2020/components/table/table-data.mjs +1 -1
- package/esm2020/components/table/table.component.mjs +91 -83
- package/esm2020/components/table/table.module.mjs +12 -4
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +51 -0
- package/esm2020/decorators/array/array-decorator.data.mjs +7 -0
- package/esm2020/decorators/array/array.decorator.mjs +24 -0
- package/esm2020/decorators/base/base-property.decorator.mjs +6 -5
- package/esm2020/decorators/base/decorator-types.enum.mjs +4 -1
- package/esm2020/decorators/base/dropdown-value.interface.mjs +2 -0
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +38 -0
- package/esm2020/decorators/base/property-decorator.data.mjs +6 -0
- package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +33 -0
- package/esm2020/decorators/boolean/boolean-decorator.data.mjs +7 -0
- package/esm2020/decorators/boolean/boolean.decorator.mjs +21 -0
- package/esm2020/decorators/date/date-decorator-internal.data.mjs +48 -0
- package/esm2020/decorators/date/date-decorator.data.mjs +7 -0
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +23 -0
- package/esm2020/decorators/number/number-decorator.data.mjs +7 -0
- package/esm2020/decorators/number/number.decorator.mjs +18 -0
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +12 -0
- package/esm2020/decorators/object/object-decorator.data.mjs +7 -0
- package/esm2020/decorators/object/object.decorator.mjs +13 -0
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +48 -0
- package/esm2020/decorators/string/string-decorator.data.mjs +7 -0
- package/esm2020/decorators/string/string.decorator.mjs +24 -0
- package/esm2020/public-api.mjs +20 -13
- package/fesm2015/ngx-material-entity.mjs +1664 -944
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +1667 -941
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +7 -1
- package/public-api.d.ts +21 -10
- package/classes/entity-model.class.d.ts +0 -9
- package/classes/entity-utilities.class.d.ts +0 -95
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +0 -35
- package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.d.ts +0 -12
- package/components/input/array-table/array-table.component.d.ts +0 -34
- package/components/input/array-table/array-table.module.d.ts +0 -19
- package/components/input/internal-input/internal-input.component.d.ts +0 -57
- package/components/input/internal-input/internal-input.module.d.ts +0 -16
- package/decorators/array.decorator.d.ts +0 -125
- package/decorators/base/property-decorator-config.interface.d.ts +0 -50
- package/decorators/boolean.decorator.d.ts +0 -42
- package/decorators/number.decorator.d.ts +0 -40
- package/decorators/object.decorator.d.ts +0 -27
- package/decorators/string.decorator.d.ts +0 -76
- package/esm2020/classes/entity-model.class.mjs +0 -19
- package/esm2020/classes/entity-service.class.mjs +0 -70
- package/esm2020/classes/entity-utilities.class.mjs +0 -296
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +0 -43
- package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.mjs +0 -22
- package/esm2020/components/input/array-table/array-table.component.mjs +0 -116
- package/esm2020/components/input/array-table/array-table.module.mjs +0 -66
- package/esm2020/components/input/internal-input/internal-input.component.mjs +0 -73
- package/esm2020/components/input/internal-input/internal-input.module.mjs +0 -54
- package/esm2020/decorators/array.decorator.mjs +0 -70
- package/esm2020/decorators/base/property-decorator-config.interface.mjs +0 -31
- package/esm2020/decorators/boolean.decorator.mjs +0 -44
- package/esm2020/decorators/number.decorator.mjs +0 -36
- package/esm2020/decorators/object.decorator.mjs +0 -23
- package/esm2020/decorators/string.decorator.mjs +0 -61
|
@@ -1,25 +1,44 @@
|
|
|
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
|
|
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
|
-
import { PropertyDecoratorConfig } from '../../decorators/base/property-decorator-config.interface';
|
|
7
|
-
import { AutocompleteStringDecoratorConfig, DefaultStringDecoratorConfig, DropdownStringDecoratorConfig, TextboxStringDecoratorConfig } from '../../decorators/string.decorator';
|
|
8
|
-
import { DropdownBooleanDecoratorConfig } from '../../decorators/boolean.decorator';
|
|
9
|
-
import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig } from '../../decorators/number.decorator';
|
|
10
|
-
import { DefaultObjectDecoratorConfig } from '../../decorators/object.decorator';
|
|
11
|
-
import { AutocompleteStringChipsArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from '../../decorators/array.decorator';
|
|
12
5
|
import { MatChipInputEvent } from '@angular/material/chips';
|
|
13
6
|
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
|
7
|
+
import { AutocompleteStringChipsArrayDecoratorConfigInternal, EntityArrayDecoratorConfigInternal, StringChipsArrayDecoratorConfigInternal } from '../../decorators/array/array-decorator-internal.data';
|
|
8
|
+
import { DropdownBooleanDecoratorConfigInternal } from '../../decorators/boolean/boolean-decorator-internal.data';
|
|
9
|
+
import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInternal } from '../../decorators/number/number-decorator-internal.data';
|
|
10
|
+
import { DefaultObjectDecoratorConfigInternal } from '../../decorators/object/object-decorator-internal.data';
|
|
11
|
+
import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../../decorators/string/string-decorator-internal.data';
|
|
12
|
+
import { PropertyDecoratorConfigInternal } from '../../decorators/base/property-decorator-internal.data';
|
|
13
|
+
import { MatTableDataSource } from '@angular/material/table';
|
|
14
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
15
|
+
import { AddArrayItemDialogDataInternal } from './add-array-item-dialog-data.builder';
|
|
16
|
+
import { AddArrayItemDialogData } from './add-array-item-dialog-data';
|
|
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';
|
|
14
24
|
import * as i0 from "@angular/core";
|
|
15
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The default input component. It gets the metadata of the property from the given @Input "entity" and @Input "propertyKey"
|
|
27
|
+
* and displays the input field accordingly.
|
|
28
|
+
*
|
|
29
|
+
* You can also define a method that generates error-messages and if the input should be hidden when its metadata says
|
|
30
|
+
* that it should be omitted for creating or updating.
|
|
31
|
+
* The last part being mostly relevant if you want to use this component inside an ngFor.
|
|
32
|
+
*/
|
|
33
|
+
export declare class NgxMatEntityInputComponent<EntityType extends object> implements OnInit {
|
|
34
|
+
private readonly dialog;
|
|
16
35
|
/**
|
|
17
|
-
* The entity on which the property exists. Used in
|
|
36
|
+
* The entity on which the property exists. Used in conjunction with the "propertyKey"
|
|
18
37
|
* to determine the property for which the input should be generated.
|
|
19
38
|
*/
|
|
20
39
|
entity: EntityType;
|
|
21
40
|
/**
|
|
22
|
-
* The name of the property to generate the input for. Used in
|
|
41
|
+
* The name of the property to generate the input for. Used in conjunction with the "entity".
|
|
23
42
|
*/
|
|
24
43
|
propertyKey: keyof EntityType;
|
|
25
44
|
/**
|
|
@@ -36,37 +55,139 @@ export declare class NgxMatEntityInputComponent<EntityType extends Entity> imple
|
|
|
36
55
|
* Is used internally for the object property.
|
|
37
56
|
*/
|
|
38
57
|
hideOmitForEdit?: boolean;
|
|
58
|
+
addArrayItemDialog: TemplateRef<unknown>;
|
|
59
|
+
addArrayItemDialogRef: MatDialogRef<unknown>;
|
|
39
60
|
type: DecoratorTypes;
|
|
40
|
-
metadata:
|
|
41
|
-
metadataDefaultString:
|
|
42
|
-
metadataTextboxString:
|
|
43
|
-
metadataAutocompleteString:
|
|
61
|
+
metadata: PropertyDecoratorConfigInternal;
|
|
62
|
+
metadataDefaultString: DefaultStringDecoratorConfigInternal;
|
|
63
|
+
metadataTextboxString: TextboxStringDecoratorConfigInternal;
|
|
64
|
+
metadataAutocompleteString: AutocompleteStringDecoratorConfigInternal;
|
|
44
65
|
autocompleteStrings: string[];
|
|
45
66
|
filteredAutocompleteStrings: string[];
|
|
46
|
-
metadataDropdownString:
|
|
47
|
-
metadataDropdownBoolean:
|
|
48
|
-
metadataDefaultNumber:
|
|
49
|
-
metadataDropdownNumber:
|
|
50
|
-
metadataDefaultObject:
|
|
51
|
-
objectProperty:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
metadataDropdownString: DropdownStringDecoratorConfigInternal;
|
|
68
|
+
metadataDropdownBoolean: DropdownBooleanDecoratorConfigInternal;
|
|
69
|
+
metadataDefaultNumber: DefaultNumberDecoratorConfigInternal;
|
|
70
|
+
metadataDropdownNumber: DropdownNumberDecoratorConfigInternal;
|
|
71
|
+
metadataDefaultObject: DefaultObjectDecoratorConfigInternal<EntityType>;
|
|
72
|
+
objectProperty: EntityType;
|
|
73
|
+
objectPropertyRows: EntityRow<EntityType>[];
|
|
74
|
+
metadataEntityArray: EntityArrayDecoratorConfigInternal<EntityType>;
|
|
75
|
+
entityArrayValues: EntityType[];
|
|
76
|
+
metadataStringChipsArray: StringChipsArrayDecoratorConfigInternal;
|
|
55
77
|
stringChipsArrayValues: string[];
|
|
56
78
|
chipsInput: string;
|
|
57
|
-
metadataAutocompleteStringChipsArray:
|
|
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>[];
|
|
89
|
+
arrayItem: EntityType;
|
|
90
|
+
private arrayItemPriorChanges;
|
|
91
|
+
arrayItemInlineRows: EntityRow<EntityType>[];
|
|
92
|
+
dataSource: MatTableDataSource<EntityType>;
|
|
93
|
+
selection: SelectionModel<EntityType>;
|
|
94
|
+
displayedColumns: string[];
|
|
95
|
+
dialogInputData: AddArrayItemDialogData<EntityType>;
|
|
96
|
+
dialogData: AddArrayItemDialogDataInternal<EntityType>;
|
|
97
|
+
arrayItemDialogRows: EntityRow<EntityType>[];
|
|
58
98
|
readonly DecoratorTypes: typeof DecoratorTypes;
|
|
59
|
-
|
|
60
|
-
|
|
99
|
+
EntityUtilities: typeof EntityUtilities;
|
|
100
|
+
DateUtilities: typeof DateUtilities;
|
|
101
|
+
constructor(dialog: MatDialog);
|
|
102
|
+
defaultDateFilter: DateFilterFn<Date | null | undefined>;
|
|
61
103
|
/**
|
|
62
|
-
*
|
|
104
|
+
* This is needed for the inputs to work inside an ngFor.
|
|
105
|
+
*
|
|
106
|
+
* @param index - The index of the element in the ngFor.
|
|
107
|
+
* @returns The index.
|
|
63
108
|
*/
|
|
64
109
|
trackByFn(index: unknown): unknown;
|
|
65
110
|
ngOnInit(): void;
|
|
66
|
-
|
|
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;
|
|
127
|
+
/**
|
|
128
|
+
* Tries to add an item to the array.
|
|
129
|
+
* Does this either inline if the "createInline"-metadata is set to true
|
|
130
|
+
* or in a separate dialog if it is set to false.
|
|
131
|
+
*/
|
|
132
|
+
add(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Adds the array item defined in the dialog.
|
|
135
|
+
*/
|
|
136
|
+
addArrayItem(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Cancels adding the array item defined in the dialog.
|
|
139
|
+
*/
|
|
140
|
+
cancelAddArrayItem(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Removes all selected entries from the array.
|
|
143
|
+
*/
|
|
144
|
+
remove(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Toggles all array-items in the table.
|
|
147
|
+
*/
|
|
148
|
+
masterToggle(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Checks if all array-items in the table have been selected.
|
|
151
|
+
* This is needed to display the "masterToggle"-checkbox correctly.
|
|
152
|
+
*
|
|
153
|
+
* @returns Whether or not all array-items in the table have been selected.
|
|
154
|
+
*/
|
|
155
|
+
isAllSelected(): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Handles adding strings to the chipsArray.
|
|
158
|
+
* Checks validation and also creates a new array if it is undefined.
|
|
159
|
+
* This is needed because two things are validated: The array itself
|
|
160
|
+
* and the contents of the array. And we need a way to display an
|
|
161
|
+
* mat-error. As the only validation for the array is whether or not
|
|
162
|
+
* it contains values, we can set it to undefined when the last element is removed
|
|
163
|
+
* (removeStringChipArrayValue). That way we can use the "required" validator.
|
|
164
|
+
*
|
|
165
|
+
* @param event - The event that fires when a new chip is completed.
|
|
166
|
+
*/
|
|
67
167
|
addStringChipArrayValue(event: MatChipInputEvent): void;
|
|
168
|
+
/**
|
|
169
|
+
* Removes the given value from the array.
|
|
170
|
+
* Sets the array to undefined if it is now empty.
|
|
171
|
+
* This is needed because two things are validated: The array itself
|
|
172
|
+
* and the contents of the array. And we need a way to display an
|
|
173
|
+
* mat-error. As the only validation for the array is whether or not
|
|
174
|
+
* it is empty, setting it to undefined here enables us to use the "required" validator.
|
|
175
|
+
*
|
|
176
|
+
* @param value - The string to remove from the array.
|
|
177
|
+
*/
|
|
68
178
|
removeStringChipArrayValue(value: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* Handles adding a string to the array when an autocomplete value has been selected.
|
|
181
|
+
*
|
|
182
|
+
* @param event - The autocomplete selected event.
|
|
183
|
+
* @param chipsInput - The element where the user typed the value.
|
|
184
|
+
*/
|
|
69
185
|
selected(event: MatAutocompleteSelectedEvent, chipsInput: HTMLInputElement): void;
|
|
186
|
+
/**
|
|
187
|
+
* Dynamically filters the Autocomplete options when the user inputs something.
|
|
188
|
+
*
|
|
189
|
+
* @param input - The input of the user.
|
|
190
|
+
*/
|
|
70
191
|
filterAutocompleteStrings(input: unknown): void;
|
|
71
192
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityInputComponent<any>, never>;
|
|
72
193
|
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,14 @@ 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 "
|
|
12
|
-
import * as i11 from "@angular/material/
|
|
13
|
-
import * as i12 from "@angular/material/
|
|
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";
|
|
16
|
+
import * as i15 from "@angular/material/datepicker";
|
|
14
17
|
export declare class NgxMatEntityInputModule {
|
|
15
18
|
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.
|
|
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]>;
|
|
17
20
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgxMatEntityInputModule>;
|
|
18
21
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseBuilder } from '../../../classes/base.builder';
|
|
2
|
+
import { ConfirmDialogDataInternal } from '../../confirm-dialog/confirm-dialog-data.builder';
|
|
3
|
+
import { CreateDialogData } from '../table-data';
|
|
4
|
+
/**
|
|
5
|
+
* The internal CreateDialogData. Requires all default values the user can leave out.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CreateDialogDataInternal implements CreateDialogData {
|
|
8
|
+
title: string;
|
|
9
|
+
createButtonLabel: string;
|
|
10
|
+
cancelButtonLabel: string;
|
|
11
|
+
createRequiresConfirmDialog: boolean;
|
|
12
|
+
confirmCreateDialogData: ConfirmDialogDataInternal;
|
|
13
|
+
constructor(title: string, createButtonLabel: string, cancelButtonLabel: string, createRequiresConfirmDialog: boolean, confirmCreateDialogData: ConfirmDialogDataInternal);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The Builder for the CreateDialogData. Sets default values.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CreateDialogDataBuilder extends BaseBuilder<CreateDialogDataInternal, CreateDialogData> {
|
|
19
|
+
constructor(data?: CreateDialogData);
|
|
20
|
+
protected generateBaseData(data?: CreateDialogData): CreateDialogDataInternal;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EntityService } from '../../../classes/entity.service';
|
|
2
|
+
import { CreateEntityDialogData } from './create-entity-dialog-data';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import { CreateDialogDataInternal } from './create-dialog-data.builder';
|
|
5
|
+
import { BaseBuilder } from '../../../classes/base.builder';
|
|
6
|
+
/**
|
|
7
|
+
* The internal CreateEntityDialogData. Requires all default values the user can leave out.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CreateEntityDialogDataInternal<EntityType extends object> implements CreateEntityDialogData<EntityType> {
|
|
10
|
+
entity: EntityType;
|
|
11
|
+
EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
|
|
12
|
+
createDialogData: CreateDialogDataInternal;
|
|
13
|
+
constructor(entity: EntityType, EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>, createDialogData: CreateDialogDataInternal);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The Builder for the CreateEntityDialogData. Sets default values.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CreateEntityDialogDataBuilder<EntityType extends object> extends BaseBuilder<CreateEntityDialogDataInternal<EntityType>, CreateEntityDialogData<EntityType>> {
|
|
19
|
+
constructor(data: CreateEntityDialogData<EntityType>);
|
|
20
|
+
protected generateBaseData(data: CreateEntityDialogData<EntityType>): CreateEntityDialogDataInternal<EntityType>;
|
|
21
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { EntityService } from '../../../classes/entity
|
|
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
|
-
* The Definition of the Create Entity Dialog Data
|
|
5
|
+
* The Definition of the Create Entity Dialog Data.
|
|
7
6
|
*/
|
|
8
|
-
export interface CreateEntityDialogData<EntityType extends
|
|
7
|
+
export interface CreateEntityDialogData<EntityType extends object> {
|
|
9
8
|
/**
|
|
10
9
|
* An empty entity that is used as the data model.
|
|
11
10
|
*/
|
|
@@ -17,5 +16,5 @@ export interface CreateEntityDialogData<EntityType extends Entity> {
|
|
|
17
16
|
/**
|
|
18
17
|
* The info of the generic create-dialog.
|
|
19
18
|
*/
|
|
20
|
-
createDialogData
|
|
19
|
+
createDialogData?: CreateDialogData;
|
|
21
20
|
}
|
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
import { Injector, OnInit } from '@angular/core';
|
|
2
2
|
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
3
|
-
import { EntityService } from '../../../classes/entity
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { EntityService } from '../../../classes/entity.service';
|
|
4
|
+
import { EntityRow, EntityUtilities } from '../../../classes/entity.utilities';
|
|
5
|
+
import { CreateEntityDialogDataInternal } from './create-entity-dialog-data.builder';
|
|
6
6
|
import { CreateEntityDialogData } from './create-entity-dialog-data';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The default dialog used to create new entities based on the configuration passed in the MAT_DIALOG_DATA "inputData".
|
|
10
|
+
* Used by the ngx-mat-entity-table.
|
|
11
|
+
*
|
|
12
|
+
* It offers a lot of customization options which can be found in "CreateEntityDialogData".
|
|
13
|
+
*/
|
|
14
|
+
export declare class NgxMatEntityCreateDialogComponent<EntityType extends object> implements OnInit {
|
|
15
|
+
private readonly inputData;
|
|
10
16
|
dialogRef: MatDialogRef<NgxMatEntityCreateDialogComponent<EntityType>>;
|
|
11
17
|
private readonly injector;
|
|
12
18
|
private readonly dialog;
|
|
13
19
|
EntityUtilities: typeof EntityUtilities;
|
|
14
|
-
|
|
20
|
+
entityRows: EntityRow<EntityType>[];
|
|
15
21
|
entityService: EntityService<EntityType>;
|
|
22
|
+
data: CreateEntityDialogDataInternal<EntityType>;
|
|
16
23
|
getWidth: typeof EntityUtilities.getWidth;
|
|
17
|
-
constructor(
|
|
24
|
+
constructor(inputData: CreateEntityDialogData<EntityType>, dialogRef: MatDialogRef<NgxMatEntityCreateDialogComponent<EntityType>>, injector: Injector, dialog: MatDialog);
|
|
18
25
|
ngOnInit(): void;
|
|
19
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Tries add the new entity and close the dialog afterwards.
|
|
28
|
+
* Also handles the confirmation if required.
|
|
29
|
+
*/
|
|
20
30
|
create(): void;
|
|
21
31
|
private confirmCreate;
|
|
32
|
+
/**
|
|
33
|
+
* Closes the dialog.
|
|
34
|
+
*/
|
|
22
35
|
cancel(): void;
|
|
23
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityCreateDialogComponent<any>, never>;
|
|
24
37
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityCreateDialogComponent<any>, "ngx-mat-entity-create-dialog", never, {}, {}, never, never>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseBuilder } from '../../../classes/base.builder';
|
|
2
|
+
import { ConfirmDialogData } from '../../confirm-dialog/confirm-dialog-data';
|
|
3
|
+
import { EditDialogData } from '../table-data';
|
|
4
|
+
/**
|
|
5
|
+
* The internal EditDialogData. Requires all default values the user can leave out.
|
|
6
|
+
*/
|
|
7
|
+
export declare class EditDialogDataInternal<EntityType extends object> implements EditDialogData<EntityType> {
|
|
8
|
+
title: (entity: EntityType) => string;
|
|
9
|
+
confirmButtonLabel: string;
|
|
10
|
+
deleteButtonLabel: string;
|
|
11
|
+
cancelButtonLabel: string;
|
|
12
|
+
deleteRequiresConfirmDialog: boolean;
|
|
13
|
+
editRequiresConfirmDialog: boolean;
|
|
14
|
+
confirmDeleteDialogData: ConfirmDialogData;
|
|
15
|
+
confirmEditDialogData: ConfirmDialogData;
|
|
16
|
+
constructor(title: (entity: EntityType) => string, confirmButtonLabel: string, deleteButtonLabel: string, cancelButtonLabel: string, deleteRequiresConfirmDialog: boolean, editRequiresConfirmDialog: boolean, confirmDeleteDialogData: ConfirmDialogData, confirmEditDialogData: ConfirmDialogData);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Builder for the EditDialogData. Sets default values.
|
|
20
|
+
*/
|
|
21
|
+
export declare class EditDialogDataBuilder<EntityType extends object> extends BaseBuilder<EditDialogDataInternal<EntityType>, EditDialogData<EntityType>> {
|
|
22
|
+
constructor(data?: EditDialogData<EntityType>);
|
|
23
|
+
protected generateBaseData(data?: EditDialogData<EntityType>): EditDialogDataInternal<EntityType>;
|
|
24
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { EntityService } from '../../../classes/entity
|
|
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
|
-
* The Definition of the Edit Entity Dialog Data
|
|
5
|
+
* The Definition of the Edit Entity Dialog Data.
|
|
7
6
|
*/
|
|
8
|
-
export interface EditEntityDialogData<EntityType extends
|
|
7
|
+
export interface EditEntityDialogData<EntityType extends object> {
|
|
9
8
|
/**
|
|
10
|
-
* The entity to edit
|
|
9
|
+
* The entity to edit.
|
|
11
10
|
*/
|
|
12
11
|
entity: EntityType;
|
|
13
12
|
/**
|
|
@@ -17,9 +16,9 @@ export interface EditEntityDialogData<EntityType extends Entity> {
|
|
|
17
16
|
/**
|
|
18
17
|
* The info of the generic edit-dialog.
|
|
19
18
|
*/
|
|
20
|
-
editDialogData
|
|
19
|
+
editDialogData?: EditDialogData<EntityType>;
|
|
21
20
|
/**
|
|
22
|
-
* Whether or not the user can delete this specific entity
|
|
21
|
+
* Whether or not the user can delete this specific entity.
|
|
23
22
|
*/
|
|
24
|
-
allowDelete
|
|
23
|
+
allowDelete?: (entity: EntityType) => boolean;
|
|
25
24
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EntityService } from '../../../classes/entity.service';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { EditEntityDialogData } from './edit-entity-dialog-data';
|
|
4
|
+
import { EditDialogDataInternal } from './edit-dialog-data.builder';
|
|
5
|
+
import { BaseBuilder } from '../../../classes/base.builder';
|
|
6
|
+
/**
|
|
7
|
+
* The internal EditEntityDialogData. Requires all default values the user can leave out.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EditEntityDialogDataInternal<EntityType extends object> implements EditEntityDialogData<EntityType> {
|
|
10
|
+
entity: EntityType;
|
|
11
|
+
EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
|
|
12
|
+
editDialogData: EditDialogDataInternal<EntityType>;
|
|
13
|
+
allowDelete: (entity: EntityType) => boolean;
|
|
14
|
+
constructor(entity: EntityType, EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>, editDialogData: EditDialogDataInternal<EntityType>, allowDelete: (entity: EntityType) => boolean);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The Builder for the EditEntityDialogData. Sets default values.
|
|
18
|
+
*/
|
|
19
|
+
export declare class EditEntityDialogDataBuilder<EntityType extends object> extends BaseBuilder<EditEntityDialogDataInternal<EntityType>, EditEntityDialogData<EntityType>> {
|
|
20
|
+
constructor(data: EditEntityDialogData<EntityType>);
|
|
21
|
+
protected generateBaseData(data: EditEntityDialogData<EntityType>): EditEntityDialogDataInternal<EntityType>;
|
|
22
|
+
}
|
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
import { Injector, OnInit } from '@angular/core';
|
|
2
2
|
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
3
|
-
import { EntityService } from '../../../classes/entity
|
|
4
|
-
import {
|
|
5
|
-
import { 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';
|
|
6
|
+
import { EditEntityDialogDataInternal } from './edit-entity-dialog.builder';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The default dialog used to edit an existing entity based on the configuration passed in the MAT_DIALOG_DATA "inputData".
|
|
10
|
+
* Used by the ngx-mat-entity-table.
|
|
11
|
+
*
|
|
12
|
+
* It offers a lot of customization options which can be found in "EditEntityDialogData".
|
|
13
|
+
*/
|
|
14
|
+
export declare class NgxMatEntityEditDialogComponent<EntityType extends object> implements OnInit {
|
|
15
|
+
private readonly inputData;
|
|
10
16
|
dialogRef: MatDialogRef<NgxMatEntityEditDialogComponent<EntityType>>;
|
|
11
17
|
private readonly injector;
|
|
12
18
|
private readonly dialog;
|
|
13
19
|
EntityUtilities: typeof EntityUtilities;
|
|
14
|
-
|
|
20
|
+
entityRows: EntityRow<EntityType>[];
|
|
15
21
|
entityService: EntityService<EntityType>;
|
|
16
22
|
entityPriorChanges: EntityType;
|
|
23
|
+
data: EditEntityDialogDataInternal<EntityType>;
|
|
17
24
|
getWidth: typeof EntityUtilities.getWidth;
|
|
18
|
-
constructor(
|
|
25
|
+
constructor(inputData: EditEntityDialogData<EntityType>, dialogRef: MatDialogRef<NgxMatEntityEditDialogComponent<EntityType>>, injector: Injector, dialog: MatDialog);
|
|
19
26
|
ngOnInit(): void;
|
|
20
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Tries to save the changes and close the dialog afterwards.
|
|
29
|
+
* Also handles the confirmation if required.
|
|
30
|
+
*/
|
|
21
31
|
edit(): void;
|
|
22
32
|
private confirmEdit;
|
|
33
|
+
/**
|
|
34
|
+
* Tries to delete the entity and close the dialog afterwards.
|
|
35
|
+
* Also handles the confirmation if required.
|
|
36
|
+
*/
|
|
23
37
|
delete(): void;
|
|
24
38
|
private confirmDelete;
|
|
39
|
+
/**
|
|
40
|
+
* Reverts all changes made and closes the dialog.
|
|
41
|
+
*/
|
|
25
42
|
cancel(): void;
|
|
26
43
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityEditDialogComponent<any>, never>;
|
|
27
44
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityEditDialogComponent<any>, "ngx-mat-entity-edit-dialog", never, {}, {}, never, never>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { EntityService } from '../../classes/entity.service';
|
|
2
|
+
import { CreateDialogDataInternal } from './create-dialog/create-dialog-data.builder';
|
|
3
|
+
import { EditDialogDataInternal } from './edit-dialog/edit-dialog-data.builder';
|
|
4
|
+
import { BaseData, DisplayColumn, MultiSelectAction, TableData } from './table-data';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
import { BaseBuilder } from '../../classes/base.builder';
|
|
7
|
+
import { EntityClassNewable } from '../../classes/entity.model';
|
|
8
|
+
/**
|
|
9
|
+
* The internal TableData. Requires all default values the user can leave out.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TableDataInternal<EntityType extends object> implements TableData<EntityType> {
|
|
12
|
+
baseData: BaseDataInternal<EntityType>;
|
|
13
|
+
createDialogData: CreateDialogDataInternal;
|
|
14
|
+
editDialogData: EditDialogDataInternal<EntityType>;
|
|
15
|
+
constructor(baseData: BaseDataInternal<EntityType>, createDialogData: CreateDialogDataInternal, editDialogData: EditDialogDataInternal<EntityType>);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The Builder for the table BaseData. Sets default values.
|
|
19
|
+
*/
|
|
20
|
+
export declare class BaseDataBuilder<EntityType extends object> extends BaseBuilder<BaseDataInternal<EntityType>, BaseData<EntityType>> {
|
|
21
|
+
constructor(data: BaseData<EntityType>);
|
|
22
|
+
protected generateBaseData(data: BaseData<EntityType>): BaseDataInternal<EntityType>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The internal TableData. Requires all default values the user can leave out.
|
|
26
|
+
*/
|
|
27
|
+
export declare class BaseDataInternal<EntityType extends object> implements BaseData<EntityType> {
|
|
28
|
+
title: string;
|
|
29
|
+
displayColumns: DisplayColumn<EntityType>[];
|
|
30
|
+
EntityServiceClass: new (httpClient: HttpClient) => EntityService<EntityType>;
|
|
31
|
+
searchLabel: string;
|
|
32
|
+
createButtonLabel: string;
|
|
33
|
+
searchString: (entity: EntityType) => string;
|
|
34
|
+
allowCreate: boolean;
|
|
35
|
+
allowEdit: (entity: EntityType) => boolean;
|
|
36
|
+
allowDelete: (entity: EntityType) => boolean;
|
|
37
|
+
multiSelectActions: MultiSelectAction<EntityType>[];
|
|
38
|
+
multiSelectLabel: string;
|
|
39
|
+
EntityClass?: EntityClassNewable<EntityType>;
|
|
40
|
+
edit?: (entity: EntityType) => unknown;
|
|
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?: EntityClassNewable<EntityType>, edit?: (entity: EntityType) => unknown, create?: (entity: EntityType) => unknown);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The Builder for the complete TableData. Sets default values and validates user input.
|
|
46
|
+
*/
|
|
47
|
+
export declare class TableDataBuilder<EntityType extends object> extends BaseBuilder<TableDataInternal<EntityType>, TableData<EntityType>> {
|
|
48
|
+
constructor(data: TableData<EntityType>);
|
|
49
|
+
protected generateBaseData(data: TableData<EntityType>): TableDataInternal<EntityType>;
|
|
50
|
+
protected validateInput(data: TableData<EntityType>): void;
|
|
51
|
+
}
|