{"version":3,"file":"ajf-core-file-input.mjs","sources":["../../../projects/core/file-input/src/file.ts","../../../projects/core/file-input/src/file-input.ts","../../../projects/core/file-input/src/file-input.html","../../../projects/core/file-input/src/file-input-module.ts","../../../projects/core/file-input/src/public_api.ts","../../../projects/core/file-input/src/ajf-core-file-input.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport interface AjfFile {\n  name: string;\n  size?: number;\n  type: string;\n  content?: string;\n  url?: string;\n  deleteUrl: boolean;\n  signature?: boolean;\n}\n\n/**\n * Default size limit for file input fields.\n */\nexport const AjfFileSizeLimit = 52428800;\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  ContentChildren,\n  Directive,\n  ElementRef,\n  EventEmitter,\n  forwardRef,\n  Input,\n  OnDestroy,\n  Output,\n  QueryList,\n  ViewChild,\n  ViewContainerRef,\n  ViewEncapsulation,\n} from '@angular/core';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\nimport {Observable, Subscription} from 'rxjs';\nimport {filter} from 'rxjs/operators';\n\nimport {AjfFile, AjfFileSizeLimit} from './file';\n\n@Directive({selector: '[ajfDropMessage]'})\nexport class AjfDropMessage {}\n\n@Directive({\n  selector: '[ajfFilePreview]',\n  exportAs: 'ajfFilePreview',\n})\nexport class AjfFilePreview implements OnDestroy {\n  private _value: AjfFile | undefined;\n  get value(): AjfFile | undefined {\n    return this._value;\n  }\n\n  private _valueSub = Subscription.EMPTY;\n\n  constructor(vcr: ViewContainerRef) {\n    const input = vcr.injector.get(AjfFileInput, null);\n    const isValueGuard = (value: AjfFile | undefined): value is AjfFile => value != null;\n    if (input) {\n      this._value = input.value;\n      this._valueSub = input.valueChange.pipe(filter(isValueGuard)).subscribe(value => {\n        this._value = value;\n      });\n    }\n  }\n\n  ngOnDestroy(): void {\n    this._valueSub.unsubscribe();\n  }\n}\n\n/**\n * It allows the upload of a file inside an AjfForm.\n *\n * @export\n * @class AjfFileInput\n */\n@Component({\n  selector: 'ajf-file-input',\n  templateUrl: './file-input.html',\n  styleUrls: ['./file-input.scss'],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n  host: {\n    '[class.ajf-file-input]': 'true',\n  },\n  providers: [\n    {\n      provide: NG_VALUE_ACCESSOR,\n      useExisting: forwardRef(() => AjfFileInput),\n      multi: true,\n    },\n  ],\n})\nexport class AjfFileInput implements ControlValueAccessor {\n  @ContentChildren(AjfDropMessage, {descendants: false})\n  _dropMessageChildren!: QueryList<AjfDropMessage>;\n\n  @ContentChildren(AjfFilePreview, {descendants: false})\n  _filePreviewChildren!: QueryList<AjfFilePreview>;\n\n  @ViewChild('nativeInput') _nativeInput!: ElementRef<HTMLInputElement>;\n\n  readonly fileIcon: SafeResourceUrl;\n  readonly removeIcon: SafeResourceUrl;\n\n  /**\n   * Enable drop for a new file to upload\n   */\n  private _emptyFile: boolean;\n  get emptyFile(): boolean {\n    return this._emptyFile;\n  }\n\n  /**\n   * Accepted MimeType\n   * Es. \"image/*\" or \"application/pdf\"\n   */\n  @Input() accept: string | undefined;\n\n  private _value: any;\n  get value(): any {\n    return this._value;\n  }\n  @Input()\n  set value(value: any) {\n    if (value instanceof File) {\n      this._processFileUpload(value);\n    } else if (value instanceof FileList) {\n      if (value.length === 1) {\n        this._processFileUpload(value[0]);\n      }\n    } else if (value == null || (isAjfFile(value) && isValidMimeType(value.type, this.accept))) {\n      this._value = value;\n      if (isAjfFile(value)) {\n        this._emptyFile = false;\n      }\n      this._valueChange.emit(this._value);\n      if (this._controlValueAccessorChangeFn != null) {\n        this._controlValueAccessorChangeFn(this.value);\n      }\n      this._cdr.detectChanges();\n    }\n  }\n\n  private _valueChange = new EventEmitter<AjfFile | undefined>();\n  @Output()\n  readonly valueChange: Observable<AjfFile | undefined> = this._valueChange as Observable<\n    AjfFile | undefined\n  >;\n\n  /**\n   * Event emitter for the delete file action\n   */\n  private _deleteFile = new EventEmitter<string>();\n  @Output()\n  readonly deleteFile: Observable<string> = this._deleteFile as Observable<string>;\n\n  /**\n   * The method to be called in order to update ngModel.\n   */\n  _controlValueAccessorChangeFn: (value: any) => void = () => {};\n\n  /**\n   * onTouch function registered via registerOnTouch (ControlValueAccessor).\n   */\n  _onTouched: () => any = () => {};\n\n  constructor(domSanitizer: DomSanitizer, private _cdr: ChangeDetectorRef) {\n    this._emptyFile = true;\n    this.fileIcon = domSanitizer.bypassSecurityTrustResourceUrl(fileIcon);\n    this.removeIcon = domSanitizer.bypassSecurityTrustResourceUrl(trashIcon);\n  }\n\n  onFileDrop(files: FileList): void {\n    if (files.length !== 1) {\n      return;\n    }\n    const file = files[0];\n    this._processFileUpload(file);\n  }\n\n  onSelectFile(): void {\n    const files = this._nativeInput.nativeElement.files;\n    if (files == null) {\n      return;\n    }\n    const file = files.item(0);\n    if (file == null) {\n      return;\n    }\n    this._processFileUpload(files.item(0) as File);\n  }\n\n  registerOnChange(fn: any): void {\n    this._controlValueAccessorChangeFn = fn;\n  }\n\n  registerOnTouched(fn: any): void {\n    this._onTouched = fn;\n  }\n\n  resetValue(): void {\n    if (this.value !== null) {\n      if (this.value.url && this.value.url.length) {\n        this._deleteFile.emit(this.value.url);\n        this.value.deleteUrl = true;\n        this.value.content = null;\n        this.value.name = null;\n        this.value.size = 0;\n      } else {\n        this.value = null;\n      }\n    }\n    this._nativeInput.nativeElement.value = '';\n    this._emptyFile = true;\n    this._cdr.markForCheck();\n  }\n\n  triggerNativeInput(): void {\n    if (!this._nativeInput) {\n      return;\n    }\n    this._nativeInput.nativeElement.click();\n  }\n\n  writeValue(value: any) {\n    this.value = value;\n    if (value == null || value == undefined || (value !== null && value.deleteUrl)) {\n      this._emptyFile = true;\n    } else {\n      this._emptyFile = false;\n    }\n    this._cdr.markForCheck();\n  }\n\n  private _processFileUpload(file: File): void {\n    const reader = new FileReader();\n    const {name, size, type} = file;\n\n    // URL is kept in the field value, and used to delete the old file when it's replaced.\n    const url = this.value && this.value.url ? this.value.url : undefined;\n\n    if (!isValidMimeType(type, this.accept)) {\n      return;\n    }\n    if (size >= AjfFileSizeLimit) {\n      this.value = {name, size, type, url, content: 'File too large'};\n      this._emptyFile = false;\n      return;\n    }\n    reader.onload = (_: ProgressEvent<FileReader>) => {\n      const content = reader.result;\n      if (typeof content !== 'string') {\n        return;\n      }\n      this.value = {name, size, type, url, content};\n      this._emptyFile = false;\n    };\n    reader.readAsDataURL(file);\n  }\n}\n\n/**\n * Test if a value is an AjfFile interface.\n * The AjfFile is valid if it contains the name and\n * the content or the url of the file\n */\nfunction isAjfFile(value: any): value is AjfFile {\n  if (value == null || typeof value !== 'object') {\n    return false;\n  }\n  if ('name' in value && ('content' in value || 'url' in value)) {\n    return true;\n  }\n  return false;\n}\n\nfunction isValidMimeType(mimeType: string, accept: string | undefined): boolean {\n  if (accept == null) {\n    return true;\n  }\n  let terminate = true;\n  if (accept.endsWith('*')) {\n    accept = accept.slice(0, accept.length - 1);\n    terminate = false;\n  }\n  const regExStr = '^' + accept + (terminate ? '$' : '');\n  const regEx = new RegExp(regExStr);\n  return regEx.test(mimeType);\n}\n\nexport const fileIcon =\n  'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwM' +\n  'C9zdmciIHdpZHRoPSIxNzA2LjY2NyIgaGVpZ2h0PSIxNzA2LjY2NyIgdmlld0JveD0iMCAwIDEyODAgMTI4MCIgcHJl' +\n  'c2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCI+PHBhdGggZD0iTTI4MyAxMDNjLTE3LjcgMi40LTMzLjkgMTM' +\n  'uOC00Mi4yIDI5LjYtNy40IDE0LTYuOC0zMi41LTYuOCA0OTcuNHMtLjYgNDgzLjQgNi44IDQ5Ny40YzYuOCAxMy4xID' +\n  'E4LjYgMjIuNyAzMy43IDI3LjhsNyAyLjNoNzE3bDctMi4zYzE1LjEtNS4xIDI2LjktMTQuNyAzMy43LTI3LjggNy40L' +\n  'TE0IDYuOCAxOS4yIDYuOC0zNzYuNlYzOTQuMWwtMTExLjItLjMtMTExLjMtLjQtOC41LTIuM2MtMjMuOC02LjUtNDMt' +\n  'MjEuMy01Mi40LTQwLjUtNy41LTE1LjMtNy02LTcuMy0xMzMuOWwtLjQtMTE0LjctMjMzLjIuMS0yMzguNy45em01MTI' +\n  'gMTA5LjhjMCAxMjAuNS0uMyAxMTQuOSA2IDEyNC40IDMuNiA1LjUgMTEuNiAxMS4yIDE5LjcgMTQuMSA1LjggMi4yID' +\n  'YuNCAyLjIgMTE1LjggMi41bDExMCAuMy0xMjUtMTI1LjQtMTI1LjctMTI1Lj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My05LTktOS05LTIzdi02NHEwLTE0I' +\n  'DktMjMgOS05IDIzLTloMzA5bDcwLTE2N3ExNS0zNyA1NC02MyAzOS0yNiA3OS0yNmgzMjBxNDAgMCA3OSAyNiAzOSAy' +\n  'NiA1NCA2M2w3MCAxNjdoMzA5cTE0IDAgMjMgOSA5IDkgOSAyM3oiLz48L3N2Zz4=';\n","<div ajfDnd (file)=\"onFileDrop($event)\" class=\"ajf-drop-zone\">\n  <div *ngIf=\"emptyFile; else fileInfo\" class=\"ajf-drop-message\" (click)=\"triggerNativeInput()\">\n    <ng-container *ngIf=\"_dropMessageChildren?.length; else defaultDropMessage\">\n      <ng-content select=\"[ajfDropMessage]\"></ng-content>\n    </ng-container>\n    <ng-template #defaultDropMessage>{{'Drop your file here or click to select'|transloco}}</ng-template>\n  </div>\n  <ng-template #fileInfo>\n    <button (click)=\"resetValue()\" class=\"ajf-remove-file\">\n      <img [src]=\"removeIcon\" alt=\"\">\n      <div class=\"ajf-screen-reader-only\">{{ 'Delete'|transloco }}</div>\n    </button>\n    <div class=\"ajf-file-info\">\n      <ng-container *ngIf=\"_filePreviewChildren?.length; else defaultFilePreview\">\n        <ng-content select=\"[ajfFilePreview]\"></ng-content>\n      </ng-container>\n      <ng-template #defaultFilePreview>\n        <div class=\"ajf-file-info-content\">\n          <img [src]=\"fileIcon\" alt=\"\">\n          <div>{{ value?.name }}</div>\n        </div>\n      </ng-template>\n    </div>\n  </ng-template>\n</div>\n<input #nativeInput [accept]=\"accept\" name=\"\" aria-label=\"file input\" type=\"file\" (change)=\"onSelectFile()\">\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfCommonModule} from '@ajf/core/common';\nimport {AjfTranslocoModule} from '@ajf/core/transloco';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\n\nimport {AjfDropMessage, AjfFileInput, AjfFilePreview} from './file-input';\n\n@NgModule({\n  declarations: [AjfDropMessage, AjfFileInput, AjfFilePreview],\n  exports: [AjfDropMessage, AjfFileInput, AjfFilePreview],\n  imports: [AjfCommonModule, CommonModule, AjfTranslocoModule],\n})\nexport class AjfFileInputModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './file';\nexport * from './file-input';\nexport * from './file-input-module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAYH;;AAEG;AACI,MAAM,gBAAgB,GAAG;;ACnChC;;;;;;;;;;;;;;;;;;;;AAoBG;MA2BU,cAAc,CAAA;+GAAd,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAA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