From c394393bba312bb17a19c61b54fedc4c0dc75d3c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 10 Apr 2020 17:50:58 +0300 Subject: [PATCH 01/20] [SSE] Insert slicers. Bug 30397 --- .../main/app/controller/Toolbar.js | 20 +- .../main/app/template/Toolbar.template | 4 + .../main/app/view/RemoveDuplicatesDialog.js | 2 +- .../main/app/view/SlicerAddDialog.js | 234 ++++++++++++++++++ .../main/app/view/Toolbar.js | 16 +- 5 files changed, 272 insertions(+), 4 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 08cd523a2..dcc156ee5 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -58,7 +58,8 @@ define([ 'spreadsheeteditor/main/app/view/PageMarginsDialog', 'spreadsheeteditor/main/app/view/HeaderFooterDialog', 'spreadsheeteditor/main/app/view/PrintTitlesDialog', - 'spreadsheeteditor/main/app/view/ScaleDialog' + 'spreadsheeteditor/main/app/view/ScaleDialog', + 'spreadsheeteditor/main/app/view/SlicerAddDialog' ], function () { 'use strict'; SSE.Controllers.Toolbar = Backbone.Controller.extend(_.extend({ @@ -328,6 +329,7 @@ define([ toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this)); + toolbar.btnInsertSlicer.on('click', _.bind(this.onInsertSlicerClick, this)); toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this)); toolbar.btnPercentStyle.on('click', _.bind(this.onNumberFormat, this)); toolbar.btnCurrencyStyle.on('click', _.bind(this.onNumberFormat, this)); @@ -2759,6 +2761,22 @@ define([ } }, + onInsertSlicerClick: function() { + var me = this, + props = me.api.asc_beforeInsertSlicer(); + if (props) { + (new SSE.Views.SlicerAddDialog({ + props: props, + handler: function (result, settings) { + if (me && me.api) { + me.api.asc_insertSlicer(settings); + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + })).show(); + } + }, + onApiMathTypes: function(equation) { this._equationTemp = equation; var me = this; diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 958f2d26d..cb7050e5f 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -144,6 +144,10 @@ +
+
+ +
diff --git a/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js b/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js index b124eb5d7..50cde1eb9 100644 --- a/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js @@ -40,7 +40,7 @@ define([ 'common/main/lib/component/Window', - 'common/main/lib/component/ComboBox', + 'common/main/lib/component/CheckBox', 'common/main/lib/component/ListView' ], function () { 'use strict'; diff --git a/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js b/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js new file mode 100644 index 000000000..912674a2a --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js @@ -0,0 +1,234 @@ +/* + * + * (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 + * + */ +/** + * SlicerAddDialog.js + * + * Created by Julia Radzhabova on 10.04.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/component/Window', + 'common/main/lib/component/ListView' +], function () { + 'use strict'; + + SSE.Views.SlicerAddDialog = Common.UI.Window.extend(_.extend({ + options: { + width: 250, + style: 'min-width: 230px;', + cls: 'modal-dlg', + buttons: ['ok', 'cancel'] + }, + + initialize : function (options) { + var t = this, + _options = {}; + + _.extend(this.options, { + title: this.txtTitle + }, options || {}); + + this.template = [ + '
', + '
', + '', + '
', + '
', + '
' + ].join(''); + + this.options.tpl = _.template(this.template)(this.options); + this.props = this.options.props; + this.handler = this.options.handler; + + Common.UI.Window.prototype.initialize.call(this, this.options); + }, + render: function () { + Common.UI.Window.prototype.render.call(this); + + this.columnsList = new Common.UI.ListView({ + el: $('#add-slicers-dlg-columns', this.$window), + store: new Common.UI.DataViewStore(), + simpleAddMode: true, + scrollAlwaysVisible: true, + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '
' + ].join('')) + }); + this.columnsList.on({ + 'item:change': this.onItemChanged.bind(this), + 'item:add': this.onItemChanged.bind(this), + 'item:select': this.onCellCheck.bind(this) + }); + this.columnsList.onKeyDown = _.bind(this.onListKeyDown, this); + + this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + this.afterRender(); + }, + + updateColumnsList: function(props) { + var arr = []; + if (props && props.length>0) { + this.props.forEach(function (item, index) { + arr.push(new Common.UI.DataViewModel({ + id : index, + selected : false, + allowSelected : true, + value : item, + check : false + })); + }); + + this.columnsList.store.reset(arr); + this.columnsList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + } + }, + + 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 (e, data) { + var record = null, listView = this.columnsList; + + 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 { + Common.UI.DataView.prototype.onKeyDown.call(this.columnsList, e, data); + } + }, + + updateCellCheck: function (listView, record) { + if (record && listView) { + record.set('check', !record.get('check')); + // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + } + }, + + afterRender: function() { + this._setDefaults(this.props); + }, + + _setDefaults: function (props) { + if (props) { + this.updateColumnsList(props); + } + }, + + getSettings: function () { + var store = this.columnsList.store, + props = []; + store.each(function(item, index) { + item.get('check') && (props.push(item.get('value'))); + }); + return props; + }, + + onBtnClick: function(event) { + this._handleInput(event.currentTarget.attributes['result'].value); + }, + + onDblClickFormat: function () { + this._handleInput('ok'); + }, + + onPrimary: function(event) { + this._handleInput('ok'); + return false; + }, + + _handleInput: function(state) { + if (this.options.handler) { + this.options.handler.call(this, state, (state == 'ok') ? this.getSettings() : this.props); + } + + this.close(); + }, + + // + txtTitle: 'Insert Slicers', + textColumns: 'Columns' + + }, SSE.Views.SlicerAddDialog || {})); +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index eccc8ae5d..44d7dd9af 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -730,6 +730,14 @@ define([ lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect] }); + me.btnInsertSlicer = new Common.UI.Button({ + id: 'tlbtn-insertslicer', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-symbol', + caption: me.capBtnInsSlicer, + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.multiselect] + }); + me.btnTableTemplate = new Common.UI.Button({ id : 'id-toolbar-btn-ttempl', cls : 'btn-toolbar', @@ -1394,7 +1402,7 @@ define([ me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnAlignLeft, me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnAlignTop, me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, - me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, me.btnInsertSymbol, + me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, me.btnInsertSymbol, me.btnInsertSlicer, me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, @@ -1571,6 +1579,7 @@ define([ _injectComponent('#slot-btn-instextart', this.btnInsertTextArt); _injectComponent('#slot-btn-insequation', this.btnInsertEquation); _injectComponent('#slot-btn-inssymbol', this.btnInsertSymbol); + _injectComponent('#slot-btn-insslicer', this.btnInsertSlicer); _injectComponent('#slot-btn-sortdesc', this.btnSortDown); _injectComponent('#slot-btn-sortasc', this.btnSortUp); _injectComponent('#slot-btn-setfilter', this.btnSetAutofilter); @@ -1652,6 +1661,7 @@ define([ _updateHint(this.btnInsertShape, this.tipInsertShape); _updateHint(this.btnInsertEquation, this.tipInsertEquation); _updateHint(this.btnInsertSymbol, this.tipInsertSymbol); + _updateHint(this.btnInsertSlicer, this.tipInsertSlicer); _updateHint(this.btnSortDown, this.txtSortAZ); _updateHint(this.btnSortUp, this.txtSortZA); _updateHint(this.btnSetAutofilter, this.txtFilter + ' (Ctrl+Shift+L)'); @@ -2393,6 +2403,8 @@ define([ tipInsertSymbol: 'Insert symbol', txtAutosumTip: 'Summation', capBtnPrintTitles: 'Print Titles', - tipPrintTitles: 'Print titles' + tipPrintTitles: 'Print titles', + capBtnInsSlicer: 'Slicer', + tipInsertSlicer: 'Insert slicer' }, SSE.Views.Toolbar || {})); }); \ No newline at end of file From 30c42cf26e4fb9c1a97e7fcbe875a10e94e30819 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Apr 2020 14:58:40 +0300 Subject: [PATCH 02/20] [SSE] Add slicer settings --- .../main/app/template/SlicerSettings.template | 76 ++++ .../main/app/view/SlicerSettings.js | 372 ++++++++++++++++++ 2 files changed, 448 insertions(+) create mode 100644 apps/spreadsheeteditor/main/app/template/SlicerSettings.template create mode 100644 apps/spreadsheeteditor/main/app/view/SlicerSettings.js diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template new file mode 100644 index 000000000..0f8b55c6d --- /dev/null +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template @@ -0,0 +1,76 @@ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+ +
+
+
+
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js new file mode 100644 index 000000000..76717d835 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -0,0 +1,372 @@ +/* + * + * (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 + * + */ +/** + * SlicerSettings.js + * + * Created by Julia Radzhabova on 14.04.2020 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/RadioBox', + 'common/main/lib/component/ComboDataView' +], function (contentTemplate) { + 'use strict'; + + SSE.Views.SlicerSettings = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 330, + height: 435, + toggleGroup: 'slicer-adv-settings-group', + storageName: 'sse-slicer-settings-adv-category' + }, + + initialize : function(options) { + var me = this; + _.extend(this.options, { + title: this.textTitle, + items: [ + {panelId: 'id-adv-slicer-style', panelCaption: this.strStyleSize}, + {panelId: 'id-adv-slicer-sorting', panelCaption: this.strSorting}, + {panelId: 'id-adv-slicer-references', panelCaption: this.strReferences} + ], + contentTemplate: _.template(contentTemplate)({ + scope: this + }) + }, options); + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + + this._changedProps = null; + this._noApply = true; + this.spinners = []; + + this._originalProps = this.options.props; + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + var me = this; + + // Style & Size + this.inputHeader = new Common.UI.InputField({ + el : $('#sliceradv-text-header'), + allowBlank : false, + blankError : me.txtEmpty, + style : 'width: 178px;' + }); + + this.chHeader = new Common.UI.CheckBox({ + el: $('#sliceradv-checkbox-header'), + labelText: this.strShowHeader + }); + this.chHeader.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + // this._changedProps.asc_putStrikeout(field.getValue()=='checked'); + } + }, this)); + + this.cmbSlicerStyle = new Common.UI.ComboDataView({ + itemWidth: 50, + itemHeight: 50, + menuMaxHeight: 272, + enableKeyEvents: true, + cls: 'combo-spark-style', + minWidth: 190 + }); + this.cmbSlicerStyle.render($('#sliceradv-combo-style')); + this.cmbSlicerStyle.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbSlicerStyle.on('click', _.bind(this.onSelectSlicerStyle, this)); + this.cmbSlicerStyle.openButton.menu.on('show:after', function () { + me.cmbSlicerStyle.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + + this.numWidth = new Common.UI.MetricSpinner({ + el: $('#sliceradv-spin-width'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var numval = field.getNumberValue(); + if (this._changedProps) { + } + }, this)); + this.spinners.push(this.numWidth); + + this.numHeight = new Common.UI.MetricSpinner({ + el: $('#sliceradv-spin-height'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var numval = field.getNumberValue(); + if (this._changedProps) { + } + }, this)); + this.spinners.push(this.numHeight); + + this.numColWidth = new Common.UI.MetricSpinner({ + el: $('#sliceradv-spin-col-width'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.numColWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var numval = field.getNumberValue(); + if (this._changedProps) { + } + }, this)); + this.spinners.push(this.numColWidth); + + this.numColHeight = new Common.UI.MetricSpinner({ + el: $('#sliceradv-spin-col-height'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.numColHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var numval = field.getNumberValue(); + if (this._changedProps) { + } + }, this)); + this.spinners.push(this.numColHeight); + + this.numCols = new Common.UI.MetricSpinner({ + el: $('#sliceradv-spin-columns'), + step: 1, + width: 85, + defaultUnit : "", + defaultValue : 1, + value: '1', + allowDecimal: false, + maxValue: 20000, + minValue: 0 + }); + this.numCols.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var numval = field.getNumberValue(); + if (this._changedProps) { + } + }, this)); + + // Sorting & Filtering + + this.radioAsc = new Common.UI.RadioBox({ + el: $('#sliceradv-radio-asc'), + name: 'asc-radio-sliceradv-sort', + labelText: this.textAsc, + checked: true + }); + this.radioAsc.on('change', _.bind(function(field, newValue, eOpts) { + if (newValue) { + } + }, this)); + + this.radioDesc = new Common.UI.RadioBox({ + el: $('#sliceradv-radio-desc'), + name: 'asc-radio-sliceradv-sort', + labelText: this.textDesc, + checked: false + }); + this.radioDesc.on('change', _.bind(function(field, newValue, eOpts) { + if (newValue) { + } + }, this)); + + this.chHideNoData = new Common.UI.CheckBox({ + el: $('#sliceradv-check-hide-nodata'), + labelText: this.strHideNoData + }); + this.chHideNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var checked = (field.getValue()=='checked'); + this.chIndNoData.setDisabled(checked); + this.chShowNoData.setDisabled(checked || (this.chIndNoData.getValue()!='checked')); + this.chShowDel.setDisabled(checked); + if (this._changedProps) { + } + }, this)); + + this.chIndNoData = new Common.UI.CheckBox({ + el: $('#sliceradv-check-indicate-nodata'), + labelText: this.strIndNoData + }); + this.chIndNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var checked = (field.getValue()=='checked'); + this.chShowNoData.setDisabled(!checked); + if (this._changedProps) { + } + }, this)); + + this.chShowNoData = new Common.UI.CheckBox({ + el: $('#sliceradv-check-show-nodata-last'), + disabled: true, + labelText: this.strShowNoData + }); + this.chShowNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + // this._changedProps.asc_putStrikeout(field.getValue()=='checked'); + } + }, this)); + + this.chShowDel = new Common.UI.CheckBox({ + el: $('#sliceradv-check-show-deleted'), + labelText: this.strShowDel + }); + this.chShowDel.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + // this._changedProps.asc_putStrikeout(field.getValue()=='checked'); + } + }, this)); + + // References + + this.inputName = new Common.UI.InputField({ + el : $('#sliceradv-text-name'), + allowBlank : false, + blankError : me.txtEmpty, + style : 'width: 178px;' + }); + + this.lblSource = $('#sliceradv-lbl-source'); + this.lblFormula = $('#sliceradv-lbl-formula'); + + this.on('show', function(obj) { + obj.getChild('.footer .primary').focus(); + }); + + this.afterRender(); + }, + + getSettings: function() { + return this._changedProps; + }, + + _setDefaults: function(props) { + if (props ){ + this._noApply = true; + + // depents of data type + this.radioAsc.setCaption(this.textAsc + ' (' + this.textSmallLarge + ')' ); + this.radioDesc.setCaption(this.textDesc + ' (' + this.textLargeSmall + ')' ); + + this.lblSource.text('Source name'); + this.lblFormula.text('Name in formulas'); + + this._noApply = false; + + this._changedProps = new Asc.asc_CParagraphProperty(); + } + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i Date: Mon, 25 May 2020 20:25:16 +0300 Subject: [PATCH 03/20] [SSE] Show slicer settings --- .../main/app/controller/DocumentHolder.js | 28 ++++++++++++++- .../main/app/view/DocumentHolder.js | 15 ++++++-- .../main/app/view/SlicerSettings.js | 34 ++++++++++++++----- 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 9cc423981..90b1e9e75 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -71,7 +71,8 @@ define([ 'spreadsheeteditor/main/app/view/ImageSettingsAdvanced', 'spreadsheeteditor/main/app/view/SetValueDialog', 'spreadsheeteditor/main/app/view/AutoFilterDialog', - 'spreadsheeteditor/main/app/view/SpecialPasteDialog' + 'spreadsheeteditor/main/app/view/SpecialPasteDialog', + 'spreadsheeteditor/main/app/view/SlicerSettings' ], function () { 'use strict'; @@ -224,6 +225,7 @@ define([ view.mnuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me)); view.mnuChartEdit.on('click', _.bind(me.onChartEdit, me)); view.mnuImgAdvanced.on('click', _.bind(me.onImgAdvanced, me)); + view.mnuSlicerAdvanced.on('click', _.bind(me.onSlicerAdvanced, me)); view.textInShapeMenu.on('render:after', _.bind(me.onTextInShapeAfterRender, me)); view.menuSignatureEditSign.on('click', _.bind(me.onSignatureClick, me)); view.menuSignatureEditSetup.on('click', _.bind(me.onSignatureClick, me)); @@ -878,6 +880,25 @@ define([ })).show(); }, + onSlicerAdvanced: function(item) { + var me = this; + + (new SSE.Views.SlicerSettings({ + props : item.imageInfo, + api : me.api, + handler : function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.asc_setGraphicObjectProps(value.imageProps); + + Common.component.Analytics.trackEvent('DocumentHolder', 'Apply slicer settings'); + } + } + Common.NotificationCenter.trigger('edit:complete', me); + } + })).show(); + }, + onChartEdit: function(item) { var me = this; var win, props; @@ -1619,6 +1640,7 @@ define([ has_chartprops = true; } else { documentHolder.mnuImgAdvanced.imageInfo = elValue; + documentHolder.mnuSlicerAdvanced.imageInfo = elValue; isimagemenu = true; } if (this.permissions.isSignatureSupport) @@ -1647,6 +1669,9 @@ define([ if (documentHolder.mnuImgAdvanced.imageInfo) documentHolder.menuImgOriginalSize.setDisabled(isObjLocked || documentHolder.mnuImgAdvanced.imageInfo.get_ImageUrl()===null || documentHolder.mnuImgAdvanced.imageInfo.get_ImageUrl()===undefined); + documentHolder.mnuSlicerAdvanced.setVisible(documentHolder.mnuImgAdvanced.imageInfo &&documentHolder.mnuImgAdvanced.imageInfo.asc_getSlicerProperties()); + documentHolder.mnuSlicerAdvanced.setDisabled(isObjLocked); + var pluginGuid = (documentHolder.mnuImgAdvanced.imageInfo) ? documentHolder.mnuImgAdvanced.imageInfo.asc_getPluginGuid() : null; documentHolder.menuImgReplace.setVisible(isimageonly && (pluginGuid===null || pluginGuid===undefined)); documentHolder.menuImgReplace.setDisabled(isObjLocked || pluginGuid===null); @@ -1671,6 +1696,7 @@ define([ if (showMenu) this.showPopupMenu(documentHolder.imgMenu, {}, event); documentHolder.mnuShapeSeparator.setVisible(documentHolder.mnuShapeAdvanced.isVisible() || documentHolder.mnuChartEdit.isVisible() || documentHolder.mnuImgAdvanced.isVisible()); + documentHolder.mnuSlicerSeparator.setVisible(documentHolder.mnuSlicerAdvanced.isVisible()); } else if (istextshapemenu || istextchartmenu) { if (!documentHolder.textInShapeMenu || !showMenu && !documentHolder.textInShapeMenu.isVisible()) return; diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 621715714..fc8903950 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -567,6 +567,14 @@ define([ caption : me.advancedImgText }); + me.mnuSlicerSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.mnuSlicerAdvanced = new Common.UI.MenuItem({ + caption : me.advancedSlicerText + }); + me.mnuChartEdit = new Common.UI.MenuItem({ caption : me.chartText }); @@ -761,7 +769,9 @@ define([ me.mnuShapeAdvanced, me.menuImgOriginalSize, me.menuImgReplace, - me.mnuImgAdvanced + me.mnuImgAdvanced, + me.mnuSlicerSeparator, + me.mnuSlicerAdvanced ] }); @@ -1100,7 +1110,8 @@ define([ textCropFill: 'Fill', textCropFit: 'Fit', textListSettings: 'List Settings', - textFromStorage: 'From Storage' + textFromStorage: 'From Storage', + advancedSlicerText: 'Slicer Settings' }, SSE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index 76717d835..a1ebbab62 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -296,19 +296,35 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }, _setDefaults: function(props) { - if (props ){ - this._noApply = true; + if (props){ + var value = props.asc_getWidth(); + this.numWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); + value = props.asc_getHeight(); + this.numHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); - // depents of data type - this.radioAsc.setCaption(this.textAsc + ' (' + this.textSmallLarge + ')' ); - this.radioDesc.setCaption(this.textDesc + ' (' + this.textLargeSmall + ')' ); + var slicerprops = props.asc_getSlicerProperties(); + if (slicerprops) { + this._noApply = true; - this.lblSource.text('Source name'); - this.lblFormula.text('Name in formulas'); + this.numCols.setValue(slicerprops.asc_getColumnCount(), true); + // this.numColWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getColWidth()).toFixed(2), true); + this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getRowHeight()).toFixed(2), true); - this._noApply = false; + this.inputHeader.setValue(slicerprops.asc_getCaption()); + this.chHeader.setValue(!!slicerprops.asc_getShowCaption()); - this._changedProps = new Asc.asc_CParagraphProperty(); + // depends of data type + this.radioAsc.setCaption(this.textAsc + ' (' + this.textSmallLarge + ')' ); + this.radioDesc.setCaption(this.textDesc + ' (' + this.textLargeSmall + ')' ); + + this.inputName.setValue(slicerprops.asc_getName()); + this.lblSource.text('Source name'); + this.lblFormula.text('Name in formulas'); + + this._noApply = false; + + this._changedProps = slicerprops; + } } }, From 95a6e48e16fa798a0b8d1fbdd5c989f5d3bde4bf Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 26 May 2020 17:14:58 +0300 Subject: [PATCH 04/20] [SSE] Load slicer settings --- .../main/app/controller/DocumentHolder.js | 4 +- ...mplate => SlicerSettingsAdvanced.template} | 31 +++- ...rSettings.js => SlicerSettingsAdvanced.js} | 139 +++++++++++++----- 3 files changed, 134 insertions(+), 40 deletions(-) rename apps/spreadsheeteditor/main/app/template/{SlicerSettings.template => SlicerSettingsAdvanced.template} (76%) rename apps/spreadsheeteditor/main/app/view/{SlicerSettings.js => SlicerSettingsAdvanced.js} (70%) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 90b1e9e75..9f15a2737 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -72,7 +72,7 @@ define([ 'spreadsheeteditor/main/app/view/SetValueDialog', 'spreadsheeteditor/main/app/view/AutoFilterDialog', 'spreadsheeteditor/main/app/view/SpecialPasteDialog', - 'spreadsheeteditor/main/app/view/SlicerSettings' + 'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced' ], function () { 'use strict'; @@ -883,7 +883,7 @@ define([ onSlicerAdvanced: function(item) { var me = this; - (new SSE.Views.SlicerSettings({ + (new SSE.Views.SlicerSettingsAdvanced({ props : item.imageInfo, api : me.api, handler : function(result, value) { diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template similarity index 76% rename from apps/spreadsheeteditor/main/app/template/SlicerSettings.template rename to apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template index 0f8b55c6d..26f58b9ca 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template @@ -26,10 +26,10 @@
-
- -
-
+ + + +
@@ -73,4 +73,27 @@
+ +
+
+ + + + + + + + + + +
+ +
+
+ + +
+ +
+
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js similarity index 70% rename from apps/spreadsheeteditor/main/app/view/SlicerSettings.js rename to apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index a1ebbab62..b045bee00 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -31,14 +31,14 @@ * */ /** - * SlicerSettings.js + * SlicerSettingsAdvanced.js * * Created by Julia Radzhabova on 14.04.2020 * Copyright (c) 2018 Ascensio System SIA. All rights reserved. * */ -define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', +define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template', 'common/main/lib/view/AdvancedSettingsWindow', 'common/main/lib/component/MetricSpinner', 'common/main/lib/component/CheckBox', @@ -47,7 +47,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', ], function (contentTemplate) { 'use strict'; - SSE.Views.SlicerSettings = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + SSE.Views.SlicerSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 330, height: 435, @@ -62,7 +62,8 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', items: [ {panelId: 'id-adv-slicer-style', panelCaption: this.strStyleSize}, {panelId: 'id-adv-slicer-sorting', panelCaption: this.strSorting}, - {panelId: 'id-adv-slicer-references', panelCaption: this.strReferences} + {panelId: 'id-adv-slicer-references', panelCaption: this.strReferences}, + {panelId: 'id-adv-image-alttext', panelCaption: this.textAlt} ], contentTemplate: _.template(contentTemplate)({ scope: this @@ -88,6 +89,8 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', allowBlank : false, blankError : me.txtEmpty, style : 'width: 178px;' + }).on('changed:after', function() { + me.isCaptionChanged = true; }); this.chHeader = new Common.UI.CheckBox({ @@ -96,7 +99,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }); this.chHeader.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { - // this._changedProps.asc_putStrikeout(field.getValue()=='checked'); + this._changedProps.asc_setShowCaption(field.getValue()=='checked'); } }, this)); @@ -130,7 +133,8 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }); this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var numval = field.getNumberValue(); - if (this._changedProps) { + if (this._originalProps) { + this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(numval)); } }, this)); this.spinners.push(this.numWidth); @@ -147,27 +151,29 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }); this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var numval = field.getNumberValue(); - if (this._changedProps) { + if (this._originalProps) { + this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(numval)); } }, this)); this.spinners.push(this.numHeight); - this.numColWidth = new Common.UI.MetricSpinner({ - el: $('#sliceradv-spin-col-width'), - step: .1, - width: 85, - defaultUnit : "cm", - defaultValue : 0, - value: '0 cm', - maxValue: 5963.9, - minValue: 0 - }); - this.numColWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ - var numval = field.getNumberValue(); - if (this._changedProps) { - } - }, this)); - this.spinners.push(this.numColWidth); + // this.numColWidth = new Common.UI.MetricSpinner({ + // el: $('#sliceradv-spin-col-width'), + // step: .1, + // width: 85, + // defaultUnit : "cm", + // defaultValue : 0, + // value: '0 cm', + // maxValue: 5963.9, + // minValue: 0, + // visible: false + // }); + // this.numColWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + // var numval = field.getNumberValue(); + // if (this._changedProps) { + // } + // }, this)); + // this.spinners.push(this.numColWidth); this.numColHeight = new Common.UI.MetricSpinner({ el: $('#sliceradv-spin-col-height'), @@ -182,6 +188,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', this.numColHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var numval = field.getNumberValue(); if (this._changedProps) { + this._changedProps.asc_setRowHeight(Common.Utils.Metric.fnRecalcToMM(numval)*36000); } }, this)); this.spinners.push(this.numColHeight); @@ -200,6 +207,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', this.numCols.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var numval = field.getNumberValue(); if (this._changedProps) { + this._changedProps.asc_setColumnCount(numval); } }, this)); @@ -213,6 +221,9 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }); this.radioAsc.on('change', _.bind(function(field, newValue, eOpts) { if (newValue) { + if (this._changedProps) { + this._changedProps.asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Ascending); + } } }, this)); @@ -224,6 +235,9 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }); this.radioDesc.on('change', _.bind(function(field, newValue, eOpts) { if (newValue) { + if (this._changedProps) { + this._changedProps.asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Descending); + } } }, this)); @@ -237,6 +251,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', this.chShowNoData.setDisabled(checked || (this.chIndNoData.getValue()!='checked')); this.chShowDel.setDisabled(checked); if (this._changedProps) { + this._changedProps.asc_setHideItemsWithNoData(checked); } }, this)); @@ -248,6 +263,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', var checked = (field.getValue()=='checked'); this.chShowNoData.setDisabled(!checked); if (this._changedProps) { + this._changedProps.asc_setIndicateItemsWithNoData(checked); } }, this)); @@ -258,7 +274,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }); this.chShowNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { - // this._changedProps.asc_putStrikeout(field.getValue()=='checked'); + this._changedProps.asc_setHideItemsWithNoData(field.getValue()=='checked'); } }, this)); @@ -279,11 +295,32 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', allowBlank : false, blankError : me.txtEmpty, style : 'width: 178px;' + }).on('changed:after', function() { + me.isNameChanged = true; }); this.lblSource = $('#sliceradv-lbl-source'); this.lblFormula = $('#sliceradv-lbl-formula'); + // Alt Text + + this.inputAltTitle = new Common.UI.InputField({ + el : $('#sliceradv-alt-title'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isAltTitleChanged = true; + }); + + this.textareaAltDescription = this.$window.find('textarea'); + this.textareaAltDescription.keydown(function (event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + event.stopPropagation(); + } + me.isAltDescChanged = true; + }); + this.on('show', function(obj) { obj.getChild('.footer .primary').focus(); }); @@ -292,7 +329,18 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', }, getSettings: function() { - return this._changedProps; + if (this.isCaptionChanged) + this._changedProps.asc_setCaption(this.inputHeader.getValue()); + if (this.isNameChanged) + this._changedProps.asc_setName(this.inputName.getValue()); + + if (this.isAltTitleChanged) + this._originalProps.asc_putTitle(this.inputAltTitle.getValue()); + + if (this.isAltDescChanged) + this._originalProps.asc_putDescription(this.textareaAltDescription.val()); + + return this._originalProps; }, _setDefaults: function(props) { @@ -302,24 +350,43 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', value = props.asc_getHeight(); this.numHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); + value = props.asc_getTitle(); + this.inputAltTitle.setValue(value ? value : ''); + + value = props.asc_getDescription(); + this.textareaAltDescription.val(value ? value : ''); + var slicerprops = props.asc_getSlicerProperties(); if (slicerprops) { this._noApply = true; this.numCols.setValue(slicerprops.asc_getColumnCount(), true); // this.numColWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getColWidth()).toFixed(2), true); - this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getRowHeight()).toFixed(2), true); + this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getRowHeight()/36000).toFixed(2), true); - this.inputHeader.setValue(slicerprops.asc_getCaption()); - this.chHeader.setValue(!!slicerprops.asc_getShowCaption()); + this.inputHeader.setValue(slicerprops.asc_getCaption(), true); + var checked = slicerprops.asc_getShowCaption(); + this.chHeader.setValue(checked !== null && checked !== undefined ? checked : 'indeterminate', true); // depends of data type - this.radioAsc.setCaption(this.textAsc + ' (' + this.textSmallLarge + ')' ); - this.radioDesc.setCaption(this.textDesc + ' (' + this.textLargeSmall + ')' ); + this.radioAsc.setCaption(this.textAsc + ' (' + this.textAZ + ')' ); + this.radioDesc.setCaption(this.textDesc + ' (' + this.textZA + ')' ); + (slicerprops.asc_getSortOrder()==Asc.ST_tabularSlicerCacheSortOrder.Ascending) ? this.radioAsc.setValue(true, true) : this.radioDesc.setValue(true, true); + + checked = slicerprops.asc_getIndicateItemsWithNoData(); + this.chIndNoData.setValue(checked !== null && checked !== undefined ? checked : 'indeterminate', true); + checked = slicerprops.asc_getShowItemsWithNoDataLast(); + this.chShowNoData.setValue(checked !== null && checked !== undefined ? checked : 'indeterminate', true); + checked = slicerprops.asc_getHideItemsWithNoData(); + this.chHideNoData.setValue(checked !== null && checked !== undefined ? checked : 'indeterminate', true); + + this.chIndNoData.setDisabled(checked); + this.chShowNoData.setDisabled(checked || (this.chIndNoData.getValue()!='checked')); + this.chShowDel.setDisabled(checked); this.inputName.setValue(slicerprops.asc_getName()); - this.lblSource.text('Source name'); - this.lblFormula.text('Name in formulas'); + this.lblSource.text(slicerprops.asc_getSourceName()); + this.lblFormula.text(slicerprops.asc_getNameInFormulas()); this._noApply = false; @@ -382,7 +449,11 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', strHideNoData: 'Hide items with no data', strIndNoData: 'Visually indicate items with no data', strShowNoData: 'Show items with no data last', - strShowDel: 'Show items deleted from the data source' + strShowDel: 'Show items deleted from the data source', + textAlt: 'Alternative Text', + textAltTitle: 'Title', + textAltDescription: 'Description', + 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.', - }, SSE.Views.SlicerSettings || {})); + }, SSE.Views.SlicerSettingsAdvanced || {})); }); From 3584b6b7e4ee9fecf202579f4227b6b3cc420771 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 26 May 2020 17:27:49 +0300 Subject: [PATCH 05/20] [SSE] Fix context menu for slicer --- .../main/app/controller/DocumentHolder.js | 14 ++++++++------ .../main/app/view/DocumentHolder.js | 2 +- .../main/app/view/SlicerSettingsAdvanced.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 9f15a2737..d302faa4c 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -889,7 +889,7 @@ define([ handler : function(result, value) { if (result == 'ok') { if (me.api) { - me.api.asc_setGraphicObjectProps(value.imageProps); + me.api.asc_setGraphicObjectProps(value); Common.component.Analytics.trackEvent('DocumentHolder', 'Apply slicer settings'); } @@ -1586,7 +1586,7 @@ define([ }, fillMenuProps: function(cellinfo, showMenu, event){ - var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu, isimageonly, + var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu, isimageonly, isslicermenu, documentHolder = this.documentHolder, seltype = cellinfo.asc_getSelectionType(), isCellLocked = cellinfo.asc_getLocked(), @@ -1614,7 +1614,7 @@ define([ } else if (isimagemenu || isshapemenu || ischartmenu) { if (!documentHolder.imgMenu || !showMenu && !documentHolder.imgMenu.isVisible()) return; - isimagemenu = isshapemenu = ischartmenu = false; + isimagemenu = isshapemenu = ischartmenu = isslicermenu = false; documentHolder.mnuImgAdvanced.imageInfo = undefined; var has_chartprops = false, @@ -1638,9 +1638,11 @@ define([ documentHolder.mnuChartEdit.chartInfo = elValue; ischartmenu = true; has_chartprops = true; + } if ( elValue.asc_getSlicerProperties() ) { + documentHolder.mnuSlicerAdvanced.imageInfo = elValue; + isslicermenu = true; } else { documentHolder.mnuImgAdvanced.imageInfo = elValue; - documentHolder.mnuSlicerAdvanced.imageInfo = elValue; isimagemenu = true; } if (this.permissions.isSignatureSupport) @@ -1669,7 +1671,7 @@ define([ if (documentHolder.mnuImgAdvanced.imageInfo) documentHolder.menuImgOriginalSize.setDisabled(isObjLocked || documentHolder.mnuImgAdvanced.imageInfo.get_ImageUrl()===null || documentHolder.mnuImgAdvanced.imageInfo.get_ImageUrl()===undefined); - documentHolder.mnuSlicerAdvanced.setVisible(documentHolder.mnuImgAdvanced.imageInfo &&documentHolder.mnuImgAdvanced.imageInfo.asc_getSlicerProperties()); + documentHolder.mnuSlicerAdvanced.setVisible(isslicermenu); documentHolder.mnuSlicerAdvanced.setDisabled(isObjLocked); var pluginGuid = (documentHolder.mnuImgAdvanced.imageInfo) ? documentHolder.mnuImgAdvanced.imageInfo.asc_getPluginGuid() : null; @@ -1678,7 +1680,7 @@ define([ documentHolder.menuImgReplace.menu.items[2].setVisible(this.permissions.canRequestInsertImage || this.permissions.fileChoiceUrl && this.permissions.fileChoiceUrl.indexOf("{documentType}")>-1); documentHolder.menuImageArrange.setDisabled(isObjLocked); - documentHolder.menuImgRotate.setVisible(!ischartmenu && (pluginGuid===null || pluginGuid===undefined)); + documentHolder.menuImgRotate.setVisible(!ischartmenu && (pluginGuid===null || pluginGuid===undefined) && !isslicermenu); documentHolder.menuImgRotate.setDisabled(isObjLocked); documentHolder.menuImgCrop.setVisible(this.api.asc_canEditCrop()); diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index fc8903950..426965d04 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -1111,7 +1111,7 @@ define([ textCropFit: 'Fit', textListSettings: 'List Settings', textFromStorage: 'From Storage', - advancedSlicerText: 'Slicer Settings' + advancedSlicerText: 'Slicer Advanced Settings' }, SSE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index b045bee00..5e89fba75 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -421,7 +421,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem } }, - textTitle: 'Slicer Settings', + textTitle: 'Slicer - Advanced Settings', textHeader: 'Header', strStyle: 'Style', strSize: 'Size', From 0ba1760176d1919046d90f06911f8fd23f6488f1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 26 May 2020 19:47:24 +0300 Subject: [PATCH 06/20] [SSE] Add slicer for pivot and formatted table --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 1 + apps/spreadsheeteditor/main/app/view/Toolbar.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 7d2862e52..c2595b986 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2369,6 +2369,7 @@ define([ this._state.inpivot = !!info.asc_getPivotTableInfo(); toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates)}); + toolbar.lockToolbar(SSE.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]}); need_disable = !this.appConfig.canModifyFilter; toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index a595bf678..ddcae6038 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -92,7 +92,8 @@ define([ headerLock: 'header-lock', sheetLock: 'sheet-lock', noPivot: 'no-pivot', - noSubitems: 'no-subitems' + noSubitems: 'no-subitems', + noSlicerSource: 'no-slicer-source' }; SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({ @@ -738,7 +739,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-symbol', caption: me.capBtnInsSlicer, - lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.multiselect] + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.multiselect, _set.noSlicerSource] }); me.btnTableTemplate = new Common.UI.Button({ From 15b036daf8a8547fc66cb0701f0c8c7dcdb18192 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 26 May 2020 23:26:36 +0300 Subject: [PATCH 07/20] [SSE] Get slicer style --- .../template/SlicerSettingsAdvanced.template | 4 +- .../main/app/view/SlicerSettingsAdvanced.js | 63 ++++++++++++++----- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template index 26f58b9ca..8f6b9b3a6 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template @@ -8,7 +8,9 @@
-
+
+
+
diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index 5e89fba75..5007d7d6a 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -103,23 +103,27 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem } }, this)); - this.cmbSlicerStyle = new Common.UI.ComboDataView({ - itemWidth: 50, - itemHeight: 50, - menuMaxHeight: 272, - enableKeyEvents: true, - cls: 'combo-spark-style', - minWidth: 190 + this.btnSlicerStyle = new Common.UI.Button({ + parentEl: $('#sliceradv-btn-style'), + cls : 'btn-large-dataview sheet-template-table', + iconCls : 'icon-template-table', + menu : new Common.UI.Menu({ + style: 'width: 400px;', + items: [ + { template: _.template('') } + ] + }) }); - this.cmbSlicerStyle.render($('#sliceradv-combo-style')); - this.cmbSlicerStyle.openButton.menu.cmpEl.css({ - 'min-width': 178, - 'max-width': 178 - }); - this.cmbSlicerStyle.on('click', _.bind(this.onSelectSlicerStyle, this)); - this.cmbSlicerStyle.openButton.menu.on('show:after', function () { - me.cmbSlicerStyle.menuPicker.scroller.update({alwaysVisibleY: true}); + this.mnuSlicerPicker = new Common.UI.DataView({ + el: $('#sliceradv-menu-style'), + parentMenu: this.btnSlicerStyle.menu, + restoreHeight: 325, + groups: new Common.UI.DataViewGroupStore(), + store: new Common.UI.DataViewStore(), + itemTemplate: _.template('
'), + style: 'max-height: 325px;' }); + this.mnuSlicerPicker.on('item:click', _.bind(this.onSelectSlicerStyle, this, this.btnSlicerStyle)); this.numWidth = new Common.UI.MetricSpinner({ el: $('#sliceradv-spin-width'), @@ -388,6 +392,17 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this.lblSource.text(slicerprops.asc_getSourceName()); this.lblFormula.text(slicerprops.asc_getNameInFormulas()); + value = slicerprops.asc_getStyle(); + // var rec = this.mnuSlicerPicker.store.findWhere({type: value}); + // if (!rec) { + // rec = this.mnuSlicerPicker.store.at(0); + // } + // this.btnSlicerStyle.suspendEvents(); + // this.mnuSlicerPicker.selectRecord(rec, true); + // this.btnSlicerStyle.resumeEvents(); + // this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); + this.$window.find('.icon-template-table').css({'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); + this._noApply = false; this._changedProps = slicerprops; @@ -406,6 +421,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem afterRender: function() { this.updateMetricUnit(); + // this.onInitStyles(this.options.styles); this._setDefaults(this._originalProps); if (this.storageName) { var value = Common.localStorage.getItem(this.storageName); @@ -413,11 +429,26 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem } }, + onInitStyles: function(Templates){ + var count = this.mnuSlicerPicker.store.length, + arr = []; + _.each(Templates, function(template){ + arr.push({ + id : Common.UI.getId(), + type : template.asc_getType(), + imageUrl : template.asc_getImage(), + allowSelected : true, + selected : false + }); + }); + this.mnuSlicerPicker.store.reset(arr); + }, + onSelectSlicerStyle: function(combo, record) { if (this._noApply) return; if (this._changedProps) { - // this._changedProps.asc_setStyle(record.get('data')); + this._changedProps.asc_setStyle(record.get('type')); } }, From c3eb5132daaf8546f54de555385063561f7a67fa Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 27 May 2020 16:33:34 +0300 Subject: [PATCH 08/20] [SSE] Show slicer settings in the right menu --- apps/common/main/lib/util/utils.js | 3 +- .../main/app/controller/DocumentHolder.js | 4 +- .../main/app/controller/RightMenu.js | 6 + .../main/app/template/RightMenu.template | 3 + .../main/app/template/SlicerSettings.template | 89 ++++ .../main/app/view/RightMenu.js | 17 +- .../main/app/view/SlicerSettings.js | 493 ++++++++++++++++++ .../main/app/view/SlicerSettingsAdvanced.js | 4 +- apps/spreadsheeteditor/main/locale/en.json | 1 + 9 files changed, 614 insertions(+), 6 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/template/SlicerSettings.template create mode 100644 apps/spreadsheeteditor/main/app/view/SlicerSettings.js diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 85f625e78..0c32fc416 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -105,7 +105,8 @@ Common.Utils = _.extend(new(function() { MailMerge : 8, Signature : 9, Pivot : 10, - Cell : 11 + Cell : 11, + Slicer : 12 }, importTextType = { DRM: 0, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 4365e2883..efd5d1221 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -884,12 +884,12 @@ define([ var me = this; (new SSE.Views.SlicerSettingsAdvanced({ - props : item.imageInfo, + imageProps : item.imageInfo, api : me.api, handler : function(result, value) { if (result == 'ok') { if (me.api) { - me.api.asc_setGraphicObjectProps(value); + me.api.asc_setGraphicObjectProps(value.imageProps); Common.component.Analytics.trackEvent('DocumentHolder', 'Apply slicer settings'); } diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 4048a750a..d93ae91aa 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -92,6 +92,7 @@ define([ this._settings[Common.Utils.documentSettingsType.Pivot] = {panelId: "id-pivot-settings", panel: rightMenu.pivotSettings, btn: rightMenu.btnPivot, hidden: 1, locked: false}; this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false}; this._settings[Common.Utils.documentSettingsType.Cell] = {panelId: "id-cell-settings", panel: rightMenu.cellSettings, btn: rightMenu.btnCell, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.Slicer] = {panelId: "id-slicer-settings", panel: rightMenu.slicerSettings, btn: rightMenu.btnSlicer, hidden: 1, locked: false}; }, setApi: function(api) { @@ -190,6 +191,8 @@ define([ this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 0; this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.asc_getLocked(); } + } else if (value.asc_getSlicerProperties() !== null) { + settingsType = Common.Utils.documentSettingsType.Slicer; } } @@ -326,6 +329,7 @@ define([ this.rightmenu.paragraphSettings.updateMetricUnit(); this.rightmenu.chartSettings.updateMetricUnit(); this.rightmenu.imageSettings.updateMetricUnit(); + this.rightmenu.slicerSettings.updateMetricUnit(); }, createDelayedElements: function() { @@ -392,6 +396,7 @@ define([ this.rightmenu.tableSettings.disableControls(disabled); this.rightmenu.pivotSettings.disableControls(disabled); this.rightmenu.cellSettings.disableControls(disabled); + this.rightmenu.slicerSettings.disableControls(disabled); if (!allowSignature && this.rightmenu.signatureSettings) { this.rightmenu.btnSignature.setDisabled(disabled); @@ -410,6 +415,7 @@ define([ this.rightmenu.btnChart.setDisabled(disabled); this.rightmenu.btnPivot.setDisabled(disabled); this.rightmenu.btnCell.setDisabled(disabled); + this.rightmenu.btnSlicer.setDisabled(disabled); } else { this.onSelectionChanged(this.api.asc_getCellInfo()); } diff --git a/apps/spreadsheeteditor/main/app/template/RightMenu.template b/apps/spreadsheeteditor/main/app/template/RightMenu.template index 09960c52f..385e6d61a 100644 --- a/apps/spreadsheeteditor/main/app/template/RightMenu.template +++ b/apps/spreadsheeteditor/main/app/template/RightMenu.template @@ -18,6 +18,8 @@
+
+
@@ -29,6 +31,7 @@ +
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template new file mode 100644 index 000000000..304bf2cf6 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template @@ -0,0 +1,89 @@ + + + + + + +
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+ +
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/RightMenu.js b/apps/spreadsheeteditor/main/app/view/RightMenu.js index cf93f489d..a2f6f68bb 100644 --- a/apps/spreadsheeteditor/main/app/view/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/view/RightMenu.js @@ -58,6 +58,7 @@ define([ 'spreadsheeteditor/main/app/view/PivotSettings', 'spreadsheeteditor/main/app/view/SignatureSettings', 'spreadsheeteditor/main/app/view/CellSettings', + 'spreadsheeteditor/main/app/view/SlicerSettings', 'common/main/lib/component/Scroller' ], function (menuTemplate, $, _, Backbone) { 'use strict'; @@ -143,6 +144,14 @@ define([ toggleGroup: 'tabpanelbtnsGroup', allowMouseEventsOnDisabled: true }); + this.btnSlicer = new Common.UI.Button({ + hint: this.txtSlicerSettings, + asctype: Common.Utils.documentSettingsType.Slicer, + enableToggle: true, + disabled: true, + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); this._settings = []; this._settings[Common.Utils.documentSettingsType.Paragraph] = {panel: "id-paragraph-settings", btn: this.btnText}; @@ -153,6 +162,7 @@ define([ this._settings[Common.Utils.documentSettingsType.Table] = {panel: "id-table-settings", btn: this.btnTable}; this._settings[Common.Utils.documentSettingsType.Pivot] = {panel: "id-pivot-settings", btn: this.btnPivot}; this._settings[Common.Utils.documentSettingsType.Cell] = {panel: "id-cell-settings", btn: this.btnCell}; + this._settings[Common.Utils.documentSettingsType.Slicer] = {panel: "id-slicer-settings", btn: this.btnSlicer}; return this; }, @@ -178,6 +188,7 @@ define([ this.btnTable.setElement($('#id-right-menu-table'), false); this.btnTable.render(); this.btnPivot.setElement($('#id-right-menu-pivot'), false); this.btnPivot.render(); this.btnCell.setElement($('#id-right-menu-cell'), false); this.btnCell.render(); + this.btnSlicer.setElement($('#id-right-menu-slicer'), false); this.btnSlicer.render(); this.btnText.on('click', _.bind(this.onBtnMenuClick, this)); this.btnImage.on('click', _.bind(this.onBtnMenuClick, this)); @@ -187,6 +198,7 @@ define([ this.btnTable.on('click', _.bind(this.onBtnMenuClick, this)); this.btnPivot.on('click', _.bind(this.onBtnMenuClick, this)); this.btnCell.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnSlicer.on('click', _.bind(this.onBtnMenuClick, this)); this.paragraphSettings = new SSE.Views.ParagraphSettings(); this.imageSettings = new SSE.Views.ImageSettings(); @@ -196,6 +208,7 @@ define([ this.tableSettings = new SSE.Views.TableSettings(); this.pivotSettings = new SSE.Views.PivotSettings(); this.cellSettings = new SSE.Views.CellSettings(); + this.slicerSettings = new SSE.Views.SlicerSettings(); if (mode && mode.isSignatureSupport) { this.btnSignature = new Common.UI.Button({ @@ -244,6 +257,7 @@ define([ this.tableSettings.setApi(api); this.pivotSettings.setApi(api); this.cellSettings.setApi(api); + this.slicerSettings.setApi(api); if (this.signatureSettings) this.signatureSettings.setApi(api); return this; }, @@ -329,6 +343,7 @@ define([ txtTableSettings: 'Table Settings', txtPivotSettings: 'Pivot Table Settings', txtSignatureSettings: 'Signature Settings', - txtCellSettings: 'Cell Settings' + txtCellSettings: 'Cell Settings', + txtSlicerSettings: 'Slicer Settings' }, SSE.Views.RightMenu || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js new file mode 100644 index 000000000..a98e2b830 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -0,0 +1,493 @@ +/* + * + * (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 + * + */ +/** + * SlicerSettings.js + * + * Created by Julia Radzhabova on 5/26/20 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ +define([ + 'text!spreadsheeteditor/main/app/template/SlicerSettings.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/Button', + 'common/main/lib/component/MetricSpinner', + 'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + SSE.Views.SlicerSettings = Backbone.View.extend(_.extend({ + el: '#id-slicer-settings', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + options: { + alias: 'SlicerSettings' + }, + + initialize: function () { + this._initSettings = true; + + this._nRatio = 1; + this._state = { + Width: 0, + Height: 0, + DisabledControls: false, + keepRatio: false, + ColCount: 0, + ColWidth: 0, + ColHeight: 0, + PosVert: 0, + PosHor: 0 + }; + this.spinners = []; + this.lockedControls = []; + this._locked = false; + + this._noApply = false; + this._originalProps = null; + + this.render(); + }, + + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + + this.linkAdvanced = $('#image-advanced-link'); + }, + + setApi: function(api) { + if ( api == undefined ) return; + this.api = api; + if (this.api) { + // this.api.asc_registerCallback('asc_InitSlicerStyles', _.bind(this.onInitStyles, this)); + } + return this; + }, + + setMode: function(mode) { + this.mode = mode; + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i0) { + this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); + } + if (this.api) { + var props = new Asc.asc_CImgProperty(); + props.asc_putLockAspect(btn.pressed); + this.api.asc_setGraphicObjectProps(props); + } + }, this)); + + this.spnWidth.on('change', _.bind(this.onWidthChange, this)); + this.spnHeight.on('change', _.bind(this.onHeightChange, this)); + this.spnWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.spnHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + + this.spnHor = new Common.UI.MetricSpinner({ + el: $('#slicer-spin-hor'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.spinners.push(this.spnHor); + this.lockedControls.push(this.spnVert); + + this.spnVert = new Common.UI.MetricSpinner({ + el: $('#slicer-spin-vert'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.spinners.push(this.spnVert); + this.lockedControls.push(this.spnVert); + + // this.spnHor.on('change', _.bind(this.onHorChange, this)); + // this.spnVert.on('change', _.bind(this.onVertChange, this)); + this.spnHor.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.spnVert.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + + this.spnColWidth = new Common.UI.MetricSpinner({ + el: $('#slicer-spin-col-width'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.spinners.push(this.spnColWidth); + this.lockedControls.push(this.spnColWidth); + + this.spnColHeight = new Common.UI.MetricSpinner({ + el: $('#slicer-spin-col-height'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 5963.9, + minValue: 0 + }); + this.spinners.push(this.spnColHeight); + this.lockedControls.push(this.spnColHeight); + + this.numCols = new Common.UI.MetricSpinner({ + el: $('#slicer-spin-cols'), + step: 1, + width: 50, + defaultUnit : "", + defaultValue : 1, + value: '1', + allowDecimal: false, + maxValue: 20000, + minValue: 0 + }); + this.lockedControls.push(this.numCols); + + // this.spnColWidth.on('change', _.bind(this.onColWidthChange, this)); + // this.spnColHeight.on('change', _.bind(this.onColHeightChange, this)); + // this.numCols.on('change', _.bind(this.onColChange, this)); + this.spnColWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.spnColHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.numCols.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + + $(this.el).on('click', '#slicer-advanced-link', _.bind(this.openAdvancedSettings, this)); + }, + + createDelayedElements: function() { + this.createDelayedControls(); + this.updateMetricUnit(); + this._initSettings = false; + }, + + openAdvancedSettings: function(e) { + if (this.linkAdvanced.hasClass('disabled')) return; + + var me = this; + var win; + if (me.api && !this._locked){ + var selectedElements = me.api.asc_getGraphicObjectProps(); + if (selectedElements && selectedElements.length>0){ + var elType, elValue; + for (var i = selectedElements.length - 1; i >= 0; i--) { + elType = selectedElements[i].asc_getObjectType(); + elValue = selectedElements[i].asc_getObjectValue(); + if (Asc.c_oAscTypeSelectElement.Image == elType) { + (new SSE.Views.SlicerSettingsAdvanced( + { + imageProps: elValue, + api: me.api, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.asc_setGraphicObjectProps(value.imageProps); + } + } + + Common.NotificationCenter.trigger('edit:complete', me); + } + })).show(); + break; + } + } + } + } + }, + + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + + this.disableControls(this._locked); + + if (props ){ + this._originalProps = new Asc.asc_CImgProperty(props); + + var value = props.asc_getWidth(); + if ( Math.abs(this._state.Width-value)>0.001 || + (this._state.Width===null || value===null)&&(this._state.Width!==value)) { + this.spnWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Width = value; + } + + value = props.asc_getHeight(); + if ( Math.abs(this._state.Height-value)>0.001 || + (this._state.Height===null || value===null)&&(this._state.Height!==value)) { + this.spnHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Height = value; + } + + if (props.asc_getHeight()>0) + this._nRatio = props.asc_getWidth()/props.asc_getHeight(); + + value = props.asc_getLockAspect(); + if (this._state.keepRatio!==value) { + this.btnRatio.toggle(value); + this._state.keepRatio=value; + } + + var slicerprops = props.asc_getSlicerProperties(); + if (slicerprops) { + value = slicerprops.asc_getColumnCount(); + if ( Math.abs(this._state.ColCount-value)>0.1 || + (this._state.ColCount===null || value===null)&&(this._state.ColCount!==value)) { + this.numCols.setValue((value!==null) ? value : '', true); + this._state.ColCount = value; + } + + // value = props.asc_getColWidth()/36000; + // if ( Math.abs(this._state.ColWidth-value)>0.001 || + // (this._state.ColWidth===null || value===null)&&(this._state.ColWidth!==value)) { + // this.spnColWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + // this._state.ColWidth = value; + // } + + value = slicerprops.asc_getRowHeight()/36000; + if ( Math.abs(this._state.ColHeight-value)>0.001 || + (this._state.ColHeight===null || value===null)&&(this._state.ColHeight!==value)) { + this.spnColHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.ColHeight = value; + } + + value = slicerprops.asc_getStyle(); + if (!this.btnSlicerStyle) + this.onInitStyles(); + // var rec = this.mnuSlicerPicker.store.findWhere({type: value}); + // if (!rec) { + // rec = this.mnuSlicerPicker.store.at(0); + // } + // this.btnSlicerStyle.suspendEvents(); + // this.mnuSlicerPicker.selectRecord(rec, true); + // this.btnSlicerStyle.resumeEvents(); + // this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); + this.$el.find('.icon-template-table').css({'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); + } + } + }, + + onWidthChange: function(field, newValue, oldValue, eOpts){ + var w = field.getNumberValue(); + var h = this.spnHeight.getNumberValue(); + if (this.btnRatio.pressed) { + h = w/this._nRatio; + if (h>this.spnHeight.options.maxValue) { + h = this.spnHeight.options.maxValue; + w = h * this._nRatio; + this.spnWidth.setValue(w, true); + } + this.spnHeight.setValue(h, true); + } + if (this.api) { + var props = new Asc.asc_CImgProperty(); + props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w)); + props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); + this.api.asc_setGraphicObjectProps(props); + } + }, + + onHeightChange: function(field, newValue, oldValue, eOpts){ + var h = field.getNumberValue(), w = this.spnWidth.getNumberValue(); + if (this.btnRatio.pressed) { + w = h * this._nRatio; + if (w>this.spnWidth.options.maxValue) { + w = this.spnWidth.options.maxValue; + h = w/this._nRatio; + this.spnHeight.setValue(h, true); + } + this.spnWidth.setValue(w, true); + } + if (this.api) { + var props = new Asc.asc_CImgProperty(); + props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w)); + props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); + this.api.asc_setGraphicObjectProps(props); + } + }, + + onInitStyles: function(Templates){ + var self = this; + this._isTemplatesChanged = true; + + if (!this.btnSlicerStyle) { + this.btnSlicerStyle = new Common.UI.Button({ + cls : 'btn-large-dataview sheet-template-table', + iconCls : 'icon-template-table', + menu : new Common.UI.Menu({ + style: 'width: 400px;', + items: [ + { template: _.template('') } + ] + }) + }); + this.btnSlicerStyle.on('render:after', function(btn) { + self.mnuSlicerPicker = new Common.UI.DataView({ + el: $('#id-slicer-menu-style'), + parentMenu: btn.menu, + restoreHeight: 325, + groups: new Common.UI.DataViewGroupStore(), + store: new Common.UI.DataViewStore(), + itemTemplate: _.template('
'), + style: 'max-height: 325px;' + }); + }); + this.btnSlicerStyle.render($('#slicer-btn-style')); + this.lockedControls.push(this.btnSlicerStyle); + this.mnuSlicerPicker.on('item:click', _.bind(this.onSelectSlicerStyle, this, this.btnSlicerStyle)); + if (this._locked) this.btnSlicerStyle.setDisabled(this._locked); + } + + if (Templates) { + var count = self.mnuSlicerPicker.store.length; + if (count>0 && count==Templates.length) { + var data = self.mnuSlicerPicker.store.models; + _.each(Templates, function(template, index){ + data[index].set('imageUrl', template.asc_getImage()); + }); + } else { + var arr = []; + _.each(Templates, function(template){ + arr.push({ + id : Common.UI.getId(), + type : template.asc_getType(), + imageUrl : template.asc_getImage(), + allowSelected : true, + selected : false + }); + }); + self.mnuSlicerPicker.store.reset(arr); + } + } + }, + + onSelectSlicerStyle: function(combo, record) { + if (this._noApply) return; + + // if (this._originalProps) { + // this._originalProps..asc_getSlicerProperties().asc_setStyle(record.get('type')); + // } + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable) { + if (this._initSettings) return; + + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.linkAdvanced.toggleClass('disabled', disable); + } + }, + + textKeepRatio: 'Constant Proportions', + textSize: 'Size', + textWidth: 'Width', + textHeight: 'Height', + textAdvanced: 'Show advanced settings', + textPosition: 'Position', + textHor: 'Horizontal', + textVert: 'Vertical', + textButtons: 'Buttons', + textColumns: 'Columns', + textStyle: 'Style' + + }, SSE.Views.SlicerSettings || {})); +}); + diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index 5007d7d6a..be8a75ff1 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -75,7 +75,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this._noApply = true; this.spinners = []; - this._originalProps = this.options.props; + this._originalProps = this.options.imageProps; }, render: function() { @@ -344,7 +344,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem if (this.isAltDescChanged) this._originalProps.asc_putDescription(this.textareaAltDescription.val()); - return this._originalProps; + return {imageProps: this._originalProps}; }, _setDefaults: function(props) { diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 424987743..be7d1e351 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2113,6 +2113,7 @@ "SSE.Views.RightMenu.txtSparklineSettings": "Sparkline Settings", "SSE.Views.RightMenu.txtTableSettings": "Table settings", "SSE.Views.RightMenu.txtTextArtSettings": "Text Art settings", + "SSE.Views.RightMenu.txtSlicerSettings": "Slicer Settings", "SSE.Views.ScaleDialog.textAuto": "Auto", "SSE.Views.ScaleDialog.textError": "The entered value is incorrect.", "SSE.Views.ScaleDialog.textFewPages": "pages", From ebe0f338cf3d95d0f73821cdba2ea6cfd27045ad Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 27 May 2020 18:34:15 +0300 Subject: [PATCH 09/20] [SSE] Set slicer style settings --- apps/common/main/resources/less/buttons.less | 7 + .../main/app/template/SlicerSettings.template | 2 +- .../main/app/view/SlicerSettings.js | 132 ++++++++++++------ .../main/app/view/SlicerSettingsAdvanced.js | 53 +++---- .../main/resources/less/rightmenu.less | 14 +- 5 files changed, 126 insertions(+), 82 deletions(-) diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index 160ccb572..a0e6c8a3f 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -784,6 +784,13 @@ height: 54px; } + .icon-template-slicer.icon { + min-width: 36px; + height: 55px; + line-height: 53px; + border: none; + } + .icon { display: inline-block; .btn.btnsize(52px); diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template index 304bf2cf6..fb68d3f6b 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template @@ -72,7 +72,7 @@ -
+
diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index a98e2b830..fcd2475be 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -83,6 +83,7 @@ define([ this._noApply = false; this._originalProps = null; + this.styles = null; this.render(); }, @@ -99,9 +100,7 @@ define([ setApi: function(api) { if ( api == undefined ) return; this.api = api; - if (this.api) { - // this.api.asc_registerCallback('asc_InitSlicerStyles', _.bind(this.onInitStyles, this)); - } + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); return this; }, @@ -160,9 +159,10 @@ define([ this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); } if (this.api) { - var props = new Asc.asc_CImgProperty(); - props.asc_putLockAspect(btn.pressed); - this.api.asc_setGraphicObjectProps(props); + if (this._originalProps) { + this._originalProps.asc_putLockAspect(btn.pressed); + this.api.asc_setGraphicObjectProps(this._originalProps); + } } }, this)); @@ -237,9 +237,9 @@ define([ }); this.lockedControls.push(this.numCols); - // this.spnColWidth.on('change', _.bind(this.onColWidthChange, this)); - // this.spnColHeight.on('change', _.bind(this.onColHeightChange, this)); - // this.numCols.on('change', _.bind(this.onColChange, this)); + this.spnColWidth.on('change', _.bind(this.onColWidthChange, this)); + this.spnColHeight.on('change', _.bind(this.onColHeightChange, this)); + this.numCols.on('change', _.bind(this.onColChange, this)); this.spnColWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.spnColHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.numCols.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); @@ -253,6 +253,14 @@ define([ this._initSettings = false; }, + onSendThemeColors: function() { + // get new table templates + if (this.mnuSlicerPicker && this._originalProps) { + this.onInitStyles(this._originalProps.asc_getSlicerProperties().asc_getStylesPictures()); + this.mnuSlicerPicker.scroller.update({alwaysVisibleY: true}); + } + }, + openAdvancedSettings: function(e) { if (this.linkAdvanced.hasClass('disabled')) return; @@ -270,6 +278,7 @@ define([ { imageProps: elValue, api: me.api, + styles: me.styles || me._originalProps.asc_getSlicerProperties().asc_getStylesPictures(), handler: function(result, value) { if (result == 'ok') { if (me.api) { @@ -328,12 +337,12 @@ define([ this._state.ColCount = value; } - // value = props.asc_getColWidth()/36000; - // if ( Math.abs(this._state.ColWidth-value)>0.001 || - // (this._state.ColWidth===null || value===null)&&(this._state.ColWidth!==value)) { - // this.spnColWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); - // this._state.ColWidth = value; - // } + value = slicerprops.asc_getButtonWidth()/36000; + if ( Math.abs(this._state.ColWidth-value)>0.001 || + (this._state.ColWidth===null || value===null)&&(this._state.ColWidth!==value)) { + this.spnColWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.ColWidth = value; + } value = slicerprops.asc_getRowHeight()/36000; if ( Math.abs(this._state.ColHeight-value)>0.001 || @@ -342,18 +351,22 @@ define([ this._state.ColHeight = value; } - value = slicerprops.asc_getStyle(); if (!this.btnSlicerStyle) - this.onInitStyles(); - // var rec = this.mnuSlicerPicker.store.findWhere({type: value}); - // if (!rec) { - // rec = this.mnuSlicerPicker.store.at(0); - // } - // this.btnSlicerStyle.suspendEvents(); - // this.mnuSlicerPicker.selectRecord(rec, true); - // this.btnSlicerStyle.resumeEvents(); - // this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); - this.$el.find('.icon-template-table').css({'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); + this.onInitStyles(slicerprops.asc_getStylesPictures()); + value = slicerprops.asc_getStyle(); + if (this._state.StyleType!==value || this._isTemplatesChanged) { + var rec = this.mnuSlicerPicker.store.findWhere({type: value}); + if (!rec) { + rec = this.mnuSlicerPicker.store.at(0); + } + this.btnSlicerStyle.suspendEvents(); + this.mnuSlicerPicker.selectRecord(rec, true); + this.btnSlicerStyle.resumeEvents(); + this.$el.find('.icon-template-slicer').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); + this._state.StyleType=value; + } + this._isTemplatesChanged = false; + } } }, @@ -371,10 +384,11 @@ define([ this.spnHeight.setValue(h, true); } if (this.api) { - var props = new Asc.asc_CImgProperty(); - props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w)); - props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); - this.api.asc_setGraphicObjectProps(props); + if (this._originalProps) { + this._originalProps.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w)); + this._originalProps.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); + this.api.asc_setGraphicObjectProps(this._originalProps); + } } }, @@ -390,25 +404,54 @@ define([ this.spnWidth.setValue(w, true); } if (this.api) { - var props = new Asc.asc_CImgProperty(); - props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w)); - props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); - this.api.asc_setGraphicObjectProps(props); + if (this._originalProps) { + this._originalProps.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w)); + this._originalProps.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, + + onColWidthChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setButtonWidth(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())*36000); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, + + onColHeightChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setRowHeight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())*36000); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, + + onColChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setColumnCount(field.getNumberValue()); + this.api.asc_setGraphicObjectProps(this._originalProps); + } } }, onInitStyles: function(Templates){ var self = this; this._isTemplatesChanged = true; + this.styles = Templates; if (!this.btnSlicerStyle) { this.btnSlicerStyle = new Common.UI.Button({ - cls : 'btn-large-dataview sheet-template-table', - iconCls : 'icon-template-table', + cls : 'btn-large-dataview sheet-template-slicer', + iconCls : 'icon-template-slicer', menu : new Common.UI.Menu({ - style: 'width: 400px;', + style: 'width: 333px;', items: [ - { template: _.template('') } + { template: _.template('') } ] }) }); @@ -419,7 +462,7 @@ define([ restoreHeight: 325, groups: new Common.UI.DataViewGroupStore(), store: new Common.UI.DataViewStore(), - itemTemplate: _.template('
'), + itemTemplate: _.template('
'), style: 'max-height: 325px;' }); }); @@ -441,7 +484,7 @@ define([ _.each(Templates, function(template){ arr.push({ id : Common.UI.getId(), - type : template.asc_getType(), + type : template.asc_getName(), imageUrl : template.asc_getImage(), allowSelected : true, selected : false @@ -452,12 +495,13 @@ define([ } }, - onSelectSlicerStyle: function(combo, record) { + onSelectSlicerStyle: function(btn, picker, itemView, record) { if (this._noApply) return; - // if (this._originalProps) { - // this._originalProps..asc_getSlicerProperties().asc_setStyle(record.get('type')); - // } + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setStyle(record.get('type')); + this.api.asc_setGraphicObjectProps(this._originalProps); + } }, setLocked: function (locked) { diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index be8a75ff1..924fe5148 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -105,12 +105,12 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this.btnSlicerStyle = new Common.UI.Button({ parentEl: $('#sliceradv-btn-style'), - cls : 'btn-large-dataview sheet-template-table', - iconCls : 'icon-template-table', + cls : 'btn-large-dataview sheet-template-slicer', + iconCls : 'icon-template-slicer', menu : new Common.UI.Menu({ - style: 'width: 400px;', + style: 'width: 333px;', items: [ - { template: _.template('') } + { template: _.template('') } ] }) }); @@ -120,7 +120,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem restoreHeight: 325, groups: new Common.UI.DataViewGroupStore(), store: new Common.UI.DataViewStore(), - itemTemplate: _.template('
'), + itemTemplate: _.template('
'), style: 'max-height: 325px;' }); this.mnuSlicerPicker.on('item:click', _.bind(this.onSelectSlicerStyle, this, this.btnSlicerStyle)); @@ -161,24 +161,6 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem }, this)); this.spinners.push(this.numHeight); - // this.numColWidth = new Common.UI.MetricSpinner({ - // el: $('#sliceradv-spin-col-width'), - // step: .1, - // width: 85, - // defaultUnit : "cm", - // defaultValue : 0, - // value: '0 cm', - // maxValue: 5963.9, - // minValue: 0, - // visible: false - // }); - // this.numColWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ - // var numval = field.getNumberValue(); - // if (this._changedProps) { - // } - // }, this)); - // this.spinners.push(this.numColWidth); - this.numColHeight = new Common.UI.MetricSpinner({ el: $('#sliceradv-spin-col-height'), step: .1, @@ -393,15 +375,14 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this.lblFormula.text(slicerprops.asc_getNameInFormulas()); value = slicerprops.asc_getStyle(); - // var rec = this.mnuSlicerPicker.store.findWhere({type: value}); - // if (!rec) { - // rec = this.mnuSlicerPicker.store.at(0); - // } - // this.btnSlicerStyle.suspendEvents(); - // this.mnuSlicerPicker.selectRecord(rec, true); - // this.btnSlicerStyle.resumeEvents(); - // this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); - this.$window.find('.icon-template-table').css({'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'}); + var rec = this.mnuSlicerPicker.store.findWhere({type: value}); + if (!rec) { + rec = this.mnuSlicerPicker.store.at(0); + } + this.btnSlicerStyle.suspendEvents(); + this.mnuSlicerPicker.selectRecord(rec, true); + this.btnSlicerStyle.resumeEvents(); + this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); this._noApply = false; @@ -421,7 +402,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem afterRender: function() { this.updateMetricUnit(); - // this.onInitStyles(this.options.styles); + this.onInitStyles(this.options.styles); this._setDefaults(this._originalProps); if (this.storageName) { var value = Common.localStorage.getItem(this.storageName); @@ -432,10 +413,10 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem onInitStyles: function(Templates){ var count = this.mnuSlicerPicker.store.length, arr = []; - _.each(Templates, function(template){ + Templates && _.each(Templates, function(template){ arr.push({ id : Common.UI.getId(), - type : template.asc_getType(), + type : template.asc_getName(), imageUrl : template.asc_getImage(), allowSelected : true, selected : false @@ -444,7 +425,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this.mnuSlicerPicker.store.reset(arr); }, - onSelectSlicerStyle: function(combo, record) { + onSelectSlicerStyle: function(btn, picker, itemView, record) { if (this._noApply) return; if (this._changedProps) { diff --git a/apps/spreadsheeteditor/main/resources/less/rightmenu.less b/apps/spreadsheeteditor/main/resources/less/rightmenu.less index 596b0f3a6..28a25d517 100644 --- a/apps/spreadsheeteditor/main/resources/less/rightmenu.less +++ b/apps/spreadsheeteditor/main/resources/less/rightmenu.less @@ -320,4 +320,16 @@ button:active:not(.disabled) .btn-change-shape {background-position: -56px - } } } -} \ No newline at end of file +} + +.sheet-template-slicer { + width: 56px; + height: 55px; +} + +.menu-slicer-template { + .item { + border: none; + .box-shadow(none); + } +} From 040b22ed81bdeee5a9933b9ca97e1c30579bfa3a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 27 May 2020 20:20:08 +0300 Subject: [PATCH 10/20] [SSE] Cell snapping settings for slicer --- .../template/SlicerSettingsAdvanced.template | 23 ++++++++- .../main/app/view/SlicerSettingsAdvanced.js | 51 ++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template index 8f6b9b3a6..2da72ee09 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template @@ -76,7 +76,28 @@ -
+
+
+ + + + + + + + + + +
+
+
+
+
+
+
+
+
+
diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index 924fe5148..ff50d7038 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -63,7 +63,8 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem {panelId: 'id-adv-slicer-style', panelCaption: this.strStyleSize}, {panelId: 'id-adv-slicer-sorting', panelCaption: this.strSorting}, {panelId: 'id-adv-slicer-references', panelCaption: this.strReferences}, - {panelId: 'id-adv-image-alttext', panelCaption: this.textAlt} + {panelId: 'id-adv-slicer-snap', panelCaption: this.textSnap}, + {panelId: 'id-adv-slicer-alttext', panelCaption: this.textAlt} ], contentTemplate: _.template(contentTemplate)({ scope: this @@ -288,6 +289,31 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this.lblSource = $('#sliceradv-lbl-source'); this.lblFormula = $('#sliceradv-lbl-formula'); + // Snapping + this.radioTwoCell = new Common.UI.RadioBox({ + el: $('#slicer-advanced-radio-twocell'), + name: 'asc-radio-snap', + labelText: this.textTwoCell, + value: AscCommon.c_oAscCellAnchorType.cellanchorTwoCell + }); + this.radioTwoCell.on('change', _.bind(this.onRadioSnapChange, this)); + + this.radioOneCell = new Common.UI.RadioBox({ + el: $('#slicer-advanced-radio-onecell'), + name: 'asc-radio-snap', + labelText: this.textOneCell, + value: AscCommon.c_oAscCellAnchorType.cellanchorOneCell + }); + this.radioOneCell.on('change', _.bind(this.onRadioSnapChange, this)); + + this.radioAbsolute = new Common.UI.RadioBox({ + el: $('#slicer-advanced-radio-absolute'), + name: 'asc-radio-snap', + labelText: this.textAbsolute, + value: AscCommon.c_oAscCellAnchorType.cellanchorAbsolute + }); + this.radioAbsolute.on('change', _.bind(this.onRadioSnapChange, this)); + // Alt Text this.inputAltTitle = new Common.UI.InputField({ @@ -342,6 +368,19 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem value = props.asc_getDescription(); this.textareaAltDescription.val(value ? value : ''); + value = props.asc_getAnchor(); + switch (value) { + case AscCommon.c_oAscCellAnchorType.cellanchorTwoCell: + this.radioTwoCell.setValue(true, true); + break; + case AscCommon.c_oAscCellAnchorType.cellanchorOneCell: + this.radioOneCell.setValue(true, true); + break; + case AscCommon.c_oAscCellAnchorType.cellanchorAbsolute: + this.radioAbsolute.setValue(true, true); + break; + } + var slicerprops = props.asc_getSlicerProperties(); if (slicerprops) { this._noApply = true; @@ -433,6 +472,12 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem } }, + onRadioSnapChange: function(field, newValue, eOpts) { + if (newValue && this._originalProps) { + this._originalProps.asc_putAnchor(field.options.value); + } + }, + textTitle: 'Slicer - Advanced Settings', textHeader: 'Header', strStyle: 'Style', @@ -466,6 +511,10 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem textAltTitle: 'Title', textAltDescription: 'Description', 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.', + 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' }, SSE.Views.SlicerSettingsAdvanced || {})); }); From bebe79c9250f175fc93dbbfa53667536fd0ef9cb Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 27 May 2020 23:28:27 +0300 Subject: [PATCH 11/20] [SSE] Fix slicer styles --- .../main/app/controller/DocumentHolder.js | 7 ++++--- .../main/app/view/SlicerSettings.js | 1 + .../main/app/view/SlicerSettingsAdvanced.js | 20 +++++++++++-------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index efd5d1221..1addf0df4 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -884,9 +884,10 @@ define([ var me = this; (new SSE.Views.SlicerSettingsAdvanced({ - imageProps : item.imageInfo, - api : me.api, - handler : function(result, value) { + imageProps: item.imageInfo, + api : me.api, + styles : item.imageInfo.asc_getSlicerProperties().asc_getStylesPictures(), + handler : function(result, value) { if (result == 'ok') { if (me.api) { me.api.asc_setGraphicObjectProps(value.imageProps); diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index fcd2475be..ce0fb2e1a 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -493,6 +493,7 @@ define([ self.mnuSlicerPicker.store.reset(arr); } } + this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1); }, onSelectSlicerStyle: function(btn, picker, itemView, record) { diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index ff50d7038..a2d177b53 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -110,6 +110,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem iconCls : 'icon-template-slicer', menu : new Common.UI.Menu({ style: 'width: 333px;', + additionalAlign: this.menuAddAlign, items: [ { template: _.template('') } ] @@ -386,7 +387,6 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this._noApply = true; this.numCols.setValue(slicerprops.asc_getColumnCount(), true); - // this.numColWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getColWidth()).toFixed(2), true); this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getRowHeight()/36000).toFixed(2), true); this.inputHeader.setValue(slicerprops.asc_getCaption(), true); @@ -415,13 +415,16 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem value = slicerprops.asc_getStyle(); var rec = this.mnuSlicerPicker.store.findWhere({type: value}); - if (!rec) { + if (!rec && this.mnuSlicerPicker.store.length>0) { rec = this.mnuSlicerPicker.store.at(0); } - this.btnSlicerStyle.suspendEvents(); - this.mnuSlicerPicker.selectRecord(rec, true); - this.btnSlicerStyle.resumeEvents(); - this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); + if (rec) { + this.btnSlicerStyle.suspendEvents(); + this.mnuSlicerPicker.selectRecord(rec, true); + this.btnSlicerStyle.resumeEvents(); + this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); + } else + this.$window.find('.icon-template-slicer').css({'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); this._noApply = false; @@ -450,8 +453,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem }, onInitStyles: function(Templates){ - var count = this.mnuSlicerPicker.store.length, - arr = []; + var arr = []; Templates && _.each(Templates, function(template){ arr.push({ id : Common.UI.getId(), @@ -462,6 +464,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem }); }); this.mnuSlicerPicker.store.reset(arr); + this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1); }, onSelectSlicerStyle: function(btn, picker, itemView, record) { @@ -470,6 +473,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem if (this._changedProps) { this._changedProps.asc_setStyle(record.get('type')); } + this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + record.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); }, onRadioSnapChange: function(field, newValue, eOpts) { From 6a8e712c8f0e0c979df25def05129c839b0e7e0b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 13:58:38 +0300 Subject: [PATCH 12/20] [SSE] Add tooltip for slicer buttons --- .../main/app/controller/DocumentHolder.js | 61 ++++++++++++++++++- .../main/app/controller/Main.js | 8 ++- .../main/app/view/SlicerSettings.js | 2 +- .../main/app/view/SlicerSettingsAdvanced.js | 2 +- apps/spreadsheeteditor/main/locale/en.json | 2 + 5 files changed, 69 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 1addf0df4..07b5ad7cd 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -97,6 +97,9 @@ define([ row_column: { ttHeight: 20 }, + slicer: { + ttHeight: 20 + }, filter: {ttHeight: 40}, func_arg: {}, input_msg: {} @@ -957,7 +960,8 @@ define([ /** coauthoring end **/ index_locked, index_column, index_row, - index_filter; + index_filter, + index_slicer; for (var i = dataarray.length; i > 0; i--) { switch (dataarray[i-1].asc_getType()) { case Asc.c_oAscMouseMoveType.Hyperlink: @@ -980,6 +984,9 @@ define([ case Asc.c_oAscMouseMoveType.Filter: index_filter = i; break; + case Asc.c_oAscMouseMoveType.Tooltip: + index_slicer = i; + break; } } @@ -992,6 +999,7 @@ define([ hyperlinkTip = me.tooltips.hyperlink, row_columnTip = me.tooltips.row_column, filterTip = me.tooltips.filter, + slicerTip = me.tooltips.slicer, pos = [ me.documentHolder.cmpEl.offset().left - $(window).scrollLeft(), me.documentHolder.cmpEl.offset().top - $(window).scrollTop() @@ -1029,6 +1037,14 @@ define([ if (!index_locked) { me.hideCoAuthTips(); } + if (index_slicer===undefined) { + if (!slicerTip.isHidden && slicerTip.ref) { + slicerTip.ref.hide(); + slicerTip.ref = undefined; + slicerTip.text = ''; + slicerTip.isHidden = true; + } + } } if (index_filter===undefined || (me.dlgFilter && me.dlgFilter.isVisible()) || (me.currentMenu && me.currentMenu.isVisible())) { if (!filterTip.isHidden && filterTip.ref) { @@ -1038,7 +1054,6 @@ define([ filterTip.isHidden = true; } } - // show tooltips /** coauthoring begin **/ var getUserName = function(id){ @@ -1281,6 +1296,48 @@ define([ }); } } + + if (index_slicer!==undefined && me.permissions.isEdit) { + if (!slicerTip.parentEl) { + slicerTip.parentEl = $('
'); + me.documentHolder.cmpEl.append(slicerTip.parentEl); + } + + var data = dataarray[index_slicer-1], + str = data.asc_getTooltip(); + if (slicerTip.ref && slicerTip.ref.isVisible()) { + if (slicerTip.text != str) { + slicerTip.text = str; + slicerTip.ref.setTitle(str); + slicerTip.ref.updateTitle(); + } + } + + if (!slicerTip.ref || !slicerTip.ref.isVisible()) { + slicerTip.text = str; + slicerTip.ref = new Common.UI.Tooltip({ + owner : slicerTip.parentEl, + html : true, + title : str + }); + + slicerTip.ref.show([-10000, -10000]); + slicerTip.isHidden = false; + + showPoint = [data.asc_getX(), data.asc_getY()]; + showPoint[0] += (pos[0] + 6); + showPoint[1] += (pos[1] - 20 - slicerTip.ttHeight); + + var tipwidth = slicerTip.ref.getBSTip().$tip.width(); + if (showPoint[0] + tipwidth > me.tooltips.coauth.bodyWidth ) + showPoint[0] = me.tooltips.coauth.bodyWidth - tipwidth - 20; + + slicerTip.ref.getBSTip().$tip.css({ + top : showPoint[1] + 'px', + left: showPoint[0] + 'px' + }); + } + } } }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 2d716ff0b..69908a197 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -127,7 +127,9 @@ define([ 'Values': this.txtValues, 'Grand Total': this.txtGrandTotal, 'Row Labels': this.txtRowLbls, - 'Column Labels': this.txtColLbls + 'Column Labels': this.txtColLbls, + 'Multi-Select (Alt+S)': this.txtMultiSelect, + 'Clear Filter (Alt+C)': this.txtClearFilter }; styleNames.forEach(function(item){ translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; @@ -2548,7 +2550,9 @@ define([ txtRowLbls: 'Row Labels', txtColLbls: 'Column Labels', errNoDuplicates: 'No duplicate values found.', - errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.' + errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.', + txtMultiSelect: 'Multi-Select (Alt+S)', + txtClearFilter: 'Clear Filter (Alt+C)' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index ce0fb2e1a..c66ddc394 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -233,7 +233,7 @@ define([ value: '1', allowDecimal: false, maxValue: 20000, - minValue: 0 + minValue: 1 }); this.lockedControls.push(this.numCols); diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index a2d177b53..57da61753 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -190,7 +190,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem value: '1', allowDecimal: false, maxValue: 20000, - minValue: 0 + minValue: 1 }); this.numCols.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var numval = field.getNumberValue(); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index be7d1e351..87e382c73 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -814,6 +814,8 @@ "SSE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.txtMultiSelect": "Multi-Select (Alt+S)", + "SSE.Controllers.Main.txtClearFilter": "Clear Filter (Alt+C)", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", From 64904a2a0b2ed172e1efdfdeb6714be8a54457ca Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 17:05:20 +0300 Subject: [PATCH 13/20] [SSE] Fix slicer settings --- .../main/app/template/SlicerSettings.template | 4 +-- .../main/app/view/SlicerSettings.js | 34 ++++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template index fb68d3f6b..279a00689 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template @@ -20,11 +20,11 @@
- - diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index c66ddc394..32a3b37fd 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -75,7 +75,8 @@ define([ ColWidth: 0, ColHeight: 0, PosVert: 0, - PosHor: 0 + PosHor: 0, + PosLocked: false }; this.spinners = []; this.lockedControls = []; @@ -94,7 +95,7 @@ define([ scope: this })); - this.linkAdvanced = $('#image-advanced-link'); + this.linkAdvanced = $('#slicer-advanced-link'); }, setApi: function(api) { @@ -181,7 +182,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnHor); - this.lockedControls.push(this.spnVert); + this.lockedControls.push(this.spnHor); this.spnVert = new Common.UI.MetricSpinner({ el: $('#slicer-spin-vert'), @@ -200,6 +201,14 @@ define([ this.spnHor.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.spnVert.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.chLock = new Common.UI.CheckBox({ + el: $('#slicer-checkbox-disable-resize'), + labelText: this.textLock, + disabled: this._locked + }); + this.lockedControls.push(this.chLock); + this.chLock.on('change', this.onLockSlicerChange.bind(this)); + this.spnColWidth = new Common.UI.MetricSpinner({ el: $('#slicer-spin-col-width'), step: .1, @@ -367,6 +376,11 @@ define([ } this._isTemplatesChanged = false; + value = slicerprops.asc_getLockedPosition(); + if ( this._state.PosLocked!==value ) { + this.chLock.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); + this._state.PosLocked=value; + } } } }, @@ -493,7 +507,7 @@ define([ self.mnuSlicerPicker.store.reset(arr); } } - this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1); + this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1 || this._locked); }, onSelectSlicerStyle: function(btn, picker, itemView, record) { @@ -505,6 +519,15 @@ define([ } }, + onLockSlicerChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setLockedPosition(field.getValue()=='checked'); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, + setLocked: function (locked) { this._locked = locked; }, @@ -531,7 +554,8 @@ define([ textVert: 'Vertical', textButtons: 'Buttons', textColumns: 'Columns', - textStyle: 'Style' + textStyle: 'Style', + textLock: 'Disable resizing or moving' }, SSE.Views.SlicerSettings || {})); }); From 3d11c70bc071b7a05bd2bdb5e359f709a2ff6d67 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 17:15:53 +0300 Subject: [PATCH 14/20] [SSE] Add translation --- apps/spreadsheeteditor/main/app/controller/Main.js | 6 ++++-- apps/spreadsheeteditor/main/locale/en.json | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 69908a197..a8f952df1 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -129,7 +129,8 @@ define([ 'Row Labels': this.txtRowLbls, 'Column Labels': this.txtColLbls, 'Multi-Select (Alt+S)': this.txtMultiSelect, - 'Clear Filter (Alt+C)': this.txtClearFilter + 'Clear Filter (Alt+C)': this.txtClearFilter, + '(blank)': this.txtBlank }; styleNames.forEach(function(item){ translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; @@ -2552,7 +2553,8 @@ define([ errNoDuplicates: 'No duplicate values found.', errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.', txtMultiSelect: 'Multi-Select (Alt+S)', - txtClearFilter: 'Clear Filter (Alt+C)' + txtClearFilter: 'Clear Filter (Alt+C)', + txtBlank: '(blank)' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 87e382c73..8c70a7bff 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -816,6 +816,7 @@ "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.txtMultiSelect": "Multi-Select (Alt+S)", "SSE.Controllers.Main.txtClearFilter": "Clear Filter (Alt+C)", + "SSE.Controllers.Main.txtBlank": "(blank)", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", From dc77c54de7b869371257439697815b7a159e036a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 17:58:32 +0300 Subject: [PATCH 15/20] [SSE] Add icons for slicer --- .../main/app/template/RightMenu.template | 2 +- apps/spreadsheeteditor/main/app/view/Toolbar.js | 2 +- .../resources/img/toolbar/1x/big/btn-slicer.png | Bin 0 -> 430 bytes .../main/resources/img/toolbar/1x/btn-slicer.png | Bin 0 -> 382 bytes .../resources/img/toolbar/2x/big/btn-slicer.png | Bin 0 -> 698 bytes .../main/resources/img/toolbar/2x/btn-slicer.png | Bin 0 -> 606 bytes 6 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-slicer.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/btn-slicer.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-slicer.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-slicer.png diff --git a/apps/spreadsheeteditor/main/app/template/RightMenu.template b/apps/spreadsheeteditor/main/app/template/RightMenu.template index 385e6d61a..c8f9c4ac0 100644 --- a/apps/spreadsheeteditor/main/app/template/RightMenu.template +++ b/apps/spreadsheeteditor/main/app/template/RightMenu.template @@ -31,7 +31,7 @@ - + \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index ddcae6038..1b3a1115c 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -737,7 +737,7 @@ define([ me.btnInsertSlicer = new Common.UI.Button({ id: 'tlbtn-insertslicer', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-symbol', + iconCls: 'toolbar__icon btn-slicer', caption: me.capBtnInsSlicer, lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.multiselect, _set.noSlicerSource] }); diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-slicer.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-slicer.png new file mode 100644 index 0000000000000000000000000000000000000000..61c78064429b72198455f4a2b564234b3062a8f4 GIT binary patch literal 430 zcmV;f0a5;mP)6xS}0u&0nrt*E+w(Z+m zdjai_R+Z`d{u(EmUM!^tOAltI^q`Q#_n;RiwpDpLvE1cJ zhrfIt4?E~U?VphAzu}evV*A1_`Bp$A_b2r)^>`)vcf{Nsra_eUAV7zZR z;si?Og+G}gBDoOr!r6FBIYKQ+Fp^p29E_w_jz|(DJd!_=b9f|IuPpS zI};k0oWZ^0-9_=i7)drVoOp~Ri;_Qgui!Y2@$WY>AbOu7 z5TcaQ%d#|~am=;j=?Zc*<_zY8uImgW5Q|5_q@$+l&gcB>(UMH5@UV>eNw9i#l)gH$&;G+?EW~}NI z8nlucj~0(Xk`L#fq-$_OVPKN7a-Q~0wx}Z~M;8|mVg+VMlnY@6y!o6QAr>S&l38*N zkK{@21?k5@agtc+$6+kKvHB@c$0knPBXvwNw!NGLw{2^nAnc!skfb&E4RQr(FS|iG cO6U6=cMJ}c_Xe$ZKL7v#07*qoM6N<$f>$(_!vFvP literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-slicer.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-slicer.png new file mode 100644 index 0000000000000000000000000000000000000000..530e454a3eb47324c147bef6d203686d6c036b88 GIT binary patch literal 698 zcmV;r0!96aP)h>9t+5e7uSw5fpWcGugqUDfO4xdA7PmJYoIIwaSJFpa|Xpw3!38j3=7xCH%zcfd{g2HN%KINXckm%W35y*@j~__ndrf=(c*h1o{)SG zjOfIi&YL8n6KBN}vK(R}h*+d}mIxv`i6>+`g)R`WXz?ryM06HU$eKn3h**VqmH-jG z#1pdTfgU1OC7#7YL~rqgA`*EA5vvr>;viy>ctSCim?t7uEuQ6xh{59Zzw6r3R$R1e zlHE)PySukk literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-slicer.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/btn-slicer.png new file mode 100644 index 0000000000000000000000000000000000000000..389f78334442548eaf59314282e30baf5b8d0538 GIT binary patch literal 606 zcmV-k0-^nhP)jK~#7F?V5pY z!Y~j;&k+MK0;5pD9?ZZ5bvEb<-2>E)!U&xp>0Pj;HpRj5-8qqZPcn%JnDh77`D_7T z7>4nGaj6G~!{Owdd&Ao;X#B8qx325_^?H4W0{Xr`;YBSz7E+6c38=Av?HF&?KAG0~#P*FPDo01&+sK4?F>O^n#P15+9B~E4~H{7Mt7;2FI|` za&&MEo4JlQ2QtZaV5HPRQVxDbX-+J4usM*)YzNkIQYlioFc)(mlWYfSt)5b7)q~G4 z2QslbaD>%?m8n(-YV|WlDi`MVV-94(tphzesSWRYyu5-8E%xi7fKe`_^Sm~^??Es= z?AOx`*MS~|8-fZ0Zh=p+cn|O>+z?+FutyQXgnAt~A>yLqMJ7aiD&Fw@)Pq>>N$nWMdueXJvEGx~d5rhcwiBtuR2}$*ZOc7{ zQ9MT+;^Usea2=dBxmxBvhE literal 0 HcmV?d00001 From b87b9f956fdc598b4c15a5a2ebe4716f4a3f4989 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 17:59:49 +0300 Subject: [PATCH 16/20] [SSE] Fix size settings for slicer --- .../template/SlicerSettingsAdvanced.template | 1 + .../main/app/view/SlicerSettingsAdvanced.js | 55 +++++++++++++++++-- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template index 2da72ee09..ca36d5327 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template @@ -17,6 +17,7 @@
+
diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index 57da61753..b936de705 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -75,6 +75,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem this._changedProps = null; this._noApply = true; this.spinners = []; + this._nRatio = 1; this._originalProps = this.options.imageProps; }, @@ -138,9 +139,19 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem minValue: 0 }); this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ - var numval = field.getNumberValue(); + if (this.btnRatio.pressed) { + var w = field.getNumberValue(); + var h = w/this._nRatio; + if (h>this.numHeight.options.maxValue) { + h = this.numHeight.options.maxValue; + w = h * this._nRatio; + this.numWidth.setValue(w, true); + } + this.numHeight.setValue(h, true); + } if (this._originalProps) { - this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(numval)); + this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.numHeight.getNumberValue())); } }, this)); this.spinners.push(this.numWidth); @@ -156,13 +167,40 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem minValue: 0 }); this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ - var numval = field.getNumberValue(); + var h = field.getNumberValue(), w = null; + if (this.btnRatio.pressed) { + w = h * this._nRatio; + if (w>this.numWidth.options.maxValue) { + w = this.numWidth.options.maxValue; + h = w/this._nRatio; + this.numHeight.setValue(h, true); + } + this.numWidth.setValue(w, true); + } if (this._originalProps) { - this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(numval)); + this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.numWidth.getNumberValue())); + this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } }, this)); this.spinners.push(this.numHeight); + this.btnRatio = new Common.UI.Button({ + parentEl: $('#sliceradv-button-ratio'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon advanced-btn-ratio', + style: 'margin-bottom: 1px;', + enableToggle: true, + hint: this.textKeepRatio + }); + this.btnRatio.on('click', _.bind(function(btn, e) { + if (btn.pressed && this.numHeight.getNumberValue()>0) { + this._nRatio = this.numWidth.getNumberValue()/this.numHeight.getNumberValue(); + } + if (this._originalProps) { + this._originalProps.asc_putLockAspect(btn.pressed); + } + }, this)); + this.numColHeight = new Common.UI.MetricSpinner({ el: $('#sliceradv-spin-col-height'), step: .1, @@ -363,6 +401,12 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem value = props.asc_getHeight(); this.numHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); + if (props.asc_getHeight()>0) + this._nRatio = props.asc_getWidth()/props.asc_getHeight(); + + value = props.asc_getLockAspect(); + this.btnRatio.toggle(value); + value = props.asc_getTitle(); this.inputAltTitle.setValue(value ? value : ''); @@ -518,7 +562,8 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem 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', + textKeepRatio: 'Constant Proportions' }, SSE.Views.SlicerSettingsAdvanced || {})); }); From 33557ba72df34d6f3892621f97bc5d9f764d8781 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 18:09:35 +0300 Subject: [PATCH 17/20] [SSE] Fix adding slicer --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index c2595b986..58a13cfff 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2824,7 +2824,7 @@ define([ (new SSE.Views.SlicerAddDialog({ props: props, handler: function (result, settings) { - if (me && me.api) { + if (me && me.api && result == 'ok') { me.api.asc_insertSlicer(settings); } Common.NotificationCenter.trigger('edit:complete', me.toolbar); From bb7c716a38d71c3a76dbdf66fc88021c4726e4c5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 19:01:50 +0300 Subject: [PATCH 18/20] [SSE] Add sort settings for slicer to the right menu --- .../main/app/template/SlicerSettings.template | 40 +++++ .../template/SlicerSettingsAdvanced.template | 4 - .../main/app/view/SlicerSettings.js | 147 +++++++++++++++++- .../main/app/view/SlicerSettingsAdvanced.js | 2 +- 4 files changed, 186 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template index 279a00689..db9953804 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template @@ -80,6 +80,46 @@
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template index ca36d5327..d61f2be90 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template @@ -29,10 +29,6 @@
- - - -
diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index 32a3b37fd..35707ae08 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -76,7 +76,11 @@ define([ ColHeight: 0, PosVert: 0, PosHor: 0, - PosLocked: false + PosLocked: false, + SortOrder: Asc.ST_tabularSlicerCacheSortOrder.Ascending, + IndNoData: false, + ShowNoData: false, + HideNoData: false }; this.spinners = []; this.lockedControls = []; @@ -253,6 +257,95 @@ define([ this.spnColHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.numCols.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + // Sorting & Filtering + + this.radioAsc = new Common.UI.RadioBox({ + el: $('#slicer-radio-asc'), + name: 'asc-radio-sliceradv-sort', + labelText: this.textAsc + ' (' + this.textAZ + ')', + checked: true + }); + this.radioAsc.on('change', _.bind(function(field, newValue, eOpts) { + if (newValue && this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Ascending); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, this)); + this.lockedControls.push(this.radioAsc); + + this.radioDesc = new Common.UI.RadioBox({ + el: $('#slicer-radio-desc'), + name: 'asc-radio-sliceradv-sort', + labelText: this.textDesc + ' (' + this.textZA + ')', + checked: false + }); + this.radioDesc.on('change', _.bind(function(field, newValue, eOpts) { + if (newValue && this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Descending); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, this)); + this.lockedControls.push(this.radioDesc); + + this.chHideNoData = new Common.UI.CheckBox({ + el: $('#slicer-check-hide-nodata'), + labelText: this.strHideNoData + }); + this.chHideNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var checked = (field.getValue()=='checked'); + this.chIndNoData.setDisabled(checked); + this.chShowNoData.setDisabled(checked || (this.chIndNoData.getValue()!='checked')); + this.chShowDel.setDisabled(checked); + if (this._originalProps && this.api) { + this._originalProps.asc_getSlicerProperties().asc_setHideItemsWithNoData(checked); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + }, this)); + this.lockedControls.push(this.chHideNoData); + + this.chIndNoData = new Common.UI.CheckBox({ + el: $('#slicer-check-indicate-nodata'), + labelText: this.strIndNoData + }); + this.chIndNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var checked = (field.getValue()=='checked'); + this.chShowNoData.setDisabled(!checked); + if (this._originalProps && this.api) { + this._originalProps.asc_getSlicerProperties().asc_setIndicateItemsWithNoData(checked); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + }, this)); + this.lockedControls.push(this.chIndNoData); + + this.chShowNoData = new Common.UI.CheckBox({ + el: $('#slicer-check-show-nodata-last'), + disabled: true, + labelText: this.strShowNoData + }); + this.chShowNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._originalProps && this.api) { + this._originalProps.asc_getSlicerProperties().asc_setShowItemsWithNoDataLast(field.getValue()=='checked'); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + }, this)); + this.lockedControls.push(this.chShowNoData); + + this.chShowDel = new Common.UI.CheckBox({ + el: $('#slicer-check-show-deleted'), + labelText: this.strShowDel + }); + this.chShowDel.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + // if (this._originalProps && this.api) { + // this._originalProps.asc_getSlicerProperties().asc_setIndicateItemsWithNoData(field.getValue()=='checked'); + // this.api.asc_setGraphicObjectProps(this._originalProps); + // } + }, this)); + this.lockedControls.push(this.chShowDel); + $(this.el).on('click', '#slicer-advanced-link', _.bind(this.openAdvancedSettings, this)); }, @@ -381,6 +474,43 @@ define([ this.chLock.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); this._state.PosLocked=value; } + + // depends of data type + // this.radioAsc.setCaption(this.textAsc + ' (' + this.textAZ + ')' ); + // this.radioDesc.setCaption(this.textDesc + ' (' + this.textZA + ')' ); + value = slicerprops.asc_getSortOrder(); + if ( this._state.SortOrder!==value ) { + (value==Asc.ST_tabularSlicerCacheSortOrder.Ascending) ? this.radioAsc.setValue(true, true) : this.radioDesc.setValue(true, true); + this._state.SortOrder=value; + } + + value = slicerprops.asc_getIndicateItemsWithNoData(); + if ( this._state.IndNoData!==value ) { + this.chIndNoData.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); + this._state.IndNoData=value; + } + + value = slicerprops.asc_getShowItemsWithNoDataLast(); + if ( this._state.ShowNoData!==value ) { + this.chShowNoData.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); + this._state.ShowNoData=value; + } + + value = slicerprops.asc_getHideItemsWithNoData(); + if ( this._state.HideNoData!==value ) { + this.chHideNoData.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); + this._state.HideNoData=value; + } + + this.chIndNoData.setDisabled(value); + this.chShowNoData.setDisabled(value || (this.chIndNoData.getValue()!='checked')); + this.chShowDel.setDisabled(value); + + // value = slicerprops.asc_getShowDeleted(); + // if ( this._state.ShowDel!==value ) { + // this.chShowDel.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); + // this._state.ShowDel=value; + // } } } }, @@ -555,7 +685,20 @@ define([ textButtons: 'Buttons', textColumns: 'Columns', textStyle: 'Style', - textLock: 'Disable resizing or moving' + textLock: 'Disable resizing or moving', + strSorting: 'Sorting and filtering', + textAsc: 'Ascending', + textDesc: 'Descending', + textAZ: 'A to Z', + textZA: 'Z to A', + textOldNew: 'oldest to newest', + textNewOld: 'newest to oldest', + textSmallLarge: 'smallest to largest', + textLargeSmall: 'largest to smallest', + strHideNoData: 'Hide items with no data', + strIndNoData: 'Visually indicate items with no data', + strShowNoData: 'Show items with no data last', + strShowDel: 'Show items deleted from the data source' }, SSE.Views.SlicerSettings || {})); }); diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js index b936de705..c749b5efd 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettingsAdvanced.js @@ -300,7 +300,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem }); this.chShowNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { - this._changedProps.asc_setHideItemsWithNoData(field.getValue()=='checked'); + this._changedProps.asc_setShowItemsWithNoDataLast(field.getValue()=='checked'); } }, this)); From 84ef09df8bd12d6c677445f645d157a785a847f0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 29 May 2020 15:39:37 +0300 Subject: [PATCH 19/20] [SSE] Add translation --- apps/spreadsheeteditor/main/locale/en.json | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 662d89a5e..05c86829d 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1579,6 +1579,7 @@ "SSE.Views.DocumentHolder.txtWidth": "Width", "SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", "SSE.Views.DocumentHolder.textFromStorage": "From Storage", + "SSE.Views.DocumentHolder.advancedSlicerText": "Slicer Advanced Settings", "SSE.Views.FieldSettingsDialog.strLayout": "Layout", "SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals", "SSE.Views.FieldSettingsDialog.textReport": "Report Form", @@ -2243,6 +2244,71 @@ "SSE.Views.SignatureSettings.txtRequestedSignatures": "This spreadsheet needs to be signed.", "SSE.Views.SignatureSettings.txtSigned": "Valid signatures has been added to the spreadsheet. The spreadsheet is protected from editing.", "SSE.Views.SignatureSettings.txtSignedInvalid": "Some of the digital signatures in spreadsheet are invalid or could not be verified. The spreadsheet is protected from editing.", + "SSE.Views.SlicerAddDialog.txtTitle": "Insert Slicers", + "SSE.Views.SlicerAddDialog.textColumns": "Columns", + "SSE.Views.SlicerSettings.textKeepRatio": "Constant Proportions", + "SSE.Views.SlicerSettings.textSize": "Size", + "SSE.Views.SlicerSettings.textWidth": "Width", + "SSE.Views.SlicerSettings.textHeight": "Height", + "SSE.Views.SlicerSettings.textAdvanced": "Show advanced settings", + "SSE.Views.SlicerSettings.textPosition": "Position", + "SSE.Views.SlicerSettings.textHor": "Horizontal", + "SSE.Views.SlicerSettings.textVert": "Vertical", + "SSE.Views.SlicerSettings.textButtons": "Buttons", + "SSE.Views.SlicerSettings.textColumns": "Columns", + "SSE.Views.SlicerSettings.textStyle": "Style", + "SSE.Views.SlicerSettings.textLock": "Disable resizing or moving", + "SSE.Views.SlicerSettings.strSorting": "Sorting and filtering", + "SSE.Views.SlicerSettings.textAsc": "Ascending", + "SSE.Views.SlicerSettings.textDesc": "Descending", + "SSE.Views.SlicerSettings.textAZ": "A to Z", + "SSE.Views.SlicerSettings.textZA": "Z to A", + "SSE.Views.SlicerSettings.textOldNew": "oldest to newest", + "SSE.Views.SlicerSettings.textNewOld": "newest to oldest", + "SSE.Views.SlicerSettings.textSmallLarge": "smallest to largest", + "SSE.Views.SlicerSettings.textLargeSmall": "largest to smallest", + "SSE.Views.SlicerSettings.strHideNoData": "Hide items with no data", + "SSE.Views.SlicerSettings.strIndNoData": "Visually indicate items with no data", + "SSE.Views.SlicerSettings.strShowNoData": "Show items with no data last", + "SSE.Views.SlicerSettings.strShowDel": "Show items deleted from the data source", + "SSE.Views.SlicerSettingsAdvanced.textTitle": "Slicer - Advanced Settings", + "SSE.Views.SlicerSettingsAdvanced.textHeader": "Header", + "SSE.Views.SlicerSettingsAdvanced.strStyle": "Style", + "SSE.Views.SlicerSettingsAdvanced.strSize": "Size", + "SSE.Views.SlicerSettingsAdvanced.strWidth": "Width", + "SSE.Views.SlicerSettingsAdvanced.strHeight": "Height", + "SSE.Views.SlicerSettingsAdvanced.strButtons": "Buttons", + "SSE.Views.SlicerSettingsAdvanced.strColumns": "Columns", + "SSE.Views.SlicerSettingsAdvanced.textSort": "Sort", + "SSE.Views.SlicerSettingsAdvanced.textSourceName": "Source name", + "SSE.Views.SlicerSettingsAdvanced.textFormulaName": "Name to use in formulas", + "SSE.Views.SlicerSettingsAdvanced.textName": "Name", + "SSE.Views.SlicerSettingsAdvanced.strStyleSize": "Style & Size", + "SSE.Views.SlicerSettingsAdvanced.strSorting": "Sorting & Filtering", + "SSE.Views.SlicerSettingsAdvanced.strReferences": "References", + "SSE.Views.SlicerSettingsAdvanced.txtEmpty": "This field is required", + "SSE.Views.SlicerSettingsAdvanced.strShowHeader": "Display header", + "SSE.Views.SlicerSettingsAdvanced.textAsc": "Ascending", + "SSE.Views.SlicerSettingsAdvanced.textDesc": "Descending", + "SSE.Views.SlicerSettingsAdvanced.textAZ": "A to Z", + "SSE.Views.SlicerSettingsAdvanced.textZA": "Z to A", + "SSE.Views.SlicerSettingsAdvanced.textOldNew": "oldest to newest", + "SSE.Views.SlicerSettingsAdvanced.textNewOld": "newest to oldest", + "SSE.Views.SlicerSettingsAdvanced.textSmallLarge": "smallest to largest", + "SSE.Views.SlicerSettingsAdvanced.textLargeSmall": "largest to smallest", + "SSE.Views.SlicerSettingsAdvanced.strHideNoData": "Hide items with no data", + "SSE.Views.SlicerSettingsAdvanced.strIndNoData": "Visually indicate items with no data", + "SSE.Views.SlicerSettingsAdvanced.strShowNoData": "Show items with no data last", + "SSE.Views.SlicerSettingsAdvanced.strShowDel": "Show items deleted from the data source", + "SSE.Views.SlicerSettingsAdvanced.textAlt": "Alternative Text", + "SSE.Views.SlicerSettingsAdvanced.textAltTitle": "Title", + "SSE.Views.SlicerSettingsAdvanced.textAltDescription": "Description", + "SSE.Views.SlicerSettingsAdvanced.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.", + "SSE.Views.SlicerSettingsAdvanced.textSnap": "Cell Snapping", + "SSE.Views.SlicerSettingsAdvanced.textAbsolute": "Don't move or size with cells", + "SSE.Views.SlicerSettingsAdvanced.textOneCell": "Move but don't size with cells", + "SSE.Views.SlicerSettingsAdvanced.textTwoCell": "Move and size with cells", + "SSE.Views.SlicerSettingsAdvanced.textKeepRatio": "Constant Proportions", "SSE.Views.SortDialog.errorEmpty": "All sort criteria must have a column or row specified.", "SSE.Views.SortDialog.errorMoreOneCol": "More than one column is selected.", "SSE.Views.SortDialog.errorMoreOneRow": "More than one row is selected.", @@ -2670,6 +2736,8 @@ "SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells", "SSE.Views.Toolbar.txtYen": "¥ Yen", "SSE.Views.Toolbar.textVertical": "Vertical Text", + "SSE.Views.Toolbar.capBtnInsSlicer": "Slicer", + "SSE.Views.Toolbar.tipInsertSlicer": "Insert slicer", "SSE.Views.Top10FilterDialog.textType": "Show", "SSE.Views.Top10FilterDialog.txtBottom": "Bottom", "SSE.Views.Top10FilterDialog.txtItems": "Item", From 6d4113fe3ea752951771ccdfb73cd4ac10949aac Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 29 May 2020 19:21:19 +0300 Subject: [PATCH 20/20] [SSE] Slicer settings: set position, lock size controls. --- .../main/app/view/SlicerSettings.js | 116 +++++++++++++----- 1 file changed, 86 insertions(+), 30 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index 35707ae08..a922dbf57 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -80,10 +80,12 @@ define([ SortOrder: Asc.ST_tabularSlicerCacheSortOrder.Ascending, IndNoData: false, ShowNoData: false, - HideNoData: false + HideNoData: false, + DisabledSizeControls: false }; this.spinners = []; this.lockedControls = []; + this.sizeControls = []; this._locked = false; this._noApply = false; @@ -135,7 +137,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnWidth); - this.lockedControls.push(this.spnWidth); + this.sizeControls.push(this.spnWidth); this.spnHeight = new Common.UI.MetricSpinner({ el: $('#slicer-spin-height'), @@ -147,7 +149,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnHeight); - this.lockedControls.push(this.spnHeight); + this.sizeControls.push(this.spnHeight); this.btnRatio = new Common.UI.Button({ parentEl: $('#slicer-button-ratio'), @@ -157,7 +159,7 @@ define([ enableToggle: true, hint: this.textKeepRatio }); - this.lockedControls.push(this.btnRatio); + this.sizeControls.push(this.btnRatio); this.btnRatio.on('click', _.bind(function(btn, e) { if (btn.pressed && this.spnHeight.getNumberValue()>0) { @@ -169,6 +171,7 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); }, this)); this.spnWidth.on('change', _.bind(this.onWidthChange, this)); @@ -186,7 +189,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnHor); - this.lockedControls.push(this.spnHor); + this.sizeControls.push(this.spnHor); this.spnVert = new Common.UI.MetricSpinner({ el: $('#slicer-spin-vert'), @@ -198,10 +201,10 @@ define([ minValue: 0 }); this.spinners.push(this.spnVert); - this.lockedControls.push(this.spnVert); + this.sizeControls.push(this.spnVert); - // this.spnHor.on('change', _.bind(this.onHorChange, this)); - // this.spnVert.on('change', _.bind(this.onVertChange, this)); + this.spnHor.on('change', _.bind(this.onHorChange, this)); + this.spnVert.on('change', _.bind(this.onVertChange, this)); this.spnHor.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.spnVert.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); @@ -223,7 +226,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnColWidth); - this.lockedControls.push(this.spnColWidth); + this.sizeControls.push(this.spnColWidth); this.spnColHeight = new Common.UI.MetricSpinner({ el: $('#slicer-spin-col-height'), @@ -235,7 +238,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnColHeight); - this.lockedControls.push(this.spnColHeight); + this.sizeControls.push(this.spnColHeight); this.numCols = new Common.UI.MetricSpinner({ el: $('#slicer-spin-cols'), @@ -248,7 +251,7 @@ define([ maxValue: 20000, minValue: 1 }); - this.lockedControls.push(this.numCols); + this.sizeControls.push(this.numCols); this.spnColWidth.on('change', _.bind(this.onColWidthChange, this)); this.spnColHeight.on('change', _.bind(this.onColHeightChange, this)); @@ -271,6 +274,7 @@ define([ this._originalProps.asc_getSlicerProperties().asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Ascending); this.api.asc_setGraphicObjectProps(this._originalProps); } + Common.NotificationCenter.trigger('edit:complete', this); } }, this)); this.lockedControls.push(this.radioAsc); @@ -287,6 +291,7 @@ define([ this._originalProps.asc_getSlicerProperties().asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Descending); this.api.asc_setGraphicObjectProps(this._originalProps); } + Common.NotificationCenter.trigger('edit:complete', this); } }, this)); this.lockedControls.push(this.radioDesc); @@ -297,13 +302,11 @@ define([ }); this.chHideNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var checked = (field.getValue()=='checked'); - this.chIndNoData.setDisabled(checked); - this.chShowNoData.setDisabled(checked || (this.chIndNoData.getValue()!='checked')); - this.chShowDel.setDisabled(checked); if (this._originalProps && this.api) { this._originalProps.asc_getSlicerProperties().asc_setHideItemsWithNoData(checked); this.api.asc_setGraphicObjectProps(this._originalProps); } + Common.NotificationCenter.trigger('edit:complete', this); }, this)); this.lockedControls.push(this.chHideNoData); @@ -313,11 +316,11 @@ define([ }); this.chIndNoData.on('change', _.bind(function(field, newValue, oldValue, eOpts){ var checked = (field.getValue()=='checked'); - this.chShowNoData.setDisabled(!checked); if (this._originalProps && this.api) { this._originalProps.asc_getSlicerProperties().asc_setIndicateItemsWithNoData(checked); this.api.asc_setGraphicObjectProps(this._originalProps); } + Common.NotificationCenter.trigger('edit:complete', this); }, this)); this.lockedControls.push(this.chIndNoData); @@ -331,6 +334,7 @@ define([ this._originalProps.asc_getSlicerProperties().asc_setShowItemsWithNoDataLast(field.getValue()=='checked'); this.api.asc_setGraphicObjectProps(this._originalProps); } + Common.NotificationCenter.trigger('edit:complete', this); }, this)); this.lockedControls.push(this.chShowNoData); @@ -387,7 +391,6 @@ define([ me.api.asc_setGraphicObjectProps(value.imageProps); } } - Common.NotificationCenter.trigger('edit:complete', me); } })).show(); @@ -402,8 +405,6 @@ define([ if (this._initSettings) this.createDelayedElements(); - this.disableControls(this._locked); - if (props ){ this._originalProps = new Asc.asc_CImgProperty(props); @@ -430,7 +431,19 @@ define([ this._state.keepRatio=value; } + value = props.get_Position(); + if (value) { + var Position = {X: value.get_X(), Y: value.get_Y()}; + this.spnHor.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true); + this.spnVert.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true); + } else { + this.spnHor.setValue('', true); + this.spnVert.setValue('', true); + } + var slicerprops = props.asc_getSlicerProperties(); + this.disableControls(this._locked, slicerprops ? slicerprops.asc_getLockedPosition() : false); + if (slicerprops) { value = slicerprops.asc_getColumnCount(); if ( Math.abs(this._state.ColCount-value)>0.1 || @@ -470,19 +483,13 @@ define([ this._isTemplatesChanged = false; value = slicerprops.asc_getLockedPosition(); - if ( this._state.PosLocked!==value ) { - this.chLock.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); - this._state.PosLocked=value; - } + this.chLock.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); // depends of data type // this.radioAsc.setCaption(this.textAsc + ' (' + this.textAZ + ')' ); // this.radioDesc.setCaption(this.textDesc + ' (' + this.textZA + ')' ); value = slicerprops.asc_getSortOrder(); - if ( this._state.SortOrder!==value ) { - (value==Asc.ST_tabularSlicerCacheSortOrder.Ascending) ? this.radioAsc.setValue(true, true) : this.radioDesc.setValue(true, true); - this._state.SortOrder=value; - } + (value==Asc.ST_tabularSlicerCacheSortOrder.Ascending) ? this.radioAsc.setValue(true, true) : this.radioDesc.setValue(true, true); value = slicerprops.asc_getIndicateItemsWithNoData(); if ( this._state.IndNoData!==value ) { @@ -502,9 +509,9 @@ define([ this._state.HideNoData=value; } - this.chIndNoData.setDisabled(value); - this.chShowNoData.setDisabled(value || (this.chIndNoData.getValue()!='checked')); - this.chShowDel.setDisabled(value); + this.chIndNoData.setDisabled(value || this._locked); + this.chShowNoData.setDisabled(value || (this.chIndNoData.getValue()!='checked') || this._locked); + this.chShowDel.setDisabled(value || this._locked); // value = slicerprops.asc_getShowDeleted(); // if ( this._state.ShowDel!==value ) { @@ -534,6 +541,7 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); }, onHeightChange: function(field, newValue, oldValue, eOpts){ @@ -554,6 +562,39 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); + }, + + onHorChange: function(field, newValue, oldValue, eOpts){ + var Position = new Asc.CPosition(); + if (field.getValue() !== '') + Position.put_X(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + if (this.spnVert.getValue() !== '') + Position.put_Y(Common.Utils.Metric.fnRecalcToMM(this.spnVert.getNumberValue())); + + if (this.api) { + if (this._originalProps) { + this._originalProps.put_Position(Position); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + Common.NotificationCenter.trigger('edit:complete', this); + }, + + onVertChange: function(field, newValue, oldValue, eOpts){ + var Position = new Asc.CPosition(); + if (this.spnHor.getValue() !== '') + Position.put_X(Common.Utils.Metric.fnRecalcToMM(this.spnHor.getNumberValue())); + if (field.getValue() !== '') + Position.put_Y(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + + if (this.api) { + if (this._originalProps) { + this._originalProps.put_Position(Position); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + Common.NotificationCenter.trigger('edit:complete', this); }, onColWidthChange: function(field, newValue, oldValue, eOpts){ @@ -563,6 +604,7 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); }, onColHeightChange: function(field, newValue, oldValue, eOpts){ @@ -572,6 +614,7 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); }, onColChange: function(field, newValue, oldValue, eOpts){ @@ -581,6 +624,7 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); }, onInitStyles: function(Templates){ @@ -647,6 +691,7 @@ define([ this._originalProps.asc_getSlicerProperties().asc_setStyle(record.get('type')); this.api.asc_setGraphicObjectProps(this._originalProps); } + Common.NotificationCenter.trigger('edit:complete', this); }, onLockSlicerChange: function(field, newValue, oldValue, eOpts){ @@ -656,15 +701,17 @@ define([ this.api.asc_setGraphicObjectProps(this._originalProps); } } + Common.NotificationCenter.trigger('edit:complete', this); }, setLocked: function (locked) { this._locked = locked; }, - disableControls: function(disable) { + disableControls: function(disable, disableSize) { if (this._initSettings) return; + this.disableSizeControls(disable || disableSize); if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; _.each(this.lockedControls, function(item) { @@ -674,6 +721,15 @@ define([ } }, + disableSizeControls: function(disable) { + if (this._state.DisabledSizeControls!==disable) { + this._state.DisabledSizeControls = disable; + _.each(this.sizeControls, function(item) { + item.setDisabled(disable); + }); + } + }, + textKeepRatio: 'Constant Proportions', textSize: 'Size', textWidth: 'Width',