mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
fixed a bug where no currently selected Item was set, when onChange has not been called yet
This commit is contained in:
parent
303ab4a9c9
commit
0057d92c9c
@ -4,7 +4,6 @@ import {find_select_options, SelectOption} from "../Et2Select/FindSelectOptions"
|
|||||||
import {Et2WidgetWithSelectMixin} from "../Et2Select/Et2WidgetWithSelectMixin";
|
import {Et2WidgetWithSelectMixin} from "../Et2Select/Et2WidgetWithSelectMixin";
|
||||||
import {css, html, LitElement, nothing, PropertyValues, TemplateResult} from "lit";
|
import {css, html, LitElement, nothing, PropertyValues, TemplateResult} from "lit";
|
||||||
import {repeat} from "lit/directives/repeat.js";
|
import {repeat} from "lit/directives/repeat.js";
|
||||||
import {query} from "lit/decorators/query.js";
|
|
||||||
import shoelace from "../Styles/shoelace";
|
import shoelace from "../Styles/shoelace";
|
||||||
import {property} from "lit/decorators/property.js";
|
import {property} from "lit/decorators/property.js";
|
||||||
import {state} from "lit/decorators/state.js";
|
import {state} from "lit/decorators/state.js";
|
||||||
@ -48,7 +47,14 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
|||||||
*/
|
*/
|
||||||
static RESULT_LIMIT: number = 100;
|
static RESULT_LIMIT: number = 100;
|
||||||
//does not work because it would need to be run on the shadow root
|
//does not work because it would need to be run on the shadow root
|
||||||
@query("sl-tree-item[selected]") selected: SlTreeItem;
|
//@query("sl-tree-item[selected]") selected: SlTreeItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the first selected node using attributes on the shadow root elements
|
||||||
|
*/
|
||||||
|
private get selected(){
|
||||||
|
return this.shadowRoot.querySelector("sl-tree-item[selected]")
|
||||||
|
}
|
||||||
@property({type: Boolean})
|
@property({type: Boolean})
|
||||||
multiple: Boolean = false;
|
multiple: Boolean = false;
|
||||||
@property({type: String})
|
@property({type: String})
|
||||||
@ -95,7 +101,6 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
|||||||
@state()
|
@state()
|
||||||
selectedNodes: SlTreeItem[]
|
selectedNodes: SlTreeItem[]
|
||||||
|
|
||||||
private input: any = null;
|
|
||||||
private _actionManager: EgwAction;
|
private _actionManager: EgwAction;
|
||||||
|
|
||||||
private get _tree() { return this.shadowRoot.querySelector('sl-tree') ?? null};
|
private get _tree() { return this.shadowRoot.querySelector('sl-tree') ?? null};
|
||||||
@ -118,8 +123,6 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
|||||||
}
|
}
|
||||||
firstUpdated()
|
firstUpdated()
|
||||||
{
|
{
|
||||||
// This is somehow required to set the autoload URL properly?
|
|
||||||
// TODO: Make this not needed, either this.autoload_url should be properly set or go away in favour of using this.autoload
|
|
||||||
if (this.autoloading)
|
if (this.autoloading)
|
||||||
{
|
{
|
||||||
// @ts-ignore from static get properties
|
// @ts-ignore from static get properties
|
||||||
@ -750,7 +753,10 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
|||||||
(event) => {
|
(event) => {
|
||||||
event.detail.id = event.target.id
|
event.detail.id = event.target.id
|
||||||
event.detail.item = event.target
|
event.detail.item = event.target
|
||||||
this.onopenstart(event.detail.id, this, 1)
|
if (this.onopenstart)
|
||||||
|
{
|
||||||
|
this.onopenstart(event.detail.id, this, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@sl-after-expand=${
|
@sl-after-expand=${
|
||||||
@ -758,7 +764,10 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
|||||||
event.detail.id = event.target.id
|
event.detail.id = event.target.id
|
||||||
event.detail.item = event.target
|
event.detail.item = event.target
|
||||||
|
|
||||||
this.onopenend(event.detail.id, this, -1)
|
if (this.onopenend)
|
||||||
|
{
|
||||||
|
this.onopenend(event.detail.id, this, -1)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2169,10 +2169,10 @@ app.classes.mail = AppJS.extend(
|
|||||||
*/
|
*/
|
||||||
mail_reduceCounterWithoutServerRoundtrip: function()
|
mail_reduceCounterWithoutServerRoundtrip: function()
|
||||||
{
|
{
|
||||||
var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
|
const ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
|
||||||
var _foldernode = ftree.getSelectedItem();
|
const _foldernode = ftree.getSelectedItem();
|
||||||
var counter = _foldernode.badge;
|
let counter = _foldernode.badge;
|
||||||
var icounter = 0;
|
let icounter = 0;
|
||||||
if (counter) icounter = parseInt(counter);
|
if (counter) icounter = parseInt(counter);
|
||||||
if (icounter>0)
|
if (icounter>0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user