UNPKG

@vipstorage/material-file-input

Version:
101 lines (100 loc) 5.27 kB
import { Platform } from '@angular/cdk/platform'; import { ChangeDetectorRef, DoCheck, ElementRef, OnDestroy } from '@angular/core'; import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { CanUpdateErrorState, ErrorStateMatcher, ThemePalette } from '@angular/material/core'; import { MatFormFieldControl } from '@angular/material/form-field'; import { Subject } from 'rxjs'; import { FileOrArrayFile } from './file-input-type'; import * as i0 from "@angular/core"; declare const _NgxMatInputMixinBase: import("@angular/material/core")._Constructor<CanUpdateErrorState> & import("@angular/material/core")._AbstractConstructor<CanUpdateErrorState> & { new (_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl): { readonly stateChanges: Subject<void>; _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; /** @docs-private */ ngControl: NgControl; }; }; export declare class NgxMatFileInputIcon { static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatFileInputIcon, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NgxMatFileInputIcon, "[ngxMatFileInputIcon]", never, {}, {}, never, never, false, never>; } export declare class NgxMatFileInputComponent extends _NgxMatInputMixinBase implements MatFormFieldControl<FileOrArrayFile>, OnDestroy, DoCheck, CanUpdateErrorState, ControlValueAccessor { protected _elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>; protected _platform: Platform; private _cd; ngControl: NgControl; private _inputFileRef; private _inputValueRef; /** Custom icon set by the consumer. */ _customIcon: NgxMatFileInputIcon; color: ThemePalette; fileNames: string; protected _uid: string; protected _previousNativeValue: any; _ariaDescribedby: string; readonly stateChanges: Subject<void>; focused: boolean; errorState: boolean; controlType: string; autofilled: boolean; /** Function when touched */ _onTouched: () => void; /** Function when changed */ _onChange: (value: FileOrArrayFile) => void; get disabled(): boolean; set disabled(value: boolean); protected _disabled: boolean; get id(): string; set id(value: string); protected _id: string; get multiple(): boolean; set multiple(value: boolean); protected _multiple: boolean; placeholder: string; separator: string; get required(): boolean; set required(value: boolean); protected _required: boolean; errorStateMatcher: ErrorStateMatcher; get value(): FileOrArrayFile; set value(value: FileOrArrayFile); protected _value: FileOrArrayFile; get readonly(): boolean; set readonly(value: boolean); private _readonly; /** * Limiting accepted file types * Example: accept="image/png, image/jpeg" or accept=".png, .jpg, .jpeg" — Accept PNG or JPEG files. */ get accept(): string; set accept(value: string); private _accept; constructor(_elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>, _platform: Platform, _cd: ChangeDetectorRef, ngControl: NgControl, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _defaultErrorStateMatcher: ErrorStateMatcher); ngOnChanges(): void; ngOnDestroy(): void; ngDoCheck(): void; writeValue(value: FileOrArrayFile): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; /** Focuses the input. */ focus(options?: FocusOptions): void; _focusChanged(isFocused: boolean): void; /** Mark the field as touched */ _markAsTouched(): void; protected _isBadInput(): boolean; get empty(): boolean; get shouldLabelFloat(): boolean; setDescribedByIds(ids: string[]): void; openFilePicker(event?: MouseEvent): void; handleFiles(filelist: FileList): void; /** Handles a click on the control's container. */ onContainerClick(event: MouseEvent): void; private _resetInputFile; private _updateInputValue; static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatFileInputComponent, [null, null, null, { optional: true; self: true; }, { optional: true; }, { optional: true; }, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatFileInputComponent, "ngx-mat-file-input", ["ngx-mat-file-input"], { "color": { "alias": "color"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "id": { "alias": "id"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "separator": { "alias": "separator"; "required": false; }; "required": { "alias": "required"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "value": { "alias": "value"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; }, {}, ["_customIcon"], ["[ngxMatFileInputIcon]"], false, never>; } export {};