jsdialog: add "linkbutton" as an independent widget

This depends on the core change, which separates the linkbutton
widget from fixedtext widget as it is already an independent widget
in "weld" and used in accessibility checker. Adds "clicked" event
that is triggered when the text is clicked and send to the core.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I4a999f3e57aaa7950482c55defa3012346351cb1
This commit is contained in:
Tomaž Vajngerl 2024-05-02 14:39:46 +09:00 committed by Szymon Kłos
parent eed0dadff3
commit cf0a6f4a2f
2 changed files with 58 additions and 0 deletions

View file

@ -398,6 +398,18 @@ td.jsdialog > [id^='table-box']:not(.sidebar) {
.ui-expander-content > .root-container.jsdialog {
margin: 4px;
}
/* Link Button*/
.ui-linkbutton {
color: var(--color-text-dark) !important;
}
.ui-linkbutton:hover {
cursor: pointer;
color: var(--color-text-lighter) !important;
}
/* TreeView */
.ui-treeview {

View file

@ -104,6 +104,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
this._controlHandlers['listbox'] = this._listboxControl;
this._controlHandlers['valueset'] = this._valuesetControl;
this._controlHandlers['fixedtext'] = this._fixedtextControl;
this._controlHandlers['linkbutton'] = this._linkButtonControl;
this._controlHandlers['htmlcontrol'] = this._htmlControl;
this._controlHandlers['expander'] = this._expanderHandler;
this._controlHandlers['grid'] = JSDialog.grid;
@ -1679,6 +1680,51 @@ L.Control.JSDialogBuilder = L.Control.extend({
return false;
},
_linkButtonControl: function(parentContainer, data, builder) {
var textContent = L.DomUtil.create('label', builder.options.cssClass + " ui-linkbutton", parentContainer);
if (data.labelFor)
textContent.htmlFor = data.labelFor + '-input';
if (data.text)
textContent.textContent = builder._cleanText(data.text);
else if (data.html)
textContent.innerHTML = data.html;
var accKey = builder._getAccessKeyFromText(data.text);
builder._stressAccessKey(textContent, accKey);
setTimeout(function () {
var labelledControl = document.getElementById(data.labelFor);
if (labelledControl) {
var target = labelledControl;
var input = labelledControl.querySelector('input');
if (input)
target = input;
var select = labelledControl.querySelector('select');
if (select)
target = select;
builder._setAccessKey(target, accKey);
}
}, 0);
textContent.id = data.id;
if (data.style && data.style.length) {
L.DomUtil.addClass(textContent, data.style);
} else {
L.DomUtil.addClass(textContent, 'ui-text');
}
if (data.hidden)
$(textContent).hide();
var clickFunction = function () {
builder.callback('linkbutton', 'click', data, null, builder);
};
$(textContent).click(clickFunction);
return false;
},
_setIconAndNameForCombobox: function(data) {
if (data.command == '.uno:CharFontName') {