Browse Source

Fix component properties

pull/6351/head
mohamedsalem401 2 years ago
parent
commit
31967718f7
  1. 8
      packages/core/src/dom_components/model/Component.ts

8
packages/core/src/dom_components/model/Component.ts

@ -351,7 +351,10 @@ export default class Component extends StyleableModel<ComponentProperties> {
: typeof attributeName === 'string' : typeof attributeName === 'string'
? { [attributeName as string]: value } ? { [attributeName as string]: value }
: {}; : {};
const evaluatedProps = ComponentDynamicValueListener.evaluateComponentDef(props, this.em); const areStaticAttributes = DynamicValueWatcher.areStaticValues(props);
const evaluatedProps = areStaticAttributes
? props
: ComponentDynamicValueListener.evaluateComponentDef(props, this.em);
this.componentDVListener?.watchProps(evaluatedProps); this.componentDVListener?.watchProps(evaluatedProps);
return super.set(evaluatedProps, options); return super.set(evaluatedProps, options);
@ -1561,8 +1564,9 @@ export default class Component extends StyleableModel<ComponentProperties> {
*/ */
toJSON(opts: ObjectAny = {}): ComponentDefinition { toJSON(opts: ObjectAny = {}): ComponentDefinition {
let obj = Model.prototype.toJSON.call(this, opts); let obj = Model.prototype.toJSON.call(this, opts);
obj.attributes = this.componentDVListener.getAttributesDefsOrValues(this.getAttributes()); obj.attributes = this.componentDVListener.getAttributesDefsOrValues(this.getAttributes({ noClass: true }));
obj = { ...obj, ...this.componentDVListener.getDynamicPropsDefs() }; obj = { ...obj, ...this.componentDVListener.getDynamicPropsDefs() };
delete obj.traits;
delete obj.attributes.class; delete obj.attributes.class;
delete obj.toolbar; delete obj.toolbar;
delete obj.status; delete obj.status;

Loading…
Cancel
Save