import { EventEmitter, OnDestroy, OnInit } from '@angular/core'; import { DialogEvent, NggvDialogComponent } from '@sebgroup/green-angular/src/v-angular/modal'; import type { APIFile, EventStateChange, FileService, LocalFile, StateMap, UploadState } from './drag-drop.models'; import '@sebgroup/green-core/components/icon/icons/cloud-upload.js'; import '@sebgroup/green-core/components/icon/icons/cross-small.js'; import '@sebgroup/green-core/components/icon/icons/checkmark.js'; import * as i0 from "@angular/core"; export type DragDropState = 'normal' | 'over' | 'uploading' | 'done'; export declare class NggvDragDropComponent implements OnInit, OnDestroy { /** @internal */ deleteModalRef: NggvDialogComponent; /** Special property used for selecting DOM elements during automated UI testing. */ thook: string | null | undefined; /** Allowing selecting or dropping multiple files. */ service: FileService | undefined; /** Mime types allowed. */ accept?: string; /** Disables deletion or cancellation during defined states [local | uploading | aborted | uploaded | validating | error | deleted | done]. */ disableRemove: UploadState[]; /** File size limit in mega bytes. */ fileLimit: number; /** Allowing selecting or dropping multiple files. */ multiple: boolean; /** Determines if list should be shown under upload, disabling list disables multiple upload. */ list: boolean; /** Frequency of requests which to send to the API requesting status updates. */ throttle: number; /** Maximum number of attempts to request a status update from the API if service is unreachable. */ retryAttempts: number; /** If selection of multiple file should be possible with a checkbox. * @experimental work in progress and should not yet be used. * @internal */ selectable: boolean; /** Allows multiple values from `apiFile.status` to be mapped to a single file upload state. */ stateMap: StateMap; /** Statuses allowed to be fetch during the initial load. Used to hide "done" states from list. */ fetchStatuses: string[]; /** Statuses allowed be shown when status is "rejected". Will fallback to generic message. `null` allows all. */ errorCodes: string[] | null; /** Event triggered on initialization and every time the "uploadState" for a file changes. */ stateChange: EventEmitter; /** Event triggered when view details is clicked. */ detailsClick: EventEmitter; /** @internal */ isDragDropAvailable: boolean; /** @internal */ componentState: DragDropState; /** @internal */ files: Map; /** @internal */ lastFile: (LocalFile & APIFile) | undefined; /** @internal */ selected: string[]; /** @internal */ loading: boolean; /** @internal */ markedForDeletion: APIFile | undefined; /** * Initialize the component and warn if service is not defined. Will also fetch files for the list if enabled. */ ngOnInit(): void; /** Destroy all event listeners and polling running */ ngOnDestroy(): void; /** @internal Warn user trying to leave page before all uploads are done. Custom message only works in older browsers. */ onBeforeUnload(event: Event): "You still have files uploading, are you sure you want to leave this page?" | undefined; /** @internal Event handler for when a file is held over the drop area */ onDragEnter(event: DragEvent): void; /** @internal Event handler for when a file leaves the drop area */ onDragLeave(event: DragEvent): void; /** @internal Event handler for when a file is dropped on the drop area or when `input` files are selected */ onDrop(event: DragEvent | Event): void; /** @internal Event trigger for when delete button is pressed */ onRemove(id: string, state: UploadState): void; /** @internal */ onConfirmRemove(event: DialogEvent): void; /** @internal Event handler for when the files should be uploaded */ onSubmit(): void; /** * @internal * Using the state map convert `apiFile.state` to one of {@link UploadState} * @param apiState the state given by the file to be used for mapping */ determineUploadState(apiState: string): UploadState; /** @internal */ uploadStateIsArray(state: string | string[]): state is string[]; /** @internal used for translation templating parameters */ translateParams(file: LocalFile & APIFile): { fileLimit: string; raw: File | undefined; progress: number; uploadState: UploadState; uploadRequests: import("rxjs").Subscription | undefined; internalStatusReasonCode: string | null; statusReasonInformation: import("./drag-drop.models").APIStatusReason[] | null; id: string; status: string; principal: string; uploadDate: string; registrarId: string; registrarName: string; fileName: string; }; /** * Poll the status endpoint to determine when file is valid * @param file file used to check state and update * @param delay how long each interval should wait before sending a request */ private checkValidity; private fallbackError; /** * Check so that no files are still validating */ private allValidationDone; /** * Check so that no files are still uploading */ private allUploadingDone; /** * Helper to update the component state to done and then back to normal */ private setComponentStateDone; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }