Browse Source

Move update property logic

up-style-manager
Artur Arseniev 4 years ago
parent
commit
40cb1663f7
  1. 40
      src/style_manager/index.js

40
src/style_manager/index.js

@ -566,28 +566,32 @@ export default () => {
sectors.map(sector => { sectors.map(sector => {
sector.getProperties().map(prop => { sector.getProperties().map(prop => {
const name = prop.getName(); this.__upProp(prop, style, parentStyles, opts);
const value = style[name];
const hasVal = propDef(value);
let newValue = hasVal ? value : null;
let parentTarget = null;
if (!hasVal) {
newValue = null;
const parentItem = parentStyles.filter(p => propDef(p.style[name]))[0];
if (parentItem) {
newValue = parentItem.style[name];
parentTarget = parentItem.target;
}
}
prop.__setParentTarget(parentTarget);
prop.__getFullValue() !== newValue && prop.upValue(newValue, { ...opts, __up: true });
}); });
}); });
}, },
__upProp(prop, style, parentStyles, opts) {
const name = prop.getName();
const value = style[name];
const hasVal = propDef(value);
let newValue = hasVal ? value : null;
let parentTarget = null;
if (!hasVal) {
newValue = null;
const parentItem = parentStyles.filter(p => propDef(p.style[name]))[0];
if (parentItem) {
newValue = parentItem.style[name];
parentTarget = parentItem.target;
}
}
prop.__setParentTarget(parentTarget);
prop.__getFullValue() !== newValue && prop.upValue(newValue, { ...opts, __up: true });
},
destroy() { destroy() {
[properties, sectors].forEach(coll => { [properties, sectors].forEach(coll => {
coll.reset(); coll.reset();

Loading…
Cancel
Save