ngx-material-entity 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/components/input/input.module.d.ts +20 -19
- package/components/input/relations/references-many-input/references-many-input.component.d.ts +27 -0
- package/decorators/array/array-decorator-internal.data.d.ts +10 -10
- package/decorators/array/array-decorator.data.d.ts +5 -18
- package/decorators/base/decorator-types.enum.d.ts +3 -1
- package/decorators/references-many/references-many-decorator-internal.data.d.ts +20 -0
- package/decorators/references-many/references-many-decorator.data.d.ts +56 -0
- package/decorators/references-many/references-many.decorator.d.ts +9 -0
- package/esm2020/classes/entity.utilities.mjs +3 -1
- package/esm2020/components/input/input.component.mjs +5 -4
- package/esm2020/components/input/input.module.mjs +4 -1
- package/esm2020/components/input/relations/references-many-input/references-many-input.component.mjs +86 -0
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +2 -2
- package/esm2020/decorators/array/array-decorator.data.mjs +1 -1
- package/esm2020/decorators/base/decorator-types.enum.mjs +2 -1
- package/esm2020/decorators/references-many/references-many-decorator-internal.data.mjs +30 -0
- package/esm2020/decorators/references-many/references-many-decorator.data.mjs +2 -0
- package/esm2020/decorators/references-many/references-many.decorator.mjs +13 -0
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/ngx-material-entity.mjs +160 -34
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +149 -34
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
package/README.md
CHANGED
|
@@ -562,7 +562,7 @@ export interface EntityArrayDecoratorConfig<EntityType extends object> extends A
|
|
|
562
562
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
563
563
|
* and the value, which is a function that generates the value to display inside a column.
|
|
564
564
|
*/
|
|
565
|
-
displayColumns:
|
|
565
|
+
displayColumns: DisplayColumn<EntityType>[],
|
|
566
566
|
|
|
567
567
|
/**
|
|
568
568
|
* The data for the add-item-dialog.
|
|
@@ -675,7 +675,7 @@ export interface DateArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
|
675
675
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
676
676
|
* and the value, which is a function that generates the value to display inside a column.
|
|
677
677
|
*/
|
|
678
|
-
displayColumns:
|
|
678
|
+
displayColumns: DisplayColumn<Date>[],
|
|
679
679
|
|
|
680
680
|
/**
|
|
681
681
|
* The label for the add button.
|
|
@@ -725,7 +725,7 @@ export interface DateTimeArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
|
725
725
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
726
726
|
* and the value, which is a function that generates the value to display inside a column.
|
|
727
727
|
*/
|
|
728
|
-
displayColumns:
|
|
728
|
+
displayColumns: DisplayColumn<Date>[],
|
|
729
729
|
|
|
730
730
|
/**
|
|
731
731
|
* The label for the add button.
|
|
@@ -802,7 +802,7 @@ export interface DateRangeArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
|
802
802
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
803
803
|
* and the value, which is a function that generates the value to display inside a column.
|
|
804
804
|
*/
|
|
805
|
-
displayColumns:
|
|
805
|
+
displayColumns: DisplayColumn<DateRange>[],
|
|
806
806
|
|
|
807
807
|
/**
|
|
808
808
|
* The label for the add button.
|
|
@@ -22,26 +22,27 @@ import * as i20 from "./file/file-input/file-input.component";
|
|
|
22
22
|
import * as i21 from "./file/file-image-input/file-image-input.component";
|
|
23
23
|
import * as i22 from "./file/file-default-input/file-default-input.component";
|
|
24
24
|
import * as i23 from "./file/file-input/dragDrop.directive";
|
|
25
|
-
import * as i24 from "./
|
|
26
|
-
import * as i25 from "./
|
|
27
|
-
import * as i26 from "
|
|
28
|
-
import * as i27 from "@angular/
|
|
29
|
-
import * as i28 from "@angular/
|
|
30
|
-
import * as i29 from "@angular/
|
|
31
|
-
import * as i30 from "@angular/material/
|
|
32
|
-
import * as i31 from "@angular/material/
|
|
33
|
-
import * as i32 from "@angular/material/
|
|
34
|
-
import * as i33 from "@angular/material/
|
|
35
|
-
import * as i34 from "@angular/material/
|
|
36
|
-
import * as i35 from "@angular/material/
|
|
37
|
-
import * as i36 from "@angular/material/
|
|
38
|
-
import * as i37 from "@angular/material/
|
|
39
|
-
import * as i38 from "@angular/material/
|
|
40
|
-
import * as i39 from "@angular/material/
|
|
41
|
-
import * as i40 from "@angular/material/
|
|
42
|
-
import * as i41 from "@angular/material/
|
|
25
|
+
import * as i24 from "./relations/references-many-input/references-many-input.component";
|
|
26
|
+
import * as i25 from "./custom/custom.component";
|
|
27
|
+
import * as i26 from "./input.component";
|
|
28
|
+
import * as i27 from "@angular/common";
|
|
29
|
+
import * as i28 from "@angular/material/input";
|
|
30
|
+
import * as i29 from "@angular/forms";
|
|
31
|
+
import * as i30 from "@angular/material/form-field";
|
|
32
|
+
import * as i31 from "@angular/material/select";
|
|
33
|
+
import * as i32 from "@angular/material/autocomplete";
|
|
34
|
+
import * as i33 from "@angular/material/checkbox";
|
|
35
|
+
import * as i34 from "@angular/material/slide-toggle";
|
|
36
|
+
import * as i35 from "@angular/material/chips";
|
|
37
|
+
import * as i36 from "@angular/material/icon";
|
|
38
|
+
import * as i37 from "@angular/material/table";
|
|
39
|
+
import * as i38 from "@angular/material/dialog";
|
|
40
|
+
import * as i39 from "@angular/material/button";
|
|
41
|
+
import * as i40 from "@angular/material/datepicker";
|
|
42
|
+
import * as i41 from "@angular/material/slider";
|
|
43
|
+
import * as i42 from "@angular/material/tabs";
|
|
43
44
|
export declare class NgxMatEntityInputModule {
|
|
44
45
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityInputModule, never>;
|
|
45
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxMatEntityInputModule, [typeof i1.StringInputComponent, typeof i2.StringTextboxInputComponent, typeof i3.StringAutocompleteInputComponent, typeof i4.StringDropdownInputComponent, typeof i5.StringPasswordInputComponent, typeof i6.BooleanCheckboxInputComponent, typeof i7.BooleanToggleInputComponent, typeof i8.BooleanDropdownInputComponent, typeof i9.NumberInputComponent, typeof i10.NumberDropdownInputComponent, typeof i11.NumberSliderInputComponent, typeof i12.ArrayStringChipsInputComponent, typeof i13.ArrayStringAutocompleteChipsComponent, typeof i14.DateInputComponent, typeof i15.DateRangeInputComponent, typeof i16.DateTimeInputComponent, typeof i17.ArrayDateInputComponent, typeof i18.ArrayDateTimeInputComponent, typeof i19.ArrayDateRangeInputComponent, typeof i20.FileInputComponent, typeof i21.FileImageInputComponent, typeof i22.FileDefaultInputComponent, typeof i23.DragDropDirective, typeof i24.
|
|
46
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxMatEntityInputModule, [typeof i1.StringInputComponent, typeof i2.StringTextboxInputComponent, typeof i3.StringAutocompleteInputComponent, typeof i4.StringDropdownInputComponent, typeof i5.StringPasswordInputComponent, typeof i6.BooleanCheckboxInputComponent, typeof i7.BooleanToggleInputComponent, typeof i8.BooleanDropdownInputComponent, typeof i9.NumberInputComponent, typeof i10.NumberDropdownInputComponent, typeof i11.NumberSliderInputComponent, typeof i12.ArrayStringChipsInputComponent, typeof i13.ArrayStringAutocompleteChipsComponent, typeof i14.DateInputComponent, typeof i15.DateRangeInputComponent, typeof i16.DateTimeInputComponent, typeof i17.ArrayDateInputComponent, typeof i18.ArrayDateTimeInputComponent, typeof i19.ArrayDateRangeInputComponent, typeof i20.FileInputComponent, typeof i21.FileImageInputComponent, typeof i22.FileDefaultInputComponent, typeof i23.DragDropDirective, typeof i24.ReferencesManyInputComponent, typeof i25.CustomInputComponent, typeof i26.NgxMatEntityInputComponent], [typeof i27.CommonModule, typeof i28.MatInputModule, typeof i29.FormsModule, typeof i30.MatFormFieldModule, typeof i31.MatSelectModule, typeof i32.MatAutocompleteModule, typeof i33.MatCheckboxModule, typeof i34.MatSlideToggleModule, typeof i35.MatChipsModule, typeof i36.MatIconModule, typeof i37.MatTableModule, typeof i38.MatDialogModule, typeof i39.MatButtonModule, typeof i40.MatDatepickerModule, typeof i41.MatSliderModule, typeof i42.MatTabsModule], [typeof i26.NgxMatEntityInputComponent]>;
|
|
46
47
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgxMatEntityInputModule>;
|
|
47
48
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
2
|
+
import { EnvironmentInjector, OnInit } from '@angular/core';
|
|
3
|
+
import { MatTableDataSource } from '@angular/material/table';
|
|
4
|
+
import { BaseEntityType } from '../../../../classes/entity.model';
|
|
5
|
+
import { SelectionUtilities } from '../../../../classes/selection.utilities';
|
|
6
|
+
import { DecoratorTypes } from '../../../../decorators/base/decorator-types.enum';
|
|
7
|
+
import { DropdownValue } from '../../../../decorators/base/dropdown-value.interface';
|
|
8
|
+
import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export declare class ReferencesManyInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.REFERENCES_MANY, string[]> implements OnInit {
|
|
11
|
+
private readonly injector;
|
|
12
|
+
allReferencedEntities: EntityType[];
|
|
13
|
+
allDropdownValues: DropdownValue<string>[];
|
|
14
|
+
dropdownValues: DropdownValue<string>[];
|
|
15
|
+
input: string;
|
|
16
|
+
referencedEntitiesDataSource: MatTableDataSource<string>;
|
|
17
|
+
displayedColumns: string[];
|
|
18
|
+
selection: SelectionModel<string>;
|
|
19
|
+
SelectionUtilities: typeof SelectionUtilities;
|
|
20
|
+
constructor(injector: EnvironmentInjector);
|
|
21
|
+
ngOnInit(): Promise<void>;
|
|
22
|
+
add(): Promise<void>;
|
|
23
|
+
addAll(): void;
|
|
24
|
+
remove(): void;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReferencesManyInputComponent<any>, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ReferencesManyInputComponent<any>, "references-many-input", never, {}, {}, never, never, false>;
|
|
27
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Time } from '@angular/common';
|
|
2
|
+
import { DateFilterFn } from '@angular/material/datepicker';
|
|
2
3
|
import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
|
|
4
|
+
import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
|
|
5
|
+
import { CreateDialogData, DisplayColumn } from '../../components/table/table-data';
|
|
3
6
|
import { DecoratorTypes } from '../base/decorator-types.enum';
|
|
4
|
-
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
5
|
-
import { ArrayTableDisplayColumn, AutocompleteStringChipsArrayDecoratorConfig, DateArrayDecoratorConfig, DateRangeArrayDecoratorConfig, DateTimeArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
|
|
6
|
-
import { DateFilterFn } from '@angular/material/datepicker';
|
|
7
|
-
import { Time } from '@angular/common';
|
|
8
7
|
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
8
|
+
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
9
9
|
import { DateRange } from '../date/date-decorator.data';
|
|
10
|
-
import {
|
|
10
|
+
import { AutocompleteStringChipsArrayDecoratorConfig, DateArrayDecoratorConfig, DateRangeArrayDecoratorConfig, DateTimeArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
|
|
11
11
|
/**
|
|
12
12
|
* The internal EntityArrayDecoratorConfig. Sets default values.
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ export declare class EntityArrayDecoratorConfigInternal<EntityType extends BaseE
|
|
|
16
16
|
allowDuplicates: boolean;
|
|
17
17
|
duplicatesErrorDialog: ConfirmDialogData;
|
|
18
18
|
EntityClass: EntityClassNewable<EntityType>;
|
|
19
|
-
displayColumns:
|
|
19
|
+
displayColumns: DisplayColumn<EntityType>[];
|
|
20
20
|
createDialogData?: CreateDialogData;
|
|
21
21
|
createInline: boolean;
|
|
22
22
|
missingErrorMessage: string;
|
|
@@ -31,7 +31,7 @@ export declare class DateArrayDecoratorConfigInternal extends PropertyDecoratorC
|
|
|
31
31
|
itemType: DecoratorTypes.DATE;
|
|
32
32
|
allowDuplicates: boolean;
|
|
33
33
|
duplicatesErrorDialog: ConfirmDialogData;
|
|
34
|
-
displayColumns:
|
|
34
|
+
displayColumns: DisplayColumn<Date>[];
|
|
35
35
|
addButtonLabel: string;
|
|
36
36
|
removeButtonLabel: string;
|
|
37
37
|
missingErrorMessage: string;
|
|
@@ -47,7 +47,7 @@ export declare class DateTimeArrayDecoratorConfigInternal extends PropertyDecora
|
|
|
47
47
|
itemType: DecoratorTypes.DATE_TIME;
|
|
48
48
|
allowDuplicates: boolean;
|
|
49
49
|
duplicatesErrorDialog: ConfirmDialogData;
|
|
50
|
-
displayColumns:
|
|
50
|
+
displayColumns: DisplayColumn<Date>[];
|
|
51
51
|
addButtonLabel: string;
|
|
52
52
|
removeButtonLabel: string;
|
|
53
53
|
missingErrorMessage: string;
|
|
@@ -68,7 +68,7 @@ export declare class DateRangeArrayDecoratorConfigInternal extends PropertyDecor
|
|
|
68
68
|
itemType: DecoratorTypes.DATE_RANGE;
|
|
69
69
|
allowDuplicates: boolean;
|
|
70
70
|
duplicatesErrorDialog: ConfirmDialogData;
|
|
71
|
-
displayColumns:
|
|
71
|
+
displayColumns: DisplayColumn<DateRange>[];
|
|
72
72
|
addButtonLabel: string;
|
|
73
73
|
removeButtonLabel: string;
|
|
74
74
|
missingErrorMessage: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateDialogData } from '../../components/table/table-data';
|
|
1
|
+
import { CreateDialogData, DisplayColumn } from '../../components/table/table-data';
|
|
2
2
|
import { BaseEntityType, EntityClassNewable } from '../../classes/entity.model';
|
|
3
3
|
import { DecoratorTypes } from '../base/decorator-types.enum';
|
|
4
4
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
@@ -7,19 +7,6 @@ import { Time } from '@angular/common';
|
|
|
7
7
|
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
8
8
|
import { DateRange } from '../date/date-decorator.data';
|
|
9
9
|
import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
|
|
10
|
-
/**
|
|
11
|
-
* The configuration options for an array property displayed as a table.
|
|
12
|
-
*/
|
|
13
|
-
export interface ArrayTableDisplayColumn<EntityType extends BaseEntityType<EntityType>> {
|
|
14
|
-
/**
|
|
15
|
-
* The name inside the header.
|
|
16
|
-
*/
|
|
17
|
-
displayName: string;
|
|
18
|
-
/**
|
|
19
|
-
* A method to get the value inside an row.
|
|
20
|
-
*/
|
|
21
|
-
value: (entity: EntityType) => string;
|
|
22
|
-
}
|
|
23
10
|
/**
|
|
24
11
|
* Interface definition for the @array metadata.
|
|
25
12
|
*/
|
|
@@ -52,7 +39,7 @@ export interface EntityArrayDecoratorConfig<EntityType extends BaseEntityType<En
|
|
|
52
39
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
53
40
|
* and the value, which is a function that generates the value to display inside a column.
|
|
54
41
|
*/
|
|
55
|
-
displayColumns:
|
|
42
|
+
displayColumns: DisplayColumn<EntityType>[];
|
|
56
43
|
/**
|
|
57
44
|
* The data for the add-item-dialog.
|
|
58
45
|
* Can be omitted when adding items inline.
|
|
@@ -91,7 +78,7 @@ export interface DateArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
|
91
78
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
92
79
|
* and the value, which is a function that generates the value to display inside a column.
|
|
93
80
|
*/
|
|
94
|
-
displayColumns:
|
|
81
|
+
displayColumns: DisplayColumn<Date>[];
|
|
95
82
|
/**
|
|
96
83
|
* The label for the add button.
|
|
97
84
|
*
|
|
@@ -130,7 +117,7 @@ export interface DateTimeArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
|
130
117
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
131
118
|
* and the value, which is a function that generates the value to display inside a column.
|
|
132
119
|
*/
|
|
133
|
-
displayColumns:
|
|
120
|
+
displayColumns: DisplayColumn<Date>[];
|
|
134
121
|
/**
|
|
135
122
|
* The label for the add button.
|
|
136
123
|
*
|
|
@@ -191,7 +178,7 @@ export interface DateRangeArrayDecoratorConfig extends ArrayDecoratorConfig {
|
|
|
191
178
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
192
179
|
* and the value, which is a function that generates the value to display inside a column.
|
|
193
180
|
*/
|
|
194
|
-
displayColumns:
|
|
181
|
+
displayColumns: DisplayColumn<DateRange>[];
|
|
195
182
|
/**
|
|
196
183
|
* The label for the add button.
|
|
197
184
|
*
|
|
@@ -5,6 +5,7 @@ import { DateRangeDateDecoratorConfigInternal, DateTimeDateDecoratorConfigIntern
|
|
|
5
5
|
import { DefaultFileDecoratorConfigInternal, ImageFileDecoratorConfigInternal } from '../file/file-decorator-internal.data';
|
|
6
6
|
import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInternal, SliderNumberDecoratorConfigInternal } from '../number/number-decorator-internal.data';
|
|
7
7
|
import { DefaultObjectDecoratorConfigInternal } from '../object/object-decorator-internal.data';
|
|
8
|
+
import { ReferencesManyDecoratorConfigInternal } from '../references-many/references-many-decorator-internal.data';
|
|
8
9
|
import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, PasswordStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../string/string-decorator-internal.data';
|
|
9
10
|
/**
|
|
10
11
|
* The enum Values for all the different DecoratorTypes.
|
|
@@ -33,9 +34,10 @@ export declare enum DecoratorTypes {
|
|
|
33
34
|
DATE_TIME = "dateTime",
|
|
34
35
|
FILE_DEFAULT = "fileDefault",
|
|
35
36
|
FILE_IMAGE = "fileImage",
|
|
37
|
+
REFERENCES_MANY = "referencesMany",
|
|
36
38
|
CUSTOM = "custom"
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* Gives the metadata-config Type based on the DecoratorTypes enum.
|
|
40
42
|
*/
|
|
41
|
-
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.CUSTOM ? CustomDecoratorConfigInternal<any, any, CustomMetadataType, any> : never;
|
|
43
|
+
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.CUSTOM ? CustomDecoratorConfigInternal<any, any, CustomMetadataType, any> : never;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseEntityType } from '../../classes/entity.model';
|
|
2
|
+
import { DisplayColumn } from '../../components/table/table-data';
|
|
3
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
4
|
+
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
5
|
+
import { ReferencesManyDecoratorConfig } from './references-many-decorator.data';
|
|
6
|
+
/**
|
|
7
|
+
* The internal DefaultNumberDecoratorConfig. Sets default values.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ReferencesManyDecoratorConfigInternal<EntityType extends BaseEntityType<EntityType>> extends PropertyDecoratorConfigInternal implements ReferencesManyDecoratorConfig<EntityType> {
|
|
10
|
+
getReferencedEntities: () => Promise<EntityType[]>;
|
|
11
|
+
getDropdownValues: (referencedEntities: EntityType[]) => DropdownValue<string>[];
|
|
12
|
+
getEntityForId: (entityId: string, allReferencedEntities: EntityType[]) => EntityType;
|
|
13
|
+
displayColumns: DisplayColumn<EntityType>[];
|
|
14
|
+
addButtonLabel: string;
|
|
15
|
+
removeButtonLabel: string;
|
|
16
|
+
dropdownLabel: string;
|
|
17
|
+
addAll: boolean;
|
|
18
|
+
addAllButtonLabel: string;
|
|
19
|
+
constructor(data: ReferencesManyDecoratorConfig<EntityType>);
|
|
20
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseEntityType } from '../../classes/entity.model';
|
|
2
|
+
import { DisplayColumn } from '../../components/table/table-data';
|
|
3
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
4
|
+
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
5
|
+
/**
|
|
6
|
+
* Definition for the @referencesMany metadata.
|
|
7
|
+
*/
|
|
8
|
+
export interface ReferencesManyDecoratorConfig<EntityType extends BaseEntityType<EntityType>> extends PropertyDecoratorConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The function that returns the values that can be referenced.
|
|
11
|
+
*/
|
|
12
|
+
getReferencedEntities: () => Promise<EntityType[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Method to get the referenced dropdown values.
|
|
15
|
+
*/
|
|
16
|
+
getDropdownValues: (referencedEntities: EntityType[]) => DropdownValue<string>[];
|
|
17
|
+
/**
|
|
18
|
+
* Gets the referenced entity for the given id.
|
|
19
|
+
*/
|
|
20
|
+
getEntityForId?: (entityId: string, allReferencedEntities: EntityType[]) => EntityType;
|
|
21
|
+
/**
|
|
22
|
+
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
23
|
+
* and the value, which is a function that generates the value to display inside a column.
|
|
24
|
+
*/
|
|
25
|
+
displayColumns: DisplayColumn<EntityType>[];
|
|
26
|
+
/**
|
|
27
|
+
* The label for the dropdown input.
|
|
28
|
+
*
|
|
29
|
+
* @default 'Select'
|
|
30
|
+
*/
|
|
31
|
+
dropdownLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Whether or not a button that adds all values exists.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
addAll?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The label for the add all button.
|
|
40
|
+
*
|
|
41
|
+
* @default 'Add all'
|
|
42
|
+
*/
|
|
43
|
+
addAllButtonLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The label for the add button when createInline is true.
|
|
46
|
+
*
|
|
47
|
+
* @default 'Add'
|
|
48
|
+
*/
|
|
49
|
+
addButtonLabel?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The label for the remove button when createInline is true.
|
|
52
|
+
*
|
|
53
|
+
* @default 'Remove'
|
|
54
|
+
*/
|
|
55
|
+
removeButtonLabel?: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEntityType } from '../../classes/entity.model';
|
|
2
|
+
import { ReferencesManyDecoratorConfig } from './references-many-decorator.data';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for setting and getting references many property metadata.
|
|
5
|
+
*
|
|
6
|
+
* @param metadata - The metadata of the references many property.
|
|
7
|
+
* @returns The method that defines the metadata.
|
|
8
|
+
*/
|
|
9
|
+
export declare function referencesMany<EntityType extends BaseEntityType<EntityType>>(metadata: ReferencesManyDecoratorConfig<EntityType>): (target: object, propertyKey: string) => void;
|