ngx-material-entity 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +533 -326
- package/classes/{base-builder.class.d.ts → base.builder.d.ts} +0 -0
- package/classes/date.utilities.d.ts +58 -0
- package/classes/entity.model.d.ts +13 -0
- package/classes/{entity-service.class.d.ts → entity.service.d.ts} +9 -4
- package/classes/{entity-utilities.class.d.ts → entity.utilities.d.ts} +24 -16
- package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +1 -1
- package/components/input/add-array-item-dialog-data.builder.d.ts +3 -4
- package/components/input/add-array-item-dialog-data.d.ts +1 -2
- package/components/input/input.component.d.ts +38 -7
- package/components/input/input.module.d.ts +2 -1
- package/components/table/create-dialog/create-dialog-data.builder.d.ts +1 -1
- package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +4 -5
- package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -3
- package/components/table/create-dialog/create-entity-dialog.component.d.ts +3 -4
- package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +3 -4
- package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +2 -3
- package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +4 -5
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +3 -4
- package/components/table/table-data.builder.d.ts +9 -9
- package/components/table/table-data.d.ts +8 -8
- package/components/table/table.component.d.ts +1 -2
- package/decorators/array/array-decorator-internal.data.d.ts +3 -3
- package/decorators/array/array-decorator.data.d.ts +4 -4
- package/decorators/array/array.decorator.d.ts +1 -2
- package/decorators/base/decorator-types.enum.d.ts +6 -3
- package/decorators/base/dropdown-value.interface.d.ts +14 -0
- package/decorators/date/date-decorator-internal.data.d.ts +44 -0
- package/decorators/date/date-decorator.data.d.ts +129 -0
- package/decorators/number/number-decorator-internal.data.d.ts +2 -4
- package/decorators/number/number-decorator.data.d.ts +2 -4
- package/decorators/number/number.decorator.d.ts +2 -2
- package/decorators/object/object-decorator-internal.data.d.ts +3 -3
- package/decorators/object/object-decorator.data.d.ts +5 -5
- package/decorators/object/object.decorator.d.ts +1 -2
- package/decorators/string/string-decorator-internal.data.d.ts +2 -4
- package/decorators/string/string-decorator.data.d.ts +2 -4
- package/esm2020/classes/base.builder.mjs +43 -0
- package/esm2020/classes/date.utilities.mjs +138 -0
- package/esm2020/classes/entity.model.mjs +19 -0
- package/esm2020/classes/entity.service.mjs +83 -0
- package/esm2020/classes/entity.utilities.mjs +538 -0
- package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +2 -2
- package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +4 -4
- package/esm2020/components/input/add-array-item-dialog-data.mjs +1 -1
- package/esm2020/components/input/input.component.mjs +82 -14
- package/esm2020/components/input/input.module.mjs +8 -4
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +2 -2
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +2 -2
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +2 -2
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +3 -3
- package/esm2020/components/table/table-data.builder.mjs +2 -2
- package/esm2020/components/table/table-data.mjs +1 -1
- package/esm2020/components/table/table.component.mjs +2 -2
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +1 -1
- package/esm2020/decorators/array/array-decorator.data.mjs +1 -1
- package/esm2020/decorators/array/array.decorator.mjs +1 -1
- package/esm2020/decorators/base/decorator-types.enum.mjs +4 -1
- package/esm2020/decorators/base/dropdown-value.interface.mjs +2 -0
- package/esm2020/decorators/date/date-decorator-internal.data.mjs +48 -0
- package/esm2020/decorators/date/date-decorator.data.mjs +7 -0
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +1 -1
- package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
- package/esm2020/decorators/number/number.decorator.mjs +3 -3
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +2 -2
- package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
- package/esm2020/decorators/object/object.decorator.mjs +1 -1
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +1 -1
- package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
- package/esm2020/public-api.mjs +7 -5
- package/fesm2015/ngx-material-entity.mjs +461 -82
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +460 -82
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +7 -1
- package/public-api.d.ts +7 -4
- package/classes/entity-model.class.d.ts +0 -9
- package/esm2020/classes/base-builder.class.mjs +0 -43
- package/esm2020/classes/entity-model.class.mjs +0 -19
- package/esm2020/classes/entity-service.class.mjs +0 -76
- package/esm2020/classes/entity-utilities.class.mjs +0 -377
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { EntityService } from '../../classes/entity.service';
|
|
3
|
+
import { EntityClassNewable } from '../../classes/entity.model';
|
|
4
4
|
import { ConfirmDialogData } from '../confirm-dialog/confirm-dialog-data';
|
|
5
5
|
/**
|
|
6
6
|
* The Definition of a Column inside the table.
|
|
7
7
|
*/
|
|
8
|
-
export interface DisplayColumn<EntityType extends
|
|
8
|
+
export interface DisplayColumn<EntityType extends object> {
|
|
9
9
|
/**
|
|
10
10
|
* The name inside the header.
|
|
11
11
|
*/
|
|
@@ -18,7 +18,7 @@ export interface DisplayColumn<EntityType extends Entity> {
|
|
|
18
18
|
/**
|
|
19
19
|
* The Definition of an Action that can be run on multiple selected entities.
|
|
20
20
|
*/
|
|
21
|
-
export interface MultiSelectAction<EntityType extends
|
|
21
|
+
export interface MultiSelectAction<EntityType extends object> {
|
|
22
22
|
/**
|
|
23
23
|
* The name of the action.
|
|
24
24
|
*/
|
|
@@ -47,7 +47,7 @@ export interface MultiSelectAction<EntityType extends Entity> {
|
|
|
47
47
|
/**
|
|
48
48
|
* The base data of the ngx-mat-entity-table.
|
|
49
49
|
*/
|
|
50
|
-
export interface BaseData<EntityType extends
|
|
50
|
+
export interface BaseData<EntityType extends object> {
|
|
51
51
|
/**
|
|
52
52
|
* The title of the table.
|
|
53
53
|
*/
|
|
@@ -65,7 +65,7 @@ export interface BaseData<EntityType extends Entity> {
|
|
|
65
65
|
/**
|
|
66
66
|
* The Class of the entities to manage.
|
|
67
67
|
*/
|
|
68
|
-
EntityClass?:
|
|
68
|
+
EntityClass?: EntityClassNewable<EntityType>;
|
|
69
69
|
/**
|
|
70
70
|
* The label on the search bar. Defaults to "Search".
|
|
71
71
|
*/
|
|
@@ -144,7 +144,7 @@ export interface CreateDialogData {
|
|
|
144
144
|
/**
|
|
145
145
|
* The data of the default edit-dialog.
|
|
146
146
|
*/
|
|
147
|
-
export interface EditDialogData<EntityType extends
|
|
147
|
+
export interface EditDialogData<EntityType extends object> {
|
|
148
148
|
/**
|
|
149
149
|
* The title of the default edit-dialog.
|
|
150
150
|
*/
|
|
@@ -181,7 +181,7 @@ export interface EditDialogData<EntityType extends Entity> {
|
|
|
181
181
|
/**
|
|
182
182
|
* All the configuration data required to display a ngx-mat-entity-table.
|
|
183
183
|
*/
|
|
184
|
-
export interface TableData<EntityType extends
|
|
184
|
+
export interface TableData<EntityType extends object> {
|
|
185
185
|
/**
|
|
186
186
|
* The base data for the table-component.
|
|
187
187
|
* Includes stuff like the title for the table, what to display inside the rows etc.
|
|
@@ -2,7 +2,6 @@ import { Injector, OnDestroy, OnInit } from '@angular/core';
|
|
|
2
2
|
import { MatPaginator } from '@angular/material/paginator';
|
|
3
3
|
import { MatSort } from '@angular/material/sort';
|
|
4
4
|
import { MatTableDataSource } from '@angular/material/table';
|
|
5
|
-
import { Entity } from '../../classes/entity-model.class';
|
|
6
5
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
7
6
|
import { MatDialog } from '@angular/material/dialog';
|
|
8
7
|
import { MultiSelectAction, TableData } from './table-data';
|
|
@@ -14,7 +13,7 @@ import * as i0 from "@angular/core";
|
|
|
14
13
|
*
|
|
15
14
|
* It offers a lot of customization options which can be found in "TableData".
|
|
16
15
|
*/
|
|
17
|
-
export declare class NgxMatEntityTableComponent<EntityType extends
|
|
16
|
+
export declare class NgxMatEntityTableComponent<EntityType extends object> implements OnInit, OnDestroy {
|
|
18
17
|
private readonly dialog;
|
|
19
18
|
private readonly injector;
|
|
20
19
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Entity } from '../../classes/entity-model.class';
|
|
2
1
|
import { CreateDialogData } from '../../components/table/table-data';
|
|
2
|
+
import { EntityClassNewable } from '../../classes/entity.model';
|
|
3
3
|
import { DecoratorTypes } from '../base/decorator-types.enum';
|
|
4
4
|
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
5
5
|
import { ArrayTableDisplayColumn, AutocompleteStringChipsArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
|
|
6
6
|
/**
|
|
7
7
|
* The internal EntityArrayDecoratorConfig. Sets default values.
|
|
8
8
|
*/
|
|
9
|
-
export declare class EntityArrayDecoratorConfigInternal<EntityType extends
|
|
9
|
+
export declare class EntityArrayDecoratorConfigInternal<EntityType extends object> extends PropertyDecoratorConfigInternal implements EntityArrayDecoratorConfig<EntityType> {
|
|
10
10
|
itemType: DecoratorTypes.OBJECT;
|
|
11
11
|
displayStyle: 'table';
|
|
12
|
-
EntityClass:
|
|
12
|
+
EntityClass: EntityClassNewable<EntityType>;
|
|
13
13
|
displayColumns: ArrayTableDisplayColumn<EntityType>[];
|
|
14
14
|
createDialogData?: CreateDialogData;
|
|
15
15
|
createInline: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Entity } from '../../classes/entity-model.class';
|
|
2
1
|
import { CreateDialogData } from '../../components/table/table-data';
|
|
2
|
+
import { EntityClassNewable } from '../../classes/entity.model';
|
|
3
3
|
import { DecoratorTypes } from '../base/decorator-types.enum';
|
|
4
4
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
5
5
|
/**
|
|
6
6
|
* The configuration options for an array property displayed as a table.
|
|
7
7
|
*/
|
|
8
|
-
export interface ArrayTableDisplayColumn<EntityType extends
|
|
8
|
+
export interface ArrayTableDisplayColumn<EntityType extends object> {
|
|
9
9
|
/**
|
|
10
10
|
* The name inside the header.
|
|
11
11
|
*/
|
|
@@ -31,13 +31,13 @@ declare abstract class ArrayDecoratorConfig extends PropertyDecoratorConfig {
|
|
|
31
31
|
/**
|
|
32
32
|
* Definition for an array of Entities.
|
|
33
33
|
*/
|
|
34
|
-
export interface EntityArrayDecoratorConfig<EntityType extends
|
|
34
|
+
export interface EntityArrayDecoratorConfig<EntityType extends object> extends ArrayDecoratorConfig {
|
|
35
35
|
itemType: DecoratorTypes.OBJECT;
|
|
36
36
|
displayStyle: 'table';
|
|
37
37
|
/**
|
|
38
38
|
* The EntityClass used for generating the create inputs.
|
|
39
39
|
*/
|
|
40
|
-
EntityClass:
|
|
40
|
+
EntityClass: EntityClassNewable<EntityType>;
|
|
41
41
|
/**
|
|
42
42
|
* The definition of the columns to display. Consists of the displayName to show in the header of the row
|
|
43
43
|
* and the value, which is a function that generates the value to display inside a column.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Entity } from '../../classes/entity-model.class';
|
|
2
1
|
import { AutocompleteStringChipsArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
|
|
3
2
|
/**
|
|
4
3
|
* Decorator for setting and getting array property metadata.
|
|
@@ -7,4 +6,4 @@ import { AutocompleteStringChipsArrayDecoratorConfig, EntityArrayDecoratorConfig
|
|
|
7
6
|
* @returns The method that defines the metadata.
|
|
8
7
|
* @throws When the given type of the array-items is unknown.
|
|
9
8
|
*/
|
|
10
|
-
export declare function array<EntityType extends
|
|
9
|
+
export declare function array<EntityType extends object>(metadata: EntityArrayDecoratorConfig<EntityType> | StringChipsArrayDecoratorConfig | AutocompleteStringChipsArrayDecoratorConfig): (target: object, propertyKey: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Entity } from '../../classes/entity-model.class';
|
|
2
1
|
import { AutocompleteStringChipsArrayDecoratorConfigInternal, EntityArrayDecoratorConfigInternal, StringChipsArrayDecoratorConfigInternal } from '../array/array-decorator-internal.data';
|
|
3
2
|
import { CheckboxBooleanDecoratorConfigInternal, DropdownBooleanDecoratorConfigInternal, ToggleBooleanDecoratorConfigInternal } from '../boolean/boolean-decorator-internal.data';
|
|
3
|
+
import { DateRangeDateDecoratorConfigInternal, DateTimeDateDecoratorConfigInternal, DefaultDateDecoratorConfigInternal } from '../date/date-decorator-internal.data';
|
|
4
4
|
import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInternal } from '../number/number-decorator-internal.data';
|
|
5
5
|
import { DefaultObjectDecoratorConfigInternal } from '../object/object-decorator-internal.data';
|
|
6
6
|
import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../string/string-decorator-internal.data';
|
|
@@ -20,9 +20,12 @@ export declare enum DecoratorTypes {
|
|
|
20
20
|
OBJECT = "object",
|
|
21
21
|
ARRAY = "array",
|
|
22
22
|
ARRAY_STRING_CHIPS = "arrayStringChips",
|
|
23
|
-
ARRAY_STRING_AUTOCOMPLETE_CHIPS = "arrayStringAutocompleteChips"
|
|
23
|
+
ARRAY_STRING_AUTOCOMPLETE_CHIPS = "arrayStringAutocompleteChips",
|
|
24
|
+
DATE = "date",
|
|
25
|
+
DATE_RANGE = "dateRange",
|
|
26
|
+
DATE_TIME = "dateTime"
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Gives the metadata-config Type based on the DecoratorTypes enum.
|
|
27
30
|
*/
|
|
28
|
-
export declare type DecoratorType<T> = 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.NUMBER ? DefaultNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_DROPDOWN ? DropdownNumberDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_CHECKBOX ? CheckboxBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_TOGGLE ? ToggleBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_DROPDOWN ? DropdownBooleanDecoratorConfigInternal : T extends DecoratorTypes.OBJECT ? DefaultObjectDecoratorConfigInternal<
|
|
31
|
+
export declare type DecoratorType<T> = 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.NUMBER ? DefaultNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_DROPDOWN ? DropdownNumberDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_CHECKBOX ? CheckboxBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_TOGGLE ? ToggleBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_DROPDOWN ? DropdownBooleanDecoratorConfigInternal : T extends DecoratorTypes.OBJECT ? DefaultObjectDecoratorConfigInternal<object> : T extends DecoratorTypes.ARRAY ? EntityArrayDecoratorConfigInternal<object> : 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 : never;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The definition for a dropdown value.
|
|
3
|
+
* Consists of the name to display in the dropdown and the actual value.
|
|
4
|
+
*/
|
|
5
|
+
export interface DropdownValue<T> {
|
|
6
|
+
/**
|
|
7
|
+
* The name to display in the dropdown.
|
|
8
|
+
*/
|
|
9
|
+
displayName: string;
|
|
10
|
+
/**
|
|
11
|
+
* The actual value.
|
|
12
|
+
*/
|
|
13
|
+
value: T;
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Time } from '@angular/common';
|
|
2
|
+
import { DateFilterFn } from '@angular/material/datepicker';
|
|
3
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
4
|
+
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
5
|
+
import { DateRangeDateDecoratorConfig, DateTimeDateDecoratorConfig, DefaultDateDecoratorConfig } from './date-decorator.data';
|
|
6
|
+
/**
|
|
7
|
+
* The internal DefaultDateDecoratorConfig. Sets default values.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DefaultDateDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DefaultDateDecoratorConfig {
|
|
10
|
+
displayStyle: 'date';
|
|
11
|
+
min?: (date?: Date) => Date;
|
|
12
|
+
max?: (date?: Date) => Date;
|
|
13
|
+
filter?: DateFilterFn<Date | null | undefined>;
|
|
14
|
+
constructor(data: DefaultDateDecoratorConfig);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The internal DateRangeDateDecoratorConfig. Sets default values.
|
|
18
|
+
*/
|
|
19
|
+
export declare class DateRangeDateDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DateRangeDateDecoratorConfig {
|
|
20
|
+
displayStyle: 'daterange';
|
|
21
|
+
minStart?: (date?: Date) => Date;
|
|
22
|
+
maxStart?: (date?: Date) => Date;
|
|
23
|
+
minEnd?: (date?: Date) => Date;
|
|
24
|
+
maxEnd?: (date?: Date) => Date;
|
|
25
|
+
filter?: DateFilterFn<Date>;
|
|
26
|
+
placeholderStart?: string;
|
|
27
|
+
placeholderEnd?: string;
|
|
28
|
+
constructor(data: DateRangeDateDecoratorConfig);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The internal DateTimeDateDecoratorConfig. Sets default values.
|
|
32
|
+
*/
|
|
33
|
+
export declare class DateTimeDateDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DateTimeDateDecoratorConfig {
|
|
34
|
+
displayStyle: 'datetime';
|
|
35
|
+
times: DropdownValue<Time>[];
|
|
36
|
+
timeDisplayName: string;
|
|
37
|
+
minDate?: (date?: Date) => Date;
|
|
38
|
+
maxDate?: (date?: Date) => Date;
|
|
39
|
+
filterDate?: DateFilterFn<Date | null | undefined>;
|
|
40
|
+
minTime?: (date?: Date) => Time;
|
|
41
|
+
maxTime?: (date?: Date) => Time;
|
|
42
|
+
filterTime?: ((time: Time) => boolean) | (() => boolean);
|
|
43
|
+
constructor(data: DateTimeDateDecoratorConfig);
|
|
44
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Time } from '@angular/common';
|
|
2
|
+
import { DateFilterFn } from '@angular/material/datepicker';
|
|
3
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
4
|
+
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
5
|
+
/**
|
|
6
|
+
* This is the needed type for an property that should be displayed as a date range.
|
|
7
|
+
*/
|
|
8
|
+
export interface DateRange {
|
|
9
|
+
/**
|
|
10
|
+
* The start date of the range.
|
|
11
|
+
*/
|
|
12
|
+
start: Date;
|
|
13
|
+
/**
|
|
14
|
+
* The end date of the range.
|
|
15
|
+
*/
|
|
16
|
+
end: Date;
|
|
17
|
+
/**
|
|
18
|
+
* The actual Date values. These are needed if the date range might contain some values that are disabled.
|
|
19
|
+
* E.g. When you build a tool to request vacation you may want the user to select 3 weeks in the range picker
|
|
20
|
+
* but don't want the weekend dates in the final result.
|
|
21
|
+
*/
|
|
22
|
+
values?: Date[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Definition for the @date metadata.
|
|
26
|
+
*/
|
|
27
|
+
declare abstract class DateDecoratorConfig extends PropertyDecoratorConfig {
|
|
28
|
+
/**
|
|
29
|
+
* How to display the date.
|
|
30
|
+
*/
|
|
31
|
+
displayStyle: 'date' | 'datetime' | 'daterange';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The configuration options for a date property displayed as a default single date picker.
|
|
35
|
+
*/
|
|
36
|
+
export interface DefaultDateDecoratorConfig extends DateDecoratorConfig {
|
|
37
|
+
displayStyle: 'date';
|
|
38
|
+
/**
|
|
39
|
+
* A function to get the minimum value of the date.
|
|
40
|
+
*/
|
|
41
|
+
min?: (date?: Date) => Date;
|
|
42
|
+
/**
|
|
43
|
+
* A function to get the maximum value of the date.
|
|
44
|
+
*/
|
|
45
|
+
max?: (date?: Date) => Date;
|
|
46
|
+
/**
|
|
47
|
+
* A filter function to do more specific filtering. This could be the removal of e.g. All weekends.
|
|
48
|
+
*/
|
|
49
|
+
filter?: DateFilterFn<Date | null | undefined>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The configuration options for a date property displayed as a date range.
|
|
53
|
+
*/
|
|
54
|
+
export interface DateRangeDateDecoratorConfig extends DateDecoratorConfig {
|
|
55
|
+
displayStyle: 'daterange';
|
|
56
|
+
/**
|
|
57
|
+
* A function to get the minimum value of the start date.
|
|
58
|
+
*/
|
|
59
|
+
minStart?: (date?: Date) => Date;
|
|
60
|
+
/**
|
|
61
|
+
* A function to get the maximum value of the start date.
|
|
62
|
+
*/
|
|
63
|
+
maxStart?: (date?: Date) => Date;
|
|
64
|
+
/**
|
|
65
|
+
* A function to get the minimum value of the end date.
|
|
66
|
+
*/
|
|
67
|
+
minEnd?: (date?: Date) => Date;
|
|
68
|
+
/**
|
|
69
|
+
* A function to get the maximum value of the end date.
|
|
70
|
+
*/
|
|
71
|
+
maxEnd?: (date?: Date) => Date;
|
|
72
|
+
/**
|
|
73
|
+
* A filter function to do more specific filtering on the disallowed end date values. This could be the removal of e.g. All weekends.
|
|
74
|
+
*/
|
|
75
|
+
filter?: DateFilterFn<Date>;
|
|
76
|
+
/**
|
|
77
|
+
* The placeholder for the start date of the date range picker.
|
|
78
|
+
*
|
|
79
|
+
* @default "Start"
|
|
80
|
+
*/
|
|
81
|
+
placeholderStart?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The placeholder for the end date of the date range picker.
|
|
84
|
+
*
|
|
85
|
+
* @default "End"
|
|
86
|
+
*/
|
|
87
|
+
placeholderEnd?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The configuration options for a date property displayed as date time.
|
|
91
|
+
*/
|
|
92
|
+
export interface DateTimeDateDecoratorConfig extends DateDecoratorConfig {
|
|
93
|
+
displayStyle: 'datetime';
|
|
94
|
+
/**
|
|
95
|
+
* The selectable times.
|
|
96
|
+
*/
|
|
97
|
+
times?: DropdownValue<Time>[];
|
|
98
|
+
/**
|
|
99
|
+
* The name to use as a label for the time form field.
|
|
100
|
+
*
|
|
101
|
+
* @default 'Time'
|
|
102
|
+
*/
|
|
103
|
+
timeDisplayName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* A function to get the minimum value of the date.
|
|
106
|
+
*/
|
|
107
|
+
minDate?: (date?: Date) => Date;
|
|
108
|
+
/**
|
|
109
|
+
* A function to get the maximum value of the date.
|
|
110
|
+
*/
|
|
111
|
+
maxDate?: (date?: Date) => Date;
|
|
112
|
+
/**
|
|
113
|
+
* A filter function to do more specific date filtering. This could be the removal of e.g. All weekends.
|
|
114
|
+
*/
|
|
115
|
+
filterDate?: DateFilterFn<Date | null | undefined>;
|
|
116
|
+
/**
|
|
117
|
+
* A function to get the minimum value of the time.
|
|
118
|
+
*/
|
|
119
|
+
minTime?: (date?: Date) => Time;
|
|
120
|
+
/**
|
|
121
|
+
* A function to get the maximum value of the time.
|
|
122
|
+
*/
|
|
123
|
+
maxTime?: (date?: Date) => Time;
|
|
124
|
+
/**
|
|
125
|
+
* A filter function to do more specific time filtering. This could be e.g. The removal of lunch breaks.
|
|
126
|
+
*/
|
|
127
|
+
filterTime?: ((time: Time) => boolean) | (() => boolean);
|
|
128
|
+
}
|
|
129
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
1
2
|
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
2
3
|
import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig } from './number-decorator.data';
|
|
3
4
|
/**
|
|
@@ -14,9 +15,6 @@ export declare class DefaultNumberDecoratorConfigInternal extends PropertyDecora
|
|
|
14
15
|
*/
|
|
15
16
|
export declare class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DropdownNumberDecoratorConfig {
|
|
16
17
|
displayStyle: 'dropdown';
|
|
17
|
-
dropdownValues:
|
|
18
|
-
displayName: string;
|
|
19
|
-
value: number;
|
|
20
|
-
}[];
|
|
18
|
+
dropdownValues: DropdownValue<number>[];
|
|
21
19
|
constructor(data: DropdownNumberDecoratorConfig);
|
|
22
20
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
1
2
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
2
3
|
/**
|
|
3
4
|
* Definition for the @number metadata.
|
|
@@ -30,9 +31,6 @@ export interface DropdownNumberDecoratorConfig extends NumberDecoratorConfig {
|
|
|
30
31
|
/**
|
|
31
32
|
* The values of the dropdown, consisting of a name to display and the actual value.
|
|
32
33
|
*/
|
|
33
|
-
dropdownValues:
|
|
34
|
-
displayName: string;
|
|
35
|
-
value: number;
|
|
36
|
-
}[];
|
|
34
|
+
dropdownValues: DropdownValue<number>[];
|
|
37
35
|
}
|
|
38
36
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig } from './number-decorator.data';
|
|
2
2
|
/**
|
|
3
|
-
* Decorator for setting and getting
|
|
3
|
+
* Decorator for setting and getting number property metadata.
|
|
4
4
|
*
|
|
5
|
-
* @param metadata - The metadata of the
|
|
5
|
+
* @param metadata - The metadata of the number property.
|
|
6
6
|
* @returns The method that defines the metadata.
|
|
7
7
|
*/
|
|
8
8
|
export declare function number(metadata: DefaultNumberDecoratorConfig | DropdownNumberDecoratorConfig): (target: object, propertyKey: string) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityClassNewable } from '../../classes/entity.model';
|
|
2
2
|
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
3
3
|
import { DefaultObjectDecoratorConfig } from './object-decorator.data';
|
|
4
4
|
/**
|
|
5
5
|
* The internal DefaultObjectDecoratorConfig. Sets default values.
|
|
6
6
|
*/
|
|
7
|
-
export declare class DefaultObjectDecoratorConfigInternal<EntityType extends
|
|
7
|
+
export declare class DefaultObjectDecoratorConfigInternal<EntityType extends object> extends PropertyDecoratorConfigInternal implements DefaultObjectDecoratorConfig<EntityType> {
|
|
8
8
|
displayStyle: 'inline';
|
|
9
|
-
|
|
9
|
+
EntityClass: EntityClassNewable<EntityType>;
|
|
10
10
|
constructor(data: DefaultObjectDecoratorConfig<EntityType>);
|
|
11
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityClassNewable } from '../../classes/entity.model';
|
|
2
2
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
3
3
|
/**
|
|
4
4
|
* Definition for the @object metadata.
|
|
5
5
|
*/
|
|
6
|
-
declare abstract class ObjectDecoratorConfig<EntityType extends
|
|
6
|
+
declare abstract class ObjectDecoratorConfig<EntityType extends object> extends PropertyDecoratorConfig {
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The class of the object. Is used to call the constructor so that all metadata is initialized.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
EntityClass: EntityClassNewable<EntityType>;
|
|
11
11
|
/**
|
|
12
12
|
* How to display the object.
|
|
13
13
|
*
|
|
@@ -19,7 +19,7 @@ declare abstract class ObjectDecoratorConfig<EntityType extends Entity> extends
|
|
|
19
19
|
/**
|
|
20
20
|
* The configuration options for a object property.
|
|
21
21
|
*/
|
|
22
|
-
export interface DefaultObjectDecoratorConfig<EntityType extends
|
|
22
|
+
export interface DefaultObjectDecoratorConfig<EntityType extends object> extends ObjectDecoratorConfig<EntityType> {
|
|
23
23
|
displayStyle: 'inline';
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Entity } from '../../classes/entity-model.class';
|
|
2
1
|
import { DefaultObjectDecoratorConfig } from './object-decorator.data';
|
|
3
2
|
/**
|
|
4
3
|
* Decorator for setting and getting object property metadata.
|
|
@@ -6,4 +5,4 @@ import { DefaultObjectDecoratorConfig } from './object-decorator.data';
|
|
|
6
5
|
* @param metadata - The metadata of the object property.
|
|
7
6
|
* @returns The method that defines the metadata.
|
|
8
7
|
*/
|
|
9
|
-
export declare function object<EntityType extends
|
|
8
|
+
export declare function object<EntityType extends object>(metadata: DefaultObjectDecoratorConfig<EntityType>): (target: object, propertyKey: string) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
1
2
|
import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
|
|
2
3
|
import { AutocompleteStringDecoratorConfig, DefaultStringDecoratorConfig, DropdownStringDecoratorConfig, TextboxStringDecoratorConfig } from './string-decorator.data';
|
|
3
4
|
/**
|
|
@@ -5,10 +6,7 @@ import { AutocompleteStringDecoratorConfig, DefaultStringDecoratorConfig, Dropdo
|
|
|
5
6
|
*/
|
|
6
7
|
export declare class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DropdownStringDecoratorConfig {
|
|
7
8
|
displayStyle: 'dropdown';
|
|
8
|
-
dropdownValues:
|
|
9
|
-
displayName: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}[];
|
|
9
|
+
dropdownValues: DropdownValue<string>[];
|
|
12
10
|
constructor(data: DropdownStringDecoratorConfig);
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DropdownValue } from '../base/dropdown-value.interface';
|
|
1
2
|
import { PropertyDecoratorConfig } from '../base/property-decorator.data';
|
|
2
3
|
/**
|
|
3
4
|
* Definition for the @string metadata.
|
|
@@ -17,10 +18,7 @@ export interface DropdownStringDecoratorConfig extends StringDecoratorConfig {
|
|
|
17
18
|
* The values of the dropdown, consisting of a name to display and the actual value
|
|
18
19
|
* Can also receive a function to determine the values.
|
|
19
20
|
*/
|
|
20
|
-
dropdownValues:
|
|
21
|
-
displayName: string;
|
|
22
|
-
value: string;
|
|
23
|
-
}[];
|
|
21
|
+
dropdownValues: DropdownValue<string>[];
|
|
24
22
|
}
|
|
25
23
|
/**
|
|
26
24
|
* The configuration options for a string property displayed in a default text input.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The abstract BaseBuilder class.
|
|
3
|
+
*/
|
|
4
|
+
export class BaseBuilder {
|
|
5
|
+
constructor(data) {
|
|
6
|
+
this.validateInput(data);
|
|
7
|
+
this.inputData = data;
|
|
8
|
+
this.data = this.generateBaseData(data);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Used to validate the user input in the constructor.
|
|
13
|
+
*
|
|
14
|
+
* @param data - The user input.
|
|
15
|
+
*/
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
+
validateInput(data) {
|
|
18
|
+
// By default, no validation is done
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the value for the given key if no user value was provided.
|
|
23
|
+
*
|
|
24
|
+
* @param key - The key to set the default value for.
|
|
25
|
+
* @param value - The value to set when nothing was provided.
|
|
26
|
+
* @returns The Builder.
|
|
27
|
+
*/
|
|
28
|
+
withDefault(key, value) {
|
|
29
|
+
if (!this.inputData || !this.inputData[key]) {
|
|
30
|
+
this.data[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Method used to get the final build value after applying all chaining.
|
|
36
|
+
*
|
|
37
|
+
* @returns The build value.
|
|
38
|
+
*/
|
|
39
|
+
getResult() {
|
|
40
|
+
return this.data;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS5idWlsZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hdGVyaWFsLWVudGl0eS9zcmMvY2xhc3Nlcy9iYXNlLmJ1aWxkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0E7O0dBRUc7QUFDSCxNQUFNLE9BQWdCLFdBQVc7SUFLN0IsWUFBc0IsSUFBZ0I7UUFDbEMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUN6QixJQUFJLENBQUMs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