ngx-material-entity 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CONTRIBUTING.md +7 -1
  2. package/README.md +536 -328
  3. package/classes/base.builder.d.ts +35 -0
  4. package/classes/date.utilities.d.ts +58 -0
  5. package/classes/entity.model.d.ts +13 -0
  6. package/classes/{entity-service.class.d.ts → entity.service.d.ts} +35 -20
  7. package/classes/entity.utilities.d.ts +153 -0
  8. package/components/confirm-dialog/confirm-dialog-data.builder.d.ts +23 -0
  9. package/components/confirm-dialog/confirm-dialog-data.d.ts +18 -8
  10. package/components/confirm-dialog/confirm-dialog.component.d.ts +15 -5
  11. package/components/get-validation-error-message.function.d.ts +3 -2
  12. package/components/input/add-array-item-dialog-data.builder.d.ts +20 -0
  13. package/components/input/add-array-item-dialog-data.d.ts +19 -0
  14. package/components/input/input.component.d.ts +151 -30
  15. package/components/input/input.module.d.ts +7 -4
  16. package/components/table/create-dialog/create-dialog-data.builder.d.ts +21 -0
  17. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +21 -0
  18. package/components/table/create-dialog/create-entity-dialog-data.d.ts +4 -5
  19. package/components/table/create-dialog/create-entity-dialog.component.d.ts +21 -8
  20. package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +24 -0
  21. package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +7 -8
  22. package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +22 -0
  23. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +25 -8
  24. package/components/table/table-data.builder.d.ts +51 -0
  25. package/components/table/table-data.d.ts +46 -30
  26. package/components/table/table.component.d.ts +53 -7
  27. package/components/table/table.module.d.ts +3 -1
  28. package/decorators/array/array-decorator-internal.data.d.ts +45 -0
  29. package/decorators/array/array-decorator.data.d.ts +129 -0
  30. package/decorators/array/array.decorator.d.ts +9 -0
  31. package/decorators/base/base-property.decorator.d.ts +7 -6
  32. package/decorators/base/decorator-types.enum.d.ts +12 -9
  33. package/decorators/base/dropdown-value.interface.d.ts +14 -0
  34. package/decorators/base/property-decorator-internal.data.d.ts +24 -0
  35. package/decorators/base/property-decorator.data.d.ts +70 -0
  36. package/decorators/boolean/boolean-decorator-internal.data.d.ts +25 -0
  37. package/decorators/boolean/boolean-decorator.data.d.ts +37 -0
  38. package/decorators/boolean/boolean.decorator.d.ts +8 -0
  39. package/decorators/date/date-decorator-internal.data.d.ts +44 -0
  40. package/decorators/date/date-decorator.data.d.ts +129 -0
  41. package/decorators/number/number-decorator-internal.data.d.ts +20 -0
  42. package/decorators/number/number-decorator.data.d.ts +36 -0
  43. package/decorators/number/number.decorator.d.ts +8 -0
  44. package/decorators/object/object-decorator-internal.data.d.ts +11 -0
  45. package/decorators/object/object-decorator.data.d.ts +25 -0
  46. package/decorators/object/object.decorator.d.ts +8 -0
  47. package/decorators/string/string-decorator-internal.data.d.ts +41 -0
  48. package/decorators/string/string-decorator.data.d.ts +77 -0
  49. package/decorators/string/string.decorator.d.ts +8 -0
  50. package/esm2020/classes/base.builder.mjs +43 -0
  51. package/esm2020/classes/date.utilities.mjs +138 -0
  52. package/esm2020/classes/entity.model.mjs +19 -0
  53. package/esm2020/classes/entity.service.mjs +83 -0
  54. package/esm2020/classes/entity.utilities.mjs +538 -0
  55. package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +44 -0
  56. package/esm2020/components/confirm-dialog/confirm-dialog-data.mjs +1 -1
  57. package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +18 -22
  58. package/esm2020/components/get-validation-error-message.function.mjs +8 -3
  59. package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +30 -0
  60. package/esm2020/components/input/add-array-item-dialog-data.mjs +2 -0
  61. package/esm2020/components/input/input.component.mjs +240 -36
  62. package/esm2020/components/input/input.module.mjs +23 -9
  63. package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +32 -0
  64. package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +26 -0
  65. package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
  66. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +31 -31
  67. package/esm2020/components/table/create-dialog/create-entity-dialog.module.mjs +20 -4
  68. package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +41 -0
  69. package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
  70. package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +27 -0
  71. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +45 -49
  72. package/esm2020/components/table/table-data.builder.mjs +105 -0
  73. package/esm2020/components/table/table-data.mjs +1 -1
  74. package/esm2020/components/table/table.component.mjs +91 -83
  75. package/esm2020/components/table/table.module.mjs +12 -4
  76. package/esm2020/decorators/array/array-decorator-internal.data.mjs +51 -0
  77. package/esm2020/decorators/array/array-decorator.data.mjs +7 -0
  78. package/esm2020/decorators/array/array.decorator.mjs +24 -0
  79. package/esm2020/decorators/base/base-property.decorator.mjs +6 -5
  80. package/esm2020/decorators/base/decorator-types.enum.mjs +4 -1
  81. package/esm2020/decorators/base/dropdown-value.interface.mjs +2 -0
  82. package/esm2020/decorators/base/property-decorator-internal.data.mjs +38 -0
  83. package/esm2020/decorators/base/property-decorator.data.mjs +6 -0
  84. package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +33 -0
  85. package/esm2020/decorators/boolean/boolean-decorator.data.mjs +7 -0
  86. package/esm2020/decorators/boolean/boolean.decorator.mjs +21 -0
  87. package/esm2020/decorators/date/date-decorator-internal.data.mjs +48 -0
  88. package/esm2020/decorators/date/date-decorator.data.mjs +7 -0
  89. package/esm2020/decorators/number/number-decorator-internal.data.mjs +23 -0
  90. package/esm2020/decorators/number/number-decorator.data.mjs +7 -0
  91. package/esm2020/decorators/number/number.decorator.mjs +18 -0
  92. package/esm2020/decorators/object/object-decorator-internal.data.mjs +12 -0
  93. package/esm2020/decorators/object/object-decorator.data.mjs +7 -0
  94. package/esm2020/decorators/object/object.decorator.mjs +13 -0
  95. package/esm2020/decorators/string/string-decorator-internal.data.mjs +48 -0
  96. package/esm2020/decorators/string/string-decorator.data.mjs +7 -0
  97. package/esm2020/decorators/string/string.decorator.mjs +24 -0
  98. package/esm2020/public-api.mjs +20 -13
  99. package/fesm2015/ngx-material-entity.mjs +1664 -944
  100. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  101. package/fesm2020/ngx-material-entity.mjs +1667 -941
  102. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  103. package/package.json +7 -1
  104. package/public-api.d.ts +21 -10
  105. package/classes/entity-model.class.d.ts +0 -9
  106. package/classes/entity-utilities.class.d.ts +0 -95
  107. package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.d.ts +0 -35
  108. package/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.d.ts +0 -12
  109. package/components/input/array-table/array-table.component.d.ts +0 -34
  110. package/components/input/array-table/array-table.module.d.ts +0 -19
  111. package/components/input/internal-input/internal-input.component.d.ts +0 -57
  112. package/components/input/internal-input/internal-input.module.d.ts +0 -16
  113. package/decorators/array.decorator.d.ts +0 -125
  114. package/decorators/base/property-decorator-config.interface.d.ts +0 -50
  115. package/decorators/boolean.decorator.d.ts +0 -42
  116. package/decorators/number.decorator.d.ts +0 -40
  117. package/decorators/object.decorator.d.ts +0 -27
  118. package/decorators/string.decorator.d.ts +0 -76
  119. package/esm2020/classes/entity-model.class.mjs +0 -19
  120. package/esm2020/classes/entity-service.class.mjs +0 -70
  121. package/esm2020/classes/entity-utilities.class.mjs +0 -296
  122. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.component.mjs +0 -43
  123. package/esm2020/components/input/array-table/add-array-item-dialog/add-array-item-dialog.module.mjs +0 -22
  124. package/esm2020/components/input/array-table/array-table.component.mjs +0 -116
  125. package/esm2020/components/input/array-table/array-table.module.mjs +0 -66
  126. package/esm2020/components/input/internal-input/internal-input.component.mjs +0 -73
  127. package/esm2020/components/input/internal-input/internal-input.module.mjs +0 -54
  128. package/esm2020/decorators/array.decorator.mjs +0 -70
  129. package/esm2020/decorators/base/property-decorator-config.interface.mjs +0 -31
  130. package/esm2020/decorators/boolean.decorator.mjs +0 -44
  131. package/esm2020/decorators/number.decorator.mjs +0 -36
  132. package/esm2020/decorators/object.decorator.mjs +0 -23
  133. package/esm2020/decorators/string.decorator.mjs +0 -61
@@ -0,0 +1,37 @@
1
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
2
+ /**
3
+ * The Definition for the @boolean metadata.
4
+ */
5
+ declare abstract class BooleanDecoratorConfig extends PropertyDecoratorConfig {
6
+ /**
7
+ * Whether to display the booleans as a checkbox, a toggle button or as a dropdown.
8
+ */
9
+ displayStyle: 'checkbox' | 'dropdown' | 'toggle';
10
+ }
11
+ /**
12
+ * The configuration options for a boolean property displayed in a dropdown.
13
+ */
14
+ export interface DropdownBooleanDecoratorConfig extends BooleanDecoratorConfig {
15
+ displayStyle: 'dropdown';
16
+ /**
17
+ * The name of the true value if displayStyle dropdown is used.
18
+ */
19
+ dropdownTrue: string;
20
+ /**
21
+ * The name of the false value if displayStyle dropdown is used.
22
+ */
23
+ dropdownFalse: string;
24
+ }
25
+ /**
26
+ * The configuration options for a boolean property displayed as a checkbox.
27
+ */
28
+ export interface CheckboxBooleanDecoratorConfig extends BooleanDecoratorConfig {
29
+ displayStyle: 'checkbox';
30
+ }
31
+ /**
32
+ * The configuration options for a boolean property displayed as a mat-toggle.
33
+ */
34
+ export interface ToggleBooleanDecoratorConfig extends BooleanDecoratorConfig {
35
+ displayStyle: 'toggle';
36
+ }
37
+ export {};
@@ -0,0 +1,8 @@
1
+ import { CheckboxBooleanDecoratorConfig, DropdownBooleanDecoratorConfig, ToggleBooleanDecoratorConfig } from './boolean-decorator.data';
2
+ /**
3
+ * Decorator for setting and getting boolean property metadata.
4
+ *
5
+ * @param metadata - The metadata of the boolean property.
6
+ * @returns The method that defines the metadata.
7
+ */
8
+ export declare function boolean(metadata: CheckboxBooleanDecoratorConfig | ToggleBooleanDecoratorConfig | DropdownBooleanDecoratorConfig): (target: object, propertyKey: string) => void;
@@ -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 {};
@@ -0,0 +1,20 @@
1
+ import { DropdownValue } from '../base/dropdown-value.interface';
2
+ import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
3
+ import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig } from './number-decorator.data';
4
+ /**
5
+ * The internal DefaultNumberDecoratorConfig. Sets default values.
6
+ */
7
+ export declare class DefaultNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DefaultNumberDecoratorConfig {
8
+ displayStyle: 'line';
9
+ min?: number;
10
+ max?: number;
11
+ constructor(data: DefaultNumberDecoratorConfig);
12
+ }
13
+ /**
14
+ * The internal DropdownNumberDecoratorConfig. Sets default values.
15
+ */
16
+ export declare class DropdownNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DropdownNumberDecoratorConfig {
17
+ displayStyle: 'dropdown';
18
+ dropdownValues: DropdownValue<number>[];
19
+ constructor(data: DropdownNumberDecoratorConfig);
20
+ }
@@ -0,0 +1,36 @@
1
+ import { DropdownValue } from '../base/dropdown-value.interface';
2
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
3
+ /**
4
+ * Definition for the @number metadata.
5
+ */
6
+ declare abstract class NumberDecoratorConfig extends PropertyDecoratorConfig {
7
+ /**
8
+ * Whether to display the number in a single line or as a dropdown.
9
+ */
10
+ displayStyle: 'line' | 'dropdown';
11
+ }
12
+ /**
13
+ * The configuration options for a number property displayed in a default number input.
14
+ */
15
+ export interface DefaultNumberDecoratorConfig extends NumberDecoratorConfig {
16
+ displayStyle: 'line';
17
+ /**
18
+ * The minimum value of the number.
19
+ */
20
+ min?: number;
21
+ /**
22
+ * The maximum value of the number.
23
+ */
24
+ max?: number;
25
+ }
26
+ /**
27
+ * The configuration options for a number property displayed in a dropdown.
28
+ */
29
+ export interface DropdownNumberDecoratorConfig extends NumberDecoratorConfig {
30
+ displayStyle: 'dropdown';
31
+ /**
32
+ * The values of the dropdown, consisting of a name to display and the actual value.
33
+ */
34
+ dropdownValues: DropdownValue<number>[];
35
+ }
36
+ export {};
@@ -0,0 +1,8 @@
1
+ import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig } from './number-decorator.data';
2
+ /**
3
+ * Decorator for setting and getting number property metadata.
4
+ *
5
+ * @param metadata - The metadata of the number property.
6
+ * @returns The method that defines the metadata.
7
+ */
8
+ export declare function number(metadata: DefaultNumberDecoratorConfig | DropdownNumberDecoratorConfig): (target: object, propertyKey: string) => void;
@@ -0,0 +1,11 @@
1
+ import { EntityClassNewable } from '../../classes/entity.model';
2
+ import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
3
+ import { DefaultObjectDecoratorConfig } from './object-decorator.data';
4
+ /**
5
+ * The internal DefaultObjectDecoratorConfig. Sets default values.
6
+ */
7
+ export declare class DefaultObjectDecoratorConfigInternal<EntityType extends object> extends PropertyDecoratorConfigInternal implements DefaultObjectDecoratorConfig<EntityType> {
8
+ displayStyle: 'inline';
9
+ EntityClass: EntityClassNewable<EntityType>;
10
+ constructor(data: DefaultObjectDecoratorConfig<EntityType>);
11
+ }
@@ -0,0 +1,25 @@
1
+ import { EntityClassNewable } from '../../classes/entity.model';
2
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
3
+ /**
4
+ * Definition for the @object metadata.
5
+ */
6
+ declare abstract class ObjectDecoratorConfig<EntityType extends object> extends PropertyDecoratorConfig {
7
+ /**
8
+ * The class of the object. Is used to call the constructor so that all metadata is initialized.
9
+ */
10
+ EntityClass: EntityClassNewable<EntityType>;
11
+ /**
12
+ * How to display the object.
13
+ *
14
+ * The objects properties are added as input fields in an section of the entity.
15
+ * Useful if the object only contains a few properties (e.g. A address on a user).
16
+ */
17
+ displayStyle: 'inline';
18
+ }
19
+ /**
20
+ * The configuration options for a object property.
21
+ */
22
+ export interface DefaultObjectDecoratorConfig<EntityType extends object> extends ObjectDecoratorConfig<EntityType> {
23
+ displayStyle: 'inline';
24
+ }
25
+ export {};
@@ -0,0 +1,8 @@
1
+ import { DefaultObjectDecoratorConfig } from './object-decorator.data';
2
+ /**
3
+ * Decorator for setting and getting object property metadata.
4
+ *
5
+ * @param metadata - The metadata of the object property.
6
+ * @returns The method that defines the metadata.
7
+ */
8
+ export declare function object<EntityType extends object>(metadata: DefaultObjectDecoratorConfig<EntityType>): (target: object, propertyKey: string) => void;
@@ -0,0 +1,41 @@
1
+ import { DropdownValue } from '../base/dropdown-value.interface';
2
+ import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
3
+ import { AutocompleteStringDecoratorConfig, DefaultStringDecoratorConfig, DropdownStringDecoratorConfig, TextboxStringDecoratorConfig } from './string-decorator.data';
4
+ /**
5
+ * The internal DropdownStringDecoratorConfig. Sets default values.
6
+ */
7
+ export declare class DropdownStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DropdownStringDecoratorConfig {
8
+ displayStyle: 'dropdown';
9
+ dropdownValues: DropdownValue<string>[];
10
+ constructor(data: DropdownStringDecoratorConfig);
11
+ }
12
+ /**
13
+ * The internal DefaultStringDecoratorConfig. Sets default values.
14
+ */
15
+ export declare class DefaultStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DefaultStringDecoratorConfig {
16
+ displayStyle: 'line';
17
+ minLength?: number;
18
+ maxLength?: number;
19
+ regex?: RegExp;
20
+ constructor(data: DefaultStringDecoratorConfig);
21
+ }
22
+ /**
23
+ * The internal TextboxStringDecoratorConfig. Sets default values.
24
+ */
25
+ export declare class TextboxStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements TextboxStringDecoratorConfig {
26
+ displayStyle: 'textbox';
27
+ minLength?: number;
28
+ maxLength?: number;
29
+ constructor(data: TextboxStringDecoratorConfig);
30
+ }
31
+ /**
32
+ * The internal AutocompleteStringDecoratorConfig. Sets default values.
33
+ */
34
+ export declare class AutocompleteStringDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements AutocompleteStringDecoratorConfig {
35
+ displayStyle: 'autocomplete';
36
+ autocompleteValues: string[];
37
+ minLength?: number;
38
+ maxLength?: number;
39
+ regex?: RegExp;
40
+ constructor(data: AutocompleteStringDecoratorConfig);
41
+ }
@@ -0,0 +1,77 @@
1
+ import { DropdownValue } from '../base/dropdown-value.interface';
2
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
3
+ /**
4
+ * Definition for the @string metadata.
5
+ */
6
+ declare abstract class StringDecoratorConfig extends PropertyDecoratorConfig {
7
+ /**
8
+ * How to display the string.
9
+ */
10
+ displayStyle: 'line' | 'textbox' | 'autocomplete' | 'dropdown';
11
+ }
12
+ /**
13
+ * The configuration options for a string property displayed as a dropdown.
14
+ */
15
+ export interface DropdownStringDecoratorConfig extends StringDecoratorConfig {
16
+ displayStyle: 'dropdown';
17
+ /**
18
+ * The values of the dropdown, consisting of a name to display and the actual value
19
+ * Can also receive a function to determine the values.
20
+ */
21
+ dropdownValues: DropdownValue<string>[];
22
+ }
23
+ /**
24
+ * The configuration options for a string property displayed in a default text input.
25
+ */
26
+ export interface DefaultStringDecoratorConfig extends StringDecoratorConfig {
27
+ displayStyle: 'line';
28
+ /**
29
+ * The minimum required length of the string.
30
+ */
31
+ minLength?: number;
32
+ /**
33
+ * The maximum required length of the string.
34
+ */
35
+ maxLength?: number;
36
+ /**
37
+ * A regex used for validation.
38
+ */
39
+ regex?: RegExp;
40
+ }
41
+ /**
42
+ * The configuration options for a string property displayed in a textbox input.
43
+ */
44
+ export interface TextboxStringDecoratorConfig extends StringDecoratorConfig {
45
+ displayStyle: 'textbox';
46
+ /**
47
+ * The minimum required length of the string.
48
+ */
49
+ minLength?: number;
50
+ /**
51
+ * The maximum required length of the string.
52
+ */
53
+ maxLength?: number;
54
+ }
55
+ /**
56
+ * The configuration options for a string property displayed in a mat-autocomplete input.
57
+ */
58
+ export interface AutocompleteStringDecoratorConfig extends StringDecoratorConfig {
59
+ displayStyle: 'autocomplete';
60
+ /**
61
+ * The autocomplete values.
62
+ */
63
+ autocompleteValues: string[];
64
+ /**
65
+ * The minimum required length of the string.
66
+ */
67
+ minLength?: number;
68
+ /**
69
+ * The maximum required length of the string.
70
+ */
71
+ maxLength?: number;
72
+ /**
73
+ * A regex used for validation.
74
+ */
75
+ regex?: RegExp;
76
+ }
77
+ export {};
@@ -0,0 +1,8 @@
1
+ import { AutocompleteStringDecoratorConfig, DefaultStringDecoratorConfig, DropdownStringDecoratorConfig, TextboxStringDecoratorConfig } from './string-decorator.data';
2
+ /**
3
+ * Decorator for setting and getting string Property metadata.
4
+ *
5
+ * @param metadata - The metadata of the string property.
6
+ * @returns The method that defines the metadata.
7
+ */
8
+ export declare function string(metadata: DropdownStringDecoratorConfig | AutocompleteStringDecoratorConfig | DefaultStringDecoratorConfig | TextboxStringDecoratorConfig): (target: object, propertyKey: string) => void;
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS5idWlsZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hdGVyaWFsLWVudGl0eS9zcmMvY2xhc3Nl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