(function() {
/**
* @typedef {Help4.control2.bubble.footer.BubbleFooter.Params} Help4.control2.bubble.footer.Apply.Params
* @property {boolean} [disableApply = true] - flag to enable/disable send button
*/
/**
* Apply footer for bubbles.
* @augments Help4.control2.bubble.footer.BubbleFooter
* @property {boolean} disableApply - flag to enable/disable send button
* @property {?Help4.control2.button.Button} _close
* @property {?Help4.control2.button.Button} _apply
*/
Help4.control2.bubble.footer.Apply = class extends Help4.control2.bubble.footer.BubbleFooter {
/**
* @override
* @param {Help4.control2.bubble.footer.Apply.Params} [params]
*/
constructor(params) {
const {TYPES: T} = Help4.jscore.ControlBase;
super(params, {
params: {
disableApply: {init: true, type: T.boolean}
},
statics: {
_close: {},
_apply: {}
},
config: {
css: 'control-bubble-footer-apply'
}
});
}
/**
* @override
* @param {HTMLElement} dom - control DOM
*/
_onDomCreated(dom) {
super._onDomCreated(dom);
const {
Localization,
control2: {button: {Button, APPEARANCES: {exposed: appearance}}}
} = Help4;
const {id, disableApply} = this;
const applyText = Localization.getText('button.dialogapply');
const applyTitle = Localization.getText('button.dialogapply');
this._apply = this._createControl(Button, {
id: `${id}-apply`,
dom,
appearance,
text: applyText,
css: 'primary',
title: applyTitle,
disabled: disableApply,
ariaLabel: applyTitle
})
.addListener('click', event => {
event.type = 'apply';
this._fireEvent(event);
});
const closeText = Localization.getText('button.dialogclose');
const closeTitle = Localization.getText('button.dialogclose');
this._close = this._createControl(Button, {
id: `${id}-close`,
dom,
text: closeText,
css: 'tertiary',
title: closeTitle,
ariaLabel: closeTitle
})
.addListener('click', event => {
event.type = 'close';
this._fireEvent(event);
});
}
/**
* @override
* @param {Help4.jscore.ControlBase.PropertyChangeEvent} event - the change event
*/
_applyPropertyToDom({name, value, oldValue}) {
name === 'disableApply'
? this._apply.disabled = value
: super._applyPropertyToDom({name, value, oldValue});
}
}
})();