Class: AuWidgetOption
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 topic.
{
"widgets": [
{
"title": "Book Size (Inches)",
"name": "books",
"type": "option",
"params": {
"type": "list",
"title": "Book Size (Inches)",
"values": []
}
},
{
"title": "Type of Pages",
"name": "pages",
"type": "option",
"params": {
"type": "radio",
"subType": "compact",
"title": "Type of Pages",
"values": []
}
}
]
}
Hierarchy
↳ AuWidgetOption
Implements
Index
Properties
Accessors
Methods
- addCssStyles
- addCustomStyles
- checkInitDependenciesWidgets
- clearSelection
- compile
- emitChange
- exportWidgetData
- restoreWidgetFromData
- showPreloader
- showToast
Properties
definition
• definition: IOption
An option definition obtained from the e-commerce driver.
element
• element: AuOptionBase
An option obtained from the e-commerce driver.
order
• order: IOrder
An order obtained from the e-commerce driver.
params
• params: any
Inherited from AuBaseWidget.params
Compiled widget configuration.
paramsRaw
• paramsRaw: any
Inherited from AuBaseWidget.paramsRaw
Uncompiled widget configuration.
Accessors
_
• get _(): IOptionValue | string
Overrides AuBaseSelectorWidget._
Returns the selected value.
Returns:IOptionValue | string
selected
• get selected(): IWidgetOptionValue | string
Returns the selected value.
Returns:IWidgetOptionValue | string
Methods
addCssStyles
▸ addCssStyles(params
: any): void
Inherited from AuBaseWidget.addCssStyles
Parameters:
Name | Type |
---|---|
params |
any |
Returns:void
addCustomStyles
▸ addCustomStyles(params
: any): void
Inherited from AuBaseWidget.addCustomStyles
Applies new styles to a widget.
Parameters:
Name | Type |
---|---|
params |
any |
Returns:void
checkInitDependenciesWidgets
▸ checkInitDependenciesWidgets(): string[]
Inherited from AuBaseWidget.checkInitDependenciesWidgets
Returns an array of widget names, due to which the current widget cannot receive parameters.
Returns:string[]
clearSelection
▸ clearSelection(): void
Overrides AuBaseSelectorWidget.clearSelection
Sets the value of the option to null
.
Returns:void
compile
▸ compile(additionalParam
: any): Promise‹any›
Inherited from AuBaseWidget.compile
Compiles the widget config.
"steps": [{
"name": "card-size",
"title": "Step 1. Card Options",
"description": "Choose a card size.",
"toolPanel": {
"name": "options"
},
"onActivate": [
"{{#function $['logo'].compile() }}"
]
},
...
Parameters:
Name | Type | Default | Description |
---|---|---|---|
additionalParam |
any | Parameters for widget config compilation. |
Returns:Promise‹any›
The compiled widget configuration.
emitChange
▸ emitChange(data
: any, forceRecompile
: boolean): void
Inherited from AuBaseWidget.emitChange
Sends a message about the widget state changes.
"steps": [{
"name": "card-size",
"title": "Step 1. Card Options",
"description": "Choose a card size.",
"toolPanel": {
"name": "options"
},
"onActivate": [
"{{#function $['options'].emitChange()}}"
]
},
...
Parameters:
Name | Type | Default | Description |
---|---|---|---|
data |
any | Data for updating the widget. | |
forceRecompile |
boolean | false | If true , runs widget recompilation to apply the updated parameters. |
Returns:void
exportWidgetData
▸ exportWidgetData(force
: boolean): Promise‹OptionsData›
Implementation of IRestorableWidget
Parameters:
Name | Type |
---|---|
force |
boolean |
Returns:Promise‹OptionsData›
restoreWidgetFromData
▸ restoreWidgetFromData(widgetData
: OptionsData, force
: boolean): Promise‹void›
Parameters:
Name | Type |
---|---|
widgetData |
OptionsData |
force |
boolean |
Returns:Promise‹void›
showPreloader
▸ showPreloader(isPreload
: boolean, message
: string): void
Inherited from AuBaseWidget.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 | undefined | A text message that appears next to the preloader. |
Returns:void
showToast
▸ showToast(data?
: string, duration?
: number): void
Inherited from AuBaseWidget.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