From 07035bd7c325cf95d3661939fcba7b0e2b81d370 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 8 Jun 2020 20:09:33 +0300 Subject: [PATCH 01/33] [SSE] Add pivot filtering settings --- apps/common/main/lib/component/Window.js | 7 ++ .../main/app/view/AutoFilterDialog.js | 118 ++++++++++++++++-- 2 files changed, 113 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 9405cc200..063bed7bf 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -951,6 +951,13 @@ define([ this.$window.find('.resize-border').remove(); } this.resizable = resizable; + } else { + if (resizable) { + (minSize && minSize.length>1) && (this.initConfig.minwidth = minSize[0]); + (minSize && minSize.length>1) && (this.initConfig.minheight = minSize[1]); + (maxSize && maxSize.length>1) && (this.initConfig.maxwidth = maxSize[0]); + (maxSize && maxSize.length>1) && (this.initConfig.maxheight = maxSize[1]); + } } }, diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index 4cf0401c3..c01fb9108 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -469,9 +469,11 @@ define([ SSE.Views.AutoFilterDialog = Common.UI.Window.extend(_.extend({ initialize: function (options) { + this.menuPanelWidth = 195; + var t = this, _options = {}, width = undefined, height = undefined; if (Common.Utils.InternalSettings.get('sse-settings-size-filter-window')) { - width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0]; + width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0] + this.menuPanelWidth; height = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[1]; } @@ -505,7 +507,7 @@ define([ '', '', '', - '' @@ -685,6 +687,61 @@ define([ }); this.miReapply.on('click', _.bind(this.onReapply, this)); + this.miReapplySeparator = new Common.UI.MenuItem({ caption: '--' }); + + // pivot + this.miValueFilter = new Common.UI.MenuItem({ + caption : this.txtValueFilter, + toggleGroup : 'menufilterfilter', + checkable : true, + checked : false, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + {value: Asc.c_oAscCustomAutoFilter.equals, caption: this.txtEquals, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.doesNotEqual, caption: this.txtNotEquals, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isGreaterThan, caption: this.txtGreater, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo, caption: this.txtGreaterEquals,checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isLessThan, caption: this.txtLess, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo, caption: this.txtLessEquals, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: -2, caption: this.txtBetween, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.top10, caption: this.txtTop10, checkable: true, type: Asc.c_oAscAutoFilterTypes.Top10, pivot: true} + ] + }) + }); + var items = this.miNumFilter.menu.items; + for (var i=0; i0); this.miSortFontColor.setVisible(hasColors); - this.miFilterFontColor.setVisible(hasColors); + this.miFilterFontColor.setVisible(!isPivot && hasColors); if (hasColors) { var colors = []; colorsFont.forEach(function(item, index) { @@ -1141,7 +1232,7 @@ define([ hasColors = (colorsFill && colorsFill.length>0); this.miSortCellColor.setVisible(hasColors); - this.miFilterCellColor.setVisible(hasColors); + this.miFilterCellColor.setVisible(!isPivot && hasColors); if (hasColors) { var colors = []; colorsFill.forEach(function(item, index) { @@ -1165,7 +1256,7 @@ define([ isAnd = (customFilter.asc_getAnd()), cond1 = customFilters[0].asc_getOperator(), cond2 = ((customFilters.length>1) ? (customFilters[1].asc_getOperator() || 0) : 0), - items = (isTextFilter) ? this.miTextFilter.menu.items : this.miNumFilter.menu.items, + items = isPivot ? (isValueFilter ? this.miValueFilter.menu.items : this.miLabelFilter.menu.items) : ((isTextFilter) ? this.miTextFilter.menu.items : this.miNumFilter.menu.items), isCustomConditions = true; if (customFilters.length==1) @@ -1174,7 +1265,7 @@ define([ item.setChecked(checked, true); if (checked) isCustomConditions = false; }); - else if (!isTextFilter && (cond1 == Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo && cond2 == Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo || + else if ((isPivot || !isTextFilter) && (cond1 == Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo && cond2 == Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo || cond1 == Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo && cond2 == Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo)){ items[6].setChecked(true, true); // between filter isCustomConditions = false; @@ -1195,7 +1286,7 @@ define([ } } else if (isDynamicFilter || isTop10) { var dynType = (isDynamicFilter) ? filterObj.asc_getFilter().asc_getType() : null, - items = this.miNumFilter.menu.items; + items = isPivot ? this.miValueFilter.menu.items : this.miNumFilter.menu.items; items.forEach(function(item){ item.setChecked(isDynamicFilter && (item.options.type == Asc.c_oAscAutoFilterTypes.DynamicFilter) && (item.value == dynType) || isTop10 && (item.options.type == Asc.c_oAscAutoFilterTypes.Top10), true); @@ -1394,6 +1485,7 @@ define([ this.$window.find('.combo-values').css({'height': size[1] - 100 + 'px'}); this.curSize.height = size[1]; } + size[0] -= this.menuPanelWidth; Common.Utils.InternalSettings.set('sse-settings-size-filter-window', size); }, @@ -1438,7 +1530,9 @@ define([ txtContains : "Contains...", txtNotContains : "Does not contain...", textSelectAllResults: 'Select All Search Results', - textAddSelection : 'Add current selection to filter' + textAddSelection : 'Add current selection to filter', + txtValueFilter: 'Value filter', + txtLabelFilter: 'Label filter' }, SSE.Views.AutoFilterDialog || {})); }); \ No newline at end of file From f7b704da61c8d51330ea6520e12c8cc82efa9697 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 9 Jun 2020 10:47:24 +0300 Subject: [PATCH 02/33] [SSE] Fix filter window resizing --- .../main/app/view/AutoFilterDialog.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index c01fb9108..9edfee537 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -469,11 +469,9 @@ define([ SSE.Views.AutoFilterDialog = Common.UI.Window.extend(_.extend({ initialize: function (options) { - this.menuPanelWidth = 195; - - var t = this, _options = {}, width = undefined, height = undefined; + var t = this, _options = {}, width = 450, height = undefined; if (Common.Utils.InternalSettings.get('sse-settings-size-filter-window')) { - width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0] + this.menuPanelWidth; + width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0]; height = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[1]; } @@ -507,7 +505,7 @@ define([ '', '', '', - '' @@ -1165,6 +1163,12 @@ define([ _setDefaults: function() { this.initialFilterType = this.configTo.asc_getFilterObj().asc_getType(); + var menuPanel = this.$window.find('.menu-panel'); + this.menuPanelWidth = menuPanel.innerWidth(); + var width = this.getWidth(); + if (Common.Utils.InternalSettings.get('sse-settings-size-filter-window')) { + width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0] + this.menuPanelWidth; + } var pivotObj = this.configTo.asc_getPivotObj(), isPivot = !!pivotObj, @@ -1175,10 +1179,9 @@ define([ if (isPivot) { if (pivotObj.asc_getIsPageFilter()) { - var menuPanel = this.$window.find('.menu-panel'); - this.setResizable(true, this.initConfig.minwidth - this.menuPanelWidth, this.initConfig.minheight); + this.setResizable(true, [this.initConfig.minwidth - this.menuPanelWidth, this.initConfig.minheight]); menuPanel.addClass('hidden'); - this.setWidth(this.getWidth() - this.menuPanelWidth); + width -= this.menuPanelWidth; this.menuPanelWidth = 0; } this.miReapplySeparator.setVisible(false); @@ -1186,6 +1189,7 @@ define([ isValueFilter = (pivotObj.asc_getDataFieldIndexFilter()!==null); } + this.setSize(width, this.getHeight()); var filterObj = this.configTo.asc_getFilterObj(), isCustomFilter = (this.initialFilterType === Asc.c_oAscAutoFilterTypes.CustomFilters), From 27de7927dbed61bb0a9a9fcbb1ce2b4e3232c482 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 9 Jun 2020 18:40:52 +0300 Subject: [PATCH 03/33] [SSE] Set filters for pivot table --- .../main/app/view/AutoFilterDialog.js | 385 ++++++++++++++++-- 1 file changed, 352 insertions(+), 33 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index 9edfee537..bedf986ff 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -83,7 +83,7 @@ define([ '', '', '
', - ' +
+ + + + + + + + + + + + + + + + + +
- +
-
+
+
+ +
+
+ + + +
+
+
+
+
+
- -
+ +
+
+
diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index 4729d53c3..f981fa73e 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -40,12 +40,34 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template', 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/ListView', 'common/main/lib/component/CheckBox', 'common/main/lib/component/InputField', 'spreadsheeteditor/main/app/view/CellRangeDialog' ], function (contentTemplate) { 'use strict'; + var _CustomItem = Common.UI.DataViewItem.extend({ + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + me.template = me.options.template || me.template; + + me.listenTo(me.model, 'change:sort', function() { + me.render(); + me.trigger('change', me, me.model); + }); + me.listenTo(me.model, 'change:selected', function() { + var el = me.$el || $(me.el); + el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); + me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); + }); + me.listenTo(me.model, 'remove', me.remove); + } + }); + SSE.Views.ChartSettingsDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 322, @@ -58,7 +80,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' _.extend(this.options, { title: this.textTitle, items: [ - {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textTypeData}, + {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textType}, + {panelId: 'id-chart-settings-dlg-data', panelCaption: this.textData}, {panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout}, {panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis}, {panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis}, @@ -728,8 +751,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } }, this)); - this.btnsCategory[2].on('click', _.bind(this.onVCategoryClick, this)); - this.btnsCategory[3].on('click', _.bind(this.onHCategoryClick, this)); + this.btnsCategory[3].on('click', _.bind(this.onVCategoryClick, this)); + this.btnsCategory[4].on('click', _.bind(this.onHCategoryClick, this)); // Sparklines this.btnSparkType = new Common.UI.Button({ @@ -970,6 +993,111 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' me.isAltDescChanged = true; }); + // Chart data + this.seriesList = new Common.UI.ListView({ + el: $('#chart-dlg-series-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + scrollAlwaysVisible: true, + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '', + '
', + '
<%= Common.Utils.String.htmlEncode(value) %>
', + '
', + '
' + ].join('')) + }); + this.seriesList.createNewItem = function(record) { + return new _CustomItem({ + template: this.itemTemplate, + model: record + }); + }; + this.seriesList.on({ + 'item:change': this.onItemChanged.bind(this), + 'item:add': this.onItemChanged.bind(this), + 'item:select': this.onCellCheck.bind(this) + }); + this.seriesList.onKeyDown = _.bind(this.onListKeyDown, this, 'series'); + this.seriesList.createNewItem = function(record) { + return new _CustomItem({ + template: this.itemTemplate, + model: record + }); + }; + this.seriesList.on('item:select', _.bind(this.onSelectSeries, this)); + + this.btnAdd = new Common.UI.Button({ + el: $('#chart-dlg-btn-add') + }); + // this.btnAdd.on('click', _.bind(this.onAddSeries, this, false)); + + this.btnDelete = new Common.UI.Button({ + el: $('#chart-dlg-btn-delete') + }); + // this.btnDelete.on('click', _.bind(this.onDeleteSeries, this)); + + this.btnEdit = new Common.UI.Button({ + el: $('#chart-dlg-btn-edit') + }); + // this.btnEdit.on('click', _.bind(this.onEditSeries, this, false)); + + this.btnUp = new Common.UI.Button({ + parentEl: $('#chart-dlg-btn-up'), + cls: 'btn-toolbar', + iconCls: 'caret-up', + hint: this.textUp + }); + // this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); + + this.btnDown = new Common.UI.Button({ + parentEl: $('#chart-dlg-btn-down'), + cls: 'btn-toolbar', + iconCls: 'caret-down', + hint: this.textDown + }); + // this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); + + this.btnSwitch = new Common.UI.Button({ + el: $('#chart-dlg-btn-switch') + }); + // this.btnSwitch.on('click', _.bind(this.onSwitch, this)); + + this.categoryList = new Common.UI.ListView({ + el: $('#chart-dlg-category-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + scrollAlwaysVisible: true, + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '', + '
', + '
<%= Common.Utils.String.htmlEncode(value) %>
', + '
', + '
' + ].join('')) + }); + this.categoryList.on({ + 'item:change': this.onItemChanged.bind(this), + 'item:add': this.onItemChanged.bind(this), + 'item:select': this.onCellCheck.bind(this) + }); + this.categoryList.onKeyDown = _.bind(this.onListKeyDown, this, 'category'); + + this.btnEditCategory = new Common.UI.Button({ + el: $('#chart-dlg-btn-category-edit') + }); + // this.btnEditCategory.on('click', _.bind(this.onEditCategory, this, false)); + this.afterRender(); }, @@ -979,23 +1107,24 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.setTitle((this.isChart) ? this.textTitle : this.textTitleSparkline); if (this.isChart) { - this.btnsCategory[4].setVisible(false); this.btnsCategory[5].setVisible(false); + this.btnsCategory[6].setVisible(false); } else { this.btnsCategory[0].setVisible(false); this.btnsCategory[1].setVisible(false); this.btnsCategory[2].setVisible(false); this.btnsCategory[3].setVisible(false); - this.btnsCategory[6].setVisible(false); + this.btnsCategory[4].setVisible(false); this.btnsCategory[7].setVisible(false); + this.btnsCategory[8].setVisible(false); } if (this.storageName) { var value = Common.localStorage.getItem(this.storageName); this.setActiveCategory((value!==null) ? parseInt(value) : 0); value = this.getActiveCategory(); - if (value==2) this.onVCategoryClick(); - else if (value==3) this.onHCategoryClick(); + if (value==3) this.onVCategoryClick(); + else if (value==4) this.onHCategoryClick(); } }, @@ -1038,8 +1167,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } value = (type == Asc.c_oAscChartTypeSettings.pie || type == Asc.c_oAscChartTypeSettings.doughnut || type == Asc.c_oAscChartTypeSettings.pie3d); - this.btnsCategory[2].setDisabled(value); this.btnsCategory[3].setDisabled(value); + this.btnsCategory[4].setDisabled(value); this.cmbHorShow.setDisabled(value); this.cmbVertShow.setDisabled(value); this.cmbHorTitle.setDisabled(value); @@ -1061,8 +1190,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' value = (type == Asc.c_oAscChartTypeSettings.hBarNormal || type == Asc.c_oAscChartTypeSettings.hBarStacked || type == Asc.c_oAscChartTypeSettings.hBarStackedPer || type == Asc.c_oAscChartTypeSettings.hBarNormal3d || type == Asc.c_oAscChartTypeSettings.hBarStacked3d || type == Asc.c_oAscChartTypeSettings.hBarStackedPer3d); - this.btnsCategory[2].options.contentTarget = (value) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert'; - this.btnsCategory[3].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; + this.btnsCategory[3].options.contentTarget = (value) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert'; + this.btnsCategory[4].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; }, updateDataLabels: function(chartType, labelPos) { @@ -1610,7 +1739,80 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } }, - show: function() { + onItemChanged: function (view, record) { + var state = record.model.get('check'); + if ( state == 'indeterminate' ) + $('input[type=checkbox]', record.$el).prop('indeterminate', true); + else $('input[type=checkbox]', record.$el).prop({checked: state, indeterminate: false}); + }, + + onCellCheck: function (listView, itemView, record) { + if (this.checkCellTrigerBlock) + return; + + var target = '', isLabel = false, bound = null; + + var event = window.event ? window.event : window._event; + if (event) { + target = $(event.currentTarget).find('.list-item'); + + if (target.length) { + bound = target.get(0).getBoundingClientRect(); + var _clientX = event.clientX*Common.Utils.zoom(), + _clientY = event.clientY*Common.Utils.zoom(); + if (bound.left < _clientX && _clientX < bound.right && + bound.top < _clientY && _clientY < bound.bottom) { + isLabel = true; + } + } + + if (isLabel || event.target.className.match('checkbox')) { + this.updateCellCheck(listView, record); + + _.delay(function () { + listView.$el.find('.listview').focus(); + }, 100, this); + } + } + }, + + onListKeyDown: function (type, e, data) { + var record = null, listView = (type=='series') ? this.seriesList : this.categoryList; + + if (listView.disabled) return; + if (_.isUndefined(undefined)) data = e; + + if (data.keyCode == Common.UI.Keys.SPACE) { + data.preventDefault(); + data.stopPropagation(); + + this.updateCellCheck(listView, listView.getSelectedRec()); + } else if (type=='series' && data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { + // this.onDeleteSeries(); + } else { + Common.UI.DataView.prototype.onKeyDown.call(listView, e, data); + } + }, + + updateCellCheck: function (listView, record) { + if (record && listView) { + record.set('check', !record.get('check')); + // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + } + }, + + onSelectSeries: function(lisvView, itemView, record) { + this.updateMoveButtons(); + }, + + updateMoveButtons: function() { + var rec = this.seriesList.getSelectedRec(), + index = rec ? this.seriesList.store.indexOf(rec) : -1; + this.btnUp.setDisabled(index<1); + this.btnDown.setDisabled(index<0 || index==this.seriesList.store.length-1); + }, + + show: function() { Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); var me = this; @@ -1750,7 +1952,16 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textSnap: 'Cell Snapping', textAbsolute: 'Don\'t move or size with cells', textOneCell: 'Move but don\'t size with cells', - textTwoCell: 'Move and size with cells' + textTwoCell: 'Move and size with cells', + textSeries: 'Legend Entries (Series)', + textAdd: 'Add', + textEdit: 'Edit', + textDelete: 'Remove', + textSwitch: 'Switch Row/Column', + textCategory: 'Horizontal (Category) Axis Labels', + textUp: 'Up', + textDown: 'Down', + textData: 'Data' }, SSE.Views.ChartSettingsDlg || {})); }); From 29bb768132547282d01e559dc9a94c070d51e7f0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 2 Jul 2020 18:10:27 +0300 Subject: [PATCH 10/33] [SSE] Chart settings: add dialog for changing series and labels data --- .../main/app/view/ChartDataRangeDialog.js | 222 ++++++++++++++++++ .../main/app/view/ChartSettingsDlg.js | 53 ++++- 2 files changed, 271 insertions(+), 4 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js new file mode 100644 index 000000000..8d83f7075 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -0,0 +1,222 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ChartDataRangeDialog.js + * + * Created by Julia Radzhabova on 02.07.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + + +if (Common === undefined) + var Common = {}; + +define([ + 'common/main/lib/component/InputField', + 'common/main/lib/component/Window' +], function () { 'use strict'; + + SSE.Views.ChartDataRangeDialog = Common.UI.Window.extend(_.extend({ + options: { + type: 0, // 0 - category, 1 - series + width : 350, + cls : 'modal-dlg', + buttons: ['ok', 'cancel'] + }, + + initialize : function(options) { + this.type = options.type || 0; + + _.extend(this.options, { + title: this.type==1 ? this.txtTitleSeries : this.txtTitleCategory + }, options); + + this.template = [ + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '<% if (type==1) { %>', + '', + '', + '', + '', + '', + '', + '', + '<% } %>', + '
', + '', + '
', + '
', + '
', + '', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
' + ].join(''); + + this.options.tpl = _.template(this.template)(this.options); + + Common.UI.Window.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.UI.Window.prototype.render.call(this); + + var $window = this.getChild(), + me = this; + + me.inputRange1 = new Common.UI.InputFieldBtn({ + el: $('#id-dlg-chart-range-range1'), + style: '100%', + textSelectData: 'Select data', + validateOnChange: true, + validateOnBlur: false + }).on('changed:after', function(input, newValue, oldValue, e) { + }).on('changing', function(input, newValue, oldValue, e) { + if (newValue == oldValue) return; + // me.onInputChanging(input, newValue, oldValue); + }).on('button:click', _.bind(this.onSelectData, this)); + this.lblRange1 = $window.find('#id-dlg-chart-range-lbl1'); + + me.inputRange2 = new Common.UI.InputFieldBtn({ + el: $('#id-dlg-chart-range-range2'), + style: '100%', + textSelectData: 'Select data', + validateOnChange: true, + validateOnBlur: false + }).on('changed:after', function(input, newValue, oldValue, e) { + }).on('changing', function(input, newValue, oldValue, e) { + if (newValue == oldValue) return; + // me.onInputChanging(input, newValue, oldValue); + }).on('button:click', _.bind(this.onSelectData, this)); + this.lblRange2 = $window.find('#id-dlg-chart-range-lbl2'); + + $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + + _.defer(function(){ + me.inputRange1.cmpEl.find('input').focus(); + }, 10); + }, + + onPrimary: function() { + this._handleInput('ok'); + return false; + }, + + setSettings: function(settings) { + var me = this; + this.api = settings.api; + }, + + getSettings: function () { + return {name: this.inputRange1.getValue(), value: this.inputRange2.getValue()}; + }, + + onSelectData: function(input) { + var me = this; + if (me.api) { + var changedValue = input.getValue(); + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + changedValue = dlg.getSettings(); + } + }; + + var win = new SSE.Views.CellRangeDialog({ + allowBlank: true, + handler: handlerDlg + }).on('close', function() { + input.setValue(changedValue); + // me.onInputChanging(input); + me.show(); + _.delay(function(){ + me._noApply = true; + input.cmpEl.find('input').focus(); + me._noApply = false; + },1); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 65, xy.top + 77); + win.setSettings({ + api : me.api, + range : !_.isEmpty(input.getValue()) ? input.getValue() : '', + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + }, + + onBtnClick: function(event) { + this._handleInput(event.currentTarget.attributes['result'].value); + }, + + _handleInput: function(state) { + if (this.options.handler) { + if (state == 'ok') { + if (this.inputRange1.checkValidate() !== true) + return; + if (type==1 && this.inputRange2.checkValidate() !== true) + return; + } + if (this.options.handler.call(this, this, state)) + return; + } + + this.close(); + }, + + txtTitleSeries: 'Edit Series', + txtTitleCategory: 'Axis Labels', + txtSeriesName: 'Series name', + txtValues: 'Values', + txtAxisLabel: 'Axis label range', + txtChoose: 'Choose range', + textSelectData: 'Select data', + txtEmpty : 'This field is required', + txtInvalidRange: 'ERROR! Invalid cells range' + }, SSE.Views.ChartDataRangeDialog || {})) +}); diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index f981fa73e..4c65ee531 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -43,7 +43,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' 'common/main/lib/component/ListView', 'common/main/lib/component/CheckBox', 'common/main/lib/component/InputField', - 'spreadsheeteditor/main/app/view/CellRangeDialog' + 'spreadsheeteditor/main/app/view/CellRangeDialog', + 'spreadsheeteditor/main/app/view/ChartDataRangeDialog' ], function (contentTemplate) { 'use strict'; @@ -1035,7 +1036,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnAdd = new Common.UI.Button({ el: $('#chart-dlg-btn-add') }); - // this.btnAdd.on('click', _.bind(this.onAddSeries, this, false)); + this.btnAdd.on('click', _.bind(this.onAddSeries, this, false)); this.btnDelete = new Common.UI.Button({ el: $('#chart-dlg-btn-delete') @@ -1045,7 +1046,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnEdit = new Common.UI.Button({ el: $('#chart-dlg-btn-edit') }); - // this.btnEdit.on('click', _.bind(this.onEditSeries, this, false)); + this.btnEdit.on('click', _.bind(this.onEditSeries, this, false)); this.btnUp = new Common.UI.Button({ parentEl: $('#chart-dlg-btn-up'), @@ -1096,7 +1097,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnEditCategory = new Common.UI.Button({ el: $('#chart-dlg-btn-category-edit') }); - // this.btnEditCategory.on('click', _.bind(this.onEditCategory, this, false)); + this.btnEditCategory.on('click', _.bind(this.onEditCategory, this, false)); this.afterRender(); }, @@ -1812,6 +1813,50 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnDown.setDisabled(index<0 || index==this.seriesList.store.length-1); }, + onAddSeries: function() { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(1, true, handlerDlg); + }, + + onEditSeries: function() { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(1, false, handlerDlg); + }, + + onEditCategory: function() { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(0, false, handlerDlg); + }, + + changeDataRange: function(type, add, handlerDlg) { + var me = this; + var win = new SSE.Views.ChartDataRangeDialog({ + type: type, //series + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api + }); + }, + show: function() { Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); From 9f51fc7761865c839c4029b52e3cc439066d1f7b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 6 Jul 2020 20:01:11 +0300 Subject: [PATCH 11/33] Revert rev. fb683cb086f9397e875dd2ee91d8dbe45aa4e53f [fb683cb] [SSE] Change chart settings: for Bug 43763 --- .../app/template/ChartSettingsDlg.template | 44 +-- .../main/app/view/ChartSettingsDlg.js | 279 +----------------- 2 files changed, 17 insertions(+), 306 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template b/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template index 780d9ec95..afad9d985 100644 --- a/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template +++ b/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template @@ -9,57 +9,23 @@
-
-
+
- - - - - - - - - - - - - - - - - -
- +
-
-
- -
-
- - - -
-
-
-
-
- +
- -
-
- + +
diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index 4c65ee531..11c552409 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -40,7 +40,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template', 'common/main/lib/view/AdvancedSettingsWindow', - 'common/main/lib/component/ListView', 'common/main/lib/component/CheckBox', 'common/main/lib/component/InputField', 'spreadsheeteditor/main/app/view/CellRangeDialog', @@ -48,27 +47,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' ], function (contentTemplate) { 'use strict'; - var _CustomItem = Common.UI.DataViewItem.extend({ - initialize : function(options) { - Common.UI.BaseView.prototype.initialize.call(this, options); - - var me = this; - - me.template = me.options.template || me.template; - - me.listenTo(me.model, 'change:sort', function() { - me.render(); - me.trigger('change', me, me.model); - }); - me.listenTo(me.model, 'change:selected', function() { - var el = me.$el || $(me.el); - el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); - me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); - }); - me.listenTo(me.model, 'remove', me.remove); - } - }); - SSE.Views.ChartSettingsDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 322, @@ -81,8 +59,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' _.extend(this.options, { title: this.textTitle, items: [ - {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textType}, - {panelId: 'id-chart-settings-dlg-data', panelCaption: this.textData}, + {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textTypeData}, {panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout}, {panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis}, {panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis}, @@ -752,8 +729,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } }, this)); - this.btnsCategory[3].on('click', _.bind(this.onVCategoryClick, this)); - this.btnsCategory[4].on('click', _.bind(this.onHCategoryClick, this)); + this.btnsCategory[2].on('click', _.bind(this.onVCategoryClick, this)); + this.btnsCategory[3].on('click', _.bind(this.onHCategoryClick, this)); // Sparklines this.btnSparkType = new Common.UI.Button({ @@ -994,111 +971,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' me.isAltDescChanged = true; }); - // Chart data - this.seriesList = new Common.UI.ListView({ - el: $('#chart-dlg-series-list', this.$window), - store: new Common.UI.DataViewStore(), - emptyText: '', - scrollAlwaysVisible: true, - template: _.template(['
'].join('')), - itemTemplate: _.template([ - '
', - '', - '
', - '
<%= Common.Utils.String.htmlEncode(value) %>
', - '
', - '
' - ].join('')) - }); - this.seriesList.createNewItem = function(record) { - return new _CustomItem({ - template: this.itemTemplate, - model: record - }); - }; - this.seriesList.on({ - 'item:change': this.onItemChanged.bind(this), - 'item:add': this.onItemChanged.bind(this), - 'item:select': this.onCellCheck.bind(this) - }); - this.seriesList.onKeyDown = _.bind(this.onListKeyDown, this, 'series'); - this.seriesList.createNewItem = function(record) { - return new _CustomItem({ - template: this.itemTemplate, - model: record - }); - }; - this.seriesList.on('item:select', _.bind(this.onSelectSeries, this)); - - this.btnAdd = new Common.UI.Button({ - el: $('#chart-dlg-btn-add') - }); - this.btnAdd.on('click', _.bind(this.onAddSeries, this, false)); - - this.btnDelete = new Common.UI.Button({ - el: $('#chart-dlg-btn-delete') - }); - // this.btnDelete.on('click', _.bind(this.onDeleteSeries, this)); - - this.btnEdit = new Common.UI.Button({ - el: $('#chart-dlg-btn-edit') - }); - this.btnEdit.on('click', _.bind(this.onEditSeries, this, false)); - - this.btnUp = new Common.UI.Button({ - parentEl: $('#chart-dlg-btn-up'), - cls: 'btn-toolbar', - iconCls: 'caret-up', - hint: this.textUp - }); - // this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); - - this.btnDown = new Common.UI.Button({ - parentEl: $('#chart-dlg-btn-down'), - cls: 'btn-toolbar', - iconCls: 'caret-down', - hint: this.textDown - }); - // this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); - - this.btnSwitch = new Common.UI.Button({ - el: $('#chart-dlg-btn-switch') - }); - // this.btnSwitch.on('click', _.bind(this.onSwitch, this)); - - this.categoryList = new Common.UI.ListView({ - el: $('#chart-dlg-category-list', this.$window), - store: new Common.UI.DataViewStore(), - emptyText: '', - scrollAlwaysVisible: true, - template: _.template(['
'].join('')), - itemTemplate: _.template([ - '
', - '', - '
', - '
<%= Common.Utils.String.htmlEncode(value) %>
', - '
', - '
' - ].join('')) - }); - this.categoryList.on({ - 'item:change': this.onItemChanged.bind(this), - 'item:add': this.onItemChanged.bind(this), - 'item:select': this.onCellCheck.bind(this) - }); - this.categoryList.onKeyDown = _.bind(this.onListKeyDown, this, 'category'); - - this.btnEditCategory = new Common.UI.Button({ - el: $('#chart-dlg-btn-category-edit') - }); - this.btnEditCategory.on('click', _.bind(this.onEditCategory, this, false)); - this.afterRender(); }, @@ -1108,24 +980,23 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.setTitle((this.isChart) ? this.textTitle : this.textTitleSparkline); if (this.isChart) { + this.btnsCategory[4].setVisible(false); this.btnsCategory[5].setVisible(false); - this.btnsCategory[6].setVisible(false); } else { this.btnsCategory[0].setVisible(false); this.btnsCategory[1].setVisible(false); this.btnsCategory[2].setVisible(false); this.btnsCategory[3].setVisible(false); - this.btnsCategory[4].setVisible(false); + this.btnsCategory[6].setVisible(false); this.btnsCategory[7].setVisible(false); - this.btnsCategory[8].setVisible(false); } if (this.storageName) { var value = Common.localStorage.getItem(this.storageName); this.setActiveCategory((value!==null) ? parseInt(value) : 0); value = this.getActiveCategory(); - if (value==3) this.onVCategoryClick(); - else if (value==4) this.onHCategoryClick(); + if (value==2) this.onVCategoryClick(); + else if (value==3) this.onHCategoryClick(); } }, @@ -1168,8 +1039,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } value = (type == Asc.c_oAscChartTypeSettings.pie || type == Asc.c_oAscChartTypeSettings.doughnut || type == Asc.c_oAscChartTypeSettings.pie3d); + this.btnsCategory[2].setDisabled(value); this.btnsCategory[3].setDisabled(value); - this.btnsCategory[4].setDisabled(value); this.cmbHorShow.setDisabled(value); this.cmbVertShow.setDisabled(value); this.cmbHorTitle.setDisabled(value); @@ -1191,8 +1062,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' value = (type == Asc.c_oAscChartTypeSettings.hBarNormal || type == Asc.c_oAscChartTypeSettings.hBarStacked || type == Asc.c_oAscChartTypeSettings.hBarStackedPer || type == Asc.c_oAscChartTypeSettings.hBarNormal3d || type == Asc.c_oAscChartTypeSettings.hBarStacked3d || type == Asc.c_oAscChartTypeSettings.hBarStackedPer3d); - this.btnsCategory[3].options.contentTarget = (value) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert'; - this.btnsCategory[4].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; + this.btnsCategory[2].options.contentTarget = (value) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert'; + this.btnsCategory[3].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; }, updateDataLabels: function(chartType, labelPos) { @@ -1740,124 +1611,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } }, - onItemChanged: function (view, record) { - var state = record.model.get('check'); - if ( state == 'indeterminate' ) - $('input[type=checkbox]', record.$el).prop('indeterminate', true); - else $('input[type=checkbox]', record.$el).prop({checked: state, indeterminate: false}); - }, - - onCellCheck: function (listView, itemView, record) { - if (this.checkCellTrigerBlock) - return; - - var target = '', isLabel = false, bound = null; - - var event = window.event ? window.event : window._event; - if (event) { - target = $(event.currentTarget).find('.list-item'); - - if (target.length) { - bound = target.get(0).getBoundingClientRect(); - var _clientX = event.clientX*Common.Utils.zoom(), - _clientY = event.clientY*Common.Utils.zoom(); - if (bound.left < _clientX && _clientX < bound.right && - bound.top < _clientY && _clientY < bound.bottom) { - isLabel = true; - } - } - - if (isLabel || event.target.className.match('checkbox')) { - this.updateCellCheck(listView, record); - - _.delay(function () { - listView.$el.find('.listview').focus(); - }, 100, this); - } - } - }, - - onListKeyDown: function (type, e, data) { - var record = null, listView = (type=='series') ? this.seriesList : this.categoryList; - - if (listView.disabled) return; - if (_.isUndefined(undefined)) data = e; - - if (data.keyCode == Common.UI.Keys.SPACE) { - data.preventDefault(); - data.stopPropagation(); - - this.updateCellCheck(listView, listView.getSelectedRec()); - } else if (type=='series' && data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { - // this.onDeleteSeries(); - } else { - Common.UI.DataView.prototype.onKeyDown.call(listView, e, data); - } - }, - - updateCellCheck: function (listView, record) { - if (record && listView) { - record.set('check', !record.get('check')); - // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); - } - }, - - onSelectSeries: function(lisvView, itemView, record) { - this.updateMoveButtons(); - }, - - updateMoveButtons: function() { - var rec = this.seriesList.getSelectedRec(), - index = rec ? this.seriesList.store.indexOf(rec) : -1; - this.btnUp.setDisabled(index<1); - this.btnDown.setDisabled(index<0 || index==this.seriesList.store.length-1); - }, - - onAddSeries: function() { - var handlerDlg = function(dlg, result) { - if (result == 'ok') { - var changedValue = dlg.getSettings(); - } - }; - this.changeDataRange(1, true, handlerDlg); - }, - - onEditSeries: function() { - var handlerDlg = function(dlg, result) { - if (result == 'ok') { - var changedValue = dlg.getSettings(); - } - }; - this.changeDataRange(1, false, handlerDlg); - }, - - onEditCategory: function() { - var handlerDlg = function(dlg, result) { - if (result == 'ok') { - var changedValue = dlg.getSettings(); - } - }; - this.changeDataRange(0, false, handlerDlg); - }, - - changeDataRange: function(type, add, handlerDlg) { - var me = this; - var win = new SSE.Views.ChartDataRangeDialog({ - type: type, //series - handler: handlerDlg - }).on('close', function() { - me.show(); - }); - - var xy = me.$window.offset(); - me.hide(); - win.show(xy.left + 160, xy.top + 125); - win.setSettings({ - api : me.api - }); - }, - - show: function() { + show: function() { Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); var me = this; @@ -1997,16 +1751,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textSnap: 'Cell Snapping', textAbsolute: 'Don\'t move or size with cells', textOneCell: 'Move but don\'t size with cells', - textTwoCell: 'Move and size with cells', - textSeries: 'Legend Entries (Series)', - textAdd: 'Add', - textEdit: 'Edit', - textDelete: 'Remove', - textSwitch: 'Switch Row/Column', - textCategory: 'Horizontal (Category) Axis Labels', - textUp: 'Up', - textDown: 'Down', - textData: 'Data' + textTwoCell: 'Move and size with cells' }, SSE.Views.ChartSettingsDlg || {})); }); From 2e6b31da93ce23472b8f3daa54750a98798b5f5f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Jul 2020 11:45:45 +0300 Subject: [PATCH 12/33] [SSE] Add dialog for selecting chart data --- .../main/app/view/ChartDataDialog.js | 585 ++++++++++++++++++ .../main/app/view/ChartSettings.js | 29 +- 2 files changed, 611 insertions(+), 3 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/view/ChartDataDialog.js diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js new file mode 100644 index 000000000..b1af4167a --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -0,0 +1,585 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * ChartDataDialog.js + * + * Created by Julia Radzhabova on 06.07.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/ListView', + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + var _CustomItem = Common.UI.DataViewItem.extend({ + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + me.template = me.options.template || me.template; + + me.listenTo(me.model, 'change:sort', function() { + me.render(); + me.trigger('change', me, me.model); + }); + me.listenTo(me.model, 'change:selected', function() { + var el = me.$el || $(me.el); + el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); + me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); + }); + me.listenTo(me.model, 'remove', me.remove); + } + }); + + SSE.Views.ChartDataDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 370, + height: 490, + buttons: null + }, + + initialize : function(options) { + var me = this; + + _.extend(this.options, { + title: this.textTitle, + template: [ + '
', + '
', + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '', + '', + '', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '' + ].join('') + }, options); + + this.handler = options.handler; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + + this._noApply = true; + this._changedProps = null; + + this.api = this.options.api; + this.chartSettings = this.options.chartSettings; + this.dataRangeValid = ''; + this.dataDirect = 0; + this.currentChartType = Asc.c_oAscChartTypeSettings.barNormal; + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + this.txtDataRange = new Common.UI.InputFieldBtn({ + el : $('#chart-dlg-txt-range'), + name : 'range', + style : 'width: 100%;', + btnHint : this.textSelectData, + allowBlank : true, + validateOnChange: true + }); + this.txtDataRange.on('button:click', _.bind(this.onSelectData_simple, this)); + this.txtDataRange.on('changed:after', function(input, newValue, oldValue, e) { + if (newValue !==me.dataRangeValid) { + if (me.isRangeValid()) { + me.dataRangeValid = newValue; + me.txtDataRange.checkValidate(); + me.chartSettings.putRange(me.dataRangeValid); + me.api.asc_editChartDrawingObject(me.chartSettings); + } else { + me.txtDataRange.setValue(me.dataRangeValid); + me.txtDataRange.checkValidate(); + } + } + }); + + // Chart data + this.seriesList = new Common.UI.ListView({ + el: $('#chart-dlg-series-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + scrollAlwaysVisible: true, + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '', + '
', + '
<%= Common.Utils.String.htmlEncode(value) %>
', + '
', + '
' + ].join('')) + }); + this.seriesList.createNewItem = function(record) { + return new _CustomItem({ + template: this.itemTemplate, + model: record + }); + }; + this.seriesList.on({ + 'item:change': this.onItemChanged.bind(this), + 'item:add': this.onItemChanged.bind(this), + 'item:select': this.onCellCheck.bind(this) + }); + this.seriesList.onKeyDown = _.bind(this.onListKeyDown, this, 'series'); + this.seriesList.createNewItem = function(record) { + return new _CustomItem({ + template: this.itemTemplate, + model: record + }); + }; + this.seriesList.on('item:select', _.bind(this.onSelectSeries, this)); + + this.btnAdd = new Common.UI.Button({ + el: $('#chart-dlg-btn-add') + }); + this.btnAdd.on('click', _.bind(this.onAddSeries, this, false)); + + this.btnDelete = new Common.UI.Button({ + el: $('#chart-dlg-btn-delete') + }); + // this.btnDelete.on('click', _.bind(this.onDeleteSeries, this)); + + this.btnEdit = new Common.UI.Button({ + el: $('#chart-dlg-btn-edit') + }); + this.btnEdit.on('click', _.bind(this.onEditSeries, this, false)); + + this.btnUp = new Common.UI.Button({ + parentEl: $('#chart-dlg-btn-up'), + cls: 'btn-toolbar', + iconCls: 'caret-up', + hint: this.textUp + }); + // this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); + + this.btnDown = new Common.UI.Button({ + parentEl: $('#chart-dlg-btn-down'), + cls: 'btn-toolbar', + iconCls: 'caret-down', + hint: this.textDown + }); + // this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); + + this.btnSwitch = new Common.UI.Button({ + el: $('#chart-dlg-btn-switch') + }); + // this.btnSwitch.on('click', _.bind(this.onSwitch, this)); + + this.categoryList = new Common.UI.ListView({ + el: $('#chart-dlg-category-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + scrollAlwaysVisible: true, + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '', + '
', + '
<%= Common.Utils.String.htmlEncode(value) %>
', + '
', + '
' + ].join('')) + }); + this.categoryList.on({ + 'item:change': this.onItemChanged.bind(this), + 'item:add': this.onItemChanged.bind(this), + 'item:select': this.onCellCheck.bind(this) + }); + this.categoryList.onKeyDown = _.bind(this.onListKeyDown, this, 'category'); + + this.btnEditCategory = new Common.UI.Button({ + el: $('#chart-dlg-btn-category-edit') + }); + this.btnEditCategory.on('click', _.bind(this.onEditCategory, this, false)); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(this.chartSettings); + }, + + show: function() { + Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); + + var me = this; + _.delay(function(){ + me.txtDataRange.cmpEl.find('input').focus(); + },50); + }, + + close: function () { + this.api.asc_onCloseChartFrame(); + Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments); + }, + + _setDefaults: function (props) { + var me = this; + if (props ){ + this.chartSettings = props; + + this.currentChartType = props.getType(); + + var value = props.getRange(); + this.txtDataRange.setValue((value) ? value : ''); + this.dataRangeValid = value; + + this.txtDataRange.validation = function(value) { + if (_.isEmpty(value)) { + return true; + } + + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + }; + + this.dataDirect = props.getInColumns() ? 1 : 0; + } + }, + + getSettings: function () { + this.chartSettings.putRange(this.txtDataRange.getValue()); + return { chartSettings: this.chartSettings}; + }, + + onDlgBtnClick: function(event) { + var me = this; + var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; + if (state == 'ok') { + this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined); + } + + this.close(); + }, + + onPrimary: function() { + this.onDlgBtnClick('ok'); + return false; + }, + + isRangeValid: function() { + var isvalid; + if (!_.isEmpty(this.txtDataRange.getValue())) { + isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.dataDirect===0, this.currentChartType); + if (isvalid == Asc.c_oAscError.ID.No) + return true; + } else + return true; + + if (isvalid == Asc.c_oAscError.ID.StockChartError) { + Common.UI.warning({msg: this.errorStockChart}); + } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { + Common.UI.warning({msg: this.errorMaxRows}); + } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) + Common.UI.warning({msg: this.errorMaxPoints}); + else + this.txtDataRange.cmpEl.find('input').focus(); + return false; + }, + + onSelectData_simple: function() { + var me = this; + if (me.api) { + var props = me.chartSettings; + var handlerDlg = function(dlg, result) { + if (result == 'ok' && me.isRangeValid()) { + me.dataRangeValid = dlg.getSettings(); + me.txtDataRange.setValue(me.dataRangeValid); + me.txtDataRange.checkValidate(); + props.putRange(me.dataRangeValid); + me.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); + me.api.asc_editChartDrawingObject(props); + } + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api, + range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid, + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + }, + + onSelectData: function() { + var me = this; + if (me.api) { + var props = me.chartSettings, + handlerDlg = function(dlg, result) { + if (result == 'ok' && me.isRangeValid()) { + props.putRange(dlg.getSettings()); + me.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); + me.api.asc_editChartDrawingObject(props); + } + }, + validation = function(value) { + var isvalid; + if (!_.isEmpty(value)) { + isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, true, !props.getInColumns(), me.currentChartType); + if (isvalid == Asc.c_oAscError.ID.No) + return true; + } else return ''; + + if (isvalid == Asc.c_oAscError.ID.StockChartError) { + return this.errorStockChart; + } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { + return this.errorMaxRows; + } + return this.txtInvalidRange; + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + me.show(); + // me.api.asc_onCloseChartFrame(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api, + range : props.getRange(), + validation: validation, + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + }, + + onItemChanged: function (view, record) { + var state = record.model.get('check'); + if ( state == 'indeterminate' ) + $('input[type=checkbox]', record.$el).prop('indeterminate', true); + else $('input[type=checkbox]', record.$el).prop({checked: state, indeterminate: false}); + }, + + onCellCheck: function (listView, itemView, record) { + if (this.checkCellTrigerBlock) + return; + + var target = '', isLabel = false, bound = null; + + var event = window.event ? window.event : window._event; + if (event) { + target = $(event.currentTarget).find('.list-item'); + + if (target.length) { + bound = target.get(0).getBoundingClientRect(); + var _clientX = event.clientX*Common.Utils.zoom(), + _clientY = event.clientY*Common.Utils.zoom(); + if (bound.left < _clientX && _clientX < bound.right && + bound.top < _clientY && _clientY < bound.bottom) { + isLabel = true; + } + } + + if (isLabel || event.target.className.match('checkbox')) { + this.updateCellCheck(listView, record); + + _.delay(function () { + listView.$el.find('.listview').focus(); + }, 100, this); + } + } + }, + + onListKeyDown: function (type, e, data) { + var record = null, listView = (type=='series') ? this.seriesList : this.categoryList; + + if (listView.disabled) return; + if (_.isUndefined(undefined)) data = e; + + if (data.keyCode == Common.UI.Keys.SPACE) { + data.preventDefault(); + data.stopPropagation(); + + this.updateCellCheck(listView, listView.getSelectedRec()); + } else if (type=='series' && data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { + // this.onDeleteSeries(); + } else { + Common.UI.DataView.prototype.onKeyDown.call(listView, e, data); + } + }, + + updateCellCheck: function (listView, record) { + if (record && listView) { + record.set('check', !record.get('check')); + // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + } + }, + + onSelectSeries: function(lisvView, itemView, record) { + this.updateMoveButtons(); + }, + + updateMoveButtons: function() { + var rec = this.seriesList.getSelectedRec(), + index = rec ? this.seriesList.store.indexOf(rec) : -1; + this.btnUp.setDisabled(index<1); + this.btnDown.setDisabled(index<0 || index==this.seriesList.store.length-1); + }, + + onAddSeries: function() { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(1, true, handlerDlg); + }, + + onEditSeries: function() { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(1, false, handlerDlg); + }, + + onEditCategory: function() { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(0, false, handlerDlg); + }, + + changeDataRange: function(type, add, handlerDlg) { + var me = this; + var win = new SSE.Views.ChartDataRangeDialog({ + type: type, //series + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api + }); + }, + + textTitle: 'Chart Data', + txtEmpty: 'This field is required', + textInvalidRange: 'ERROR! Invalid cells range', + textSelectData: 'Select data', + errorMaxRows: 'ERROR! The maximum number of data series per chart is 255.', + errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', + errorMaxPoints: 'ERROR! The maximum number of points in series per chart is 4096.', + textSeries: 'Legend Entries (Series)', + textAdd: 'Add', + textEdit: 'Edit', + textDelete: 'Remove', + textSwitch: 'Switch Row/Column', + textCategory: 'Horizontal (Category) Axis Labels', + textUp: 'Up', + textDown: 'Down', + textData: 'Data' + }, SSE.Views.ChartDataDialog || {})) +}); diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 831622d30..0afbfdec4 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -46,7 +46,8 @@ define([ 'common/main/lib/component/Button', 'common/main/lib/component/MetricSpinner', 'common/main/lib/component/ComboDataView', - 'spreadsheeteditor/main/app/view/ChartSettingsDlg' + 'spreadsheeteditor/main/app/view/ChartSettingsDlg', + 'spreadsheeteditor/main/app/view/ChartDataDialog' ], function (menuTemplate, $, _, Backbone) { 'use strict'; @@ -851,7 +852,7 @@ define([ } }, - onSelectData: function() { + onSelectData_simple: function() { var me = this; if (me.api) { var props = me.api.asc_getChartObject(), @@ -895,7 +896,29 @@ define([ }); } }, - + + onSelectData: function() { + var me = this; + var win, props; + if (me.api){ + props = me.api.asc_getChartObject(); + if (props) { + (new SSE.Views.ChartDataDialog( + { + chartSettings: props, + api: me.api, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + } + } + Common.NotificationCenter.trigger('edit:complete', me); + } + })).show(); + } + } + }, + onSelectType: function(btn, picker, itemView, record) { if (this._noApply) return; From 6dc0054f77f11c77822dcdc360589802aa62fd49 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Jul 2020 12:32:59 +0300 Subject: [PATCH 13/33] [SSE] Refactoring chart data dialog --- .../main/app/view/ChartDataDialog.js | 122 +----------------- 1 file changed, 3 insertions(+), 119 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index b1af4167a..5868d023f 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -47,27 +47,6 @@ define([ 'common/main/lib/view/AdvancedSettingsWindow' ], function () { 'use strict'; - var _CustomItem = Common.UI.DataViewItem.extend({ - initialize : function(options) { - Common.UI.BaseView.prototype.initialize.call(this, options); - - var me = this; - - me.template = me.options.template || me.template; - - me.listenTo(me.model, 'change:sort', function() { - me.render(); - me.trigger('change', me, me.model); - }); - me.listenTo(me.model, 'change:selected', function() { - var el = me.$el || $(me.el); - el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); - me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); - }); - me.listenTo(me.model, 'remove', me.remove); - } - }); - SSE.Views.ChartDataDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 370, @@ -185,38 +164,9 @@ define([ el: $('#chart-dlg-series-list', this.$window), store: new Common.UI.DataViewStore(), emptyText: '', - scrollAlwaysVisible: true, - template: _.template(['
'].join('')), - itemTemplate: _.template([ - '
', - '', - '
', - '
<%= Common.Utils.String.htmlEncode(value) %>
', - '
', - '
' - ].join('')) - }); - this.seriesList.createNewItem = function(record) { - return new _CustomItem({ - template: this.itemTemplate, - model: record - }); - }; - this.seriesList.on({ - 'item:change': this.onItemChanged.bind(this), - 'item:add': this.onItemChanged.bind(this), - 'item:select': this.onCellCheck.bind(this) + scrollAlwaysVisible: true }); this.seriesList.onKeyDown = _.bind(this.onListKeyDown, this, 'series'); - this.seriesList.createNewItem = function(record) { - return new _CustomItem({ - template: this.itemTemplate, - model: record - }); - }; this.seriesList.on('item:select', _.bind(this.onSelectSeries, this)); this.btnAdd = new Common.UI.Button({ @@ -259,24 +209,7 @@ define([ el: $('#chart-dlg-category-list', this.$window), store: new Common.UI.DataViewStore(), emptyText: '', - scrollAlwaysVisible: true, - template: _.template(['
'].join('')), - itemTemplate: _.template([ - '
', - '', - '
', - '
<%= Common.Utils.String.htmlEncode(value) %>
', - '
', - '
' - ].join('')) - }); - this.categoryList.on({ - 'item:change': this.onItemChanged.bind(this), - 'item:add': this.onItemChanged.bind(this), - 'item:select': this.onCellCheck.bind(this) + scrollAlwaysVisible: true }); this.categoryList.onKeyDown = _.bind(this.onListKeyDown, this, 'category'); @@ -448,68 +381,19 @@ define([ } }, - onItemChanged: function (view, record) { - var state = record.model.get('check'); - if ( state == 'indeterminate' ) - $('input[type=checkbox]', record.$el).prop('indeterminate', true); - else $('input[type=checkbox]', record.$el).prop({checked: state, indeterminate: false}); - }, - - onCellCheck: function (listView, itemView, record) { - if (this.checkCellTrigerBlock) - return; - - var target = '', isLabel = false, bound = null; - - var event = window.event ? window.event : window._event; - if (event) { - target = $(event.currentTarget).find('.list-item'); - - if (target.length) { - bound = target.get(0).getBoundingClientRect(); - var _clientX = event.clientX*Common.Utils.zoom(), - _clientY = event.clientY*Common.Utils.zoom(); - if (bound.left < _clientX && _clientX < bound.right && - bound.top < _clientY && _clientY < bound.bottom) { - isLabel = true; - } - } - - if (isLabel || event.target.className.match('checkbox')) { - this.updateCellCheck(listView, record); - - _.delay(function () { - listView.$el.find('.listview').focus(); - }, 100, this); - } - } - }, - onListKeyDown: function (type, e, data) { var record = null, listView = (type=='series') ? this.seriesList : this.categoryList; if (listView.disabled) return; if (_.isUndefined(undefined)) data = e; - if (data.keyCode == Common.UI.Keys.SPACE) { - data.preventDefault(); - data.stopPropagation(); - - this.updateCellCheck(listView, listView.getSelectedRec()); - } else if (type=='series' && data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { + if (type=='series' && data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { // this.onDeleteSeries(); } else { Common.UI.DataView.prototype.onKeyDown.call(listView, e, data); } }, - updateCellCheck: function (listView, record) { - if (record && listView) { - record.set('check', !record.get('check')); - // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); - } - }, - onSelectSeries: function(lisvView, itemView, record) { this.updateMoveButtons(); }, From 0e492b61344f4b8ad7fd7a71425fed2896578fed Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Jul 2020 15:07:15 +0300 Subject: [PATCH 14/33] [SSE] Show chart data settings --- .../main/app/view/ChartDataDialog.js | 125 ++++++++++++++++-- .../main/app/view/ChartDataRangeDialog.js | 49 ++++++- 2 files changed, 160 insertions(+), 14 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 5868d023f..63af5abd3 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -86,7 +86,7 @@ define([ '', '', '
', - '
', + '
', '
', '
', '', @@ -168,6 +168,9 @@ define([ }); this.seriesList.onKeyDown = _.bind(this.onListKeyDown, this, 'series'); this.seriesList.on('item:select', _.bind(this.onSelectSeries, this)); + this.seriesList.store.comparator = function(rec) { + return rec.get("order"); + }; this.btnAdd = new Common.UI.Button({ el: $('#chart-dlg-btn-add') @@ -177,7 +180,7 @@ define([ this.btnDelete = new Common.UI.Button({ el: $('#chart-dlg-btn-delete') }); - // this.btnDelete.on('click', _.bind(this.onDeleteSeries, this)); + this.btnDelete.on('click', _.bind(this.onDeleteSeries, this)); this.btnEdit = new Common.UI.Button({ el: $('#chart-dlg-btn-edit') @@ -190,7 +193,7 @@ define([ iconCls: 'caret-up', hint: this.textUp }); - // this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); + this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); this.btnDown = new Common.UI.Button({ parentEl: $('#chart-dlg-btn-down'), @@ -198,7 +201,7 @@ define([ iconCls: 'caret-down', hint: this.textDown }); - // this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); + this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); this.btnSwitch = new Common.UI.Button({ el: $('#chart-dlg-btn-switch') @@ -260,7 +263,25 @@ define([ }; this.dataDirect = props.getInColumns() ? 1 : 0; + + this.updateSeriesList(props.getSeries(), 0); + + var categories = props.getCatValues(), + arr = []; + var store = this.categoryList.store; + for (var i = 0, len = categories.length; i < len; i++) + { + var item = categories[i], + rec = new Common.UI.DataViewModel(); + rec.set({ + value: item + }); + arr.push(rec); + } + store.reset(arr); + (len>0) && this.categoryList.selectByIndex(0); } + this.updateButtons(); }, getSettings: function () { @@ -398,6 +419,17 @@ define([ this.updateMoveButtons(); }, + updateButtons: function() { + // this.btnAdd.setDisabled(this.seriesList.store.length>63); + this.btnEdit.setDisabled(this.seriesList.store.length<1); + this.btnDelete.setDisabled(this.seriesList.store.length<1); + this.updateMoveButtons(); + }, + + updateCatButtons: function() { + this.btnEditCategory.setDisabled(this.categoryList.store.length<1); + }, + updateMoveButtons: function() { var rec = this.seriesList.getSelectedRec(), index = rec ? this.seriesList.store.indexOf(rec) : -1; @@ -406,21 +438,47 @@ define([ }, onAddSeries: function() { + var rec = (this.seriesList.store.length>0) ? this.seriesList.store.at(this.seriesList.store.length-1) : null, + isScatter = false; + rec && (isScatter = rec.get('series').asc_IsScatter()); var handlerDlg = function(dlg, result) { if (result == 'ok') { var changedValue = dlg.getSettings(); + if (isScatter) { + this.chartSettings.addScatterSeries(changedValue.name, changedValue.valuesX, changedValue.valuesY); + } else { + this.chartSettings.addSeries(changedValue.name, changedValue.values); + } + this.updateSeriesList(this.chartSettings.getSeries(), this.seriesList.store.length-1); + this.updateButtons(); } }; - this.changeDataRange(1, true, handlerDlg); + this.changeDataRange(1, {isScatter: isScatter}, true, handlerDlg); + }, + + onDeleteSeries: function() { + var rec = this.seriesList.getSelectedRec(); + if (rec) { + var order = rec.get('order'); + // this.chartSettings.deleteSeries(rec.get('index')); + this.updateSeriesList(this.chartSettings.getSeries(), order); + } + this.updateButtons(); }, onEditSeries: function() { - var handlerDlg = function(dlg, result) { - if (result == 'ok') { - var changedValue = dlg.getSettings(); - } - }; - this.changeDataRange(1, false, handlerDlg); + var rec = this.seriesList.getSelectedRec(); + if (rec) { + var series = rec.get('series'), + isScatter = series.asc_IsScatter(); + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var changedValue = dlg.getSettings(); + } + }; + this.changeDataRange(1, {series: series, name: series.asc_getName(), isScatter: isScatter, values: isScatter ? null : series.asc_getValues(), + valuesX: !isScatter ? null : series.asc_getXValues(), valuesY: !isScatter ? null : series.asc_getYValues() }, false, handlerDlg); + } }, onEditCategory: function() { @@ -432,10 +490,11 @@ define([ this.changeDataRange(0, false, handlerDlg); }, - changeDataRange: function(type, add, handlerDlg) { + changeDataRange: function(type, props, add, handlerDlg) { var me = this; var win = new SSE.Views.ChartDataRangeDialog({ type: type, //series + isScatter: !!props.isScatter, handler: handlerDlg }).on('close', function() { me.show(); @@ -445,10 +504,50 @@ define([ me.hide(); win.show(xy.left + 160, xy.top + 125); win.setSettings({ - api : me.api + api : me.api, + props : props }); }, + onMoveClick: function(up) { + var store = this.seriesList.store, + length = store.length, + rec = this.seriesList.getSelectedRec(); + if (rec) { + var index = store.indexOf(rec), + order = rec.get('order'), + newindex = up ? Math.max(0, index-1) : Math.min(length-1, index+1), + newrec = store.at(newindex), + neworder = newrec.get('order'); + store.add(store.remove(rec), {at: newindex}); + rec.set('order', neworder); + newrec.set('order', order); + // this.chartSettings.changeSeriesOrder(rec.get('index'), neworder, newrec.get('index'), order); + this.seriesList.selectRecord(rec); + this.seriesList.scrollToRecord(rec); + } + this.updateMoveButtons(); + }, + + updateSeriesList: function(series, index) { + var arr = []; + var store = this.seriesList.store; + for (var i = 0, len = series.length; i < len; i++) + { + var item = series[i], + rec = new Common.UI.DataViewModel(); + rec.set({ + value: item.getSeriesName(), + index: item.asc_getIdx(), + order: item.asc_getOrder(), + series: item + }); + arr.push(rec); + } + store.reset(arr); + (len>0) && this.seriesList.selectByIndex(Math.min(index || 0, store.length-1)); + }, + textTitle: 'Chart Data', txtEmpty: 'This field is required', textInvalidRange: 'ERROR! Invalid cells range', diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index 8d83f7075..d492e42df 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -57,6 +57,7 @@ define([ initialize : function(options) { this.type = options.type || 0; + this.isScatter = options.isScatter; _.extend(this.options, { title: this.type==1 ? this.txtTitleSeries : this.txtTitleCategory @@ -81,7 +82,7 @@ define([ '<% if (type==1) { %>', '', '', - '', + '', '', '', '', @@ -92,6 +93,21 @@ define([ '', '', '', + '<% if (isScatter) { %>', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '', + '', + '', + '', + '<% } %>', '<% } %>', '', '
' @@ -134,6 +150,19 @@ define([ }).on('button:click', _.bind(this.onSelectData, this)); this.lblRange2 = $window.find('#id-dlg-chart-range-lbl2'); + me.inputRange3 = new Common.UI.InputFieldBtn({ + el: $('#id-dlg-chart-range-range3'), + style: '100%', + textSelectData: 'Select data', + validateOnChange: true, + validateOnBlur: false + }).on('changed:after', function(input, newValue, oldValue, e) { + }).on('changing', function(input, newValue, oldValue, e) { + if (newValue == oldValue) return; + // me.onInputChanging(input, newValue, oldValue); + }).on('button:click', _.bind(this.onSelectData, this)); + this.lblRange3 = $window.find('#id-dlg-chart-range-lbl3'); + $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); _.defer(function(){ @@ -149,6 +178,22 @@ define([ setSettings: function(settings) { var me = this; this.api = settings.api; + this.props = settings.props; + + if (this.props.series) { + var series = this.props.series; + this.inputRange1.setValue(series.asc_getName()); + (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); + if (this.props.isScatter) { + this.inputRange2.setValue(series.asc_getXValues()); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join(';')); + this.inputRange3.setValue(series.asc_getYValues()); + (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join(';')); + } else { + this.inputRange2.setValue(series.asc_getValues()); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join(';')); + } + } }, getSettings: function () { @@ -213,6 +258,8 @@ define([ txtTitleCategory: 'Axis Labels', txtSeriesName: 'Series name', txtValues: 'Values', + txtXValues: 'X Values', + txtYValues: 'Y Values', txtAxisLabel: 'Axis label range', txtChoose: 'Choose range', textSelectData: 'Select data', From 2ae33bdfb2857daecbfe4f77a9add1ad0a630f03 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Jul 2020 15:10:48 +0300 Subject: [PATCH 15/33] [SSE] Refactoring --- apps/spreadsheeteditor/main/app/view/ChartDataDialog.js | 8 ++------ .../main/app/view/ChartDataRangeDialog.js | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 63af5abd3..8a0ef6fd4 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -50,8 +50,7 @@ define([ SSE.Views.ChartDataDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 370, - height: 490, - buttons: null + height: 490 }, initialize : function(options) { @@ -111,10 +110,7 @@ define([ '
', '', '', - '
', - '' + '
' ].join('') }, options); diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index d492e42df..4ac3e2cf8 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -186,12 +186,12 @@ define([ (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); if (this.props.isScatter) { this.inputRange2.setValue(series.asc_getXValues()); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join(';')); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; ')); this.inputRange3.setValue(series.asc_getYValues()); - (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join(';')); + (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; ')); } else { this.inputRange2.setValue(series.asc_getValues()); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join(';')); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); } } }, From 3bfd4182fcb3e8e3dc6285668d60285649d68768 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Jul 2020 16:19:30 +0300 Subject: [PATCH 16/33] [SSE] Fix category settings --- .../main/app/view/ChartDataDialog.js | 12 +++++++++--- .../main/app/view/ChartDataRangeDialog.js | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 8a0ef6fd4..419d85ce6 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -278,6 +278,7 @@ define([ (len>0) && this.categoryList.selectByIndex(0); } this.updateButtons(); + this.updateCatButtons(); }, getSettings: function () { @@ -412,6 +413,7 @@ define([ }, onSelectSeries: function(lisvView, itemView, record) { + this.updateCatButtons(record.get('series').asc_IsScatter()); this.updateMoveButtons(); }, @@ -422,8 +424,12 @@ define([ this.updateMoveButtons(); }, - updateCatButtons: function() { - this.btnEditCategory.setDisabled(this.categoryList.store.length<1); + updateCatButtons: function(isScatter) { + if (isScatter===undefined) { + var rec = this.seriesList.getSelectedRec(); + rec && (isScatter = rec.get('series').asc_IsScatter()); + } + this.btnEditCategory.setDisabled(this.categoryList.store.length<1 || !!isScatter); }, updateMoveButtons: function() { @@ -483,7 +489,7 @@ define([ var changedValue = dlg.getSettings(); } }; - this.changeDataRange(0, false, handlerDlg); + this.changeDataRange(0, {category: '', values: this.chartSettings.getCatValues()}, false, handlerDlg); }, changeDataRange: function(type, props, add, handlerDlg) { diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index 4ac3e2cf8..301608e36 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -193,6 +193,10 @@ define([ this.inputRange2.setValue(series.asc_getValues()); (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); } + } else { + this.inputRange1.setValue(this.props.category || ''); + // if (this.inputRange1.getValue()!=='') + this.props.values && this.lblRange1.html('= ' + this.props.values.join('; ')); } }, @@ -244,7 +248,9 @@ define([ if (state == 'ok') { if (this.inputRange1.checkValidate() !== true) return; - if (type==1 && this.inputRange2.checkValidate() !== true) + if (this.type==1 && this.inputRange2.checkValidate() !== true) + return; + if (this.type==1 && this.isScatter && this.inputRange3.checkValidate() !== true) return; } if (this.options.handler.call(this, this, state)) From f5dc20d8d0a75a0633b10b0e3949507872250622 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 8 Jul 2020 10:41:18 +0300 Subject: [PATCH 17/33] [SSE] Refactoring chart range settings --- .../main/app/view/ChartDataDialog.js | 194 +++++++----------- .../main/app/view/ChartDataRangeDialog.js | 110 +++++++--- 2 files changed, 160 insertions(+), 144 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 419d85ce6..ae545fea8 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -124,7 +124,6 @@ define([ this.api = this.options.api; this.chartSettings = this.options.chartSettings; this.dataRangeValid = ''; - this.dataDirect = 0; this.currentChartType = Asc.c_oAscChartTypeSettings.barNormal; }, @@ -140,19 +139,10 @@ define([ allowBlank : true, validateOnChange: true }); - this.txtDataRange.on('button:click', _.bind(this.onSelectData_simple, this)); + this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); this.txtDataRange.on('changed:after', function(input, newValue, oldValue, e) { - if (newValue !==me.dataRangeValid) { - if (me.isRangeValid()) { - me.dataRangeValid = newValue; - me.txtDataRange.checkValidate(); - me.chartSettings.putRange(me.dataRangeValid); - me.api.asc_editChartDrawingObject(me.chartSettings); - } else { - me.txtDataRange.setValue(me.dataRangeValid); - me.txtDataRange.checkValidate(); - } - } + if (newValue == oldValue) return; + me.changeChartRange(newValue); }); // Chart data @@ -210,7 +200,6 @@ define([ emptyText: '', scrollAlwaysVisible: true }); - this.categoryList.onKeyDown = _.bind(this.onListKeyDown, this, 'category'); this.btnEditCategory = new Common.UI.Button({ el: $('#chart-dlg-btn-category-edit') @@ -258,31 +247,13 @@ define([ return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; }; - this.dataDirect = props.getInColumns() ? 1 : 0; - this.updateSeriesList(props.getSeries(), 0); - - var categories = props.getCatValues(), - arr = []; - var store = this.categoryList.store; - for (var i = 0, len = categories.length; i < len; i++) - { - var item = categories[i], - rec = new Common.UI.DataViewModel(); - rec.set({ - value: item - }); - arr.push(rec); - } - store.reset(arr); - (len>0) && this.categoryList.selectByIndex(0); + this.updateCategoryList(props.getCatValues()); } this.updateButtons(); - this.updateCatButtons(); }, getSettings: function () { - this.chartSettings.putRange(this.txtDataRange.getValue()); return { chartSettings: this.chartSettings}; }, @@ -290,6 +261,7 @@ define([ var me = this; var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; if (state == 'ok') { + if (!this.isRangeValid()) return; this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined); } @@ -304,6 +276,7 @@ define([ isRangeValid: function() { var isvalid; if (!_.isEmpty(this.txtDataRange.getValue())) { + //change validation!! isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.dataDirect===0, this.currentChartType); if (isvalid == Asc.c_oAscError.ID.No) return true; @@ -321,18 +294,26 @@ define([ return false; }, - onSelectData_simple: function() { + changeChartRange: function(settings) { + var me = this; + if (me.isRangeValid(settings)) { + me.dataRangeValid = settings; + me.txtDataRange.checkValidate(); + me.chartSettings.putRange(me.dataRangeValid); + + me.updateSeriesList(me.chartSettings.getSeries(), 0); + me.updateCategoryList(me.chartSettings.getCatValues()); + me.updateButtons(); + } + }, + + onSelectData: function(input) { var me = this; if (me.api) { - var props = me.chartSettings; var handlerDlg = function(dlg, result) { - if (result == 'ok' && me.isRangeValid()) { - me.dataRangeValid = dlg.getSettings(); - me.txtDataRange.setValue(me.dataRangeValid); - me.txtDataRange.checkValidate(); - props.putRange(me.dataRangeValid); - me.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); - me.api.asc_editChartDrawingObject(props); + if (result == 'ok') { + input.setValue(dlg.getSettings()); + me.changeChartRange(dlg.getSettings()); } }; @@ -353,59 +334,13 @@ define([ } }, - onSelectData: function() { - var me = this; - if (me.api) { - var props = me.chartSettings, - handlerDlg = function(dlg, result) { - if (result == 'ok' && me.isRangeValid()) { - props.putRange(dlg.getSettings()); - me.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); - me.api.asc_editChartDrawingObject(props); - } - }, - validation = function(value) { - var isvalid; - if (!_.isEmpty(value)) { - isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, true, !props.getInColumns(), me.currentChartType); - if (isvalid == Asc.c_oAscError.ID.No) - return true; - } else return ''; - - if (isvalid == Asc.c_oAscError.ID.StockChartError) { - return this.errorStockChart; - } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { - return this.errorMaxRows; - } - return this.txtInvalidRange; - }; - - var win = new SSE.Views.CellRangeDialog({ - handler: handlerDlg - }).on('close', function() { - me.show(); - // me.api.asc_onCloseChartFrame(); - }); - - var xy = me.$window.offset(); - me.hide(); - win.show(xy.left + 160, xy.top + 125); - win.setSettings({ - api : me.api, - range : props.getRange(), - validation: validation, - type : Asc.c_oAscSelectionDialogType.Chart - }); - } - }, - onListKeyDown: function (type, e, data) { - var record = null, listView = (type=='series') ? this.seriesList : this.categoryList; + var record = null, listView = this.seriesList; if (listView.disabled) return; if (_.isUndefined(undefined)) data = e; - if (type=='series' && data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { + if (data.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) { // this.onDeleteSeries(); } else { Common.UI.DataView.prototype.onKeyDown.call(listView, e, data); @@ -413,25 +348,15 @@ define([ }, onSelectSeries: function(lisvView, itemView, record) { - this.updateCatButtons(record.get('series').asc_IsScatter()); this.updateMoveButtons(); }, updateButtons: function() { - // this.btnAdd.setDisabled(this.seriesList.store.length>63); this.btnEdit.setDisabled(this.seriesList.store.length<1); this.btnDelete.setDisabled(this.seriesList.store.length<1); this.updateMoveButtons(); }, - updateCatButtons: function(isScatter) { - if (isScatter===undefined) { - var rec = this.seriesList.getSelectedRec(); - rec && (isScatter = rec.get('series').asc_IsScatter()); - } - this.btnEditCategory.setDisabled(this.categoryList.store.length<1 || !!isScatter); - }, - updateMoveButtons: function() { var rec = this.seriesList.getSelectedRec(), index = rec ? this.seriesList.store.indexOf(rec) : -1; @@ -441,21 +366,23 @@ define([ onAddSeries: function() { var rec = (this.seriesList.store.length>0) ? this.seriesList.store.at(this.seriesList.store.length-1) : null, - isScatter = false; + isScatter = false, + me = this; rec && (isScatter = rec.get('series').asc_IsScatter()); + // me.setStartPointHistory(); + var series; + if (isScatter) { + series = me.chartSettings.addScatterSeries(); + } else { + series = me.chartSettings.addSeries(); + } var handlerDlg = function(dlg, result) { if (result == 'ok') { - var changedValue = dlg.getSettings(); - if (isScatter) { - this.chartSettings.addScatterSeries(changedValue.name, changedValue.valuesX, changedValue.valuesY); - } else { - this.chartSettings.addSeries(changedValue.name, changedValue.values); - } - this.updateSeriesList(this.chartSettings.getSeries(), this.seriesList.store.length-1); - this.updateButtons(); + me.updateSeriesList(me.chartSettings.getSeries(), me.seriesList.store.length-1); + me.updateButtons(); } }; - this.changeDataRange(1, {isScatter: isScatter}, true, handlerDlg); + this.changeDataRange(1, {series: series, isScatter: isScatter}, handlerDlg); }, onDeleteSeries: function() { @@ -472,27 +399,38 @@ define([ var rec = this.seriesList.getSelectedRec(); if (rec) { var series = rec.get('series'), - isScatter = series.asc_IsScatter(); + isScatter = series.asc_IsScatter(), + me = this; var handlerDlg = function(dlg, result) { if (result == 'ok') { - var changedValue = dlg.getSettings(); + // var changedValue = dlg.getSettings(); + // series.asc_setName(changedValue.name); + // if (isScatter) { + // series.asc_setXValues(changedValue.valuesX); + // series.asc_setYValues(changedValue.valuesY); + // } else { + // series.asc_setValues(changedValue.valuesX); + // } } }; - this.changeDataRange(1, {series: series, name: series.asc_getName(), isScatter: isScatter, values: isScatter ? null : series.asc_getValues(), - valuesX: !isScatter ? null : series.asc_getXValues(), valuesY: !isScatter ? null : series.asc_getYValues() }, false, handlerDlg); + // me.setStartPointHistory(); + this.changeDataRange(1, {series: series, isScatter: isScatter }, handlerDlg); } }, onEditCategory: function() { + var me = this; var handlerDlg = function(dlg, result) { if (result == 'ok') { - var changedValue = dlg.getSettings(); + // var changedValue = dlg.getSettings(); + // me.chartSettings.setCatFormula(changedValue.name); } }; - this.changeDataRange(0, {category: '', values: this.chartSettings.getCatValues()}, false, handlerDlg); + // me.setStartPointHistory(); + this.changeDataRange(0, {category: '', values: this.chartSettings.getCatValues()}, handlerDlg); }, - changeDataRange: function(type, props, add, handlerDlg) { + changeDataRange: function(type, props, handlerDlg) { var me = this; var win = new SSE.Views.ChartDataRangeDialog({ type: type, //series @@ -500,6 +438,7 @@ define([ handler: handlerDlg }).on('close', function() { me.show(); + // me.setEndPointHistory(); when cancel }); var xy = me.$window.offset(); @@ -507,7 +446,8 @@ define([ win.show(xy.left + 160, xy.top + 125); win.setSettings({ api : me.api, - props : props + props : props, + chartSettings: me.chartSettings }); }, @@ -532,6 +472,8 @@ define([ }, updateSeriesList: function(series, index) { + this.btnEditCategory.setDisabled(series && series.length>0 ? series[0].asc_IsScatter() : false); + var arr = []; var store = this.seriesList.store; for (var i = 0, len = series.length; i < len; i++) @@ -550,6 +492,22 @@ define([ (len>0) && this.seriesList.selectByIndex(Math.min(index || 0, store.length-1)); }, + updateCategoryList: function(categories) { + var arr = []; + var store = this.categoryList.store; + for (var i = 0, len = categories.length; i < len; i++) + { + var item = categories[i], + rec = new Common.UI.DataViewModel(); + rec.set({ + value: item + }); + arr.push(rec); + } + store.reset(arr); + (len>0) && this.categoryList.selectByIndex(0); + }, + textTitle: 'Chart Data', txtEmpty: 'This field is required', textInvalidRange: 'ERROR! Invalid cells range', diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index 301608e36..cfb89a09f 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -131,10 +131,12 @@ define([ validateOnChange: true, validateOnBlur: false }).on('changed:after', function(input, newValue, oldValue, e) { + if (newValue == oldValue) return; + me.updateRangeData(1, newValue); }).on('changing', function(input, newValue, oldValue, e) { if (newValue == oldValue) return; // me.onInputChanging(input, newValue, oldValue); - }).on('button:click', _.bind(this.onSelectData, this)); + }).on('button:click', _.bind(this.onSelectData, this, 1)); this.lblRange1 = $window.find('#id-dlg-chart-range-lbl1'); me.inputRange2 = new Common.UI.InputFieldBtn({ @@ -144,10 +146,12 @@ define([ validateOnChange: true, validateOnBlur: false }).on('changed:after', function(input, newValue, oldValue, e) { + if (newValue == oldValue) return; + me.updateRangeData(2, newValue); }).on('changing', function(input, newValue, oldValue, e) { if (newValue == oldValue) return; // me.onInputChanging(input, newValue, oldValue); - }).on('button:click', _.bind(this.onSelectData, this)); + }).on('button:click', _.bind(this.onSelectData, this, 2)); this.lblRange2 = $window.find('#id-dlg-chart-range-lbl2'); me.inputRange3 = new Common.UI.InputFieldBtn({ @@ -157,10 +161,12 @@ define([ validateOnChange: true, validateOnBlur: false }).on('changed:after', function(input, newValue, oldValue, e) { + if (newValue == oldValue) return; + me.updateRangeData(3, newValue); }).on('changing', function(input, newValue, oldValue, e) { if (newValue == oldValue) return; // me.onInputChanging(input, newValue, oldValue); - }).on('button:click', _.bind(this.onSelectData, this)); + }).on('button:click', _.bind(this.onSelectData, this, 3)); this.lblRange3 = $window.find('#id-dlg-chart-range-lbl3'); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); @@ -179,19 +185,24 @@ define([ var me = this; this.api = settings.api; this.props = settings.props; + this.chartSettings = settings.chartSettings; + + if (this.type==1) { + if (this.props.series) { + var series = this.props.series; + this.inputRange1.setValue(series.asc_getName()); + (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); + if (this.props.isScatter) { + this.inputRange2.setValue(series.asc_getXValues()); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; ')); + this.inputRange3.setValue(series.asc_getYValues()); + (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; ')); + } else { + this.inputRange2.setValue(series.asc_getValues()); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); + } + } else { // add series - if (this.props.series) { - var series = this.props.series; - this.inputRange1.setValue(series.asc_getName()); - (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); - if (this.props.isScatter) { - this.inputRange2.setValue(series.asc_getXValues()); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; ')); - this.inputRange3.setValue(series.asc_getYValues()); - (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; ')); - } else { - this.inputRange2.setValue(series.asc_getValues()); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); } } else { this.inputRange1.setValue(this.props.category || ''); @@ -201,16 +212,16 @@ define([ }, getSettings: function () { - return {name: this.inputRange1.getValue(), value: this.inputRange2.getValue()}; + return {name: this.inputRange1.getValue(), valuesX: this.inputRange2.getValue(), valuesY: this.inputRange3.getValue()}; }, - onSelectData: function(input) { + onSelectData: function(type, input) { var me = this; if (me.api) { - var changedValue = input.getValue(); var handlerDlg = function(dlg, result) { if (result == 'ok') { - changedValue = dlg.getSettings(); + input.setValue(dlg.getSettings()); + me.updateRangeData(type, dlg.getSettings()); } }; @@ -218,7 +229,6 @@ define([ allowBlank: true, handler: handlerDlg }).on('close', function() { - input.setValue(changedValue); // me.onInputChanging(input); me.show(); _.delay(function(){ @@ -239,6 +249,57 @@ define([ } }, + isRangeValid: function(type, value) { + var isvalid; + if (!_.isEmpty(value)) { + //change validation!! + isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, true, false, this.chartSettings.getType()); + if (isvalid == Asc.c_oAscError.ID.No) + return true; + } else + return true; + + if (isvalid == Asc.c_oAscError.ID.StockChartError) { + Common.UI.warning({msg: this.errorStockChart}); + } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { + Common.UI.warning({msg: this.errorMaxRows}); + } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) + Common.UI.warning({msg: this.errorMaxPoints}); + return false; + }, + + updateRangeData: function(type, value) { + if (!this.isRangeValid(type, value)) return; + + if (this.props.series) { + var series = this.props.series; + switch (type) { + case 1: + series.asc_setName(value); + (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); + break; + case 2: + if (this.isScatter) { + series.asc_setXValues(value); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; ')); + } else { + series.asc_setValues(value); + (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); + } + break; + case 3: + series.asc_setYValues(value); + (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; ')); + break; + } + } else { + // this.chartSettings.setCatFormula(value); + var values = this.chartSettings.getCatValues(); + // if (this.inputRange1.getValue()!=='') + values && this.lblRange1.html('= ' + values.join('; ')); + } + }, + onBtnClick: function(event) { this._handleInput(event.currentTarget.attributes['result'].value); }, @@ -246,12 +307,9 @@ define([ _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - if (this.inputRange1.checkValidate() !== true) - return; - if (this.type==1 && this.inputRange2.checkValidate() !== true) - return; - if (this.type==1 && this.isScatter && this.inputRange3.checkValidate() !== true) - return; + if (!this.isRangeValid(1, this.inputRange1.getValue())) return; + if (this.type==1 && !this.isRangeValid(2, this.inputRange1.getValue())) return; + if (this.type==1 && this.isScatter && !this.isRangeValid(3, this.inputRange1.getValue())) return; } if (this.options.handler.call(this, this, state)) return; From 5fa4da93b475137901128829e06dc26c0d76104c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 8 Jul 2020 12:51:57 +0300 Subject: [PATCH 18/33] [SSE] Refactoring chart range settings --- .../main/app/view/ChartDataDialog.js | 27 ++++++----- .../main/app/view/ChartDataRangeDialog.js | 46 ++++++++++--------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index ae545fea8..67353743b 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -136,8 +136,8 @@ define([ name : 'range', style : 'width: 100%;', btnHint : this.textSelectData, - allowBlank : true, - validateOnChange: true + allowBlank : true + // validateOnChange: true }); this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); this.txtDataRange.on('changed:after', function(input, newValue, oldValue, e) { @@ -192,7 +192,7 @@ define([ this.btnSwitch = new Common.UI.Button({ el: $('#chart-dlg-btn-switch') }); - // this.btnSwitch.on('click', _.bind(this.onSwitch, this)); + this.btnSwitch.on('click', _.bind(this.onSwitch, this)); this.categoryList = new Common.UI.ListView({ el: $('#chart-dlg-category-list', this.$window), @@ -403,14 +403,7 @@ define([ me = this; var handlerDlg = function(dlg, result) { if (result == 'ok') { - // var changedValue = dlg.getSettings(); - // series.asc_setName(changedValue.name); - // if (isScatter) { - // series.asc_setXValues(changedValue.valuesX); - // series.asc_setYValues(changedValue.valuesY); - // } else { - // series.asc_setValues(changedValue.valuesX); - // } + rec.set('value', series.asc_getSeriesName()); } }; // me.setStartPointHistory(); @@ -422,8 +415,7 @@ define([ var me = this; var handlerDlg = function(dlg, result) { if (result == 'ok') { - // var changedValue = dlg.getSettings(); - // me.chartSettings.setCatFormula(changedValue.name); + me.updateCategoryList(me.chartSettings.getCatValues()); } }; // me.setStartPointHistory(); @@ -481,7 +473,7 @@ define([ var item = series[i], rec = new Common.UI.DataViewModel(); rec.set({ - value: item.getSeriesName(), + value: item.asc_getSeriesName(), index: item.asc_getIdx(), order: item.asc_getOrder(), series: item @@ -508,6 +500,13 @@ define([ (len>0) && this.categoryList.selectByIndex(0); }, + onSwitch: function() { + this.chartSettings.switchRowCol(); + this.updateSeriesList(this.chartSettings.getSeries(), 0); + this.updateCategoryList(this.chartSettings.getCatValues()); + this.updateButtons(); + }, + textTitle: 'Chart Data', txtEmpty: 'This field is required', textInvalidRange: 'ERROR! Invalid cells range', diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index cfb89a09f..2df1ce630 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -128,7 +128,7 @@ define([ el: $('#id-dlg-chart-range-range1'), style: '100%', textSelectData: 'Select data', - validateOnChange: true, + // validateOnChange: true, validateOnBlur: false }).on('changed:after', function(input, newValue, oldValue, e) { if (newValue == oldValue) return; @@ -143,7 +143,7 @@ define([ el: $('#id-dlg-chart-range-range2'), style: '100%', textSelectData: 'Select data', - validateOnChange: true, + // validateOnChange: true, validateOnBlur: false }).on('changed:after', function(input, newValue, oldValue, e) { if (newValue == oldValue) return; @@ -158,7 +158,7 @@ define([ el: $('#id-dlg-chart-range-range3'), style: '100%', textSelectData: 'Select data', - validateOnChange: true, + // validateOnChange: true, validateOnBlur: false }).on('changed:after', function(input, newValue, oldValue, e) { if (newValue == oldValue) return; @@ -191,23 +191,25 @@ define([ if (this.props.series) { var series = this.props.series; this.inputRange1.setValue(series.asc_getName()); - (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); + this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (series.asc_getNameVal() || '')) : this.txtChoose); if (this.props.isScatter) { + var arr = series.asc_getXValuesArr(); this.inputRange2.setValue(series.asc_getXValues()); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; ')); - this.inputRange3.setValue(series.asc_getYValues()); - (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; ')); - } else { - this.inputRange2.setValue(series.asc_getValues()); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); - } - } else { // add series + this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); + this.inputRange3.setValue(series.asc_getYValues()); + arr = series.asc_getYValuesArr(); + this.lblRange3.html((this.inputRange3.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); + } else { + var arr = series.asc_getValuesArr(); + this.inputRange2.setValue(series.asc_getValues()); + this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); + } } } else { + var arr = this.props.values; this.inputRange1.setValue(this.props.category || ''); - // if (this.inputRange1.getValue()!=='') - this.props.values && this.lblRange1.html('= ' + this.props.values.join('; ')); + this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); } }, @@ -276,27 +278,29 @@ define([ switch (type) { case 1: series.asc_setName(value); - (this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName()); + this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (series.asc_getNameVal() || '')) : this.txtChoose); break; case 2: if (this.isScatter) { + var arr = series.asc_getXValuesArr(); series.asc_setXValues(value); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; ')); + this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); } else { + var arr = series.asc_getValuesArr(); series.asc_setValues(value); - (this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; ')); + this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); } break; case 3: + var arr = series.asc_getYValuesArr(); series.asc_setYValues(value); - (this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; ')); + this.lblRange3.html((this.inputRange3.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); break; } } else { // this.chartSettings.setCatFormula(value); - var values = this.chartSettings.getCatValues(); - // if (this.inputRange1.getValue()!=='') - values && this.lblRange1.html('= ' + values.join('; ')); + var arr = this.chartSettings.getCatValues(); + this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); } }, From 05c520015bed0d80e5af2405d9d0e888d9bd9d18 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 8 Jul 2020 15:04:19 +0300 Subject: [PATCH 19/33] [SSE] Disable switch button for empty range. Fix error messages --- .../main/app/view/ChartDataDialog.js | 15 +++++++++------ .../main/app/view/ChartDataRangeDialog.js | 9 ++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 67353743b..e2576eacd 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -244,7 +244,7 @@ define([ } var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); - return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? (me.textError + ' ' + me.textInvalidRange) : true; }; this.updateSeriesList(props.getSeries(), 0); @@ -289,8 +289,9 @@ define([ Common.UI.warning({msg: this.errorMaxRows}); } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) Common.UI.warning({msg: this.errorMaxPoints}); - else - this.txtDataRange.cmpEl.find('input').focus(); + else { + Common.UI.warning({msg: this.textInvalidRange}); + } return false; }, @@ -354,6 +355,7 @@ define([ updateButtons: function() { this.btnEdit.setDisabled(this.seriesList.store.length<1); this.btnDelete.setDisabled(this.seriesList.store.length<1); + this.btnSwitch.setDisabled(this.seriesList.store.length<1 || !this.chartSettings.getRange()); this.updateMoveButtons(); }, @@ -509,11 +511,12 @@ define([ textTitle: 'Chart Data', txtEmpty: 'This field is required', - textInvalidRange: 'ERROR! Invalid cells range', + textInvalidRange: 'Invalid cells range', + textError: 'ERROR!', textSelectData: 'Select data', - errorMaxRows: 'ERROR! The maximum number of data series per chart is 255.', + errorMaxRows: 'The maximum number of data series per chart is 255.', errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', - errorMaxPoints: 'ERROR! The maximum number of points in series per chart is 4096.', + errorMaxPoints: 'The maximum number of points in series per chart is 4096.', textSeries: 'Legend Entries (Series)', textAdd: 'Add', textEdit: 'Edit', diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index 2df1ce630..be783d2f3 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -267,6 +267,8 @@ define([ Common.UI.warning({msg: this.errorMaxRows}); } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) Common.UI.warning({msg: this.errorMaxPoints}); + else + Common.UI.warning({msg: this.textInvalidRange}); return false; }, @@ -332,6 +334,11 @@ define([ txtChoose: 'Choose range', textSelectData: 'Select data', txtEmpty : 'This field is required', - txtInvalidRange: 'ERROR! Invalid cells range' + textInvalidRange: 'Invalid cells range', + textError: 'ERROR!', + errorMaxRows: 'The maximum number of data series per chart is 255.', + errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', + errorMaxPoints: 'The maximum number of points in series per chart is 4096.' + }, SSE.Views.ChartDataRangeDialog || {})) }); From 96704a1f1fe0097d47c863e4846f94066d500431 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 8 Jul 2020 16:07:57 +0300 Subject: [PATCH 20/33] [SSE] Remove data settings from chart settings dialog (use chart data dialog instead) --- .../app/template/ChartSettingsDlg.template | 42 ++-- .../main/app/view/ChartSettingsDlg.js | 203 +++++++++--------- 2 files changed, 123 insertions(+), 122 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template b/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template index afad9d985..f73333cf4 100644 --- a/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template +++ b/apps/spreadsheeteditor/main/app/template/ChartSettingsDlg.template @@ -9,27 +9,27 @@ -
-
- - - - - - - - - - -
- -
-
-
- -
-
-
+ + + + + + + + + + + + + + + + + + + + +
diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index 11c552409..d2b2bc419 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -59,7 +59,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' _.extend(this.options, { title: this.textTitle, items: [ - {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textTypeData}, + {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textType}, {panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout}, {panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis}, {panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis}, @@ -138,26 +138,26 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnChartType.render($('#chart-dlg-button-type')); this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); - this.cmbDataDirect = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-range'), - menuStyle : 'min-width: 120px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: 0, displayValue: this.textDataRows }, - { value: 1, displayValue: this.textDataColumns } - ] - }); - - this.txtDataRange = new Common.UI.InputFieldBtn({ - el : $('#chart-dlg-txt-range'), - name : 'range', - style : 'width: 100%;', - btnHint : this.textSelectData, - allowBlank : true, - validateOnChange: true - }); - this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); + // this.cmbDataDirect = new Common.UI.ComboBox({ + // el : $('#chart-dlg-combo-range'), + // menuStyle : 'min-width: 120px;', + // editable : false, + // cls : 'input-group-nr', + // data : [ + // { value: 0, displayValue: this.textDataRows }, + // { value: 1, displayValue: this.textDataColumns } + // ] + // }); + // + // this.txtDataRange = new Common.UI.InputFieldBtn({ + // el : $('#chart-dlg-txt-range'), + // name : 'range', + // style : 'width: 100%;', + // btnHint : this.textSelectData, + // allowBlank : true, + // validateOnChange: true + // }); + // this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); this.cmbChartTitle = new Common.UI.ComboBox({ el : $('#chart-dlg-combo-chart-title'), @@ -1293,24 +1293,24 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this._noApply = false; - var value = props.getRange(); - this.txtDataRange.setValue((value) ? value : ''); - this.dataRangeValid = value; - - this.txtDataRange.validation = function(value) { - if (_.isEmpty(value)) { - if (!me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(true); - return true; - } - - if (me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(false); - - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); - return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; - }; - - this.cmbDataDirect.setDisabled(value===null); - this.cmbDataDirect.setValue(props.getInColumns() ? 1 : 0); + // var value = props.getRange(); + // this.txtDataRange.setValue((value) ? value : ''); + // this.dataRangeValid = value; + // + // this.txtDataRange.validation = function(value) { + // if (_.isEmpty(value)) { + // if (!me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(true); + // return true; + // } + // + // if (me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(false); + // + // var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + // return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + // }; + // + // this.cmbDataDirect.setDisabled(value===null); + // this.cmbDataDirect.setValue(props.getInColumns() ? 1 : 0); this.cmbChartTitle.setValue(props.getTitle()); this.cmbLegendPos.setValue(props.getLegendPos()); @@ -1321,7 +1321,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.chCategoryName.setValue(this.chartSettings.getShowCatName(), true); this.chValue.setValue(this.chartSettings.getShowVal(), true); - value = props.getSeparator(); + var value = props.getSeparator(); this.txtSeparator.setValue((value) ? value : ''); // Vertical Axis @@ -1423,8 +1423,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.chartSettings.putType(type); - this.chartSettings.putInColumns(this.cmbDataDirect.getValue()==1); - this.chartSettings.putRange(this.txtDataRange.getValue()); + // this.chartSettings.putInColumns(this.cmbDataDirect.getValue()==1); + // this.chartSettings.putRange(this.txtDataRange.getValue()); this.chartSettings.putTitle(this.cmbChartTitle.getValue()); this.chartSettings.putLegendPos(this.cmbLegendPos.getValue()); @@ -1484,63 +1484,64 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' }, isRangeValid: function() { - if (this.isChart) { - var isvalid; - if (!_.isEmpty(this.txtDataRange.getValue())) { - var rec = this.mnuChartTypePicker.getSelectedRec(), - type = (rec) ? rec.get('type') : this.currentChartType; - - isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.cmbDataDirect.getValue()==0, type); - if (isvalid == Asc.c_oAscError.ID.No) - return true; - } else - return true; - - this.setActiveCategory(0); - if (isvalid == Asc.c_oAscError.ID.StockChartError) { - Common.UI.warning({msg: this.errorStockChart}); - } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { - Common.UI.warning({msg: this.errorMaxRows}); - } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) - Common.UI.warning({msg: this.errorMaxPoints}); - else - this.txtDataRange.cmpEl.find('input').focus(); - return false; - } else - return true; + return true; + // if (this.isChart) { + // var isvalid; + // if (!_.isEmpty(this.txtDataRange.getValue())) { + // var rec = this.mnuChartTypePicker.getSelectedRec(), + // type = (rec) ? rec.get('type') : this.currentChartType; + // + // isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.cmbDataDirect.getValue()==0, type); + // if (isvalid == Asc.c_oAscError.ID.No) + // return true; + // } else + // return true; + // + // this.setActiveCategory(0); + // if (isvalid == Asc.c_oAscError.ID.StockChartError) { + // Common.UI.warning({msg: this.errorStockChart}); + // } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { + // Common.UI.warning({msg: this.errorMaxRows}); + // } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) + // Common.UI.warning({msg: this.errorMaxPoints}); + // else + // this.txtDataRange.cmpEl.find('input').focus(); + // return false; + // } else + // return true; }, - onSelectData: function() { - var me = this; - if (me.api) { - me.btnChartType.menu.options.additionalAlign = me.menuAddAlign; - me.btnSparkType.menu.options.additionalAlign = me.menuAddAlign; - - var handlerDlg = function(dlg, result) { - if (result == 'ok') { - me.dataRangeValid = dlg.getSettings(); - me.txtDataRange.setValue(me.dataRangeValid); - me.txtDataRange.checkValidate(); - } - }; - - var win = new SSE.Views.CellRangeDialog({ - handler: handlerDlg - }).on('close', function() { - me.show(); - }); - - var xy = me.$window.offset(); - me.hide(); - win.show(xy.left + 160, xy.top + 125); - win.setSettings({ - api : me.api, - isRows : (me.cmbDataDirect.getValue()==0), - range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid, - type : Asc.c_oAscSelectionDialogType.Chart - }); - } - }, + // onSelectData: function() { + // var me = this; + // if (me.api) { + // me.btnChartType.menu.options.additionalAlign = me.menuAddAlign; + // me.btnSparkType.menu.options.additionalAlign = me.menuAddAlign; + // + // var handlerDlg = function(dlg, result) { + // if (result == 'ok') { + // me.dataRangeValid = dlg.getSettings(); + // me.txtDataRange.setValue(me.dataRangeValid); + // me.txtDataRange.checkValidate(); + // } + // }; + // + // var win = new SSE.Views.CellRangeDialog({ + // handler: handlerDlg + // }).on('close', function() { + // me.show(); + // }); + // + // var xy = me.$window.offset(); + // me.hide(); + // win.show(xy.left + 160, xy.top + 125); + // win.setSettings({ + // api : me.api, + // isRows : (me.cmbDataDirect.getValue()==0), + // range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid, + // type : Asc.c_oAscSelectionDialogType.Chart + // }); + // } + // }, onSelectDataLabels: function(obj, rec, e) { var disable = rec.value == Asc.c_oAscChartDataLabelsPos.none; @@ -1614,10 +1615,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' show: function() { Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); - var me = this; - _.delay(function(){ - me.txtDataRange.cmpEl.find('input').focus(); - },50); + // var me = this; + // _.delay(function(){ + // me.txtDataRange.cmpEl.find('input').focus(); + // },50); }, close: function () { From 15dd23ba04a759b5626a7c3282bdb6ac1255006c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 10 Jul 2020 19:11:55 +0300 Subject: [PATCH 21/33] [SSE] Check chard data --- .../main/app/view/ChartDataDialog.js | 44 ++++++++++++------- .../main/app/view/ChartDataRangeDialog.js | 32 +++++++++++--- .../main/app/view/ChartSettings.js | 29 +++++++----- 3 files changed, 72 insertions(+), 33 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index e2576eacd..9ef52f845 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -150,7 +150,8 @@ define([ el: $('#chart-dlg-series-list', this.$window), store: new Common.UI.DataViewStore(), emptyText: '', - scrollAlwaysVisible: true + scrollAlwaysVisible: true, + itemTemplate: _.template('
<%= value %>
') }); this.seriesList.onKeyDown = _.bind(this.onListKeyDown, this, 'series'); this.seriesList.on('item:select', _.bind(this.onSelectSeries, this)); @@ -198,7 +199,8 @@ define([ el: $('#chart-dlg-category-list', this.$window), store: new Common.UI.DataViewStore(), emptyText: '', - scrollAlwaysVisible: true + scrollAlwaysVisible: true, + itemTemplate: _.template('
<%= value %>
') }); this.btnEditCategory = new Common.UI.Button({ @@ -239,6 +241,7 @@ define([ this.dataRangeValid = value; this.txtDataRange.validation = function(value) { + return true; if (_.isEmpty(value)) { return true; } @@ -276,9 +279,8 @@ define([ isRangeValid: function() { var isvalid; if (!_.isEmpty(this.txtDataRange.getValue())) { - //change validation!! - isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.dataDirect===0, this.currentChartType); - if (isvalid == Asc.c_oAscError.ID.No) + isvalid = this.chartSettings.isValidRange(this.txtDataRange.getValue()); + if (isvalid === true || isvalid == Asc.c_oAscError.ID.No) return true; } else return true; @@ -300,7 +302,7 @@ define([ if (me.isRangeValid(settings)) { me.dataRangeValid = settings; me.txtDataRange.checkValidate(); - me.chartSettings.putRange(me.dataRangeValid); + me.chartSettings.setRange(me.dataRangeValid); me.updateSeriesList(me.chartSettings.getSeries(), 0); me.updateCategoryList(me.chartSettings.getCatValues()); @@ -314,7 +316,9 @@ define([ var handlerDlg = function(dlg, result) { if (result == 'ok') { input.setValue(dlg.getSettings()); - me.changeChartRange(dlg.getSettings()); + _.delay(function(){ + me.changeChartRange(dlg.getSettings()); + },10); } }; @@ -330,7 +334,8 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid, - type : Asc.c_oAscSelectionDialogType.Chart + type : Asc.c_oAscSelectionDialogType.Chart, + validation: function() {return true;} }); } }, @@ -371,7 +376,7 @@ define([ isScatter = false, me = this; rec && (isScatter = rec.get('series').asc_IsScatter()); - // me.setStartPointHistory(); + me.chartSettings.startEditData(); var series; if (isScatter) { series = me.chartSettings.addScatterSeries(); @@ -382,6 +387,8 @@ define([ if (result == 'ok') { me.updateSeriesList(me.chartSettings.getSeries(), me.seriesList.store.length-1); me.updateButtons(); + me.chartSettings.endEditData(); + me._isEditRanges = false; } }; this.changeDataRange(1, {series: series, isScatter: isScatter}, handlerDlg); @@ -391,7 +398,8 @@ define([ var rec = this.seriesList.getSelectedRec(); if (rec) { var order = rec.get('order'); - // this.chartSettings.deleteSeries(rec.get('index')); + rec.get('series').asc_Remove(); + this.txtDataRange.setValue(this.chartSettings.getRange() || ''); this.updateSeriesList(this.chartSettings.getSeries(), order); } this.updateButtons(); @@ -406,9 +414,11 @@ define([ var handlerDlg = function(dlg, result) { if (result == 'ok') { rec.set('value', series.asc_getSeriesName()); + me.chartSettings.endEditData(); + me._isEditRanges = false; } }; - // me.setStartPointHistory(); + me.chartSettings.startEditData(); this.changeDataRange(1, {series: series, isScatter: isScatter }, handlerDlg); } }, @@ -418,10 +428,12 @@ define([ var handlerDlg = function(dlg, result) { if (result == 'ok') { me.updateCategoryList(me.chartSettings.getCatValues()); + me.chartSettings.endEditData(); + me._isEditRanges = false; } }; - // me.setStartPointHistory(); - this.changeDataRange(0, {category: '', values: this.chartSettings.getCatValues()}, handlerDlg); + me.chartSettings.startEditData(); + this.changeDataRange(0, {category: this.chartSettings.getCatFormula(), values: this.chartSettings.getCatValues()}, handlerDlg); }, changeDataRange: function(type, props, handlerDlg) { @@ -431,10 +443,12 @@ define([ isScatter: !!props.isScatter, handler: handlerDlg }).on('close', function() { + me._isEditRanges && me.chartSettings.cancelEditData(); + me._isEditRanges = false; me.show(); - // me.setEndPointHistory(); when cancel }); + me._isEditRanges = true; var xy = me.$window.offset(); me.hide(); win.show(xy.left + 160, xy.top + 125); @@ -458,7 +472,7 @@ define([ store.add(store.remove(rec), {at: newindex}); rec.set('order', neworder); newrec.set('order', order); - // this.chartSettings.changeSeriesOrder(rec.get('index'), neworder, newrec.get('index'), order); + up ? rec.get('series').asc_MoveUp() : rec.get('series').asc_MoveDown(); this.seriesList.selectRecord(rec); this.seriesList.scrollToRecord(rec); } diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index be783d2f3..f808df9b8 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -223,7 +223,9 @@ define([ var handlerDlg = function(dlg, result) { if (result == 'ok') { input.setValue(dlg.getSettings()); - me.updateRangeData(type, dlg.getSettings()); + _.delay(function(){ + me.updateRangeData(type, dlg.getSettings()); + },10); } }; @@ -246,7 +248,8 @@ define([ win.setSettings({ api : me.api, range : !_.isEmpty(input.getValue()) ? input.getValue() : '', - type : Asc.c_oAscSelectionDialogType.Chart + type : Asc.c_oAscSelectionDialogType.Chart, + validation: function() {return true;} }); } }, @@ -254,9 +257,26 @@ define([ isRangeValid: function(type, value) { var isvalid; if (!_.isEmpty(value)) { - //change validation!! - isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, true, false, this.chartSettings.getType()); - if (isvalid == Asc.c_oAscError.ID.No) + switch (type) { + case 1: + if (this.props.series) { + isvalid = this.props.series.asc_IsValidName(value); + } else { + isvalid = this.chartSettings.isValidCatFormula(value); + } + break; + case 2: + if (this.props.isScatter) { + isvalid = this.props.series.asc_IsValidXValues(value); + } else { + isvalid = this.props.series.asc_IsValidValues(value); + } + break; + case 3: + isvalid = this.props.series.asc_IsValidYValues(value); + break; + } + if (isvalid === true || isvalid == Asc.c_oAscError.ID.No) return true; } else return true; @@ -300,7 +320,7 @@ define([ break; } } else { - // this.chartSettings.setCatFormula(value); + this.chartSettings.setCatFormula(value); var arr = this.chartSettings.getCatValues(); this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose); } diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 0afbfdec4..e205fb0de 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -899,22 +899,27 @@ define([ onSelectData: function() { var me = this; - var win, props; + var props; if (me.api){ props = me.api.asc_getChartObject(); if (props) { - (new SSE.Views.ChartDataDialog( - { - chartSettings: props, - api: me.api, - handler: function(result, value) { - if (result == 'ok') { - if (me.api) { - } - } - Common.NotificationCenter.trigger('edit:complete', me); + me._isEditRanges = true; + props.startEdit(); + var win = new SSE.Views.ChartDataDialog({ + chartSettings: props, + api: me.api, + handler: function(result, value) { + if (result == 'ok') { + props.endEdit(); + me._isEditRanges = false; } - })).show(); + Common.NotificationCenter.trigger('edit:complete', me); + } + }).on('close', function() { + me._isEditRanges && props.cancelEdit(); + me._isEditRanges = false; + }); + win.show(); } } }, From 82fbc204b41e9575621ee04bafcf06ebbcb47576 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 13 Jul 2020 14:23:43 +0300 Subject: [PATCH 22/33] Add permissions.copy parameter to api config --- apps/api/documents/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 542fb2816..10b6c9fc0 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -48,7 +48,8 @@ comment: // default = edit, modifyFilter: // default = true modifyContentControl: // default = true - fillForms: // default = edit || review + fillForms: // default = edit || review, + copy: // default = true } }, editorConfig: { From a91e1801ee89a91f80b6ab2d5b9324a1c5da9452 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Jul 2020 14:27:45 +0300 Subject: [PATCH 23/33] [SSE] Table settings: change action buttons --- apps/common/main/resources/less/buttons.less | 2 +- .../main/app/template/TableSettings.template | 20 ++++++++++--- .../main/app/view/TableSettings.js | 28 ++++++++++++++---- apps/spreadsheeteditor/main/locale/en.json | 1 + .../toolbar/1.25x/btn-convert-to-range.png | Bin 0 -> 514 bytes .../img/toolbar/1.25x/btn-pivot-sum.png | Bin 0 -> 507 bytes .../toolbar/1.25x/btn-remove-duplicates.png | Bin 0 -> 442 bytes .../img/toolbar/1.5x/btn-convert-to-range.png | Bin 0 -> 620 bytes .../img/toolbar/1.5x/btn-pivot-sum.png | Bin 0 -> 527 bytes .../toolbar/1.5x/btn-remove-duplicates.png | Bin 0 -> 458 bytes .../toolbar/1.75x/btn-convert-to-range.png | Bin 0 -> 690 bytes .../img/toolbar/1.75x/btn-pivot-sum.png | Bin 0 -> 637 bytes .../toolbar/1.75x/btn-remove-duplicates.png | Bin 0 -> 508 bytes .../img/toolbar/1x/btn-convert-to-range.png | Bin 0 -> 451 bytes .../img/toolbar/1x/btn-pivot-sum.png | Bin 0 -> 433 bytes .../img/toolbar/1x/btn-remove-duplicates.png | Bin 0 -> 396 bytes .../img/toolbar/2x/btn-convert-to-range.png | Bin 0 -> 810 bytes .../img/toolbar/2x/btn-pivot-sum.png | Bin 0 -> 768 bytes .../img/toolbar/2x/btn-remove-duplicates.png | Bin 0 -> 583 bytes 19 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-convert-to-range.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-pivot-sum.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-remove-duplicates.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-convert-to-range.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-pivot-sum.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-remove-duplicates.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-convert-to-range.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-pivot-sum.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-remove-duplicates.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-convert-to-range.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-pivot-sum.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-remove-duplicates.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-convert-to-range.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-pivot-sum.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-remove-duplicates.png diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index a0e6c8a3f..8e3386b15 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -309,7 +309,7 @@ &:not(.icon-top) .caption:not(:empty) { - padding: 0 2px; + padding: 0 5px; } .icon { diff --git a/apps/spreadsheeteditor/main/app/template/TableSettings.template b/apps/spreadsheeteditor/main/app/template/TableSettings.template index 78e589aa3..47f03cc6d 100644 --- a/apps/spreadsheeteditor/main/app/template/TableSettings.template +++ b/apps/spreadsheeteditor/main/app/template/TableSettings.template @@ -75,22 +75,34 @@ - +
+ + + + + + + + + diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index 563607dff..8943c8f61 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -294,8 +294,13 @@ define([ this.lockedControls.push(this.btnEdit); this.btnConvertRange = new Common.UI.Button({ - el: $('#table-btn-convert-range') + parentEl: $('#table-btn-convert-range'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-convert-to-range', + caption : this.textConvertRange, + style : 'width: 100%;text-align: left;' }); + this.btnConvertRange.on('click', _.bind(function(btn){ if (this.api) this.api.asc_convertTableToRange(this._state.TableName); Common.NotificationCenter.trigger('edit:complete', this); @@ -303,7 +308,11 @@ define([ this.lockedControls.push(this.btnConvertRange); this.btnRemDuplicates = new Common.UI.Button({ - el: $('#table-btn-rem-duplicates') + parentEl: $('#table-btn-rem-duplicates'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-remove-duplicates', + caption : this.textRemDuplicates, + style : 'width: 100%;text-align: left;' }); this.btnRemDuplicates.on('click', _.bind(function(btn){ Common.NotificationCenter.trigger('data:remduplicates', this); @@ -311,13 +320,21 @@ define([ this.lockedControls.push(this.btnRemDuplicates); this.btnSlicer = new Common.UI.Button({ - el: $('#table-btn-slicer') + parentEl: $('#table-btn-slicer'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-slicer', + caption : this.textSlicer, + style : 'width: 100%;text-align: left;' }); this.btnSlicer.on('click', _.bind(this.onInsertSlicerClick, this)); this.lockedControls.push(this.btnSlicer); this.btnPivot = new Common.UI.Button({ - el: $('#table-btn-pivot') + parentEl: $('#table-btn-pivot'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-pivot-sum', + caption : this.textPivot, + style : 'width: 100%;text-align: left;' }); this.btnPivot.on('click', _.bind(this.onInsertPivotClick, this)); this.lockedControls.push(this.btnPivot); @@ -626,7 +643,8 @@ define([ warnLongOperation: 'The operation you are about to perform might take rather much time to complete.
Are you sure you want to continue?', textRemDuplicates: 'Remove duplicates', textSlicer: 'Insert slicer', - textPivot: 'Insert pivot table' + textPivot: 'Insert pivot table', + textActions: 'Table actions' }, SSE.Views.TableSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index c613f3e40..166c3607b 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2532,6 +2532,7 @@ "SSE.Views.TableSettings.warnLongOperation": "The operation you are about to perform might take rather much time to complete.
Are you sure you want to continue?", "SSE.Views.TableSettings.textSlicer": "Insert slicer", "SSE.Views.TableSettings.textPivot": "Insert pivot table", + "SSE.Views.TableSettings.textActions": "Table actions", "SSE.Views.TableSettingsAdvanced.textAlt": "Alternative Text", "SSE.Views.TableSettingsAdvanced.textAltDescription": "Description", "SSE.Views.TableSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.", diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-convert-to-range.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-convert-to-range.png new file mode 100644 index 0000000000000000000000000000000000000000..28e0aec7a0a98b114b01d22f61770af37888da92 GIT binary patch literal 514 zcmV+d0{#7oP)X1^@s6b5wmq00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yP$h=noq=^L}^WQ|6 zi$}^i{_h(3t9Z?GWXkAdI9ZiY_#So>Vyz@?-=Xe3>?XuoImGWO+pp`oClFkwY5M+q zPj*%nlAqv~ut$y|dcQ&h<847=&1Z$X1^@s6b5wmq00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yPVK~#7F?UvDv zgD?z+4TATMzz7`y33xv?xQ#kO=>!Y_NOu$THfTqLOAl!R{5kTiZM99 zVmkl?0s$KlHxtqRA3c1!v;F(#~er;4$wa2N&QFmSUWAnAO--Y)cG0=S$LtE^$aXG*N zDFOp!(=@eWZ6#6w2NV&Rh&79`xofE>asOZ(*REn*QBOjcXr77LEMy$VD=6tiGl>y) zUtB>+Co$K;uE%z>FX8HIyV=*iEBV)nP}<~qzEf>QQGDR^1)iX^!LegDV~o{8WKE=L znn@dp!gM-dpawj^3R~Jp)B#7MdnbVv@D@t~k|fz<&K^m`FbpTy2yd}M0NIW>8nm4@ z3jxt$aXw=`(E1k#72YSd>TmFaJc+X?her$)VT`f%U#rHCx73xEF1;lz1%7X>ptX1^@s6b5wmq00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yP)h@yYjKHHEAXD&V6uwNs0IjNyz(OrJASCL>mpFtE%1IF@_SNS!?io{1P=HXq z|Fms;my(8IsHB*NcPB`>6+w!{@ES%qdJ-=t0449}*$dVP@frgJ_ykH&@-6{^YTl+1 zjrcEkNi`5})kw@W@q?p}ZwB#Jji77fV(viPvs^Q@wTt0# zplifps~Vx}7wseN#OY1!T>;v&pE*8l(j07*qoM6N<$g4u|(sQ>@~ literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-convert-to-range.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-convert-to-range.png new file mode 100644 index 0000000000000000000000000000000000000000..ecd300e593f55112fd6c226b9caf2ee103e42e28 GIT binary patch literal 620 zcmV-y0+aoTP)qEu(dU zU8)GS?H9U5#`J-_{Upm^*XH~pZI%6&Mws(Zw4&z_w?r4Ee)~DnIHHYuv<3wK}yKqvKPQ`xX=iB9S@u?(}*qH72@*4as+0hOd3bL<=OrxaO@O&WE_Q5QtY(>^M$fS@a6chq$#6m~Qd=HPEDJ zNibjcAbJc3Cl)9^0DuD~;IWM?kh$)iC=n<=036UfO76a9e5njdBg;+$jyT(@p1w3s zT7P~;QLB3T(kWykE@qZ?0000CwUSq^6%mlxZ2 z$5cpzOb#^P*ZQX|IYeg62dJcJ)4PB7yIpkfE1A8%E zPH?%l;5v$-_t+QLu?@Y)naqFb^V5^#b~;&`||a3)nO0+zqoKS#$C|73}v zyNS^nmd+T~xFw53CMbw&R69Pv6^V)u!|=fpU`SBXe#OM`f2?t%1nYH{bABw#l57_$ zN7FRDvjpgM7SBigUgEOfa^#E~yTePJ#eBz(O4~>SVsGO(ezP>lI(t`g(|x`XcuZ%@@My^LG8O?Bu{w` zzffL-O;gtwsttkUsWa!fE~0%w6ov5DD~OLcx-opmyyg;-bJeKe_d*JS66Ud z=nNxSx~}V~ZCmS}VIfGCo~T*(45Jk1@I22yrasAa$*5@EsyQqtIR6q$XfFmw}4uB3)07w1-6FJ^pwAgDqQudQZ zCX%U22cVW8k`Oi02y>#1l(x01IKcV#!@fOcX_5c(myc0R4=_VwQvLCy-|{NpwZV`x|uI<_}?BassA$ zhD>B(RfExRdA`7u7*H}2TGMlH6F`Ov~XuDpoCsaM0DO)}RQOO9xaQVOj z+29JYhs#GAOVQaQloI!p<#M@A`nbIM{eFwehkMGeSh&366Lg`-GG^cDbefyZ=5Y7b z>vivZK8Fw|NQ7WwD^w~*^3imMrW$j}u7K;(S Y0RqrD(tcGLivR!s07*qoM6N<$g62*slK=n! literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-pivot-sum.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-pivot-sum.png new file mode 100644 index 0000000000000000000000000000000000000000..4b576563a54782560650e5485808ed116f021a66 GIT binary patch literal 637 zcmV-@0)qXCP)(=XJyvt0W;AzqY+4ES^u+I z?J51TXipeQ8amt$(T;~`Y8?JMV z)JCvgNgo^e4d4-dY+8K@*+kN9@D##;o5Cc@5fl-WGd7#euDLfFjb1RlACJee3V@D? z68U4t>{Y&CwEE&CVlKDOa5zl4{lQ?6!J#EYE0t$zw@+$#B*R!jw6evFeZ;g?v=k{x zl6>If>)~+l9xZJZt&Wt+7j+|A2&;%Oi2^}V+&~#bDe(21MB$E@OH86*J;liIvGN6D z%pI{Nwh=>xQHpsBA+C!QrgU^L&mq{S3d802Y#TRmiLu0(!ymCPw!$pnL{7z8m&VW& zRRycMHiibQyK6d5RNng%r%QKzch~F-5~pj|?2B6W{BU0?NEBVKJRB{~Q}_~z{BwQ) X4xn7Uk3$&u00000NkvXXu0mjf8(S5n literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-remove-duplicates.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-remove-duplicates.png new file mode 100644 index 0000000000000000000000000000000000000000..882e24c7d5ba5da48ed987dc5889d4f4d046cb0e GIT binary patch literal 508 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!3HEX#cOhb6lZ})WHAE+w=f7ZGR&GI0Tg5` z4sv&5Sa(k5C6L3C?&#~tz_78O`%fY(P;R29i(^Oy7zC?Fk>eFv)3((gSeBh2Gtr4x6;>c+y%YpIdjf_bdK%!7~noR3#ciD^3< zy=2v@+WX(1Z_;_aEK_fzRm5SdXSpm(t0T^Bxc1?d(CW`lZ}fS6EuU1@$%c3J@jdLe zJaE4>M$;;@_T)R{m> z6aKmO&mJ4pY9lm5&PcD*x<+c-=9&0u?fx!W??N%8rNb+6xDn4`SL zd@G+~<0rm*{TuFy2u_np&gMGa6Daue@UUfd#i#sC*N)}v wtrXAByT__|e8&x|<2ehJIhquJXpiB3_EREa@rAuTz{q0oboFyt=akR{01cAVh5!Hn literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-convert-to-range.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-convert-to-range.png new file mode 100644 index 0000000000000000000000000000000000000000..79baa76507ae5bdd2551ecf117f64b0a7841149c GIT binary patch literal 451 zcmV;!0X+VRP)dPR;=dka*JRd|+PQ z-LnJH3)f*aERrPY$pckYt){;30rC+7Om46VbcvQUV-x5SJ=M$`2>?M`7R8xv0O;BF zC(QB%^k0nbW^7^Gw%Y?@#Xxj@tA);O)aJ=_?N$?6OkeZ>Mn}`4xd`r*R_%)*->YW#u zNDjWHEX%#At=-Qwp}?W}Fp!+ZqTZX@$~V~r+l$!nI!#j*$MJzP3E;4}Mr_PlAr72L z0GGvINT2*LV25VHuIma~4$WsCwnKz;vfT@3i}7!9MADX+$rTW}=Gym0Gw|Evz-K1M t;?}12=DR=?MY+^o3HS_3?S0|a_yuto%vc_NTwwqJ002ovPDHLkV1l|@!5IJm literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-pivot-sum.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-pivot-sum.png new file mode 100644 index 0000000000000000000000000000000000000000..c91adc8c51c42465997c46516b34c750c0817dfd GIT binary patch literal 433 zcmV;i0Z#sjP)XWq~)Fu7lkHH1M~+%{iMio!%6I{w#Q(l$T(W7~eDzY!YKK by%~)^CeOmLV7y>f00000NkvXXu0mjfCELC| literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-remove-duplicates.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-remove-duplicates.png new file mode 100644 index 0000000000000000000000000000000000000000..9d852ccee8992bfb1b58b8f7907b26d7bc227ab0 GIT binary patch literal 396 zcmV;70dxL|P)?3^a|gdTR1x&t8TamGSw3T~2kYR&&bZtW;~8^l5`E~L=lMQO)0ex(T#`f|I%B)X zdbw-NwVFi117ExAy6z^q9D$cVuy$BC$z>Dt$AvqC16E_LEhLx2A1$Br0jt3(B-b(M z!B9oowml|EQqUfpQ$51bB}aQOA@fOWN qC5z&z<{*cr2hD`)3H`eA-@E}W>8WS82#M4H00004Q_K~#7F?U~M#_>50C-w2pJ_oAo17@+B*T<2?!IkcZ9nEk4PY3gWeG`LLU)-`<>#nX>dqfJ0TM1 zC#6p8RD3!4d>q?Ef*=U@ODkK^>-A1lA&bSLMHZX@RY(h%+}|d_3NNpr$SH|a%R0)n zvx}UPIJK;!e(G#-pd}tT0uFmdG0IfGz@dMr0l;8deK4q%K4%Wx@AngkjFW3V=Q?T* ztR+re$EwbXLI-AZS6V>j>~_0<*#>m&5!U;rv)L@xv>D|v3nvGvywHc2&nwPT z-BOk5=v>yxx=~oW$jHG%@r;Gi)nG92>2_%Kso?Rl{R-zk)r8K0|8WFx+K^I9-dLWW zVxg4ld=wfr+SyU591*UwpwU%)Cs`dma3S zZ|KBNee60MANo|V_>+c9pK5ZV_N^drJjz8>^v@6tSBAQrXo|@`v-(PisF;|}dmk}b zlDE&Sor&NfCdcFPH%`}d1>8fM&4%g*&%iD$)K>>ad4anucU|rp+?CbNTg+{)=Eyd= zRCU=Eox5;MDfhXWBma0Vd@XoQ;9Bsir1ZAtcDsFOx7)eFyY&nOJkXWk)jdPef@$6m oqq0v81uu74=Qp4r2*SPd4t%k4b^GQ7dH?_b07*qoM6N<$f}cBlX#fBK literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-pivot-sum.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-pivot-sum.png new file mode 100644 index 0000000000000000000000000000000000000000..67d622242b05fae9fdacf3782821d18b55d48dc3 GIT binary patch literal 768 zcmV+b1ONPqP)M#_B4;KdL2pORxBoZLrZZ~K*xY^)xCurHAcZ9wnfe0gXglteA5dyXUschACNcszck8rJLez-N9F_Whc81$E;C;4{Ao`+k~V zBm^;Pn&9g+Unhk+*Vkz-C%I_4pExiO5ik%DFp$PG(D#fAJ=1*g&90%@*hU;E2!hZ7 zv)L@+Mm+_&CgIjJFIp|^0}FRLoeGYJ!(p~uE=%$xcEw@cJHe$;A2Zylbj@u&3v2Q8 zFU)bDoM?!bs8-ZDF?uarhbf-!GekVgi80^0SmJ5k`!H7N#MT^WIj_|H9QVPAmUyKx zR8ox-TNChbINWIQAXcXPIW|Q6P2F)rAL3<3e?}i7epz2@0&X^&2W)|y1>0`7rS9jL z`*>`%S}mv}@cj?C{ma6cXIzXMpdChpL!p8MQ7tnY}zMoE~w^ehnCEok7(AEVsvh6+MTgNor->!hx zbKWyD?~^?T?we!$4&e@S|51xrk18zAQ^lM)E_Y}%7L^}azO}w60`B*Feknk8^*jHXSnwm9xzNt+870~y+Cn??J4AaMgKe5X z!~$QQkhO&`!5RNdNXW5;Lx`3{bVZ@+T;9S3pMBI5jEaJ+-A$ y%Za(G`sfrEaWa|wp`M~1qV0000HD{>I7LgK=uw{SV$L}%$OSej_mqi_!YPTvR#nNa&mOVF`jLNK5|oANz)JOIaW z9LI5-w`BD9z+^JHLj=3sZUh3Xa_O6USBc zNpsymC2RwO8CvUl&Rv7vy3V<7ppumP0(H;QVwl@YeX+T2pc2x+F83##>n+kWEjF7? zX_-qP&Oz%JxGS)R(kj=?z|cJ0Ew9(>VLF{=@M2WWTjF-W&lwm&8c4knP;V5M%cU5P z$6xp{tD2a%nJCSrpx!i|yipXm{niJMCgyD>N^{K&JRXlFHZI5iDZ>?hH5035<+z1? z21X{bPvP1OsX2`%wwlQ0#!{Qn!N?4rn8@YUunp93yWQY?KEr>8Z6Iez^L!Yx!Mb2y z7|LNthoQ~=P6KC1^L#aA5Ad+B#4V?u$g!(AX7@lz^M*juJPD+M(x>9-bebhe!ZuHu zOA)(%*I)(_&6DPu8Mxo?S6I~I)y%8G+E%y=b3qgHYE0Jyx7+PEFj&n4p~HG0*3Q;9 z*gWu48Eie!kiOOfqi_S247MI<$e{JPfl5r*17on72SQKxy}{;zj^j9v<2cS+@dJ-2 VBHyU+faw4L002ovPDHLkV1mnk21Nh> literal 0 HcmV?d00001 From a964fb89df8d0e24a2afc4a4287738faadf41b4a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Jul 2020 16:23:55 +0300 Subject: [PATCH 24/33] [SSE] Change icons for pivot table --- .../main/app/template/RightMenu.template | 2 +- .../spreadsheeteditor/main/app/view/PivotTable.js | 2 +- .../img/toolbar/1.25x/big/btn-add-pivot.png | Bin 317 -> 0 bytes .../img/toolbar/1.25x/big/btn-pivot-sum.png | Bin 0 -> 637 bytes .../img/toolbar/1.25x/btn-menu-pivot.png | Bin 222 -> 0 bytes .../img/toolbar/1.5x/big/btn-add-pivot.png | Bin 323 -> 0 bytes .../img/toolbar/1.5x/big/btn-pivot-sum.png | Bin 0 -> 713 bytes .../resources/img/toolbar/1.5x/btn-menu-pivot.png | Bin 262 -> 0 bytes .../img/toolbar/1.75x/big/btn-add-pivot.png | Bin 342 -> 0 bytes .../img/toolbar/1.75x/big/btn-pivot-sum.png | Bin 0 -> 713 bytes .../img/toolbar/1.75x/btn-menu-pivot.png | Bin 317 -> 0 bytes .../img/toolbar/1x/big/btn-add-pivot.png | Bin 259 -> 0 bytes .../img/toolbar/1x/big/btn-pivot-sum.png | Bin 0 -> 524 bytes .../resources/img/toolbar/1x/btn-menu-pivot.png | Bin 196 -> 0 bytes .../img/toolbar/2x/big/btn-add-pivot.png | Bin 392 -> 0 bytes .../img/toolbar/2x/big/btn-pivot-sum.png | Bin 0 -> 935 bytes .../resources/img/toolbar/2x/btn-menu-pivot.png | Bin 245 -> 0 bytes 17 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-add-pivot.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-pivot-sum.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-menu-pivot.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-add-pivot.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-pivot-sum.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-menu-pivot.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-add-pivot.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-pivot-sum.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-menu-pivot.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-add-pivot.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-pivot-sum.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-menu-pivot.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-add-pivot.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-pivot-sum.png delete mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-menu-pivot.png diff --git a/apps/spreadsheeteditor/main/app/template/RightMenu.template b/apps/spreadsheeteditor/main/app/template/RightMenu.template index bcba6cfa2..1a6b96c13 100644 --- a/apps/spreadsheeteditor/main/app/template/RightMenu.template +++ b/apps/spreadsheeteditor/main/app/template/RightMenu.template @@ -30,7 +30,7 @@ - + diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 4183a3340..34e292abd 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -180,7 +180,7 @@ define([ this.btnAddPivot = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-add-pivot', + iconCls: 'toolbar__icon btn-pivot-sum', caption: this.txtCreate, disabled : false, lock : [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer] diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-add-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-add-pivot.png deleted file mode 100644 index f1c73e7e23431272dbc9fa3fca2c7d8b0b871dc8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 317 zcmV-D0mA-?P)-=I1fDm%gGp1}{TJbqt4;g^$J_ zVgfSwXsn_pVJRGZ7$PtVf&o*jB0Xf*V`^34f!Vz>L>y$5k(@s;0#+zzY3?SzNExCJ zLxc+oq8meW9cA%ih%jO~0VC5XnCS$}5T$T**Axvk)ep8?PIuKL)H>LZp`4|~oYJ$s ziYn%WXL}Vj6i#_tksSj@-d1GB3~{d_D+Y0|A~Pl#FUktWdQtZD^tkc{`p*Pdv+&PI P00000NkvXXu0mjftSWrM diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-pivot-sum.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-pivot-sum.png new file mode 100644 index 0000000000000000000000000000000000000000..4b576563a54782560650e5485808ed116f021a66 GIT binary patch literal 637 zcmV-@0)qXCP)(=XJyvt0W;AzqY+4ES^u+I z?J51TXipeQ8amt$(T;~`Y8?JMV z)JCvgNgo^e4d4-dY+8K@*+kN9@D##;o5Cc@5fl-WGd7#euDLfFjb1RlACJee3V@D? z68U4t>{Y&CwEE&CVlKDOa5zl4{lQ?6!J#EYE0t$zw@+$#B*R!jw6evFeZ;g?v=k{x zl6>If>)~+l9xZJZt&Wt+7j+|A2&;%Oi2^}V+&~#bDe(21MB$E@OH86*J;liIvGN6D z%pI{Nwh=>xQHpsBA+C!QrgU^L&mq{S3d802Y#TRmiLu0(!ymCPw!$pnL{7z8m&VW& zRRycMHiibQyK6d5RNng%r%QKzch~F-5~pj|?2B6W{BU0?NEBVKJRB{~Q}_~z{BwQ) X4xn7Uk3$&u00000NkvXXu0mjf8(S5n literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-menu-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-menu-pivot.png deleted file mode 100644 index 64d7d49e5db93c1af8498509bca9564bc62f6c94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmV<403rX0P)X1ONa4*Y|M8F%b(priSg zb&AHBj*j96MKsRzUA@$-V;~CMK!qZ72(_H5aUAC-cmR1e VA+vv{_TT^j002ovPDHLkV1mJZi0%LY diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-pivot-sum.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-pivot-sum.png new file mode 100644 index 0000000000000000000000000000000000000000..cd76fa3b15c2b07397d021eeaa0aee572c1405f2 GIT binary patch literal 713 zcmV;)0yh1LP)7L z0x=MV2UzYYfpic$SOiGi5EZ0^lmMlqgXInfIv^de9fUit`~wDUqP4M&_mN~iX=G__ znbC*Wvo?_+2!bF8f0Kr;V=x$;bbZU^vf(n`g}k{^SmH7rwbb;S4$-y_Suzr zPNLbI9FNDuS87pYSEhQzZDNvIy3oAWoZGrd&3nyNYm{25P}81SC#j}A^PbdFh3ni*n@=;^kDJc0?;$z+MDn#YJY#5?xQ zZrx-miQn=>bX{aJAy;UkHt;oG>Fje(h!bByd~CpYjDGJ00000NkvXXu0mjfSob!d literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-menu-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-menu-pivot.png deleted file mode 100644 index f6c03689043c092cfd111c3e905e4397b5a9a02c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 262 zcmV+h0r~!kP)JLJgoYe9HSGMmt7{4WCg z7ft|nh}b$Yv19tSxQXvxE{-iR=g#8X%Rvs=Bu0+|Cq77=m#jla{xKxR0!3#y2cAue zRD+miLqRo(`6TsGymyR>;x5lqmnpbDy2*r9S=8Gd$ z_HeEMA*KjsO4v M07*qoM6N<$g3o1cGXMYp diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-add-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-add-pivot.png deleted file mode 100644 index d93aba848f54d76c3c2c2eb22280d5fabb5a7992..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 342 zcmV-c0jd6pP)IyiAV4#93dn89(oHJS(Mo#Nceoyfq3|&MFEcE zIL`Z#dF1=OCJ*sY)b{L0)b`9pUDQQwMPKZC(x6JJ6&L+K(Rj)?-E8iQ^2D2RHd_+? zxQsFded4u5d7&_LBwlZQUPg(7r6|CK!l6U7-r97{n_jfuT3)#sCkg<0%U>}5nYd9| zvq3ZtN%CwgI#4(pivlquNoPw@fPuoZu_%yA5?fJ#g<>o^g;7%ZgG7s|XdFh#i=t%f zjH+s4fAggEUi0Yn1aQ6AJicP*w6=6XmH5oHr3*UEj?J{I*|V8ye3m3Jw9R$1X6fAZ okC{U6>#3p{x?fL@<2cX5H_w%6HS(@_od5s;07*qoM6N<$g4Rl$&;S4c diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-pivot-sum.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-pivot-sum.png new file mode 100644 index 0000000000000000000000000000000000000000..cd76fa3b15c2b07397d021eeaa0aee572c1405f2 GIT binary patch literal 713 zcmV;)0yh1LP)7L z0x=MV2UzYYfpic$SOiGi5EZ0^lmMlqgXInfIv^de9fUit`~wDUqP4M&_mN~iX=G__ znbC*Wvo?_+2!bF8f0Kr;V=x$;bbZU^vf(n`g}k{^SmH7rwbb;S4$-y_Suzr zPNLbI9FNDuS87pYSEhQzZDNvIy3oAWoZGrd&3nyNYm{25P}81SC#j}A^PbdFh3ni*n@=;^kDJc0?;$z+MDn#YJY#5?xQ zZrx-miQn=>bX{aJAy;UkHt;oG>Fje(h!bByd~CpYjDGJ00000NkvXXu0mjfSob!d literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-menu-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-menu-pivot.png deleted file mode 100644 index f1c73e7e23431272dbc9fa3fca2c7d8b0b871dc8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 317 zcmV-D0mA-?P)-=I1fDm%gGp1}{TJbqt4;g^$J_ zVgfSwXsn_pVJRGZ7$PtVf&o*jB0Xf*V`^34f!Vz>L>y$5k(@s;0#+zzY3?SzNExCJ zLxc+oq8meW9cA%ih%jO~0VC5XnCS$}5T$T**Axvk)ep8?PIuKL)H>LZp`4|~oYJ$s ziYn%WXL}Vj6i#_tksSj@-d1GB3~{d_D+Y0|A~Pl#FUktWdQtZD^tkc{`p*Pdv+&PI P00000NkvXXu0mjftSWrM diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-add-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-add-pivot.png deleted file mode 100644 index 1dcd2ac7a63a956b2dfb9bb3845b276e3a18fadb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^7C)fZ-opw4ESil% z8V6M)n3U}AHi99eYT&7<4}{F_pHRv!4w|BoRB<Yk4E>yTusp16CC>XHdNH_Tz>{23H6 zx3thAEyO0Ub&`gK7Zx-64dEv@^qC{xp|!^vWYMq!{ziGWT>#6Jeb_Ok-_Y8g^; zmd)ERd72Oi-+i^T{HxO%fgM>7ADmdGcwnOMLPqEat`r7ff~b=uBQ%pR03fkJI!YIS^dGe=%NQFIqbiY~WLzvqMw{}v7LyFCJ-B+NxPP8S)}xD z!5B|nOKD5#pXZU*Y|WZSTC*ig!Oc)>$-1>i>h-sEthn1Tp`*SZ;e1s z{S}vhC7ntH#`;Dxor;fDtr}lbF5)pnE@{<#?bs&FWzns0WYI+8nfU?yLk9UMQV`Do O0000h{kIzcscugf$B>F!Zzpc#Z7|?rv2}7g z!O@yN?&xAeCS@C4{fdc9R(h?oUwp~GeZJb_iZRoq?f^d~fzQDYzfYB%JK>@e z|0(rWj#J0yh_3yzcIxjv>8xC4BBxesRacw|aZ~6KIJEJHoobB3f0xwF6Kz{3Y-@A5 vWt?5Q$KGNQk+8Mmx8amHrL*@HYbdO;o=y&#W`UXaH|FUVt~7v!Sc}SI0pjboEDiG56F4CMSpM`rW%N)YXpRgHBkW^ z=cNdieiAHt0$KEWcwF?CV;&d%<(S7sFUaGf7vyo#3-Y+=1$kWbf+Q{pf@fUVqY`ZR mWTA>ns^A8+2pVIIG3Ez8D2a-H5um9600004sfLN{Xid(aOd-RN9D<6lCIb5 z0z7fA-Gco5O zxR=CJT(03gD<=l)z>@O{b)CvXaAHZkLc3LfgA;=kuq+;yQ+1EZv5QzCUaH+r!9m2} z1gsJ-&+|gvr*h09R*9!~m0Y$KF*pHFr_-N0@f2kdsSd;gJ!=9L;wdUbtj#Y(0hf5n z>%>zi5vj;^V&Re>7^VxFh&k7(#CjCk7c5%pJ2n(FVZ6jfu^*`Y$L(Q&X#a7}`9&e% z@pydX;(r(>jq{5_!0~weL}%<${=zVM;avKf=yeoYF-gBU z{708&?7lt5{)WJ*n4~Wa@flp*M}wC}`Ss>N(+W!&6z>=C+lg;x7P|XPD=Zc9pZOtK z6Za9lIM7AB*=+VOoldFi`N@~E&1SQLfN>EIV;|t!wSMM@v5oWVTtFM~P_zU$Y9BF? zA8_qbD9JrJZwTUX3{4fjHeb3B$! zyG@-=1w0%M^a%u*zDA%#c+Zc7TcL16TX8A)$njWVzTWcdR6ueNc8@8FxFh$GP`) literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-menu-pivot.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-menu-pivot.png deleted file mode 100644 index 5a0b396ac2ae296870e741024c52017fd27661e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^0YI$5!2%=?XKw8RQhPjI978H@y`9=Bc$k6b$fl^m z-jw3}pl7R6>QCv*{|r!PmrCw2T;B8iXJ(#({)fL!KmTq^DBHe(^{?3Xe`4G!ejIh) z1vj3aul6pucUE6XM5a~gM6Fz^qt_cLKc(t_+CsbA7=NyMuSZ@Z1&(UFZe=l}KhWl8ML3NVCycx}Pn-qR?E|~vEdWxNK%ij{m sht9RT<=x+~FR7cP@SBkf=&DGD0+uBSIYv8v0{y|@>FVdQ&MBb@0NaIOo&W#< From ad9cce3946e040f1ea08656af335074fdcd2b31a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 15 Jul 2020 13:01:05 +0300 Subject: [PATCH 25/33] [SSE] Check chart data --- .../main/app/view/ChartDataDialog.js | 79 ++++++++++------- .../main/app/view/ChartDataRangeDialog.js | 86 +++++++++++-------- 2 files changed, 101 insertions(+), 64 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 9ef52f845..85fe9ed97 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -123,7 +123,6 @@ define([ this.api = this.options.api; this.chartSettings = this.options.chartSettings; - this.dataRangeValid = ''; this.currentChartType = Asc.c_oAscChartTypeSettings.barNormal; }, @@ -238,16 +237,9 @@ define([ var value = props.getRange(); this.txtDataRange.setValue((value) ? value : ''); - this.dataRangeValid = value; this.txtDataRange.validation = function(value) { return true; - if (_.isEmpty(value)) { - return true; - } - - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); - return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? (me.textError + ' ' + me.textInvalidRange) : true; }; this.updateSeriesList(props.getSeries(), 0); @@ -261,7 +253,6 @@ define([ }, onDlgBtnClick: function(event) { - var me = this; var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; if (state == 'ok') { if (!this.isRangeValid()) return; @@ -278,31 +269,43 @@ define([ isRangeValid: function() { var isvalid; - if (!_.isEmpty(this.txtDataRange.getValue())) { - isvalid = this.chartSettings.isValidRange(this.txtDataRange.getValue()); - if (isvalid === true || isvalid == Asc.c_oAscError.ID.No) - return true; - } else + isvalid = this.chartSettings.isValidRange(this.txtDataRange.getValue()); + if (isvalid === true || isvalid == Asc.c_oAscError.ID.No) return true; - if (isvalid == Asc.c_oAscError.ID.StockChartError) { - Common.UI.warning({msg: this.errorStockChart}); - } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { - Common.UI.warning({msg: this.errorMaxRows}); - } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) - Common.UI.warning({msg: this.errorMaxPoints}); - else { - Common.UI.warning({msg: this.textInvalidRange}); + var error = this.textInvalidRange; + switch (isvalid) { + case Asc.c_oAscError.ID.StockChartError: + error = this.errorStockChart; + break; + case Asc.c_oAscError.ID.MaxDataSeriesError: + error = this.errorMaxRows; + break; + case Asc.c_oAscError.ID.MaxDataPointsError: + error = this.errorMaxPoints; + break; + case Asc.c_oAscError.ID.ErrorInFormula: + error = this.errorInFormula; + break; + case Asc.c_oAscError.ID.InvalidReference: + error = this.errorInvalidReference; + break; + case Asc.c_oAscError.ID.NoSingleRowCol: + error = this.errorNoSingleRowCol; + break; + case Asc.c_oAscError.ID.NoValues: + error = this.errorNoValues; + break; } + Common.UI.warning({msg: error, maxwidth: 600}); return false; }, changeChartRange: function(settings) { var me = this; if (me.isRangeValid(settings)) { - me.dataRangeValid = settings; me.txtDataRange.checkValidate(); - me.chartSettings.setRange(me.dataRangeValid); + me.chartSettings.setRange(settings); me.updateSeriesList(me.chartSettings.getSeries(), 0); me.updateCategoryList(me.chartSettings.getCatValues()); @@ -333,7 +336,7 @@ define([ win.show(xy.left + 160, xy.top + 125); win.setSettings({ api : me.api, - range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid, + range : me.txtDataRange.getValue(), type : Asc.c_oAscSelectionDialogType.Chart, validation: function() {return true;} }); @@ -357,6 +360,10 @@ define([ this.updateMoveButtons(); }, + updateRange: function() { + this.txtDataRange.setValue(this.chartSettings.getRange() || ''); + }, + updateButtons: function() { this.btnEdit.setDisabled(this.seriesList.store.length<1); this.btnDelete.setDisabled(this.seriesList.store.length<1); @@ -385,6 +392,7 @@ define([ } var handlerDlg = function(dlg, result) { if (result == 'ok') { + me.updateRange(); me.updateSeriesList(me.chartSettings.getSeries(), me.seriesList.store.length-1); me.updateButtons(); me.chartSettings.endEditData(); @@ -399,10 +407,10 @@ define([ if (rec) { var order = rec.get('order'); rec.get('series').asc_Remove(); - this.txtDataRange.setValue(this.chartSettings.getRange() || ''); + this.updateRange(); this.updateSeriesList(this.chartSettings.getSeries(), order); + this.updateButtons(); } - this.updateButtons(); }, onEditSeries: function() { @@ -414,6 +422,8 @@ define([ var handlerDlg = function(dlg, result) { if (result == 'ok') { rec.set('value', series.asc_getSeriesName()); + me.updateRange(); + me.updateButtons(); me.chartSettings.endEditData(); me._isEditRanges = false; } @@ -428,6 +438,8 @@ define([ var handlerDlg = function(dlg, result) { if (result == 'ok') { me.updateCategoryList(me.chartSettings.getCatValues()); + me.updateRange(); + me.updateButtons(); me.chartSettings.endEditData(); me._isEditRanges = false; } @@ -475,8 +487,9 @@ define([ up ? rec.get('series').asc_MoveUp() : rec.get('series').asc_MoveDown(); this.seriesList.selectRecord(rec); this.seriesList.scrollToRecord(rec); + this.updateRange(); + this.updateButtons(); } - this.updateMoveButtons(); }, updateSeriesList: function(series, index) { @@ -520,6 +533,7 @@ define([ this.chartSettings.switchRowCol(); this.updateSeriesList(this.chartSettings.getSeries(), 0); this.updateCategoryList(this.chartSettings.getCatValues()); + this.updateRange(); this.updateButtons(); }, @@ -539,6 +553,11 @@ define([ textCategory: 'Horizontal (Category) Axis Labels', textUp: 'Up', textDown: 'Down', - textData: 'Data' - }, SSE.Views.ChartDataDialog || {})) + textData: 'Data', + errorInFormula: "There's an error in formula you entered.", + errorInvalidReference: 'The reference is not valid. Reference must be to an open worksheet.', + errorNoSingleRowCol: 'The reference is not valid. References for titles, values, sizes, or data labels must be a single cell, row, or column.', + errorNoValues: 'To create a chart, the series must contain at least one value.' + +}, SSE.Views.ChartDataDialog || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index f808df9b8..709ee1eb6 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -256,39 +256,53 @@ define([ isRangeValid: function(type, value) { var isvalid; - if (!_.isEmpty(value)) { - switch (type) { - case 1: - if (this.props.series) { - isvalid = this.props.series.asc_IsValidName(value); - } else { - isvalid = this.chartSettings.isValidCatFormula(value); - } - break; - case 2: - if (this.props.isScatter) { - isvalid = this.props.series.asc_IsValidXValues(value); - } else { - isvalid = this.props.series.asc_IsValidValues(value); - } - break; - case 3: - isvalid = this.props.series.asc_IsValidYValues(value); - break; - } - if (isvalid === true || isvalid == Asc.c_oAscError.ID.No) - return true; - } else + switch (type) { + case 1: + if (this.props.series) { + isvalid = this.props.series.asc_IsValidName(value); + } else { + isvalid = this.chartSettings.isValidCatFormula(value); + } + break; + case 2: + if (this.props.isScatter) { + isvalid = this.props.series.asc_IsValidXValues(value); + } else { + isvalid = this.props.series.asc_IsValidValues(value); + } + break; + case 3: + isvalid = this.props.series.asc_IsValidYValues(value); + break; + } + if (isvalid === true || isvalid == Asc.c_oAscError.ID.No) return true; - if (isvalid == Asc.c_oAscError.ID.StockChartError) { - Common.UI.warning({msg: this.errorStockChart}); - } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { - Common.UI.warning({msg: this.errorMaxRows}); - } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) - Common.UI.warning({msg: this.errorMaxPoints}); - else - Common.UI.warning({msg: this.textInvalidRange}); + var error = this.textInvalidRange; + switch (isvalid) { + case Asc.c_oAscError.ID.StockChartError: + error = this.errorStockChart; + break; + case Asc.c_oAscError.ID.MaxDataSeriesError: + error = this.errorMaxRows; + break; + case Asc.c_oAscError.ID.MaxDataPointsError: + error = this.errorMaxPoints; + break; + case Asc.c_oAscError.ID.ErrorInFormula: + error = this.errorInFormula; + break; + case Asc.c_oAscError.ID.InvalidReference: + error = this.errorInvalidReference; + break; + case Asc.c_oAscError.ID.NoSingleRowCol: + error = this.errorNoSingleRowCol; + break; + case Asc.c_oAscError.ID.NoValues: + error = this.errorNoValues; + break; + } + Common.UI.warning({msg: error, maxwidth: 600}); return false; }, @@ -334,8 +348,8 @@ define([ if (this.options.handler) { if (state == 'ok') { if (!this.isRangeValid(1, this.inputRange1.getValue())) return; - if (this.type==1 && !this.isRangeValid(2, this.inputRange1.getValue())) return; - if (this.type==1 && this.isScatter && !this.isRangeValid(3, this.inputRange1.getValue())) return; + if (this.type==1 && !this.isRangeValid(2, this.inputRange2.getValue())) return; + if (this.type==1 && this.isScatter && !this.isRangeValid(3, this.inputRange3.getValue())) return; } if (this.options.handler.call(this, this, state)) return; @@ -358,7 +372,11 @@ define([ textError: 'ERROR!', errorMaxRows: 'The maximum number of data series per chart is 255.', errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', - errorMaxPoints: 'The maximum number of points in series per chart is 4096.' + errorMaxPoints: 'The maximum number of points in series per chart is 4096.', + errorInFormula: "There's an error in formula you entered.", + errorInvalidReference: 'The reference is not valid. Reference must be to an open worksheet.', + errorNoSingleRowCol: 'The reference is not valid. References for titles, values, sizes, or data labels must be a single cell, row, or column.', + errorNoValues: 'To create a chart, the series must contain at least one value.' }, SSE.Views.ChartDataRangeDialog || {})) }); From 57c038ff0c4a3db96d1c3779010bd86f07f36398 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 15 Jul 2020 13:21:32 +0300 Subject: [PATCH 26/33] [SSE] Check chart type --- .../main/app/view/ChartSettingsDlg.js | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index d2b2bc419..cbd4b42a7 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -1484,31 +1484,29 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' }, isRangeValid: function() { - return true; - // if (this.isChart) { - // var isvalid; - // if (!_.isEmpty(this.txtDataRange.getValue())) { - // var rec = this.mnuChartTypePicker.getSelectedRec(), - // type = (rec) ? rec.get('type') : this.currentChartType; - // - // isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.cmbDataDirect.getValue()==0, type); - // if (isvalid == Asc.c_oAscError.ID.No) - // return true; - // } else - // return true; - // - // this.setActiveCategory(0); - // if (isvalid == Asc.c_oAscError.ID.StockChartError) { - // Common.UI.warning({msg: this.errorStockChart}); - // } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { - // Common.UI.warning({msg: this.errorMaxRows}); - // } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) - // Common.UI.warning({msg: this.errorMaxPoints}); - // else - // this.txtDataRange.cmpEl.find('input').focus(); - // return false; - // } else - // return true; + if (this.isChart) { + var isvalid, + range = this.chartSettings.getRange(); + if (!_.isEmpty(range)) { + var rec = this.mnuChartTypePicker.getSelectedRec(), + type = (rec) ? rec.get('type') : this.currentChartType; + + isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, range, true, !this.chartSettings.getInColumns(), type); + if (isvalid == Asc.c_oAscError.ID.No) + return true; + } else + return true; + + this.setActiveCategory(0); + if (isvalid == Asc.c_oAscError.ID.StockChartError) { + Common.UI.warning({msg: this.errorStockChart}); + } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { + Common.UI.warning({msg: this.errorMaxRows}); + } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) + Common.UI.warning({msg: this.errorMaxPoints}); + return false; + } else + return true; }, // onSelectData: function() { From f11ee3f5a24623e78ac14788b3f25c5ce54b3e35 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 15 Jul 2020 13:48:58 +0300 Subject: [PATCH 27/33] [SSE] Add translation --- .../main/app/view/ChartDataDialog.js | 6 ++-- .../main/app/view/ChartDataRangeDialog.js | 2 -- apps/spreadsheeteditor/main/locale/en.json | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 85fe9ed97..0cc7000a7 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -65,7 +65,7 @@ define([ '
+
- +
- +
+
+
- +
', '', '', '', '', @@ -538,9 +538,7 @@ define([ }, textTitle: 'Chart Data', - txtEmpty: 'This field is required', textInvalidRange: 'Invalid cells range', - textError: 'ERROR!', textSelectData: 'Select data', errorMaxRows: 'The maximum number of data series per chart is 255.', errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', @@ -553,7 +551,7 @@ define([ textCategory: 'Horizontal (Category) Axis Labels', textUp: 'Up', textDown: 'Down', - textData: 'Data', + textData: 'Chart data range', errorInFormula: "There's an error in formula you entered.", errorInvalidReference: 'The reference is not valid. Reference must be to an open worksheet.', errorNoSingleRowCol: 'The reference is not valid. References for titles, values, sizes, or data labels must be a single cell, row, or column.', diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js index 709ee1eb6..8fe5b5db2 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataRangeDialog.js @@ -367,9 +367,7 @@ define([ txtAxisLabel: 'Axis label range', txtChoose: 'Choose range', textSelectData: 'Select data', - txtEmpty : 'This field is required', textInvalidRange: 'Invalid cells range', - textError: 'ERROR!', errorMaxRows: 'The maximum number of data series per chart is 255.', errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', errorMaxPoints: 'The maximum number of points in series per chart is 4096.', diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 5c18b0aed..b19f9fbe3 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1272,6 +1272,42 @@ "SSE.Views.CellSettings.textControl": "Text Control", "SSE.Views.CellSettings.strWrap": "Wrap text", "SSE.Views.CellSettings.strShrink": "Shrink to fit", + "SSE.Views.ChartDataDialog.textTitle": "Chart Data", + "SSE.Views.ChartDataDialog.textInvalidRange": "Invalid cells range", + "SSE.Views.ChartDataDialog.textSelectData": "Select data", + "SSE.Views.ChartDataDialog.errorMaxRows": "The maximum number of data series per chart is 255.", + "SSE.Views.ChartDataDialog.errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.", + "SSE.Views.ChartDataDialog.errorMaxPoints": "The maximum number of points in series per chart is 4096.", + "SSE.Views.ChartDataDialog.textSeries": "Legend Entries (Series)", + "SSE.Views.ChartDataDialog.textAdd": "Add", + "SSE.Views.ChartDataDialog.textEdit": "Edit", + "SSE.Views.ChartDataDialog.textDelete": "Remove", + "SSE.Views.ChartDataDialog.textSwitch": "Switch Row/Column", + "SSE.Views.ChartDataDialog.textCategory": "Horizontal (Category) Axis Labels", + "SSE.Views.ChartDataDialog.textUp": "Up", + "SSE.Views.ChartDataDialog.textDown": "Down", + "SSE.Views.ChartDataDialog.textData": "Chart data range", + "SSE.Views.ChartDataDialog.errorInFormula": "There's an error in formula you entered.", + "SSE.Views.ChartDataDialog.errorInvalidReference": "The reference is not valid. Reference must be to an open worksheet.", + "SSE.Views.ChartDataDialog.errorNoSingleRowCol": "The reference is not valid. References for titles, values, sizes, or data labels must be a single cell, row, or column.", + "SSE.Views.ChartDataDialog.errorNoValues": "To create a chart, the series must contain at least one value.", + "SSE.Views.ChartDataRangeDialog.txtTitleSeries": "Edit Series", + "SSE.Views.ChartDataRangeDialog.txtTitleCategory": "Axis Labels", + "SSE.Views.ChartDataRangeDialog.txtSeriesName": "Series name", + "SSE.Views.ChartDataRangeDialog.txtValues": "Values", + "SSE.Views.ChartDataRangeDialog.txtXValues": "X Values", + "SSE.Views.ChartDataRangeDialog.txtYValues": "Y Values", + "SSE.Views.ChartDataRangeDialog.txtAxisLabel": "Axis label range", + "SSE.Views.ChartDataRangeDialog.txtChoose": "Choose range", + "SSE.Views.ChartDataRangeDialog.textInvalidRange": "Invalid cells range", + "SSE.Views.ChartDataRangeDialog.textSelectData": "Select data", + "SSE.Views.ChartDataRangeDialog.errorMaxRows": "The maximum number of data series per chart is 255.", + "SSE.Views.ChartDataRangeDialog.errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.", + "SSE.Views.ChartDataRangeDialog.errorMaxPoints": "The maximum number of points in series per chart is 4096.", + "SSE.Views.ChartDataRangeDialog.errorInFormula": "There's an error in formula you entered.", + "SSE.Views.ChartDataRangeDialog.errorInvalidReference": "The reference is not valid. Reference must be to an open worksheet.", + "SSE.Views.ChartDataRangeDialog.errorNoSingleRowCol": "The reference is not valid. References for titles, values, sizes, or data labels must be a single cell, row, or column.", + "SSE.Views.ChartDataRangeDialog.errorNoValues": "To create a chart, the series must contain at least one value.", "SSE.Views.ChartSettings.strLineWeight": "Line Weight", "SSE.Views.ChartSettings.strSparkColor": "Color", "SSE.Views.ChartSettings.strTemplate": "Template", From 36694c0690186208b330b54d988d3b30a0999cb7 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 16 Jul 2020 17:26:04 +0300 Subject: [PATCH 28/33] [SSE] Fix statusbar styles --- apps/spreadsheeteditor/main/resources/less/statusbar.less | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/resources/less/statusbar.less b/apps/spreadsheeteditor/main/resources/less/statusbar.less index f1afb8293..3d03bc64e 100644 --- a/apps/spreadsheeteditor/main/resources/less/statusbar.less +++ b/apps/spreadsheeteditor/main/resources/less/statusbar.less @@ -194,6 +194,7 @@ box-shadow: 0px 4px 0 #49795d inset; border-top-width: 0; + padding-top: 1px; font-weight: bold; } } @@ -207,14 +208,14 @@ } &.coauth-locked { - vertical-align: top; &.active { > span { - border-top-width: 1px; + border-top-width: 0px; } } > span { outline: none; + position: relative; } > span:after { position: absolute; From 36e04823c442b15e5c6cf2c573f451a0f1841a88 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 17 Jul 2020 13:51:13 +0300 Subject: [PATCH 29/33] [SSE Update categories list when change series --- apps/spreadsheeteditor/main/app/view/ChartDataDialog.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js index 0cc7000a7..496d0007c 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ChartDataDialog.js @@ -394,6 +394,7 @@ define([ if (result == 'ok') { me.updateRange(); me.updateSeriesList(me.chartSettings.getSeries(), me.seriesList.store.length-1); + me.updateCategoryList(me.chartSettings.getCatValues()); me.updateButtons(); me.chartSettings.endEditData(); me._isEditRanges = false; @@ -409,6 +410,7 @@ define([ rec.get('series').asc_Remove(); this.updateRange(); this.updateSeriesList(this.chartSettings.getSeries(), order); + this.updateCategoryList(this.chartSettings.getCatValues()); this.updateButtons(); } }, @@ -423,6 +425,7 @@ define([ if (result == 'ok') { rec.set('value', series.asc_getSeriesName()); me.updateRange(); + me.updateCategoryList(me.chartSettings.getCatValues()); me.updateButtons(); me.chartSettings.endEditData(); me._isEditRanges = false; @@ -488,6 +491,7 @@ define([ this.seriesList.selectRecord(rec); this.seriesList.scrollToRecord(rec); this.updateRange(); + this.updateCategoryList(this.chartSettings.getCatValues()); this.updateButtons(); } }, From a77e0a32ce2ba3edfffb6a00faa0eb52e8af9acb Mon Sep 17 00:00:00 2001 From: Kirill Volkov Date: Fri, 17 Jul 2020 19:14:46 +0300 Subject: [PATCH 30/33] Add new icons for View tab. Add icons Sheet view, sheet view close, sheet view new, freeze panes. --- .../img/toolbar/1.25x/big/btn-freeze-panes.png | Bin 0 -> 325 bytes .../img/toolbar/1.25x/big/btn-sheet-view.png | Bin 0 -> 842 bytes .../img/toolbar/1.25x/btn-sheet-view-close.png | Bin 0 -> 404 bytes .../img/toolbar/1.25x/btn-sheet-view-new.png | Bin 0 -> 337 bytes .../img/toolbar/1.5x/big/btn-freeze-panes.png | Bin 0 -> 337 bytes .../img/toolbar/1.5x/big/btn-sheet-view.png | Bin 0 -> 953 bytes .../img/toolbar/1.5x/btn-sheet-view-close.png | Bin 0 -> 460 bytes .../img/toolbar/1.5x/btn-sheet-view-new.png | Bin 0 -> 371 bytes .../img/toolbar/1.75x/big/btn-freeze-panes.png | Bin 0 -> 363 bytes .../img/toolbar/1.75x/big/btn-sheet-view.png | Bin 0 -> 1070 bytes .../img/toolbar/1.75x/btn-sheet-view-close.png | Bin 0 -> 500 bytes .../img/toolbar/1.75x/btn-sheet-view-new.png | Bin 0 -> 442 bytes .../img/toolbar/1x/big/btn-freeze-panes.png | Bin 0 -> 272 bytes .../img/toolbar/1x/big/btn-sheet-view.png | Bin 0 -> 629 bytes .../img/toolbar/1x/btn-sheet-view-close.png | Bin 0 -> 347 bytes .../img/toolbar/1x/btn-sheet-view-new.png | Bin 0 -> 301 bytes .../img/toolbar/2x/big/btn-freeze-panes.png | Bin 0 -> 451 bytes .../img/toolbar/2x/big/btn-sheet-view.png | Bin 0 -> 1186 bytes .../img/toolbar/2x/btn-sheet-view-close.png | Bin 0 -> 695 bytes .../img/toolbar/2x/btn-sheet-view-new.png | Bin 0 -> 553 bytes 20 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-freeze-panes.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-sheet-view-close.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/btn-sheet-view-new.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-freeze-panes.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-sheet-view.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-sheet-view-close.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-sheet-view-new.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-freeze-panes.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-sheet-view.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-sheet-view-close.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-sheet-view-new.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-freeze-panes.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-sheet-view.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-sheet-view-close.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-sheet-view-new.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-freeze-panes.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-sheet-view.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-sheet-view-close.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-sheet-view-new.png diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-freeze-panes.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-freeze-panes.png new file mode 100644 index 0000000000000000000000000000000000000000..afbd464a7866c2a56f6c6227879f363a755c6860 GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!3-qjPWHqDDYF2d5LY1W>gwv^;sPZ9!+^81 zGmr@pgs_2J2L}fr8=}lIOGzK7Q>Y}!FPLG$|M@_ambTtt{dxm~`}glxGq~mgW!HGR zIEGX(zP-Z8b;y9H^lD&`V!(=y&xT~e=U2`_>E_lM_ ze0W*ST~2E`^QW)S8?Wv?*gxlET_f`Tf6^noJH|*sYT80d+gTe~DWM4fo4Sa& literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png new file mode 100644 index 0000000000000000000000000000000000000000..cd44867e1d6aeb1d66142ad68d39ca7e1b72e500 GIT binary patch literal 842 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!3-qjPWHqDsTBb}A+A8$1qNJQU13a@|JZkOUe47Y8zcTn`Tqpg4pL(FNUIIry+Vf=_>`vn>FMR*+QQO?O zd;ia_OPC_MWUs@g;9^->S;NEn-_&2kw0f=FAkA8%{7&_j#NywXXQt<<2S`+pHG-{CS&$j zPwC=k)n%54*u-7LKIHc$gce=m5YHEIJyY2Fz-;>))gD{zrDBs5ZzX>g+-m(+L$$}d z$1wZkglQJGt|4o4n6WU39}FXCCBT_H+t#R&ieg) zSMxsq$2~WGn7CJRMnZZ>VxYE_h1_ni-Vozl-c z|Ni#_fy<0Gy|S1Xm9Ba&pXIlB6VFB-9i=;l_mwrSA7M=rwr;W8s3pDo!b0n1Z+~^2 z+qRM0_LuQ3HqO1y*~_1q|7>06y`wtw{gqeUbE8h{Rs7x{92XTV_VC`NkXQHGdE;MS zy7+BYdT({{+?9VOn!PKzxWl~p&=1=T{-B4^wSQk(XJk%xbmM>ZI{d!l@##$~qVGTY n%)i~@?e*;zp2>CV?f)~oWNOOGKC^QGCNu_5S3j3^P6X1ONa4*QQWO|J54dBQ~N5qNXh@3Hw zymIV)w$w)_viDjP9rj)%`gG2=oClB5<3#WjV8DyuIb(}?qRXaTopn$YMa%TvWqVG8 z!X1ONa4*m?4MklkE#BXParK%s{iC;$nOMy$C-mS jU4Y3&aoKT0Zr%Cgwv^;_@F1oSmJ4 zG>`-eLPQ)K9DrOWCnq5H()|lNfExHqg8YIR?*G64KP@fZAl|^>enJAL^qMN5)Dce? z$B>F!Z?9hDYBu0$eRx@7>#bei>+g7KxNWF7HN!l5Klj_K{uwM6OaJShSle)T!FDza zN#DxY^A;~sPQ9*rcTw4E&LWr8pdEtij5P1CTwl!Z-o0_%roSuS9e;P_2n&Ds=71MUOl} zVh=Ad^ys@k=gKV4pg#G#nbV}Qoi>D@)c>`oHp{z#A(Q#D*8P{10Wm10FoXa9$0k%6$8bA3f$b>fDDLsh)SRo&}yI*kPBouIXOWX5cA=J zK#j&39OXc_T9gF&1v5D0ufPBP|M>A3VX$*$pyv5$!GuV=5~?j`Wb8Tc)r-_h*c_qt1V(b@K@!HsEuT5qm&3H@$*rQ1zy)7qVW#gjupOZTpsxgvG;DRsS)qo144e_5$td9iTW^!48JUj~2Q`o?l;d$XP^-}9AA z?arABr{(yp&9d-c>$}Iu=Pdt*&K&~01rjqNOfM{n@o>*@Q`@CHh4osFz{3Ztt~ecD zc=&bl3e{^#Atzs~GCAdN`SD&|lRdX@CCdKWwk=q!Q7^9Go;UOFYka$(Y@a)Kl}OK> z$5R~nc#MBHT-f+{He-d@EpzrB?%xeZHa`B#u}7;p^>oQ;la{_*BYp;@=mzb}x|e5I zZ1arvdc~#j){pD0$Unt9Z&sJ;b8+rht=BOBoprbVM?j1J*M;j8zRTN%{0x!Ln*Umy zx#{(MeTHk%`z0Fo{QJq3a6KvWBcp`fEnZQp`EM+CG~L-($$IR3nX~G-$+GU>7oFSf z;5_AL@ssH%bRTiQcp!W(PRc{OzVFYZTPtri&y-`hDITv|BkPp-eY*D384p9(t{1!4 z-?{1c>8V2DK0NUW9Tv%_{}>q0Ei<)0Tl@zE^$n|i@#Mrck=vE0^G zzSdHHsg6JOEWCA_r}H}=o9T7!x3>HJ)oXTq*cy=^v+DetYmZvF-#=YvX}{$6+*`%2 z`#9fNKGN4wG&(C!PwU^8em<`8~e6UOVcT_x9C!d3kjV*OJUa8mdKI;Vst0ITlPsQ>@~ literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-sheet-view-close.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/btn-sheet-view-close.png new file mode 100644 index 0000000000000000000000000000000000000000..2c25f873bd711a64a8ad54a9a35d86a3c1687e04 GIT binary patch literal 460 zcmV;-0W&Cjk9gIQp{khO3m$9Qf?b~)i z@YrLI{h-BR`V#L{3J`$5Q:*B3%~!5btflQ2OE%o8e_RPvq|v37_fUhok^XuO~e z!g?qc7(}=mF@SU5oFR0GL$w!;m~nL)&-j>1cizAdI)L`Y0A^gBIUn&Kc7hf4vKO5a zTCdiev@W#98eiyu%=kj~1IuS>D2Gkt-}fdCN6G4FK->Dv^_F+h&(Cu5M*awOzN_CG5Q#uUqOW z`eIjauZwLetx==4A|j>pL$Lk6aTq;?hzK>2NSo>dw%hmB1=FwTTU#Za zCRLg}H4Y=Ow9H8?&8|AwED_PTh-22>8VgHY#5rtP_@&=1v9f!+OTSxU*jGDm^Ac$@ zi+y)2PNS}u!OrQj#FN_h(@pwLqsG`}Z;%fLu;<;DfU($10)iYokpr4=9 zs-7bjDc$E?$6&82&4O{<8L?MYrubF2b@Es?^Tsd8+u;Z7DgFoIGiQEHz5zOPCQU{> RH}L=f002ovPDHLkV1g@fs6qe$ literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-freeze-panes.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-freeze-panes.png new file mode 100644 index 0000000000000000000000000000000000000000..5688d5beb5df430cf693d36f3a90211ef067bfcd GIT binary patch literal 363 zcmeAS@N?(olHy`uVBq!ia0vp^NkDAK!3-qD5_?jClvaRGh%1nGb#--darqAh&d$z2 z+QY*GNCMeFDF+7!AR9=g|GobjsG6@N$S;`T{{Q>`)6x_a?i(l=7%VZ=Qv=F8@^o5_ozxUrQ%@GrsvM-{k^_gwN$CUXgJVvvYW!k5`w91|}XaBiU z7TxqsedWtet_M+Gf3z8|2s=y;p0RD|?XO2ZcwWz2eq?rM{^>m*m&QKdTP!Bz=V9Sk z&RO5h;lwhf!^vd|hi16aZC>R?x3xF!=7_n~C3AFvlFWgnYfr@SoZo*#^T-0Fgv|nn zH#Z0-32+N2wxu(wtl(9wk*?{=(R{kxPw|kW&FAN72Pdn|vvl&w4_Q>`)21Y{NJ9F< vLCXsLh9C1i!xnsd+a}DkUTD^`v%eYc-WRug?(t0)=vxL)S3j3^P6gZg3GG1ELaWCPV>51gPfu zg?dAvL(NNq{DK(_^5>tw|Ns5|^>BtleS(63LBawcEwG^BenWpjf5Cc(f&hnr`1lDE z7UXZ(5D+iQb4rSVftk_M#WAFU@$EIv&9@W;*gx#=ZRi!eaAd)x-RtGv@7w?1{dL3L zjR(Kf75|=Hd|bs^XSaf$-G!q^kG=>tNt;t_`14O@i@kvVGuFr$A7* zn0d`L>2r}&9!<|#IMvT9nz1laTUGe?YZhTemt==eZJ)n|d%lUuz8k8r?RTlrPos8xRorOBwq}!vUDhj= zc&+P)4szXOJYckF5$8J&t#gxqf9;Z-b3(VlXyKyFrx{v)Z|m-U`={{G#IlYUI} zi1pZ6&g;PS|Km|xT~FD}*G{MQzF?Rn*Pdw8wEf`|#<+7edo`3ZW~UqOiJIvC>+W^$ z=m}>T`IfILRC*xExP0b=5Dxdit0EUaXz?ze-CS_l`=I}W3;JzND^^W+ntNbjycVlb z<^v99|AI^3f^34V6Yd?nC~C8|l~bne@*gr=wfpbIaz8)qQE)M! zDPGm{T`c!)ql;eUV*9sN-SfTkW@F)(J-;^BH+S!xZENYh%+T%}FdZK?pPc02y79|} RWMF<`@O1TaS?83{1OU1g1jhgX literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-sheet-view-close.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/btn-sheet-view-close.png new file mode 100644 index 0000000000000000000000000000000000000000..bcd3904277db6a06820707811985f82ee4992d64 GIT binary patch literal 500 zcmV^ndbCy*b9+nX#G49WT%Nh_re z9XfRAkUgp@Ms}O0Dy=VbukFtDN%4YtL;fCrL3tu1s1v&f!vW0 zaD&E4DWzcG5g^#^a?valto{P2-IL{_H=$?<0`%8^o)BztVMB?U?&NMP1d2n8s)iDq zRTP7S-UT-ZfH<@W4HC?1RVdm1A@+p+(_33ZX}LPk`Bm^3)QoVKtHUx}suaZmhGqD@ zYVy+;7(wQOn89T4p}~@iyHd>09f&Ftt{Ay=9I8}qR2h~%FdvnXoiJAC<5@KW429{~ zvZ1hPW|{#8VLG-j2=h3jG*zDB3&t8JISv~ZYc{6IBfen_B*&Sazikt7?Pp$coMn`L z&$OR;$**5Ud5`YH359b#ZcT@?j`F_j0YN}LzOX~sh|;ylJzwD-H?HGu_w6tN0Zkg{MCgGOXbI-yaUBR;D4-4H!IU*?LaA=nK_hcvi6}&zwbubk5jy7 qX2Kq(39`n8VwkcGeCW`j|Diwgl7n);^CN5k00008NGBp(6Yti^Ma~Gc#P0JAtQH$@N zs`M0Y6fR^SEk{J8@QiXYTI}s7AC%j;p>40_=iR}qmm;tvZgkDh`;wPMMKmokK1+4T ztSF?FOg%-Ter)EfN3}|1Lt&F@8Ef38o<6T+(xUi8#%$|JUb&=2@u|)b*SBSei;O$h z%7_rxI>eRC`GAawzHM}ZCgrY46&T(&I)MatO{zPvA-JsL{(Y%y4}r|Me_yKGV~x9N zansA|qZg&N${4N`CSD)CCj4agz&q*t(uZX31@^`f3cLA*nEXNb k6H1e5GXGnqrKM#jpJKOnJ!_6rH2?qr07*qoM6N<$f=#~5J^%m! literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-freeze-panes.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-freeze-panes.png new file mode 100644 index 0000000000000000000000000000000000000000..625e42c03129723face295b745c2859751b62664 GIT binary patch literal 272 zcmV+r0q_2aP)CJ(h-_>;1ct;p8p=9?v#9DM zF&>%Msdujg$>Zd8>fC=VIL}6K8eNBVy77?aWzS*#j!oSk3SO*-q~##PW5~y}wEbpQ zP-Iasxa{ub*97UZJNktTMP5F_G||)$+-!y-^aPcp5_D@0H6qavbkU&_BtczjX>Zru z33hkQy+cz&VuXFiVZ?ZQ24@JG7&IdI;#-WjCtZ=DmlXt`r?ecI8PK0ox>&cd@xdF^ W>wWEN?9F8W0000$?bvLTa%`{o^t8a#^D;XpD=m5VP_U{nQ+Jij)WwG`tMVGD3G6Uodnob5 zplz1oO7CESUPs>G6+e?N{LcJv)#=iY6xC38>qW|)W83zna-92>_uc&1(b}gyVUIWbUbaPYpI+q;xt#^`H$V72>Gbq7 zt?E$=pXpCgdeGDA`0k>)(d4Y9DN%`U`tLusKetuld$`XDJz(rHc)I$ztaD0e0s#Lr BH1Plc literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-sheet-view-close.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-sheet-view-close.png new file mode 100644 index 0000000000000000000000000000000000000000..ad135aa8d66fa91e2407cb2c193f58e1ba33350f GIT binary patch literal 347 zcmV-h0i^zkP)1iqqKf2K1ZG!`U?B38Wi>5)9`^w9aUR$sG8o? zcfxQguBH08z6)P&xg;jpF*aCLYg8t5E$74}JH7{0AEy~Qq)hnR6_8dY$;v95wCYln z3A+MfOp;Z5_H|BX<4VzxjPGz2I&o&Pw471yC9ap92{P?Far3~vPnwlH?aj%#!uhts tmR-y85_g{ApD48Kw4!hUJfHGA=@;y!&gnQFai9PI002ovPDHLkV1idaoJs%y literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-sheet-view-new.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-sheet-view-new.png new file mode 100644 index 0000000000000000000000000000000000000000..9b7b8fd425e28900714557dd91af094cf3d179c4 GIT binary patch literal 301 zcmV+|0n+}7P)zIjm?Stj>9vt(EM^A5Z1Tsl4s%DxpK+%8?5vKdHDuy4#96Wg*2* zdme?8{pEBxJ@V0*c9(9e%F$>r9F1vr3CaOYWxnAbyUeE|8lW~N-QmPFg({tBm!0C7 zPz9587XCF|;dyW8(dSU*f_AtRT;$$B_^J5=-<75|KA7Uw6uJM{CtIi0)_ht z1qrkMtF2&QU=;IoaSW+oe0!yJ60;#k!^09!^G)mC|6jpgx{mGnq4={m%n!Ge%1=#= zoVHcdVaEL(-P=+H#J2N%QCL?XepF#yih_ex$-naVZ}hkn<*okjE;suy+0m6JrmLJ`MCiM``4=)V&N+BIZ+WYCk*+ P3`7P`S3j3^P6gvnD literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-sheet-view.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-sheet-view.png new file mode 100644 index 0000000000000000000000000000000000000000..7f81c53256283ba67fe9837cb698ae47021b8a44 GIT binary patch literal 1186 zcmeAS@N?(olHy`uVBq!ia0vp^1wd@U!3-pYOnWMT)XV^%5LY1W3I@*3&Mq!4Kqioc z0HDZ!+yJNsC<#>K00wSuZVTkCULam!fx?3R`~3>**Dr{#uWx8b zNGK>Mn4hqI3B&RR1_tIHM%MVL?#;RX|NjnY>1)Tj zXFk3aa&JnB^&}m}KmKZyPo@}E&$3?E-mz|f#jJxFjuJ;by<9w}wKMjF=-8O-_{`*{ z@p%f5XGq`8bM6Q0*GVvF&zn8{oP7PxST`pzHkpR$iJy()`flg#V@lnccW6%U4ZT|p zn{JvVvKjQe4Oqc#uqI2SjEC(*?dCGhHeaVh^A0yOcklT2;YRcf*^9BtyVy5O3X9!S!*_gb5|x1u5~e2rwp2C4El zJr#}fQoW+<7PmCB`e&Tq?&9rT(@}1ru4sYolMon^)3rk6%dMH0_MX%r&y_Sx)57 zyjV9UNH05cS&e%3_oh1aB+vOi^6|5xoQ}uoees%klk4u}nHRHzy)V>dZ9it7vGc|S z!M&$T!sE90h|*l+_~sneP-#Pib&-JXn1+E@0>C;HMq!*1r~m}{M!x$4qA zo-f`0vZ|T|b9MT(ODv3S)V`c;`%YH97ARD6|1x{t z+_h3Y+bmAxzY@?ixYhJ}8^dB*6m)HzrQL zw07nN<|i@xPd?0Db);|gy|2ePK6FJy>g_kb@nxO8TZ8%H2CdeP`##q;`Csd+RjPA5 zuYIxe`C;(~bKG6lCj?%7aW3l*TetGH*6uh~F-N1C?!rY&w%kp6G1+qc$KB$}zg_az z`LB7arsb7m9w@kUqTR;YoWwZhXk+o#qaSjU)IXQu;JJoc-!;pF1P0G8VM~4vnME?^_Ey! z758JE&T`}WbqQM(&KU2^7IIHy_}>rAOf&y*{^Sd??9e^J2F%Y4p00i_>zopr0Oip> Ap8x;= literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-sheet-view-close.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-sheet-view-close.png new file mode 100644 index 0000000000000000000000000000000000000000..075c8369da62edaec9b8a4905b19ac983e184339 GIT binary patch literal 695 zcmeAS@N?(olHy`uVBq!ia0vp^0YI$5!3-qh_VpSAsm1`G5LY1W;Nalu>gw$5>;eOB zZf^gv0S^xkpfZRIL@kgD)DC2$DF+$|6o)H@n-5e5VFO7ZaB_0`_QrM}&=J}tL4Lsu z0txfazyBW(r4%M8Oz7XAZ{PqX?kg;~zrf)B`t=Le&(BXdIj7r_fq`+Cr;B4q#jUqf zqKlgh1X_K0qq&xxaAgsFqIBuo|NjS$^==k)PMGsD+E)L~sb7VYoFn#rx#WGmYwy~f z%nv?%wVpk@*xtroK%5doFZ`$dtqIx&YXWH&ut=TQUyH2Yv zy&)eHDfhiKr>Oi=9Os6WCGm3^P8A%A({+)#`?Xi#Ys<-PEqcxcuMSwcq_C&{wkTiW zTI&!X*kN~wtKR5utc2K(UOu6l3v9FMd%Iclk{evMo7-#>VhiPM@Cq$&oYebmz1ZGW zRgGF9*E_2A^mCT@gf4ipqOWwqo%2t>xGxmB(ELfTz}at|c3h;W@P}PVuO+O028CuZ zP7?MHJ*p!hY-_ADM|;Cl#iK`W7i!qHDj9!Q-u1YD^0{5ni>@j(#+ZrN*Vp7Kv3wDF zak_2Z6KT1xnX3iXSH!07xe@2WD^&V%0*}M5y~!>nl`ACr?_E@#aPsnUURRf9cM$nV zGRa>39mCpL70;fp{>bdO`r4k>2c7BSLendz=%@Z=cQ~_nwz}QclrxKGsY@-?`Ir}} z|LMi16UvX6@@Jk9^%vZkd&;7!ELEn`X`us;a80s{VrVJ36c?d+LWqRmyN_@+DVB#JJgOk8Pa&roQtOz};3*vWHay&#xg zukK4XW)uYLkNHT02cTc~iG~pXf5=DMS}z!{+XYxA34*ubkB~<@tvEb6GMWijN5lHE<7&BN0W47NDvin*F~+Y7mQ1PGcF6rl({_$ z)^GPB3J+xUa9KREdW?X7(Tmav=3&8y1c!V>#tYJI0(Q>}KIAv7Y-qFI$@I^TJdT=E zf#_ENA4W|{z37M?GQcSV{8I!tJCfDAkCjjy!Z?3!eGA|k)YkJ(JznT% r0)F*~_h7%XUInax6|kzR>Oaz7!EL@D+fJS;00000NkvXXu0mjfz()Gq literal 0 HcmV?d00001 From d53ae5fab97d4e27b08fe217e4414b4408edaede Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Jul 2020 15:32:58 +0300 Subject: [PATCH 31/33] [Common] Add help button to window component --- apps/common/main/lib/component/Window.js | 13 ++++++++++- apps/common/main/resources/less/window.less | 25 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 063bed7bf..6e3249300 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -152,6 +152,7 @@ define([ alias: 'Window', cls: '', toolclose: 'close', + help: false, maxwidth: undefined, maxheight: undefined, minwidth: 0, @@ -162,9 +163,14 @@ define([ var template = '
<%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;">' + '<% if (header==true) { %>' + '
' + + '
' + '<% if (closable!==false) %>' + '
' + '<% %>' + + '<% if (help===true) %>' + + '
?
' + + '<% %>' + + '
' + '
<%= title %>
' + '
' + '<% } %>' + @@ -284,7 +290,7 @@ define([ /* window drag's functions */ function _dragstart(event) { - if ( $(event.target).hasClass('close') ) return; + if ( $(event.target).hasClass('close') || $(event.target).hasClass('help') ) return; Common.UI.Menu.Manager.hideAll(); var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1; this.dragging.enabled = true; @@ -635,8 +641,13 @@ define([ else (this.initConfig.toolclose=='hide') ? this.hide() : this.close(); }; + var dohelp = function() { + if ( this.$window.find('.tool.help').hasClass('disabled') ) return; + this.fireEvent('help',this); + }; this.$window.find('.header').on('mousedown', this.binding.dragStart); this.$window.find('.tool.close').on('click', _.bind(doclose, this)); + this.$window.find('.tool.help').on('click', _.bind(dohelp, this)); if (!this.initConfig.modal) Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this)); diff --git a/apps/common/main/resources/less/window.less b/apps/common/main/resources/less/window.less index afb367b6a..5a47e07ca 100644 --- a/apps/common/main/resources/less/window.less +++ b/apps/common/main/resources/less/window.less @@ -59,6 +59,12 @@ cursor: move; + .tools { + position: absolute; + right: 0; + padding-right: 6px; + } + .tool { float: right; width: 16px; @@ -80,6 +86,25 @@ cursor: default; } } + + &.help { + width: 20px; + margin-right:0; + line-height: 14px; + font-size: 14px; + font-weight: bold; + color: #444; + opacity: 0.7; + + &:hover { + opacity: 1; + } + + &.disabled { + opacity: 0.3; + cursor: default; + } + } } &.resizing { From 70a4ff2b879dc193dbf1ba671edc2bbd1ac3f945 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Jul 2020 15:33:22 +0300 Subject: [PATCH 32/33] Show help for plugins --- apps/common/main/lib/controller/Plugins.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 8bf8ff38a..6a6d38878 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -203,6 +203,7 @@ define([ plugin.set_Name(item.get('name')); plugin.set_Guid(item.get('guid')); plugin.set_BaseUrl(item.get('baseUrl')); + plugin.set_Help(item.get('help')); var variations = item.get('variations'), variationsArr = []; @@ -380,6 +381,7 @@ define([ }); } + var help = plugin.get_Help(); me.pluginDlg = new Common.Views.PluginDlg({ cls: isCustomWindow ? 'plain' : '', header: !isCustomWindow, @@ -389,7 +391,8 @@ define([ url: url, frameId : frameId, buttons: isCustomWindow ? undefined : newBtns, - toolcallback: _.bind(this.onToolClose, this) + toolcallback: _.bind(this.onToolClose, this), + help: !!help }); me.pluginDlg.on({ 'render:after': function(obj){ @@ -404,6 +407,9 @@ define([ }, 'resize': function(args){ me.api.asc_pluginEnableMouseEvents(args[1]=='start'); + }, + 'help': function(){ + help && window.open(help, '_blank'); } }); @@ -555,7 +561,8 @@ define([ currentVariation: 0, visible: pluginVisible, groupName: (item.group) ? item.group.name : '', - groupRank: (item.group) ? item.group.rank : 0 + groupRank: (item.group) ? item.group.rank : 0, + help: item.help })); } }); From e79fa7f09355e9de448fe1b979841f1b7cf44f55 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Jul 2020 18:23:39 +0300 Subject: [PATCH 33/33] [Plugins] Move help parameter to variations --- apps/common/main/lib/controller/Plugins.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 6a6d38878..b305b8649 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -203,7 +203,6 @@ define([ plugin.set_Name(item.get('name')); plugin.set_Guid(item.get('guid')); plugin.set_BaseUrl(item.get('baseUrl')); - plugin.set_Help(item.get('help')); var variations = item.get('variations'), variationsArr = []; @@ -226,6 +225,7 @@ define([ variation.set_Size(itemVar.get('size')); variation.set_InitOnSelectionChanged(itemVar.get('initOnSelectionChanged')); variation.set_Events(itemVar.get('events')); + variation.set_Help(itemVar.get('help')); variationsArr.push(variation); }); @@ -381,7 +381,7 @@ define([ }); } - var help = plugin.get_Help(); + var help = variation.get_Help(); me.pluginDlg = new Common.Views.PluginDlg({ cls: isCustomWindow ? 'plain' : '', header: !isCustomWindow, @@ -541,7 +541,8 @@ define([ url: itemVar.url, icons: itemVar.icons, buttons: itemVar.buttons, - visible: visible + visible: visible, + help: itemVar.help }); variationsArr.push(model); @@ -561,8 +562,7 @@ define([ currentVariation: 0, visible: pluginVisible, groupName: (item.group) ? item.group.name : '', - groupRank: (item.group) ? item.group.rank : 0, - help: item.help + groupRank: (item.group) ? item.group.rank : 0 })); } });
', - '', + '', '