mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
re-add lost label getter and setter to fix not shown labels in buttons
This commit is contained in:
parent
b2d9e30b8d
commit
263f2c867f
@ -114,7 +114,6 @@ export const ButtonMixin = <T extends Constructor>(superclass : T) => class exte
|
||||
{
|
||||
return {
|
||||
...super.properties,
|
||||
label: {type: String},
|
||||
image: {type: String},
|
||||
|
||||
/**
|
||||
@ -152,6 +151,45 @@ export const ButtonMixin = <T extends Constructor>(superclass : T) => class exte
|
||||
|
||||
}
|
||||
|
||||
protected firstUpdated(_changedProperties : PropertyValues)
|
||||
{
|
||||
super.firstUpdated(_changedProperties);
|
||||
|
||||
if(!this.label && this.__image)
|
||||
{
|
||||
/*
|
||||
Label / no label should get special classes set, but they're missing without this extra requestUpdate()
|
||||
This is a work-around for button--has-prefix & button--has-label not being set, something to do
|
||||
with how we're setting them.
|
||||
*/
|
||||
this.updateComplete.then(() =>
|
||||
{
|
||||
this.requestUpdate();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
set label(new_label : string)
|
||||
{
|
||||
this.updateComplete.then(() =>
|
||||
{
|
||||
if(!this._labelNode)
|
||||
{
|
||||
const textNode = document.createTextNode(new_label);
|
||||
this.appendChild(textNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._labelNode.textContent = new_label;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get label()
|
||||
{
|
||||
return this._labelNode?.textContent?.trim();
|
||||
}
|
||||
|
||||
set image(new_image : string)
|
||||
{
|
||||
let oldValue = this.__image;
|
||||
@ -354,4 +392,4 @@ export const ButtonMixin = <T extends Constructor>(superclass : T) => class exte
|
||||
// array.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user