mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-29 10:09:10 +01:00
Implement parent_node attribute
Fixes calendar sidebox was not shown
This commit is contained in:
parent
7b11a25b8d
commit
d15d7a3426
@ -47,6 +47,13 @@ const Et2WidgetMixin = (superClass) =>
|
||||
private _inst : etemplate2 | null = null;
|
||||
private supportedWidgetClasses = [];
|
||||
|
||||
/**
|
||||
* If we put the widget somewhere other than as a child of its parent, we need to record that so
|
||||
* we don't move it back to the parent.
|
||||
* @type {Element}
|
||||
* @protected
|
||||
*/
|
||||
protected _parent_node : Element;
|
||||
/**
|
||||
* Not actually required by et2_widget, but needed to keep track of non-webComponent children
|
||||
*/
|
||||
@ -101,6 +108,12 @@ const Et2WidgetMixin = (superClass) =>
|
||||
reflect: true
|
||||
},
|
||||
|
||||
/**
|
||||
* Widget ID of another node to insert this node into instead of the normal location
|
||||
* This isn't a normal property...
|
||||
*/
|
||||
parent_node: {type: String},
|
||||
|
||||
/**
|
||||
* Tooltip which is shown for this element on hover
|
||||
*/
|
||||
@ -616,7 +629,7 @@ const Et2WidgetMixin = (superClass) =>
|
||||
* rest themselves with their normal lifecycle (especially connectedCallback(), which is kind
|
||||
* of the equivalent of doLoadingFinished()
|
||||
*/
|
||||
if(this.getParent() instanceof et2_widget && (<et2_DOMWidget>this.getParent()).getDOMNode(this) != this.parentNode)
|
||||
if(!this._parent_node && this.getParent() instanceof et2_widget && (<et2_DOMWidget>this.getParent()).getDOMNode(this) != this.parentNode)
|
||||
{
|
||||
this.getParent().getDOMNode(this).append(this);
|
||||
}
|
||||
@ -678,6 +691,25 @@ const Et2WidgetMixin = (superClass) =>
|
||||
return check_children(this.getChildren()) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent is different than what is specified in the template / hierarchy.
|
||||
* Find it and re-parent there.
|
||||
*
|
||||
* @param {string} parent
|
||||
*/
|
||||
set parent_node(parent : string | Element)
|
||||
{
|
||||
if(typeof parent === "string")
|
||||
{
|
||||
parent = document.querySelector("#" + parent);
|
||||
}
|
||||
if(parent)
|
||||
{
|
||||
parent.append(this);
|
||||
this._parent_node = parent;
|
||||
}
|
||||
}
|
||||
|
||||
setParent(new_parent : Et2WidgetClass | et2_widget)
|
||||
{
|
||||
this._parent = new_parent;
|
||||
|
Loading…
Reference in New Issue
Block a user