UNPKG

@netgrif/components-core

Version:

Netgrif Application engine frontend core Angular library

76 lines (75 loc) 2.72 kB
import { DataField } from '../../models/abstract-data-field'; import { Behavior } from '../../models/behavior'; import { Layout } from '../../models/layout'; import { FileFieldValue } from './file-field-value'; import { Observable } from 'rxjs'; import { Component } from '../../models/component'; import { FormControl } from '@angular/forms'; import { Validation } from '../../models/validation'; import { ChangedFieldsMap } from '../../../event/services/interfaces/changed-fields-map'; /** * Supported types of files a user can select through a file picker. */ export declare enum FileUploadMIMEType { IMAGE = "image/*", VIDEO = "video/*", AUDIO = "audio/*", PDF = ".pdf", JPG_JPEG = ".jpg,.jpeg", XML = ".xml", DOC_DOCX = ".doc,.docx", XLS_XLSX = ".xls,.xlsx" } /** * Supported types for file preview */ export declare enum FilePreviewType { pdf = 0, jpg = 1, jpeg = 2, png = 3 } /** * Extended structure for file by name and extension. */ export interface FileUploadDataModel { file: File; name: string; extension: string; } /** * Holds information represent file field implements in Petri Net */ export declare class FileField extends DataField<FileFieldValue> { private _maxUploadSizeInBytes?; private _allowTypes?; /** * Specifies the size of all uploaded files in bytes. * * It is an indicator for checking the oversized size in the Petri Net. */ filesSize: number; /** * Used to forward the result of the upload file backend call to the task content */ private _changedFields$; downloaded: boolean; set value(value: FileFieldValue); get value(): FileFieldValue; get updated(): Observable<void>; getTypedComponentType(): string; valueWithoutChange(value: FileFieldValue): void; /** * Create new instance for file field with all his properties. * * Placeholder is a substitute for the value name if not set value. */ constructor(stringId: string, title: string, behavior: Behavior, value?: FileFieldValue, placeholder?: string, description?: string, layout?: Layout, _maxUploadSizeInBytes?: number, _allowTypes?: string | FileUploadMIMEType | Array<FileUploadMIMEType>, validations?: Array<Validation>, component?: Component, parentTaskId?: string); get maxUploadSizeInBytes(): number; get allowTypes(): string; get changedFields$(): Observable<ChangedFieldsMap>; emitChangedFields(change: ChangedFieldsMap): void; protected valueEquality(a: FileFieldValue, b: FileFieldValue): boolean; registerFormControl(formControl: FormControl): void; protected updateFormControlState(formControl: FormControl): void; }