mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:49:10 +01:00
Merge feature/improve_nm_performance changes in
This commit is contained in:
parent
458a40c792
commit
b8c6d52d29
@ -380,10 +380,12 @@ var et2_dataview = /** @class */ (function () {
|
||||
*/
|
||||
et2_dataview.prototype._buildGrid = function () {
|
||||
// Create the collection of column ids
|
||||
var colIds = new Array(this.columns.length);
|
||||
var colIds = [];
|
||||
for (var i = 0; i < this.columns.length; i++) {
|
||||
colIds[i] = this.columns[i].id;
|
||||
}
|
||||
if (this.columns[i].visible) {
|
||||
colIds[i] = this.columns[i].id;
|
||||
}
|
||||
}
|
||||
// Create the row provider
|
||||
if (this.rowProvider) {
|
||||
this.rowProvider.destroy();
|
||||
|
@ -534,14 +534,17 @@ export class et2_dataview
|
||||
private _buildGrid()
|
||||
{
|
||||
// Create the collection of column ids
|
||||
var colIds = new Array(this.columns.length);
|
||||
var colIds = [];
|
||||
for (var i = 0; i < this.columns.length; i++)
|
||||
{
|
||||
colIds[i] = this.columns[i].id;
|
||||
if(this.columns[i].visible)
|
||||
{
|
||||
colIds[i] = this.columns[i].id;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the row provider
|
||||
if (this.rowProvider)
|
||||
if(this.rowProvider)
|
||||
{
|
||||
this.rowProvider.destroy();
|
||||
}
|
||||
|
@ -85,19 +85,22 @@ var et2_dataview_rowProvider = /** @class */ (function () {
|
||||
this._prototypes["fullRow"] = tr;
|
||||
};
|
||||
et2_dataview_rowProvider.prototype._createDefaultPrototype = function () {
|
||||
var tr = jQuery(document.createElement("tr"));
|
||||
// Append a td for each column
|
||||
for (var i = 0; i < this._columnIds.length; i++) {
|
||||
var td = jQuery(document.createElement("td"))
|
||||
.addClass(this._outerId + "_td_" + this._columnIds[i])
|
||||
.appendTo(tr);
|
||||
var div = jQuery(document.createElement("div"))
|
||||
.addClass(this._outerId + "_div_" + this._columnIds[i])
|
||||
.addClass("innerContainer")
|
||||
.appendTo(td);
|
||||
}
|
||||
this._prototypes["default"] = tr;
|
||||
};
|
||||
var tr = jQuery(document.createElement("tr"));
|
||||
// Append a td for each column
|
||||
for (var _i = 0, _a = this._columnIds; _i < _a.length; _i++) {
|
||||
var column = _a[_i];
|
||||
if (!column)
|
||||
continue;
|
||||
var td = jQuery(document.createElement("td"))
|
||||
.addClass(this._outerId + "_td_" + column)
|
||||
.appendTo(tr);
|
||||
var div = jQuery(document.createElement("div"))
|
||||
.addClass(this._outerId + "_div_" + column)
|
||||
.addClass("innerContainer")
|
||||
.appendTo(td);
|
||||
}
|
||||
this._prototypes["default"] = tr;
|
||||
};
|
||||
et2_dataview_rowProvider.prototype._createEmptyPrototype = function () {
|
||||
this._prototypes["empty"] = jQuery(document.createElement("tr"));
|
||||
};
|
||||
|
@ -117,13 +117,15 @@ export class et2_dataview_rowProvider
|
||||
var tr = jQuery(document.createElement("tr"));
|
||||
|
||||
// Append a td for each column
|
||||
for (var i = 0; i < this._columnIds.length; i++)
|
||||
for (var column of this._columnIds)
|
||||
{
|
||||
if(!column) continue;
|
||||
|
||||
var td = jQuery(document.createElement("td"))
|
||||
.addClass(this._outerId + "_td_" + this._columnIds[i])
|
||||
.addClass(this._outerId + "_td_" + column)
|
||||
.appendTo(tr);
|
||||
var div = jQuery(document.createElement("div"))
|
||||
.addClass(this._outerId + "_div_" + this._columnIds[i])
|
||||
.addClass(this._outerId + "_div_" + column)
|
||||
.addClass("innerContainer")
|
||||
.appendTo(td);
|
||||
}
|
||||
|
@ -949,21 +949,23 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
}
|
||||
};
|
||||
et2_nextmatch.prototype._parseDataRow = function (_row, _rowData, _colData) {
|
||||
var columnWidgets = new Array(this.columns.length);
|
||||
_row.sort(function (a, b) {
|
||||
return a.colData.order - b.colData.order;
|
||||
});
|
||||
for (var x = 0; x < columnWidgets.length; x++) {
|
||||
if (typeof _row[x] != "undefined" && _row[x].widget) {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
// Append the widget to this container
|
||||
this.addChild(_row[x].widget);
|
||||
}
|
||||
else {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
}
|
||||
// Pass along column alignment
|
||||
if (_row[x].align && columnWidgets[x]) {
|
||||
var columnWidgets = [];
|
||||
_row.sort(function (a, b) {
|
||||
return a.colData.order - b.colData.order;
|
||||
});
|
||||
for (var x = 0; x < this.columns.length; x++) {
|
||||
if (!this.columns[x].visible) {
|
||||
continue;
|
||||
}
|
||||
if (typeof _row[x] != "undefined" && _row[x].widget) {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
// Append the widget to this container
|
||||
this.addChild(_row[x].widget);
|
||||
} else {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
}
|
||||
// Pass along column alignment
|
||||
if (_row[x].align && columnWidgets[x]) {
|
||||
columnWidgets[x].align = _row[x].align;
|
||||
}
|
||||
}
|
||||
|
@ -196,10 +196,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
// Popup to select columns
|
||||
private selectPopup: any;
|
||||
|
||||
public static legacyOptions = ["template","hide_header","header_left","header_right"];
|
||||
public static legacyOptions = ["template", "hide_header", "header_left", "header_right"];
|
||||
|
||||
private template: any;
|
||||
columns: {widget: et2_widget}[];
|
||||
columns: { visible: boolean, widget: et2_widget }[];
|
||||
private sortedColumnsList: string[];
|
||||
|
||||
// If we need the nextmatch to have a value, keep it here.
|
||||
@ -1322,15 +1322,20 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
|
||||
_parseDataRow( _row, _rowData, _colData)
|
||||
{
|
||||
const columnWidgets = new Array(this.columns.length);
|
||||
const columnWidgets = [];
|
||||
|
||||
_row.sort(function(a,b) {
|
||||
return a.colData.order - b.colData.order;
|
||||
});
|
||||
_row.sort(function (a, b)
|
||||
{
|
||||
return a.colData.order - b.colData.order;
|
||||
});
|
||||
|
||||
for (let x = 0; x < columnWidgets.length; x++)
|
||||
for (let x = 0; x < this.columns.length; x++)
|
||||
{
|
||||
if (typeof _row[x] != "undefined" && _row[x].widget)
|
||||
if(!this.columns[x].visible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(typeof _row[x] != "undefined" && _row[x].widget)
|
||||
{
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
|
||||
|
@ -219,35 +219,44 @@ var et2_nextmatch_rowProvider = /** @class */ (function () {
|
||||
*/
|
||||
et2_nextmatch_rowProvider.prototype._getVariableAttributeSet = function (_widget) {
|
||||
var variableAttributes = [];
|
||||
_widget.iterateOver(function (_widget) {
|
||||
// Create the attribtues
|
||||
var hasAttr = false;
|
||||
var widgetData = {
|
||||
"widget": _widget,
|
||||
"data": []
|
||||
};
|
||||
// Get all attribute values
|
||||
for (var key in _widget.attributes) {
|
||||
if (!_widget.attributes[key].ignore &&
|
||||
typeof _widget.options[key] != "undefined") {
|
||||
var process = function (_widget) {
|
||||
// Create the attribtues
|
||||
var hasAttr = false;
|
||||
var widgetData = {
|
||||
"widget": _widget,
|
||||
"data": []
|
||||
};
|
||||
// Get all attribute values
|
||||
for (var key in _widget.attributes) {
|
||||
if (!_widget.attributes[key].ignore &&
|
||||
typeof _widget.options[key] != "undefined") {
|
||||
var val = _widget.options[key];
|
||||
// TODO: Improve detection
|
||||
if (typeof val == "string" && val.indexOf("$") >= 0) {
|
||||
hasAttr = true;
|
||||
widgetData.data.push({
|
||||
"attribute": key,
|
||||
"expression": val
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add the entry if there is any data in it
|
||||
if (hasAttr) {
|
||||
variableAttributes.push(widgetData);
|
||||
}
|
||||
}, this);
|
||||
return variableAttributes;
|
||||
};
|
||||
"attribute": key,
|
||||
"expression": val
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add the entry if there is any data in it
|
||||
if (hasAttr) {
|
||||
variableAttributes.push(widgetData);
|
||||
}
|
||||
};
|
||||
// Check each column
|
||||
var columns = _widget.getChildren();
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
// If column is hidden, don't process it
|
||||
if (this._context && this._context.columns && this._context.columns[i] && !this._context.columns[i].visible) {
|
||||
continue;
|
||||
}
|
||||
columns[i].iterateOver(process, this);
|
||||
}
|
||||
return variableAttributes;
|
||||
};
|
||||
et2_nextmatch_rowProvider.prototype._seperateWidgets = function (_varAttrs) {
|
||||
// The detachable array contains all widgets which implement the
|
||||
// et2_IDetachedDOM interface for all needed attributes
|
||||
@ -467,18 +476,20 @@ var et2_nextmatch_rowWidget = /** @class */ (function (_super) {
|
||||
* @param {array} _widgets
|
||||
*/
|
||||
et2_nextmatch_rowWidget.prototype.createWidgets = function (_widgets) {
|
||||
// Clone the given the widgets with this element as parent
|
||||
this._widgets = new Array(_widgets.length);
|
||||
for (var i = 0; i < _widgets.length; i++) {
|
||||
// Disabled columns might be missing widget - skip it
|
||||
if (!_widgets[i])
|
||||
continue;
|
||||
this._widgets[i] = _widgets[i].clone(this);
|
||||
this._widgets[i].loadingFinished();
|
||||
// Set column alignment from widget
|
||||
if (this._widgets[i].align) {
|
||||
this._row.childNodes[i].align = this._widgets[i].align;
|
||||
}
|
||||
// Clone the given the widgets with this element as parent
|
||||
this._widgets = [];
|
||||
var row_id = 0;
|
||||
for (var i = 0; i < _widgets.length; i++) {
|
||||
// Disabled columns might be missing widget - skip it
|
||||
if (!_widgets[i])
|
||||
continue;
|
||||
this._widgets[i] = _widgets[i].clone(this);
|
||||
this._widgets[i].loadingFinished();
|
||||
// Set column alignment from widget
|
||||
if (this._widgets[i].align) {
|
||||
this._row.childNodes[row_id].align = this._widgets[i].align;
|
||||
}
|
||||
row_id++;
|
||||
}
|
||||
};
|
||||
/**
|
||||
@ -488,11 +499,16 @@ var et2_nextmatch_rowWidget = /** @class */ (function (_super) {
|
||||
* @return {DOMElement}
|
||||
*/
|
||||
et2_nextmatch_rowWidget.prototype.getDOMNode = function (_sender) {
|
||||
var row_id = 0;
|
||||
for (var i = 0; i < this._widgets.length; i++) {
|
||||
if (this._widgets[i] == _sender) {
|
||||
return this._row.childNodes[i].childNodes[0]; // Return the i-th td tag
|
||||
}
|
||||
}
|
||||
// Disabled columns might be missing widget - skip it
|
||||
if (!this._widgets[i])
|
||||
continue;
|
||||
if (this._widgets[i] == _sender) {
|
||||
return this._row.childNodes[row_id].childNodes[0]; // Return the i-th td tag
|
||||
}
|
||||
row_id++;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
return et2_nextmatch_rowWidget;
|
||||
|
@ -258,9 +258,10 @@ export class et2_nextmatch_rowProvider
|
||||
*/
|
||||
_getVariableAttributeSet( _widget)
|
||||
{
|
||||
var variableAttributes = [];
|
||||
let variableAttributes = [];
|
||||
|
||||
_widget.iterateOver(function(_widget) {
|
||||
const process = function (_widget)
|
||||
{
|
||||
// Create the attribtues
|
||||
var hasAttr = false;
|
||||
var widgetData = {
|
||||
@ -269,32 +270,43 @@ export class et2_nextmatch_rowProvider
|
||||
};
|
||||
|
||||
// Get all attribute values
|
||||
for (var key in _widget.attributes)
|
||||
for (const key in _widget.attributes)
|
||||
{
|
||||
if (!_widget.attributes[key].ignore &&
|
||||
typeof _widget.options[key] != "undefined")
|
||||
if(!_widget.attributes[key].ignore &&
|
||||
typeof _widget.options[key] != "undefined")
|
||||
{
|
||||
var val = _widget.options[key];
|
||||
const val = _widget.options[key];
|
||||
|
||||
// TODO: Improve detection
|
||||
if (typeof val == "string" && val.indexOf("$") >= 0)
|
||||
if(typeof val == "string" && val.indexOf("$") >= 0)
|
||||
{
|
||||
hasAttr = true;
|
||||
widgetData.data.push({
|
||||
"attribute": key,
|
||||
"expression": val
|
||||
});
|
||||
"attribute": key,
|
||||
"expression": val
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the entry if there is any data in it
|
||||
if (hasAttr)
|
||||
if(hasAttr)
|
||||
{
|
||||
variableAttributes.push(widgetData);
|
||||
}
|
||||
};
|
||||
|
||||
}, this);
|
||||
// Check each column
|
||||
const columns = _widget.getChildren();
|
||||
for (var i = 0; i < columns.length; i++)
|
||||
{
|
||||
// If column is hidden, don't process it
|
||||
if(this._context && this._context.columns && this._context.columns[i] && !this._context.columns[i].visible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
columns[i].iterateOver(process, this);
|
||||
}
|
||||
|
||||
return variableAttributes;
|
||||
}
|
||||
@ -603,7 +615,8 @@ class et2_nextmatch_rowWidget extends et2_widget implements et2_IDOMNode
|
||||
createWidgets( _widgets)
|
||||
{
|
||||
// Clone the given the widgets with this element as parent
|
||||
this._widgets = new Array(_widgets.length);
|
||||
this._widgets = [];
|
||||
let row_id = 0;
|
||||
for (var i = 0; i < _widgets.length; i++)
|
||||
{
|
||||
// Disabled columns might be missing widget - skip it
|
||||
@ -614,8 +627,9 @@ class et2_nextmatch_rowWidget extends et2_widget implements et2_IDOMNode
|
||||
// Set column alignment from widget
|
||||
if(this._widgets[i].align)
|
||||
{
|
||||
this._row.childNodes[i].align = this._widgets[i].align;
|
||||
this._row.childNodes[row_id].align = this._widgets[i].align;
|
||||
}
|
||||
row_id++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -627,12 +641,16 @@ class et2_nextmatch_rowWidget extends et2_widget implements et2_IDOMNode
|
||||
*/
|
||||
getDOMNode( _sender)
|
||||
{
|
||||
var row_id = 0;
|
||||
for (var i = 0; i < this._widgets.length; i++)
|
||||
{
|
||||
if (this._widgets[i] == _sender)
|
||||
// Disabled columns might be missing widget - skip it
|
||||
if(!this._widgets[i]) continue;
|
||||
if(this._widgets[i] == _sender)
|
||||
{
|
||||
return this._row.childNodes[i].childNodes[0]; // Return the i-th td tag
|
||||
return this._row.childNodes[row_id].childNodes[0]; // Return the i-th td tag
|
||||
}
|
||||
row_id++;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user