Some fixes for tile view after Typescript conversion

This commit is contained in:
nathangray 2020-03-23 10:05:46 -06:00
parent 7e1da8d909
commit 3350f3a024
4 changed files with 147 additions and 147 deletions

View File

@ -111,7 +111,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
row_selector: '', row_selector: '',
orientation_style: null orientation_style: null
}; };
_this.activeFilters = {col_filter: {}}; _this.activeFilters = { col_filter: {} };
_this.columns = []; _this.columns = [];
// keeps sorted columns // keeps sorted columns
_this.sortedColumnsList = []; _this.sortedColumnsList = [];
@ -740,6 +740,17 @@ var et2_nextmatch = /** @class */ (function (_super) {
else { else {
colName = this._getColumnName(_row[i].widget); colName = this._getColumnName(_row[i].widget);
} }
_colData[i].visible = negated;
var stop_1 = false;
for (var j = 0; j < columnDisplay.length && !stop_1; j++) {
if (columnDisplay[j] == colName) {
_colData[i].visible = !negated;
stop_1 = true;
}
}
if (!negated) {
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
}
if (!colName) if (!colName)
continue; continue;
if (size[colName]) { if (size[colName]) {
@ -751,16 +762,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
_colData[i].width = parseInt(size[colName]) + 'px'; _colData[i].width = parseInt(size[colName]) + 'px';
} }
} }
if (!negated) {
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
}
for (var j = 0; j < columnDisplay.length; j++) {
if (columnDisplay[j] == colName) {
_colData[i].visible = !negated;
continue RowLoop;
}
}
_colData[i].visible = negated;
} }
} }
_colData.sort(function (a, b) { _colData.sort(function (a, b) {
@ -968,7 +969,8 @@ var et2_nextmatch = /** @class */ (function (_super) {
columnWidgets[x] = _row[x].widget; columnWidgets[x] = _row[x].widget;
// Append the widget to this container // Append the widget to this container
this.addChild(_row[x].widget); this.addChild(_row[x].widget);
} else { }
else {
columnWidgets[x] = _row[x].widget; columnWidgets[x] = _row[x].widget;
} }
// Pass along column alignment // Pass along column alignment
@ -1123,15 +1125,15 @@ var et2_nextmatch = /** @class */ (function (_super) {
}); });
autoRefresh_1.set_value(this._get_autorefresh()); autoRefresh_1.set_value(this._get_autorefresh());
autoRefresh_1.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({
'default': {label: 'Default', title: 'Set these columns as the default'}, 'default': { label: 'Default', title: 'Set these columns as the default' },
'reset': {label: 'Reset', title: "Reset all user's column preferences"}, 'reset': { label: 'Reset', title: "Reset all user's column preferences" },
'force': {label: 'Force', title: 'Force column preference so users cannot change it'} 'force': { label: 'Force', title: 'Force column preference so users cannot change it' }
}); });
defaultCheck.set_value(this.options.settings.columns_forced ? 'force' : ''); defaultCheck.set_value(this.options.settings.columns_forced ? 'force' : '');
var okButton = et2_createWidget("buttononly", {"background_image": true, image: "check"}, this); var okButton = et2_createWidget("buttononly", { "background_image": true, image: "check" }, this);
okButton.set_label(this.egw().lang("ok")); okButton.set_label(this.egw().lang("ok"));
okButton.onclick = function () { okButton.onclick = function () {
// Update visibility // Update visibility
@ -1421,7 +1423,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
// We don't use iterateOver because it checks sub-children // We don't use iterateOver because it checks sub-children
for (var i = this._children.length - 1; i >= 0; i--) { for (var i = this._children.length - 1; i >= 0; i--) {
var _node = this._children[i]; var _node = this._children[i];
if (_node != this.header) { if (_node != this.header && _node !== template) {
this.removeChild(_node); this.removeChild(_node);
_node.destroy(); _node.destroy();
} }
@ -1433,9 +1435,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
} }
this.dataview = new et2_dataview_1.et2_dataview(this.innerDiv, this.egw()); this.dataview = new et2_dataview_1.et2_dataview(this.innerDiv, this.egw());
} }
// Create the template
if (template_name) {
}
if (!template) { if (!template) {
this.egw().debug("error", "Error while loading definition template for " + this.egw().debug("error", "Error while loading definition template for " +
"nextmatch widget.", template_name); "nextmatch widget.", template_name);

View File

@ -1054,6 +1054,20 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
{ {
colName = this._getColumnName(_row[i].widget); colName = this._getColumnName(_row[i].widget);
} }
_colData[i].visible = negated;
let stop = false;
for(var j = 0; j < columnDisplay.length && !stop; j++)
{
if(columnDisplay[j] == colName)
{
_colData[i].visible = !negated;
stop = true;
}
}
if(!negated)
{
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
}
if(!colName) continue; if(!colName) continue;
if(size[colName]) if(size[colName])
@ -1068,20 +1082,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
_colData[i].width = parseInt(size[colName])+'px'; _colData[i].width = parseInt(size[colName])+'px';
} }
} }
if(!negated)
{
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
}
for(var j = 0; j < columnDisplay.length; j++)
{
if(columnDisplay[j] == colName)
{
_colData[i].visible = !negated;
continue RowLoop;
}
}
_colData[i].visible = negated;
} }
} }
@ -1941,7 +1941,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// We don't use iterateOver because it checks sub-children // We don't use iterateOver because it checks sub-children
for (let i = this._children.length - 1; i >= 0; i--) { for (let i = this._children.length - 1; i >= 0; i--) {
const _node = this._children[i]; const _node = this._children[i];
if (_node != this.header) { if (_node != this.header && _node !== template) {
this.removeChild(_node); this.removeChild(_node);
_node.destroy(); _node.destroy();
} }
@ -1955,11 +1955,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
this.dataview = new et2_dataview(this.innerDiv, this.egw()); this.dataview = new et2_dataview(this.innerDiv, this.egw());
} }
// Create the template
if (template_name)
{
}
if (!template) if (!template)
{ {
this.egw().debug("error", "Error while loading definition template for " + this.egw().debug("error", "Error while loading definition template for " +

View File

@ -307,7 +307,13 @@ var filemanagerAPP = /** @class */ (function (_super) {
for (var file in _data.uploaded) { for (var file in _data.uploaded) {
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) { if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) {
var buttons = [ var buttons = [
{ text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check' }, {
text: this.egw.lang("Yes"),
id: "overwrite",
class: "ui-priority-primary",
"default": true,
image: 'check'
},
{ text: this.egw.lang("Rename"), id: "rename", image: 'edit' }, { text: this.egw.lang("Rename"), id: "rename", image: 'edit' },
{ text: this.egw.lang("Cancel"), id: "cancel" } { text: this.egw.lang("Cancel"), id: "cancel" }
]; ];
@ -612,14 +618,14 @@ var filemanagerAPP = /** @class */ (function (_super) {
} }
// Toggle button icon to the other view // Toggle button icon to the other view
//todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master //todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master
button_widget.set_image("list_" + (view == nm.getController().VIEW_ROW ? nm.getController().VIEW_TILE : nm.getController().VIEW_ROW)); button_widget.set_image("list_" + (view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW));
button_widget.set_statustext(view == nm.getController().VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view')); button_widget.set_statustext(view == et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
} }
nm.set_view(view); nm.set_view(view);
// Put it into active filters (but don't refresh) // Put it into active filters (but don't refresh)
nm.activeFilters["view"] = view; nm.activeFilters["view"] = view;
// Change template to match // Change template to match
var template = view == nm.getController().VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile'; var template = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
nm.set_template(template); nm.set_template(template);
// Wait for template to load, then refresh // Wait for template to load, then refresh
template = nm.getWidgetById(template); template = nm.getWidgetById(template);

View File

@ -744,9 +744,9 @@ export class filemanagerAPP extends EgwApp
// Toggle button icon to the other view // Toggle button icon to the other view
//todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master //todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master
button_widget.set_image("list_"+(view == nm.getController().VIEW_ROW ? nm.getController().VIEW_TILE : nm.getController().VIEW_ROW)); button_widget.set_image("list_"+(view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW));
button_widget.set_statustext(view == nm.getController().VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view')); button_widget.set_statustext(view == et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
} }
nm.set_view(view); nm.set_view(view);
@ -754,7 +754,7 @@ export class filemanagerAPP extends EgwApp
nm.activeFilters["view"]= view; nm.activeFilters["view"]= view;
// Change template to match // Change template to match
let template : any = view == nm.getController().VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile'; let template : any = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
nm.set_template(template); nm.set_template(template);
// Wait for template to load, then refresh // Wait for template to load, then refresh