ngx-material-entity 15.2.4 → 15.2.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.
- package/components/edit-page/edit-data.route.d.ts +13 -0
- package/components/edit-page/edit-page.component.d.ts +3 -12
- package/components/input/input.component.d.ts +36 -1
- package/components/input/number/number-dropdown-input/number-dropdown-input.component.d.ts +4 -1
- package/components/input/string/string-dropdown-input/string-dropdown-input.component.d.ts +4 -1
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +1 -0
- package/components/table/table.component.d.ts +14 -0
- package/decorators/base/decorator-types.enum.d.ts +4 -2
- package/decorators/base/property-decorator-internal.data.d.ts +2 -2
- package/decorators/base/property-decorator.data.d.ts +1 -1
- package/decorators/number/number-decorator-internal.data.d.ts +2 -1
- package/decorators/number/number-decorator.data.d.ts +2 -1
- package/decorators/references-many/references-many-decorator-internal.data.d.ts +8 -0
- package/decorators/references-one/references-one-decorator-internal.data.d.ts +14 -0
- package/decorators/references-one/references-one-decorator.data.d.ts +24 -0
- package/decorators/references-one/references-one.decorator.d.ts +9 -0
- package/decorators/string/string-decorator-internal.data.d.ts +2 -1
- package/decorators/string/string-decorator.data.d.ts +2 -1
- package/esm2020/components/edit-page/edit-data.route.mjs +8 -0
- package/esm2020/components/edit-page/edit-page.component.mjs +11 -11
- package/esm2020/components/input/input.component.mjs +113 -48
- package/esm2020/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +11 -3
- package/esm2020/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +11 -3
- package/esm2020/components/input/string/string-password-input/string-password-input.component.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +11 -6
- package/esm2020/components/table/table.component.mjs +41 -15
- package/esm2020/decorators/base/decorator-types.enum.mjs +2 -1
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +4 -7
- package/esm2020/decorators/base/property-decorator.data.mjs +1 -1
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +10 -2
- package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +2 -1
- package/esm2020/decorators/references-many/references-many-decorator-internal.data.mjs +2 -2
- package/esm2020/decorators/references-one/references-one-decorator-internal.data.mjs +16 -0
- package/esm2020/decorators/references-one/references-one-decorator.data.mjs +2 -0
- package/esm2020/decorators/references-one/references-one.decorator.mjs +13 -0
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +10 -2
- package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
- package/esm2020/public-api.mjs +4 -1
- package/esm2020/utilities/entity.utilities.mjs +18 -6
- package/fesm2015/ngx-material-entity.mjs +280 -95
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +267 -91
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
- package/utilities/entity.utilities.d.ts +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EnvironmentProviders, Provider, Type } from '@angular/core';
|
|
2
|
+
import { DefaultExport, Route } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
/**
|
|
5
|
+
* The definition for a route to use with the "NgxMatEntityEditPageComponent".
|
|
6
|
+
*/
|
|
7
|
+
export interface EditDataRoute extends Route {
|
|
8
|
+
loadComponent: () => Type<unknown> | Observable<Type<unknown> | DefaultExport<Type<unknown>>> | Promise<Type<unknown> | DefaultExport<Type<unknown>>>;
|
|
9
|
+
providers: (Provider | EnvironmentProviders)[];
|
|
10
|
+
title: string;
|
|
11
|
+
path: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const defaultEditDataRoute: Omit<EditDataRoute, 'providers'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Location } from '@angular/common';
|
|
2
|
-
import { EnvironmentInjector,
|
|
2
|
+
import { EnvironmentInjector, InjectionToken, OnInit } from '@angular/core';
|
|
3
3
|
import { MatDialog } from '@angular/material/dialog';
|
|
4
|
-
import { ActivatedRoute
|
|
4
|
+
import { ActivatedRoute } from '@angular/router';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
|
|
7
7
|
import { EntityService } from '../../services/entity.service';
|
|
@@ -12,16 +12,6 @@ import { EditEntityData } from '../table/edit-dialog/edit-entity-data';
|
|
|
12
12
|
import { EditData } from '../table/table-data';
|
|
13
13
|
import { PageEditDataInternal } from './page-edit-data.builder';
|
|
14
14
|
import * as i0 from "@angular/core";
|
|
15
|
-
/**
|
|
16
|
-
* The definition for a route to use with the "NgxMatEntityEditPageComponent".
|
|
17
|
-
*/
|
|
18
|
-
export interface EditDataRoute extends Route {
|
|
19
|
-
loadComponent: () => Type<unknown> | Observable<Type<unknown> | DefaultExport<Type<unknown>>> | Promise<Type<unknown> | DefaultExport<Type<unknown>>>;
|
|
20
|
-
providers: (Provider | EnvironmentProviders)[];
|
|
21
|
-
title: string;
|
|
22
|
-
path: string;
|
|
23
|
-
}
|
|
24
|
-
export declare const defaultEditDataRoute: Omit<EditDataRoute, 'providers'>;
|
|
25
15
|
/**
|
|
26
16
|
* The data that needs to be provided for a route to be able to edit a entity.
|
|
27
17
|
*/
|
|
@@ -80,6 +70,7 @@ export declare class NgxMatEntityEditPageComponent<EntityType extends BaseEntity
|
|
|
80
70
|
isEntityValid: boolean;
|
|
81
71
|
isEntityDirty: boolean;
|
|
82
72
|
isEntityReadOnly: boolean;
|
|
73
|
+
allowDelete: boolean;
|
|
83
74
|
private inConfirmNavigation;
|
|
84
75
|
get hasUnsavedChanges(): boolean;
|
|
85
76
|
constructor(dialog: MatDialog, location: Location, route: ActivatedRoute, injector: EnvironmentInjector, entityService: EntityService<EntityType>, EntityClass: EntityClassNewable<EntityType>, inputData: PageEditData<EntityType>);
|
|
@@ -9,9 +9,11 @@ import { Router } from '@angular/router';
|
|
|
9
9
|
import { BaseEntityType } from '../../classes/entity.model';
|
|
10
10
|
import { EditArrayItemDialogDataInternal, EntityArrayDecoratorConfigInternal } from '../../decorators/array/array-decorator-internal.data';
|
|
11
11
|
import { DecoratorTypes } from '../../decorators/base/decorator-types.enum';
|
|
12
|
+
import { DropdownValue } from '../../decorators/base/dropdown-value.interface';
|
|
12
13
|
import { PropertyDecoratorConfigInternal } from '../../decorators/base/property-decorator-internal.data';
|
|
13
14
|
import { HasManyDecoratorConfigInternal } from '../../decorators/has-many/has-many-decorator-internal.data';
|
|
14
15
|
import { DefaultObjectDecoratorConfigInternal } from '../../decorators/object/object-decorator-internal.data';
|
|
16
|
+
import { ReferencesOneDecoratorConfigInternal } from '../../decorators/references-one/references-one-decorator-internal.data';
|
|
15
17
|
import { DateUtilities } from '../../utilities/date.utilities';
|
|
16
18
|
import { EntityTab, EntityUtilities } from '../../utilities/entity.utilities';
|
|
17
19
|
import { SelectionUtilities } from '../../utilities/selection.utilities';
|
|
@@ -119,9 +121,16 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
119
121
|
hasManyEntityPriorChanges: EntityType;
|
|
120
122
|
isHasManyEntityValid: boolean;
|
|
121
123
|
isHasManyEntityDirty: boolean;
|
|
124
|
+
hasManyAllowCreate: boolean;
|
|
122
125
|
hasManyCreateTabs: EntityTab<EntityType>[];
|
|
123
126
|
hasManyUpdateTabs: EntityTab<EntityType>[];
|
|
124
|
-
private
|
|
127
|
+
private hasManyCreateBaseUrl;
|
|
128
|
+
metadataReferencesOne: ReferencesOneDecoratorConfigInternal<EntityType>;
|
|
129
|
+
referencesOneInput: string;
|
|
130
|
+
referencesOneObject: EntityType;
|
|
131
|
+
referencesOnePropertyTabs: EntityTab<EntityType>[];
|
|
132
|
+
referencesOneAllReferencedEntities: EntityType[];
|
|
133
|
+
referencesOneDropdownValues: DropdownValue<string>[];
|
|
125
134
|
readonly DecoratorTypes: typeof DecoratorTypes;
|
|
126
135
|
EntityUtilities: typeof EntityUtilities;
|
|
127
136
|
DateUtilities: typeof DateUtilities;
|
|
@@ -152,11 +161,16 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
152
161
|
*/
|
|
153
162
|
getDisplayColumnValue(entity: EntityType, displayColumn: DisplayColumn<EntityType>): unknown;
|
|
154
163
|
ngOnInit(): void;
|
|
164
|
+
private initReferencesOne;
|
|
155
165
|
private initHasMany;
|
|
156
166
|
private initEntityArray;
|
|
157
167
|
private initObjectInput;
|
|
158
168
|
private startImportJson;
|
|
159
169
|
private importJson;
|
|
170
|
+
/**
|
|
171
|
+
* Sets the references one object using the input id.
|
|
172
|
+
*/
|
|
173
|
+
setReferencesOneObject(): void;
|
|
160
174
|
/**
|
|
161
175
|
* Edits an entity. This either calls the edit-Method provided by the user or uses a default edit-dialog.
|
|
162
176
|
*
|
|
@@ -164,6 +178,27 @@ export declare class NgxMatEntityInputComponent<EntityType extends BaseEntityTyp
|
|
|
164
178
|
* @throws When no EntityClass was provided, as a new call is needed to initialize metadata.
|
|
165
179
|
*/
|
|
166
180
|
editHasManyEntity(entity: EntityType): void;
|
|
181
|
+
/**
|
|
182
|
+
* Whether updating the provided entity from the has many property is allowed.
|
|
183
|
+
*
|
|
184
|
+
* @param entity - A single value of the has many property that the user wants to edit.
|
|
185
|
+
* @returns True when the user can edit the provided entity and false otherwise.
|
|
186
|
+
*/
|
|
187
|
+
hasManyAllowUpdate(entity: EntityType): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether viewing the provided entity from the has many property is allowed.
|
|
190
|
+
*
|
|
191
|
+
* @param entity - A single value of the has many property that the user wants to view.
|
|
192
|
+
* @returns True when the user can view the provided entity and false otherwise.
|
|
193
|
+
*/
|
|
194
|
+
hasManyAllowRead(entity: EntityType): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Whether deleting the provided entity from the has many property is allowed.
|
|
197
|
+
*
|
|
198
|
+
* @param entity - A single value of the has many property that the user wants to delete.
|
|
199
|
+
* @returns True when the user can delete the provided entity and false otherwise.
|
|
200
|
+
*/
|
|
201
|
+
hasManyAllowDelete(entity: EntityType): boolean;
|
|
167
202
|
private editHasManyDefaultPage;
|
|
168
203
|
private editHasManyDefaultDialog;
|
|
169
204
|
/**
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
-
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
3
2
|
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
3
|
+
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
4
|
+
import { DropdownValue } from '../../../../decorators/base/dropdown-value.interface';
|
|
4
5
|
import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class NumberDropdownInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.NUMBER_DROPDOWN, number> implements OnInit {
|
|
8
|
+
dropdownValues: DropdownValue<number | undefined>[];
|
|
9
|
+
ngOnInit(): Promise<void>;
|
|
7
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<NumberDropdownInputComponent<any>, never>;
|
|
8
11
|
static ɵcmp: i0.ɵɵComponentDeclaration<NumberDropdownInputComponent<any>, "number-dropdown-input", never, {}, {}, never, never, false, never>;
|
|
9
12
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
-
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
3
2
|
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
3
|
+
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
4
|
+
import { DropdownValue } from '../../../../decorators/base/dropdown-value.interface';
|
|
4
5
|
import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class StringDropdownInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.STRING_DROPDOWN, string> implements OnInit {
|
|
8
|
+
dropdownValues: DropdownValue<string | undefined>[];
|
|
9
|
+
ngOnInit(): Promise<void>;
|
|
7
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<StringDropdownInputComponent<any>, never>;
|
|
8
11
|
static ɵcmp: i0.ɵɵComponentDeclaration<StringDropdownInputComponent<any>, "string-dropdown-input", never, {}, {}, never, never, false, never>;
|
|
9
12
|
}
|
|
@@ -26,6 +26,7 @@ export declare class NgxMatEntityEditDialogComponent<EntityType extends BaseEnti
|
|
|
26
26
|
isEntityValid: boolean;
|
|
27
27
|
isEntityDirty: boolean;
|
|
28
28
|
isEntityReadOnly: boolean;
|
|
29
|
+
allowDelete: boolean;
|
|
29
30
|
constructor(inputData: EditEntityData<EntityType>, dialogRef: MatDialogRef<NgxMatEntityEditDialogComponent<EntityType>>, injector: EnvironmentInjector, dialog: MatDialog);
|
|
30
31
|
ngOnInit(): void;
|
|
31
32
|
/**
|
|
@@ -61,6 +61,20 @@ export declare class NgxMatEntityTableComponent<EntityType extends BaseEntityTyp
|
|
|
61
61
|
* @throws When no EntityClass was provided, as a new call is needed to initialize metadata.
|
|
62
62
|
*/
|
|
63
63
|
editEntity(entity: EntityType, dCol: DisplayColumn<EntityType>): void;
|
|
64
|
+
/**
|
|
65
|
+
* Whether updating the provided entity is allowed.
|
|
66
|
+
*
|
|
67
|
+
* @param entity - The entity that the user wants to edit.
|
|
68
|
+
* @returns True when the user can edit the provided entity and false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
allowUpdate(entity: EntityType): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether viewing the provided entity is allowed.
|
|
73
|
+
*
|
|
74
|
+
* @param entity - The entity that the user wants to view.
|
|
75
|
+
* @returns True when the user can view the provided entity and false otherwise.
|
|
76
|
+
*/
|
|
77
|
+
allowRead(entity: EntityType): boolean;
|
|
64
78
|
private editDefaultPage;
|
|
65
79
|
private editDefaultDialog;
|
|
66
80
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutocompleteStringChipsArrayDecoratorConfigInternal,
|
|
1
|
+
import { AutocompleteStringChipsArrayDecoratorConfigInternal, DateArrayDecoratorConfigInternal, DateRangeArrayDecoratorConfigInternal, DateTimeArrayDecoratorConfigInternal, EntityArrayDecoratorConfigInternal, StringChipsArrayDecoratorConfigInternal } from '../array/array-decorator-internal.data';
|
|
2
2
|
import { CheckboxBooleanDecoratorConfigInternal, DropdownBooleanDecoratorConfigInternal, ToggleBooleanDecoratorConfigInternal } from '../boolean/boolean-decorator-internal.data';
|
|
3
3
|
import { CustomDecoratorConfigInternal } from '../custom/custom-decorator-internal.data';
|
|
4
4
|
import { DateRangeDateDecoratorConfigInternal, DateTimeDateDecoratorConfigInternal, DefaultDateDecoratorConfigInternal } from '../date/date-decorator-internal.data';
|
|
@@ -7,6 +7,7 @@ import { HasManyDecoratorConfigInternal } from '../has-many/has-many-decorator-i
|
|
|
7
7
|
import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInternal, SliderNumberDecoratorConfigInternal } from '../number/number-decorator-internal.data';
|
|
8
8
|
import { DefaultObjectDecoratorConfigInternal } from '../object/object-decorator-internal.data';
|
|
9
9
|
import { ReferencesManyDecoratorConfigInternal } from '../references-many/references-many-decorator-internal.data';
|
|
10
|
+
import { ReferencesOneDecoratorConfigInternal } from '../references-one/references-one-decorator-internal.data';
|
|
10
11
|
import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, PasswordStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../string/string-decorator-internal.data';
|
|
11
12
|
/**
|
|
12
13
|
* The enum Values for all the different DecoratorTypes.
|
|
@@ -36,10 +37,11 @@ export declare enum DecoratorTypes {
|
|
|
36
37
|
FILE_DEFAULT = "fileDefault",
|
|
37
38
|
FILE_IMAGE = "fileImage",
|
|
38
39
|
REFERENCES_MANY = "referencesMany",
|
|
40
|
+
REFERENCES_ONE = "referencesOne",
|
|
39
41
|
HAS_MANY = "hasMany",
|
|
40
42
|
CUSTOM = "custom"
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Gives the metadata-config Type based on the DecoratorTypes enum.
|
|
44
46
|
*/
|
|
45
|
-
export declare type DecoratorType<T, CustomMetadataType extends Record<string, unknown>> = T extends DecoratorTypes.STRING ? DefaultStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_TEXTBOX ? TextboxStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_DROPDOWN ? DropdownStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_AUTOCOMPLETE ? AutocompleteStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_PASSWORD ? PasswordStringDecoratorConfigInternal : T extends DecoratorTypes.NUMBER ? DefaultNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_DROPDOWN ? DropdownNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_SLIDER ? SliderNumberDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_CHECKBOX ? CheckboxBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_TOGGLE ? ToggleBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_DROPDOWN ? DropdownBooleanDecoratorConfigInternal : T extends DecoratorTypes.OBJECT ? DefaultObjectDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY ? EntityArrayDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY_DATE ? DateArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_TIME ? DateTimeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_RANGE ? DateRangeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_CHIPS ? StringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS ? AutocompleteStringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.DATE ? DefaultDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_RANGE ? DateRangeDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_TIME ? DateTimeDateDecoratorConfigInternal : T extends DecoratorTypes.FILE_DEFAULT ? DefaultFileDecoratorConfigInternal : T extends DecoratorTypes.FILE_IMAGE ? ImageFileDecoratorConfigInternal : T extends DecoratorTypes.REFERENCES_MANY ? ReferencesManyDecoratorConfigInternal<any> : T extends DecoratorTypes.HAS_MANY ? HasManyDecoratorConfigInternal<any, any> : T extends DecoratorTypes.CUSTOM ? CustomDecoratorConfigInternal<any, any, CustomMetadataType, any> : never;
|
|
47
|
+
export declare type DecoratorType<T, CustomMetadataType extends Record<string, unknown>> = T extends DecoratorTypes.STRING ? DefaultStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_TEXTBOX ? TextboxStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_DROPDOWN ? DropdownStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_AUTOCOMPLETE ? AutocompleteStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_PASSWORD ? PasswordStringDecoratorConfigInternal : T extends DecoratorTypes.NUMBER ? DefaultNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_DROPDOWN ? DropdownNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_SLIDER ? SliderNumberDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_CHECKBOX ? CheckboxBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_TOGGLE ? ToggleBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_DROPDOWN ? DropdownBooleanDecoratorConfigInternal : T extends DecoratorTypes.OBJECT ? DefaultObjectDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY ? EntityArrayDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY_DATE ? DateArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_TIME ? DateTimeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_RANGE ? DateRangeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_CHIPS ? StringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS ? AutocompleteStringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.DATE ? DefaultDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_RANGE ? DateRangeDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_TIME ? DateTimeDateDecoratorConfigInternal : T extends DecoratorTypes.FILE_DEFAULT ? DefaultFileDecoratorConfigInternal : T extends DecoratorTypes.FILE_IMAGE ? ImageFileDecoratorConfigInternal : T extends DecoratorTypes.REFERENCES_MANY ? ReferencesManyDecoratorConfigInternal<any> : T extends DecoratorTypes.REFERENCES_ONE ? ReferencesOneDecoratorConfigInternal<any> : T extends DecoratorTypes.HAS_MANY ? HasManyDecoratorConfigInternal<any, any> : T extends DecoratorTypes.CUSTOM ? CustomDecoratorConfigInternal<any, any, CustomMetadataType, any> : never;
|
|
@@ -14,7 +14,7 @@ declare class PositionInternal implements Position {
|
|
|
14
14
|
* The internal PropertyDecoratorConfig. Sets default values.
|
|
15
15
|
*/
|
|
16
16
|
export declare abstract class PropertyDecoratorConfigInternal implements PropertyDecoratorConfig {
|
|
17
|
-
display: boolean;
|
|
17
|
+
display: (entity: any) => boolean;
|
|
18
18
|
displayName: string;
|
|
19
19
|
required: boolean;
|
|
20
20
|
omitForCreate: boolean;
|
|
@@ -23,6 +23,6 @@ export declare abstract class PropertyDecoratorConfigInternal implements Propert
|
|
|
23
23
|
position: PositionInternal;
|
|
24
24
|
isReadOnly: (entity: any) => boolean;
|
|
25
25
|
constructor(data: PropertyDecoratorConfig);
|
|
26
|
-
private
|
|
26
|
+
private booleanToFunction;
|
|
27
27
|
}
|
|
28
28
|
export {};
|
|
@@ -15,8 +15,9 @@ export declare class DefaultNumberDecoratorConfigInternal extends PropertyDecora
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DropdownNumberDecoratorConfig {
|
|
17
17
|
displayStyle: 'dropdown';
|
|
18
|
-
dropdownValues: DropdownValue<number | undefined>[];
|
|
18
|
+
dropdownValues: ((entity: any) => Promise<DropdownValue<number | undefined>[]>);
|
|
19
19
|
constructor(data: DropdownNumberDecoratorConfig);
|
|
20
|
+
private dropdownValuesToFunction;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* The internal SliderNumberDecoratorConfig. Sets default values.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
2
2
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
3
|
+
export declare type NumberDropdownValues = DropdownValue<number | undefined>[] | ((entity: any) => DropdownValue<number | undefined>[]) | ((entity: any) => Promise<DropdownValue<number | undefined>[]>);
|
|
3
4
|
/**
|
|
4
5
|
* Definition for the @number metadata.
|
|
5
6
|
*/
|
|
@@ -31,7 +32,7 @@ export interface DropdownNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
|
31
32
|
/**
|
|
32
33
|
* The values of the dropdown, consisting of a name to display and the actual value.
|
|
33
34
|
*/
|
|
34
|
-
dropdownValues:
|
|
35
|
+
dropdownValues: NumberDropdownValues;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* The configuration options for a number property displayed as a slider input.
|
|
@@ -18,3 +18,11 @@ export declare class ReferencesManyDecoratorConfigInternal<EntityType extends Ba
|
|
|
18
18
|
addAllButtonLabel: string;
|
|
19
19
|
constructor(data: ReferencesManyDecoratorConfig<EntityType>);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The default function to use when trying to get the referenced entity for the given id.
|
|
23
|
+
*
|
|
24
|
+
* @param entityId - The id of the referenced entity.
|
|
25
|
+
* @param allReferencedEntities - All referenced entities.
|
|
26
|
+
* @returns The entity that has the given id.
|
|
27
|
+
*/
|
|
28
|
+
export declare function defaultGetEntityForId<EntityType extends BaseEntityType<EntityType>>(entityId: string, allReferencedEntities: EntityType[]): EntityType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
|
|
2
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
3
|
+
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
4
|
+
import { ReferencesOneDecoratorConfig } from './references-one-decorator.data';
|
|
5
|
+
/**
|
|
6
|
+
* The internal DefaultNumberDecoratorConfig. Sets default values.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ReferencesOneDecoratorConfigInternal<EntityType extends BaseEntityType<EntityType>> extends PropertyDecoratorConfigInternal implements ReferencesOneDecoratorConfig<EntityType> {
|
|
9
|
+
getReferencedEntities: () => Promise<EntityType[]>;
|
|
10
|
+
getDropdownValues: (referencedEntities: EntityType[]) => DropdownValue<string>[];
|
|
11
|
+
getEntityForId: (entityId: string, allReferencedEntities: EntityType[]) => EntityType;
|
|
12
|
+
EntityClass: EntityClassNewable<EntityType>;
|
|
13
|
+
constructor(data: ReferencesOneDecoratorConfig<EntityType>);
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
|
|
2
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
3
|
+
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
4
|
+
/**
|
|
5
|
+
* Definition for the @referencesOne metadata.
|
|
6
|
+
*/
|
|
7
|
+
export interface ReferencesOneDecoratorConfig<EntityType extends BaseEntityType<EntityType>> extends PropertyDecoratorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The function that returns the values that can be possibly referenced.
|
|
10
|
+
*/
|
|
11
|
+
getReferencedEntities: () => Promise<EntityType[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Method to filter or add dropdown options eg, for an empty value.
|
|
14
|
+
*/
|
|
15
|
+
getDropdownValues: (referencedEntities: EntityType[]) => DropdownValue<string>[];
|
|
16
|
+
/**
|
|
17
|
+
* Gets the referenced entity for the given id.
|
|
18
|
+
*/
|
|
19
|
+
getEntityForId?: (entityId: string, allReferencedEntities: EntityType[]) => EntityType;
|
|
20
|
+
/**
|
|
21
|
+
* The class of the entity that gets referenced.
|
|
22
|
+
*/
|
|
23
|
+
EntityClass: EntityClassNewable<EntityType>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEntityType } from '../../classes/entity.model';
|
|
2
|
+
import { ReferencesOneDecoratorConfig } from './references-one-decorator.data';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for setting and getting references one property metadata.
|
|
5
|
+
*
|
|
6
|
+
* @param metadata - The metadata of the references one property.
|
|
7
|
+
* @returns The method that defines the metadata.
|
|
8
|
+
*/
|
|
9
|
+
export declare function referencesOne<EntityType extends BaseEntityType<EntityType>>(metadata: ReferencesOneDecoratorConfig<EntityType>): (target: object, propertyKey: string) => void;
|
|
@@ -6,8 +6,9 @@ import { AutocompleteStringDecoratorConfig, DefaultStringDecoratorConfig, Dropdo
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DropdownStringDecoratorConfig {
|
|
8
8
|
displayStyle: 'dropdown';
|
|
9
|
-
dropdownValues: DropdownValue<string | undefined>[];
|
|
9
|
+
dropdownValues: ((entity: any) => Promise<DropdownValue<string | undefined>[]>);
|
|
10
10
|
constructor(data: DropdownStringDecoratorConfig);
|
|
11
|
+
private dropdownValuesToFunction;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* The internal DefaultStringDecoratorConfig. Sets default values.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
2
2
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
3
|
+
export declare type StringDropdownValues = DropdownValue<string | undefined>[] | ((entity: any) => DropdownValue<string | undefined>[]) | ((entity: any) => Promise<DropdownValue<string | undefined>[]>);
|
|
3
4
|
/**
|
|
4
5
|
* Definition for the @string metadata.
|
|
5
6
|
*/
|
|
@@ -18,7 +19,7 @@ export interface DropdownStringDecoratorConfig extends StringDecoratorConfig {
|
|
|
18
19
|
* The values of the dropdown, consisting of a name to display and the actual value
|
|
19
20
|
* Can also receive a function to determine the values.
|
|
20
21
|
*/
|
|
21
|
-
dropdownValues:
|
|
22
|
+
dropdownValues: StringDropdownValues;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* The configuration options for a string property displayed in a default text input.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UnsavedChangesGuard } from '../../services/unsaved-changes.guard';
|
|
2
|
+
export const defaultEditDataRoute = {
|
|
3
|
+
loadComponent: () => import('./edit-page.component').then(m => m.NgxMatEntityEditPageComponent),
|
|
4
|
+
title: 'Edit',
|
|
5
|
+
path: 'entities:id',
|
|
6
|
+
canDeactivate: [UnsavedChangesGuard]
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWRpdC1kYXRhLnJvdXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hdGVyaWFsLWVudGl0eS9zcmMvY29tcG9uZW50cy9lZGl0LXBhZ2UvZWRpdC1kYXRhLnJvdXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBZ0IzRSxNQUFNLENBQUMsTUFBTSxvQkFBb0IsR0FBcUM7SUFDbEUsYUFBYSxFQUFFLEdBQUcsRUFBRSxDQUFDLE1BQU0sQ0FBQyx1QkFBdUIsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyw2QkFBNkIsQ0FBQztJQUMvRixLQUFLLEVBQUUsTUFBTTtJQUNiLElBQUksRUFBRSxhQUFhO0lBQ25CLGFBQWEsRUFBRSxDQUFDLG1CQUFtQixDQUFDO0NBQ3ZDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBFbnZpcm9ubWVudFByb3ZpZGVycywgUHJvdmlkZXIsIFR5cGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IERlZmF1bHRFeHBvcnQsIFJvdXRlIH0gZnJvbSAnQGFuZ3VsYXIvcm91dGVyJztcbmltcG9ydCB7IE9ic2VydmFibGUgfSBmcm9tICdyeGpzJztcbmltcG9ydCB7IFVuc2F2ZWRDaGFuZ2VzR3VhcmQgfSBmcm9tICcuLi8uLi9zZXJ2aWNlcy91bnNhdmVkLWNoYW5nZXMuZ3VhcmQnO1xuXG4vKipcbiAqIFRoZSBkZWZpbml0aW9uIGZvciBhIHJvdXRlIHRvIHVzZSB3aXRoIHRoZSBcIk5neE1hdEVudGl0eUVkaXRQYWdlQ29tcG9uZW50XCIuXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgRWRpdERhdGFSb3V0ZSBleHRlbmRzIFJvdXRlIHtcbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbWF4LWxlbiwganNkb2MvcmVxdWlyZS1qc2RvY1xuICAgIGxvYWRDb21wb25lbnQ6ICgpID0+IFR5cGU8dW5rbm93bj4gfCBPYnNlcnZhYmxlPFR5cGU8dW5rbm93bj4gfCBEZWZhdWx0RXhwb3J0PFR5cGU8dW5rbm93bj4+PiB8IFByb21pc2U8VHlwZTx1bmtub3duPiB8IERlZmF1bHRFeHBvcnQ8VHlwZTx1bmtub3duPj4+LFxuICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBqc2RvYy9yZXF1aXJlLWpzZG9jXG4gICAgcHJvdmlkZXJzOiAoUHJvdmlkZXIgfCBFbnZpcm9ubWVudFByb3ZpZGVycylbXSxcbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUganNkb2MvcmVxdWlyZS1qc2RvY1xuICAgIHRpdGxlOiBzdHJpbmcsXG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIGpzZG9jL3JlcXVpcmUtanNkb2NcbiAgICBwYXRoOiBzdHJpbmdcbn1cblxuZXhwb3J0IGNvbnN0IGRlZmF1bHRFZGl0RGF0YVJvdXRlOiBPbWl0PEVkaXREYXRhUm91dGUsICdwcm92aWRlcnMnPiA9IHtcbiAgICBsb2FkQ29tcG9uZW50OiAoKSA9PiBpbXBvcnQoJy4vZWRpdC1wYWdlLmNvbXBvbmVudCcpLnRoZW4obSA9PiBtLk5neE1hdEVudGl0eUVkaXRQYWdlQ29tcG9uZW50KSxcbiAgICB0aXRsZTogJ0VkaXQnLFxuICAgIHBhdGg6ICdlbnRpdGllczppZCcsXG4gICAgY2FuRGVhY3RpdmF0ZTogW1Vuc2F2ZWRDaGFuZ2VzR3VhcmRdXG59OyJdfQ==
|