ngx-material-entity 15.1.1 → 15.1.2

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 (27) hide show
  1. package/classes/entity.utilities.d.ts +36 -0
  2. package/components/input/date/date-range-input/date-range-input.component.d.ts +6 -3
  3. package/components/input/date/date-time-input/date-time-input.component.d.ts +2 -1
  4. package/components/input/file/file-image-input/file-image-input.component.d.ts +4 -2
  5. package/components/input/file/file-input/file-input.component.d.ts +5 -2
  6. package/components/input/string/string-password-input/string-password-input.component.d.ts +2 -1
  7. package/decorators/base/base-property.decorator.d.ts +2 -1
  8. package/decorators/custom/custom.decorator.d.ts +2 -1
  9. package/encapsulation/reflect.utilities.d.ts +9 -0
  10. package/esm2020/classes/entity.utilities.mjs +44 -1
  11. package/esm2020/components/input/date/date-range-input/date-range-input.component.mjs +21 -1
  12. package/esm2020/components/input/date/date-time-input/date-time-input.component.mjs +9 -1
  13. package/esm2020/components/input/file/file-default-input/file-default-input.component.mjs +3 -3
  14. package/esm2020/components/input/file/file-image-input/file-image-input.component.mjs +17 -3
  15. package/esm2020/components/input/file/file-input/file-input.component.mjs +14 -2
  16. package/esm2020/components/input/string/string-password-input/string-password-input.component.mjs +8 -3
  17. package/esm2020/decorators/base/base-property.decorator.mjs +6 -2
  18. package/esm2020/decorators/custom/custom.decorator.mjs +4 -3
  19. package/esm2020/decorators/date/date.decorator.mjs +4 -3
  20. package/esm2020/decorators/file/file.decorator.mjs +4 -3
  21. package/esm2020/decorators/string/string.decorator.mjs +3 -2
  22. package/esm2020/encapsulation/reflect.utilities.mjs +12 -1
  23. package/fesm2015/ngx-material-entity.mjs +333 -225
  24. package/fesm2015/ngx-material-entity.mjs.map +1 -1
  25. package/fesm2020/ngx-material-entity.mjs +330 -222
  26. package/fesm2020/ngx-material-entity.mjs.map +1 -1
  27. package/package.json +1 -1
@@ -5,6 +5,42 @@ import { BaseEntityType } from './entity.model';
5
5
  * Contains HelperMethods around handling Entities and their property-metadata.
6
6
  */
7
7
  export declare abstract class EntityUtilities {
8
+ /**
9
+ * The key for all keys of metadata that should be set to undefined when the entity gets reset.
10
+ */
11
+ static readonly METADATA_KEYS_TO_RESET_KEY: string;
12
+ /**
13
+ * The key for the metadata that saves the single preview image value on image properties.
14
+ */
15
+ static readonly SINGLE_PREVIEW_IMAGE_KEY: string;
16
+ /**
17
+ * The key for the metadata that saves the multi preview images value on image properties.
18
+ */
19
+ static readonly MULTI_PREVIEW_IMAGES_KEY: string;
20
+ /**
21
+ * The key for the metadata that saves the filenames value on file properties.
22
+ */
23
+ static readonly FILENAMES_KEY: string;
24
+ /**
25
+ * The key for the metadata that saves the confirm password value on password properties.
26
+ */
27
+ static readonly CONFIRM_PASSWORD_KEY: string;
28
+ /**
29
+ * The key for the metadata that saves the time value on date time properties.
30
+ */
31
+ static readonly TIME_KEY: string;
32
+ /**
33
+ * The key for the metadata that saves the date range value on date range properties.
34
+ */
35
+ static readonly DATE_RANGE_KEY: string;
36
+ /**
37
+ * The key for the metadata that saves the date range start value on date range properties.
38
+ */
39
+ static readonly DATE_RANGE_START_KEY: string;
40
+ /**
41
+ * The key for the metadata that saves the date range end value on date range properties.
42
+ */
43
+ static readonly DATE_RANGE_END_KEY: string;
8
44
  /**
9
45
  * Gets the properties to omit when updating the entity.
10
46
  *
@@ -6,9 +6,12 @@ import { DateRange } from '../../../../decorators/date/date-decorator.data';
6
6
  import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class DateRangeInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.DATE_RANGE, DateRange> implements OnInit {
9
- dateRange: DateRange;
10
- dateRangeStart?: Date;
11
- dateRangeEnd?: Date;
9
+ get dateRange(): DateRange;
10
+ set dateRange(value: DateRange);
11
+ get dateRangeStart(): Date | undefined;
12
+ set dateRangeStart(value: Date | undefined);
13
+ get dateRangeEnd(): Date | undefined;
14
+ set dateRangeEnd(value: Date | undefined);
12
15
  defaultDateFilter: DateFilterFn<Date | null | undefined>;
13
16
  ngOnInit(): void;
14
17
  /**
@@ -9,8 +9,9 @@ import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
9
9
  import * as i0 from "@angular/core";
10
10
  export declare class DateTimeInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.DATE_TIME, Date> implements OnInit {
11
11
  DateUtilities: typeof DateUtilities;
12
- time?: Time;
13
12
  timeDropdownValues: DropdownValue<Time>[];
13
+ get time(): Time | undefined;
14
+ set time(value: Time | undefined);
14
15
  defaultDateFilter: DateFilterFn<Date | null | undefined>;
15
16
  ngOnInit(): void;
16
17
  /**
@@ -7,8 +7,10 @@ import { NgxMatEntityBaseInputComponent } from '../../base-input.component';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class FileImageInputComponent<EntityType extends BaseEntityType<EntityType>> extends NgxMatEntityBaseInputComponent<EntityType, DecoratorTypes.FILE_IMAGE, FileData | FileData[]> implements OnInit {
9
9
  FileUtilities: typeof FileUtilities;
10
- singlePreviewImage?: string;
11
- multiPreviewImages?: string[];
10
+ get multiPreviewImages(): string[] | undefined;
11
+ set multiPreviewImages(value: string[] | undefined);
12
+ get singlePreviewImage(): string | undefined;
13
+ set singlePreviewImage(value: string | undefined);
12
14
  imageIndex: number;
13
15
  placeHolder: string;
14
16
  private setSinglePreviewImage;
@@ -8,9 +8,12 @@ import { BaseEntityType } from '../../../../classes/entity.model';
8
8
  import * as i0 from "@angular/core";
9
9
  export declare class FileInputComponent<EntityType extends BaseEntityType<EntityType>> implements OnInit {
10
10
  private readonly dialog;
11
- filenames?: string[];
11
+ get filenames(): string[] | undefined;
12
+ set filenames(value: string[] | undefined);
12
13
  FileUtilities: typeof FileUtilities;
13
14
  propertyValue: FileData | FileData[] | undefined;
15
+ entity: EntityType;
16
+ key: keyof EntityType;
14
17
  metadata: DefaultFileDecoratorConfigInternal | ImageFileDecoratorConfigInternal;
15
18
  getValidationErrorMessage: (model: NgModel) => string;
16
19
  isReadOnly: boolean;
@@ -29,5 +32,5 @@ export declare class FileInputComponent<EntityType extends BaseEntityType<Entity
29
32
  downloadAllEnabled(): boolean;
30
33
  downloadAll(): Promise<void>;
31
34
  static ɵfac: i0.ɵɵFactoryDeclaration<FileInputComponent<any>, never>;
32
- static ɵcmp: i0.ɵɵComponentDeclaration<FileInputComponent<any>, "file-input", never, { "propertyValue": "propertyValue"; "metadata": "metadata"; "getValidationErrorMessage": "getValidationErrorMessage"; "isReadOnly": "isReadOnly"; }, { "fileDataChangeEvent": "fileDataChangeEvent"; }, never, never, false, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<FileInputComponent<any>, "file-input", never, { "propertyValue": "propertyValue"; "entity": "entity"; "key": "key"; "metadata": "metadata"; "getValidationErrorMessage": "getValidationErrorMessage"; "isReadOnly": "isReadOnly"; }, { "fileDataChangeEvent": "fileDataChangeEvent"; }, never, never, false, never>;
33
36
  }
@@ -7,7 +7,8 @@ export declare class StringPasswordInputComponent<EntityType extends BaseEntityT
7
7
  hide: boolean;
8
8
  hideConfirm: boolean;
9
9
  confirmRequired: boolean;
10
- confirmPassword?: string;
10
+ get confirmPassword(): string | undefined;
11
+ set confirmPassword(value: string | undefined);
11
12
  ngOnInit(): void;
12
13
  passwordInput(): void;
13
14
  static ɵfac: i0.ɵɵFactoryDeclaration<StringPasswordInputComponent<any>, never>;
@@ -4,6 +4,7 @@ import { DecoratorType, DecoratorTypes } from './decorator-types.enum';
4
4
  *
5
5
  * @param metadata - The metadata to define.
6
6
  * @param type - The type of metadata.
7
+ * @param metadataKeysToReset - Any metadata keys which values should be set to undefined on reset.
7
8
  * @returns The method that sets the metadata.
8
9
  */
9
- export declare function baseProperty<T extends DecoratorTypes, CustomMetadataType extends Record<string, unknown>>(metadata: DecoratorType<T, CustomMetadataType>, type: T): (target: object, propertyKey: string) => void;
10
+ export declare function baseProperty<T extends DecoratorTypes, CustomMetadataType extends Record<string, unknown>>(metadata: DecoratorType<T, CustomMetadataType>, type: T, metadataKeysToReset?: string[]): (target: object, propertyKey: string) => void;
@@ -4,6 +4,7 @@ import { CustomDecoratorConfig } from './custom-decorator.data';
4
4
  * Decorator for setting and getting custom property metadata.
5
5
  *
6
6
  * @param metadata - The metadata of the custom property.
7
+ * @param metadataKeysToReset - Any metadata keys which values should be set to undefined on reset.
7
8
  * @returns The method that defines the metadata.
8
9
  */
9
- export declare function custom<ValueType, CustomMetadataType extends BaseEntityType<CustomMetadataType>, EntityType extends BaseEntityType<EntityType>>(metadata: CustomDecoratorConfig<EntityType, ValueType, CustomMetadataType, any>): (target: object, propertyKey: string) => void;
10
+ export declare function custom<ValueType, CustomMetadataType extends BaseEntityType<CustomMetadataType>, EntityType extends BaseEntityType<EntityType>>(metadata: CustomDecoratorConfig<EntityType, ValueType, CustomMetadataType, any>, metadataKeysToReset?: string[]): (target: object, propertyKey: string) => void;
@@ -44,6 +44,15 @@ export declare abstract class ReflectUtilities {
44
44
  * @returns Whether or not the given target has the key.
45
45
  */
46
46
  static has<T extends object>(target: T, propertyKey: keyof T): boolean;
47
+ /**
48
+ * Checks if the targets key entry has a metadata value for the given metadata key.
49
+ *
50
+ * @returns Whether the metadata is null or not.
51
+ * @param metadataKey - The key of the metadata on the property.
52
+ * @param target - Object that contains the property on itself or in its prototype chain.
53
+ * @param propertyKey - The key of the target.
54
+ */
55
+ static hasMetadata<T extends object>(metadataKey: string, target: T, propertyKey: keyof T): boolean;
47
56
  /**
48
57
  * Define a unique metadata entry on the target.
49
58
  *