From c0171aa8d82c298318d218bbda36515baf161b9a Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 15 May 2025 06:36:13 +0200 Subject: [PATCH] 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. --- src/component/FlexContainerComponent.js | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/component/FlexContainerComponent.js b/src/component/FlexContainerComponent.js index 0f46425..e86f707 100644 --- a/src/component/FlexContainerComponent.js +++ b/src/component/FlexContainerComponent.js @@ -130,6 +130,33 @@ class FlexContainerComponent extends Component { 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