import * as i0 from '@angular/core'; import { InjectionToken, EventEmitter, ElementRef } from '@angular/core'; import * as i1 from '@sbb-esta/angular/core'; import * as i3 from '@sbb-esta/angular/icon'; import { ControlValueAccessor } from '@angular/forms'; declare const SBB_FILE_SELECTOR_OPTIONS: InjectionToken; interface SbbFileSelectorOptions { /** * Categories of file types accepted by sbb-file-selector component. * It is optional. */ accept?: string; /** * Attribute whose state specifies the preferred facing mode for the media capture mechanism. * The attribute's keywords are user and environment, which map to the respective states user and environment. * It is optional. */ capture?: 'user' | 'environment'; /** * Mode on file selector component to chose more files to upload. * It is optional. */ multiple?: boolean; /** Set if the component should add files on top of the already selected ones or keep default input file behaviour */ multipleMode?: 'default' | 'persistent'; } type FileTypeCategory = 'generic' | 'doc' | 'image' | 'pdf' | 'audio' | 'video' | 'zip'; declare const SBB_FILE_TYPES: { TEXT: string[]; IMAGE: string[]; IMAGE_JPG: string[]; IMAGE_PNG: string[]; IMAGE_SVG: string[]; IMAGE_GIF: string[]; AUDIO: string[]; AUDIO_MP4: string[]; AUDIO_MP3: string[]; AUDIO_OGG: string[]; AUDIO_WAVE: string[]; AUDIO_WAV: string[]; VIDEO: string[]; VIDEO_MP4: string[]; VIDEO_MPEG: string[]; VIDEO_OGG: string[]; VIDEO_MOV: string[]; VIDEO_WEBM: string[]; VIDEO_AVI: string[]; VIDEO_WMV: string[]; PDF: string[]; MS_WORD_DOC: string[]; MS_EXCEL: string[]; MS_POWERPOINT: string[]; ZIP: string[]; }; declare const SBB_CATEGORY_MIME_TYPES: Map; declare class SbbFileSelector implements ControlValueAccessor, SbbFileSelectorOptions { private _fileTypeService; private _renderer; private _changeDetector; _labelUploadFile: string; _labelRemoveFile: string; private _uniqueId; /** Whether the file selector is disabled. */ disabled: boolean; /** Unique id of the element. */ id: string; /** Id for the inner input field. */ get inputId(): string; /** Categories of file types accepted by sbb-file-selector component. */ accept?: string; /** Attribute whose state specifies the preferred facing mode for the media capture mechanism. */ capture?: 'user' | 'environment'; /** Mode on file selector component to chose more files to upload. */ multiple: boolean; /** Set if the component should add files on top of the already selected ones or keep default input file behaviour. */ multipleMode: 'default' | 'persistent'; /** Event emitted to a change on file selector component (for example the uploading of files). */ fileChanged: EventEmitter; /** @docs-private */ fileInput: ElementRef; /** List of files uploaded. */ filesList: File[]; /** Property that listens changes on file selector. */ _onChange: (_: any) => void; /** Property that catches the interaction with user. */ _onTouched: () => void; constructor(...args: unknown[]); /** * Applies changes on the list of files uploaded. * @param files Files uploaded. */ fileChange(files: FileList | Event): void; /** * Applies changes on sbb-file-selector. * @param files Files uploaded. * @param action add or remove */ applyChanges(files: File[], action?: 'add' | 'remove'): void; /** * Returns the list of files without the file deleted. * @param file File to delete. * @returns List of files without the file deleted. */ removeFile(file: File): void; writeValue(value: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; /** Returns the file type category by the file type in input. */ _resolveFileTypeCategory(file: File): FileTypeCategory; /** Get the file name without the extension. */ _fileNameNoExtension(file: File): string; /** Get the file extension of the given file. */ _fileExtension(file: File): string; /** Returns the formatted file size of the given file. */ _fileSizeFormatted(file: File): string; private _getFileListByMode; private _checkFileEquality; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_multiple: unknown; } declare class SbbFileSelectorModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare class SbbFileSelectorTypesService { /** * Returns the file type category/ies from given mime type. * @param mimeType Mime type of a file. * @returns File type category/ies. */ getFileTypeCategoryByMimeType(mimeType: string): FileTypeCategory; /** * Returns all accepted formats. * @param typeCats File type category/ies. * @returns All formats accepted. */ getAcceptString(...typeCats: FileTypeCategory[] | FileTypeCategory[][]): string; /** * Returns the file extension from the given file name. * Returns empty string, if the file name has no extension or has the pattern '.name'. * @param fileName File name. * @return File with the name in input. */ fileExtension(fileName: string): string; /** * Returns the file extension of the file with name in input. * @param fileName File name. * @returns File extension. */ removeFileExtension(fileName: string): string; /** * Returns the file size with the correct unit of measure. * @param bytes File size in bytes. * @returns File size with the correct unit of measure. */ formatFileSize(bytes: number): string; private _buildAcceptString; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { SBB_CATEGORY_MIME_TYPES, SBB_FILE_SELECTOR_OPTIONS, SBB_FILE_TYPES, SbbFileSelector, SbbFileSelectorModule, SbbFileSelectorTypesService }; export type { FileTypeCategory, SbbFileSelectorOptions };