ngx-material-entity 18.0.0 → 18.1.0
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/components/custom-table/custom-table-configuration.model.d.ts +65 -0
- package/components/custom-table/custom-table.component.d.ts +111 -0
- package/components/edit-page/edit-page.component.d.ts +5 -1
- package/components/input/array/array-date-input/array-date-input.component.d.ts +2 -2
- package/components/input/array/array-date-range-input/array-date-range-input.component.d.ts +3 -3
- package/components/input/array/array-date-time-input/array-date-time-input.component.d.ts +3 -3
- package/components/input/array/array-table.class.d.ts +25 -19
- package/components/input/input.component.d.ts +99 -80
- package/components/input/relations/references-many-input/references-many-input.component.d.ts +12 -17
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +5 -5
- package/components/table/table-data.d.ts +9 -4
- package/components/table/table.component.d.ts +15 -37
- package/decorators/array/array-decorator-internal.data.d.ts +5 -1
- package/decorators/array/array-decorator.data.d.ts +38 -82
- package/decorators/references-many/references-many-decorator-internal.data.d.ts +3 -1
- package/decorators/references-many/references-many-decorator.data.d.ts +13 -1
- package/directives/dynamic-style-class.directive.d.ts +4 -5
- package/esm2022/components/confirm-dialog/confirm-dialog.component.mjs +5 -6
- package/esm2022/components/create-page/create-page.component.mjs +6 -7
- package/esm2022/components/custom-table/custom-table-configuration.model.mjs +37 -0
- package/esm2022/components/custom-table/custom-table.component.mjs +213 -0
- package/esm2022/components/edit-page/edit-page.component.mjs +19 -9
- package/esm2022/components/form/form.component.mjs +5 -6
- package/esm2022/components/input/array/array-date-input/array-date-input.component.mjs +16 -20
- package/esm2022/components/input/array/array-date-range-input/array-date-range-input.component.mjs +27 -26
- package/esm2022/components/input/array/array-date-time-input/array-date-time-input.component.mjs +17 -21
- package/esm2022/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +4 -4
- package/esm2022/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +4 -4
- package/esm2022/components/input/array/array-table.class.mjs +51 -43
- package/esm2022/components/input/date/date-range-input/date-range-input.component.mjs +5 -6
- package/esm2022/components/input/date/date-time-input/date-time-input.component.mjs +4 -4
- package/esm2022/components/input/file/file-image-input/file-image-input.component.mjs +4 -7
- package/esm2022/components/input/file/file-input/file-input.component.mjs +4 -5
- package/esm2022/components/input/input.component.mjs +143 -106
- package/esm2022/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +4 -5
- package/esm2022/components/input/relations/references-many-input/references-many-input.component.mjs +40 -55
- package/esm2022/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +4 -5
- package/esm2022/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +4 -5
- package/esm2022/components/input/string/string-password-input/string-password-input.component.mjs +4 -4
- package/esm2022/components/table/create-dialog/create-entity-dialog.component.mjs +9 -8
- package/esm2022/components/table/edit-dialog/edit-entity-dialog.component.mjs +22 -14
- package/esm2022/components/table/table-data.mjs +1 -1
- package/esm2022/components/table/table.component.mjs +40 -107
- package/esm2022/components/tooltip/tooltip.component.mjs +3 -3
- package/esm2022/decorators/array/array-decorator-internal.data.mjs +14 -1
- package/esm2022/decorators/array/array-decorator.data.mjs +33 -2
- package/esm2022/decorators/has-many/has-many-decorator-internal.data.mjs +1 -1
- package/esm2022/decorators/references-many/references-many-decorator-internal.data.mjs +8 -1
- package/esm2022/decorators/references-many/references-many-decorator.data.mjs +1 -1
- package/esm2022/directives/dynamic-style-class.directive.mjs +5 -5
- package/esm2022/directives/tooltip.directive.mjs +4 -1
- package/esm2022/functions/get-changes-tooltip-content.function.mjs +23 -0
- package/esm2022/functions/get-validation-errors-tooltip-content.function.mjs +23 -0
- package/esm2022/functions/table-column-value-to-sort-value.function.mjs +29 -0
- package/esm2022/public-api.mjs +3 -2
- package/esm2022/utilities/date.utilities.mjs +7 -6
- package/esm2022/utilities/entity.utilities.mjs +23 -7
- package/esm2022/utilities/validation.utilities.mjs +2 -2
- package/fesm2022/ngx-material-entity.mjs +2550 -2224
- package/fesm2022/ngx-material-entity.mjs.map +1 -1
- package/functions/get-changes-tooltip-content.function.d.ts +13 -0
- package/functions/table-column-value-to-sort-value.function.d.ts +9 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/utilities/entity.utilities.d.ts +7 -3
- package/esm2022/functions/get-validation-errors-tooltip-content.function.ts.mjs +0 -23
- /package/functions/{get-validation-errors-tooltip-content.function.ts.d.ts → get-validation-errors-tooltip-content.function.d.ts} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NgxGlobalDefaultValues } from '../../global-configuration-values';
|
|
2
|
+
import { DisplayColumn, DynamicStyleClasses } from '../table/table-data';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the custom table.
|
|
5
|
+
*/
|
|
6
|
+
export interface CustomTableConfiguration<T = unknown> {
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for css classes that should be applied to table rows based on a condition.
|
|
9
|
+
* This could be used to eg. Set the background color to green when an item has the status completed etc.
|
|
10
|
+
* INFO: You need to use ng-deep or apply the styling in the styles.scss.
|
|
11
|
+
* @default () => []
|
|
12
|
+
*/
|
|
13
|
+
dynamicRowStyleClasses?: DynamicStyleClasses<T>;
|
|
14
|
+
/**
|
|
15
|
+
* The columns to display inside the custom table.
|
|
16
|
+
*/
|
|
17
|
+
displayColumns: DisplayColumn<T>[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether or not a loading spinner should be shown.
|
|
20
|
+
* Only works when you provide the "loading" input to the custom table.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
displayLoadingSpinner?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether or not the select column should be enabled.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
withSelection: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A function that resolves a row value to a string that can be searched for.
|
|
31
|
+
* By default this uses a built in search filter.
|
|
32
|
+
*/
|
|
33
|
+
searchStringForRow?: (value: T) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether or not the user is allowed to click on entries in the custom table.
|
|
36
|
+
* @default () => true
|
|
37
|
+
*/
|
|
38
|
+
allowClick?: (value: T) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* An error message to show when the table contains no entries.
|
|
41
|
+
* Also applies styling to the table.
|
|
42
|
+
*/
|
|
43
|
+
emptyErrorMessage?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Resolves the given id for an entity.
|
|
46
|
+
* This is used for the referencesMany input,
|
|
47
|
+
* where you want to show values of the entity in the table rows and not the id.
|
|
48
|
+
*/
|
|
49
|
+
resolveToReferencedEntity?: (id: unknown) => unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Internal configuration for the custom table.
|
|
53
|
+
* Provides default values.
|
|
54
|
+
*/
|
|
55
|
+
export declare class InternalCustomTableConfiguration<T = unknown> implements CustomTableConfiguration<T> {
|
|
56
|
+
dynamicRowStyleClasses: DynamicStyleClasses<T>;
|
|
57
|
+
displayColumns: DisplayColumn<T>[];
|
|
58
|
+
displayLoadingSpinner: boolean;
|
|
59
|
+
withSelection: boolean;
|
|
60
|
+
searchStringForRow: (value: T) => string;
|
|
61
|
+
allowClick: (value: T) => boolean;
|
|
62
|
+
emptyErrorMessage: string;
|
|
63
|
+
resolveToReferencedEntity?: (id: unknown) => unknown;
|
|
64
|
+
constructor(globalConfig: NgxGlobalDefaultValues, configuration: CustomTableConfiguration<T>);
|
|
65
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
2
|
+
import { EnvironmentInjector, EventEmitter, OnInit } from '@angular/core';
|
|
3
|
+
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
4
|
+
import { MatTableDataSource } from '@angular/material/table';
|
|
5
|
+
import { CustomTableConfiguration, InternalCustomTableConfiguration } from './custom-table-configuration.model';
|
|
6
|
+
import { BaseEntityType } from '../../classes/entity.model';
|
|
7
|
+
import { NgxGlobalDefaultValues } from '../../global-configuration-values';
|
|
8
|
+
import { SelectionUtilities } from '../../utilities/selection.utilities';
|
|
9
|
+
import { DisplayColumn, TableColumnValue } from '../table/table-data';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
/**
|
|
12
|
+
* The event for clicking on a table cell.
|
|
13
|
+
*/
|
|
14
|
+
export type CellClickedEvent<T> = {
|
|
15
|
+
/**
|
|
16
|
+
* The column that was clicked.
|
|
17
|
+
*/
|
|
18
|
+
displayColumn: DisplayColumn<T>;
|
|
19
|
+
/**
|
|
20
|
+
* The value of the row that was clicked.
|
|
21
|
+
*/
|
|
22
|
+
value: T;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A custom table that has things like sorting and pagination already built in.
|
|
26
|
+
*/
|
|
27
|
+
export declare class CustomTableComponent<T, EntityType extends BaseEntityType<EntityType>> implements OnInit {
|
|
28
|
+
private readonly injector;
|
|
29
|
+
private readonly globalConfig;
|
|
30
|
+
SelectionUtilities: typeof SelectionUtilities;
|
|
31
|
+
/**
|
|
32
|
+
* Updates the table entries.
|
|
33
|
+
*/
|
|
34
|
+
set data(value: T[]);
|
|
35
|
+
/**
|
|
36
|
+
* Applies the given string as a filter to the table.
|
|
37
|
+
*/
|
|
38
|
+
set searchString(value: string);
|
|
39
|
+
set required(value: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* Whether or not the table should show an error message when the table is empty.
|
|
42
|
+
*/
|
|
43
|
+
shouldShowMissingError: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether or not the table data is currently loading.
|
|
46
|
+
*/
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The configuration of the table.
|
|
50
|
+
*/
|
|
51
|
+
configuration: CustomTableConfiguration<T>;
|
|
52
|
+
internalConfiguration: InternalCustomTableConfiguration<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Emits when a cell is clicked that is neither disabled nor disallowed to be clicked.
|
|
55
|
+
*/
|
|
56
|
+
readonly cellClicked: EventEmitter<CellClickedEvent<T>>;
|
|
57
|
+
/**
|
|
58
|
+
* Emits when the selected values change.
|
|
59
|
+
*/
|
|
60
|
+
readonly selectionChanged: EventEmitter<T[]>;
|
|
61
|
+
/**
|
|
62
|
+
* The paginator from the html.
|
|
63
|
+
*/
|
|
64
|
+
private readonly paginator;
|
|
65
|
+
/**
|
|
66
|
+
* The sort from the html.
|
|
67
|
+
*/
|
|
68
|
+
private readonly sort;
|
|
69
|
+
/**
|
|
70
|
+
* The data source for the table.
|
|
71
|
+
*/
|
|
72
|
+
dataSource: MatTableDataSource<T>;
|
|
73
|
+
/**
|
|
74
|
+
* The selection of the table.
|
|
75
|
+
*/
|
|
76
|
+
selection: SelectionModel<T>;
|
|
77
|
+
/**
|
|
78
|
+
* The columns of the table.
|
|
79
|
+
*/
|
|
80
|
+
displayedColumns: string[];
|
|
81
|
+
constructor(injector: EnvironmentInjector, globalConfig: NgxGlobalDefaultValues);
|
|
82
|
+
ngOnInit(): void;
|
|
83
|
+
private setupDataSource;
|
|
84
|
+
/**
|
|
85
|
+
* Emits a cellClicked event when the clicked column is enabled and clicking is allowed by the configuration.
|
|
86
|
+
* @param value - The value of the row that was clicked.
|
|
87
|
+
* @param dCol - The display column of the row that was clicked.
|
|
88
|
+
*/
|
|
89
|
+
clickCell(value: T, dCol: DisplayColumn<T>): void;
|
|
90
|
+
/**
|
|
91
|
+
* Toggles a single table row.
|
|
92
|
+
* @param value - The value of the row that was clicked.
|
|
93
|
+
* @param event - The change event from the checkbox.
|
|
94
|
+
*/
|
|
95
|
+
toggle(value: T, event?: MatCheckboxChange): void;
|
|
96
|
+
/**
|
|
97
|
+
* Toggles all table rows.
|
|
98
|
+
* @param event - The change event from the checkbox.
|
|
99
|
+
*/
|
|
100
|
+
masterToggle(event?: MatCheckboxChange): void;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the value to display in the column.
|
|
103
|
+
* Runs in environment context to enable injection.
|
|
104
|
+
* @param value - The column value to get the display string from.
|
|
105
|
+
* @param displayColumn - The display column to get the value from.
|
|
106
|
+
* @returns The value of the display column.
|
|
107
|
+
*/
|
|
108
|
+
getDisplayColumnValue(value: T, displayColumn: DisplayColumn<T>): TableColumnValue;
|
|
109
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CustomTableComponent<any, any>, never>;
|
|
110
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CustomTableComponent<any, any>, "custom-table", never, { "data": { "alias": "data"; "required": true; }; "searchString": { "alias": "searchString"; "required": false; }; "required": { "alias": "required"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "configuration": { "alias": "configuration"; "required": true; }; }, { "cellClicked": "cellClicked"; "selectionChanged": "selectionChanged"; }, never, never, true, never>;
|
|
111
|
+
}
|
|
@@ -8,7 +8,7 @@ import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
|
|
|
8
8
|
import { NgxGlobalDefaultValues } from '../../global-configuration-values';
|
|
9
9
|
import { EntityService } from '../../services/entity.service';
|
|
10
10
|
import { UnsavedChangesPage } from '../../services/unsaved-changes.guard';
|
|
11
|
-
import { EntityUtilities } from '../../utilities/entity.utilities';
|
|
11
|
+
import { Difference, EntityUtilities } from '../../utilities/entity.utilities';
|
|
12
12
|
import { ValidationError } from '../../utilities/validation.utilities';
|
|
13
13
|
import { ConfirmDialogData } from '../confirm-dialog/confirm-dialog-data';
|
|
14
14
|
import { EditActionInternal } from '../table/edit-dialog/edit-data.builder';
|
|
@@ -91,6 +91,10 @@ export declare class NgxMatEntityEditPageComponent<EntityType extends BaseEntity
|
|
|
91
91
|
* Whether or not the entity is valid.
|
|
92
92
|
*/
|
|
93
93
|
isEntityValid: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* All changes that have been done to the entity.
|
|
96
|
+
*/
|
|
97
|
+
changes: Difference<EntityType>[];
|
|
94
98
|
/**
|
|
95
99
|
* Whether or not the entity is dirty.
|
|
96
100
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import {
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
3
|
import { MatDialog } from '@angular/material/dialog';
|
|
4
4
|
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
5
5
|
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
@@ -10,7 +10,7 @@ import * as i0 from "@angular/core";
|
|
|
10
10
|
export declare class ArrayDateInputComponent<EntityType extends BaseEntityType<EntityType>> extends ArrayTableComponent<Date, EntityType, DecoratorTypes.ARRAY_DATE> implements OnInit {
|
|
11
11
|
private readonly globalConfig;
|
|
12
12
|
DateUtilities: typeof DateUtilities;
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(dialog: MatDialog, http: HttpClient, globalConfig: NgxGlobalDefaultValues);
|
|
14
14
|
ngOnInit(): void;
|
|
15
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateInputComponent<any>, never>;
|
|
16
16
|
static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateInputComponent<any>, "array-date-input", never, {}, {}, never, never, true, never>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import {
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
3
|
import { MatDialog } from '@angular/material/dialog';
|
|
4
4
|
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
5
5
|
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
@@ -13,12 +13,12 @@ export declare class ArrayDateRangeInputComponent<EntityType extends BaseEntityT
|
|
|
13
13
|
DateUtilities: typeof DateUtilities;
|
|
14
14
|
dateRangeStart?: Date;
|
|
15
15
|
dateRangeEnd?: Date;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(dialog: MatDialog, http: HttpClient, globalConfig: NgxGlobalDefaultValues);
|
|
17
17
|
ngOnInit(): void;
|
|
18
18
|
/**
|
|
19
19
|
* Adds a DateRange to the array.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
add(): Promise<void>;
|
|
22
22
|
protected resetInput(): void;
|
|
23
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateRangeInputComponent<any>, never>;
|
|
24
24
|
static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateRangeInputComponent<any>, "array-date-range-input", never, {}, {}, never, never, true, never>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import {
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
3
|
import { MatDialog } from '@angular/material/dialog';
|
|
4
4
|
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
5
5
|
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
@@ -14,13 +14,13 @@ export declare class ArrayDateTimeInputComponent<EntityType extends BaseEntityTy
|
|
|
14
14
|
dateTime?: Date;
|
|
15
15
|
time?: Time;
|
|
16
16
|
timeDropdownValues: DropdownValue<Time>[];
|
|
17
|
-
constructor(matDialog: MatDialog,
|
|
17
|
+
constructor(matDialog: MatDialog, http: HttpClient, globalConfig: NgxGlobalDefaultValues);
|
|
18
18
|
ngOnInit(): void;
|
|
19
19
|
protected resetInput(): void;
|
|
20
20
|
/**
|
|
21
21
|
* Adds a date time to the array.
|
|
22
22
|
*/
|
|
23
|
-
addDateTime(): void
|
|
23
|
+
addDateTime(): Promise<void>;
|
|
24
24
|
static ɵfac: i0.ɵɵFactoryDeclaration<ArrayDateTimeInputComponent<any>, never>;
|
|
25
25
|
static ɵcmp: i0.ɵɵComponentDeclaration<ArrayDateTimeInputComponent<any>, "array-date-time-input", never, {}, {}, never, never, true, never>;
|
|
26
26
|
}
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
2
1
|
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import {
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
4
3
|
import { MatDialog } from '@angular/material/dialog';
|
|
5
|
-
import { MatTableDataSource } from '@angular/material/table';
|
|
6
4
|
import { BaseEntityType } from '../../../classes/entity.model';
|
|
7
5
|
import { DecoratorTypes } from '../../../decorators/base/decorator-types.enum';
|
|
8
|
-
import {
|
|
9
|
-
import { DisplayColumn } from '../../table/table-data';
|
|
6
|
+
import { CustomTableConfiguration } from '../../custom-table/custom-table-configuration.model';
|
|
10
7
|
import { NgxMatEntityBaseInputComponent } from '../base-input.component';
|
|
11
8
|
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* The Decorator Types that use the array table class.
|
|
11
|
+
*/
|
|
12
12
|
type ArrayTableType = DecoratorTypes.ARRAY | DecoratorTypes.ARRAY_DATE | DecoratorTypes.ARRAY_DATE_RANGE | DecoratorTypes.ARRAY_DATE_TIME;
|
|
13
13
|
/**
|
|
14
14
|
* The base component needed for all arrays that are displayed as a table.
|
|
15
15
|
*/
|
|
16
16
|
export declare abstract class ArrayTableComponent<ValueType, EntityType extends BaseEntityType<EntityType>, ArrayType extends ArrayTableType> extends NgxMatEntityBaseInputComponent<EntityType, ArrayType, ValueType[]> implements OnInit {
|
|
17
|
-
private readonly
|
|
18
|
-
private readonly injector;
|
|
17
|
+
private readonly dialog;
|
|
19
18
|
private readonly http;
|
|
19
|
+
/**
|
|
20
|
+
* The input that should be added to the array.
|
|
21
|
+
*/
|
|
20
22
|
input?: ValueType;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The currently selected values.
|
|
25
|
+
*/
|
|
26
|
+
selected: ValueType[];
|
|
27
|
+
/**
|
|
28
|
+
* The configuration of the table.
|
|
29
|
+
*/
|
|
30
|
+
tableConfig: CustomTableConfiguration;
|
|
31
|
+
get propertyValue(): ValueType[];
|
|
32
|
+
set propertyValue(value: ValueType[]);
|
|
33
|
+
constructor(dialog: MatDialog, http: HttpClient);
|
|
26
34
|
ngOnInit(): void;
|
|
27
35
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @param displayColumn - The display column to get the value from.
|
|
32
|
-
* @returns The value of the display column.
|
|
36
|
+
* Sets the table config.
|
|
37
|
+
* This is not included in the ngOnInit for child classes to be able to set their metadata.
|
|
38
|
+
* (which is used in the table config).
|
|
33
39
|
*/
|
|
34
|
-
|
|
40
|
+
protected setTableConfig(): void;
|
|
35
41
|
/**
|
|
36
42
|
* Tries to add an item to the array.
|
|
37
43
|
*/
|
|
38
|
-
add(): void
|
|
44
|
+
add(): Promise<void>;
|
|
39
45
|
/**
|
|
40
46
|
* Is split up from the add method to override this functionality more easily.
|
|
41
47
|
*/
|
|
@@ -3,7 +3,6 @@ import { HttpClient } from '@angular/common/http';
|
|
|
3
3
|
import { EnvironmentInjector, EventEmitter, OnInit } from '@angular/core';
|
|
4
4
|
import { NgModel } from '@angular/forms';
|
|
5
5
|
import { MatDialog } from '@angular/material/dialog';
|
|
6
|
-
import { MatPaginator } from '@angular/material/paginator';
|
|
7
6
|
import { MatTableDataSource } from '@angular/material/table';
|
|
8
7
|
import { Router } from '@angular/router';
|
|
9
8
|
import { BaseEntityType } from '../../classes/entity.model';
|
|
@@ -16,14 +15,24 @@ import { DefaultObjectDecoratorConfigInternal, DropdownObjectDecoratorConfigInte
|
|
|
16
15
|
import { ReferencesOneDecoratorConfigInternal } from '../../decorators/references-one/references-one-decorator-internal.data';
|
|
17
16
|
import { NgxGlobalDefaultValues } from '../../global-configuration-values';
|
|
18
17
|
import { DateUtilities } from '../../utilities/date.utilities';
|
|
19
|
-
import { EntityTab, EntityUtilities } from '../../utilities/entity.utilities';
|
|
18
|
+
import { Difference, EntityTab, EntityUtilities } from '../../utilities/entity.utilities';
|
|
20
19
|
import { SelectionUtilities } from '../../utilities/selection.utilities';
|
|
21
20
|
import { ValidationError } from '../../utilities/validation.utilities';
|
|
21
|
+
import { InternalCustomTableConfiguration } from '../custom-table/custom-table-configuration.model';
|
|
22
22
|
import { CreateDataInternal } from '../table/create-dialog/create-data.builder';
|
|
23
23
|
import { EditActionInternal } from '../table/edit-dialog/edit-data.builder';
|
|
24
24
|
import { DisplayColumn } from '../table/table-data';
|
|
25
25
|
import { BaseTableActionInternal, TableActionInternal } from '../table/table-data.builder';
|
|
26
26
|
import * as i0 from "@angular/core";
|
|
27
|
+
/**
|
|
28
|
+
* Generic type for contexts that can fill an inline template.
|
|
29
|
+
*/
|
|
30
|
+
type TemplateContext<T> = {
|
|
31
|
+
/**
|
|
32
|
+
* The actual value. The $implicit is needed so that we don't need to specify a key when writing "let-context" in the html template.
|
|
33
|
+
*/
|
|
34
|
+
$implicit: T;
|
|
35
|
+
};
|
|
27
36
|
/**
|
|
28
37
|
* A form context that is used to fill an inline template.
|
|
29
38
|
* This is used to go around the limitations of having everything in the same file due to circular dependencies.
|
|
@@ -31,38 +40,64 @@ import * as i0 from "@angular/core";
|
|
|
31
40
|
*/
|
|
32
41
|
type FormContext<EntityType extends BaseEntityType<EntityType>> = {
|
|
33
42
|
/**
|
|
34
|
-
* The
|
|
43
|
+
* The entity to build the form for.
|
|
44
|
+
*/
|
|
45
|
+
entity: EntityType;
|
|
46
|
+
/**
|
|
47
|
+
* The tabs to display.
|
|
48
|
+
*/
|
|
49
|
+
tabs: EntityTab<EntityType>[];
|
|
50
|
+
/**
|
|
51
|
+
* Whether or not edit values should be omitted.
|
|
52
|
+
*/
|
|
53
|
+
hideOmitForEdit?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether or not create values should be omitted.
|
|
56
|
+
*/
|
|
57
|
+
hideOmitForCreate?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* What happens when the input changes.
|
|
35
60
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
inputChangeEvent: () => void | Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Whether or not the input is readonly.
|
|
64
|
+
*/
|
|
65
|
+
isReadOnly?: (property: EntityType, key: keyof EntityType) => boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether or not the input is valid empty.
|
|
68
|
+
*/
|
|
69
|
+
validEmpty?: () => boolean;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A table context that is used to fill an inline template.
|
|
73
|
+
* This is used to go around the limitations of having everything in the same file due to circular dependencies.
|
|
74
|
+
* The table is used for entity array and hasMany.
|
|
75
|
+
*/
|
|
76
|
+
type TableContext<T> = InternalCustomTableConfiguration & {
|
|
77
|
+
/**
|
|
78
|
+
* The data source of the table.
|
|
79
|
+
*/
|
|
80
|
+
dataSource: MatTableDataSource<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Whether or not a error message should be shown when the table is empty.
|
|
83
|
+
*/
|
|
84
|
+
shouldShowMissingError: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The selection of the table.
|
|
87
|
+
*/
|
|
88
|
+
selection: SelectionModel<T>;
|
|
89
|
+
/**
|
|
90
|
+
* What happens when a cell is clicked.
|
|
91
|
+
*/
|
|
92
|
+
clickCell: (value: T, displayColumn: DisplayColumn<T>) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Whether or not the data for the table is currently being loaded.
|
|
95
|
+
*/
|
|
96
|
+
isLoading: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* All columns that should be displayed.
|
|
99
|
+
*/
|
|
100
|
+
displayedColumns: string[];
|
|
66
101
|
};
|
|
67
102
|
/**
|
|
68
103
|
* The default input component. It gets the metadata of the property from the given @Input "entity" and @Input "propertyKey"
|
|
@@ -122,6 +157,12 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
122
157
|
* Emits when the input value has been changed.
|
|
123
158
|
*/
|
|
124
159
|
readonly inputChangeEvent: EventEmitter<void>;
|
|
160
|
+
/**
|
|
161
|
+
* A setter for the has many sort.
|
|
162
|
+
* Is needed because the sort is inside a switch case,
|
|
163
|
+
* which means that at ngOnInit it can't be initialized.
|
|
164
|
+
*/
|
|
165
|
+
private set sort(value);
|
|
125
166
|
/**
|
|
126
167
|
* The type of the decorator for this input.
|
|
127
168
|
*/
|
|
@@ -137,7 +178,7 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
137
178
|
/**
|
|
138
179
|
* The form context for an object property.
|
|
139
180
|
*/
|
|
140
|
-
objectFormContext: FormContext<EntityType
|
|
181
|
+
objectFormContext: TemplateContext<FormContext<EntityType>>;
|
|
141
182
|
/**
|
|
142
183
|
* The metadata of an dropdown object property.
|
|
143
184
|
*/
|
|
@@ -176,9 +217,9 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
176
217
|
*/
|
|
177
218
|
metadataEntityArray: EntityArrayDecoratorConfigInternal<EntityType>;
|
|
178
219
|
/**
|
|
179
|
-
* The entity array
|
|
220
|
+
* The table context for the entity array input.
|
|
180
221
|
*/
|
|
181
|
-
|
|
222
|
+
entityArrayTableContext: TemplateContext<TableContext<EntityType>>;
|
|
182
223
|
/**
|
|
183
224
|
* The current array item to be added or updated.
|
|
184
225
|
*/
|
|
@@ -190,23 +231,11 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
190
231
|
/**
|
|
191
232
|
* The form context for adding an array item.
|
|
192
233
|
*/
|
|
193
|
-
addArrayItemFormContext: FormContext<EntityType
|
|
234
|
+
addArrayItemFormContext: TemplateContext<FormContext<EntityType>>;
|
|
194
235
|
/**
|
|
195
236
|
* The form context for editing an array item.
|
|
196
237
|
*/
|
|
197
|
-
editArrayItemFormContext: FormContext<EntityType
|
|
198
|
-
/**
|
|
199
|
-
* The dataSource for the entity array.
|
|
200
|
-
*/
|
|
201
|
-
entityArrayDataSource: MatTableDataSource<EntityType>;
|
|
202
|
-
/**
|
|
203
|
-
* The selection for the entity array.
|
|
204
|
-
*/
|
|
205
|
-
entityArraySelection: SelectionModel<EntityType>;
|
|
206
|
-
/**
|
|
207
|
-
* The columns to display in the entity array table.
|
|
208
|
-
*/
|
|
209
|
-
entityArrayDisplayedColumns: string[];
|
|
238
|
+
editArrayItemFormContext: TemplateContext<FormContext<EntityType>>;
|
|
210
239
|
/**
|
|
211
240
|
* Whether or not the array item is valid.
|
|
212
241
|
*/
|
|
@@ -231,6 +260,10 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
231
260
|
* All validation errors for the array item.
|
|
232
261
|
*/
|
|
233
262
|
arrayItemValidationErrors: ValidationError[];
|
|
263
|
+
/**
|
|
264
|
+
* All the changes that have been done to the array item.
|
|
265
|
+
*/
|
|
266
|
+
arrayItemChanges: Difference<EntityType>[];
|
|
234
267
|
/**
|
|
235
268
|
* What to display inside the array item tooltip.
|
|
236
269
|
*/
|
|
@@ -240,34 +273,9 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
240
273
|
*/
|
|
241
274
|
metadataHasMany: HasManyDecoratorConfigInternal<EntityType, EntityType>;
|
|
242
275
|
/**
|
|
243
|
-
*
|
|
244
|
-
*/
|
|
245
|
-
hasManyIsLoading: boolean;
|
|
246
|
-
/**
|
|
247
|
-
* A setter for the has many paginator.
|
|
248
|
-
* Is needed because the paginator is inside a switch case,
|
|
249
|
-
* which means that at ngOnInit it can't be initialized.
|
|
250
|
-
*/
|
|
251
|
-
set hasManyPaginator(paginator: MatPaginator);
|
|
252
|
-
/**
|
|
253
|
-
* A setter for the has many sort.
|
|
254
|
-
* Is needed because the sort is inside a switch case,
|
|
255
|
-
* which means that at ngOnInit it can't be initialized.
|
|
256
|
-
*/
|
|
257
|
-
private set hasManySort(value);
|
|
258
|
-
private readonly hasManyFilter;
|
|
259
|
-
/**
|
|
260
|
-
* The columns of the has many table.
|
|
276
|
+
* The table context for the has many input.
|
|
261
277
|
*/
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* The data source of the has many table.
|
|
265
|
-
*/
|
|
266
|
-
hasManyDataSource: MatTableDataSource<EntityType>;
|
|
267
|
-
/**
|
|
268
|
-
* The selection of the has many table.
|
|
269
|
-
*/
|
|
270
|
-
hasManySelection: SelectionModel<EntityType>;
|
|
278
|
+
hasManyTableContext: TemplateContext<TableContext<EntityType>>;
|
|
271
279
|
/**
|
|
272
280
|
* The has many import action.
|
|
273
281
|
*/
|
|
@@ -293,6 +301,10 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
293
301
|
* All validation errors of the has many entity.
|
|
294
302
|
*/
|
|
295
303
|
hasManyValidationErrors: ValidationError[];
|
|
304
|
+
/**
|
|
305
|
+
* All the changes that have been done to the has many entity.
|
|
306
|
+
*/
|
|
307
|
+
hasManyChanges: Difference<EntityType>[];
|
|
296
308
|
/**
|
|
297
309
|
* What to display inside the has many tooltip.
|
|
298
310
|
*/
|
|
@@ -308,11 +320,11 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
308
320
|
/**
|
|
309
321
|
* The form context for creating an has many entity.
|
|
310
322
|
*/
|
|
311
|
-
hasManyCreateFormContext: FormContext<EntityType
|
|
323
|
+
hasManyCreateFormContext: TemplateContext<FormContext<EntityType>>;
|
|
312
324
|
/**
|
|
313
325
|
* The form context for editing an has many entity.
|
|
314
326
|
*/
|
|
315
|
-
hasManyEditFormContext: FormContext<EntityType
|
|
327
|
+
hasManyEditFormContext: TemplateContext<FormContext<EntityType>>;
|
|
316
328
|
private hasManyCreateBaseUrl;
|
|
317
329
|
/**
|
|
318
330
|
* The metadata for a references one property.
|
|
@@ -337,7 +349,7 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
337
349
|
/**
|
|
338
350
|
* The form context for an object property.
|
|
339
351
|
*/
|
|
340
|
-
referencesOneFormContext: FormContext<EntityType
|
|
352
|
+
referencesOneFormContext: TemplateContext<FormContext<EntityType>>;
|
|
341
353
|
/**
|
|
342
354
|
* The enum Values for all the different DecoratorTypes.
|
|
343
355
|
*/
|
|
@@ -381,6 +393,13 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
381
393
|
* @returns The value of the display column.
|
|
382
394
|
*/
|
|
383
395
|
getDisplayColumnValue(entity: EntityType, displayColumn: DisplayColumn<EntityType>): unknown;
|
|
396
|
+
/**
|
|
397
|
+
* Emits a cellClicked event when the clicked column is enabled and clicking is allowed by the configuration.
|
|
398
|
+
* @param value - The value of the row that was clicked.
|
|
399
|
+
* @param dCol - The display column of the row that was clicked.
|
|
400
|
+
* @param context - The context of the table where the cell was clicked.
|
|
401
|
+
*/
|
|
402
|
+
clickCell<T>(value: T, dCol: DisplayColumn<T>, context: TableContext<T>): void;
|
|
384
403
|
ngOnInit(): void;
|
|
385
404
|
private initReferencesOne;
|
|
386
405
|
/**
|
package/components/input/relations/references-many-input/references-many-input.component.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
2
1
|
import { EnvironmentInjector, OnInit } from '@angular/core';
|
|
3
|
-
import { MatTableDataSource } from '@angular/material/table';
|
|
4
2
|
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
5
3
|
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
6
4
|
import { DropdownValue } from '../../../../decorators/base/dropdown-value.interface';
|
|
7
5
|
import { NgxGlobalDefaultValues } from '../../../../global-configuration-values';
|
|
8
|
-
import {
|
|
9
|
-
import { DisplayColumn } from '../../../table/table-data';
|
|
6
|
+
import { CustomTableConfiguration } from '../../../custom-table/custom-table-configuration.model';
|
|
10
7
|
import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
|
|
11
8
|
import * as i0 from "@angular/core";
|
|
12
9
|
export declare class ReferencesManyInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.REFERENCES_MANY, string[]> implements OnInit {
|
|
@@ -17,12 +14,18 @@ export declare class ReferencesManyInputComponent<EntityType extends BaseEntityT
|
|
|
17
14
|
dropdownValues: DropdownValue<string>[];
|
|
18
15
|
filteredDropdownValues: DropdownValue<string>[];
|
|
19
16
|
input: string;
|
|
20
|
-
referencedEntitiesDataSource: MatTableDataSource<string>;
|
|
21
|
-
displayedColumns: string[];
|
|
22
|
-
selection: SelectionModel<string>;
|
|
23
|
-
SelectionUtilities: typeof SelectionUtilities;
|
|
24
17
|
get currentDropdownValue(): DropdownValue<string> | undefined;
|
|
25
18
|
get shouldDisplayCurrentValue(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The currently selected values.
|
|
21
|
+
*/
|
|
22
|
+
selected: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for the references many table.
|
|
25
|
+
*/
|
|
26
|
+
tableConfig: CustomTableConfiguration;
|
|
27
|
+
get propertyValue(): string[];
|
|
28
|
+
set propertyValue(value: string[]);
|
|
26
29
|
constructor(injector: EnvironmentInjector, globalConfig: NgxGlobalDefaultValues);
|
|
27
30
|
ngOnInit(): void;
|
|
28
31
|
/**
|
|
@@ -30,15 +33,7 @@ export declare class ReferencesManyInputComponent<EntityType extends BaseEntityT
|
|
|
30
33
|
* @param searchInput - The search input to filter for.
|
|
31
34
|
*/
|
|
32
35
|
filterDropdownValues(searchInput: string): void;
|
|
33
|
-
|
|
34
|
-
* Gets the value to display in the column.
|
|
35
|
-
* Runs in environment context to enable injection.
|
|
36
|
-
* @param entityId - The id of the entity to get the value from.
|
|
37
|
-
* @param displayColumn - The display column to get the value from.
|
|
38
|
-
* @returns The value of the display column.
|
|
39
|
-
*/
|
|
40
|
-
getDisplayColumnValue(entityId: string, displayColumn: DisplayColumn<EntityType>): unknown;
|
|
41
|
-
add(): Promise<void>;
|
|
36
|
+
add(): void;
|
|
42
37
|
addAll(): void;
|
|
43
38
|
remove(): void;
|
|
44
39
|
static ɵfac: i0.ɵɵFactoryDeclaration<ReferencesManyInputComponent<any>, never>;
|