Code style improvements

This commit is contained in:
nathangray 2020-02-11 11:32:50 -07:00
parent 3f282c5416
commit 8eebea528d
3 changed files with 449 additions and 452 deletions

View File

@ -148,7 +148,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
* Destroys all * Destroys all
*/ */
et2_nextmatch.prototype.destroy = function () { et2_nextmatch.prototype.destroy = function () {
// Stop autorefresh // Stop auto-refresh
if (this._autorefresh_timer) { if (this._autorefresh_timer) {
window.clearInterval(this._autorefresh_timer); window.clearInterval(this._autorefresh_timer);
this._autorefresh_timer = null; this._autorefresh_timer = null;
@ -205,13 +205,13 @@ var et2_nextmatch = /** @class */ (function (_super) {
var appname = split[0]; var appname = split[0];
// Check link registry // Check link registry
if (this.egw().link_get_registry(appname)) { if (this.egw().link_get_registry(appname)) {
var self = this; var self_1 = this;
// Register a handler // Register a handler
// @ts-ignore // @ts-ignore
jQuery(this.div) jQuery(this.div)
.on('dragenter', '.egwGridView_grid tr', function (e) { .on('dragenter', '.egwGridView_grid tr', function (e) {
// Figure out _which_ row // Figure out _which_ row
var row = self.controller.getRowByNode(this); var row = self_1.controller.getRowByNode(this);
if (!row || !row.uid) { if (!row || !row.uid) {
return false; return false;
} }
@ -223,23 +223,23 @@ var et2_nextmatch = /** @class */ (function (_super) {
} }
return false; return false;
}) })
.on('dragexit', '.egwGridView_grid tr', function (e) { .on('dragexit', '.egwGridView_grid tr', function () {
self.controller._selectionMgr.setFocused(); self_1.controller._selectionMgr.setFocused();
}) })
.on('dragover', '.egwGridView_grid tr', false).attr("dropzone", "copy") .on('dragover', '.egwGridView_grid tr', false).attr("dropzone", "copy")
.on('drop', '.egwGridView_grid tr', function (e) { .on('drop', '.egwGridView_grid tr', function (e) {
self.handle_drop(e, this); self_1.handle_drop(e, this);
return false; return false;
}); });
} }
} }
// stop invalidation in no visible tabs // stop invalidation in no visible tabs
jQuery(this.getInstanceManager().DOMContainer.parentNode).on('hide.et2_nextmatch', jQuery.proxy(function (e) { jQuery(this.getInstanceManager().DOMContainer.parentNode).on('hide.et2_nextmatch', jQuery.proxy(function () {
if (this.controller && this.controller._grid) { if (this.controller && this.controller._grid) {
this.controller._grid.doInvalidate = false; this.controller._grid.doInvalidate = false;
} }
}, this)); }, this));
jQuery(this.getInstanceManager().DOMContainer.parentNode).on('show.et2_nextmatch', jQuery.proxy(function (e) { jQuery(this.getInstanceManager().DOMContainer.parentNode).on('show.et2_nextmatch', jQuery.proxy(function () {
if (this.controller && this.controller._grid) { if (this.controller && this.controller._grid) {
this.controller._grid.doInvalidate = true; this.controller._grid.doInvalidate = true;
} }
@ -789,9 +789,9 @@ var et2_nextmatch = /** @class */ (function (_super) {
if (widget.instanceOf(et2_nextmatch_customfields)) { if (widget.instanceOf(et2_nextmatch_customfields)) {
// Just the ID for server side, not the whole nm name - some apps use it to skip custom fields // Just the ID for server side, not the whole nm name - some apps use it to skip custom fields
colName = widget.id; colName = widget.id;
for (var name in widget.options.fields) { for (var name_1 in widget.options.fields) {
if (widget.options.fields[name]) if (widget.options.fields[name_1])
custom_fields.push(et2_nextmatch_customfields.prefix + name); custom_fields.push(et2_nextmatch_customfields.prefix + name_1);
} }
} }
if (visibility[colMgr.columns[i].id].visible) if (visibility[colMgr.columns[i].id].visible)
@ -1037,7 +1037,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
// Iterate over the rows // Iterate over the rows
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
// Get the uid from the data // Get the uid from the data
var uid = this.egw().appName + '::' + _rows[i][_rowId]; var uid = this.egw().app_name() + '::' + _rows[i][_rowId];
// Store the data for that uid // Store the data for that uid
this.egw().dataStoreUID(uid, _rows[i]); this.egw().dataStoreUID(uid, _rows[i]);
// Push the uid onto the order array // Push the uid onto the order array
@ -1084,20 +1084,20 @@ var et2_nextmatch = /** @class */ (function (_super) {
} }
// Build the popup // Build the popup
if (!this.selectPopup) { if (!this.selectPopup) {
var select = et2_createWidget("select", { var select_1 = et2_createWidget("select", {
multiple: true, multiple: true,
rows: 8, rows: 8,
empty_label: this.egw().lang("select columns"), empty_label: this.egw().lang("select columns"),
selected_first: false, selected_first: false,
value_class: "selcolumn_sortable_" value_class: "selcolumn_sortable_"
}, this); }, this);
select.set_select_options(columns); select_1.set_select_options(columns);
select.set_value(columns_selected); select_1.set_value(columns_selected);
var autoRefresh = et2_createWidget("select", { var autoRefresh_1 = et2_createWidget("select", {
"empty_label": "Refresh" "empty_label": "Refresh"
}, this); }, this);
autoRefresh.set_id("nm_autorefresh"); autoRefresh_1.set_id("nm_autorefresh");
autoRefresh.set_select_options({ autoRefresh_1.set_select_options({
// Cause [unknown] problems with mail // Cause [unknown] problems with mail
//30: "30 seconds", //30: "30 seconds",
//60: "1 Minute", //60: "1 Minute",
@ -1105,8 +1105,8 @@ var et2_nextmatch = /** @class */ (function (_super) {
900: "15 Minutes", 900: "15 Minutes",
1800: "30 Minutes" 1800: "30 Minutes"
}); });
autoRefresh.set_value(this._get_autorefresh()); autoRefresh_1.set_value(this._get_autorefresh());
autoRefresh.set_statustext(egw.lang("Automatically refresh list")); autoRefresh_1.set_statustext(egw.lang("Automatically refresh list"));
var defaultCheck = et2_createWidget("select", { "empty_label": "Preference" }, this); var defaultCheck = et2_createWidget("select", { "empty_label": "Preference" }, this);
defaultCheck.set_id('nm_col_preference'); defaultCheck.set_id('nm_col_preference');
defaultCheck.set_select_options({ defaultCheck.set_select_options({
@ -1121,13 +1121,13 @@ var et2_nextmatch = /** @class */ (function (_super) {
// Update visibility // Update visibility
var visibility = {}; var visibility = {};
for (var i = 0; i < columnMgr.columns.length; i++) { for (var i = 0; i < columnMgr.columns.length; i++) {
var col = columnMgr.columns[i]; var col_1 = columnMgr.columns[i];
if (col.caption && col.visibility !== et2_dataview_model_columns_1.et2_dataview_column.ET2_COL_VISIBILITY_ALWAYS_NOSELECT && if (col_1.caption && col_1.visibility !== et2_dataview_model_columns_1.et2_dataview_column.ET2_COL_VISIBILITY_ALWAYS_NOSELECT &&
col.visibility !== et2_dataview_model_columns_1.et2_dataview_column.ET2_COL_VISIBILITY_DISABLED) { col_1.visibility !== et2_dataview_model_columns_1.et2_dataview_column.ET2_COL_VISIBILITY_DISABLED) {
visibility[col.id] = { visible: false }; visibility[col_1.id] = { visible: false };
} }
} }
var value = select.getValue(); var value = select_1.getValue();
// Update & remove letter filter // Update & remove letter filter
if (self.header.lettersearch) { if (self.header.lettersearch) {
var show_letters = true; var show_letters = true;
@ -1168,17 +1168,17 @@ var et2_nextmatch = /** @class */ (function (_super) {
} }
columnMgr.setColumnVisibilitySet(visibility); columnMgr.setColumnVisibilitySet(visibility);
this.sortedColumnsList = []; this.sortedColumnsList = [];
jQuery(select.getDOMNode()).find('li[class^="selcolumn_sortable_"]').each(function (i, v) { jQuery(select_1.getDOMNode()).find('li[class^="selcolumn_sortable_"]').each(function (i, v) {
var data_id = v.getAttribute('data-value'); var data_id = v.getAttribute('data-value');
var value = select.getValue(); var value = select_1.getValue();
if (data_id.match(/^col_/) && value.indexOf(data_id) != -1) { if (data_id.match(/^col_/) && value.indexOf(data_id) != -1) {
var col_id = data_id.replace('col_', ''); var col_id = data_id.replace('col_', '');
var col_widget = self.columns[col_id].widget; var col_widget = self.columns[col_id].widget;
if (col_widget.customfields) { if (col_widget.customfields) {
self.sortedColumnsList.push(col_widget.id); self.sortedColumnsList.push(col_widget.id);
for (var field_name in col_widget.customfields) { for (var field_name_1 in col_widget.customfields) {
if (jQuery.isEmptyObject(col_widget.options.fields) || col_widget.options.fields[field_name] == true) { if (jQuery.isEmptyObject(col_widget.options.fields) || col_widget.options.fields[field_name_1] == true) {
self.sortedColumnsList.push(et2_customfields_list.prefix + field_name); self.sortedColumnsList.push(et2_customfields_list.prefix + field_name_1);
} }
} }
} }
@ -1191,7 +1191,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
self.selectPopup.toggle(); self.selectPopup.toggle();
self.dataview.updateColumns(); self.dataview.updateColumns();
// Auto refresh // Auto refresh
self._set_autorefresh(autoRefresh.get_value()); self._set_autorefresh(autoRefresh_1.get_value());
// Set default or clear forced // Set default or clear forced
if (show_letters) { if (show_letters) {
self.activeFilters.selectcols.push('lettersearch'); self.activeFilters.selectcols.push('lettersearch');
@ -1205,7 +1205,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
self.selectPopup.toggle(); self.selectPopup.toggle();
self.selectPopup = null; self.selectPopup = null;
}; };
var $select = jQuery(select.getDOMNode()); var $select = jQuery(select_1.getDOMNode());
$select.find('.ui-multiselect-checkboxes').sortable({ $select.find('.ui-multiselect-checkboxes').sortable({
placeholder: 'ui-fav-sortable-placeholder', placeholder: 'ui-fav-sortable-placeholder',
items: 'li[class^="selcolumn_sortable_col"]', items: 'li[class^="selcolumn_sortable_col"]',
@ -1240,11 +1240,11 @@ var et2_nextmatch = /** @class */ (function (_super) {
.append(cancelButton.getDOMNode()); .append(cancelButton.getDOMNode());
this.selectPopup = jQuery(document.createElement("div")) this.selectPopup = jQuery(document.createElement("div"))
.addClass("colselection ui-dialog ui-widget-content") .addClass("colselection ui-dialog ui-widget-content")
.append(select.getDOMNode()) .append(select_1.getDOMNode())
.append($footerWrap) .append($footerWrap)
.appendTo(this.innerDiv); .appendTo(this.innerDiv);
// Add autorefresh // Add autorefresh
$footerWrap.append(autoRefresh.getSurroundings().getDOMNode(autoRefresh.getDOMNode())); $footerWrap.append(autoRefresh_1.getSurroundings().getDOMNode(autoRefresh_1.getDOMNode()));
// Add default checkbox for admins // Add default checkbox for admins
var apps = this.egw().user('apps'); var apps = this.egw().user('apps');
if (apps['admin']) { if (apps['admin']) {
@ -1327,7 +1327,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
this.header.lettersearch.hide(); this.header.lettersearch.hide();
} }
var lettersearch_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-lettersearch"; var lettersearch_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-lettersearch";
this.egw().set_preference(this.egw().getAppName(), lettersearch_preference, letters_on); this.egw().set_preference(this.egw().app_name(), lettersearch_preference, letters_on);
}; };
/** /**
* Set the auto-refresh time period, and starts the timer if not started * Set the auto-refresh time period, and starts the timer if not started
@ -1386,9 +1386,10 @@ var et2_nextmatch = /** @class */ (function (_super) {
* When the template attribute is set, the nextmatch widget tries to load * When the template attribute is set, the nextmatch widget tries to load
* that template and to fetch the grid which is inside of it. It then calls * that template and to fetch the grid which is inside of it. It then calls
* *
* @param {string} _value template name * @param {string} template_name Full template name in the form app.template[.template]
*/ */
et2_nextmatch.prototype.set_template = function (template_name) { et2_nextmatch.prototype.set_template = function (template_name) {
var template = et2_createWidget("template", { "id": template_name }, this);
if (this.template) { if (this.template) {
// Stop early to prevent unneeded processing, and prevent infinite // Stop early to prevent unneeded processing, and prevent infinite
// loops if the server changes the template in get_rows // loops if the server changes the template in get_rows
@ -1418,7 +1419,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
} }
// Create the template // Create the template
if (template_name) { if (template_name) {
var template = et2_createWidget("template", { "id": template_name }, this);
} }
if (!template) { if (!template) {
this.egw().debug("error", "Error while loading definition template for " + this.egw().debug("error", "Error while loading definition template for " +
@ -1643,7 +1643,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
link.file_upload.set_drop_target(false); link.file_upload.set_drop_target(false);
if (row.row.tr) { if (row.row.tr) {
// Ignore most of the UI, just use the status indicators // Ignore most of the UI, just use the status indicators
var status = jQuery(document.createElement("div")) var status_1 = jQuery(document.createElement("div"))
.addClass('et2_link_to') .addClass('et2_link_to')
.width(row.row.tr.width()) .width(row.row.tr.width())
.position({ my: "left top", at: "left top", of: row.row.tr }) .position({ my: "left top", at: "left top", of: row.row.tr })
@ -1661,10 +1661,10 @@ var et2_nextmatch = /** @class */ (function (_super) {
link._parent.refresh(uid, 'edit'); link._parent.refresh(uid, 'edit');
} }
// Fade out nicely // Fade out nicely
status.delay(linked ? 1 : 2000) status_1.delay(linked ? 1 : 2000)
.fadeOut(500, function () { .fadeOut(500, function () {
link.destroy(); link.destroy();
status.remove(); status_1.remove();
}); });
}); });
} }
@ -1776,7 +1776,9 @@ var et2_nextmatch = /** @class */ (function (_super) {
var callback = jQuery.proxy(function (button, value) { var callback = jQuery.proxy(function (button, value) {
if (button === et2_dialog.CANCEL_BUTTON) { if (button === et2_dialog.CANCEL_BUTTON) {
// Give dialog a chance to close, or it will be in the print // Give dialog a chance to close, or it will be in the print
window.setTimeout(function () { defer.reject(); }, 0); window.setTimeout(function () {
defer.reject();
}, 0);
return; return;
} }
// Set CSS for orientation // Set CSS for orientation
@ -1814,59 +1816,65 @@ var et2_nextmatch = /** @class */ (function (_super) {
} }
// We need more rows // We need more rows
if (button === 'dialog[all]' || rows > loaded_count) { if (button === 'dialog[all]' || rows > loaded_count) {
var count = 0; var count_1 = 0;
var fetchedCount = 0; var fetchedCount_1 = 0;
var cancel = false; var cancel_1 = false;
var nm = this; var nm_1 = this;
var dialog = et2_dialog.show_dialog( var dialog_1 = et2_dialog.show_dialog(
// Abort the long task if they canceled the data load // Abort the long task if they canceled the data load
function () { count = total; cancel = true; window.setTimeout(function () { defer.reject(); }, 0); }, egw.lang('Loading'), egw.lang('please wait...'), {}, [ function () {
count_1 = total;
cancel_1 = true;
window.setTimeout(function () {
defer.reject();
}, 0);
}, egw.lang('Loading'), egw.lang('please wait...'), {}, [
{ "button_id": et2_dialog.CANCEL_BUTTON, "text": 'cancel', id: 'dialog[cancel]', image: 'cancel' } { "button_id": et2_dialog.CANCEL_BUTTON, "text": 'cancel', id: 'dialog[cancel]', image: 'cancel' }
]); ]);
// dataFetch() is asyncronous, so all these requests just get fired off... // dataFetch() is asynchronous, so all these requests just get fired off...
// 200 rows chosen arbitrarily to reduce requests. // 200 rows chosen arbitrarily to reduce requests.
do { do {
var ctx = { var ctx = {
"self": this.controller, "self": this.controller,
"start": count, "start": count_1,
"count": Math.min(rows, 200), "count": Math.min(rows, 200),
"lastModification": this.controller._lastModification "lastModification": this.controller._lastModification
}; };
if (nm.controller.dataStorePrefix) { if (nm_1.controller.dataStorePrefix) {
// @ts-ignore // @ts-ignore
ctx.prefix = nm.controller.dataStorePrefix; ctx.prefix = nm_1.controller.dataStorePrefix;
} }
nm.controller.dataFetch({ start: count, num_rows: Math.min(rows, 200) }, function (data) { nm_1.controller.dataFetch({ start: count_1, num_rows: Math.min(rows, 200) }, function (data) {
// Keep track // Keep track
if (data && data.order) { if (data && data.order) {
fetchedCount += data.order.length; fetchedCount_1 += data.order.length;
} }
nm.controller._fetchCallback.apply(this, arguments); nm_1.controller._fetchCallback.apply(this, arguments);
if (fetchedCount >= rows) { if (fetchedCount_1 >= rows) {
if (cancel) { if (cancel_1) {
dialog.destroy(); dialog_1.destroy();
defer.reject(); defer.reject();
return; return;
} }
// Use CSS to hide all but the requested rows // Use CSS to hide all but the requested rows
// Prevents us from showing more than requested, if actual height was less than average // Prevents us from showing more than requested, if actual height was less than average
nm.print_row_selector = ".egwGridView_grid > tbody > tr:not(:nth-child(-n+" + rows + "))"; nm_1.print_row_selector = ".egwGridView_grid > tbody > tr:not(:nth-child(-n+" + rows + "))";
egw.css(nm.print_row_selector, 'display: none'); egw.css(nm_1.print_row_selector, 'display: none');
// No scrollbar in print view // No scrollbar in print view
jQuery('.egwGridView_scrollarea', this.div).css('overflow-y', 'hidden'); jQuery('.egwGridView_scrollarea', this.div).css('overflow-y', 'hidden');
// Show it all // Show it all
jQuery('.egwGridView_scrollarea', this.div).css('height', 'auto'); jQuery('.egwGridView_scrollarea', this.div).css('height', 'auto');
// Grid needs to redraw before it can be printed, so wait // Grid needs to redraw before it can be printed, so wait
window.setTimeout(jQuery.proxy(function () { window.setTimeout(jQuery.proxy(function () {
dialog.destroy(); dialog_1.destroy();
// Should be OK to print now // Should be OK to print now
defer.resolve(); defer.resolve();
}, nm), et2_dataview_grid.ET2_GRID_INVALIDATE_TIMEOUT); }, nm_1), et2_dataview_grid.ET2_GRID_INVALIDATE_TIMEOUT);
} }
}, ctx); }, ctx);
count += 200; count_1 += 200;
} while (count < rows); } while (count_1 < rows);
nm.controller._grid.setScrollHeight(nm.controller._grid.getAverageHeight() * (rows + 1)); nm_1.controller._grid.setScrollHeight(nm_1.controller._grid.getAverageHeight() * (rows + 1));
} }
else { else {
// Don't need more rows, limit to requested and finish // Don't need more rows, limit to requested and finish
@ -1879,7 +1887,9 @@ var et2_nextmatch = /** @class */ (function (_super) {
// No scrollbar in print view // No scrollbar in print view
jQuery('.egwGridView_scrollarea', this.div).css('overflow-y', 'hidden'); jQuery('.egwGridView_scrollarea', this.div).css('overflow-y', 'hidden');
// Give dialog a chance to close, or it will be in the print // Give dialog a chance to close, or it will be in the print
window.setTimeout(function () { defer.resolve(); }, 0); window.setTimeout(function () {
defer.resolve();
}, 0);
} }
}, this); }, this);
var value = { var value = {
@ -1940,7 +1950,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
delete this.print.old_height; delete this.print.old_height;
// Remove CSS rule hiding extra rows // Remove CSS rule hiding extra rows
if (this.print.row_selector) { if (this.print.row_selector) {
egw.css(this.print.row_selector, false); egw.css(this.print.row_selector, '');
delete this.print.row_selector; delete this.print.row_selector;
} }
// Restore columns // Restore columns
@ -1956,6 +1966,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
if (pref) { if (pref) {
if (typeof pref === 'string') if (typeof pref === 'string')
pref = pref.split(','); pref = pref.split(',');
// @ts-ignore
this.set_columns(pref, app); this.set_columns(pref, app);
} }
this.dynheight.outerNode.css('max-width', 'inherit'); this.dynheight.outerNode.css('max-width', 'inherit');
@ -2046,9 +2057,9 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
/** /**
* Constructor * Constructor
* *
* @param nextmatch * @param _parent
* @param nm_div * @param _attrs
* @memberOf et2_nextmatch_header_bar * @param _child
*/ */
function et2_nextmatch_header_bar(_parent, _attrs, _child) { function et2_nextmatch_header_bar(_parent, _attrs, _child) {
var _this = _super.call(this, _parent, [_parent, _parent.options.settings], et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_nextmatch_header_bar._attributes, _child || {})) || this; var _this = _super.call(this, _parent, [_parent, _parent.options.settings], et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_nextmatch_header_bar._attributes, _child || {})) || this;
@ -2072,12 +2083,9 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
this._createHeader(); this._createHeader();
} }
// Bind row count // Bind row count
/* TODO
this.nextmatch.dataview.grid.setInvalidateCallback(function () { this.nextmatch.dataview.grid.setInvalidateCallback(function () {
this.count_total.text(this.nextmatch.dataview.grid.getTotalCount() + ""); this.count_total.text(this.nextmatch.dataview.grid.getTotalCount() + "");
}, this); }, this);
*/
}; };
/** /**
* Actions are handled by the controller, so ignore these * Actions are handled by the controller, so ignore these
@ -2204,9 +2212,9 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
this._setup_favorites(settings['favorites']); this._setup_favorites(settings['favorites']);
// Export // Export
if (typeof settings.csv_fields != "undefined" && settings.csv_fields != false) { if (typeof settings.csv_fields != "undefined" && settings.csv_fields != false) {
var definition = settings.csv_fields; var definition_1 = settings.csv_fields;
if (settings.csv_fields === true) { if (settings.csv_fields === true) {
definition = egw.preference('nextmatch-export-definition', this.nextmatch.egw().getAppName()); definition_1 = egw.preference('nextmatch-export-definition', this.nextmatch.egw().app_name());
} }
var button_1 = et2_createWidget("buttononly", { id: "export", "statustext": "Export", image: "download", "background_image": true }, this); var button_1 = et2_createWidget("buttononly", { id: "export", "statustext": "Export", image: "download", "background_image": true }, this);
jQuery(button_1.getDOMNode()) jQuery(button_1.getDOMNode())
@ -2215,7 +2223,7 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
egw_openWindowCentered2(egw.link('/index.php', { egw_openWindowCentered2(egw.link('/index.php', {
'menuaction': 'importexport.importexport_export_ui.export_dialog', 'menuaction': 'importexport.importexport_export_ui.export_dialog',
'appname': event.data.egw().getAppName(), 'appname': event.data.egw().getAppName(),
'definition': definition 'definition': definition_1
}), '_blank', 850, 440, 'yes'); }), '_blank', 850, 440, 'yes');
}); });
} }
@ -2262,7 +2270,7 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
} }
// Apply letter search preference // Apply letter search preference
var lettersearch_preference = "nextmatch-" + this.nextmatch.options.settings.columnselection_pref + "-lettersearch"; var lettersearch_preference = "nextmatch-" + this.nextmatch.options.settings.columnselection_pref + "-lettersearch";
if (this.lettersearch && !egw.preference(lettersearch_preference, this.nextmatch.egw().getAppName())) { if (this.lettersearch && !egw.preference(lettersearch_preference, this.nextmatch.egw().app_name())) {
this.lettersearch.hide(); this.lettersearch.hide();
} }
}; };
@ -2347,7 +2355,7 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
if ((!options || options.length == 0) && ( if ((!options || options.length == 0) && (
// perspectiveData.row in nm, data["${row}"] in an auto-repeat grid // perspectiveData.row in nm, data["${row}"] in an auto-repeat grid
this.nextmatch.getArrayMgr("sel_options").perspectiveData.row || this.nextmatch.getArrayMgr("sel_options").data[row_stuck[i]])) { this.nextmatch.getArrayMgr("sel_options").perspectiveData.row || this.nextmatch.getArrayMgr("sel_options").data[row_stuck[i]])) {
var row_id = name.replace(/[0-9]+/, row_stuck[i]); row_id = name.replace(/[0-9]+/, row_stuck[i]);
options = this.nextmatch.getArrayMgr("sel_options").getEntry(row_id); options = this.nextmatch.getArrayMgr("sel_options").getEntry(row_id);
if (!options) { if (!options) {
row_id = row_stuck[i] + "[" + name + "]"; row_id = row_stuck[i] + "[" + name + "]";
@ -2376,14 +2384,14 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
select.attributes.select_options.ignore = true; select.attributes.select_options.ignore = true;
if (this.nextmatch.options.settings[name + "_onchange"]) { if (this.nextmatch.options.settings[name + "_onchange"]) {
// Get the onchange function string // Get the onchange function string
var onchange = this.nextmatch.options.settings[name + "_onchange"]; var onchange_1 = this.nextmatch.options.settings[name + "_onchange"];
// Real submits cause all sorts of problems // Real submits cause all sorts of problems
if (onchange.match(/this\.form\.submit/)) { if (onchange_1.match(/this\.form\.submit/)) {
this.egw().debug("warn", "%s tries to submit form, which is not allowed. Filter changes automatically refresh data with no reload.", name); this.egw().debug("warn", "%s tries to submit form, which is not allowed. Filter changes automatically refresh data with no reload.", name);
onchange = onchange.replace(/this\.form\.submit\([^)]*\);?/, 'return true;'); onchange_1 = onchange_1.replace(/this\.form\.submit\([^)]*\);?/, 'return true;');
} }
// Connect it to the onchange event of the input element - may submit // Connect it to the onchange event of the input element - may submit
select.change = et2_compileLegacyJS(onchange, this.nextmatch, select.getInputNode()); select.change = et2_compileLegacyJS(onchange_1, this.nextmatch, select.getInputNode());
this._bindHeaderInput(select); this._bindHeaderInput(select);
} }
else // default request changed rows with new filters, previous this.form.submit() else // default request changed rows with new filters, previous this.form.submit()
@ -2557,8 +2565,8 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
} }
else { else {
// Not null is easy, just get values // Not null is easy, just get values
var value = this.getInstanceManager().getValues(sub_header); var value_1 = this.getInstanceManager().getValues(sub_header);
header.nextmatch.applyFilters(value[header.nextmatch.id]); header.nextmatch.applyFilters(value_1[header.nextmatch.id]);
} }
} }
// In case this gets bound twice, it's important to return // In case this gets bound twice, it's important to return
@ -2711,6 +2719,7 @@ var et2_nextmatch_customfields = /** @class */ (function (_super) {
var nm_column = null; var nm_column = null;
var set_fields = {}; var set_fields = {};
for (var i = 0; i < this.nextmatch.columns.length; i++) { for (var i = 0; i < this.nextmatch.columns.length; i++) {
// @ts-ignore
if (this.nextmatch.columns[i].widget == this) { if (this.nextmatch.columns[i].widget == this) {
nm_column = columnMgr.columns[i]; nm_column = columnMgr.columns[i];
break; break;
@ -3171,7 +3180,6 @@ var et2_nextmatch_entryheader = /** @class */ (function (_super) {
this.attributes.value.ignore = true; this.attributes.value.ignore = true;
//this.attributes.select_options.ignore = true; //this.attributes.select_options.ignore = true;
} }
var self = this;
// Fire on lost focus, clear filter if user emptied box // Fire on lost focus, clear filter if user emptied box
}; };
return et2_nextmatch_entryheader; return et2_nextmatch_entryheader;
@ -3187,6 +3195,7 @@ var et2_nextmatch_customfilter = /** @class */ (function (_super) {
* *
* @param _parent * @param _parent
* @param _attrs * @param _attrs
* @param _child
* @memberOf et2_nextmatch_customfilter * @memberOf et2_nextmatch_customfilter
*/ */
function et2_nextmatch_customfilter(_parent, _attrs, _child) { function et2_nextmatch_customfilter(_parent, _attrs, _child) {

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ export class et2_nextmatch_controller extends et2_dataview_controller implements
* @memberOf et2_nextmatch_controller * @memberOf et2_nextmatch_controller
*/ */
constructor( _parentController, _egw, _execId, _widget, _parentId, constructor( _parentController, _egw, _execId, _widget, _parentId,
_grid, _rowProvider, _actionLinks, _objectManager, _actions) _grid, _rowProvider, _actionLinks, _objectManager, _actions?)
{ {
// Call the parent et2_dataview_controller constructor // Call the parent et2_dataview_controller constructor