@doku-dev/doku-fragment
Version:
A new Angular UI library that moving away from Bootstrap and built from scratch.
69 lines (68 loc) • 2.99 kB
TypeScript
import { AfterViewInit, ChangeDetectorRef, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
import { ControlValueAccessor, NgControl } from '@angular/forms';
import { DokuFormFieldAccessor, DokuFormFieldAccessorValidateState, DokuFormFieldAccessorValidateValue, DokuFormFieldOptions } from '../form-field';
import * as i0 from "@angular/core";
export declare class DokuInputFileUpload implements DokuFormFieldAccessor, ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy {
private cdr;
private ngControl?;
onChange?: (value: File) => void;
onTouched?: () => void;
onDisable?: (value: boolean) => void;
onValidate?: (value?: DokuFormFieldAccessorValidateValue, state?: DokuFormFieldAccessorValidateState) => void;
value?: File | string;
fieldOptions?: DokuFormFieldOptions;
private loadingChanges$;
private destroy$;
protected imagePreviewSrc?: string;
/**
* Text that is shown as an input title.
*/
title: string;
/**
* Text that is shown as an input subtitle.
*/
subtitle: string;
/**
* Text that is shown in loading state.
*/
loadingText: string;
/**
* Comma-separated list of one or more file types, or unique file type specifiers,
* describing which file types to allow. The default is "*".
*/
accept: string;
/**
* Whether input file upload should be on disabled state. The default is `false`.
*/
get disabled(): boolean;
set disabled(val: boolean);
private _disabled;
/**
* Whether input file upload should be on loading state. The default is `false`.
*/
get loading(): unknown;
set loading(val: unknown);
private _loading;
constructor(cdr: ChangeDetectorRef, ngControl?: NgControl | undefined);
ngAfterViewInit(): void;
onFileSelected(e: Event): void;
ngOnChanges(changes: SimpleChanges): void;
setDisabledState?(isDisabled: boolean): void;
/**
* Listen and assign NgControl status to `doku-form-field`
* to complete behavior and functionality of the field
* (hint, error, success message, and styling).
*/
private _listenNgControlStatus;
private _showImagePreview;
private _checkFileIsImage;
private _checkStringIsImage;
ngOnDestroy(): void;
writeValue(value: File | string): void;
registerOnTouched(fn: () => void): void;
registerOnDisable(fn: (value: boolean) => void): void;
registerOnChange(fn: (value: File) => void): void;
registerOnValidate(fn: (value?: DokuFormFieldAccessorValidateValue) => void): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DokuInputFileUpload, [null, { optional: true; self: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<DokuInputFileUpload, "doku-input-file-upload", ["dokuInputFileUpload"], { "title": "title"; "subtitle": "subtitle"; "loadingText": "loadingText"; "accept": "accept"; "disabled": "disabled"; "loading": "loading"; }, {}, never, never, true>;
}