Source: control2/Text.js

(function() {
    /**
     * @typedef {Help4.control2.Control.Params} Help4.control2.Text.Params
     * @property {string} text - the text to be displayed
     */

    /**
     * A control to display a text.
     * @augments Help4.control2.Control
     * @property {string} text - the text to be displayed
     */
    Help4.control2.Text = class extends Help4.control2.Control {
        /**
         * @override
         * @param {Help4.control2.Text.Params} [params]
         * @param {Help4.jscore.ControlBase.Params} [derived]
         */
        constructor(params, derived) {
            const {ControlBase} = Help4.jscore;
            const T = ControlBase.TYPES;
            const TT = ControlBase.TEXT_TYPES;

            super(params, {
                params: {
                    text: {type: T.string, mandatory: true}
                },
                config: {
                    css: 'control-text'
                },
                texts: {
                    text: TT.innerText
                },
                derived
            });
        }

        /**
         * @override
         * @param {Help4.jscore.ControlBase.PropertyChangeEvent} event - the change event
         */
        _applyPropertyToDom({name, value, oldValue}) {
            if (name === 'text') {
                const dom = this.getDom();
                Help4.Element.setText(dom, value);
                this._applyTextAttribute(dom, 'text', !!value);
            } else {
                super._applyPropertyToDom({name, value, oldValue});
            }
        }
    }
})();