import { EventEmitter } from "../../stencil-public-runtime"; import { StzhUploadCanceledEvent, StzhUploadCanceledMultipleEvent, StzhUploadCompleteEvent, StzhUploadCompleteMultipleEvent, StzhUploadErrorEvent, StzhUploadErrorMultipleEvent, StzhUploadFileAddedEvent, StzhUploadFileRemovedEvent, StzhUploadFileRemoveEvent, StzhUploadFilesAddedEvent, StzhUploadFilesItem, StzhUploadProcessingEvent, StzhUploadProcessingMultipleEvent, StzhUploadProgressEvent, StzhUploadProgressTotalEvent, StzhUploadSendingEvent, StzhUploadSendingMultipleEvent, StzhUploadSuccessEvent, StzhUploadSuccessMultipleEvent } from "../../index"; import { StzhEnvironmentEnum } from "../../utils/utils"; import { StzhUploadLocalizedText } from "./stzh-upload.localization"; import "../../libraries/dropzone/dropzone"; import { StzhPhotographingUrlDetailsDto } from "./models/stzh-photographing-url-details.dto"; import { StzhPhotographingConfigurationDto } from "./models/stzh-photographing-configuration.dto"; /** * @slot error - Slot for error */ export declare class StzhUpload { /** * Pre-existing files (e.g. already uploaded by the user). * Array of objects that must at least include `name` and `size` attribute: * `[{"name":"file1.txt", "size": 12345}, {"name":"file2.txt", "size": 12345}]` */ existingFiles: StzhUploadFilesItem[] | string; private _existingFiles; private displayedExistingFiles; /** Name of hidden input field */ name: string; /** Label */ label: string; /** Whether label should be truncated or not */ noLabelTruncate: boolean; /** Whether label should be visually hidden. */ labelHidden: boolean; /** Instructions description */ description: string; /** Long description message appearing in a popover */ descriptionLong: string; /** Button text */ button: string; /** Scan Button text */ buttonScan: string; /** Scan Button text */ photographingEnabled: boolean; /** Disable toasts on upload success and error */ disableToasts: boolean; /** Leading icon */ leadingIcon?: string; /** * URL the files are processed to (if autoProcessQueue is true). * You can also provide a function that will be called with `files` and `dataBlocks` and must return the url as string. */ url?: string | ((files: File[], dataBlocks?: unknown) => string); /** * Can be changed to `"put"` if necessary. You can also provide a function * that will be called with `files` and must return the method. */ method: "post" | "put" | Function; /** * Will be set on the XHRequest. */ withCredentials: boolean; /** * Whether the upload is disabled or not. */ disabled: boolean; /** * Whether the upload is marked as invalid. */ invalid: boolean; /** Hide `(optional)` label (or use `required` inside form to hide it) */ hideOptional: boolean; /** Required status */ required: boolean; /** Whether download functionality should be disabled. */ downloadDisabled: boolean; /** Whether download functionality should only be shown to completed files. */ downloadDisabledWhileProcessing: boolean; /** One or multiple error message (use error slot as alternative) */ error: string | string[]; private _error; /** The file types accepted to be uploaded. */ acceptedFiles: string; /** * If false, files will be added to the queue but the queue will not be * processed automatically. * This can be useful if you need some additional user input before sending * files (or if you want all files sent at once). * If you're ready to send the file simply call `element.processQueue()`. * If true, you need to set `url`. */ autoProcessQueue: boolean; /** * Hide progress (bars and text). */ hideProgress: boolean; /** * Hide progress (bars) only while idle (will show them as soon as upload starts). * Can be used together with `autoProcessQueue`, e.g. if files are uploaded at form submit to prevent showing empty progressbar. */ hideProgressWhileIdle: boolean; /** * If not `null` defines how many files this dropzone handles. If it exceeds, * the event `stzhMaxfilesexceeded` will be called. */ maxFiles: number | null; /** * The maximum filesize (in MiB) that is allowed to be uploaded per file. */ maxFilesize: number | null; /** * The maximum filesize (in MiB) that is allowed to be uploaded over all files. */ maxFilesizeTotal: number | null; /** * How many file uploads to process in parallel. */ parallelUploads: number; /** * Whether to send multiple files in one request. If * this it set to true, then the fallback file input element will * have the `multiple` attribute as well. This option will * also trigger additional events (like `stzhSuccessMultiple`). See the events * documentation section for more information. */ uploadMultiple: boolean; /** * Whether you want files to be uploaded in chunks to your server. This can't be * used in combination with `uploadMultiple`. * * See `chunksUploaded` prop for the callback to finalise an upload. */ chunking: boolean; /** * If `chunking` is enabled, this defines whether **every** file should be chunked, * even if the file size is below chunkSize. This means, that the additional chunk * form data will be submitted and the `chunksUploaded` callback will be invoked. */ forceChunking: boolean; /** * If `chunking` is `true`, then this defines the chunk size in bytes. */ chunkSize: number; /** * If `true`, the individual chunks of a file are being uploaded simultaneously. */ parallelChunkUploads: boolean; /** * Whether a chunk should be retried if it fails. */ retryChunks: boolean; /** * If `retryChunks` is true, how many times should it be retried. */ retryChunksLimit: number; /** * The base that is used to calculate the **displayed** filesize. You can * change this to 1024 if you would rather display kibibytes, mebibytes, * etc... 1024 is technically incorrect, because `1024 bytes` are `1 kibibyte` * not `1 kilobyte`. You can change this to `1024` if you don't care about * validity. */ filesizeBase: number; /** * An optional object to send additional headers to the server. Eg: * `{ "My-Awesome-Header": "header value" }` * * Can also be set as function returning the headers object dynamically. * If you want to use an async function, use "headersAsync" prop. */ headers: object | ((Dropzone: any) => { [key: string]: string; }) | null; /** * An optional function providing headers asynchronously. If you use that, * it will automatically set 'autoProcessQueue' to 'false'. * The component will still automatically process the queue, but in a different * way (workaround since dropzone not supporting async headers). */ headersAsync: (() => Promise<{ [key: string]: string; }>) | null; /** * Should the default headers be set or not? * Accept: application/json <- for requesting json response * Cache-Control: no-cache <- Request shouldnt be cached * X-Requested-With: XMLHttpRequest <- We sent the request via XMLHttpRequest */ defaultHeaders: boolean; /** * Whether it is possible to upload files with identical names. */ preventDuplicateFileNames: boolean; /** * A function that gets a [file](https://developer.mozilla.org/en-US/docs/DOM/File) * and a `done` function as parameters. * * If the done function is invoked without arguments, the file is "accepted" and will * be processed. If you pass an error message, the file is rejected, and the error * message will be displayed. * This function will not be called if the file is too big or doesn't match the mime types. */ accept: Function; /** * The callback that will be invoked when all chunks have been uploaded for a file. * It gets the file for which the chunks have been uploaded as the first parameter, * and the `done` function as second. `done()` needs to be invoked when everything * needed to finish the upload process is done. */ chunksUploaded: Function; /** * This is the element the hidden input field (which is used when clicking on the * dropzone to trigger file selection) will be appended to. This might * be important in case you use frameworks to switch the content of your page. * * Can be a selector string, or an element directly. Will be rendered into element by default. */ hiddenInputContainer: string | HTMLElement; /** * Prevent clearing hidden input after adding a new file * (set true if you use stzh-upload inside a native multipart form with POST method). */ preventHiddenInputClear: boolean; /** Translation strings. */ localization: StzhUploadLocalizedText; environment: StzhEnvironmentEnum | undefined; totalFileSize: number; duplicateDetected: boolean; totalTooBig: boolean; totalTooBigMessageHeading: string; totalTooBigMessageBody: string; totalTooBigMessageBody2: string; totalFilesState: Array; duplicateFileName: string; duplicateFileSize: string; uploadEl: HTMLStzhUploadElement; resetListener(event: Event): void; nameWatcher(newValue: string): void; maxFilesWatcher(newMaxFiles: number | null): void; maxFilesizeWatcher(newMaxFilesize: number | null): void; acceptedFilesWatcher(newAcceptedFiles: string): void; existingFilesWatcher(newValue: StzhUploadFilesItem[] | string): void; disabledWatcher(): void; errorWatcher(newValue: string | string[]): void; /** File added */ stzhFileAdded: EventEmitter; /** Files added (multiple) */ stzhFilesAdded: EventEmitter; /** File remove (before, cancelable) */ stzhFileRemove: EventEmitter; /** File removed */ stzhFileRemoved: EventEmitter; /** Before sending file (add additional data before request if necessary) */ stzhSending: EventEmitter; /** Before sending multiple files (add additional data before request if necessary) */ stzhSendingMultiple: EventEmitter; /** Files starting to get processed */ stzhProcessing: EventEmitter; /** Files starting to get processed (multiple) */ stzhProcessingMultiple: EventEmitter; /** Upload file progress during upload */ stzhProgress: EventEmitter; /** Upload total file progress during upload */ stzhProgressTotal: EventEmitter; /** File error */ stzhError: EventEmitter; /** Files error (multiple files) */ stzhErrorMultiple: EventEmitter; /** File successfully uploaded */ stzhSuccess: EventEmitter; /** Files successfully uploaded (multiple files) */ stzhSuccessMultiple: EventEmitter; /** Canceled file upload */ stzhCanceled: EventEmitter; /** Canceled file upload (multiple files) */ stzhCanceledMultiple: EventEmitter; /** Completed upload (successfully or with error) */ stzhComplete: EventEmitter; /** Completed upload (successfully or with error, multiple files) */ stzhCompleteMultiple: EventEmitter; /** Sets the focus on the choose file button, when stzh-upload is focused. */ setFocus(options?: FocusOptions & { deep?: boolean; }): Promise; processQueue(): Promise; removeFile(file: any, force?: boolean): Promise; removeAllFiles(cancelIfNecessary?: boolean, force?: boolean): Promise; private dropzone; private dropzoneElement; private chooseFileButtonEl; private clickareaElement; private previewsElement; private errorsElement; private hiddenInputContainerElement; private readonly uid; /** a11y description for the 2 buttons (choose file and photograph) */ private get a11yDescribedby(); /** Dropzone requires a url. We only require a url if autoProcessQueue is true. Otherwise we set '/' as default url (if none is provided). */ private getDropzoneUrl; private photographingOverlayElement; private photographingQrcodeElement; private PHOTOGRAPHING_BASE_URL; private PHOTOGRAPHING_ENDPOINTS; isPhotographingAvailable: boolean; photographingUrlDetails: StzhPhotographingUrlDetailsDto | undefined; photographingHost: string; photographingConfig: StzhPhotographingConfigurationDto | undefined; photographingWebsocket: WebSocket | undefined; photographingToken: { access_token: string; expires_in: number; } | undefined; hiddenInputFiles: File[]; private handleReset; private cleanLabel; private getToken; private requestPhotographingToken; private initializePhotographingWithEnvironment; private startPhotographingUserSession; private retrievePhotographingPdf; private fetchFile; private establishPhotographingWebsocketConnection; private closePhotographingWebsocketConnection; private sendPhotographingWebsocketMessage; private getPhotographingHttpOptionsWithToken; private checkPhotographingAvailability; private setPhotographingConfig; private getPhotographingHostForEnvironment; private onButtonScanClick; private closePhotographingOverlay; private filesize; private filePreviewId; private removeFileFromState; private displayNewExistingFiles; componentWillLoad(): Promise; private toggleToast; componentDidLoad(): void; componentDidRender(): void; disconnectedCallback(): void; /*** private UploadDescription() { if (!this.description) return null; return (
{this.description}
); } */ render(): any; }