ngx-material-entity 0.1.4 → 1.0.5

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 (156) hide show
  1. package/README.md +416 -39
  2. package/capsulation/lodash.utilities.d.ts +62 -0
  3. package/capsulation/reflect.utilities.d.ts +56 -0
  4. package/classes/base.builder.d.ts +2 -1
  5. package/classes/date.utilities.d.ts +18 -6
  6. package/classes/entity.model.d.ts +9 -2
  7. package/classes/entity.service.d.ts +38 -1
  8. package/classes/entity.utilities.d.ts +45 -16
  9. package/classes/file.utilities.d.ts +52 -0
  10. package/components/input/add-array-item-dialog-data.builder.d.ts +3 -2
  11. package/components/input/add-array-item-dialog-data.d.ts +2 -1
  12. package/components/input/array/array-date-input/array-date-input.component.d.ts +11 -0
  13. package/components/input/array/array-date-range-input/array-date-range-input.component.d.ts +20 -0
  14. package/components/input/array/array-date-time-input/array-date-time-input.component.d.ts +22 -0
  15. package/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.d.ts +50 -0
  16. package/components/input/array/array-string-chips-input/array-string-chips-input.component.d.ts +42 -0
  17. package/components/input/array/array-table.class.d.ts +48 -0
  18. package/components/input/base-input.component.d.ts +57 -0
  19. package/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.d.ts +10 -0
  20. package/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.d.ts +9 -0
  21. package/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.d.ts +10 -0
  22. package/components/input/custom/custom.component.d.ts +13 -0
  23. package/components/input/date/date-input/date-input.component.d.ts +11 -0
  24. package/components/input/date/date-range-input/date-range-input.component.d.ts +19 -0
  25. package/components/input/date/date-time-input/date-time-input.component.d.ts +30 -0
  26. package/components/input/file/file-default-input/file-default-input.component.d.ts +13 -0
  27. package/components/input/file/file-image-input/file-image-input.component.d.ts +22 -0
  28. package/components/input/file/file-input/dragDrop.directive.d.ts +32 -0
  29. package/components/input/file/file-input/file-input.component.d.ts +33 -0
  30. package/components/input/input.component.d.ts +49 -92
  31. package/components/input/input.module.d.ts +41 -16
  32. package/components/input/number/number-dropdown-input/number-dropdown-input.component.d.ts +9 -0
  33. package/components/input/number/number-input/number-input.component.d.ts +9 -0
  34. package/components/input/number/number-slider-input/number-slider-input.component.d.ts +9 -0
  35. package/components/input/string/string-autocomplete-input/string-autocomplete-input.component.d.ts +18 -0
  36. package/components/input/string/string-dropdown-input/string-dropdown-input.component.d.ts +9 -0
  37. package/components/input/string/string-input/string-input.component.d.ts +9 -0
  38. package/components/input/string/string-password-input/string-password-input.component.d.ts +15 -0
  39. package/components/input/string/string-textbox-input/string-textbox-input.component.d.ts +9 -0
  40. package/components/table/create-dialog/create-entity-dialog-data.builder.d.ts +3 -2
  41. package/components/table/create-dialog/create-entity-dialog-data.d.ts +2 -1
  42. package/components/table/create-dialog/create-entity-dialog.component.d.ts +7 -2
  43. package/components/table/edit-dialog/edit-dialog-data.builder.d.ts +3 -2
  44. package/components/table/edit-dialog/edit-entity-dialog-data.d.ts +6 -1
  45. package/components/table/edit-dialog/edit-entity-dialog.builder.d.ts +5 -3
  46. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +6 -2
  47. package/components/table/table-data.builder.d.ts +9 -8
  48. package/components/table/table-data.d.ts +18 -10
  49. package/components/table/table.component.d.ts +2 -1
  50. package/decorators/array/array-decorator-internal.data.d.ts +71 -6
  51. package/decorators/array/array-decorator.data.d.ts +178 -12
  52. package/decorators/array/array.decorator.d.ts +3 -2
  53. package/decorators/base/base-property.decorator.d.ts +2 -3
  54. package/decorators/base/decorator-types.enum.d.ts +15 -5
  55. package/decorators/custom/custom-decorator-internal.data.d.ts +17 -0
  56. package/decorators/custom/custom-decorator.data.d.ts +37 -0
  57. package/decorators/custom/custom.decorator.d.ts +11 -0
  58. package/decorators/date/date-decorator-internal.data.d.ts +2 -2
  59. package/decorators/date/date.decorator.d.ts +8 -0
  60. package/decorators/file/file-decorator-internal.data.d.ts +92 -0
  61. package/decorators/file/file-decorator.data.d.ts +92 -0
  62. package/decorators/file/file.decorator.d.ts +9 -0
  63. package/decorators/number/number-decorator-internal.data.d.ts +20 -1
  64. package/decorators/number/number-decorator.data.d.ts +27 -1
  65. package/decorators/number/number.decorator.d.ts +2 -2
  66. package/decorators/object/object-decorator-internal.data.d.ts +2 -2
  67. package/decorators/object/object-decorator.data.d.ts +3 -3
  68. package/decorators/object/object.decorator.d.ts +2 -1
  69. package/decorators/string/string-decorator-internal.data.d.ts +14 -1
  70. package/decorators/string/string-decorator.data.d.ts +37 -1
  71. package/decorators/string/string.decorator.d.ts +2 -2
  72. package/esm2020/capsulation/lodash.utilities.mjs +75 -0
  73. package/esm2020/capsulation/reflect.utilities.mjs +69 -0
  74. package/esm2020/classes/base.builder.mjs +2 -3
  75. package/esm2020/classes/date.utilities.mjs +35 -15
  76. package/esm2020/classes/entity.model.mjs +5 -1
  77. package/esm2020/classes/entity.service.mjs +103 -6
  78. package/esm2020/classes/entity.utilities.mjs +241 -71
  79. package/esm2020/classes/file.utilities.mjs +124 -0
  80. package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +4 -4
  81. package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +3 -3
  82. package/esm2020/components/input/add-array-item-dialog-data.builder.mjs +2 -2
  83. package/esm2020/components/input/add-array-item-dialog-data.mjs +1 -1
  84. package/esm2020/components/input/array/array-date-input/array-date-input.component.mjs +26 -0
  85. package/esm2020/components/input/array/array-date-range-input/array-date-range-input.component.mjs +50 -0
  86. package/esm2020/components/input/array/array-date-time-input/array-date-time-input.component.mjs +50 -0
  87. package/esm2020/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +103 -0
  88. package/esm2020/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +85 -0
  89. package/esm2020/components/input/array/array-table.class.mjs +104 -0
  90. package/esm2020/components/input/base-input.component.mjs +65 -0
  91. package/esm2020/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.mjs +21 -0
  92. package/esm2020/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.mjs +17 -0
  93. package/esm2020/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.mjs +21 -0
  94. package/esm2020/components/input/custom/custom.component.mjs +26 -0
  95. package/esm2020/components/input/date/date-input/date-input.component.mjs +22 -0
  96. package/esm2020/components/input/date/date-range-input/date-range-input.component.mjs +51 -0
  97. package/esm2020/components/input/date/date-time-input/date-time-input.component.mjs +63 -0
  98. package/esm2020/components/input/file/file-default-input/file-default-input.component.mjs +23 -0
  99. package/esm2020/components/input/file/file-image-input/file-image-input.component.mjs +84 -0
  100. package/esm2020/components/input/file/file-input/dragDrop.directive.mjs +64 -0
  101. package/esm2020/components/input/file/file-input/file-input.component.mjs +154 -0
  102. package/esm2020/components/input/input.component.mjs +137 -236
  103. package/esm2020/components/input/input.module.mjs +82 -6
  104. package/esm2020/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +18 -0
  105. package/esm2020/components/input/number/number-input/number-input.component.mjs +16 -0
  106. package/esm2020/components/input/number/number-slider-input/number-slider-input.component.mjs +17 -0
  107. package/esm2020/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +35 -0
  108. package/esm2020/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +18 -0
  109. package/esm2020/components/input/string/string-input/string-input.component.mjs +16 -0
  110. package/esm2020/components/input/string/string-password-input/string-password-input.component.mjs +36 -0
  111. package/esm2020/components/input/string/string-textbox-input/string-textbox-input.component.mjs +17 -0
  112. package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +2 -2
  113. package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +1 -1
  114. package/esm2020/components/table/create-dialog/create-entity-dialog-data.mjs +1 -1
  115. package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +15 -8
  116. package/esm2020/components/table/edit-dialog/edit-dialog-data.builder.mjs +2 -2
  117. package/esm2020/components/table/edit-dialog/edit-entity-dialog-data.mjs +1 -1
  118. package/esm2020/components/table/edit-dialog/edit-entity-dialog.builder.mjs +4 -3
  119. package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +19 -10
  120. package/esm2020/components/table/table-data.builder.mjs +13 -10
  121. package/esm2020/components/table/table-data.mjs +1 -1
  122. package/esm2020/components/table/table.component.mjs +35 -35
  123. package/esm2020/decorators/array/array-decorator-internal.data.mjs +102 -14
  124. package/esm2020/decorators/array/array-decorator.data.mjs +2 -2
  125. package/esm2020/decorators/array/array.decorator.mjs +8 -2
  126. package/esm2020/decorators/base/base-property.decorator.mjs +4 -3
  127. package/esm2020/decorators/base/decorator-types.enum.mjs +9 -1
  128. package/esm2020/decorators/base/property-decorator-internal.data.mjs +10 -10
  129. package/esm2020/decorators/base/property-decorator.data.mjs +1 -1
  130. package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +3 -3
  131. package/esm2020/decorators/custom/custom-decorator-internal.data.mjs +26 -0
  132. package/esm2020/decorators/custom/custom-decorator.data.mjs +2 -0
  133. package/esm2020/decorators/custom/custom.decorator.mjs +13 -0
  134. package/esm2020/decorators/date/date-decorator-internal.data.mjs +5 -5
  135. package/esm2020/decorators/date/date.decorator.mjs +21 -0
  136. package/esm2020/decorators/file/file-decorator-internal.data.mjs +98 -0
  137. package/esm2020/decorators/file/file-decorator.data.mjs +7 -0
  138. package/esm2020/decorators/file/file.decorator.mjs +22 -0
  139. package/esm2020/decorators/number/number-decorator-internal.data.mjs +24 -1
  140. package/esm2020/decorators/number/number-decorator.data.mjs +1 -1
  141. package/esm2020/decorators/number/number.decorator.mjs +9 -7
  142. package/esm2020/decorators/object/object-decorator-internal.data.mjs +1 -1
  143. package/esm2020/decorators/object/object-decorator.data.mjs +1 -1
  144. package/esm2020/decorators/object/object.decorator.mjs +1 -1
  145. package/esm2020/decorators/string/string-decorator-internal.data.mjs +16 -1
  146. package/esm2020/decorators/string/string-decorator.data.mjs +1 -1
  147. package/esm2020/decorators/string/string.decorator.mjs +13 -13
  148. package/esm2020/mocks/placeholder-data.png.mjs +3 -0
  149. package/esm2020/public-api.mjs +9 -1
  150. package/fesm2015/ngx-material-entity.mjs +2488 -524
  151. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  152. package/fesm2020/ngx-material-entity.mjs +2363 -493
  153. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  154. package/mocks/placeholder-data.png.d.ts +1 -0
  155. package/package.json +1 -1
  156. package/public-api.d.ts +8 -0
@@ -1,11 +1,16 @@
1
1
  import { CreateDialogData } from '../../components/table/table-data';
2
- import { EntityClassNewable } from '../../classes/entity.model';
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';
5
+ import { DateFilterFn } from '@angular/material/datepicker';
6
+ import { Time } from '@angular/common';
7
+ import { DropdownValue } from '../base/dropdown-value.interface';
8
+ import { DateRange } from '../date/date-decorator.data';
9
+ import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
5
10
  /**
6
11
  * The configuration options for an array property displayed as a table.
7
12
  */
8
- export interface ArrayTableDisplayColumn<EntityType extends object> {
13
+ export interface ArrayTableDisplayColumn<EntityType extends BaseEntityType<EntityType>> {
9
14
  /**
10
15
  * The name inside the header.
11
16
  */
@@ -18,22 +23,27 @@ export interface ArrayTableDisplayColumn<EntityType extends object> {
18
23
  /**
19
24
  * Interface definition for the @array metadata.
20
25
  */
21
- declare abstract class ArrayDecoratorConfig extends PropertyDecoratorConfig {
22
- /**
23
- * How to display the string.
24
- */
25
- displayStyle: 'table' | 'chips';
26
+ export declare abstract class ArrayDecoratorConfig extends PropertyDecoratorConfig {
26
27
  /**
27
28
  * The type of the items inside the array.
28
29
  */
29
30
  itemType: DecoratorTypes;
31
+ /**
32
+ * Whether or not duplicate values are allowed inside the array.
33
+ *
34
+ * @default false
35
+ */
36
+ allowDuplicates?: boolean;
37
+ /**
38
+ * The error dialog to display when the user tries to add a duplicate entry.
39
+ */
40
+ duplicatesErrorDialog?: ConfirmDialogData;
30
41
  }
31
42
  /**
32
43
  * Definition for an array of Entities.
33
44
  */
34
- export interface EntityArrayDecoratorConfig<EntityType extends object> extends ArrayDecoratorConfig {
45
+ export interface EntityArrayDecoratorConfig<EntityType extends BaseEntityType<EntityType>> extends ArrayDecoratorConfig {
35
46
  itemType: DecoratorTypes.OBJECT;
36
- displayStyle: 'table';
37
47
  /**
38
48
  * The EntityClass used for generating the create inputs.
39
49
  */
@@ -72,12 +82,170 @@ export interface EntityArrayDecoratorConfig<EntityType extends object> extends A
72
82
  */
73
83
  missingErrorMessage?: string;
74
84
  }
85
+ /**
86
+ * Definition for an array of Dates.
87
+ */
88
+ export interface DateArrayDecoratorConfig extends ArrayDecoratorConfig {
89
+ itemType: DecoratorTypes.DATE;
90
+ /**
91
+ * The definition of the columns to display. Consists of the displayName to show in the header of the row
92
+ * and the value, which is a function that generates the value to display inside a column.
93
+ */
94
+ displayColumns: ArrayTableDisplayColumn<Date>[];
95
+ /**
96
+ * The label for the add button.
97
+ *
98
+ * @default 'Add'
99
+ */
100
+ addButtonLabel?: string;
101
+ /**
102
+ * The label for the remove button.
103
+ *
104
+ * @default 'Remove'
105
+ */
106
+ removeButtonLabel?: string;
107
+ /**
108
+ * The error-message to display when the array is required but contains no values.
109
+ */
110
+ missingErrorMessage?: string;
111
+ /**
112
+ * A function to get the minimum value of the date.
113
+ */
114
+ min?: (date?: Date) => Date;
115
+ /**
116
+ * A function to get the maximum value of the date.
117
+ */
118
+ max?: (date?: Date) => Date;
119
+ /**
120
+ * A filter function to do more specific filtering. This could be the removal of e.g. All weekends.
121
+ */
122
+ filter?: DateFilterFn<Date | null | undefined>;
123
+ }
124
+ /**
125
+ * Definition for an array of DateTimes.
126
+ */
127
+ export interface DateTimeArrayDecoratorConfig extends ArrayDecoratorConfig {
128
+ itemType: DecoratorTypes.DATE_TIME;
129
+ /**
130
+ * The definition of the columns to display. Consists of the displayName to show in the header of the row
131
+ * and the value, which is a function that generates the value to display inside a column.
132
+ */
133
+ displayColumns: ArrayTableDisplayColumn<Date>[];
134
+ /**
135
+ * The label for the add button.
136
+ *
137
+ * @default 'Add'
138
+ */
139
+ addButtonLabel?: string;
140
+ /**
141
+ * The label for the remove button.
142
+ *
143
+ * @default 'Remove'
144
+ */
145
+ removeButtonLabel?: string;
146
+ /**
147
+ * The error-message to display when the array is required but contains no values.
148
+ */
149
+ missingErrorMessage?: string;
150
+ /**
151
+ * The selectable times.
152
+ */
153
+ times?: DropdownValue<Time>[];
154
+ /**
155
+ * The name to use as a label for the time form field.
156
+ *
157
+ * @default 'Time'
158
+ */
159
+ timeDisplayName?: string;
160
+ /**
161
+ * A function to get the minimum value of the date.
162
+ */
163
+ minDate?: (date?: Date) => Date;
164
+ /**
165
+ * A function to get the maximum value of the date.
166
+ */
167
+ maxDate?: (date?: Date) => Date;
168
+ /**
169
+ * A filter function to do more specific date filtering. This could be the removal of e.g. All weekends.
170
+ */
171
+ filterDate?: DateFilterFn<Date | null | undefined>;
172
+ /**
173
+ * A function to get the minimum value of the time.
174
+ */
175
+ minTime?: (date?: Date) => Time;
176
+ /**
177
+ * A function to get the maximum value of the time.
178
+ */
179
+ maxTime?: (date?: Date) => Time;
180
+ /**
181
+ * A filter function to do more specific time filtering. This could be e.g. The removal of lunch breaks.
182
+ */
183
+ filterTime?: ((time: Time) => boolean) | (() => boolean);
184
+ }
185
+ /**
186
+ * Definition for an array of DateRanges.
187
+ */
188
+ export interface DateRangeArrayDecoratorConfig extends ArrayDecoratorConfig {
189
+ itemType: DecoratorTypes.DATE_RANGE;
190
+ /**
191
+ * The definition of the columns to display. Consists of the displayName to show in the header of the row
192
+ * and the value, which is a function that generates the value to display inside a column.
193
+ */
194
+ displayColumns: ArrayTableDisplayColumn<DateRange>[];
195
+ /**
196
+ * The label for the add button.
197
+ *
198
+ * @default 'Add'
199
+ */
200
+ addButtonLabel?: string;
201
+ /**
202
+ * The label for the remove button.
203
+ *
204
+ * @default 'Remove'
205
+ */
206
+ removeButtonLabel?: string;
207
+ /**
208
+ * The error-message to display when the array is required but contains no values.
209
+ */
210
+ missingErrorMessage?: string;
211
+ /**
212
+ * A function to get the minimum value of the start date.
213
+ */
214
+ minStart?: (date?: Date) => Date;
215
+ /**
216
+ * A function to get the maximum value of the start date.
217
+ */
218
+ maxStart?: (date?: Date) => Date;
219
+ /**
220
+ * A function to get the minimum value of the end date.
221
+ */
222
+ minEnd?: (date?: Date) => Date;
223
+ /**
224
+ * A function to get the maximum value of the end date.
225
+ */
226
+ maxEnd?: (date?: Date) => Date;
227
+ /**
228
+ * A filter function to do more specific filtering on the disallowed end date values. This could be the removal of e.g. All weekends.
229
+ */
230
+ filter?: DateFilterFn<Date>;
231
+ /**
232
+ * The placeholder for the start date of the date range picker.
233
+ *
234
+ * @default "Start"
235
+ */
236
+ placeholderStart?: string;
237
+ /**
238
+ * The placeholder for the end date of the date range picker.
239
+ *
240
+ * @default "End"
241
+ */
242
+ placeholderEnd?: string;
243
+ }
75
244
  /**
76
245
  * Definition for an array of strings displayed as a chips list.
77
246
  */
78
247
  export interface StringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
79
248
  itemType: DecoratorTypes.STRING;
80
- displayStyle: 'chips';
81
249
  /**
82
250
  * The class for the <i> tag used to remove an entry from the array.
83
251
  *
@@ -102,7 +270,6 @@ export interface StringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
102
270
  */
103
271
  export interface AutocompleteStringChipsArrayDecoratorConfig extends ArrayDecoratorConfig {
104
272
  itemType: DecoratorTypes.STRING_AUTOCOMPLETE;
105
- displayStyle: 'chips';
106
273
  /**
107
274
  * The class for the <i> tag used to remove an entry from the array.
108
275
  *
@@ -126,4 +293,3 @@ export interface AutocompleteStringChipsArrayDecoratorConfig extends ArrayDecora
126
293
  */
127
294
  regex?: RegExp;
128
295
  }
129
- export {};
@@ -1,4 +1,5 @@
1
- import { AutocompleteStringChipsArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
1
+ import { BaseEntityType } from '../../classes/entity.model';
2
+ import { AutocompleteStringChipsArrayDecoratorConfig, DateArrayDecoratorConfig, DateRangeArrayDecoratorConfig, DateTimeArrayDecoratorConfig, EntityArrayDecoratorConfig, StringChipsArrayDecoratorConfig } from './array-decorator.data';
2
3
  /**
3
4
  * Decorator for setting and getting array property metadata.
4
5
  *
@@ -6,4 +7,4 @@ import { AutocompleteStringChipsArrayDecoratorConfig, EntityArrayDecoratorConfig
6
7
  * @returns The method that defines the metadata.
7
8
  * @throws When the given type of the array-items is unknown.
8
9
  */
9
- export declare function array<EntityType extends object>(metadata: EntityArrayDecoratorConfig<EntityType> | StringChipsArrayDecoratorConfig | AutocompleteStringChipsArrayDecoratorConfig): (target: object, propertyKey: string) => void;
10
+ export declare function array<EntityType extends BaseEntityType<EntityType>>(metadata: EntityArrayDecoratorConfig<EntityType> | StringChipsArrayDecoratorConfig | AutocompleteStringChipsArrayDecoratorConfig | DateArrayDecoratorConfig | DateTimeArrayDecoratorConfig | DateRangeArrayDecoratorConfig): (target: object, propertyKey: string) => void;
@@ -1,5 +1,4 @@
1
- import { DecoratorTypes } from './decorator-types.enum';
2
- import { PropertyDecoratorConfigInternal } from './property-decorator-internal.data';
1
+ import { DecoratorType, DecoratorTypes } from './decorator-types.enum';
3
2
  /**
4
3
  * The base decorator for setting metadata on properties.
5
4
  *
@@ -7,4 +6,4 @@ import { PropertyDecoratorConfigInternal } from './property-decorator-internal.d
7
6
  * @param type - The type of metadata.
8
7
  * @returns The method that sets the metadata.
9
8
  */
10
- export declare function baseProperty(metadata: PropertyDecoratorConfigInternal, type: DecoratorTypes): (target: object, propertyKey: string) => void;
9
+ export declare function baseProperty<T extends DecoratorTypes, CustomMetadataType extends Record<string, unknown>>(metadata: DecoratorType<T, CustomMetadataType>, type: T): (target: object, propertyKey: string) => void;
@@ -1,9 +1,11 @@
1
- import { AutocompleteStringChipsArrayDecoratorConfigInternal, EntityArrayDecoratorConfigInternal, StringChipsArrayDecoratorConfigInternal } from '../array/array-decorator-internal.data';
1
+ import { AutocompleteStringChipsArrayDecoratorConfigInternal, EntityArrayDecoratorConfigInternal, DateArrayDecoratorConfigInternal, StringChipsArrayDecoratorConfigInternal, DateTimeArrayDecoratorConfigInternal, DateRangeArrayDecoratorConfigInternal } from '../array/array-decorator-internal.data';
2
2
  import { CheckboxBooleanDecoratorConfigInternal, DropdownBooleanDecoratorConfigInternal, ToggleBooleanDecoratorConfigInternal } from '../boolean/boolean-decorator-internal.data';
3
+ import { CustomDecoratorConfigInternal } from '../custom/custom-decorator-internal.data';
3
4
  import { DateRangeDateDecoratorConfigInternal, DateTimeDateDecoratorConfigInternal, DefaultDateDecoratorConfigInternal } from '../date/date-decorator-internal.data';
4
- import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInternal } from '../number/number-decorator-internal.data';
5
+ import { DefaultFileDecoratorConfigInternal, ImageFileDecoratorConfigInternal } from '../file/file-decorator-internal.data';
6
+ import { DefaultNumberDecoratorConfigInternal, DropdownNumberDecoratorConfigInternal, SliderNumberDecoratorConfigInternal } from '../number/number-decorator-internal.data';
5
7
  import { DefaultObjectDecoratorConfigInternal } from '../object/object-decorator-internal.data';
6
- import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../string/string-decorator-internal.data';
8
+ import { AutocompleteStringDecoratorConfigInternal, DefaultStringDecoratorConfigInternal, DropdownStringDecoratorConfigInternal, PasswordStringDecoratorConfigInternal, TextboxStringDecoratorConfigInternal } from '../string/string-decorator-internal.data';
7
9
  /**
8
10
  * The enum Values for all the different DecoratorTypes.
9
11
  */
@@ -12,20 +14,28 @@ export declare enum DecoratorTypes {
12
14
  STRING_DROPDOWN = "stringDropdown",
13
15
  STRING_AUTOCOMPLETE = "stringAutocomplete",
14
16
  STRING_TEXTBOX = "stringTextbox",
17
+ STRING_PASSWORD = "stringPassword",
15
18
  NUMBER = "number",
16
19
  NUMBER_DROPDOWN = "numberDropdown",
20
+ NUMBER_SLIDER = "numberSlider",
17
21
  BOOLEAN_CHECKBOX = "boolean",
18
22
  BOOLEAN_TOGGLE = "booleanToggle",
19
23
  BOOLEAN_DROPDOWN = "booleanDropdown",
20
24
  OBJECT = "object",
21
25
  ARRAY = "array",
26
+ ARRAY_DATE = "arrayDate",
27
+ ARRAY_DATE_TIME = "arrayDateTime",
28
+ ARRAY_DATE_RANGE = "arrayDateRange",
22
29
  ARRAY_STRING_CHIPS = "arrayStringChips",
23
30
  ARRAY_STRING_AUTOCOMPLETE_CHIPS = "arrayStringAutocompleteChips",
24
31
  DATE = "date",
25
32
  DATE_RANGE = "dateRange",
26
- DATE_TIME = "dateTime"
33
+ DATE_TIME = "dateTime",
34
+ FILE_DEFAULT = "fileDefault",
35
+ FILE_IMAGE = "fileImage",
36
+ CUSTOM = "custom"
27
37
  }
28
38
  /**
29
39
  * Gives the metadata-config Type based on the DecoratorTypes enum.
30
40
  */
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;
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;
@@ -0,0 +1,17 @@
1
+ import { Type } from '@angular/core';
2
+ import { BaseEntityType } from '../../classes/entity.model';
3
+ import { NgxMatEntityBaseInputComponent } from '../../components/input/base-input.component';
4
+ import { DecoratorTypes } from '../base/decorator-types.enum';
5
+ import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
6
+ import { CustomDecoratorConfig } from './custom-decorator.data';
7
+ /**
8
+ * The internal config for the @custom decorator.
9
+ * Sets default values.
10
+ */
11
+ export declare class CustomDecoratorConfigInternal<EntityType extends BaseEntityType<EntityType>, ValueType, MetadataType extends BaseEntityType<MetadataType>, ComponentType extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.CUSTOM, MetadataType>> extends PropertyDecoratorConfigInternal implements CustomDecoratorConfig<EntityType, ValueType, MetadataType, ComponentType> {
12
+ component: Type<ComponentType>;
13
+ isValid: (value: ValueType, omit: 'create' | 'update') => boolean;
14
+ isEqual: (value: ValueType, valuePriorChanges: ValueType, metadata: CustomDecoratorConfig<EntityType, ValueType, MetadataType, ComponentType>) => boolean;
15
+ customMetadata: MetadataType;
16
+ constructor(data: CustomDecoratorConfig<EntityType, ValueType, MetadataType, ComponentType>);
17
+ }
@@ -0,0 +1,37 @@
1
+ import { NgxMatEntityBaseInputComponent } from '../../components/input/base-input.component';
2
+ import { BaseEntityType } from '../../classes/entity.model';
3
+ import { DecoratorTypes } from '../base/decorator-types.enum';
4
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
5
+ import { Type } from '@angular/core';
6
+ /**
7
+ * Definition for a custom property. Use this if the provided decorators don't fit your needs.
8
+ */
9
+ export interface CustomDecoratorConfig<EntityType extends BaseEntityType<EntityType>, ValueType, MetadataType extends BaseEntityType<MetadataType>, ComponentType extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.CUSTOM, MetadataType>> extends PropertyDecoratorConfig {
10
+ /**
11
+ * The component to use for this input.
12
+ */
13
+ component: Type<ComponentType>;
14
+ /**
15
+ * The function that defines whether or not the value is valid.
16
+ * Used in addition to default checks like required etc.
17
+ * Needed for the edit and create dialogs.
18
+ *
19
+ * TIP: If you need additional data for checking if the value is valid, you can define them as metadata directly on the value.
20
+ *
21
+ * @default () => true
22
+ */
23
+ isValid?: (value: ValueType, omit: 'create' | 'update') => boolean;
24
+ /**
25
+ * The function that defines whether or not two of your custom values are equal.
26
+ * Needed for the edit and create dialogs.
27
+ *
28
+ * TIP: If you need additional data for checking if the value is valid, you can define them as metadata directly on the values.
29
+ *
30
+ * @default (value: ValueType, valuePriorChanges: ValueType) => LodashUtilities.isEqual(value, valuePriorChanges)
31
+ */
32
+ isEqual?: (value: ValueType, valuePriorChanges: ValueType, metadata: CustomDecoratorConfig<EntityType, ValueType, MetadataType, ComponentType>) => boolean;
33
+ /**
34
+ * Any custom metadata you want to add to the property.
35
+ */
36
+ customMetadata: MetadataType;
37
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseEntityType } from '../../classes/entity.model';
2
+ import { NgxMatEntityBaseInputComponent } from '../../components/input/base-input.component';
3
+ import { DecoratorTypes } from '../base/decorator-types.enum';
4
+ import { CustomDecoratorConfig } from './custom-decorator.data';
5
+ /**
6
+ * Decorator for setting and getting custom property metadata.
7
+ *
8
+ * @param metadata - The metadata of the custom property.
9
+ * @returns The method that defines the metadata.
10
+ */
11
+ export declare function custom<ValueType, MetadataType extends BaseEntityType<MetadataType>, EntityType extends BaseEntityType<EntityType>>(metadata: CustomDecoratorConfig<EntityType, ValueType, MetadataType, NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.CUSTOM, MetadataType>>): (target: object, propertyKey: string) => void;
@@ -23,8 +23,8 @@ export declare class DateRangeDateDecoratorConfigInternal extends PropertyDecora
23
23
  minEnd?: (date?: Date) => Date;
24
24
  maxEnd?: (date?: Date) => Date;
25
25
  filter?: DateFilterFn<Date>;
26
- placeholderStart?: string;
27
- placeholderEnd?: string;
26
+ placeholderStart: string;
27
+ placeholderEnd: string;
28
28
  constructor(data: DateRangeDateDecoratorConfig);
29
29
  }
30
30
  /**
@@ -0,0 +1,8 @@
1
+ import { DateRangeDateDecoratorConfig, DateTimeDateDecoratorConfig, DefaultDateDecoratorConfig } from './date-decorator.data';
2
+ /**
3
+ * Decorator for setting and getting date property metadata.
4
+ *
5
+ * @param metadata - The metadata of the date property.
6
+ * @returns The method that defines the metadata.
7
+ */
8
+ export declare function date(metadata: DefaultDateDecoratorConfig | DateRangeDateDecoratorConfig | DateTimeDateDecoratorConfig): (target: object, propertyKey: string) => void;
@@ -0,0 +1,92 @@
1
+ import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
2
+ import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
3
+ import { DefaultFileDecoratorConfig, ImageFileDecoratorConfig } from './file-decorator.data';
4
+ /**
5
+ * Contains data about a file property where a blob exists.
6
+ */
7
+ export interface FileDataWithFile {
8
+ /**
9
+ * The name of the file.
10
+ */
11
+ name: string;
12
+ /**
13
+ * The file data itself in form of a blob.
14
+ */
15
+ file: Blob;
16
+ /**
17
+ * The mime type of the file.
18
+ * This is needed to increase performance when checking if the provided file is valid.
19
+ */
20
+ type: string;
21
+ /**
22
+ * The size of the file in bytes.
23
+ * This is needed to increase performance when checking if the provided file is valid.
24
+ */
25
+ size: number;
26
+ /**
27
+ * The url where the blob is saved.
28
+ */
29
+ url?: string;
30
+ }
31
+ /**
32
+ * Contains data about a file property where no blob exists.
33
+ */
34
+ export interface FileDataWithUrl {
35
+ /**
36
+ * The name of the file.
37
+ */
38
+ name: string;
39
+ /**
40
+ * The file data itself in form of a blob.
41
+ */
42
+ file?: Blob;
43
+ /**
44
+ * The mime type of the file.
45
+ * This is needed to increase performance when checking if the provided file is valid.
46
+ */
47
+ type: string;
48
+ /**
49
+ * The size of the file in bytes.
50
+ * This is needed to increase performance when checking if the provided file is valid.
51
+ */
52
+ size: number;
53
+ /**
54
+ * The url where the blob is saved.
55
+ */
56
+ url: string;
57
+ }
58
+ /**
59
+ * The internal DefaultFileDecoratorConfig. Sets default values.
60
+ */
61
+ export declare class DefaultFileDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements DefaultFileDecoratorConfig {
62
+ type: 'other';
63
+ preview: false;
64
+ multiple: boolean;
65
+ allowedMimeTypes: string[];
66
+ deleteIcon: string;
67
+ maxSize: number;
68
+ maxSizeTotal: number;
69
+ mimeTypeErrorDialog: ConfirmDialogData;
70
+ maxSizeErrorDialog: ConfirmDialogData;
71
+ maxSizeTotalErrorDialog: ConfirmDialogData;
72
+ dragAndDrop: boolean;
73
+ constructor(data: DefaultFileDecoratorConfig);
74
+ }
75
+ /**
76
+ * The internal ImageFileDecoratorConfig. Sets default values.
77
+ */
78
+ export declare class ImageFileDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements ImageFileDecoratorConfig {
79
+ type: 'image';
80
+ allowedMimeTypes: string[];
81
+ multiple: boolean;
82
+ preview: boolean;
83
+ previewPlaceholderUrl?: string;
84
+ deleteIcon: string;
85
+ maxSize: number;
86
+ maxSizeTotal: number;
87
+ mimeTypeErrorDialog: ConfirmDialogData;
88
+ maxSizeErrorDialog: ConfirmDialogData;
89
+ maxSizeTotalErrorDialog: ConfirmDialogData;
90
+ dragAndDrop: boolean;
91
+ constructor(data: ImageFileDecoratorConfig);
92
+ }
@@ -0,0 +1,92 @@
1
+ import { ConfirmDialogData } from '../../components/confirm-dialog/confirm-dialog-data';
2
+ import { PropertyDecoratorConfig } from '../base/property-decorator.data';
3
+ import { FileDataWithFile, FileDataWithUrl } from './file-decorator-internal.data';
4
+ /**
5
+ * The type of a property annotated with @file.
6
+ */
7
+ export declare type FileData = FileDataWithFile | FileDataWithUrl;
8
+ /**
9
+ * Definition for the @file metadata.
10
+ */
11
+ declare abstract class FileDecoratorConfig extends PropertyDecoratorConfig {
12
+ /**
13
+ * Specifies whether or not the decorated property can have multiple files.
14
+ */
15
+ multiple: boolean;
16
+ /**
17
+ * The type of the upload.
18
+ */
19
+ type: 'image' | 'other';
20
+ /**
21
+ * The class for the <i> tag used to remove a file from the input.
22
+ *
23
+ * @default 'fas fa-circle-minus'
24
+ */
25
+ deleteIcon?: string;
26
+ /**
27
+ * Whether or not the file should be displayed inside a preview.
28
+ *
29
+ * @default true
30
+ */
31
+ preview?: boolean;
32
+ /**
33
+ * Specifies allowed File types like 'image/jpg' etc.
34
+ * Allows every file type if not set.
35
+ */
36
+ allowedMimeTypes?: string[];
37
+ /**
38
+ * The error dialog to display when the user inputs files that are not of the allowed mime types.
39
+ */
40
+ mimeTypeErrorDialog?: ConfirmDialogData;
41
+ /**
42
+ * The maximum allowed size of a single file in MB.
43
+ *
44
+ * @default 10
45
+ */
46
+ maxSize?: number;
47
+ /**
48
+ * The error dialog to display when the user inputs a single file that is bigger than the 'maxSize' value.
49
+ */
50
+ maxSizeErrorDialog?: ConfirmDialogData;
51
+ /**
52
+ * The maximum allowed size of all files in MB.
53
+ *
54
+ * @default 100
55
+ */
56
+ maxSizeTotal?: number;
57
+ /**
58
+ * The error dialog to display when the user inputs files which are in total bigger than the 'maxSizeTotal' value.
59
+ */
60
+ maxSizeTotalErrorDialog?: ConfirmDialogData;
61
+ /**
62
+ * Defines whether or not a dropdown box is displayed.
63
+ *
64
+ * @default true // when multiple is set to true.
65
+ * false // when multiple is set to false.
66
+ */
67
+ dragAndDrop?: boolean;
68
+ }
69
+ /**
70
+ * Definition for a default file.
71
+ */
72
+ export interface DefaultFileDecoratorConfig extends FileDecoratorConfig {
73
+ type: 'other';
74
+ preview?: false;
75
+ }
76
+ /**
77
+ * Definition for a image file.
78
+ */
79
+ export interface ImageFileDecoratorConfig extends FileDecoratorConfig {
80
+ type: 'image';
81
+ /**
82
+ * Specifies allowed File types like image/jpg etc. In a comma separated string.
83
+ *
84
+ * @default ['image/*']
85
+ */
86
+ allowedMimeTypes?: string[];
87
+ /**
88
+ * Url to the file that gets displayed in the preview when no file has been selected yet.
89
+ */
90
+ previewPlaceholderUrl?: string;
91
+ }
92
+ export {};
@@ -0,0 +1,9 @@
1
+ import { DefaultFileDecoratorConfig, ImageFileDecoratorConfig } from './file-decorator.data';
2
+ /**
3
+ * Decorator for setting and getting file property metadata.
4
+ *
5
+ * @param metadata - The metadata of the file property.
6
+ * @returns The method that defines the metadata.
7
+ * @throws When an unknown metadata type was provided.
8
+ */
9
+ export declare function file(metadata: DefaultFileDecoratorConfig | ImageFileDecoratorConfig): (target: object, propertyKey: string) => void;
@@ -1,6 +1,6 @@
1
1
  import { DropdownValue } from '../base/dropdown-value.interface';
2
2
  import { PropertyDecoratorConfigInternal } from '../base/property-decorator-internal.data';
3
- import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig } from './number-decorator.data';
3
+ import { DefaultNumberDecoratorConfig, DropdownNumberDecoratorConfig, SliderNumberDecoratorConfig } from './number-decorator.data';
4
4
  /**
5
5
  * The internal DefaultNumberDecoratorConfig. Sets default values.
6
6
  */
@@ -18,3 +18,22 @@ export declare class DropdownNumberDecoratorConfigInternal extends PropertyDecor
18
18
  dropdownValues: DropdownValue<number>[];
19
19
  constructor(data: DropdownNumberDecoratorConfig);
20
20
  }
21
+ /**
22
+ * The internal SliderNumberDecoratorConfig. Sets default values.
23
+ */
24
+ export declare class SliderNumberDecoratorConfigInternal extends PropertyDecoratorConfigInternal implements SliderNumberDecoratorConfig {
25
+ displayStyle: 'slider';
26
+ min?: number;
27
+ max?: number;
28
+ step?: number;
29
+ formatThumbLabelValue: (value: number) => string | number;
30
+ tickInterval?: number | 'auto';
31
+ constructor(data: SliderNumberDecoratorConfig);
32
+ }
33
+ /**
34
+ * The default function to format values for the number slider thumb label.
35
+ *
36
+ * @param value - The value of the slider.
37
+ * @returns Just the value without any formatting done.
38
+ */
39
+ export declare function defaultFormatThumbLabelValue(value: number): number;