@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
314 lines (193 loc) • 7.39 kB
Markdown
A widget that is used to select product options provided by an e-commerce system such as paper types, colors, sizes, etc.
For details, you can refer to the [Option widget](https://customerscanvas.com/dev/editors/ui-framework/widgets/option.html) topic.
```
{
"widgets": [
{
"title": "Book Size (Inches)",
"name": "books",
"type": "option",
"params": {
"type": "list",
"title": "Book Size (Inches)",
"initWithEmptyValue": true,
"placeholderText": "Select a book size",
"values": []
}
},
{
"title": "Type of Pages",
"name": "pages",
"type": "option",
"params": {
"type": "radio",
"subType": "compact",
"title": "Type of Pages",
"initWithEmptyValue": true,
"placeholderText": "Select a type",
"values": []
}
}
]
}
```
↳ [AuAbstractOption](auabstractoption.md)
↳ **AuWidgetOption**
* [IWidget](../interfaces/iwidget.md)
* [IRestorableWidget](../interfaces/irestorablewidget.md)
* [_definitionPromise](auwidgetoption.md
* [_firstTimeInit](auwidgetoption.md
* [_onChange](auwidgetoption.md
* [definition](auwidgetoption.md
* [element](auwidgetoption.md
* [order](auwidgetoption.md
* [params](auwidgetoption.md
* [placeholderText](auwidgetoption.md
* [_](auwidgetoption.md
* [selected](auwidgetoption.md
* [_manageEmptyValuesText](auwidgetoption.md
* [checkInitDependenciesWidgets](auwidgetoption.md
* [clearSelection](auwidgetoption.md
* [exportWidgetData](auwidgetoption.md
* [resetPreloaderState](auwidgetoption.md
* [restoreWidgetFromData](auwidgetoption.md
* [showPreloader](auwidgetoption.md
* [showToast](auwidgetoption.md
• **_definitionPromise**: *Promise‹any›* = Promise.resolve()
*Inherited from [AuAbstractOption](auabstractoption.md).[_definitionPromise](auabstractoption.md
___
• **_firstTimeInit**: *boolean* = true
*Inherited from [AuAbstractOption](auabstractoption.md).[_firstTimeInit](auabstractoption.md
___
• **_onChange**: *Function*
*Inherited from [AuAbstractOption](auabstractoption.md).[_onChange](auabstractoption.md
___
• **definition**: *IOption*
An option definition obtained from the e-commerce driver.
___
• **element**: *[AuOptionBase](auoptionbase.md)*
*Inherited from [AuAbstractOption](auabstractoption.md).[element](auabstractoption.md
An option obtained from the e-commerce driver.
___
• **order**: *IOrder*
*Inherited from [AuAbstractOption](auabstractoption.md).[order](auabstractoption.md
An order obtained from the e-commerce driver.
___
• **params**: *any*
*Implementation of [IWidget](../interfaces/iwidget.md).[params](../interfaces/iwidget.md
*Inherited from [AuBaseWidget](aubasewidget.md).[params](aubasewidget.md
Compiled widget configuration.
___
• **placeholderText**: *string*
*Inherited from [AuAbstractOption](auabstractoption.md).[placeholderText](auabstractoption.md
• **get _**(): *string | IOptionValue & SelectedOption*
*Inherited from [AuAbstractOption](auabstractoption.md).[_](auabstractoption.md
*Overrides [AuBaseSelectorWidget](aubaseselectorwidget.md).[_](aubaseselectorwidget.md
Returns the selected value.
**Returns:** *string | IOptionValue & SelectedOption*
___
• **get selected**(): *string | [IWidgetOptionValue](../interfaces/iwidgetoptionvalue.md) & SelectedOption*
*Inherited from [AuAbstractOption](auabstractoption.md).[selected](auabstractoption.md
Returns the selected value.
**Returns:** *string | [IWidgetOptionValue](../interfaces/iwidgetoptionvalue.md) & SelectedOption*
▸ **_manageEmptyValuesText**(`applyEmptyValues`: boolean): *void*
*Inherited from [AuAbstractOption](auabstractoption.md).[_manageEmptyValuesText](auabstractoption.md
**Parameters:**
Name | Type |
------ | ------ |
`applyEmptyValues` | boolean |
**Returns:** *void*
___
▸ **checkInitDependenciesWidgets**(): *string[]*
*Inherited from [AuBaseWidget](aubasewidget.md).[checkInitDependenciesWidgets](aubasewidget.md
Returns an array of widget names, due to which the current widget cannot receive parameters.
**Returns:** *string[]*
___
▸ **clearSelection**(): *void*
*Inherited from [AuAbstractOption](auabstractoption.md).[clearSelection](auabstractoption.md
*Overrides [AuBaseSelectorWidget](aubaseselectorwidget.md).[clearSelection](aubaseselectorwidget.md
Sets the value of the option to `null`.
**Returns:** *void*
___
▸ **exportWidgetData**(`force`: boolean): *Promise‹OptionsData›*
*Implementation of [IRestorableWidget](../interfaces/irestorablewidget.md)*
**Parameters:**
Name | Type |
------ | ------ |
`force` | boolean |
**Returns:** *Promise‹OptionsData›*
___
▸ **resetPreloaderState**(): *void*
*Inherited from [AuBaseWidget](aubasewidget.md).[resetPreloaderState](aubasewidget.md
**Returns:** *void*
___
▸ **restoreWidgetFromData**(`widgetData`: OptionsData, `force`: boolean): *Promise‹void›*
**Parameters:**
Name | Type |
------ | ------ |
`widgetData` | OptionsData |
`force` | boolean |
**Returns:** *Promise‹void›*
___
▸ **showPreloader**(`isPreload`: boolean, `message`: string | string[], `timeout`: number): *void*
*Inherited from [AuBaseWidget](aubasewidget.md).[showPreloader](aubasewidget.md
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 &
`timeout` | number | 5 | - |
**Returns:** *void*
___
▸ **showToast**(`data?`: string, `duration?`: number): *void*
*Inherited from [AuBaseWidget](aubasewidget.md).[showToast](aubasewidget.md
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*