@koobiq/components 17.0.0-beta.2 → 17.0.0-rc.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 (31) hide show
  1. package/core/styles/theming/_theming.scss +1 -3
  2. package/esm2022/core/version.mjs +2 -2
  3. package/esm2022/file-upload/file-upload.mjs +15 -1
  4. package/esm2022/file-upload/file-upload.module.mjs +15 -4
  5. package/esm2022/file-upload/multiple-file-upload.component.mjs +98 -49
  6. package/esm2022/file-upload/single-file-upload.component.mjs +110 -54
  7. package/esm2022/select/select.component.mjs +21 -8
  8. package/esm2022/tree-select/tree-select.component.mjs +18 -7
  9. package/fesm2022/koobiq-components-core.mjs +1 -1
  10. package/fesm2022/koobiq-components-core.mjs.map +1 -1
  11. package/fesm2022/koobiq-components-file-upload.mjs +225 -96
  12. package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
  13. package/fesm2022/koobiq-components-select.mjs +20 -7
  14. package/fesm2022/koobiq-components-select.mjs.map +1 -1
  15. package/fesm2022/koobiq-components-tree-select.mjs +17 -6
  16. package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
  17. package/file-upload/file-upload.d.ts +1 -1
  18. package/file-upload/file-upload.module.d.ts +11 -9
  19. package/file-upload/multiple-file-upload.component.d.ts +38 -10
  20. package/file-upload/single-file-upload.component.d.ts +40 -13
  21. package/package.json +13 -12
  22. package/prebuilt-themes/dark-theme.css +1 -1
  23. package/prebuilt-themes/light-theme.css +1 -1
  24. package/schematics/collection.json +11 -0
  25. package/schematics/ng-add/index.js +70 -0
  26. package/schematics/ng-add/schema.json +15 -0
  27. package/scrollbar/scrollbar.directive.d.ts +1 -0
  28. package/scrollbar/scrollbar.types.d.ts +1 -0
  29. package/select/select.component.d.ts +2 -0
  30. package/splitter/_splitter-theme.scss +2 -2
  31. package/tree-select/tree-select.component.d.ts +1 -0
@@ -3,16 +3,18 @@ import * as i1 from "./file-drop";
3
3
  import * as i2 from "./single-file-upload.component";
4
4
  import * as i3 from "./multiple-file-upload.component";
5
5
  import * as i4 from "@angular/common";
6
- import * as i5 from "@koobiq/components/tooltip";
7
- import * as i6 from "@koobiq/components/progress-spinner";
8
- import * as i7 from "@koobiq/components/icon";
9
- import * as i8 from "@koobiq/components/button";
10
- import * as i9 from "@koobiq/components/list";
11
- import * as i10 from "@koobiq/components/form-field";
12
- import * as i11 from "@koobiq/components/ellipsis-center";
13
- import * as i12 from "@koobiq/components/core";
6
+ import * as i5 from "@angular/forms";
7
+ import * as i6 from "@koobiq/components/tooltip";
8
+ import * as i7 from "@koobiq/components/progress-spinner";
9
+ import * as i8 from "@koobiq/components/icon";
10
+ import * as i9 from "@koobiq/components/button";
11
+ import * as i10 from "@koobiq/components/list";
12
+ import * as i11 from "@koobiq/components/form-field";
13
+ import * as i12 from "@koobiq/components/ellipsis-center";
14
+ import * as i13 from "@koobiq/components/core";
15
+ import * as i14 from "@koobiq/components/link";
14
16
  export declare class KbqFileUploadModule {
15
17
  static ɵfac: i0.ɵɵFactoryDeclaration<KbqFileUploadModule, never>;
16
- static ɵmod: i0.ɵɵNgModuleDeclaration<KbqFileUploadModule, [typeof i1.KbqFileDropDirective, typeof i2.KbqSingleFileUploadComponent, typeof i3.KbqMultipleFileUploadComponent], [typeof i4.CommonModule, typeof i5.KbqToolTipModule, typeof i6.KbqProgressSpinnerModule, typeof i7.KbqIconModule, typeof i8.KbqButtonModule, typeof i9.KbqListModule, typeof i10.KbqFormFieldModule, typeof i11.KbqEllipsisCenterModule, typeof i12.KbqDataSizeModule], [typeof i2.KbqSingleFileUploadComponent, typeof i3.KbqMultipleFileUploadComponent, typeof i1.KbqFileDropDirective]>;
18
+ static ɵmod: i0.ɵɵNgModuleDeclaration<KbqFileUploadModule, [typeof i1.KbqFileDropDirective, typeof i2.KbqSingleFileUploadComponent, typeof i3.KbqMultipleFileUploadComponent], [typeof i4.CommonModule, typeof i5.FormsModule, typeof i5.ReactiveFormsModule, typeof i6.KbqToolTipModule, typeof i7.KbqProgressSpinnerModule, typeof i8.KbqIconModule, typeof i9.KbqButtonModule, typeof i10.KbqListModule, typeof i11.KbqFormFieldModule, typeof i12.KbqEllipsisCenterModule, typeof i13.KbqDataSizeModule, typeof i14.KbqLinkModule], [typeof i2.KbqSingleFileUploadComponent, typeof i3.KbqMultipleFileUploadComponent, typeof i1.KbqFileDropDirective]>;
17
19
  static ɵinj: i0.ɵɵInjectorDeclaration<KbqFileUploadModule>;
18
20
  }
@@ -1,7 +1,9 @@
1
- import { FocusMonitor } from '@angular/cdk/a11y';
2
1
  import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, Renderer2, TemplateRef } from '@angular/core';
3
2
  import { CanDisable, KbqLocaleService } from '@koobiq/components/core';
3
+ import { Subscription } from 'rxjs';
4
4
  import { KbqFile, KbqFileItem, KbqFileValidatorFn, KbqInputFile, KbqInputFileLabel } from './file-upload';
5
+ import { ProgressSpinnerMode } from '@koobiq/components/progress-spinner';
6
+ import { ControlValueAccessor, NgControl } from '@angular/forms';
5
7
  import * as i0 from "@angular/core";
6
8
  export interface KbqInputFileMultipleLabel extends KbqInputFileLabel {
7
9
  captionTextWhenSelected: string;
@@ -13,19 +15,28 @@ export interface KbqInputFileMultipleLabel extends KbqInputFileLabel {
13
15
  [k: string | number | symbol]: unknown;
14
16
  }
15
17
  export declare const KBQ_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION: KbqInputFileMultipleLabel;
16
- export declare class KbqMultipleFileUploadComponent implements AfterViewInit, OnDestroy, KbqInputFile, CanDisable {
17
- private focusMonitor;
18
+ export declare class KbqMultipleFileUploadComponent implements AfterViewInit, OnDestroy, KbqInputFile, CanDisable, ControlValueAccessor {
18
19
  private cdr;
19
20
  private renderer;
20
21
  readonly configuration: KbqInputFileMultipleLabel;
21
22
  private localeService?;
23
+ ngControl?: NgControl | undefined;
24
+ /**
25
+ * A value responsible for progress spinner type.
26
+ * Loading logic depends on selected mode */
27
+ progressMode: ProgressSpinnerMode;
22
28
  accept?: string[];
23
29
  disabled: boolean;
24
30
  errors: string[];
25
- files: KbqFileItem[];
26
31
  size: 'compact' | 'default';
27
32
  inputId: string;
33
+ /**
34
+ * Alternative for FormControl's validation
35
+ */
28
36
  customValidation?: KbqFileValidatorFn[];
37
+ private _files;
38
+ get files(): KbqFileItem[];
39
+ set files(currentFileList: KbqFileItem[]);
29
40
  fileQueueChanged: EventEmitter<KbqFileItem[]>;
30
41
  customFileIcon: TemplateRef<HTMLElement>;
31
42
  input: ElementRef<HTMLInputElement>;
@@ -38,23 +49,40 @@ export declare class KbqMultipleFileUploadComponent implements AfterViewInit, On
38
49
  separatedCaptionText: string[];
39
50
  separatedCaptionTextWhenSelected: string[];
40
51
  separatedCaptionTextForCompactSize: string[];
41
- private focusMonitorSubscription;
52
+ statusChangeSubscription?: Subscription;
53
+ /** cvaOnChange function registered via registerOnChange (ControlValueAccessor). */
54
+ cvaOnChange: (_: KbqFileItem[]) => void;
55
+ /** onTouch function registered via registerOnTouch (ControlValueAccessor). */
56
+ onTouched: () => void;
42
57
  get acceptedFiles(): string;
43
58
  get hasErrors(): boolean;
44
- constructor(focusMonitor: FocusMonitor, cdr: ChangeDetectorRef, renderer: Renderer2, configuration: KbqInputFileMultipleLabel, localeService?: KbqLocaleService | undefined);
59
+ constructor(cdr: ChangeDetectorRef, renderer: Renderer2, configuration: KbqInputFileMultipleLabel, localeService?: KbqLocaleService | undefined, ngControl?: NgControl | undefined);
45
60
  ngAfterViewInit(): void;
46
61
  ngOnDestroy(): void;
62
+ /** Implemented as part of ControlValueAccessor.
63
+ * @docs-private */
64
+ writeValue(files: FileList | KbqFileItem[] | null): void;
65
+ /** Implemented as part of ControlValueAccessor.
66
+ * @docs-private */
67
+ registerOnChange(fn: any): void;
68
+ /** Implemented as part of ControlValueAccessor.
69
+ * @docs-private */
70
+ registerOnTouched(fn: any): void;
71
+ /**
72
+ * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
73
+ * @param isDisabled Whether the control should be disabled.
74
+ * @docs-private
75
+ */
76
+ setDisabledState(isDisabled: boolean): void;
47
77
  onFileSelectedViaClick({ target }: Event): void;
48
78
  onFileDropped(files: FileList | KbqFile[]): void;
49
79
  deleteFile(index: number, event?: MouseEvent): void;
50
80
  onFileListChange(): void;
51
- onFocus(focusState: boolean): void;
52
81
  private updateLocaleParams;
53
82
  private mapToFileItem;
54
83
  private validateFile;
55
- private isCorrectExtension;
56
84
  private initDefaultParams;
57
85
  private getCaptionText;
58
- static ɵfac: i0.ɵɵFactoryDeclaration<KbqMultipleFileUploadComponent, [null, null, null, { optional: true; }, { optional: true; }]>;
59
- static ɵcmp: i0.ɵɵComponentDeclaration<KbqMultipleFileUploadComponent, "kbq-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>;
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<KbqMultipleFileUploadComponent, [null, null, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
87
+ static ɵcmp: i0.ɵɵComponentDeclaration<KbqMultipleFileUploadComponent, "kbq-multiple-file-upload,kbq-file-upload[multiple]", never, { "progressMode": { "alias": "progressMode"; "required": false; }; "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; }; "files": { "alias": "files"; "required": false; }; }, { "fileQueueChanged": "fileQueueChanged"; }, ["customFileIcon"], ["[hint]"], false, never>;
60
88
  }
@@ -1,41 +1,68 @@
1
- import { FocusMonitor } from '@angular/cdk/a11y';
2
1
  import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, Renderer2 } from '@angular/core';
3
2
  import { CanDisable, KbqLocaleService } from '@koobiq/components/core';
3
+ import { Subscription } from 'rxjs';
4
+ import { ProgressSpinnerMode } from '@koobiq/components/progress-spinner';
5
+ import { ControlValueAccessor, NgControl } from '@angular/forms';
4
6
  import { KbqFile, KbqFileItem, KbqFileValidatorFn, KbqInputFile, KbqInputFileLabel } from './file-upload';
5
7
  import * as i0 from "@angular/core";
6
8
  export declare const KBQ_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION: KbqInputFileLabel;
7
- export declare class KbqSingleFileUploadComponent implements AfterViewInit, OnDestroy, KbqInputFile, CanDisable {
8
- private focusMonitor;
9
+ export declare class KbqSingleFileUploadComponent implements AfterViewInit, OnDestroy, KbqInputFile, CanDisable, ControlValueAccessor {
9
10
  private cdr;
10
11
  private renderer;
11
12
  readonly configuration: KbqInputFileLabel;
12
13
  private localeService?;
13
- accept: string[];
14
+ ngControl?: NgControl | undefined;
15
+ /**
16
+ * A value responsible for progress spinner type.
17
+ * Loading logic depends on selected mode */
18
+ progressMode: ProgressSpinnerMode;
19
+ accept?: string[];
14
20
  disabled: boolean;
15
21
  errors: string[];
16
- files: KbqFileItem[];
17
22
  inputId: string;
23
+ /**
24
+ * Alternative for FormControl's validation
25
+ */
18
26
  customValidation?: KbqFileValidatorFn[];
19
- fileQueueChanged: EventEmitter<KbqFileItem | null>;
27
+ private _file;
28
+ get file(): KbqFileItem | null;
29
+ set file(currentFile: KbqFileItem | null);
30
+ fileQueueChange: EventEmitter<KbqFileItem | null>;
20
31
  input: ElementRef<HTMLInputElement>;
21
- hasFocus: boolean;
22
32
  config: KbqInputFileLabel;
23
33
  separatedCaptionText: string[];
24
- private focusMonitorSubscription;
34
+ statusChangeSubscription?: Subscription;
35
+ /** cvaOnChange function registered via registerOnChange (ControlValueAccessor). */
36
+ cvaOnChange: (_: KbqFileItem | null) => void;
37
+ /** onTouch function registered via registerOnTouch (ControlValueAccessor). */
38
+ onTouched: () => void;
25
39
  get acceptedFiles(): string;
26
- constructor(focusMonitor: FocusMonitor, cdr: ChangeDetectorRef, renderer: Renderer2, configuration: KbqInputFileLabel, localeService?: KbqLocaleService | undefined);
40
+ constructor(cdr: ChangeDetectorRef, renderer: Renderer2, configuration: KbqInputFileLabel, localeService?: KbqLocaleService | undefined, ngControl?: NgControl | undefined);
27
41
  ngAfterViewInit(): void;
28
42
  ngOnDestroy(): void;
43
+ /** Implemented as part of ControlValueAccessor.
44
+ * @docs-private */
45
+ writeValue(file: File | KbqFileItem | null): void;
46
+ /** Implemented as part of ControlValueAccessor.
47
+ * @docs-private */
48
+ registerOnChange(fn: any): void;
49
+ /** Implemented as part of ControlValueAccessor.
50
+ * @docs-private */
51
+ registerOnTouched(fn: any): void;
52
+ /**
53
+ * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
54
+ * @param isDisabled Whether the control should be disabled.
55
+ * @docs-private
56
+ */
57
+ setDisabledState(isDisabled: boolean): void;
29
58
  onFileSelectedViaClick({ target }: Event): void;
30
59
  deleteItem(event?: MouseEvent): void;
31
60
  onFileDropped(files: FileList | KbqFile[]): void;
32
- onFocus(focusState: boolean): void;
33
61
  private updateLocaleParams;
34
62
  private mapToFileItem;
35
63
  private validateFile;
36
- private isCorrectExtension;
37
64
  private initDefaultParams;
38
65
  private getCaptionText;
39
- static ɵfac: i0.ɵɵFactoryDeclaration<KbqSingleFileUploadComponent, [null, null, null, { optional: true; }, { optional: true; }]>;
40
- static ɵcmp: i0.ɵɵComponentDeclaration<KbqSingleFileUploadComponent, "kbq-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]", "[kbq-icon]"], false, never>;
66
+ static ɵfac: i0.ɵɵFactoryDeclaration<KbqSingleFileUploadComponent, [null, null, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
67
+ static ɵcmp: i0.ɵɵComponentDeclaration<KbqSingleFileUploadComponent, "kbq-single-file-upload,kbq-file-upload:not([multiple])", never, { "progressMode": { "alias": "progressMode"; "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; }; "file": { "alias": "file"; "required": false; }; }, { "fileQueueChange": "fileQueueChange"; }, never, ["[hint]", "[kbq-icon]"], false, never>;
41
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koobiq/components",
3
- "version": "17.0.0-beta.2",
3
+ "version": "17.0.0-rc.2",
4
4
  "description": "koobiq",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,13 +19,13 @@
19
19
  "peerDependencies": {
20
20
  "@angular/cdk": "^17.2.0",
21
21
  "@angular/forms": "^17.2.0",
22
- "@koobiq/cdk": "^17.0.0-beta.2",
23
- "@koobiq/angular-moment-adapter": "^17.0.0-beta.2",
24
- "@koobiq/angular-luxon-adapter": "^17.0.0-beta.2",
22
+ "@koobiq/cdk": "^17.0.0-rc.2",
23
+ "@koobiq/angular-moment-adapter": "^17.0.0-rc.2",
24
+ "@koobiq/angular-luxon-adapter": "^17.0.0-rc.2",
25
25
  "@koobiq/date-formatter": "^3.0.2",
26
26
  "@koobiq/icons": "^7.1.0",
27
- "@koobiq/tokens-builder": "3.0.0-beta.31",
28
- "@koobiq/design-tokens": "3.0.0-beta.31",
27
+ "@koobiq/tokens-builder": "3.0.0-beta.32",
28
+ "@koobiq/design-tokens": "3.0.0-beta.32",
29
29
  "marked": "^4.0.18",
30
30
  "overlayscrollbars": "^2.2.0",
31
31
  "ngx-highlightjs": "^10.0.0"
@@ -64,18 +64,18 @@
64
64
  "esm": "./esm2022/alert/koobiq-components-alert.mjs",
65
65
  "default": "./fesm2022/koobiq-components-alert.mjs"
66
66
  },
67
- "./badge": {
68
- "types": "./badge/index.d.ts",
69
- "esm2022": "./esm2022/badge/koobiq-components-badge.mjs",
70
- "esm": "./esm2022/badge/koobiq-components-badge.mjs",
71
- "default": "./fesm2022/koobiq-components-badge.mjs"
72
- },
73
67
  "./autocomplete": {
74
68
  "types": "./autocomplete/index.d.ts",
75
69
  "esm2022": "./esm2022/autocomplete/koobiq-components-autocomplete.mjs",
76
70
  "esm": "./esm2022/autocomplete/koobiq-components-autocomplete.mjs",
77
71
  "default": "./fesm2022/koobiq-components-autocomplete.mjs"
78
72
  },
73
+ "./badge": {
74
+ "types": "./badge/index.d.ts",
75
+ "esm2022": "./esm2022/badge/koobiq-components-badge.mjs",
76
+ "esm": "./esm2022/badge/koobiq-components-badge.mjs",
77
+ "default": "./fesm2022/koobiq-components-badge.mjs"
78
+ },
79
79
  "./button": {
80
80
  "types": "./button/index.d.ts",
81
81
  "esm2022": "./esm2022/button/koobiq-components-button.mjs",
@@ -335,6 +335,7 @@
335
335
  "default": "./fesm2022/koobiq-components-tree-select.mjs"
336
336
  }
337
337
  },
338
+ "schematics": "./schematics/collection.json",
338
339
  "module": "fesm2022/koobiq-components.mjs",
339
340
  "typings": "index.d.ts",
340
341
  "sideEffects": false