From 99fdf2fbfca50d710cf0314a34f9781701a7dd66 Mon Sep 17 00:00:00 2001 From: Juan Fuentes <juanf@bs-mbpr28.d.ethz.ch> Date: Thu, 8 Aug 2019 10:12:08 +0200 Subject: [PATCH] SSDM-7956 : Improved view mode and saving, after the component was updated by its developer --- .../html/js/util/JExcelEditorManager.js | 45 ++++++++++++++----- .../eln-lims/html/lib/jexcel/VERSION.txt | 2 +- .../eln-lims/html/lib/jexcel/jexcel.css | 2 +- .../eln-lims/html/lib/jexcel/jexcel.js | 25 ++++++++--- 4 files changed, 56 insertions(+), 18 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JExcelEditorManager.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JExcelEditorManager.js index e90a5308bb9..0d98d8d6747 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JExcelEditorManager.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JExcelEditorManager.js @@ -6,15 +6,17 @@ var JExcelEditorManager = new function() { var _this = this; return function() { var jExcelEditor = _this.jExcelEditors[guid]; - var data = jExcelEditor.getData(); - var style = jExcelEditor.getStyle(); - var meta = jExcelEditor.getMeta(); - var jExcelEditorValue = { - data : data, - style : style, - meta : meta + if(jExcelEditor) { + var data = jExcelEditor.getData(); + var style = jExcelEditor.getStyle(); + var meta = jExcelEditor.getMeta(); + var jExcelEditorValue = { + data : data, + style : style, + meta : meta + } + entity.properties[propertyCode] = "<DATA>" + JSON.stringify(jExcelEditorValue) + "</DATA>"; } - entity.properties[propertyCode] = "<DATA>" + JSON.stringify(jExcelEditorValue) + "</DATA>"; } } @@ -56,15 +58,36 @@ var JExcelEditorManager = new function() { { type:'color', content:'format_color_fill', k:'background-color' }, ]; } - var jexcelField = jexcel($container[0], { + + var options = { data: data, style: style, meta: meta, editable : mode == FormMode.EDIT, minDimensions:[30, 30], toolbar: toolbar, - onchange: onChangeHandler - }); + onchange: onChangeHandler, + onchangestyle: onChangeHandler, + onchangemeta: onChangeHandler + + }; + + if(mode != FormMode.EDIT) { + options.allowInsertRow = false; + options.allowManualInsertRow = false; + options.allowInsertColumn = false; + options.allowManualInsertColumn = false; + options.allowDeleteRow = false; + options.allowDeleteColumn = false; + options.allowRenameColumn = false; + options.allowComments = false; + + options.contextMenu = function(obj, x, y, e) { + return []; + } + } + + var jexcelField = jexcel($container[0], options); this.jExcelEditors[guid] = jexcelField; } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/VERSION.txt b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/VERSION.txt index 3e1700eef08..4e48a183b1e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/VERSION.txt +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/VERSION.txt @@ -1 +1 @@ -3.4 from Master \ No newline at end of file +3.4.1 from Master 2019.08.08 \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.css b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.css index 3b5711f7b21..55d0153866d 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.css +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.css @@ -1,5 +1,5 @@ /** - * (c) jExcel v3.4.0 + * (c) jExcel v3.4.1 * * Author: Paul Hodel <paul.hodel@gmail.com> * Website: https://bossanova.uk/jexcel/ diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.js index 7896bf64ea1..eb9fd03d454 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/jexcel/jexcel.js @@ -1,5 +1,5 @@ /** - * (c) jExcel v3.4.0 + * (c) jExcel v3.4.1 * * Author: Paul Hodel <paul.hodel@gmail.com> * Website: https://bossanova.uk/jexcel/ @@ -136,6 +136,8 @@ var jexcel = (function(el, options) { onchangeheader:null, oneditionstart:null, oneditionend:null, + onchangestyle:null, + onchangemeta:null, // Customize any cell behavior updateTable:null, // Texts @@ -173,7 +175,7 @@ var jexcel = (function(el, options) { noCellsSelected: 'No cells selected', }, // About message - about:"jExcel CE Spreadsheet\nVersion 3.4.0\nAuthor: Paul Hodel <paul.hodel@gmail.com>\nWebsite: https://jexcel.net/v3", + about:"jExcel CE Spreadsheet\nVersion 3.4.1\nAuthor: Paul Hodel <paul.hodel@gmail.com>\nWebsite: https://jexcel.net/v3", }; // Loading initial configuration from user @@ -2629,6 +2631,12 @@ var jexcel = (function(el, options) { } } } + + if (obj.ignoreEvents != true) { + if (typeof(obj.options.onchangemeta) == 'function') { + obj.options.onchangemeta(el, o, k, v); + } + } } /** @@ -2776,6 +2784,12 @@ var jexcel = (function(el, options) { newValue: newValue, }); } + + if (obj.ignoreEvents != true) { + if (typeof(obj.options.onchangestyle) == 'function') { + obj.options.onchangestyle(el, o, k, v); + } + } } /** @@ -4721,9 +4735,10 @@ var jexcel = (function(el, options) { if (query) { // Search filter - var search = function(item, query) { + var search = function(item, query, index) { for (var i = 0; i < item.length; i++) { - if ((''+item[i]).toLowerCase().search(query) >= 0) { + if ((''+item[i]).toLowerCase().search(query) >= 0 || + (''+obj.records[index][i].innerHTML).toLowerCase().search(query) >= 0) { return true; } } @@ -4739,7 +4754,7 @@ var jexcel = (function(el, options) { // Filter var data = obj.options.data.filter(function(v, k) { - if (search(v, query)) { + if (search(v, query, k)) { // Merged rows found var rows = obj.isRowMerged(k); if (rows.length) { -- GitLab