@skyux/forms 5.9.2 → 5.9.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.
@@ -8,10 +8,10 @@ import { SkyFileAttachmentLabelComponent } from './file-attachment-label.compone
8
8
  import { SkyFileAttachmentService } from './file-attachment.service';
9
9
  import { SkyFileItemService } from './file-item.service';
10
10
  import * as i0 from "@angular/core";
11
- import * as i1 from "@skyux/theme";
12
- import * as i2 from "./file-attachment.service";
13
- import * as i3 from "./file-item.service";
14
- import * as i4 from "@angular/forms";
11
+ import * as i1 from "./file-attachment.service";
12
+ import * as i2 from "./file-item.service";
13
+ import * as i3 from "@angular/forms";
14
+ import * as i4 from "@skyux/theme";
15
15
  import * as i5 from "@skyux/indicators";
16
16
  import * as i6 from "@angular/common";
17
17
  import * as i7 from "@skyux/i18n";
@@ -20,12 +20,12 @@ let uniqueId = 0;
20
20
  * Provides an element to attach a single local file.
21
21
  */
22
22
  export class SkyFileAttachmentComponent {
23
- constructor(themeSvc, changeDetector, fileAttachmentService, fileItemService, ngControl) {
24
- this.themeSvc = themeSvc;
23
+ constructor(changeDetector, fileAttachmentService, fileItemService, ngControl, themeSvc) {
25
24
  this.changeDetector = changeDetector;
26
25
  this.fileAttachmentService = fileAttachmentService;
27
26
  this.fileItemService = fileItemService;
28
27
  this.ngControl = ngControl;
28
+ this.themeSvc = themeSvc;
29
29
  /**
30
30
  * Specifies the maximum size in bytes for valid files.
31
31
  */
@@ -97,12 +97,14 @@ export class SkyFileAttachmentComponent {
97
97
  return this._value;
98
98
  }
99
99
  ngOnInit() {
100
- this.themeSvc.settingsChange
101
- .pipe(takeUntil(this.ngUnsubscribe))
102
- .subscribe((themeSettings) => {
103
- this.currentThemeName = themeSettings.currentSettings.theme.name;
104
- this.updateFileAttachmentButton();
105
- });
100
+ if (this.themeSvc) {
101
+ this.themeSvc.settingsChange
102
+ .pipe(takeUntil(this.ngUnsubscribe))
103
+ .subscribe((themeSettings) => {
104
+ this.currentThemeName = themeSettings.currentSettings.theme.name;
105
+ this.updateFileAttachmentButton();
106
+ });
107
+ }
106
108
  }
107
109
  ngAfterViewInit() {
108
110
  // This is needed to address a bug in Angular 7.
@@ -290,8 +292,8 @@ export class SkyFileAttachmentComponent {
290
292
  this.changeDetector.markForCheck();
291
293
  }
292
294
  }
293
- SkyFileAttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentComponent, deps: [{ token: i1.SkyThemeService }, { token: i0.ChangeDetectorRef }, { token: i2.SkyFileAttachmentService }, { token: i3.SkyFileItemService }, { token: i4.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
294
- SkyFileAttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyFileAttachmentComponent, selector: "sky-file-attachment", inputs: { acceptedTypes: "acceptedTypes", disabled: "disabled", maxFileSize: "maxFileSize", minFileSize: "minFileSize", validateFn: "validateFn", required: "required" }, outputs: { fileChange: "fileChange", fileClick: "fileClick" }, providers: [SkyFileAttachmentService], queries: [{ propertyName: "labelComponents", predicate: SkyFileAttachmentLabelComponent }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"\n sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\n \"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n", styles: [".sky-file-attachment-wrapper{display:inline-block}.sky-file-attachment-upload{padding-right:8px;display:block;border:1px solid transparent}.sky-file-attachment-accept{border-color:#72bf44;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}.sky-file-attachment-reject{border-color:#ef4044;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}:host(.ng-invalid.ng-dirty) .sky-file-attachment-btn{box-shadow:0 0 8px #ef404499;border:1px solid #ef4044}.sky-file-attachment-name{padding:0 5px}.sky-file-attachment-name a{cursor:pointer}.sky-file-attachment-delete{border:none;color:#cdcfd2;cursor:pointer;padding:0}.sky-file-attachment-delete:hover{color:#979ba2;transition:color .15s}.sky-file-attachment-preview-img{max-width:25%;height:auto;box-shadow:0 0 5px #666;margin:10px}.sky-file-attachment-drop-description{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}:host-context(.sky-theme-modern) .sky-file-attachment-none{font-size:13px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}.sky-theme-modern .sky-file-attachment-none{font-size:13px}.sky-theme-modern .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}\n"], components: [{ type: i5.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }], pipes: { "skyLibResources": i7.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
295
+ SkyFileAttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyFileAttachmentService }, { token: i2.SkyFileItemService }, { token: i3.NgControl, optional: true, self: true }, { token: i4.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
296
+ SkyFileAttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyFileAttachmentComponent, selector: "sky-file-attachment", inputs: { acceptedTypes: "acceptedTypes", disabled: "disabled", maxFileSize: "maxFileSize", minFileSize: "minFileSize", validateFn: "validateFn", required: "required" }, outputs: { fileChange: "fileChange", fileClick: "fileClick" }, providers: [SkyFileAttachmentService], queries: [{ propertyName: "labelComponents", predicate: SkyFileAttachmentLabelComponent }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"\n sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\n \"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n", styles: [".sky-file-attachment-wrapper{display:inline-block}.sky-file-attachment-upload{padding-right:8px;display:block;border:1px solid transparent}.sky-file-attachment-accept{border-color:#72bf44;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}.sky-file-attachment-reject{border-color:#ef4044;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}:host(.ng-invalid.ng-dirty) .sky-file-attachment-btn{box-shadow:0 0 8px #ef404499;border:1px solid #ef4044}.sky-file-attachment-name{padding:0 5px}.sky-file-attachment-name a{cursor:pointer}.sky-file-attachment-delete{border:none;color:#cdcfd2;cursor:pointer;padding:0}.sky-file-attachment-delete:hover{color:#979ba2;transition:color .15s}.sky-file-attachment-preview-img{max-width:25%;height:auto;box-shadow:0 0 5px #666;margin:10px}.sky-file-attachment-drop-description{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}:host-context(.sky-theme-modern) .sky-file-attachment-none{font-size:13px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}.sky-theme-modern .sky-file-attachment-none{font-size:13px}.sky-theme-modern .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}\n"], components: [{ type: i5.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }], pipes: { "skyLibResources": i7.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
295
297
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentComponent, decorators: [{
296
298
  type: Component,
297
299
  args: [{
@@ -301,10 +303,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
301
303
  providers: [SkyFileAttachmentService],
302
304
  changeDetection: ChangeDetectionStrategy.OnPush,
303
305
  }]
304
- }], ctorParameters: function () { return [{ type: i1.SkyThemeService }, { type: i0.ChangeDetectorRef }, { type: i2.SkyFileAttachmentService }, { type: i3.SkyFileItemService }, { type: i4.NgControl, decorators: [{
306
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.SkyFileAttachmentService }, { type: i2.SkyFileItemService }, { type: i3.NgControl, decorators: [{
305
307
  type: Self
306
308
  }, {
307
309
  type: Optional
310
+ }] }, { type: i4.SkyThemeService, decorators: [{
311
+ type: Optional
308
312
  }] }]; }, propDecorators: { acceptedTypes: [{
309
313
  type: Input
310
314
  }], disabled: [{
@@ -1 +1 @@
1
- {"version":3,"file":"file-attachment.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/file-attachment/file-attachment.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/file-attachment/file-attachment.component.html"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,IAAI,EACJ,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,k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,kCAAkC;oBAC/C,SAAS,EAAE,CAAC,kCAAkC,CAAC;oBAC/C,SAAS,EAAE,CAAC,wBAAwB,CAAC;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;;0BA4HI,IAAI;;0BAAI,QAAQ;4CAlHZ,aAAa;sBADnB,KAAK;gBAQK,QAAQ;sBADlB,KAAK;gBAgBC,WAAW;sBADjB,KAAK;gBAOC,WAAW;sBADjB,KAAK;gBAQC,UAAU;sBADhB,KAAK;gBAOC,UAAU;sBADhB,MAAM;gBAQA,SAAS;sBADf,MAAM;gBAsBA,QAAQ;sBADd,KAAK;gBA0BE,OAAO;sBADd,SAAS;uBAAC,WAAW;gBAId,eAAe;sBADtB,eAAe;uBAAC,+BAA+B","sourcesContent":["import {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n QueryList,\n Self,\n ViewChild,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { SkyFileAttachmentLabelComponent } from './file-attachment-label.component';\nimport { SkyFileAttachmentService } from './file-attachment.service';\nimport { SkyFileItem } from './file-item';\nimport { SkyFileItemService } from './file-item.service';\nimport { SkyFileAttachmentChange } from './types/file-attachment-change';\nimport { SkyFileAttachmentClick } from './types/file-attachment-click';\n\nlet uniqueId = 0;\n\n/**\n * Provides an element to attach a single local file.\n */\n@Component({\n selector: 'sky-file-attachment',\n templateUrl: './file-attachment.component.html',\n styleUrls: ['./file-attachment.component.scss'],\n providers: [SkyFileAttachmentService],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyFileAttachmentComponent\n implements AfterViewInit, AfterContentInit, OnInit, OnDestroy\n{\n /**\n * Specifies a comma-delimited string literal of MIME types that users can attach.\n * By default, all file types are allowed.\n * @required\n */\n @Input()\n public acceptedTypes: string;\n\n /**\n * Indicates whether to disable the input.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);\n if (this._disabled !== newDisabledState) {\n this._disabled = newDisabledState;\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Specifies the maximum size in bytes for valid files.\n */\n @Input()\n public maxFileSize = 500000;\n\n /**\n * Specifies the minimum size in bytes for valid files.\n */\n @Input()\n public minFileSize = 0;\n\n /**\n * Specifies a custom validation function. This validation runs alongside the internal\n * file validation. This function takes a `SkyFileItem` object as a parameter.\n */\n @Input()\n public validateFn: Function;\n\n /**\n * Fires when users add or remove files.\n */\n @Output()\n public fileChange = new EventEmitter<SkyFileAttachmentChange>();\n\n /**\n * Fires when users select the file name link. Make sure to bind the event.\n * If you do not, the file name link will be a dead link.\n */\n @Output()\n public fileClick = new EventEmitter<SkyFileAttachmentClick>();\n\n public acceptedOver = false;\n\n public get hasLabelComponent(): boolean {\n return this.labelComponents.length > 0;\n }\n\n public fileDropDescriptionElementId: string;\n\n public labelElementId: string;\n\n public rejectedOver = false;\n\n /**\n * Indicates whether the input is required for form validation.\n * When you set this property to `true`, the component adds `aria-required` and `required`\n * attributes to the input element so that forms display an invalid state until the input element\n * is complete.\n */\n @Input()\n public required = false;\n\n public set value(value: SkyFileItem) {\n // The null check is needed to address a bug in Angular 4.\n // writeValue is being called twice, first time with a phantom null value\n // See: https://github.com/angular/angular/issues/14988\n // tslint:disable-next-line:no-null-keyword\n const isNewValue = value !== this.value && value !== null;\n\n if (isNewValue) {\n this._value = value;\n this._onChange(value);\n this.updateFileAttachmentButton();\n }\n }\n\n public get value(): SkyFileItem {\n return this._value;\n }\n\n public currentThemeName: string;\n\n public showFileAttachmentButton: boolean;\n\n @ViewChild('fileInput')\n private inputEl: ElementRef;\n\n @ContentChildren(SkyFileAttachmentLabelComponent)\n private labelComponents: QueryList<SkyFileAttachmentLabelComponent>;\n\n private enterEventTarget: any;\n\n private fileAttachmentId = uniqueId++;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _disabled = false;\n\n private _value: any;\n\n constructor(\n public themeSvc: SkyThemeService,\n private changeDetector: ChangeDetectorRef,\n private fileAttachmentService: SkyFileAttachmentService,\n private fileItemService: SkyFileItemService,\n @Self() @Optional() private ngControl: NgControl\n ) {\n this.labelElementId = `sky-file-attachment-label-${this.fileAttachmentId}`;\n this.fileDropDescriptionElementId = `sky-file-attachment-drop-description-${this.fileAttachmentId}`;\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n public ngOnInit(): void {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((themeSettings) => {\n this.currentThemeName = themeSettings.currentSettings.theme.name;\n this.updateFileAttachmentButton();\n });\n }\n\n public ngAfterViewInit(): void {\n // This is needed to address a bug in Angular 7.\n // When a control value is set intially, its value is not represented on the view.\n // See: https://github.com/angular/angular/issues/13792\n // Of note is the parent check which allows us to determine if the form is reactive.\n // Without this check there is a changed before checked error\n /* istanbul ignore else */\n if (this.ngControl) {\n setTimeout(() => {\n this.ngControl.control.setValue(this.value, {\n emitEvent: false,\n });\n this.changeDetector.markForCheck();\n });\n\n // Backwards compatibility support for anyone still using Validators.Required.\n this.required =\n this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);\n }\n }\n\n public ngAfterContentInit(): void {\n // Handles updating classes when label changes\n this.labelComponents.changes\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.changeDetector.detectChanges();\n });\n }\n\n public isImage(): boolean {\n return this.fileItemService.isImage(this.value);\n }\n\n public onDropClicked(): void {\n this._onTouched();\n this.inputEl.nativeElement.click();\n }\n\n public fileChangeEvent(fileChangeEvent: any): void {\n this.handleFiles(fileChangeEvent.target.files);\n }\n\n public fileDragEnter(dragEnterEvent: any): void {\n // Save this target to know when the drag event leaves\n this.enterEventTarget = dragEnterEvent.target;\n dragEnterEvent.stopPropagation();\n dragEnterEvent.preventDefault();\n }\n\n public fileDragOver(dragOverEvent: any): void {\n const transfer = dragOverEvent.dataTransfer;\n\n dragOverEvent.stopPropagation();\n dragOverEvent.preventDefault();\n\n if (transfer) {\n if (transfer.items) {\n const files = transfer.items;\n\n for (let index = 0; index < files.length; index++) {\n const file: any = files[index];\n\n if (\n file.type &&\n this.fileAttachmentService.fileTypeRejected(\n file.type,\n this.acceptedTypes\n )\n ) {\n this.rejectedOver = true;\n this.acceptedOver = false;\n return;\n }\n }\n\n if (files.length > 0 && !this.acceptedOver) {\n this.rejectedOver = false;\n this.acceptedOver = true;\n }\n } else if (transfer.files) {\n // If the browser does not support DataTransfer.items,\n // defer file-type checking to drop handler.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility\n this.rejectedOver = false;\n this.acceptedOver = true;\n }\n }\n }\n\n public fileDrop(dropEvent: DragEvent): void {\n dropEvent.stopPropagation();\n dropEvent.preventDefault();\n\n this.enterEventTarget = undefined;\n this.rejectedOver = false;\n this.acceptedOver = false;\n\n if (dropEvent.dataTransfer && dropEvent.dataTransfer.files) {\n if (dropEvent.dataTransfer.files.length > 1) {\n return;\n }\n\n if (\n this.fileAttachmentService.hasDirectory(dropEvent.dataTransfer.files)\n ) {\n return;\n }\n\n this.handleFiles(dropEvent.dataTransfer.files);\n }\n }\n\n public fileDragLeave(dragLeaveEvent: any): void {\n if (this.enterEventTarget === dragLeaveEvent.target) {\n this.rejectedOver = false;\n this.acceptedOver = false;\n }\n }\n\n public deleteFileAttachment(): void {\n this.value = undefined;\n this.changeDetector.markForCheck();\n this.emitFileChangeEvent(this.value);\n }\n\n public getFileName(truncate = true): string | undefined {\n if (this.value) {\n // tslint:disable-next-line: max-line-length\n const dropName =\n this.fileItemService.isFile(this.value) && this.value.file.name\n ? this.value.file.name\n : this.value.url;\n\n if (truncate && dropName.length > 26) {\n return dropName.slice(0, 26) + '...';\n } else {\n return dropName;\n }\n } else {\n return undefined;\n }\n }\n\n public ngOnDestroy(): void {\n this.fileChange.complete();\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public registerOnChange(fn: (value: any) => any): void {\n this._onChange = fn;\n }\n public registerOnTouched(fn: () => any): void {\n this._onTouched = fn;\n }\n\n public writeValue(value: any): void {\n this.value = value;\n this.changeDetector.markForCheck();\n }\n\n /**\n * @internal\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n public setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n this.changeDetector.markForCheck();\n }\n\n public emitClick(): void {\n this.fileClick.emit({\n file: this.value,\n });\n }\n\n private emitFileChangeEvent(currentFile: SkyFileItem): void {\n if (currentFile && !currentFile.errorType) {\n this.writeValue(currentFile);\n }\n this.fileChange.emit({\n file: currentFile,\n } as SkyFileAttachmentChange);\n\n this.inputEl.nativeElement.value = '';\n }\n\n private loadFile(file: SkyFileItem): void {\n const reader = new FileReader();\n\n reader.addEventListener('load', (event: any): void => {\n file.url = event.target.result;\n this.emitFileChangeEvent(file);\n });\n\n reader.addEventListener('error', (event: any): void => {\n this.emitFileChangeEvent(file);\n });\n\n reader.addEventListener('abort', (event: any): void => {\n this.emitFileChangeEvent(file);\n });\n\n reader.readAsDataURL(file.file);\n }\n\n private handleFiles(files: FileList): void {\n // tslint:disable-next-line: max-line-length\n const processedFiles = this.fileAttachmentService.checkFiles(\n files,\n this.minFileSize,\n this.maxFileSize,\n this.acceptedTypes,\n this.validateFn\n );\n\n for (const file of processedFiles) {\n if (file.errorType) {\n this.emitFileChangeEvent(file);\n } else {\n this.loadFile(file);\n }\n }\n }\n\n private updateFileAttachmentButton(): void {\n this.showFileAttachmentButton = !(\n this.value && this.currentThemeName === 'modern'\n );\n this.changeDetector.markForCheck();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private _onChange = (_: any) => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private _onTouched = () => {};\n}\n","<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"\n sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\n \"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n"]}
1
+ {"version":3,"file":"file-attachment.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/file-attachment/file-attachment.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/file-attachment/file-attachment.component.html"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,IAAI,EACJ,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE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,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;;wHAvXU,0BAA0B;4GAA1B,0BAA0B,uRAH1B,CAAC,wBAAwB,CAAC,0DA4GpB,+BAA+B,mICtJlD,00GA+GA;4FDlEa,0BAA0B;kBAPtC,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,WAAW,EAAE,kCAAkC;oBAC/C,SAAS,EAAE,CAAC,kCAAkC,CAAC;oBAC/C,SAAS,EAAE,CAAC,wBAAwB,CAAC;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;;0BA2HI,IAAI;;0BAAI,QAAQ;;0BAChB,QAAQ;4CAlHJ,aAAa;sBADnB,KAAK;gBAQK,QAAQ;sBADlB,KAAK;gBAgBC,WAAW;sBADjB,KAAK;gBAOC,WAAW;sBADjB,KAAK;gBAQC,UAAU;sBADhB,KAAK;gBAOC,UAAU;sBADhB,MAAM;gBAQA,SAAS;sBADf,MAAM;gBAsBA,QAAQ;sBADd,KAAK;gBA0BE,OAAO;sBADd,SAAS;uBAAC,WAAW;gBAId,eAAe;sBADtB,eAAe;uBAAC,+BAA+B","sourcesContent":["import {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n QueryList,\n Self,\n ViewChild,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { SkyFileAttachmentLabelComponent } from './file-attachment-label.component';\nimport { SkyFileAttachmentService } from './file-attachment.service';\nimport { SkyFileItem } from './file-item';\nimport { SkyFileItemService } from './file-item.service';\nimport { SkyFileAttachmentChange } from './types/file-attachment-change';\nimport { SkyFileAttachmentClick } from './types/file-attachment-click';\n\nlet uniqueId = 0;\n\n/**\n * Provides an element to attach a single local file.\n */\n@Component({\n selector: 'sky-file-attachment',\n templateUrl: './file-attachment.component.html',\n styleUrls: ['./file-attachment.component.scss'],\n providers: [SkyFileAttachmentService],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyFileAttachmentComponent\n implements AfterViewInit, AfterContentInit, OnInit, OnDestroy\n{\n /**\n * Specifies a comma-delimited string literal of MIME types that users can attach.\n * By default, all file types are allowed.\n * @required\n */\n @Input()\n public acceptedTypes: string;\n\n /**\n * Indicates whether to disable the input.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);\n if (this._disabled !== newDisabledState) {\n this._disabled = newDisabledState;\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Specifies the maximum size in bytes for valid files.\n */\n @Input()\n public maxFileSize = 500000;\n\n /**\n * Specifies the minimum size in bytes for valid files.\n */\n @Input()\n public minFileSize = 0;\n\n /**\n * Specifies a custom validation function. This validation runs alongside the internal\n * file validation. This function takes a `SkyFileItem` object as a parameter.\n */\n @Input()\n public validateFn: Function;\n\n /**\n * Fires when users add or remove files.\n */\n @Output()\n public fileChange = new EventEmitter<SkyFileAttachmentChange>();\n\n /**\n * Fires when users select the file name link. Make sure to bind the event.\n * If you do not, the file name link will be a dead link.\n */\n @Output()\n public fileClick = new EventEmitter<SkyFileAttachmentClick>();\n\n public acceptedOver = false;\n\n public get hasLabelComponent(): boolean {\n return this.labelComponents.length > 0;\n }\n\n public fileDropDescriptionElementId: string;\n\n public labelElementId: string;\n\n public rejectedOver = false;\n\n /**\n * Indicates whether the input is required for form validation.\n * When you set this property to `true`, the component adds `aria-required` and `required`\n * attributes to the input element so that forms display an invalid state until the input element\n * is complete.\n */\n @Input()\n public required = false;\n\n public set value(value: SkyFileItem) {\n // The null check is needed to address a bug in Angular 4.\n // writeValue is being called twice, first time with a phantom null value\n // See: https://github.com/angular/angular/issues/14988\n // tslint:disable-next-line:no-null-keyword\n const isNewValue = value !== this.value && value !== null;\n\n if (isNewValue) {\n this._value = value;\n this._onChange(value);\n this.updateFileAttachmentButton();\n }\n }\n\n public get value(): SkyFileItem {\n return this._value;\n }\n\n public currentThemeName: string;\n\n public showFileAttachmentButton: boolean;\n\n @ViewChild('fileInput')\n private inputEl: ElementRef;\n\n @ContentChildren(SkyFileAttachmentLabelComponent)\n private labelComponents: QueryList<SkyFileAttachmentLabelComponent>;\n\n private enterEventTarget: any;\n\n private fileAttachmentId = uniqueId++;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _disabled = false;\n\n private _value: any;\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private fileAttachmentService: SkyFileAttachmentService,\n private fileItemService: SkyFileItemService,\n @Self() @Optional() private ngControl?: NgControl,\n @Optional() private themeSvc?: SkyThemeService\n ) {\n this.labelElementId = `sky-file-attachment-label-${this.fileAttachmentId}`;\n this.fileDropDescriptionElementId = `sky-file-attachment-drop-description-${this.fileAttachmentId}`;\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n public ngOnInit(): void {\n if (this.themeSvc) {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((themeSettings) => {\n this.currentThemeName = themeSettings.currentSettings.theme.name;\n this.updateFileAttachmentButton();\n });\n }\n }\n\n public ngAfterViewInit(): void {\n // This is needed to address a bug in Angular 7.\n // When a control value is set intially, its value is not represented on the view.\n // See: https://github.com/angular/angular/issues/13792\n // Of note is the parent check which allows us to determine if the form is reactive.\n // Without this check there is a changed before checked error\n /* istanbul ignore else */\n if (this.ngControl) {\n setTimeout(() => {\n this.ngControl.control.setValue(this.value, {\n emitEvent: false,\n });\n this.changeDetector.markForCheck();\n });\n\n // Backwards compatibility support for anyone still using Validators.Required.\n this.required =\n this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);\n }\n }\n\n public ngAfterContentInit(): void {\n // Handles updating classes when label changes\n this.labelComponents.changes\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.changeDetector.detectChanges();\n });\n }\n\n public isImage(): boolean {\n return this.fileItemService.isImage(this.value);\n }\n\n public onDropClicked(): void {\n this._onTouched();\n this.inputEl.nativeElement.click();\n }\n\n public fileChangeEvent(fileChangeEvent: any): void {\n this.handleFiles(fileChangeEvent.target.files);\n }\n\n public fileDragEnter(dragEnterEvent: any): void {\n // Save this target to know when the drag event leaves\n this.enterEventTarget = dragEnterEvent.target;\n dragEnterEvent.stopPropagation();\n dragEnterEvent.preventDefault();\n }\n\n public fileDragOver(dragOverEvent: any): void {\n const transfer = dragOverEvent.dataTransfer;\n\n dragOverEvent.stopPropagation();\n dragOverEvent.preventDefault();\n\n if (transfer) {\n if (transfer.items) {\n const files = transfer.items;\n\n for (let index = 0; index < files.length; index++) {\n const file: any = files[index];\n\n if (\n file.type &&\n this.fileAttachmentService.fileTypeRejected(\n file.type,\n this.acceptedTypes\n )\n ) {\n this.rejectedOver = true;\n this.acceptedOver = false;\n return;\n }\n }\n\n if (files.length > 0 && !this.acceptedOver) {\n this.rejectedOver = false;\n this.acceptedOver = true;\n }\n } else if (transfer.files) {\n // If the browser does not support DataTransfer.items,\n // defer file-type checking to drop handler.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility\n this.rejectedOver = false;\n this.acceptedOver = true;\n }\n }\n }\n\n public fileDrop(dropEvent: DragEvent): void {\n dropEvent.stopPropagation();\n dropEvent.preventDefault();\n\n this.enterEventTarget = undefined;\n this.rejectedOver = false;\n this.acceptedOver = false;\n\n if (dropEvent.dataTransfer && dropEvent.dataTransfer.files) {\n if (dropEvent.dataTransfer.files.length > 1) {\n return;\n }\n\n if (\n this.fileAttachmentService.hasDirectory(dropEvent.dataTransfer.files)\n ) {\n return;\n }\n\n this.handleFiles(dropEvent.dataTransfer.files);\n }\n }\n\n public fileDragLeave(dragLeaveEvent: any): void {\n if (this.enterEventTarget === dragLeaveEvent.target) {\n this.rejectedOver = false;\n this.acceptedOver = false;\n }\n }\n\n public deleteFileAttachment(): void {\n this.value = undefined;\n this.changeDetector.markForCheck();\n this.emitFileChangeEvent(this.value);\n }\n\n public getFileName(truncate = true): string | undefined {\n if (this.value) {\n // tslint:disable-next-line: max-line-length\n const dropName =\n this.fileItemService.isFile(this.value) && this.value.file.name\n ? this.value.file.name\n : this.value.url;\n\n if (truncate && dropName.length > 26) {\n return dropName.slice(0, 26) + '...';\n } else {\n return dropName;\n }\n } else {\n return undefined;\n }\n }\n\n public ngOnDestroy(): void {\n this.fileChange.complete();\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public registerOnChange(fn: (value: any) => any): void {\n this._onChange = fn;\n }\n public registerOnTouched(fn: () => any): void {\n this._onTouched = fn;\n }\n\n public writeValue(value: any): void {\n this.value = value;\n this.changeDetector.markForCheck();\n }\n\n /**\n * @internal\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n public setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n this.changeDetector.markForCheck();\n }\n\n public emitClick(): void {\n this.fileClick.emit({\n file: this.value,\n });\n }\n\n private emitFileChangeEvent(currentFile: SkyFileItem): void {\n if (currentFile && !currentFile.errorType) {\n this.writeValue(currentFile);\n }\n this.fileChange.emit({\n file: currentFile,\n } as SkyFileAttachmentChange);\n\n this.inputEl.nativeElement.value = '';\n }\n\n private loadFile(file: SkyFileItem): void {\n const reader = new FileReader();\n\n reader.addEventListener('load', (event: any): void => {\n file.url = event.target.result;\n this.emitFileChangeEvent(file);\n });\n\n reader.addEventListener('error', (event: any): void => {\n this.emitFileChangeEvent(file);\n });\n\n reader.addEventListener('abort', (event: any): void => {\n this.emitFileChangeEvent(file);\n });\n\n reader.readAsDataURL(file.file);\n }\n\n private handleFiles(files: FileList): void {\n // tslint:disable-next-line: max-line-length\n const processedFiles = this.fileAttachmentService.checkFiles(\n files,\n this.minFileSize,\n this.maxFileSize,\n this.acceptedTypes,\n this.validateFn\n );\n\n for (const file of processedFiles) {\n if (file.errorType) {\n this.emitFileChangeEvent(file);\n } else {\n this.loadFile(file);\n }\n }\n }\n\n private updateFileAttachmentButton(): void {\n this.showFileAttachmentButton = !(\n this.value && this.currentThemeName === 'modern'\n );\n this.changeDetector.markForCheck();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private _onChange = (_: any) => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private _onTouched = () => {};\n}\n","<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"\n sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\n \"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n"]}
@@ -1,4 +1,4 @@
1
- import { ChangeDetectionStrategy, Component, ContentChildren, ElementRef, HostListener, Input, NgZone, QueryList, ViewChild, ViewEncapsulation, } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, ContentChildren, ElementRef, HostListener, Input, NgZone, Optional, QueryList, ViewChild, ViewEncapsulation, } from '@angular/core';
2
2
  import { MutationObserverService, SkyCoreAdapterService, } from '@skyux/core';
3
3
  import { SkyThemeService } from '@skyux/theme';
4
4
  import { Subject } from 'rxjs';
@@ -6,22 +6,22 @@ import { takeUntil } from 'rxjs/operators';
6
6
  import { SkySelectionBoxAdapterService } from './selection-box-adapter.service';
7
7
  import { SkySelectionBoxComponent } from './selection-box.component';
8
8
  import * as i0 from "@angular/core";
9
- import * as i1 from "@skyux/theme";
10
- import * as i2 from "@skyux/core";
11
- import * as i3 from "./selection-box-adapter.service";
9
+ import * as i1 from "@skyux/core";
10
+ import * as i2 from "./selection-box-adapter.service";
11
+ import * as i3 from "@skyux/theme";
12
12
  import * as i4 from "@angular/common";
13
13
  const SKY_SELECTION_BOX_CLASS_NAME = '.sky-selection-box';
14
14
  /**
15
15
  * Creates a grid layout for an array of selection boxes.
16
16
  */
17
17
  export class SkySelectionBoxGridComponent {
18
- constructor(themeSvc, coreAdapterService, selectionBoxAdapter, hostElRef, mutationObserverSvc, ngZone) {
19
- this.themeSvc = themeSvc;
18
+ constructor(coreAdapterService, selectionBoxAdapter, hostElRef, mutationObserverSvc, ngZone, themeSvc) {
20
19
  this.coreAdapterService = coreAdapterService;
21
20
  this.selectionBoxAdapter = selectionBoxAdapter;
22
21
  this.hostElRef = hostElRef;
23
22
  this.mutationObserverSvc = mutationObserverSvc;
24
23
  this.ngZone = ngZone;
24
+ this.themeSvc = themeSvc;
25
25
  this.ngUnsubscribe = new Subject();
26
26
  }
27
27
  /**
@@ -101,7 +101,7 @@ export class SkySelectionBoxGridComponent {
101
101
  this.coreAdapterService.syncMaxHeight(this.elementRef, SKY_SELECTION_BOX_CLASS_NAME);
102
102
  }
103
103
  }
104
- SkySelectionBoxGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxGridComponent, deps: [{ token: i1.SkyThemeService }, { token: i2.SkyCoreAdapterService }, { token: i3.SkySelectionBoxAdapterService }, { token: i0.ElementRef }, { token: i2.MutationObserverService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
104
+ SkySelectionBoxGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxGridComponent, deps: [{ token: i1.SkyCoreAdapterService }, { token: i2.SkySelectionBoxAdapterService }, { token: i0.ElementRef }, { token: i1.MutationObserverService }, { token: i0.NgZone }, { token: i3.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
105
105
  SkySelectionBoxGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySelectionBoxGridComponent, selector: "sky-selection-box-grid", inputs: { alignItems: "alignItems" }, host: { listeners: { "window:resize": "onWindowResize()" } }, queries: [{ propertyName: "selectionBoxes", predicate: SkySelectionBoxComponent, read: SkySelectionBoxComponent }], viewQueries: [{ propertyName: "elementRef", first: true, predicate: ["container"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-selection-box-grid\"\n [ngClass]=\"'sky-selection-box-grid-align-' + alignItems\"\n #container\n>\n <ng-content select=\"sky-selection-box\"></ng-content>\n</div>\n", styles: [":host{display:block}.sky-selection-box-grid{display:flex;flex-flow:row wrap;padding:0 7.5px;margin:0 auto}.sky-selection-box-grid.sky-selection-box-grid-align-center{justify-content:center}.sky-selection-box-grid.sky-selection-box-grid-align-left{justify-content:flex-start}.sky-selection-box-grid>sky-selection-box{margin:0 7.5px 15px;height:100%}.sky-selection-box-grid.sky-selection-box-container-xs{max-width:374px}.sky-selection-box-grid.sky-selection-box-container-xs>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-sm{max-width:733px}.sky-selection-box-grid.sky-selection-box-container-sm>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-md{max-width:937px}.sky-selection-box-grid.sky-selection-box-container-md>sky-selection-box{flex:0 1 446px}.sky-selection-box-grid.sky-selection-box-container-lg{max-width:1398px}.sky-selection-box-grid.sky-selection-box-container-lg>sky-selection-box{flex:0 1 446px}\n"], directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
106
106
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxGridComponent, decorators: [{
107
107
  type: Component,
@@ -112,7 +112,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
112
112
  changeDetection: ChangeDetectionStrategy.OnPush,
113
113
  encapsulation: ViewEncapsulation.None,
114
114
  }]
115
- }], ctorParameters: function () { return [{ type: i1.SkyThemeService }, { type: i2.SkyCoreAdapterService }, { type: i3.SkySelectionBoxAdapterService }, { type: i0.ElementRef }, { type: i2.MutationObserverService }, { type: i0.NgZone }]; }, propDecorators: { alignItems: [{
115
+ }], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }, { type: i2.SkySelectionBoxAdapterService }, { type: i0.ElementRef }, { type: i1.MutationObserverService }, { type: i0.NgZone }, { type: i3.SkyThemeService, decorators: [{
116
+ type: Optional
117
+ }] }]; }, propDecorators: { alignItems: [{
116
118
  type: Input
117
119
  }], selectionBoxes: [{
118
120
  type: ContentChildren,
@@ -1 +1 @@
1
- {"version":3,"file":"selection-box-grid.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/selection-box/selection-box-grid.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/selection-box/selection-box-grid.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EACL,MAAM,EAGN,SAAS,EACT,SAAS,EACT,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;;;;;;AAGrE,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAE1D;;GAEG;AAQH,MAAM,OAAO,4BAA4B;IA4CvC,YACU,QAAyB,EACzB,kBAAyC,EACzC,mBAAkD,EAClD,SAAqB,EACrB,mBAA4C,EAC5C,MAAc;QALd,aAAQ,GAAR,QAAQ,CAAiB;QACzB,uBAAkB,GAAlB,kBAAkB,CAAuB;QACzC,wBAAmB,GAAnB,mBAAmB,CAA+B;QAClD,cAAS,GAAT,SAAS,CAAY;QACrB,wBAAmB,GAAnB,mBAAmB,CAAyB;QAC5C,WAAM,GAAN,MAAM,CAAQ;QAZhB,kBAAa,GAAG,IAAI,OAAO,EAAE,CAAC;IAanC,CAAC;IAhDJ;;;;OAIG;IACH,IACW,UAAU,CAAC,KAAwC;QAC5D,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC;IACtC,CAA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AK;gBAYC,cAAc;sBAHpB,eAAe;uBAAC,wBAAwB,EAAE;wBACzC,IAAI,EAAE,wBAAwB;qBAC/B;gBAeO,UAAU;sBAJjB,SAAS;uBAAC,WAAW,EAAE;wBACtB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBA8CM,cAAc;sBADpB,YAAY;uBAAC,eAAe","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n ElementRef,\n HostListener,\n Input,\n NgZone,\n OnDestroy,\n OnInit,\n QueryList,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n MutationObserverService,\n SkyCoreAdapterService,\n SkyMediaBreakpoints,\n} from '@skyux/core';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkySelectionBoxAdapterService } from './selection-box-adapter.service';\nimport { SkySelectionBoxComponent } from './selection-box.component';\nimport { SkySelectionBoxGridAlignItemsType } from './types/selection-box-grid-align-items-type';\n\nconst SKY_SELECTION_BOX_CLASS_NAME = '.sky-selection-box';\n\n/**\n * Creates a grid layout for an array of selection boxes.\n */\n@Component({\n selector: 'sky-selection-box-grid',\n templateUrl: './selection-box-grid.component.html',\n styleUrls: ['./selection-box-grid.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkySelectionBoxGridComponent\n implements AfterViewInit, OnDestroy, OnInit\n{\n /**\n * @internal\n * Specifies how to display the selection boxes in the grid.\n * @default 'center'\n */\n @Input()\n public set alignItems(value: SkySelectionBoxGridAlignItemsType) {\n this._alignItems = value;\n }\n\n public get alignItems(): SkySelectionBoxGridAlignItemsType {\n return this._alignItems || 'center';\n }\n\n @ContentChildren(SkySelectionBoxComponent, {\n read: SkySelectionBoxComponent,\n })\n public selectionBoxes: QueryList<SkySelectionBoxComponent>;\n\n private set currentBreakpoint(value: SkyMediaBreakpoints) {\n if (value !== this._currentBreakpoint) {\n this._currentBreakpoint = value;\n this.selectionBoxAdapter.setResponsiveClass(this.elementRef, value);\n this.updateChildrenHeights();\n }\n }\n\n @ViewChild('container', {\n read: ElementRef,\n static: true,\n })\n private elementRef: ElementRef<any>;\n\n private mutationObserver: MutationObserver;\n\n private ngUnsubscribe = new Subject();\n\n private _alignItems: SkySelectionBoxGridAlignItemsType;\n\n private _currentBreakpoint: SkyMediaBreakpoints;\n\n constructor(\n private themeSvc: SkyThemeService,\n private coreAdapterService: SkyCoreAdapterService,\n private selectionBoxAdapter: SkySelectionBoxAdapterService,\n private hostElRef: ElementRef,\n private mutationObserverSvc: MutationObserverService,\n private ngZone: NgZone\n ) {}\n\n public ngOnInit(): void {\n /* istanbul ignore else */\n if (this.themeSvc) {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.updateBreakpointClass();\n this.updateChildrenHeights();\n });\n }\n }\n\n public ngAfterViewInit(): void {\n this.updateBreakpointClass();\n this.updateChildrenHeights();\n this.initMutationObserver();\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n\n this.destroyMutationObserver();\n }\n\n @HostListener('window:resize')\n public onWindowResize(): void {\n this.updateBreakpointClass();\n }\n\n private initMutationObserver(): void {\n /* istanbul ignore else */\n if (!this.mutationObserver) {\n const el = this.elementRef.nativeElement;\n\n // MutationObserver is patched by Zone.js and therefore becomes part of the\n // Angular change detection cycle, but this can lead to infinite loops in some\n // scenarios. This will keep MutationObserver from triggering change detection.\n this.ngZone.runOutsideAngular(() => {\n this.mutationObserver = this.mutationObserverSvc.create(() => {\n this.updateChildrenHeights();\n });\n\n this.mutationObserver.observe(el, {\n characterData: true,\n subtree: true,\n });\n });\n }\n }\n\n private destroyMutationObserver(): void {\n /* istanbul ignore else */\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n }\n\n private updateBreakpointClass(): void {\n const parentWidth = this.selectionBoxAdapter.getParentWidth(this.hostElRef);\n this.currentBreakpoint =\n this.selectionBoxAdapter.getBreakpointForWidth(parentWidth);\n }\n\n private updateChildrenHeights(): void {\n this.coreAdapterService.resetHeight(\n this.elementRef,\n SKY_SELECTION_BOX_CLASS_NAME\n );\n this.coreAdapterService.syncMaxHeight(\n this.elementRef,\n SKY_SELECTION_BOX_CLASS_NAME\n );\n }\n}\n","<div\n class=\"sky-selection-box-grid\"\n [ngClass]=\"'sky-selection-box-grid-align-' + alignItems\"\n #container\n>\n <ng-content select=\"sky-selection-box\"></ng-content>\n</div>\n"]}
1
+ {"version":3,"file":"selection-box-grid.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/selection-box/selection-box-grid.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/selection-box/selection-box-grid.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EACL,MAAM,EAGN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;;;;;;AAGrE,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAE1D;;GAEG;AAQH,MAAM,OAAO,4BAA4B;IA4CvC,YACU,kBAAyC,EACzC,mBAAkD,EAClD,SAAqB,EACrB,mBAA4C,EAC5C,MAAc,EACF,QAA0B;QALtC,uBAA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CAAC,kBAAkB,CAAC,aAAa,CACnC,IAAI,CAAC,UAAU,EACf,4BAA4B,CAC7B,CAAC;IACJ,CAAC;;0HA/HU,4BAA4B;8GAA5B,4BAA4B,iMAiBtB,wBAAwB,QACjC,wBAAwB,iHAaxB,UAAU,2CCzEpB,6LAOA;4FDmCa,4BAA4B;kBAPxC,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;oBAClC,WAAW,EAAE,qCAAqC;oBAClD,SAAS,EAAE,CAAC,qCAAqC,CAAC;oBAClD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;;0BAmDI,QAAQ;4CAzCA,UAAU;sBADpB,KAAK;gBAYC,cAAc;sBAHpB,eAAe;uBAAC,wBAAwB,EAAE;wBACzC,IAAI,EAAE,wBAAwB;qBAC/B;gBAeO,UAAU;sBAJjB,SAAS;uBAAC,WAAW,EAAE;wBACtB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBA8CM,cAAc;sBADpB,YAAY;uBAAC,eAAe","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n ElementRef,\n HostListener,\n Input,\n NgZone,\n OnDestroy,\n OnInit,\n Optional,\n QueryList,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n MutationObserverService,\n SkyCoreAdapterService,\n SkyMediaBreakpoints,\n} from '@skyux/core';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkySelectionBoxAdapterService } from './selection-box-adapter.service';\nimport { SkySelectionBoxComponent } from './selection-box.component';\nimport { SkySelectionBoxGridAlignItemsType } from './types/selection-box-grid-align-items-type';\n\nconst SKY_SELECTION_BOX_CLASS_NAME = '.sky-selection-box';\n\n/**\n * Creates a grid layout for an array of selection boxes.\n */\n@Component({\n selector: 'sky-selection-box-grid',\n templateUrl: './selection-box-grid.component.html',\n styleUrls: ['./selection-box-grid.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkySelectionBoxGridComponent\n implements AfterViewInit, OnDestroy, OnInit\n{\n /**\n * @internal\n * Specifies how to display the selection boxes in the grid.\n * @default 'center'\n */\n @Input()\n public set alignItems(value: SkySelectionBoxGridAlignItemsType) {\n this._alignItems = value;\n }\n\n public get alignItems(): SkySelectionBoxGridAlignItemsType {\n return this._alignItems || 'center';\n }\n\n @ContentChildren(SkySelectionBoxComponent, {\n read: SkySelectionBoxComponent,\n })\n public selectionBoxes: QueryList<SkySelectionBoxComponent>;\n\n private set currentBreakpoint(value: SkyMediaBreakpoints) {\n if (value !== this._currentBreakpoint) {\n this._currentBreakpoint = value;\n this.selectionBoxAdapter.setResponsiveClass(this.elementRef, value);\n this.updateChildrenHeights();\n }\n }\n\n @ViewChild('container', {\n read: ElementRef,\n static: true,\n })\n private elementRef: ElementRef<any>;\n\n private mutationObserver: MutationObserver;\n\n private ngUnsubscribe = new Subject();\n\n private _alignItems: SkySelectionBoxGridAlignItemsType;\n\n private _currentBreakpoint: SkyMediaBreakpoints;\n\n constructor(\n private coreAdapterService: SkyCoreAdapterService,\n private selectionBoxAdapter: SkySelectionBoxAdapterService,\n private hostElRef: ElementRef,\n private mutationObserverSvc: MutationObserverService,\n private ngZone: NgZone,\n @Optional() private themeSvc?: SkyThemeService\n ) {}\n\n public ngOnInit(): void {\n /* istanbul ignore else */\n if (this.themeSvc) {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.updateBreakpointClass();\n this.updateChildrenHeights();\n });\n }\n }\n\n public ngAfterViewInit(): void {\n this.updateBreakpointClass();\n this.updateChildrenHeights();\n this.initMutationObserver();\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n\n this.destroyMutationObserver();\n }\n\n @HostListener('window:resize')\n public onWindowResize(): void {\n this.updateBreakpointClass();\n }\n\n private initMutationObserver(): void {\n /* istanbul ignore else */\n if (!this.mutationObserver) {\n const el = this.elementRef.nativeElement;\n\n // MutationObserver is patched by Zone.js and therefore becomes part of the\n // Angular change detection cycle, but this can lead to infinite loops in some\n // scenarios. This will keep MutationObserver from triggering change detection.\n this.ngZone.runOutsideAngular(() => {\n this.mutationObserver = this.mutationObserverSvc.create(() => {\n this.updateChildrenHeights();\n });\n\n this.mutationObserver.observe(el, {\n characterData: true,\n subtree: true,\n });\n });\n }\n }\n\n private destroyMutationObserver(): void {\n /* istanbul ignore else */\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n }\n\n private updateBreakpointClass(): void {\n const parentWidth = this.selectionBoxAdapter.getParentWidth(this.hostElRef);\n this.currentBreakpoint =\n this.selectionBoxAdapter.getBreakpointForWidth(parentWidth);\n }\n\n private updateChildrenHeights(): void {\n this.coreAdapterService.resetHeight(\n this.elementRef,\n SKY_SELECTION_BOX_CLASS_NAME\n );\n this.coreAdapterService.syncMaxHeight(\n this.elementRef,\n SKY_SELECTION_BOX_CLASS_NAME\n );\n }\n}\n","<div\n class=\"sky-selection-box-grid\"\n [ngClass]=\"'sky-selection-box-grid-align-' + alignItems\"\n #container\n>\n <ng-content select=\"sky-selection-box\"></ng-content>\n</div>\n"]}