UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

171 lines (100 loc) 3.84 kB
# Class: AuDesignEditor The base class for the [`DesignEditor`](auwidgetdesigneditor.md) widget. ## Hierarchy ↳ [AuBaseWidget](aubasewidget.md) ↳ **AuDesignEditor** ↳ [AuWidgetDesignEditor](auwidgetdesigneditor.md) ## Implements * [IWidget](../interfaces/iwidget.md) ## Index ### Properties * [params](audesigneditor.md#params) ### Methods * [checkInitDependenciesWidgets](audesigneditor.md#checkinitdependencieswidgets) * [colorToHex](audesigneditor.md#colortohex) * [getDesignEditorItemModel](audesigneditor.md#getdesigneditoritemmodel) * [getEditor](audesigneditor.md#geteditor) * [getProduct](audesigneditor.md#getproduct) * [resetPreloaderState](audesigneditor.md#resetpreloaderstate) * [showPreloader](audesigneditor.md#showpreloader) * [showToast](audesigneditor.md#showtoast) ## Properties ### params**params**: *any* *Implementation of [IWidget](../interfaces/iwidget.md).[params](../interfaces/iwidget.md#optional-params)* *Inherited from [AuBaseWidget](aubasewidget.md).[params](aubasewidget.md#params)* Compiled widget configuration. ## 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[]* ___ ### colorToHex ▸ **colorToHex**(`color`: Color): *Promise‹string›* **Parameters:** Name | Type | ------ | ------ | `color` | Color | **Returns:** *Promise‹string›* ___ ### getDesignEditorItemModel**getDesignEditorItemModel**(`item`: BaseTextItem | PlaceholderItem | ShapeItem): *Promise‹[DesignEditorItemChanges](designeditoritemchanges.md)›* **Parameters:** Name | Type | ------ | ------ | `item` | BaseTextItem | PlaceholderItem | ShapeItem | **Returns:** *Promise‹[DesignEditorItemChanges](designeditoritemchanges.md)›* ___ ### getEditor ▸ **getEditor**(): *Promise‹Editor›* Returns a promise with an instance of the `DesignEditor`. **Returns:** *Promise‹Editor›* ___ ### getProduct**getProduct**(): *Promise‹Product›* Returns a promise with the product opened in the `DesignEditor`. **Returns:** *Promise‹Product›* ___ ### resetPreloaderState ▸ **resetPreloaderState**(): *void* *Inherited from [AuBaseWidget](aubasewidget.md).[resetPreloaderState](aubasewidget.md#resetpreloaderstate)* **Returns:** *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*