SiFileUploaderComponent documentation¶
import { SiFileUploaderComponent } from '@siemens/element-ng/file-uploader'; Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| accept ¶ | string | undefined | Define which file types are suggested in file browser. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept | |
| acceptText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types: {{accept}}.` | Text for the accepted file types. |
| autoUpload ¶ | boolean | false | Auto-upload mode - automatically start upload once files are added. |
| cancelButtonText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.CANCEL:Cancel` | Text of cancel button. Shown during upload. Required for a11y. |
| clearButtonText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.CLEAR:Clear` | Text used inside the clear button. |
| directoryUpload ¶ | boolean | false | Enable directory upload mode. When enabled, the file input will accept directories and upload all files within as a flat list. The hierarchy of the directory will not be preserved. The Note: This feature is not yet available for safari (iOS) |
| disableUpload ¶ | boolean | false | Disable the upload button. |
| errorTextFileMaxSize ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.ERROR_FILE_SIZE_EXCEEDED:Max. {{maxFileSize}}` | Message or translation key if file exceeds the maximum file size limit. |
| errorTextFileType ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.ERROR_FILE_TYPE:Invalid file type` | Text shown to indicate that an incorrect file type was added to file list. |
| errorUploadFailed ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.UPLOAD_FAILED:Upload failed` | Text shown if the upload failed. |
| maxConcurrentUploads ¶ | number | 3 | Maximum number of concurrent uploads. |
| maxFiles ¶ | number | 10 | Define maximal allowed number of files. When directoryUpload is enabled, this will have no effect. |
| maxFileSize ¶ | number | undefined | Define maximal allowed file size in bytes. |
| maxFileSizeText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.MAX_SIZE:Upload max. {{maxFileSize}}` | Text to describe the maximum file size. |
| maxFilesReachedText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.MAX_FILE_REACHED:Max. {{maxFiles}} files` | Error message shown when the maximum number of files are reached. |
| removeButtonText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.REMOVE:Remove` | Text shown to remove a file from the file list. Required for a11y. |
| retries ¶ | number | 0 | Numbers of retries for failed uploads. |
| showHttpError ¶ | boolean | false | On failed upload, show the error received from the server. |
| successTextTitle ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.UPLOAD_COMPLETED:Upload completed` | Text shown if the upload was successful. |
| uploadButtonText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.UPLOAD:Upload` | Text used inside the upload button. |
| uploadConfig ¶ | FileUploadConfig | { headers: new HttpHeaders({ 'Accept': 'application/json' }), method: 'POST', url: '', fieldName: 'upload_file', responseType: 'json' } | Config for HTTP request to upload file. |
| uploadDropText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.DROP:Drop files here or click to upload` | Text instructing a user to drop the files inside the dropzone. |
| uploadingText ¶ | TranslatableString | $localize`:@@SI_FILE_UPLOADER.UPLOADING:Uploading` | Text shown during the file upload. |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| filesChanges ¶ | UploadFile[] | Output which fires whenever new files are added to or removed from the uploader. |
| uploadCanceled ¶ | UploadFile | Emits when a user press cancel during upload. The event provides the file details. |
| uploadCompleted ¶ | FileUploadResult | Output callback event will provide you if upload is finished. If an error occurred it will be emitted. |
Attributes and Methods¶
Types Documentation¶
import type { FileUploadConfig } from '@siemens/element-ng/file-uploader'; -
Additional form fields added in the HTTP request.
Example:
{ upload_user: 'Reiner Zufall', expiry_date: ' 21.12.2012' }additionalFields?:
Record<string, string>¶ -
Form field name for the uploaded file.
-
A function to modify the HTTP request sent on the consumer side.
handler?:
((req: HttpRequest<unknown>) => Observable<HttpEvent<unknown>>)¶ -
headers:
string | HttpHeaders | Record<string, string | number | (string | number)[]> | Headers¶ -
Specify the server response type
responseType?:
"arraybuffer" | "blob" | "json" | "text"¶ -
When
true, the file will be sent directly w/o the use ofFormData. You will also need to set theContent-Typeheader when sending binary. See: headers
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.
import type { FileUploadResult } from '@siemens/element-ng/file-uploader';The FileUploadResult is emitted at completion of the file uploading via the uploadCompleted emitter. On success the Http response from the backend is provided and on failure, the error object is available.
Except where otherwise noted, content on this site is licensed under MIT License.