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() {
        var _a, _b;
        const options = this.options;
        if (isPresent(options === null || options === void 0 ? void 0 : options.flex)) {
            const style = (_a = this.element) === null || _a === void 0 ? void 0 : _a.nativeElement.style;
            if (style && this.options) {
                style.flex = (_b = this.options.flex) !== null && _b !== void 0 ? _b : '';
            }
        }
    }
}
//# sourceMappingURL=stackPanelFlex.extension.js.map