mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 12:51:52 +02:00
fix opened folders
fix for #91431 --2. one level too much is opened in mail, see screenshot
This commit is contained in:
parent
288c0c39e9
commit
2ddfb6a596
@ -77,7 +77,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
imagePath: String = egw().webserverUrl + "/api/templates/default/images/dhtmlxtree/" //TODO we will need a different path here! maybe just rename the path?
|
||||
// description: "Directory for tree structure images, set on server-side to 'dhtmlx' subdir of templates image-directory"
|
||||
@property()
|
||||
value ={}
|
||||
value = {}
|
||||
|
||||
protected autoloading_url: any;
|
||||
// private selectOptions: TreeItemData[] = [];
|
||||
@ -100,7 +100,8 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
}
|
||||
|
||||
//Sl-Trees handle their own onClick events
|
||||
_handleClick(_ev) {
|
||||
_handleClick(_ev)
|
||||
{
|
||||
}
|
||||
|
||||
static get styles()
|
||||
@ -120,7 +121,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
}
|
||||
`,
|
||||
css`
|
||||
::part(label):hover{
|
||||
::part(label):hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
`
|
||||
@ -308,6 +309,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
this.onopenstart = _handler
|
||||
this.installHandler("onopenstart", _handler)
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated assign to onopenend
|
||||
* @param _handler
|
||||
@ -338,7 +340,6 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
}
|
||||
|
||||
|
||||
|
||||
public getSelectedItem(): TreeItemData
|
||||
{
|
||||
return this._currentOption
|
||||
@ -348,9 +349,9 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
* getValue, retrieves the Id of the selected Item
|
||||
* @return string or object or null
|
||||
*/
|
||||
getValue():string|string[]
|
||||
getValue(): string | string[]
|
||||
{
|
||||
return this._currentOption?this._currentOption.id:null
|
||||
return this._currentOption ? this._currentOption.id : null
|
||||
}
|
||||
|
||||
/**
|
||||
@ -461,13 +462,17 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
|
||||
/**
|
||||
* Does nothing
|
||||
* @deprecated setting styles on individual items is no longer supported
|
||||
* @param _id
|
||||
* @param _style
|
||||
*/
|
||||
setStyle(_id, _style)
|
||||
{
|
||||
//setting a style on an iduvidual item is not planned to be used with sl_tree
|
||||
var temp = this.getDomNode(_id);
|
||||
if (!temp) return 0;
|
||||
if (!temp.style.cssText)
|
||||
temp.setAttribute("style", _style);
|
||||
else
|
||||
temp.style.cssText = temp.style.cssText + ";" + _style;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -493,11 +498,16 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
|
||||
// Update action
|
||||
// since the action ID has to = this.id, getObjectById() won't work
|
||||
let treeObj:EgwActionObject = egw_getAppObjectManager(false).getObjectById(this.id);
|
||||
for (const actionObject of treeObj.children) {
|
||||
if(actionObject.id == _id){
|
||||
let treeObj: EgwActionObject = egw_getAppObjectManager(false).getObjectById(this.id);
|
||||
for (const actionObject of treeObj.children)
|
||||
{
|
||||
if (actionObject.id == _id)
|
||||
{
|
||||
actionObject.id = _newItemId;
|
||||
if (actionObject.iface){actionObject.iface.id = _newItemId}
|
||||
if (actionObject.iface)
|
||||
{
|
||||
actionObject.iface.id = _newItemId
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@ -564,7 +574,6 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
}
|
||||
|
||||
|
||||
|
||||
return html`
|
||||
<sl-tree-item
|
||||
id=${selectOption.id}
|
||||
@ -721,18 +730,23 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
return action_links;
|
||||
}
|
||||
|
||||
protected updated(_changedProperties: PropertyValues) {
|
||||
protected updated(_changedProperties: PropertyValues)
|
||||
{
|
||||
this._link_actions(this.actions)
|
||||
super.updated(_changedProperties);
|
||||
}
|
||||
|
||||
private _search(_id: string, data: TreeItemData[]): TreeItemData {
|
||||
private _search(_id: string, data: TreeItemData[]): TreeItemData
|
||||
{
|
||||
let res: TreeItemData = null
|
||||
for (const value of data) {
|
||||
if (value.id === _id) {
|
||||
for (const value of data)
|
||||
{
|
||||
if (value.id === _id)
|
||||
{
|
||||
res = value
|
||||
return res
|
||||
} else if (_id.startsWith(value.id)) {
|
||||
} else if (_id.startsWith(value.id))
|
||||
{
|
||||
res = this._search(_id, value.item)
|
||||
}
|
||||
}
|
||||
@ -740,16 +754,23 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
}
|
||||
|
||||
private calculateExpandState = (selectOption: TreeItemData) => {
|
||||
if (selectOption.id.includes("INBOX") || selectOption.id == window.egw.preference("ActiveProfileID", "mail")) {
|
||||
if (selectOption.id.endsWith("INBOX") || selectOption.id == window.egw.preference("ActiveProfileID", "mail"))
|
||||
{
|
||||
return true
|
||||
}
|
||||
if (selectOption.open) {
|
||||
if (selectOption.open)
|
||||
{
|
||||
return true
|
||||
}
|
||||
if ((this._selectOptions.find((selectOption) => {
|
||||
if (
|
||||
this._selectOptions[0] == selectOption &&
|
||||
(this._selectOptions.find((selectOption) => {
|
||||
return selectOption.open
|
||||
}) == undefined) && this._selectOptions[0] == selectOption) {
|
||||
return true
|
||||
}) == undefined
|
||||
)
|
||||
)
|
||||
{
|
||||
return true //open the first item, if no item is opened
|
||||
}
|
||||
|
||||
return false
|
||||
@ -816,7 +837,8 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
|
||||
}
|
||||
|
||||
customElements.define("et2-tree", Et2Tree);
|
||||
customElements.define("et2-tree-cat", class extends Et2Tree {
|
||||
customElements.define("et2-tree-cat", class extends Et2Tree
|
||||
{
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user