mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-10 16:08:34 +01:00
Getter/Setter shenanigans to
- get widget's DOM ID to have the instance template as prefix - keep widget.id as what's in the template, matching legacy - widget.dom_id gives the DOM ID, matching legacy
This commit is contained in:
parent
d9fe73f979
commit
decd64e7c3
@ -61,6 +61,8 @@ const Et2WidgetMixin = (superClass) =>
|
||||
/**
|
||||
* Properties - default values, and actually creating them as fields
|
||||
*/
|
||||
protected _widget_id : string = "";
|
||||
protected _dom_id : string = "";
|
||||
protected _label : string = "";
|
||||
private statustext : string = "";
|
||||
protected disabled : Boolean = false;
|
||||
@ -196,6 +198,42 @@ const Et2WidgetMixin = (superClass) =>
|
||||
this.disabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual DOM ID, which has been prefixed to make sure it's unique.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
get dom_id()
|
||||
{
|
||||
return this.getAttribute("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ID of the widget
|
||||
*
|
||||
* This is the "widget" ID, which is used as an index into the managed arrays (content, etc) and when
|
||||
* trying to find widgets by ID.
|
||||
*
|
||||
* This is not the DOM ID.
|
||||
*
|
||||
* @param {string} value
|
||||
*/
|
||||
set id(value)
|
||||
{
|
||||
this._widget_id = value;
|
||||
this.setAttribute("id", this._widget_id ? this.getInstanceManager().uniqueId + '_' + this._widget_id.replace(/\./g, '-') : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of the widget
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
get id()
|
||||
{
|
||||
return this._widget_id;
|
||||
}
|
||||
|
||||
set label(value : string)
|
||||
{
|
||||
let oldValue = this.label;
|
||||
@ -658,7 +696,7 @@ const Et2WidgetMixin = (superClass) =>
|
||||
|
||||
getDOMNode() : HTMLElement
|
||||
{
|
||||
return this;
|
||||
return <HTMLElement><unknown>this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user