{"version":3,"file":"ngx-mat-file.mjs","sources":["../../../projects/ngx-mat-file/src/lib/ngx-mat-file.service.ts","../../../projects/ngx-mat-file/src/lib/ngx-mat-file.directive.ts","../../../projects/ngx-mat-file/src/lib/ngx-mat-file.component.ts","../../../projects/ngx-mat-file/src/lib/ngx-mat-file.component.html","../../../projects/ngx-mat-file/src/lib/ngx-mat-file.module.ts","../../../projects/ngx-mat-file/src/public-api.ts","../../../projects/ngx-mat-file/src/ngx-mat-file.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class NgxMatFileService {\n\n  constructor() { }\n}\n","import { Directive, EventEmitter, HostBinding, HostListener, Output } from '@angular/core';\n\n@Directive({\n  selector: '[matFileDnd]'\n})\nexport class NgxMatFileDirective {\n\n  constructor() { }\n\n  @HostBinding('class.darken') fileOver: boolean = false;\n  @Output() fileDropped = new EventEmitter<any>();\n\n  @HostListener('dragover', ['$event']) onDragOver(event: any) {\n    event.preventDefault();\n    event.stopPropagation();\n    this.fileOver = true;\n  }\n\n  @HostListener('dragleave', ['$event']) public onDragLeave(event: any) {\n    event.preventDefault();\n    event.stopPropagation();\n    this.fileOver = false;\n  }\n\n  @HostListener('drop', ['$event']) public ondrop(event: any) {\n    event.preventDefault();\n    event.stopPropagation();\n    this.fileOver = false;\n    if (event.dataTransfer.files.length > 0) {\n      this.fileDropped.emit(event);\n    }\n  }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, EventEmitter, HostBinding, Input, OnInit, Optional, Output, Self, ViewChild } from '@angular/core';\n\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { Subject } from 'rxjs';\n\n@Component({\n  selector: 'ngx-mat-file',\n  templateUrl: './ngx-mat-file.component.html',\n  styleUrls: [ './ngx-mat-file.component.css'\n  ],\n  providers: [\n    { provide: MatFormFieldControl, useExisting: NgxMatFileComponent },\n  ]\n})\n\nexport class NgxMatFileComponent implements OnInit, ControlValueAccessor, MatFormFieldControl<Array<File>>  {\n  @Input() preview = true\n  @Input() hiddenUpload = false;\n  @Input() buttonBrowseText = \"Browse\";\n  @Input() buttonUploadText = \"Upload\";\n  @Input() buttonRemoveAllText = \"Remove All\";\n  @Input() buttonVariant = \"mat-flat-button\";\n  @Input() minlength: any = 1;\n  @Input() invalidMinFileCountMessage = \"Minimum {0} file(s) required\";\n  @Input() maxlength: any = 3;\n  @Input() invalidMaxFileCountMessage = \"Maximum number of files exceeded\";\n  @Input() invalidFileTypeMessage = \"Invalid file type. \\nAllowed file types: {0}\";\n  @Input() maxFileSize = 5;\n  @Input() invalidFileSizeMessage = \"Maximum size: {0} MB\";\n  @Input() dragAndDropText = \"Drag & drop files here\";\n  @Input()\n  get required() {\n    return this._required;\n  }\n  set required(req) {\n    this._required = coerceBooleanProperty(req);\n    this.stateChanges.next();\n  }\n  private _required = false;\n\n  @Input()\n  get previewWidth() {\n    return this._previewWidth;\n  }\n  set previewWidth(req: any) {\n    this._previewWidth = req.toString();\n    this.previewWidthStyle = \"max-width: \" + this._previewWidth + \"px\"\n    this.stateChanges.next();\n  }\n  private _previewWidth = 200\n\n  @ViewChild('ngx_mat_file_input', { static: true }) ngx_mat_file_input?: ElementRef;\n\n  private onChange: any = () => {}\n  private onTouch: any = () => {}\n  public selectedFiles: Array<File> = [] \n  public invalidFiles: Array<any> = []\n  public previewData: any = [] \n  files?: any[]\n  public previewWidthStyle: string = \"\"\n\n  //MatFormFieldControl Interface\n  static nextId = 0;\n  stateChanges = new Subject<void>();\n  @HostBinding() id = `app-ngx-mat-file-${NgxMatFileComponent.nextId++}`;\n  placeholder: string = \"\";\n  focused: boolean = false;\n  touched: boolean = false;\n  shouldLabelFloat: boolean = false;\n  controlType: string = \"app-ngx-mat-file\";\n  autofilled?: boolean | undefined;\n  userAriaDescribedBy?: string | undefined;\n  @HostBinding('attr.aria-describedby') describedBy = '';\n  setDescribedByIds(ids: string[]): void {\n    this.describedBy = ids.join(' ');\n  }\n  \n  onContainerClick(event: MouseEvent): void { }\n  \n  get errorState(): boolean {\n    return this.ngControl.control?.errors != null && this.ngControl?.control?.touched;\n  }\n\n  get empty() {\n    let n = this.value;\n    return !n.area && !n.exchange && !n.subscriber;\n  }\n  \n\n  @Input()\n  get disabled(): boolean { return this._disabled; }\n  set disabled(value: boolean) {\n  this._disabled = coerceBooleanProperty(value);\n  this._disabled ? this.ngControl.control?.enable() : this.ngControl.control?.disable();\n  this.stateChanges.next();\n}\nprivate _disabled = false;\n //MatFormFieldControl Interface\n\n @Input()\n get multiple(): boolean {\n   return this._multiple;\n }\n set multiple(value: boolean) {\n   this._multiple = coerceBooleanProperty(value);\n this._multiple ? this.ngx_mat_file_input?.nativeElement.setAttribute(\"multiple\",\"\") : \"\";\n this.stateChanges.next();\n }\n  private _multiple = false;\n  \n  @Input()\n get accept(): string {\n   return this._accept;\n }\n set accept(value: string) {\n   this._accept = value;\n   this._accept ? this.ngx_mat_file_input?.nativeElement.setAttribute(\"accept\", this._accept) : \"\"\n   this.typeError = this.invalidFileTypeMessage.replace(\"{0}\" , this.accept)\n   this.stateChanges.next()\n }\n  private _accept = \"\"\n  \n  public typeError = \"\"\n  \n  set value(val: any) {  \n    if (val && this.value !== val && val!=[]) {\n      this.stateChanges.next();\n      this.onChange(val)\n      this.onTouch(val)\n    }\n  }\n\n  private extensionLists = {\n    video: ['ogm', 'wmv', 'ogv', 'mov', 'asx', 'mpeg', 'm4v', 'avi', 'mpg', 'mp4', 'webm'],\n    audio: ['opus', 'wav', 'ogg', 'm4a', 'oga', 'mid', 'webm', 'weba', 'flac', 'mp3', 'aiff', 'wma', 'au'],\n    image: ['tiff', 'pjp', 'jfif', 'svg', 'xbm', 'dib', 'jxl', 'jpeg', 'webp', 'ico', 'tif', 'pjpeg', 'avif', 'jpg', 'gif', 'bmp', 'png']\n  }\n\n@Output() onUploadClick = new EventEmitter<any>();\n\n\n  constructor(@Optional() @Self() public ngControl: NgControl) {\n     if (this.ngControl != null) {\n      // Setting the value accessor directly (instead of using\n      // the providers) to avoid running into a circular import.\n      this.ngControl.valueAccessor = this;\n    }\n  }\n\n  ngOnInit(): void {\n    this.interpolation()\n  }\n\n  ngOnDestroy() {\n    this.stateChanges.complete();\n  }\n\n  writeValue(value: any) { \n    if (!value) {\n      this.removeAll()\n    }\n    this.value = value\n  }\n\n  registerOnChange(fn: any) {\n    this.onChange = fn\n  }\n  \n  registerOnTouched(fn: any){\n    this.onTouch = fn\n  }\n\n  interpolation() {\n    this.typeError = this.invalidFileTypeMessage.replace(\"{0}\" , this.accept)\n    this.invalidFileSizeMessage = this.invalidFileSizeMessage.replace(\"{0}\", this.maxFileSize.toString())\n    this.invalidMinFileCountMessage = this.invalidMinFileCountMessage.replace(\"{0}\", this.minlength.toString())\n    this.invalidMaxFileCountMessage = this.invalidMaxFileCountMessage.replace(\"{0}\", this.maxlength.toString())\n    this.previewWidthStyle = \"max-width: \" + this.previewWidth + \"px\";\n  }  \n\n  uploadClick() {\n    this.onUploadClick.emit(this.selectedFiles);\n  }\n\n  selectionChange(e: any): void {\n    this.invalidFiles = []\n    let files = e.type == \"drop\" ? e.dataTransfer.files : e.target.files \n\n    if (this.selectedFiles.length == 0) {\n      this.selectedFiles = []\n    } \n    let arr = [...this.selectedFiles] as Array<File>\n    \n    for (const file of files) {\n\n      if ( this.fileSizeValid(file.size) && \n        this.fileTypeValid(file))\n      {\n        if (arr.find(f =>\n        f.name == file.name &&\n        f.size == file.size &&\n        f.type == file.type) === undefined) {\n          this.selectedFiles.push(file)\n          this.computePreviewData(file)\n        }\n      }\n      else if(!this.fileSizeValid(file.size)) {\n        this.invalidFiles.push({\n          name: file.name,\n          size: file.size,\n        })      \n      } else {\n        this.invalidFiles.push({\n          name: file.name,\n          type: file.type,\n        })   \n      }\n    }\n\n    this.writeValue(this.selectedFiles)\n  }\n\n  removeAll() {\n    this.selectedFiles = []\n    this.invalidFiles = []\n    this.previewData = []\n    this.writeValue(this.selectedFiles)\n  }\n\n  removeFile(index: number) {\n    this.invalidFiles = []\n    this.ngx_mat_file_input!.nativeElement.value = \"\"\n    this.selectedFiles.splice(index, 1)  \n    this.previewData.splice(index, 1)  \n    this.writeValue(this.selectedFiles)\n  }\n\n  computePreviewData(file: File) {\n    if (!this.preview || !this.isImage(file)) {\n      return\n    }\n    \n    const reader = new FileReader()\n    reader.onload = (value) => {\n       this.previewData.push(value.target?.result)\n    }\n    reader.readAsDataURL(file)\n    \n  }\n\n  isImage(file: File): boolean{\n    return file.type.indexOf('image') != -1\n  }\n\n  fileCount(): number {\n    return this.selectedFiles.length\n  }\n\n  invalidFileCount(): number {\n    return this.invalidFiles.length\n  }\n\n  fileTypeValid(file: File): boolean {\n    const extensions = this.accept.split(',').map(item=>item.trim())\n\n    if (extensions.filter(item=>file.name.endsWith(item.toLowerCase())).length > 0) {\n      return true;\n    }\n    if (this.accept.includes('image') || this.accept.includes('video') || this.accept.includes('audio')) {\n      return  this.isValidExtension(file.name, 'image') ||\n              this.isValidExtension(file.name, 'video') ||\n              this.isValidExtension(file.name, 'audio')\n    }\n   \n    return this.accept.includes(file.type)\n  }\n\n  private isValidExtension(fileName: string, property: string) {\n    if (!this.extensionLists.hasOwnProperty(property)) {\n      return false      \n    }\n    if (this.accept.includes('/*')){\n      if (this.extensionLists[property as keyof typeof this.extensionLists].filter((val: string) => fileName.endsWith(val)).length > 0) {\n        return true\n      }\n      return false\n    }\n    else {\n      if (this.accept.slice(this.accept.indexOf('/')+1) != '' && fileName.endsWith(this.accept.slice(this.accept.indexOf('/')+1))) {\n        return true\n      }\n      return false\n    }\n  }\n\n  fileSizeValid(fileSize: number): boolean {\n    return this.byteToMegabyte(fileSize) <= this.maxFileSize\n  }\n\n  byteToMegabyte(byte: number): number{\n    return byte / 1048576\n  }\n}","<div class=\"ngx-mf-wrapper\">\n  <input\n    #ngx_mat_file_input\n    type=\"file\"\n    [accept]=\"accept\"\n    minlength=\"minlength\"\n    maxlength=\"maxlength\"\n    hidden\n    (change)=\"selectionChange($event)\"\n    [multiple]=\"multiple\"\n    />\n\n  <div class=\"ngx-mf-toolbar\">\n    <div>\n      <button \n        color=\"primary\"\n        mat-button\n        [ngClass]=\"buttonVariant\"\n       \n        [disabled]=\"disabled\"\n        (click)=\"ngx_mat_file_input.click()\"\n      >\n        {{ buttonBrowseText }}\n      </button>\n      <button\n        *ngIf=\"!hiddenUpload\"\n        color=\"primary\"\n        mat-button\n        [ngClass]=\"buttonVariant\"\n        [disabled]=\"\n          fileCount() === 0 ||\n          fileCount() > maxlength ||\n          fileCount() < minlength ||\n          disabled\"\n          (click)=\"uploadClick()\"\n      >\n        {{ buttonUploadText }}\n      </button>\n    </div>\n    <div>\n      <button\n        color=\"warn\"\n        mat-button\n        [ngClass]=\"buttonVariant\"\n        [disabled]=\"fileCount() === 0 || disabled\"\n        (click)=\"removeAll()\"\n      >\n        {{ buttonRemoveAllText }}\n      </button>\n    </div>\n  </div>\n\n  <div matFileDnd (fileDropped)=\"selectionChange($event)\"\n    class=\"ngx-mf-dropzone\">\n    <div class=\"ngx-mf-error\">\n      <div\n        class=\"ngx-mf-error-button\"\n        *ngIf=\"fileCount() + invalidFileCount() > maxlength\"\n      >\n        <mat-icon>error_outline</mat-icon>\n        <div>\n          <b>&nbsp;{{ invalidMaxFileCountMessage }}</b>\n        </div>\n      </div>\n      <div class=\"ngx-mf-error-button\" *ngFor=\"let item of invalidFiles\">\n        <mat-icon>error_outline</mat-icon>\n        <div *ngIf=\"item.size || item.size==''\">\n          <b>&nbsp;{{ item.name }} {{ item.size | number: \"1.0\" }} bytes</b> |\n          {{ invalidFileSizeMessage }}\n        </div>\n        <div *ngIf=\"item.type || item.type==''\">\n          <b>&nbsp;{{ item.name }} {{ item.type }}</b> |\n          {{ typeError }}\n        </div>\n      </div>\n    </div>\n    <div *ngFor=\"let item of selectedFiles; index as i\">\n      <div class=\"ngx-mf-img-card\">\n        <div class=\"ngx-mf-img-card-header\">\n          <div>{{ item.name }}</div>\n          <button mat-icon-button color=\"warn\" (click)=\"removeFile(i)\">\n            <mat-icon>close</mat-icon>\n          </button>\n        </div>\n        <div *ngIf=\"!fileSizeValid(item.size)\">\n          <div class=\"ngx-mf-error\">\n            <p>{{ invalidFileSizeMessage }}</p>\n          </div>\n        </div>\n        <div *ngIf=\"!fileTypeValid(item)\">\n          <div class=\"ngx-mf-error\">\n            <p>{{ typeError }}</p>\n          </div>\n        </div>\n\n        <div\n          *ngIf=\"fileSizeValid(item.size) && fileTypeValid(item) && preview\"\n          \n        >\n          <img\n            [src]=\"previewData[i]\"\n            [style]=\"previewWidthStyle\"\n            style=\"border: none\"\n          />\n        </div>\n        <div class=\"ngx-mf-img-card-footer\">\n          <div>{{ byteToMegabyte(item.size) | number: \"1.0-2\" }} MB</div>\n        </div>\n      </div>\n    </div>\n    <div *ngIf=\"fileCount() === 0\" class=\"ngx-mf-dragndrop\">\n      <h3>{{ dragAndDropText }}</h3>\n    </div>\n  </div>\n</div>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { NgxMatFileComponent } from './ngx-mat-file.component';\nimport { NgxMatFileDirective } from './ngx-mat-file.directive'\n\n\n\n@NgModule({\n  declarations: [\n    NgxMatFileComponent,\n    NgxMatFileDirective\n  ],\n  imports: [\n    CommonModule,\n    MatButtonModule,\n    MatIconModule\n  ],\n  exports: [\n    NgxMatFileComponent\n  ]\n})\nexport class NgxMatFileModule { }\n","/*\n * Public API Surface of ngx-mat-file\n */\n\nexport * from './lib/ngx-mat-file.service';\nexport * from './lib/ngx-mat-file.component';\nexport * from './lib/ngx-mat-file.module';\nexport * from './lib/ngx-mat-file.directive';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAKa,iBAAiB;IAE5B,iBAAiB;;8GAFN,iBAAiB;kHAAjB,iBAAiB,cAF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