@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
205 lines (125 loc) • 4.42 kB
Markdown
# Class: AuWidgetCheckbox
A widget that adds a checkbox.
For details, you can refer to the [Checkbox widget](https://customerscanvas.com/dev/editors/ui-framework/widgets/checkbox.html) topic.
```
{
"widgets": [
{
"name": "agree-checkbox",
"type": "checkbox",
"params": {
"prompt": "I approve the design.",
"autoReset": true,
"value": true
}
}
]
}
```
## Hierarchy
↳ [AuBaseSelectorWidget](aubaseselectorwidget.md)
↳ **AuWidgetCheckbox**
## Implements
* [IWidget](../interfaces/iwidget.md)
* [IRestorableWidget](../interfaces/irestorablewidget.md)
## Index
### Properties
* [params](auwidgetcheckbox.md#params)
* [value](auwidgetcheckbox.md#value)
### Accessors
* [_](auwidgetcheckbox.md#_)
### Methods
* [checkInitDependenciesWidgets](auwidgetcheckbox.md#checkinitdependencieswidgets)
* [clearSelection](auwidgetcheckbox.md#clearselection)
* [exportWidgetData](auwidgetcheckbox.md#exportwidgetdata)
* [resetPreloaderState](auwidgetcheckbox.md#resetpreloaderstate)
* [restoreWidgetFromData](auwidgetcheckbox.md#restorewidgetfromdata)
* [showPreloader](auwidgetcheckbox.md#showpreloader)
* [showToast](auwidgetcheckbox.md#showtoast)
## Properties
### params
• **params**: *[ICheckboxConfig](../interfaces/icheckboxconfig.md)*
*Implementation of [IWidget](../interfaces/iwidget.md).[params](../interfaces/iwidget.md#optional-params)*
*Overrides [AuBaseWidget](aubasewidget.md).[params](aubasewidget.md#params)*
Properties of the widget.
___
### value
• **value**: *boolean* = false
## Accessors
### _
• **get _**(): *boolean*
*Overrides [AuBaseSelectorWidget](aubaseselectorwidget.md).[_](aubaseselectorwidget.md#_)*
Returns the checkbox value.
**Returns:** *boolean*
## Methods
### checkInitDependenciesWidgets
▸ **checkInitDependenciesWidgets**(): *string[]*
*Inherited from [AuBaseWidget](aubasewidget.md).[checkInitDependenciesWidgets](aubasewidget.md#checkinitdependencieswidgets)*
Returns an array of widget names, due to which the current widget cannot receive parameters.
**Returns:** *string[]*
___
### clearSelection
▸ **clearSelection**(): *void*
*Overrides [AuBaseSelectorWidget](aubaseselectorwidget.md).[clearSelection](aubaseselectorwidget.md#abstract-clearselection)*
Sets the checkbox value to `false`.
**Returns:** *void*
___
### exportWidgetData
▸ **exportWidgetData**(`force`: boolean): *Promise‹CheckboxData›*
*Implementation of [IRestorableWidget](../interfaces/irestorablewidget.md)*
**Parameters:**
Name | Type |
------ | ------ |
`force` | boolean |
**Returns:** *Promise‹CheckboxData›*
___
### resetPreloaderState
▸ **resetPreloaderState**(): *void*
*Inherited from [AuBaseWidget](aubasewidget.md).[resetPreloaderState](aubasewidget.md#resetpreloaderstate)*
**Returns:** *void*
___
### restoreWidgetFromData
▸ **restoreWidgetFromData**(`widgetData`: CheckboxData, `force`: boolean): *Promise‹void›*
**Parameters:**
Name | Type |
------ | ------ |
`widgetData` | CheckboxData |
`force` | boolean |
**Returns:** *Promise‹void›*
___
### showPreloader
▸ **showPreloader**(`isPreload`: boolean, `message`: string | string[], `timeout`: number): *void*
*Inherited from [AuBaseWidget](aubasewidget.md).[showPreloader](aubasewidget.md#showpreloader)*
Shows a preloader.
```
"onClick": [
"{{#function main.showPreloader(true, 'Creating print files...')}}",
"{{#function $['editor'].getHiResImages(800,800)}}",
"{{#function main.showPreloader(false)}}"
]
```
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`isPreload` | boolean | - | If `true`, enables the preloader. |
`message` | string | string[] | [""] | A text message that appears next to the preloader. |
`timeout` | number | 5 | - |
**Returns:** *void*
___
### showToast
▸ **showToast**(`data?`: string, `duration?`: number): *void*
*Inherited from [AuBaseWidget](aubasewidget.md).[showToast](aubasewidget.md#showtoast)*
Shows a toast.
```
return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
```
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`data?` | string | A string message to display in the toast. |
`duration?` | number | Defines how long to show the toast for. |
**Returns:** *void*