mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Enable disabled select options
This commit is contained in:
parent
bf6891d06a
commit
f7d44c63cb
@ -580,7 +580,9 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
||||
return html`
|
||||
<sl-menu-item value="${option.value}"
|
||||
title="${!option.title || this.noLang ? option.title : this.egw().lang(option.title)}"
|
||||
class="${option.class}" .option=${option}>
|
||||
class="${option.class}" .option=${option}
|
||||
?disabled=${option.disabled}
|
||||
>
|
||||
${this._iconTemplate(option)}
|
||||
${this.noLang ? option.label : this.egw().lang(option.label)}
|
||||
</sl-menu-item>`;
|
||||
@ -623,7 +625,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
||||
{
|
||||
tag.size = this.size;
|
||||
}
|
||||
if(this.readonly)
|
||||
if(this.readonly || item.option && typeof (item.option.disabled) != "undefined" && item.option.disabled)
|
||||
{
|
||||
tag.removable = false;
|
||||
tag.readonly = true;
|
||||
|
@ -8,6 +8,9 @@ export interface SelectOption
|
||||
icon? : string;
|
||||
// Class applied to node
|
||||
class? : string;
|
||||
// Show the option, but it is not selectable.
|
||||
// If multiple=true and the option is in the value, it is not removable.
|
||||
disabled? : boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1080,7 +1080,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
||||
// Reset remaining options. It might be faster to re-create instead.
|
||||
this._menuItems.forEach((item) =>
|
||||
{
|
||||
item.disabled = false;
|
||||
item.disabled = item.option?.disabled || false;
|
||||
item.classList.remove("match");
|
||||
item.classList.remove("no-match");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user