au-widget-color-selector/au-widget-color-selector
Classes
AuWidgetColorSelector
A widget that is used to select colors in the editor.
{
"widgets": [
{
"title": "Color picks",
"name": "colorSelector1",
"type": "color-selector",
"params": {
"text": "Our color picks",
"popupText": "Our color picks",
"svg": "<svg viewBox='0 0 20 20'><path d='m5 5h10v10h-10z' fill='currentColor'/></svg>",
"colors": [
{
"title": "Pastel Pink / Salmon",
"value": ["#F4CDD3", "#E08697"]
},
{
"title": "Fog/Navy",
"value": ["#DCDCDC", "#151B4E"]
},
{
"title": "Eggshell / Seamist",
"value": ["#F6F4EC", "#717BA1"]
}
]
}
},
{
"title": "Text color",
"name": "colorSelector2",
"type": "color-selector",
"params": {
"text": "Text color",
"popupText": "Select text color",
"colors": [
{
"title": "Pastel Pink",
"value": ["#F4CDD3"]
},
{
"title": "Salmon",
"value": ["#D7877C"]
}
]
}
},
{
"title": "Base color",
"name": "colorSelector3",
"type": "color-selector",
"params": {
"text": "Base color",
"popupText": "Select base color",
"colors": [
{
"title": "Pastel Pink",
"value": "#F4CDD3"
},
{
"title": "Salmon",
"value": "#D7877C"
}
]
}
}
]
}
Extends
Implements
Constructors
Constructor
new AuWidgetColorSelector(): AuWidgetColorSelector;
Returns
Inherited from
AuBaseSelectorWidget.constructor
Properties
color
color: any;
The color selected by the user.
params
params: IColorSelectorConfig;
Properties of the widget.
Overrides
Accessors
_
Get Signature
get _(): boolean;
Returns the selected value.
Returns
boolean
Overrides
hiddenColor
Get Signature
get hiddenColor(): boolean;
Returns
boolean
Set Signature
set hiddenColor(value): void;
Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
void
Methods
checkInitDependenciesWidgets()
checkInitDependenciesWidgets(): string[];
Returns an array of widget names, due to which the current widget cannot receive parameters.
Returns
string[]
Inherited from
AuBaseSelectorWidget.checkInitDependenciesWidgets
clearSelection()
clearSelection(): void;
Sets the color value to false to reset the color selection.
Returns
void
Overrides
AuBaseSelectorWidget.clearSelection
closeSelector()
closeSelector(): void;
Closes the color selector.
Returns
void
createPalette()
createPalette(colors, svg): void;
Creates a palette.
Parameters
| Parameter | Type |
|---|---|
colors | any |
svg | any |
Returns
void
exportWidgetData()
exportWidgetData(force): Promise<ColorSelectorData>;
Parameters
| Parameter | Type |
|---|---|
force | boolean |
Returns
Promise<ColorSelectorData>
Implementation of
IRestorableWidget.exportWidgetData
resetPreloaderState()
resetPreloaderState(): void;
Returns
void
Inherited from
AuBaseSelectorWidget.resetPreloaderState
restoreWidgetFromData()
restoreWidgetFromData(widgetData, force): Promise<void>;
Parameters
| Parameter | Type |
|---|---|
widgetData | ColorSelectorData |
force | boolean |
Returns
Promise<void>
Implementation of
IRestorableWidget.restoreWidgetFromData
showPreloader()
showPreloader(
isPreload,
message?,
timeout?): void;
Shows a preloader.
"onClick": [
"{{#function main.showPreloader(true, 'Creating print files...')}}",
"{{#function $['editor'].getHiResImages(800,800)}}",
"{{#function main.showPreloader(false)}}"
]
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
isPreload | boolean | undefined | If true, enables the preloader. |
message | string | string[] | ... | A text message that appears next to the preloader. |
timeout | number | 5 | - |
Returns
void
Inherited from
AuBaseSelectorWidget.showPreloader
showToast()
showToast(data?, duration?): void;
Shows a toast.
return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
Parameters
| Parameter | Type | Description |
|---|---|---|
data? | string | A string message to display in the toast. |
duration? | number | Defines how long to show the toast for. |
Returns
void
Inherited from
AuBaseSelectorWidget.showToast
toggleSelector()
toggleSelector(): void;
Shows and hides the color selector.
Returns
void
References
widget
Renames and re-exports AuWidgetColorSelector