[Common] Split button: set different hints to main button and caret button. Neet to set hint: ['Main hint', 'Caret hint']
This commit is contained in:
parent
1774b33b45
commit
8130efcafb
|
@ -296,14 +296,26 @@ define([
|
||||||
if (me.options.hint) {
|
if (me.options.hint) {
|
||||||
var modalParents = me.cmpEl.closest('.asc-window');
|
var modalParents = me.cmpEl.closest('.asc-window');
|
||||||
|
|
||||||
me.cmpEl.attr('data-toggle', 'tooltip');
|
if (typeof me.options.hint == 'object' && me.options.hint.length>1 && $('button', el).length>0) {
|
||||||
me.cmpEl.tooltip({
|
var btnEl = $('button', el);
|
||||||
title : me.options.hint,
|
me.btnEl = $(btnEl[0]);
|
||||||
|
me.btnMenuEl = $(btnEl[1]);
|
||||||
|
} else {
|
||||||
|
me.btnEl = me.cmpEl;
|
||||||
|
me.btnEl.attr('data-toggle', 'tooltip');
|
||||||
|
}
|
||||||
|
me.btnEl.tooltip({
|
||||||
|
title : (typeof me.options.hint == 'string') ? me.options.hint : me.options.hint[0],
|
||||||
|
placement : me.options.hintAnchor||'cursor'
|
||||||
|
});
|
||||||
|
me.btnMenuEl && me.btnMenuEl.tooltip({
|
||||||
|
title : me.options.hint[1],
|
||||||
placement : me.options.hintAnchor||'cursor'
|
placement : me.options.hintAnchor||'cursor'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (modalParents.length > 0) {
|
if (modalParents.length > 0) {
|
||||||
me.cmpEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
me.btnEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
||||||
|
me.btnMenuEl && me.btnMenuEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +327,7 @@ define([
|
||||||
if (!me.disabled && e.which == 1) {
|
if (!me.disabled && e.which == 1) {
|
||||||
me.doToggle();
|
me.doToggle();
|
||||||
if (me.options.hint) {
|
if (me.options.hint) {
|
||||||
var tip = me.cmpEl.data('bs.tooltip');
|
var tip = me.btnEl.data('bs.tooltip');
|
||||||
if (tip) {
|
if (tip) {
|
||||||
if (tip.dontShow===undefined)
|
if (tip.dontShow===undefined)
|
||||||
tip.dontShow = true;
|
tip.dontShow = true;
|
||||||
|
@ -364,7 +376,7 @@ define([
|
||||||
if (!me.disabled && e.which == 1) {
|
if (!me.disabled && e.which == 1) {
|
||||||
if (isSplit) {
|
if (isSplit) {
|
||||||
if (me.options.hint) {
|
if (me.options.hint) {
|
||||||
var tip = me.cmpEl.data('bs.tooltip');
|
var tip = (me.btnMenuEl ? me.btnMenuEl : me.btnEl).data('bs.tooltip');
|
||||||
if (tip) {
|
if (tip) {
|
||||||
if (tip.dontShow===undefined)
|
if (tip.dontShow===undefined)
|
||||||
tip.dontShow = true;
|
tip.dontShow = true;
|
||||||
|
@ -500,12 +512,19 @@ define([
|
||||||
isGroup && decorateBtn(el.children('button'));
|
isGroup && decorateBtn(el.children('button'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disabled || !Common.Utils.isGecko) {
|
if ((disabled || !Common.Utils.isGecko) && this.options.hint) {
|
||||||
var tip = this.cmpEl.data('bs.tooltip');
|
var tip = this.btnEl.data('bs.tooltip');
|
||||||
if (tip) {
|
if (tip) {
|
||||||
disabled && tip.hide();
|
disabled && tip.hide();
|
||||||
!Common.Utils.isGecko && (tip.enabled = !disabled);
|
!Common.Utils.isGecko && (tip.enabled = !disabled);
|
||||||
}
|
}
|
||||||
|
if (this.btnMenuEl) {
|
||||||
|
tip = this.btnMenuEl.data('bs.tooltip');
|
||||||
|
if (tip) {
|
||||||
|
disabled && tip.hide();
|
||||||
|
!Common.Utils.isGecko && (tip.enabled = !disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,24 +556,50 @@ define([
|
||||||
var cmpEl = this.cmpEl,
|
var cmpEl = this.cmpEl,
|
||||||
modalParents = cmpEl.closest('.asc-window');
|
modalParents = cmpEl.closest('.asc-window');
|
||||||
|
|
||||||
if (cmpEl.data('bs.tooltip'))
|
|
||||||
cmpEl.removeData('bs.tooltip');
|
if (!this.btnEl) {
|
||||||
cmpEl.attr('data-toggle', 'tooltip');
|
if (typeof this.options.hint == 'object' && this.options.hint.length>1 && $('button', cmpEl).length>0) {
|
||||||
cmpEl.tooltip({
|
var btnEl = $('button', cmpEl);
|
||||||
title : hint,
|
this.btnEl = $(btnEl[0]);
|
||||||
placement : this.options.hintAnchor || 'cursor'
|
this.btnMenuEl = $(btnEl[1]);
|
||||||
|
} else {
|
||||||
|
this.btnEl = cmpEl;
|
||||||
|
this.btnEl.attr('data-toggle', 'tooltip');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.btnEl.data('bs.tooltip'))
|
||||||
|
this.btnEl.removeData('bs.tooltip');
|
||||||
|
if (this.btnMenuEl && this.btnMenuEl.data('bs.tooltip'))
|
||||||
|
this.btnMenuEl.removeData('bs.tooltip');
|
||||||
|
|
||||||
|
this.btnEl.tooltip({
|
||||||
|
title : (typeof hint == 'string') ? hint : hint[0],
|
||||||
|
placement : this.options.hintAnchor||'cursor'
|
||||||
|
});
|
||||||
|
this.btnMenuEl && this.btnMenuEl.tooltip({
|
||||||
|
title : hint[1],
|
||||||
|
placement : this.options.hintAnchor||'cursor'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (modalParents.length > 0) {
|
if (modalParents.length > 0) {
|
||||||
cmpEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
this.btnEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
||||||
|
this.btnMenuEl && this.btnMenuEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.disabled || !Common.Utils.isGecko) {
|
if (this.disabled || !Common.Utils.isGecko) {
|
||||||
var tip = this.cmpEl.data('bs.tooltip');
|
var tip = this.btnEl.data('bs.tooltip');
|
||||||
if (tip) {
|
if (tip) {
|
||||||
this.disabled && tip.hide();
|
this.disabled && tip.hide();
|
||||||
!Common.Utils.isGecko && (tip.enabled = !this.disabled);
|
!Common.Utils.isGecko && (tip.enabled = !this.disabled);
|
||||||
}
|
}
|
||||||
|
if (this.btnMenuEl) {
|
||||||
|
tip = this.btnMenuEl.data('bs.tooltip');
|
||||||
|
if (tip) {
|
||||||
|
this.disabled && tip.hide();
|
||||||
|
!Common.Utils.isGecko && (tip.enabled = !this.disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue