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