import { DynamicItemExtensionBase } from '@anglr/dynamic';
import { isPresent } from '@jscrpt/common';
/**
 * Child extension that applies flex styling to child
 */
export class StackPanelFlexExtension extends DynamicItemExtensionBase {
    //######################### public methods - overrides #########################
    /**
     * @inheritdoc
     */
    onInit() {
        this._applyStyling();
    }
    /**
     * @inheritdoc
     */
    onOptionsChange() {
        this._applyStyling();
    }
    //######################### protected methods #########################
    /**
     * Applies flex styling to element
     */
    _applyStyling() {
        const options = this.options;
        if (isPresent(options?.flex)) {
            const style = this.element?.nativeElement.style;
            if (style && this.options) {
                style.flex = this.options.flex ?? '';
            }
        }
    }
}
//# sourceMappingURL=stackPanelFlex.extension.js.map