Browse Source

IMPRO,FEAT: added modifyChildren

enables passing a modifier to all children of a flex container.
Similar to distributeSpacingEvengly.
might be refactored into component in general.
master
chris 1 month ago
parent
commit
c0171aa8d8
  1. 27
      src/component/FlexContainerComponent.js

27
src/component/FlexContainerComponent.js

@ -130,6 +130,33 @@ class FlexContainerComponent extends Component {
return this; return this;
} }
/**
* Adds, sets, updates or overwrites the Modification of/for the children of this component.
* Just calls .modifier(modifier) on each child.
*
* @param {Modifier} modifier
* @param {boolean|ExtStorage|ExtStoreType|OverwriteBehaviour} [extStore=null]
* @returns {FlexContainerComponent} this component object
*/
modifyChildren(modifier, underTheName = "", extStore = false) {
if (underTheName === "") {
underTheName = `.${this._compName}-style-children`;
}
if (!extStore) {
for (const child of this._children) {
child.modifier(modifier)
}
} else {
this.addStyleClass(underTheName);
this._styles.push(
new SStoreDefinition(
underTheName,
modifier.ensureModifier()
)
);
}
return this;
}
/** /**
* @override * @override

Loading…
Cancel
Save