@ptsecurity/mosaic 17.2.12 → 17.2.14

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 (46) hide show
  1. package/core/forms/index.d.ts +1 -0
  2. package/core/forms/validators.d.ts +22 -0
  3. package/core/pop-up/constants.d.ts +13 -0
  4. package/core/pop-up/pop-up-trigger.d.ts +14 -1
  5. package/core/styles/theming/_theming.scss +1 -0
  6. package/esm2022/core/forms/index.mjs +2 -1
  7. package/esm2022/core/forms/validators.mjs +33 -0
  8. package/esm2022/core/pop-up/constants.mjs +10 -1
  9. package/esm2022/core/pop-up/pop-up-trigger.mjs +45 -3
  10. package/esm2022/core/version.mjs +2 -2
  11. package/esm2022/file-upload/file-upload.mjs +39 -2
  12. package/esm2022/file-upload/file-upload.module.mjs +8 -1
  13. package/esm2022/file-upload/multiple-file-upload.component.mjs +129 -37
  14. package/esm2022/file-upload/single-file-upload.component.mjs +124 -46
  15. package/esm2022/form-field/form-field.mjs +6 -6
  16. package/esm2022/popover/popover.component.mjs +2 -2
  17. package/esm2022/select/select.component.mjs +6 -4
  18. package/esm2022/tooltip/tooltip.component.mjs +5 -2
  19. package/esm2022/tree-select/tree-select.component.mjs +6 -4
  20. package/fesm2022/ptsecurity-mosaic-core.mjs +86 -3
  21. package/fesm2022/ptsecurity-mosaic-core.mjs.map +1 -1
  22. package/fesm2022/ptsecurity-mosaic-file-upload.mjs +282 -72
  23. package/fesm2022/ptsecurity-mosaic-file-upload.mjs.map +1 -1
  24. package/fesm2022/ptsecurity-mosaic-form-field.mjs +5 -5
  25. package/fesm2022/ptsecurity-mosaic-form-field.mjs.map +1 -1
  26. package/fesm2022/ptsecurity-mosaic-popover.mjs +1 -1
  27. package/fesm2022/ptsecurity-mosaic-popover.mjs.map +1 -1
  28. package/fesm2022/ptsecurity-mosaic-select.mjs +5 -3
  29. package/fesm2022/ptsecurity-mosaic-select.mjs.map +1 -1
  30. package/fesm2022/ptsecurity-mosaic-tooltip.mjs +5 -2
  31. package/fesm2022/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  32. package/fesm2022/ptsecurity-mosaic-tree-select.mjs +5 -3
  33. package/fesm2022/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  34. package/file-upload/_file-upload-theme.scss +21 -11
  35. package/file-upload/file-upload.d.ts +31 -3
  36. package/file-upload/file-upload.module.d.ts +11 -10
  37. package/file-upload/file-upload.scss +8 -1
  38. package/file-upload/multiple-file-upload.component.d.ts +54 -13
  39. package/file-upload/multiple-file-upload.component.scss +0 -8
  40. package/file-upload/single-file-upload.component.d.ts +49 -14
  41. package/file-upload/single-file-upload.component.scss +0 -8
  42. package/form-field/form-field.d.ts +1 -1
  43. package/package.json +4 -4
  44. package/prebuilt-themes/dark-theme.css +1 -1
  45. package/prebuilt-themes/default-theme.css +1 -1
  46. package/tooltip/tooltip.component.d.ts +2 -1
@@ -1,6 +1,6 @@
1
- import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, Renderer2, TemplateRef } from '@angular/core';
2
- import { CanDisable, McLocaleService } from '@ptsecurity/mosaic/core';
3
- import { McFile, McFileItem, McFileValidatorFn, McInputFile, McInputFileLabel } from './file-upload';
1
+ import { AfterViewInit, DoCheck, ElementRef, EventEmitter, QueryList, TemplateRef } from '@angular/core';
2
+ import { CanDisable, CanUpdateErrorState, ErrorStateMatcher } from '@ptsecurity/mosaic/core';
3
+ import { McFile, McFileItem, McFileUploadBase, McFileValidatorFn, McInputFile, McInputFileLabel } from './file-upload';
4
4
  import * as i0 from "@angular/core";
5
5
  export interface McInputFileMultipleLabel extends McInputFileLabel {
6
6
  captionTextWhenSelected: string;
@@ -12,21 +12,37 @@ export interface McInputFileMultipleLabel extends McInputFileLabel {
12
12
  [k: string | number | symbol]: unknown;
13
13
  }
14
14
  export declare const MC_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION: McInputFileMultipleLabel;
15
- export declare class McMultipleFileUploadComponent implements McInputFile, CanDisable, OnDestroy {
16
- private renderer;
17
- private cdr;
15
+ export declare class McMultipleFileUploadComponent extends McFileUploadBase implements AfterViewInit, DoCheck, McInputFile, CanDisable, CanUpdateErrorState {
18
16
  readonly configuration: McInputFileMultipleLabel;
19
- private localeService?;
20
17
  accept?: string[];
21
18
  disabled: boolean;
22
19
  errors: string[];
23
- files: McFileItem[];
24
20
  size: 'compact' | 'default';
21
+ /**
22
+ * custom ID for the file input element.
23
+ */
25
24
  inputId: string;
25
+ /**
26
+ * @deprecated use `FormControl.errors`
27
+ */
26
28
  customValidation?: McFileValidatorFn[];
29
+ /** An object used to control the error state of the component. */
30
+ errorStateMatcher: ErrorStateMatcher;
31
+ get files(): McFileItem[];
32
+ set files(currentFileList: McFileItem[]);
33
+ private _files;
27
34
  fileQueueChanged: EventEmitter<McFileItem[]>;
35
+ /**
36
+ * Emits an event containing a chunk of files added to the file list.
37
+ */
38
+ filesAdded: EventEmitter<McFileItem[]>;
39
+ /**
40
+ * Emits an event containing a file and file's index when removed from the file list.
41
+ */
42
+ fileRemoved: EventEmitter<[McFileItem, number]>;
28
43
  customFileIcon: TemplateRef<HTMLElement>;
29
44
  input: ElementRef<HTMLInputElement>;
45
+ readonly hint: QueryList<TemplateRef<any>>;
30
46
  columnDefs: {
31
47
  header: string;
32
48
  cssClass: string;
@@ -36,10 +52,35 @@ export declare class McMultipleFileUploadComponent implements McInputFile, CanDi
36
52
  separatedCaptionTextWhenSelected: string[];
37
53
  separatedCaptionTextForCompactSize: string[];
38
54
  get acceptedFiles(): string;
55
+ /**
56
+ * @deprecated use `FormControl.errors`
57
+ */
39
58
  get hasErrors(): boolean;
40
- private localeSubscription;
41
- constructor(renderer: Renderer2, cdr: ChangeDetectorRef, configuration: McInputFileMultipleLabel, localeService?: McLocaleService | undefined);
42
- ngOnDestroy(): void;
59
+ get hasHint(): boolean;
60
+ /**
61
+ * Indicates an invalid state based on file errors or `errorState`,
62
+ * applying a CSS class in HTML for visual feedback.
63
+ */
64
+ get invalid(): boolean;
65
+ constructor(configuration: McInputFileMultipleLabel);
66
+ ngAfterViewInit(): void;
67
+ ngDoCheck(): void;
68
+ /** cvaOnChange function registered via registerOnChange (ControlValueAccessor). @docs-private */
69
+ cvaOnChange: (_: McFileItem[]) => void;
70
+ /** onTouch function registered via registerOnTouch (ControlValueAccessor). @docs-private */
71
+ onTouched: () => void;
72
+ /** Implemented as part of ControlValueAccessor. @docs-private */
73
+ writeValue(files: FileList | McFileItem[] | null): void;
74
+ /** Implemented as part of ControlValueAccessor. @docs-private */
75
+ registerOnChange(fn: any): void;
76
+ /** Implemented as part of ControlValueAccessor. @docs-private */
77
+ registerOnTouched(fn: any): void;
78
+ /**
79
+ * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
80
+ * @param isDisabled Whether the control should be disabled.
81
+ * @docs-private
82
+ */
83
+ setDisabledState(isDisabled: boolean): void;
43
84
  onFileSelectedViaClick({ target }: Event): void;
44
85
  onFileDropped(files: FileList | McFile[]): void;
45
86
  deleteFile(index: number, event?: MouseEvent): void;
@@ -50,6 +91,6 @@ export declare class McMultipleFileUploadComponent implements McInputFile, CanDi
50
91
  private isCorrectExtension;
51
92
  private initDefaultParams;
52
93
  private makeCaptionText;
53
- static ɵfac: i0.ɵɵFactoryDeclaration<McMultipleFileUploadComponent, [null, null, { optional: true; }, { optional: true; }]>;
54
- static ɵcmp: i0.ɵɵComponentDeclaration<McMultipleFileUploadComponent, "mc-multiple-file-upload", never, { "accept": { "alias": "accept"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "files": { "alias": "files"; "required": false; }; "size": { "alias": "size"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "customValidation": { "alias": "customValidation"; "required": false; }; }, { "fileQueueChanged": "fileQueueChanged"; }, ["customFileIcon"], ["[hint]"], false, never>;
94
+ static ɵfac: i0.ɵɵFactoryDeclaration<McMultipleFileUploadComponent, [{ optional: true; }]>;
95
+ static ɵcmp: i0.ɵɵComponentDeclaration<McMultipleFileUploadComponent, "mc-multiple-file-upload", never, { "accept": { "alias": "accept"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "size": { "alias": "size"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "customValidation": { "alias": "customValidation"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "files": { "alias": "files"; "required": false; }; }, { "fileQueueChanged": "fileQueueChanged"; "filesAdded": "filesAdded"; "fileRemoved": "fileRemoved"; }, ["customFileIcon", "hint"], ["mc-hint,[hint]"], false, never>;
55
96
  }
@@ -142,11 +142,3 @@ $vertical-padding-item: mc-css-variable(file-upload-size-multiple-uploaded-item-
142
142
  height: 100%;
143
143
  }
144
144
  }
145
-
146
- .mc-hint {
147
- display: block;
148
- }
149
-
150
- .mc-file-upload__hint {
151
- margin-top: mc-css-variable(form-field-hint-size-margin-top);
152
- }
@@ -1,27 +1,62 @@
1
- import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, Renderer2 } from '@angular/core';
2
- import { CanDisable, McLocaleService } from '@ptsecurity/mosaic/core';
3
- import { McFile, McFileItem, McFileValidatorFn, McInputFile, McInputFileLabel } from './file-upload';
1
+ import { DoCheck, ElementRef, EventEmitter } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+ import { CanDisable, ErrorStateMatcher } from '@ptsecurity/mosaic/core';
4
+ import { McFile, McFileItem, McFileUploadBase, McFileValidatorFn, McInputFile, McInputFileLabel } from './file-upload';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare const MC_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION: McInputFileLabel;
6
- export declare class McSingleFileUploadComponent implements McInputFile, CanDisable, OnDestroy {
7
- private renderer;
8
- private cdr;
7
+ export declare class McSingleFileUploadComponent extends McFileUploadBase implements McInputFile, CanDisable, DoCheck, ControlValueAccessor {
9
8
  readonly configuration: McInputFileLabel;
10
- private localeService?;
9
+ get file(): McFileItem | null;
10
+ set file(currentFile: McFileItem | null);
11
+ private _file;
12
+ get acceptedFiles(): string;
13
+ get hasHint(): boolean;
14
+ /**
15
+ * Indicates an invalid state based on `errorState`,
16
+ * applying a CSS class in HTML for visual feedback.
17
+ */
18
+ get invalid(): boolean;
11
19
  accept: string[];
12
20
  disabled: boolean;
21
+ /**
22
+ * @deprecated use `FormControl.errors`
23
+ */
13
24
  errors: string[];
14
- files: McFileItem[];
15
25
  inputId: string;
26
+ /**
27
+ * @deprecated use FormControl for validation
28
+ */
16
29
  customValidation?: McFileValidatorFn[];
30
+ /** An object used to control the error state of the component. */
31
+ errorStateMatcher: ErrorStateMatcher;
17
32
  fileQueueChanged: EventEmitter<McFileItem | null>;
18
33
  input: ElementRef<HTMLInputElement>;
19
- get acceptedFiles(): string;
20
34
  config: McInputFileLabel;
21
35
  separatedCaptionText: string[];
22
- private localeSubscription;
23
- constructor(renderer: Renderer2, cdr: ChangeDetectorRef, configuration: McInputFileLabel, localeService?: McLocaleService | undefined);
24
- ngOnDestroy(): void;
36
+ private readonly hint;
37
+ constructor(configuration: McInputFileLabel);
38
+ /** cvaOnChange function registered via registerOnChange (ControlValueAccessor).
39
+ * @docs-private
40
+ */
41
+ cvaOnChange: (_: McFileItem | null) => void;
42
+ /** onTouch function registered via registerOnTouch (ControlValueAccessor).
43
+ * @docs-private
44
+ */
45
+ onTouched: () => void;
46
+ ngAfterViewInit(): void;
47
+ ngDoCheck(): void;
48
+ /** Implemented as part of ControlValueAccessor. @docs-private */
49
+ writeValue(file: File | McFileItem | null): void;
50
+ /** Implemented as part of ControlValueAccessor. @docs-private */
51
+ registerOnChange(fn: any): void;
52
+ /** Implemented as part of ControlValueAccessor. @docs-private */
53
+ registerOnTouched(fn: any): void;
54
+ /**
55
+ * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
56
+ * @param isDisabled Whether the control should be disabled.
57
+ * @docs-private
58
+ */
59
+ setDisabledState(isDisabled: boolean): void;
25
60
  onFileSelectedViaClick({ target }: Event): void;
26
61
  deleteItem(event?: MouseEvent): void;
27
62
  onFileDropped(files: FileList | McFile[]): void;
@@ -31,6 +66,6 @@ export declare class McSingleFileUploadComponent implements McInputFile, CanDisa
31
66
  private updateLocaleParams;
32
67
  private initDefaultParams;
33
68
  private makeCaptionText;
34
- static ɵfac: i0.ɵɵFactoryDeclaration<McSingleFileUploadComponent, [null, null, { optional: true; }, { optional: true; }]>;
35
- static ɵcmp: i0.ɵɵComponentDeclaration<McSingleFileUploadComponent, "mc-single-file-upload", never, { "accept": { "alias": "accept"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "files": { "alias": "files"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "customValidation": { "alias": "customValidation"; "required": false; }; }, { "fileQueueChanged": "fileQueueChanged"; }, never, ["[hint]", "[mc-icon]"], false, never>;
69
+ static ɵfac: i0.ɵɵFactoryDeclaration<McSingleFileUploadComponent, [{ optional: true; }]>;
70
+ static ɵcmp: i0.ɵɵComponentDeclaration<McSingleFileUploadComponent, "mc-single-file-upload", never, { "file": { "alias": "file"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "customValidation": { "alias": "customValidation"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; }, { "fileQueueChanged": "fileQueueChanged"; }, ["hint"], ["mc-hint,[hint]", "[mc-icon]"], false, never>;
36
71
  }
@@ -41,11 +41,3 @@ $tokens: meta.module-variables(tokens) !default;
41
41
  }
42
42
  }
43
43
  }
44
-
45
- .mc-hint {
46
- display: block;
47
- }
48
-
49
- .mc-file-upload__hint {
50
- margin-top: mc-css-variable(form-field-hint-size-margin-top);
51
- }
@@ -59,7 +59,7 @@ export declare class McFormField extends McFormFieldMixinBase implements AfterCo
59
59
  /** Determines whether a class from the NgControl should be forwarded to the host element. */
60
60
  shouldForward(prop: keyof NgControl): boolean;
61
61
  ngOnDestroy(): void;
62
- runFocusMonitor(): void;
62
+ runFocusMonitor: () => void;
63
63
  stopFocusMonitor(): void;
64
64
  /** Throws an error if the form field's control is missing. */
65
65
  protected validateControlChild(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptsecurity/mosaic",
3
- "version": "17.2.12",
3
+ "version": "17.2.14",
4
4
  "description": "Mosaic",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,9 +19,9 @@
19
19
  "peerDependencies": {
20
20
  "@angular/cdk": "^17.2.0",
21
21
  "@angular/forms": "^17.2.0",
22
- "@ptsecurity/cdk": "^17.2.12",
23
- "@ptsecurity/mosaic-moment-adapter": "^17.2.12",
24
- "@ptsecurity/mosaic-luxon-adapter": "^17.2.12",
22
+ "@ptsecurity/cdk": "^17.2.14",
23
+ "@ptsecurity/mosaic-moment-adapter": "^17.2.14",
24
+ "@ptsecurity/mosaic-luxon-adapter": "^17.2.14",
25
25
  "@mosaic-design/date-formatter": "^2.1.7",
26
26
  "@ptsecurity/mosaic-icons": "^7.0.8",
27
27
  "@mosaic-design/tokens-builder": "^3.1.0",