Class AuWidgetUploader
A widget that is used to upload files to a server.
{
"widgets": [
{
"name": "logo-upload",
"type": "uploader",
"params": {
"multiple": false,
"text": "Upload logo",
"destination": "{{ vars.backendUrl + '/api/upload/image' }}",
"fileTypes": [ ".jpg", ".jpeg", ".png", ".svg" ],
"buttonText": "click me"
}
}
]
}
Package: ui-framework
Properties
errorResponse
Declaration
errorResponse: any = ""
Property Value
Type | Description |
---|---|
any |
httpCode
Declaration
httpCode: number = 0
Property Value
Type | Description |
---|---|
number |
params
Properties of the widget.
Declaration
params: IUploaderConfig
Property Value
Type | Description |
---|---|
IUploaderConfig | Properties of the widget. |
response
Declaration
response: any = null
Property Value
Type | Description |
---|---|
any |
responseType
Declaration
responseType: string = "json"
Property Value
Type | Description |
---|---|
string |
statusText
Declaration
statusText: string = ""
Property Value
Type | Description |
---|---|
string |
Methods
checkInitDependenciesWidgets()
Returns an array of widget names, due to which the current widget cannot receive parameters.
Declaration
function checkInitDependenciesWidgets()
Returns
Type | Description |
---|---|
string[] |
resetPreloaderState()
Declaration
function resetPreloaderState()
showPreloader(boolean, string | string[], number)
Shows a preloader.
"onClick": [
"{{#function main.showPreloader(true, 'Creating print files...')}}",
"{{#function $['editor'].getHiResImages(800,800)}}",
"{{#function main.showPreloader(false)}}"
]
Declaration
function showPreloader(isPreload: boolean, message: string | string[], timeout: number)
Parameters
Type | Name | Description |
---|---|---|
boolean | isPreload |
If |
string | string[] | message |
A text message that appears next to the preloader. |
number | timeout |
showToast(string, number)
Shows a toast.
return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
Declaration
function showToast(data?: string, duration?: number)
Parameters
Type | Name | Description |
---|---|---|
string | data |
A string message to display in the toast. |
number | duration |
Defines how long to show the toast for. |