Browse Source

Update clear for detached properties

up-style-manager
Artur Arseniev 5 years ago
parent
commit
1949aa1801
  1. 11
      src/style_manager/model/PropertyComposite.js

11
src/style_manager/model/PropertyComposite.js

@ -55,11 +55,12 @@ export default Property.extend({
} }
}, },
__upTargetsStyle(style, opts) { __upTargetsStyle(style, opts = {}) {
const toStyle = this.get('toStyle'); const toStyle = this.get('toStyle');
const { __clear } = opts;
let newStyle = style; let newStyle = style;
if (toStyle && !opts.__clear) { if (toStyle && !__clear) {
const values = this.getValues(); const values = this.getValues();
newStyle = toStyle(values, { ...opts, style }); newStyle = toStyle(values, { ...opts, style });
} }
@ -121,10 +122,14 @@ export default Property.extend({
}, },
clear() { clear() {
this.getProperties().map(p => p.clear({ __clearIn: true })); this.getProperties().map(p => p.clear({ __clearIn: !this.isDetached() }));
return Property.prototype.clear.call(this); return Property.prototype.clear.call(this);
}, },
hasValue(opts) {
return this.getProperties().some(prop => prop.hasValue(opts));
},
/** /**
* Get current values of properties * Get current values of properties
* @param {Object} [opts={}] Options * @param {Object} [opts={}] Options

Loading…
Cancel
Save