|
|
@ -54,12 +54,12 @@ import { |
|
|
import { ComponentDynamicValueListener } from './ComponentDynamicValueListener'; |
|
|
import { ComponentDynamicValueListener } from './ComponentDynamicValueListener'; |
|
|
import { DynamicValueWatcher } from './DynamicValueWatcher'; |
|
|
import { DynamicValueWatcher } from './DynamicValueWatcher'; |
|
|
|
|
|
|
|
|
export interface IComponent extends ExtractMethods<Component> { } |
|
|
export interface IComponent extends ExtractMethods<Component> {} |
|
|
export interface DynamicWatchersOptions { |
|
|
export interface DynamicWatchersOptions { |
|
|
skipWatcherUpdates?: boolean; |
|
|
skipWatcherUpdates?: boolean; |
|
|
} |
|
|
} |
|
|
export interface SetAttrOptions extends SetOptions, UpdateStyleOptions, DynamicWatchersOptions { } |
|
|
export interface SetAttrOptions extends SetOptions, UpdateStyleOptions, DynamicWatchersOptions {} |
|
|
export interface ComponentSetOptions extends SetOptions, DynamicWatchersOptions { } |
|
|
export interface ComponentSetOptions extends SetOptions, DynamicWatchersOptions {} |
|
|
|
|
|
|
|
|
const escapeRegExp = (str: string) => { |
|
|
const escapeRegExp = (str: string) => { |
|
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'); |
|
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'); |
|
|
@ -226,12 +226,12 @@ export default class Component extends StyleableModel<ComponentProperties> { |
|
|
return this.frame?.getPage(); |
|
|
return this.frame?.getPage(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
preInit() { } |
|
|
preInit() {} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Hook method, called once the model is created |
|
|
* Hook method, called once the model is created |
|
|
*/ |
|
|
*/ |
|
|
init() { } |
|
|
init() {} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Hook method, called when the model has been updated (eg. updated some model's property) |
|
|
* Hook method, called when the model has been updated (eg. updated some model's property) |
|
|
@ -239,12 +239,12 @@ export default class Component extends StyleableModel<ComponentProperties> { |
|
|
* @param {*} value Property value, if triggered after some property update |
|
|
* @param {*} value Property value, if triggered after some property update |
|
|
* @param {*} previous Property previous value, if triggered after some property update |
|
|
* @param {*} previous Property previous value, if triggered after some property update |
|
|
*/ |
|
|
*/ |
|
|
updated(property: string, value: any, previous: any) { } |
|
|
updated(property: string, value: any, previous: any) {} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Hook method, called once the model has been removed |
|
|
* Hook method, called once the model has been removed |
|
|
*/ |
|
|
*/ |
|
|
removed() { } |
|
|
removed() {} |
|
|
|
|
|
|
|
|
em!: EditorModel; |
|
|
em!: EditorModel; |
|
|
opt!: ComponentOptions; |
|
|
opt!: ComponentOptions; |
|
|
@ -1575,14 +1575,14 @@ export default class Component extends StyleableModel<ComponentProperties> { |
|
|
const dynamicTraitsObj = this.componentDVListener.getTraitsDefs(); |
|
|
const dynamicTraitsObj = this.componentDVListener.getTraitsDefs(); |
|
|
const keys = Object.keys(dynamicTraitsObj); |
|
|
const keys = Object.keys(dynamicTraitsObj); |
|
|
const serializedTraits: ObjectAny[] = []; |
|
|
const serializedTraits: ObjectAny[] = []; |
|
|
keys.forEach(key => { |
|
|
keys.forEach((key) => { |
|
|
const traitJSON = this.getTrait(key).toJSON(); |
|
|
const traitJSON = this.getTrait(key).toJSON(); |
|
|
const traitValue = dynamicTraitsObj[key]; |
|
|
const traitValue = dynamicTraitsObj[key]; |
|
|
serializedTraits.push({ |
|
|
serializedTraits.push({ |
|
|
...traitJSON, |
|
|
...traitJSON, |
|
|
name: key, |
|
|
name: key, |
|
|
value: traitValue |
|
|
value: traitValue, |
|
|
}) |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
if (serializedTraits.length > 0) { |
|
|
if (serializedTraits.length > 0) { |
|
|
obj[dynamicAttrKey] = serializedTraits; |
|
|
obj[dynamicAttrKey] = serializedTraits; |
|
|
|