Class AuWidgetDataDrivenEditor
Represents a Data-Driven Editor widget, enabling users to fill out pre-configured forms and modify designs accordingly. For details, you can refer to the Data-Driven Editor widget topic.
{
"widgets": [
{
"name": "dde",
"type": "data-driven-editor",
"params": {
"config": {
"access": {
"tenantId": "12345",
"userId": "jon.snow",
"token": "..."
},
"design": {
"designId": "68e74591f70c72b7ce14f889",
"dataSetId": "68a24768aa00e6f0203564dc"
},
"api": {
"designAtoms": "https://api.example.com/atoms",
"assetProcessor": "https://api.example.com/processor",
"assetStorage": "https://api.example.com/storage"
},
"settings": {
"lang": "en",
"allowManipulations": false,
"itemsSnapLines": true
},
"renderer": {
"watermarkEnabled": true,
"watermarkOpacity": 0.5,
"format": "jpeg"
}
}
}
}
]
}
Package: ui-framework
Properties
idStr
Product ID string
Declaration
public idStr: string
Property Value
Type | Description |
---|---|
string | Product ID string |
isValid
true
if form of data driven editor is valid
Declaration
public isValid: boolean
Property Value
Type | Description |
---|---|
boolean |
|
pdfUrl
URL for download PDF file
Declaration
public pdfUrl: string
Property Value
Type | Description |
---|---|
string | URL for download PDF file |
previewUrlLink
URL preview image (First page)
Declaration
public previewUrlLink: string
Property Value
Type | Description |
---|---|
string | URL preview image (First page) |
previewUrls
URL's preview images
Declaration
public previewUrls: string[] = []
Property Value
Type | Description |
---|---|
string[] | URL's preview images |
stateId
Saved product ID
Declaration
public stateId: string
Property Value
Type | Description |
---|---|
string | Saved product ID |
userId
Current user ID
Declaration
public userId: string
Property Value
Type | Description |
---|---|
string | Current user ID |
Methods
checkInitDependenciesWidgets()
Returns an array of widget names, due to which the current widget cannot receive parameters.
Declaration
function checkInitDependenciesWidgets()
Returns
Type | Description |
---|---|
string[] |
createIdStr()
Create id string from values from data driven form
Declaration
function createIdStr()
Returns
Type | Description |
---|---|
Promise<string> |
createPdfPreview(IRendererConfig)
Create link for download preview PDF file
Declaration
function createPdfPreview(config?: IRendererConfig)
Parameters
Type | Name | Description |
---|---|---|
IRendererConfig | config |
Render configuration |
Returns
Type | Description |
---|---|
Promise<string> |
createPreview(IRendererConfig)
Create preview images
Declaration
function createPreview(config?: IRendererConfig)
Parameters
Type | Name | Description |
---|---|---|
IRendererConfig | config |
Render configuration |
Returns
Type | Description |
---|---|
Promise<string[]> |
exportWidgetData(boolean)
Declaration
function exportWidgetData(force: boolean)
Parameters
Type | Name | Description |
---|---|---|
boolean | force |
Returns
Type | Description |
---|---|
Promise<Partial<IEditorConfig>> |
getFormData(IFormDataConfig)
Allow to get current data of form
Declaration
function getFormData(config: IFormDataConfig)
Parameters
Type | Name | Description |
---|---|---|
IFormDataConfig | config |
Returns
Type | Description |
---|---|
Object |
resetPreloaderState()
Declaration
function resetPreloaderState()
restoreWidgetFromData(IEditorConfig, boolean)
Declaration
function restoreWidgetFromData(data: IEditorConfig, force: boolean)
Parameters
Type | Name | Description |
---|---|---|
IEditorConfig | data | |
boolean | force |
Returns
Type | Description |
---|---|
Promise<void> |
saveProduct(boolean)
Saved or updated current product to private storage
Declaration
function saveProduct(asNew: boolean)
Parameters
Type | Name | Description |
---|---|---|
boolean | asNew |
Returns
Type | Description |
---|---|
Promise<void> |
setEditorConfig(IEditorConfig)
Sets the configuration of data driven editor
Declaration
function setEditorConfig(config: IEditorConfig)
Parameters
Type | Name | Description |
---|---|---|
IEditorConfig | config |
Returns
Type | Description |
---|---|
Promise<void> |
setLang(string)
Sets the language of data driven editor
Declaration
function setLang(lang: string)
Parameters
Type | Name | Description |
---|---|---|
string | lang |
setUserInfo(Record<string, string>)
Allow to set user info
Declaration
function setUserInfo(userInfo: Record<string, string>)
Parameters
Type | Name | Description |
---|---|---|
Record<string, string> | userInfo |
showPreloader(boolean, string | string[], number)
Shows a preloader.
"onClick": [
"{{#function main.showPreloader(true, 'Creating print files...')}}",
"{{#function $['editor'].getHiResImages(800,800)}}",
"{{#function main.showPreloader(false)}}"
]
Declaration
function showPreloader(isPreload: boolean, message: string | string[], timeout: number)
Parameters
Type | Name | Description |
---|---|---|
boolean | isPreload |
If |
string | string[] | message |
A text message that appears next to the preloader. |
number | timeout |
showToast(string, number)
Shows a toast.
return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
Declaration
function showToast(data?: string, duration?: number)
Parameters
Type | Name | Description |
---|---|---|
string | data |
A string message to display in the toast. |
number | duration |
Defines how long to show the toast for. |
updateToken(string)
Update the token for data driven editor.
Declaration
function updateToken(token: string)
Parameters
Type | Name | Description |
---|---|---|
string | token |
validate()
Validate form in editor
Declaration
function validate()
Returns
Type | Description |
---|---|
boolean |