@ngx-mce/file-input 22.2.14 → 22.3.0

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.
@@ -208,11 +208,14 @@ var NgxMatFileInputComponent = class NgxMatFileInputComponent extends NgxMatInpu
208
208
  _resetInputFile() {
209
209
  this._inputFileRef().nativeElement.value = "";
210
210
  }
211
+ _getFileName(file) {
212
+ return file != null && file.name != null ? file.name : null;
213
+ }
211
214
  _updateInputValue(files) {
212
215
  let text = null;
213
216
  if (files) {
214
- if (Array.isArray(files)) text = this._multiple ? files.map((x) => x.name).join(this.separator()) : files[0].name;
215
- else text = files.name != null ? files.name : null;
217
+ if (Array.isArray(files)) text = this._multiple ? files.map((x) => this._getFileName(x)).filter((x) => x != null).join(this.separator()) : this._getFileName(files[0]);
218
+ else text = this._getFileName(files);
216
219
  }
217
220
  this._inputValueRef().nativeElement.value = text;
218
221
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-mce-file-input.mjs","names":[],"sources":["../../../projects/file-input/src/lib/file-input.component.ts","../../../projects/file-input/src/lib/file-input.component.html","../../../projects/file-input/src/lib/file-input-helper.ts","../../../projects/file-input/src/lib/validators/max-size.validator.ts","../../../projects/file-input/src/lib/validators/accept.validator.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Platform } from '@angular/cdk/platform';\n\nimport {\n ChangeDetectorRef,\n Component,\n Directive,\n DoCheck,\n ElementRef,\n forwardRef,\n inject,\n Input,\n input,\n OnChanges,\n OnDestroy,\n viewChild,\n ViewEncapsulation,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { ErrorStateMatcher, ThemePalette } from '@angular/material/core';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { Subject } from 'rxjs';\nimport { FileOrArrayFile } from './file-input-type';\n\nlet nextUniqueId = 0;\n\nclass NgxMatInputMixinBase {\n\n readonly stateChanges = new Subject<void>();\n\n protected ngControl: NgControl | null = null;\n protected _parentForm: NgForm | null = null;\n protected _parentFormGroup: FormGroupDirective | null = null;\n protected _defaultErrorStateMatcher: ErrorStateMatcher | null = null;\n\n}\n\n@Directive({\n selector: '[ngxMatFileInputIcon]',\n})\nexport class NgxMatFileInputIcon {}\n\n@Component({\n selector: 'ngx-mat-file-input',\n templateUrl: 'file-input.component.html',\n styleUrls: ['file-input.component.scss'],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ngx-mat-file-input',\n },\n providers: [\n {\n provide: MatFormFieldControl,\n useExisting: forwardRef(() => NgxMatFileInputComponent),\n },\n ],\n exportAs: 'ngx-mat-file-input',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [MatIconModule, MatButtonModule],\n})\nexport class NgxMatFileInputComponent\n extends NgxMatInputMixinBase\n implements MatFormFieldControl<FileOrArrayFile>, OnChanges, OnDestroy, DoCheck, ControlValueAccessor\n{\n private _inputFileRef = viewChild<ElementRef>('inputFile');\n private _inputValueRef = viewChild<ElementRef>('inputValue');\n\n readonly color = input<ThemePalette>('primary');\n\n public fileNames = \"\";\n\n protected _uid = `ngx-mat-fileinput-${nextUniqueId++}`;\n _ariaDescribedby = \"\";\n\n override stateChanges: Subject<void> = new Subject<void>();\n focused = false;\n errorState = false;\n controlType = 'ngx-mat-file-input';\n autofilled = false;\n\n /** Function when touched */\n _onTouched = () => {\n // Intentionally empty.\n };\n\n /** Function when changed */\n _onChange: (value: FileOrArrayFile) => void = () => {\n // Intentionally empty.\n };\n\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n protected _disabled = false;\n\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n }\n protected _id = \"\";\n\n @Input()\n get multiple(): boolean {\n return this._multiple;\n }\n set multiple(value: boolean) {\n this._multiple = coerceBooleanProperty(value);\n }\n protected _multiple = false;\n\n @Input()\n placeholder = 'Choose a file';\n separator = input<string>(',');\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n }\n protected _required = false;\n\n @Input() errorStateMatcher: ErrorStateMatcher | null = null;\n\n @Input()\n get value(): FileOrArrayFile | null {\n return this._value;\n }\n set value(value: FileOrArrayFile) {\n this._value = value;\n }\n protected _value: FileOrArrayFile | null = null;\n\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = true;\n\n /**\n * Limiting accepted file types\n * Example: accept=\"image/png, image/jpeg\" or accept=\".png, .jpg, .jpeg\" — Accept PNG or JPEG files.\n */\n @Input()\n get accept(): string {\n return this._accept;\n }\n set accept(value: string) {\n this._accept = value;\n }\n private _accept = \"\";\n\n protected _elementRef = inject(ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>);\n protected _platform = inject(Platform);\n private _cd = inject(ChangeDetectorRef);\n\n override ngControl = inject(NgControl, { optional: true, self: true });\n protected override _parentForm = inject(NgForm, { optional: true });\n protected override _parentFormGroup = inject(FormGroupDirective, { optional: true });\n protected override _defaultErrorStateMatcher = inject(ErrorStateMatcher);\n\n constructor() {\n super();\n\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n this.updateErrorState();\n }\n }\n\n updateErrorState() {\n const control = this.ngControl ? this.ngControl.control : null;\n\n this.errorState = (this.errorStateMatcher ?? this._defaultErrorStateMatcher).isErrorState(\n control,\n this._parentForm,\n );\n }\n\n // Implemented as part of ControlValueAccessor.\n writeValue(value: FileOrArrayFile): void {\n this._updateInputValue(value);\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnChange(fn: (value: FileOrArrayFile) => void): void {\n this._onChange = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.stateChanges.next();\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this._inputValueRef()?.nativeElement.focus(options);\n }\n\n _focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused && (!this.readonly || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n /** Mark the field as touched */\n _markAsTouched() {\n this._onTouched();\n this._cd.markForCheck();\n this.stateChanges.next();\n }\n\n protected _isBadInput() {\n const validity = (this._inputValueRef()?.nativeElement as HTMLInputElement).validity;\n return validity && validity.badInput;\n }\n\n get empty(): boolean {\n return !this._inputValueRef()?.nativeElement.value && !this._isBadInput() && !this.autofilled;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n openFilePicker(event?: MouseEvent) {\n this._inputFileRef()?.nativeElement.click();\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n this._markAsTouched();\n }\n\n handleFiles(filelist: FileList) {\n if (filelist.length > 0) {\n const files: File[] = [];\n for (let i = 0; i < filelist.length; i++) {\n const f = filelist.item(i);\n if (f)\n files.push(f);\n }\n this._updateInputValue(files);\n this._resetInputFile();\n this._onChange(this.multiple ? files : files[0]);\n }\n }\n\n /** Handles a click on the control's container. */\n onContainerClick(_: MouseEvent) {\n // Intentionally empty.\n }\n\n private _resetInputFile() {\n this._inputFileRef()!.nativeElement.value = '';\n }\n\n private _updateInputValue(files: FileOrArrayFile) {\n let text = null;\n if (files) {\n if (Array.isArray(files)) {\n text = this._multiple ? files.map((x) => x.name).join(this.separator()) : files[0].name;\n } else {\n text = files.name != null ? files.name : null;\n }\n }\n\n this._inputValueRef()!.nativeElement.value = text;\n }\n}\n","<input\n #inputValue\n autocomplete=\"off\"\n class=\"mat-mdc-input-element mat-mdc-form-field-input-control mdc-text-field__input\"\n [attr.id]=\"id\"\n [attr.placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.readonly]=\"readonly || null\"\n [attr.aria-describedby]=\"_ariaDescribedby || null\"\n [attr.aria-invalid]=\"errorState\"\n [attr.aria-required]=\"required.toString()\"\n/>\n<div class=\"mat-mdc-form-field-suffix\">\n <button\n matSuffix\n mat-icon-button\n [color]=\"color()\"\n class=\"button-browse\"\n (click)=\"openFilePicker($event)\"\n type=\"button\"\n [disabled]=\"disabled\"\n >\n <ng-content select=\"[ngxMatFileInputIcon]\">\n <mat-icon class=\"ngx-mat-file-input--default-icon\">attach_file</mat-icon>\n </ng-content>\n </button>\n</div>\n<input\n type=\"file\"\n #inputFile\n (change)=\"handleFiles($event.target.files!)\"\n class=\"input-file\"\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n/>\n","export function calculFileSize(number: number): string {\n if (number < 1024) {\n return number + 'bytes';\n } else if (number >= 1024 && number < 1048576) {\n return (number / 1024).toFixed(1) + 'KB';\n } else if (number >= 1048576) {\n return (number / 1048576).toFixed(1) + 'MB';\n }\n return `${number}`;\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for size of file\n * @param max Max of size of file (in bytes)\n */\nexport function MaxSizeValidator(max: number): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n max = Number(max);\n if (isNaN(max)) {\n throw 'MaxSizeValidator: max of size of file is invalid';\n }\n if (!ctrl.value) return null;\n let files: File[] = ctrl.value;\n if (!Array.isArray(ctrl.value)) {\n files = [ctrl.value];\n }\n if (!files.length) return null;\n const add = (a: number, b: number): number => a + b;\n const sumSize = files.map((x) => x.size).reduce(add);\n if (sumSize > max) {\n return {\n maxSize: true,\n };\n }\n return null;\n };\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for input file accept\n * @param accept Allowable type of file\n */\nexport function AcceptValidator(accept: string): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n if (!accept) {\n throw 'AcceptValidator: allowable type of file can not be empty';\n }\n\n if (ctrl.value == null) return null;\n\n if (!accept.includes(ctrl.value.type)) {\n return {\n accept: true,\n };\n }\n\n return null;\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAI,eAAe;AAEnB,IAAM,uBAAN,MAA0B;CAEf,eAAe,IAAI,QAAO;CAEzB,YAA8B;CAC9B,cAA6B;CAC7B,mBAA8C;CAC9C,4BAAsD;AAEjE;AAKD,IAAa,sBAAb,MAAa,oBAAmB;CAAnB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAmB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAnB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAmB,cAAA;EAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAAnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAH/B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,wBACX,CAAA;;;AAqBD,IAAa,2BAAb,MAAa,iCACH,qBAAoB;CAGpB,gBAAgB,UAAsB,aAAY,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAClD,iBAAiB,UAAsB,cAAa,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAEnD,QAAQ,MAAoB,WAAU,GA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CAAA;EAAA,CAAA;EAAA,UAAA,CAAA,EAyB1D,MAAA,M;E,OAgBA,MAAA,M;E,aASA,MAAA,M;E,gBASA,MAAA,M;;;;;;;;;E,aAIA,MAAA,M;E,sBASA,MAAA,M;E,UAEA,MAAA,M;E,aASA,MAAA,M;E,WAaA,MAAA,M;;;AEpKH,SAAgB,eAAe,QAAc;CAC3C,IAAI,SAAS,MACX,OAAO,SAAS;MACX,IAAI,UAAU,QAAQ,SAAS,SACpC,QAAQ,SAAS,KAAA,CAAM,QAAQ,CAAC,IAAI;MAC/B,IAAI,UAAU,SACnB,QAAQ,SAAS,QAAA,CAAS,QAAQ,CAAC,IAAI;CAEzC,OAAO,GAAG;AACZ;ACHA,SAAgB,iBAAiB,KAAW;CAC1C,QAAQ,SAAkD;EACxD,MAAM,OAAO,GAAG;EAChB,IAAI,MAAM,GAAG,GACX,MAAM;EAER,IAAI,CAAC,KAAK,OAAO,OAAO;EACxB,IAAI,QAAgB,KAAK;EACzB,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,GAC3B,QAAQ,CAAC,KAAK,KAAK;EAErB,IAAI,CAAC,MAAM,QAAQ,OAAO;EAC1B,MAAM,OAAO,GAAW,MAAsB,IAAI;EAElD,IADgB,MAAM,KAAK,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,GAC5C,IAAU,KACZ,OAAO,EACL,SAAS,KACV;EAEH,OAAO;CACT;AACF;ACrBA,SAAgB,gBAAgB,QAAc;CAC5C,QAAQ,SAAkD;EACxD,IAAI,CAAC,QACH,MAAM;EAGR,IAAI,KAAK,SAAS,MAAM,OAAO;EAE/B,IAAI,CAAC,OAAO,SAAS,KAAK,MAAM,IAAI,GAClC,OAAO,EACL,QAAQ,KACT;EAGH,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"ngx-mce-file-input.mjs","names":[],"sources":["../../../projects/file-input/src/lib/file-input.component.ts","../../../projects/file-input/src/lib/file-input.component.html","../../../projects/file-input/src/lib/file-input-helper.ts","../../../projects/file-input/src/lib/validators/max-size.validator.ts","../../../projects/file-input/src/lib/validators/accept.validator.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Platform } from '@angular/cdk/platform';\n\nimport {\n ChangeDetectorRef,\n Component,\n Directive,\n DoCheck,\n ElementRef,\n forwardRef,\n inject,\n Input,\n input,\n OnChanges,\n OnDestroy,\n viewChild,\n ViewEncapsulation,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { ErrorStateMatcher, ThemePalette } from '@angular/material/core';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { Subject } from 'rxjs';\nimport { FileOrArrayFile } from './file-input-type';\n\nlet nextUniqueId = 0;\n\nclass NgxMatInputMixinBase {\n\n readonly stateChanges = new Subject<void>();\n\n protected ngControl: NgControl | null = null;\n protected _parentForm: NgForm | null = null;\n protected _parentFormGroup: FormGroupDirective | null = null;\n protected _defaultErrorStateMatcher: ErrorStateMatcher | null = null;\n\n}\n\n@Directive({\n selector: '[ngxMatFileInputIcon]',\n})\nexport class NgxMatFileInputIcon {}\n\n@Component({\n selector: 'ngx-mat-file-input',\n templateUrl: 'file-input.component.html',\n styleUrls: ['file-input.component.scss'],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ngx-mat-file-input',\n },\n providers: [\n {\n provide: MatFormFieldControl,\n useExisting: forwardRef(() => NgxMatFileInputComponent),\n },\n ],\n exportAs: 'ngx-mat-file-input',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [MatIconModule, MatButtonModule],\n})\nexport class NgxMatFileInputComponent\n extends NgxMatInputMixinBase\n implements MatFormFieldControl<FileOrArrayFile>, OnChanges, OnDestroy, DoCheck, ControlValueAccessor\n{\n private _inputFileRef = viewChild<ElementRef>('inputFile');\n private _inputValueRef = viewChild<ElementRef>('inputValue');\n\n readonly color = input<ThemePalette>('primary');\n\n public fileNames = \"\";\n\n protected _uid = `ngx-mat-fileinput-${nextUniqueId++}`;\n _ariaDescribedby = \"\";\n\n override stateChanges: Subject<void> = new Subject<void>();\n focused = false;\n errorState = false;\n controlType = 'ngx-mat-file-input';\n autofilled = false;\n\n /** Function when touched */\n _onTouched = () => {\n // Intentionally empty.\n };\n\n /** Function when changed */\n _onChange: (value: FileOrArrayFile) => void = () => {\n // Intentionally empty.\n };\n\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n protected _disabled = false;\n\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n }\n protected _id = \"\";\n\n @Input()\n get multiple(): boolean {\n return this._multiple;\n }\n set multiple(value: boolean) {\n this._multiple = coerceBooleanProperty(value);\n }\n protected _multiple = false;\n\n @Input()\n placeholder = 'Choose a file';\n separator = input<string>(',');\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n }\n protected _required = false;\n\n @Input() errorStateMatcher: ErrorStateMatcher | null = null;\n\n @Input()\n get value(): FileOrArrayFile | null {\n return this._value;\n }\n set value(value: FileOrArrayFile) {\n this._value = value;\n }\n protected _value: FileOrArrayFile | null = null;\n\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = true;\n\n /**\n * Limiting accepted file types\n * Example: accept=\"image/png, image/jpeg\" or accept=\".png, .jpg, .jpeg\" — Accept PNG or JPEG files.\n */\n @Input()\n get accept(): string {\n return this._accept;\n }\n set accept(value: string) {\n this._accept = value;\n }\n private _accept = \"\";\n\n protected _elementRef = inject(ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>);\n protected _platform = inject(Platform);\n private _cd = inject(ChangeDetectorRef);\n\n override ngControl = inject(NgControl, { optional: true, self: true });\n protected override _parentForm = inject(NgForm, { optional: true });\n protected override _parentFormGroup = inject(FormGroupDirective, { optional: true });\n protected override _defaultErrorStateMatcher = inject(ErrorStateMatcher);\n\n constructor() {\n super();\n\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n this.updateErrorState();\n }\n }\n\n updateErrorState() {\n const control = this.ngControl ? this.ngControl.control : null;\n\n this.errorState = (this.errorStateMatcher ?? this._defaultErrorStateMatcher).isErrorState(\n control,\n this._parentForm,\n );\n }\n\n // Implemented as part of ControlValueAccessor.\n writeValue(value: FileOrArrayFile): void {\n this._updateInputValue(value);\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnChange(fn: (value: FileOrArrayFile) => void): void {\n this._onChange = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.stateChanges.next();\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this._inputValueRef()?.nativeElement.focus(options);\n }\n\n _focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused && (!this.readonly || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n /** Mark the field as touched */\n _markAsTouched() {\n this._onTouched();\n this._cd.markForCheck();\n this.stateChanges.next();\n }\n\n protected _isBadInput() {\n const validity = (this._inputValueRef()?.nativeElement as HTMLInputElement).validity;\n return validity && validity.badInput;\n }\n\n get empty(): boolean {\n return !this._inputValueRef()?.nativeElement.value && !this._isBadInput() && !this.autofilled;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n openFilePicker(event?: MouseEvent) {\n this._inputFileRef()?.nativeElement.click();\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n this._markAsTouched();\n }\n\n handleFiles(filelist: FileList) {\n if (filelist.length > 0) {\n const files: File[] = [];\n for (let i = 0; i < filelist.length; i++) {\n const f = filelist.item(i);\n if (f)\n files.push(f);\n }\n this._updateInputValue(files);\n this._resetInputFile();\n this._onChange(this.multiple ? files : files[0]);\n }\n }\n\n /** Handles a click on the control's container. */\n onContainerClick(_: MouseEvent) {\n // Intentionally empty.\n }\n\n private _resetInputFile() {\n this._inputFileRef()!.nativeElement.value = '';\n }\n\n private _getFileName(file: File): string | null {\n return file != null && file.name != null ? file.name : null;\n }\n\n private _updateInputValue(files: FileOrArrayFile) {\n let text: string | null = null;\n if (files) {\n if (Array.isArray(files)) {\n text = this._multiple\n ? files.map(x => this._getFileName(x))\n .filter(x => x != null)\n .join(this.separator())\n : this._getFileName(files[0]);\n } else {\n text = this._getFileName(files);\n }\n }\n\n this._inputValueRef()!.nativeElement.value = text;\n }\n}\n","<input\n #inputValue\n autocomplete=\"off\"\n class=\"mat-mdc-input-element mat-mdc-form-field-input-control mdc-text-field__input\"\n [attr.id]=\"id\"\n [attr.placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.readonly]=\"readonly || null\"\n [attr.aria-describedby]=\"_ariaDescribedby || null\"\n [attr.aria-invalid]=\"errorState\"\n [attr.aria-required]=\"required.toString()\"\n/>\n<div class=\"mat-mdc-form-field-suffix\">\n <button\n matSuffix\n mat-icon-button\n [color]=\"color()\"\n class=\"button-browse\"\n (click)=\"openFilePicker($event)\"\n type=\"button\"\n [disabled]=\"disabled\"\n >\n <ng-content select=\"[ngxMatFileInputIcon]\">\n <mat-icon class=\"ngx-mat-file-input--default-icon\">attach_file</mat-icon>\n </ng-content>\n </button>\n</div>\n<input\n type=\"file\"\n #inputFile\n (change)=\"handleFiles($event.target.files!)\"\n class=\"input-file\"\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n/>\n","export function calculFileSize(number: number): string {\n if (number < 1024) {\n return number + 'bytes';\n } else if (number >= 1024 && number < 1048576) {\n return (number / 1024).toFixed(1) + 'KB';\n } else if (number >= 1048576) {\n return (number / 1048576).toFixed(1) + 'MB';\n }\n return `${number}`;\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for size of file\n * @param max Max of size of file (in bytes)\n */\nexport function MaxSizeValidator(max: number): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n max = Number(max);\n if (isNaN(max)) {\n throw 'MaxSizeValidator: max of size of file is invalid';\n }\n if (!ctrl.value) return null;\n let files: File[] = ctrl.value;\n if (!Array.isArray(ctrl.value)) {\n files = [ctrl.value];\n }\n if (!files.length) return null;\n const add = (a: number, b: number): number => a + b;\n const sumSize = files.map((x) => x.size).reduce(add);\n if (sumSize > max) {\n return {\n maxSize: true,\n };\n }\n return null;\n };\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for input file accept\n * @param accept Allowable type of file\n */\nexport function AcceptValidator(accept: string): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n if (!accept) {\n throw 'AcceptValidator: allowable type of file can not be empty';\n }\n\n if (ctrl.value == null) return null;\n\n if (!accept.includes(ctrl.value.type)) {\n return {\n accept: true,\n };\n }\n\n return null;\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAI,eAAe;AAEnB,IAAM,uBAAN,MAA0B;CAEf,eAAe,IAAI,QAAO;CAEzB,YAA8B;CAC9B,cAA6B;CAC7B,mBAA8C;CAC9C,4BAAsD;AAEjE;AAKD,IAAa,sBAAb,MAAa,oBAAmB;CAAnB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA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B,IAAI,MAAM,GAAG,GACX,MAAM;EAER,IAAI,CAAC,KAAK,OAAO,OAAO;EACxB,IAAI,QAAgB,KAAK;EACzB,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,GAC3B,QAAQ,CAAC,KAAK,KAAK;EAErB,IAAI,CAAC,MAAM,QAAQ,OAAO;EAC1B,MAAM,OAAO,GAAW,MAAsB,IAAI;EAElD,IADgB,MAAM,KAAK,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,GAC5C,IAAU,KACZ,OAAO,EACL,SAAS,KACV;EAEH,OAAO;CACT;AACF;ACrBA,SAAgB,gBAAgB,QAAc;CAC5C,QAAQ,SAAkD;EACxD,IAAI,CAAC,QACH,MAAM;EAGR,IAAI,KAAK,SAAS,MAAM,OAAO;EAE/B,IAAI,CAAC,OAAO,SAAS,KAAK,MAAM,IAAI,GAClC,OAAO,EACL,QAAQ,KACT;EAGH,OAAO;CACT;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngx-mce/file-input",
3
- "version": "22.2.14",
3
+ "version": "22.3.0",
4
4
  "description": "Angular Material File Input",
5
5
  "author": "Felipe B.",
6
6
  "repository": {
@@ -91,6 +91,7 @@ export declare class NgxMatFileInputComponent extends NgxMatInputMixinBase imple
91
91
  /** Handles a click on the control's container. */
92
92
  onContainerClick(_: MouseEvent): void;
93
93
  private _resetInputFile;
94
+ private _getFileName;
94
95
  private _updateInputValue;
95
96
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatFileInputComponent, never>;
96
97
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatFileInputComponent, "ngx-mat-file-input", ["ngx-mat-file-input"], {