Class AuWidgetColorPicker
A widget that is used to select colors in the editor.
{
"widgets": [
{
"title": "Background Color",
"name": "colors",
"type": "color-picker",
"params": {
"text": "Choose a background",
"type": "color",
"colors": [
{
"value": "Beige",
"displayColor": "#dac0a3"
},
{
"value": "Kelly Green",
"displayColor": "#017c60"
},
{
"value": "Yellow",
"displayColor": "#fed505"
},
{
"value": "Teal",
"displayColor": "#009ead"
}
]
}
}
]
}
Package: ui-framework
Properties
color
The color selected by the user.
Declaration
color: any
Property Value
| Type | Description |
|---|---|
| any | The color selected by the user. |
params
Properties of the widget.
Declaration
params: IColorPickerConfig
Property Value
| Type | Description |
|---|---|
| IColorPickerConfig | Properties of the widget. |
Methods
checkInitDependenciesWidgets()
Returns an array of widget names, due to which the current widget cannot receive parameters.
Declaration
function checkInitDependenciesWidgets()
Returns
| Type | Description |
|---|---|
| string[] |
clearSelection()
Sets the color value to false to reset the color selection.
Declaration
function clearSelection()
closePicker()
Closes the color picker.
Declaration
function closePicker()
exportWidgetData(boolean)
Declaration
function exportWidgetData(force: boolean)
Parameters
| Type | Name | Description |
|---|---|---|
| boolean | force |
Returns
| Type | Description |
|---|---|
| Promise<ColorPickerData> |
resetPreloaderState()
Declaration
function resetPreloaderState()
restoreWidgetFromData(ColorPickerData, boolean)
Declaration
function restoreWidgetFromData(widgetData: ColorPickerData, force: boolean)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorPickerData | widgetData | |
| boolean | force |
Returns
| Type | Description |
|---|---|
| Promise<void> |
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. |
togglePicker()
Shows and hides the color picker.
Declaration
function togglePicker()