From c47d09be76bd4c9e7f936985dd3cc04ccc8f54ac Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Apr 2020 16:08:14 +0300 Subject: [PATCH 01/63] [SSE] Move color scheme button to Layout tab --- .../img/toolbar/1.5x/big/btn-colorschemas.png | Bin 0 -> 275 bytes .../img/toolbar/1x/big/btn-colorschemas.png | Bin 0 -> 229 bytes .../img/toolbar/2x/big/btn-colorschemas.png | Bin 0 -> 394 bytes .../main/app/template/Toolbar.template | 6 +++++- apps/spreadsheeteditor/main/app/view/Toolbar.js | 8 +++++--- apps/spreadsheeteditor/main/locale/en.json | 1 + 6 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 apps/common/main/resources/img/toolbar/1.5x/big/btn-colorschemas.png create mode 100644 apps/common/main/resources/img/toolbar/1x/big/btn-colorschemas.png create mode 100644 apps/common/main/resources/img/toolbar/2x/big/btn-colorschemas.png diff --git a/apps/common/main/resources/img/toolbar/1.5x/big/btn-colorschemas.png b/apps/common/main/resources/img/toolbar/1.5x/big/btn-colorschemas.png new file mode 100644 index 0000000000000000000000000000000000000000..c67c4f8f21ee8aa2d086c007afa7eca83c4d66a0 GIT binary patch literal 275 zcmV+u0qp*XP)&4s ztM;drL>17_0IGowq6%mPPz5xCsRD{r0cEOzGF3pCYM@LN&@)v)=g*}jpm=E+D5RiJ zLmTR#K7kNW7*Swc0cd4$i=lPi*>R=nytCtqfbtU{po6Faim#P`@@u7_L^V*PDkxAL z6sQUcR0jnrK*hKspg67oloL>_q4%Nq%?T)u$O_5{DAv%1HuSHc@Ica!}F}%e{x^=7$w(|5U;>EKlN|W?%7q}XMT)X>XlyR`Qgl;sJACl>XtfMeJE`x zdBAw7F;qb`g7s39f-1+QhS#sTEGL9}G@faEvs0lM2-O>c9VQ4L&{Q~KZp_Mg--1=@ ziAcqS;0KO=jqH}Jax9vT6PS*Oa7+kJaCqi0?T<|(b0rg}5&I_g2I(VTe|}#Rwm*1H ccDcWNa8)*o_|`5~pt~77UHx3vIVCg!07>yx&Hw-a literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/2x/big/btn-colorschemas.png b/apps/common/main/resources/img/toolbar/2x/big/btn-colorschemas.png new file mode 100644 index 0000000000000000000000000000000000000000..b375d44f6a70e6bf4d44a61a61ef99c493d893e1 GIT binary patch literal 394 zcmV;50d@X~P)0{{R307*qoM6N<$f^|~8O#lD@ literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 958f2d26d..64d923a56 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -109,7 +109,7 @@
- +
@@ -162,6 +162,10 @@
+
+
+ +
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index eccc8ae5d..3664876e4 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1018,8 +1018,9 @@ define([ me.btnColorSchemas = new Common.UI.Button({ id : 'id-toolbar-btn-colorschemas', - cls : 'btn-toolbar', - iconCls : 'toolbar__icon toolbar__icon btn-colorschemas', + cls : 'btn-toolbar x-huge icon-top', + iconCls : 'toolbar__icon btn-colorschemas', + caption : me.capBtnColorSchemas, lock : [_set.editCell, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ items: [], @@ -2393,6 +2394,7 @@ define([ tipInsertSymbol: 'Insert symbol', txtAutosumTip: 'Summation', capBtnPrintTitles: 'Print Titles', - tipPrintTitles: 'Print titles' + tipPrintTitles: 'Print titles', + capBtnColorSchemas: 'Color Scheme' }, SSE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index b1f6637b7..715375197 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2653,6 +2653,7 @@ "SSE.Views.Toolbar.txtTime": "Time", "SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells", "SSE.Views.Toolbar.txtYen": "¥ Yen", + "SSE.Views.Toolbar.capBtnColorSchemas": "Color Scheme", "SSE.Views.Top10FilterDialog.textType": "Show", "SSE.Views.Top10FilterDialog.txtBottom": "Bottom", "SSE.Views.Top10FilterDialog.txtItems": "Item", From ba22351c914ea8e4485d4133f1170bfe77f57577 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Apr 2020 17:31:47 +0300 Subject: [PATCH 02/63] [SSE] Add conditional formatting --- .../main/app/controller/Toolbar.js | 21 ++- .../main/app/view/Toolbar.js | 127 +++++++++++++++++- 2 files changed, 145 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 08cd523a2..6c3580e55 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -382,7 +382,9 @@ define([ button.on('click', _.bind(me.onEditHeaderClick, me)); }); toolbar.btnPrintTitles.on('click', _.bind(this.onPrintTitlesClick, this)); - + if (toolbar.btnCondFormat.rendered) { + toolbar.btnCondFormat.menu.on('item:click', _.bind(this.onCondFormatMenu, this)); + } Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); this.onSetupCopyStyleButton(); @@ -1450,6 +1452,23 @@ define([ } }, + onCondFormatMenu: function(menu, item) { + if (item.value == 'manage') { + var me = this, + props = me.api.asc_getSortProps(); + if (props) { + (new SSE.Views.ConditionalFormaDialog({ + props: props, + api: me.api, + handler: function (result, settings) { + if (me && me.api) { + } + } + })).show(); + } + } + }, + createDelayedElements: function() { var me = this; diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 3664876e4..ce2498f07 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1016,6 +1016,14 @@ define([ }) }); + me.btnCondFormat = new Common.UI.Button({ + id : 'id-toolbar-btn-condformat', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-condformat', + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], + menu : true + }); + me.btnColorSchemas = new Common.UI.Button({ id : 'id-toolbar-btn-colorschemas', cls : 'btn-toolbar x-huge icon-top', @@ -1397,7 +1405,7 @@ define([ 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.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, - me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, + me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnCondFormat, me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, me.btnInsertChart, me.btnColorSchemas, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint, @@ -1603,6 +1611,7 @@ define([ _injectComponent('#slot-img-movefrwd', this.btnImgForward); _injectComponent('#slot-img-movebkwd', this.btnImgBackward); _injectComponent('#slot-btn-scale', this.btnScale); + _injectComponent('#slot-btn-condformat', this.btnCondFormat); this.btnsEditHeader = Common.Utils.injectButtons($host.find('.slot-editheader'), 'tlbtn-editheader-', 'toolbar__icon btn-editheader', this.capBtnInsHeader, [SSE.enumLock.editCell, SSE.enumLock.selRangeEdit, SSE.enumLock.headerLock, SSE.enumLock.lostConnect, SSE.enumLock.coAuth]); Array.prototype.push.apply(this.lockControls, this.btnsEditHeader); @@ -1676,6 +1685,7 @@ define([ _updateHint(this.btnPrintArea, this.tipPrintArea); _updateHint(this.btnPrintTitles, this.tipPrintTitles); _updateHint(this.btnScale, this.tipScale); + _updateHint(this.btnCondFormat, this.tipCondFormat); this.btnsEditHeader.forEach(function (btn) { _updateHint(btn, me.tipEditHeader); }); @@ -1863,6 +1873,102 @@ define([ this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt); } + if (this.btnCondFormat && this.btnCondFormat.rendered) { + this.btnCondFormat.setMenu( new Common.UI.Menu({ + items: [ + { + caption : this.textGreater, + value : Asc.c_oAscCustomAutoFilter.isGreaterThan + }, + { + caption : this.textLess, + value : Asc.c_oAscCustomAutoFilter.isLessThan + }, + { + caption : this.textEqual, + value : Asc.c_oAscCustomAutoFilter.equals + }, + {caption: '--'}, + { + caption : this.textBetween, + value : Asc.c_oAscCustomAutoFilter.between + }, + { + caption : this.textTop10, + value : Asc.c_oAscCustomAutoFilter.top10 + }, + {caption: '--'}, + { + caption : this.textText, + value : Asc.c_oAscCustomAutoFilter.text, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [] + }) + }, + {caption: '--'}, + { + caption : this.textDate, + value : Asc.c_oAscCustomAutoFilter.date, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [] + }) + }, + {caption: '--'}, + { + caption : this.textBlank, + value : Asc.c_oAscCustomAutoFilter.blank + }, + { + caption : this.textDuplicate, + value : Asc.c_oAscCustomAutoFilter.duplicate + }, + {caption: '--'}, + { + caption : this.textDataBars, + value : Asc.c_oAscCustomAutoFilter.bars, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [] + }) + }, + { + caption : this.textColorScales, + value : Asc.c_oAscCustomAutoFilter.scales, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [] + }) + }, + { + caption : this.textIconSets, + value : Asc.c_oAscCustomAutoFilter.icons, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [] + }) + }, + {caption: '--'}, + { + caption : this.textNewRule, + value : 'new' + }, + { + caption : this.textClearRule, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [] + }) + }, + { + caption : this.textManageRule, + value : 'manage' + } + ] + })); + } + if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) this.updateMetricUnit(); }, @@ -2395,6 +2501,23 @@ define([ txtAutosumTip: 'Summation', capBtnPrintTitles: 'Print Titles', tipPrintTitles: 'Print titles', - capBtnColorSchemas: 'Color Scheme' + capBtnColorSchemas: 'Color Scheme', + tipCondFormat: 'Conditional formatting', + textGreater: 'Greater Than', + textLess: 'Less Than', + textEqual: 'Equal To', + textBetween: 'Between', + textTop10: 'Top 10', + textText: 'Text', + textDate: 'Date', + textBlank: 'Blank', + textDuplicate: 'Duplicate', + textDataBars: 'Data Bars', + textColorScales: 'Color Scales', + textIconSets: 'Icon Sets', + textNewRule: 'New Rule', + textClearRule: 'Clear Rules', + textManageRule: 'Manage Rules' + }, SSE.Views.Toolbar || {})); }); \ No newline at end of file From fd4716eb7209541da3f5b68aa490c83625d75f2f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Apr 2020 20:32:48 +0300 Subject: [PATCH 03/63] [SSE] Add rules manager for conditional formatting --- .../main/app/controller/Toolbar.js | 5 +- .../template/FormatRulesManagerDlg.template | 35 ++ .../main/app/view/FormatRulesManagerDlg.js | 381 ++++++++++++++++++ 3 files changed, 419 insertions(+), 2 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/template/FormatRulesManagerDlg.template create mode 100644 apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 6c3580e55..5f943a207 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/FormatRulesManagerDlg' ], function () { 'use strict'; SSE.Controllers.Toolbar = Backbone.Controller.extend(_.extend({ @@ -1457,7 +1458,7 @@ define([ var me = this, props = me.api.asc_getSortProps(); if (props) { - (new SSE.Views.ConditionalFormaDialog({ + (new SSE.Views.FormatRulesManagerDlg({ props: props, api: me.api, handler: function (result, settings) { diff --git a/apps/spreadsheeteditor/main/app/template/FormatRulesManagerDlg.template b/apps/spreadsheeteditor/main/app/template/FormatRulesManagerDlg.template new file mode 100644 index 000000000..184099560 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/template/FormatRulesManagerDlg.template @@ -0,0 +1,35 @@ +
+
+ + + + + + + + + + + + + + +
+ +
+
+ + + +
+
+
+ + +
+
+
+ +
+
+
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js new file mode 100644 index 000000000..ae13825a3 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -0,0 +1,381 @@ +/* + * + * (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 + * + */ +/** + * + * FormatRulesManagerDlg.js + * + * Created by Julia.Radzhabova on 14.04.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/ListView', + 'common/main/lib/component/InputField' +], function (contentTemplate) { + 'use strict'; + + SSE.Views = SSE.Views || {}; + + var _CustomItem = Common.UI.DataViewItem.extend({ + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + me.template = me.options.template || me.template; + + me.listenTo(me.model, 'change:sort', function() { + me.render(); + me.trigger('change', me, me.model); + }); + me.listenTo(me.model, 'change:selected', function() { + var el = me.$el || $(me.el); + el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); + me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); + }); + me.listenTo(me.model, 'remove', me.remove); + } + }); + + SSE.Views.FormatRulesManagerDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + alias: 'FormatRulesManagerDlg', + contentWidth: 510, + height: 361, + buttons: ['ok', 'cancel'] + }, + + initialize: function (options) { + var me = this; + _.extend(this.options, { + title: this.txtTitle, + template: [ + '
', + '
' + _.template(contentTemplate)({scope: this}) + '
', + '
', + '
' + ].join('') + }, options); + + this.api = options.api; + this.handler = options.handler; + this.props = options.props; + this.levels = []; + + this.rulesStore = new Common.UI.DataViewStore(); + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + render: function () { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + this.cmbScope = new Common.UI.ComboBox({ + el : $('#format-manager-combo-scope'), + menuStyle : 'min-width: 100%;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textSelection }, + { value: 1, displayValue: this.textThisSheet }, + { value: 2, displayValue: this.textThisTable } + ] + }).on('selected', function(combo, record) { + me.refreshRuleList(record.value); + }); + this.cmbScope.setValue(0); + + this.rulesList = new Common.UI.ListView({ + el: $('#format-manager-rules-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '
<%= name %>
', + '
', + '
', + '
' + ].join('')) + }); + this.rulesList.createNewItem = function(record) { + return new _CustomItem({ + template: this.itemTemplate, + model: record + }); + }; + this.rulesList.on('item:select', _.bind(this.onSelectRule, this)) + .on('item:keydown', _.bind(this.onKeyDown, this)); + + this.btnNew = new Common.UI.Button({ + el: $('#format-manager-btn-new') + }); + this.btnNew.on('click', _.bind(this.onEditRule, this, false)); + + this.btnEdit = new Common.UI.Button({ + el: $('#format-manager-btn-edit') + }); + this.btnEdit.on('click', _.bind(this.onEditRule, this, true)); + + this.btnDelete = new Common.UI.Button({ + el: $('#format-manager-btn-delete') + }); + this.btnDelete.on('click', _.bind(this.onDeleteRule, this)); + + this.btnUp = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'caret-up', + hint: this.textUp + }); + this.btnUp.render($('#format-manager-btn-up')) ; + this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); + + this.btnDown = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'caret-down', + hint: this.textDown + }); + this.btnDown.render($('#format-manager-btn-down')) ; + this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(this.props); + }, + + _setDefaults: function (props) { + if (props) { + this.rulesList.on('item:add', _.bind(this.addControls, this)); + this.rulesList.on('item:change', _.bind(this.addControls, this)); + this.refreshRuleList(this.cmbScope.getValue()); + } + }, + + refreshRuleList: function(scope) { + // var levels = this.api.asc_getRules(scope); + var levels = [{name: 'some name', range: '=A1', props: {}}, {name: 'equals', range: '=A1', props: {}}]; + var arr = []; + if (levels) { + for (var i=0; i0) && this.rulesList.selectByIndex(0); + + this.updateButtons(); + }, + + addControls: function(listView, itemView, item) { + if (!item) return; + + var me = this, + i = item.get('levelIndex'), + cmpEl = this.rulesList.cmpEl.find('#format-manager-item-' + i); + if (!this.levels[i]) + this.levels[i] = {}; + var level = this.levels[i]; + var input = new Common.UI.InputFieldBtn({ + el : cmpEl.find('#format-manager-txt-rule-' + i), + name : 'range', + style : 'width: 100%;', + btnHint : this.textSelectData, + allowBlank : true, + validateOnChange: true + }).on('button:click', _.bind(this.onSelectData, this, level)); + + var val = item.get('range'); + (val!==null) && input.setValue(val); + level.txtDataRange = input; + level.dataRangeValid = val; + + cmpEl.on('mousedown', 'input', function(){ + me.rulesList.selectRecord(item); + }); + }, + + onSelectData: function(item, cmp) { + var me = this; + if (me.api) { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + item.dataRangeValid = dlg.getSettings(); + item.txtDataRange.setValue(item.dataRangeValid); + item.txtDataRange.checkValidate(); + } + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api, + range : (!_.isEmpty(item.txtDataRange.getValue()) && (item.txtDataRange.checkValidate()==true)) ? item.txtDataRange.getValue() : item.dataRangeValid, + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + }, + + onEditRule: function (isEdit) { + return; + + var me = this, + xy = me.$window.offset(), + rec = this.rangeList.getSelectedRec(), + idx = _.indexOf(this.rangeList.store.models, rec), + oldname = (isEdit && rec) ? new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('isTable'), undefined, undefined, undefined, true) : null; + + var win = new SSE.Views.NamedRangeEditDlg({ + api: me.api, + sheets : this.sheets, + props : (isEdit) ? oldname : this.props, + isEdit : isEdit, + handler : function(result, settings) { + if (result == 'ok' && settings) { + if (isEdit) { + me.currentNamedRange = settings; + me.api.asc_editDefinedNames(oldname, settings); + } else { + me.cmbFilter.setValue(0); + me.currentNamedRange = settings; + me.api.asc_setDefinedNames(settings); + me.updateButtons(); + } + } + } + }).on('close', function() { + me.show(); + _.delay(function () { + me.rangeList.cmpEl.find('.listview').focus(); + }, 100, me); + }); + + me.hide(); + win.show(xy.left + 65, xy.top + 77); + }, + + onDeleteRule: function () { + var store = this.rulesList.store, + rec = this.rulesList.getSelectedRec(); + if (rec) { + var index = rec.get('levelIndex'); + this.levels[index] = undefined; + index = store.indexOf(rec); + store.remove(rec); + (store.length>0) && this.rulesList.selectByIndex(index63); + this.btnDelete.setDisabled(this.rulesList.store.length<1); + this.btnEdit.setDisabled(this.rulesList.store.length<1); + this.updateMoveButtons(); + this.rulesList.scroller && this.rulesList.scroller.update(); + }, + + updateMoveButtons: function() { + var rec = this.rulesList.getSelectedRec(), + index = rec ? this.rulesList.store.indexOf(rec) : -1; + this.btnUp.setDisabled(index<1); + this.btnDown.setDisabled(index<0 || index==this.rulesList.store.length-1); + }, + + getSettings: function() { + return this.sort; + }, + + onKeyDown: function (lisvView, record, e) { + if (e.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) + this.onDeleteRule(); + }, + + txtTitle: 'Conditional Formatting', + textNew: 'New', + textEdit: 'Edit', + textDelete: 'Delete', + textUp: 'Move rule up', + textDown: 'Move rule down', + textSelection: 'Current selection', + textThisSheet: 'This worksheet', + textThisTable: 'This table', + textScope: 'Show formatting rules for', + textRules: 'Rules', + textApply: 'Apply to', + textFormat: 'Format', + textSelectData: 'Select data' + + }, SSE.Views.FormatRulesManagerDlg || {})); +}); \ No newline at end of file From 07cd5d326784305782bbabc23696af25bbe8b5f2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 15 Apr 2020 20:08:56 +0300 Subject: [PATCH 04/63] [SSE] Load conditional formatting settings --- .../main/app/controller/Toolbar.js | 18 ++-- .../main/app/view/FormatRulesManagerDlg.js | 94 +++++++++++++++---- 2 files changed, 81 insertions(+), 31 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 5f943a207..64b9cb194 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1455,18 +1455,14 @@ define([ onCondFormatMenu: function(menu, item) { if (item.value == 'manage') { - var me = this, - props = me.api.asc_getSortProps(); - if (props) { - (new SSE.Views.FormatRulesManagerDlg({ - props: props, - api: me.api, - handler: function (result, settings) { - if (me && me.api) { - } + var me = this; + (new SSE.Views.FormatRulesManagerDlg({ + api: me.api, + handler: function (result, settings) { + if (me && me.api) { } - })).show(); - } + } + })).show(); } }, diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index ae13825a3..bbe122bf1 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -109,14 +109,15 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa editable : false, cls : 'input-group-nr', data : [ - { value: 0, displayValue: this.textSelection }, - { value: 1, displayValue: this.textThisSheet }, - { value: 2, displayValue: this.textThisTable } + { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection }, + { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet }, + { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable }, + { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot } ] }).on('selected', function(combo, record) { me.refreshRuleList(record.value); }); - this.cmbScope.setValue(0); + this.cmbScope.setValue(Asc.c_oAscSelectionForCFType.selection); this.rulesList = new Common.UI.ListView({ el: $('#format-manager-rules-list', this.$window), @@ -179,31 +180,22 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa }, _setDefaults: function (props) { - if (props) { - this.rulesList.on('item:add', _.bind(this.addControls, this)); - this.rulesList.on('item:change', _.bind(this.addControls, this)); - this.refreshRuleList(this.cmbScope.getValue()); - } + this.rulesList.on('item:add', _.bind(this.addControls, this)); + this.rulesList.on('item:change', _.bind(this.addControls, this)); + this.refreshRuleList(this.cmbScope.getValue()); }, refreshRuleList: function(scope) { - // var levels = this.api.asc_getRules(scope); - var levels = [{name: 'some name', range: '=A1', props: {}}, {name: 'equals', range: '=A1', props: {}}]; + var levels = this.api.asc_getCF(scope, (scope==Asc.c_oAscSelectionForCFType.worksheet) ? this.api.asc_getActiveWorksheetIndex() : undefined); var arr = []; if (levels) { for (var i=0; i Date: Thu, 16 Apr 2020 10:58:31 +0300 Subject: [PATCH 05/63] [SSE] Get formatting rules range --- apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index bbe122bf1..a8f0a1415 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -194,7 +194,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa arr.push({ levelIndex: i, name: this.getRuleName(level), - range: '=A1',//level.asc_getRange(), + range: level.asc_getLocation(), props: level }); } @@ -251,7 +251,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa name = 'Not contains text'; break; case Asc.c_oAscCFType.timePeriod: - name = 'Time period'; + name = 'Date'; break; case Asc.c_oAscCFType.top10: name = 'Top 10 values'; From 04a2b32cc1f6d2c46a534ae7f9b77f6ec2e8c2f9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 16 Apr 2020 18:42:54 +0300 Subject: [PATCH 06/63] Change ComboBoxColor component: show displayValue --- apps/common/main/lib/component/ComboBorderSize.js | 7 ++++--- apps/common/main/resources/less/combo-border-size.less | 6 ++++++ apps/spreadsheeteditor/main/app/view/SortDialog.js | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/common/main/lib/component/ComboBorderSize.js b/apps/common/main/lib/component/ComboBorderSize.js index f7c7ef6b4..98c0b7216 100644 --- a/apps/common/main/lib/component/ComboBorderSize.js +++ b/apps/common/main/lib/component/ComboBorderSize.js @@ -271,7 +271,7 @@ define([ Common.UI.ComboBoxColor = Common.UI.ComboBox.extend(_.extend({ template: _.template([ - '
', + '
', '
', '
', '
', @@ -309,12 +309,13 @@ define([ updateFormControl: function(record) { var formcontrol = $(this.el).find('.form-control > div'); + formcontrol[0].innerHTML = record.get('displayValue'); if (record.get('value')!=-1) { - formcontrol[0].innerHTML = ''; formcontrol.css({'background': '#' + record.get('value'), 'margin-top': '0'}); + record.get('displayColor') && formcontrol.css({'color': '#' + record.get('displayColor'), 'text-align': 'center'}); } else { - formcontrol[0].innerHTML = record.get('displayValue'); formcontrol.css({'background': '', 'margin-top': '1px'}); + formcontrol.css({'color': '', 'text-align': ''}); } }, diff --git a/apps/common/main/resources/less/combo-border-size.less b/apps/common/main/resources/less/combo-border-size.less index 51df24ed9..8e9c5c75a 100644 --- a/apps/common/main/resources/less/combo-border-size.less +++ b/apps/common/main/resources/less/combo-border-size.less @@ -44,3 +44,9 @@ } } } + +.combo-color { + .form-control:not(input) { + cursor: pointer; + } +} \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SortDialog.js b/apps/spreadsheeteditor/main/app/view/SortDialog.js index 143dc7a6d..d838eafb4 100644 --- a/apps/spreadsheeteditor/main/app/view/SortDialog.js +++ b/apps/spreadsheeteditor/main/app/view/SortDialog.js @@ -268,7 +268,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template', if (item) color_data.push({ value: Common.Utils.ThemeColor.getHexColor(item.get_r(), item.get_g(), item.get_b()).toLocaleUpperCase(), - displayValue: Common.Utils.ThemeColor.getHexColor(item.get_r(), item.get_g(), item.get_b()).toLocaleUpperCase(), + displayValue: '', color: item }); else @@ -555,7 +555,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template', var value = item ? Common.Utils.ThemeColor.getHexColor(item.get_r(), item.get_g(), item.get_b()).toLocaleUpperCase() : -1, color_data = { value: value, - displayValue: item ? value : ((level.cmbSort.getValue()==Asc.c_oAscSortOptions.ByColorFill) ? me.textNone : me.textAuto), + displayValue: item ? '' : ((level.cmbSort.getValue()==Asc.c_oAscSortOptions.ByColorFill) ? me.textNone : me.textAuto), color: item }; item ? level.color_data.push(color_data) : level.color_data.unshift(color_data); From 77491f30cc7e769e159af5ff4ea76e12035e83ad Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 16 Apr 2020 18:43:16 +0300 Subject: [PATCH 07/63] [SSE] Show rule settings dialog --- .../main/app/view/FormatRulesEditDlg.js | 597 ++++++++++++++++++ .../main/app/view/FormatRulesManagerDlg.js | 23 +- 2 files changed, 602 insertions(+), 18 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js new file mode 100644 index 000000000..258efa9f6 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -0,0 +1,597 @@ +/* + * + * (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 + * +*/ +/** + * + * FormatRulesEditDlg.js + * + * Created by Julia.Radzhabova on 15.04.20 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/InputField' +], function () { + 'use strict'; + + SSE.Views = SSE.Views || {}; + + SSE.Views.FormatRulesEditDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + alias: 'FormatRulesEditDlg', + contentWidth: 480, + height: 350 + }, + + initialize: function (options) { + var me = this; + + _.extend(this.options, { + title: this.txtTitleNew, + template: [ + '
', + '
', + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '
','
', + '
','
', + '
','
', + '
','
', + '
', + '
', + '
', + '
', + '
', + '
' + ].join('') + }, options); + + this.api = options.api; + this.handler = options.handler; + this.isEdit = options.isEdit || false; + this.props = options.props; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + render: function () { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + var rules = [ + { + name: this.textValue, + type: Asc.c_oAscCFType.cellIs, + rules: [ + { name: this.textGreater}, + { name: this.textGreaterEq}, + { name: this.textLess}, + { name: this.textLessEq}, + { name: this.textEqual}, + { name: this.textNotEqual}, + { name: this.textBetween}, + { name: this.textNotBetween} + ] + }, + { + name: this.textRanked, + type: Asc.c_oAscCFType.top10, + rules: [ + { name: this.textTop10}, + { name: this.textTop10Per}, + { name: this.textBottom10}, + { name: this.textBottom10Per} + ] + }, + { + name: 'Average', + type: Asc.c_oAscCFType.aboveAverage, + rules: [ + { name: 'Above'}, + { name: 'Below'}, + { name: 'Equal or above'}, + { name: 'Equal or below'}, + { name: '1 std dev above'}, + { name: '1 std dev below'}, + { name: '2 std dev above'}, + { name: '2 std dev below'}, + { name: '3 std dev above'}, + { name: '3 std dev below'} + ] + }, + { + name: 'Text', + type: Asc.c_oAscCFType.containsText, + rules: [ + { name: 'Contains', type: Asc.c_oAscCFType.containsText }, + { name: 'Does not contain', type: Asc.c_oAscCFType.notContainsText }, + { name: 'Begins with', type: Asc.c_oAscCFType.beginsWith }, + { name: 'Ends with', type: Asc.c_oAscCFType.endsWith } + ] + }, + { + name: 'Date', + type: Asc.c_oAscCFType.timePeriod, + rules: [ + { name: 'Yesterday'}, + { name: 'Today'}, + { name: 'Tomorrow'}, + { name: 'In the last 7 days'}, + { name: 'Last week'}, + { name: 'This week'}, + { name: 'Next week'}, + { name: 'Last month'}, + { name: 'This month'}, + { name: 'Next month'} + ] + }, + { + name: 'Blank/Error', + type: Asc.c_oAscCFType.containsBlanks, + rules: [ + { name: 'Contains blanks', type: Asc.c_oAscCFType.containsBlanks }, + { name: 'Does not contain blanks', type: Asc.c_oAscCFType.notContainsBlanks }, + { name: 'Contains errors', type: Asc.c_oAscCFType.containsErrors }, + { name: 'Does not contain errors', type: Asc.c_oAscCFType.notContainsErrors } + ] + }, + { + name: 'Duplicate/Unique', + type: Asc.c_oAscCFType.duplicateValues, + rules: [ + { name: 'Duplicate', type: Asc.c_oAscCFType.duplicateValues }, + { name: 'Unique', type: Asc.c_oAscCFType.uniqueValues } + ] + }, + { + name: '2 Color scale', + type: Asc.c_oAscCFType.colorScale, + num: 2 + }, + { + name: '3 Color scale', + type: Asc.c_oAscCFType.colorScale, + num: 3 + }, + { + name: 'Data bar', + type: Asc.c_oAscCFType.dataBar + }, + { + name: 'Icon sets', + type: Asc.c_oAscCFType.iconSet + }, + { + name: 'Formula', + type: Asc.c_oAscCFType.expression + } + ]; + var arrrules = [], + cmbData = []; + _.each(rules, function(rule, index){ + var arr = []; + + rule.rules && _.each(rule.rules, function(item, idx){ + arr.push({ + name : item.name, + type : (item.type!==undefined) ? item.type : rule.type, + allowSelected : true, + selected: false + }); + }); + var store = new Backbone.Collection(arr); + arrrules.push({ + name : rule.name, + type : rule.type, + rules : store, + num : rule.num, + index : index + }); + cmbData.push({value: index, displayValue: rule.name}); + }); + this.ruleStore = new Backbone.Collection(arrrules); + + this.txtScope = new Common.UI.InputFieldBtn({ + el : $('#format-rules-edit-txt-scope'), + name : 'range', + style : 'width: 150px;', + allowBlank : true, + btnHint : this.textSelectData, + validateOnChange: false + }); + this.txtScope.on('button:click', _.bind(this.onSelectData, this)); + + this.cmbCategory = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-category'), + style : 'width: 150px;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : cmbData + }).on('selected', function(combo, record) { + me.refreshRules(record.value); + }); + + this.cmbRule = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-rule'), + style : 'width: 150px;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : [] + }); + // this.cmbRule.on('selected', _.bind(this.onRuleSelect, this)); + + this.txtRange1 = new Common.UI.InputFieldBtn({ + el : $('#format-rules-edit-txt-r1'), + name : 'range', + style : 'width: 150px;', + allowBlank : true, + btnHint : this.textSelectData, + validateOnChange: false + }); + this.txtRange1.on('button:click', _.bind(this.onSelectData, this)); + + this.txtRange2 = new Common.UI.InputFieldBtn({ + el : $('#format-rules-edit-txt-r2'), + name : 'range', + style : 'width: 150px;', + allowBlank : true, + btnHint : this.textSelectData, + validateOnChange: false + }); + this.txtRange2.on('button:click', _.bind(this.onSelectData, this)); + + // Format + var color_data = [ + { value: 'ffeb9c', displayValue: 'absdef', color: '#ffeb9c', displayColor: '9c6500' }, + { value: 'ffc7ce', displayValue: 'absdef', color: '#ffc7ce', displayColor: 'b32e35' }, + { value: 'c6efce', displayValue: 'absdef', color: '#c6efce', displayColor: '2e8230' }, + { value: 'ffcc99', displayValue: 'absdef', color: '#ffcc99', displayColor: '56507b' }, + { value: -1, displayValue: this.textCustom, color: null } + ]; + this.cmbFormats = new Common.UI.ComboBoxColor({ + el : $('#format-rules-format-preset'), + editable : false, + style : 'width: 150px;', + menuStyle : 'min-width: 100%;max-height: 211px;', + data : color_data + }).on('selected', function(combo, record) { + // record.color; + }); + this.cmbFormats.setValue(color_data[0].value); + // this.cmbFormats.on('selected', _.bind(this.onFormatsSelect, this)); + + this.btnBold = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-bold', + enableToggle: true, + hint: this.textBold + }); + this.btnBold.render($('#format-rules-bold')) ; + // this.btnBold.on('click', _.bind(this.onBoldClick, this)); + + this.btnItalic = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-italic', + enableToggle: true, + hint: this.textItalic + }); + this.btnItalic.render($('#format-rules-italic')) ; + // this.btnItalic.on('click', _.bind(this.onItalicClick, this)); + + this.btnUnderline = new Common.UI.Button({ + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-underline', + enableToggle: true, + hint: this.textUnderline + }); + this.btnUnderline.render($('#format-rules-underline')) ; + // this.btnUnderline.on('click', _.bind(this.onUnderlineClick, this)); + + this.btnStrikeout = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-strikeout', + enableToggle: true, + hint: this.textStrikeout + }); + this.btnStrikeout.render($('#format-rules-strikeout')) ; + // this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this)); + + this.btnSuperscript = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-superscript', + enableToggle: true, + toggleGroup: 'superscriptFRGroup', + hint: this.textSuperscript + }); + this.btnSuperscript.render($('#format-rules-superscript')) ; + // this.btnSuperscript.on('click', _.bind(this.onSuperscriptClick, this)); + + this.btnSubscript = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-subscript', + enableToggle: true, + toggleGroup: 'superscriptFRGroup', + hint: this.textSubscript + }); + this.btnSubscript.render($('#format-rules-subscript')) ; + // this.btnSubscript.on('click', _.bind(this.onSubscriptClick, this)); + + var initNewColor = function(btn, picker_el) { + if (btn && btn.cmpEl) { + btn.currentColor = '#000000'; + var colorVal = $('
'); + $('button:first-child', btn.cmpEl).append(colorVal); + colorVal.css('background-color', btn.currentColor); + var picker = new Common.UI.ThemeColorPalette({ + el: $(picker_el) + }); + picker.currentColor = btn.currentColor; + } + btn.menu.cmpEl.on('click', picker_el+'-new', _.bind(function() { + picker.addNewColor((typeof(btn.color) == 'object') ? btn.color.color : btn.color); + }, me)); + // picker.on('select', _.bind(me.onColorSelect, me, btn)); + return picker; + }; + + this.btnTextColor = new Common.UI.Button({ + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-fontcolor', + hint : this.textColor, + split : true, + menu : new Common.UI.Menu({ + additionalAlign: this.menuAddAlign, + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnTextColor.render($('#format-rules-fontcolor')); + // this.btnTextColor.on('click', _.bind(this.onTextColor, this)); + this.mnuTextColorPicker = initNewColor(this.btnTextColor, "#format-rules-menu-fontcolor"); + + this.btnFillColor = new Common.UI.Button({ + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-paracolor', + hint : this.fillColor, + split : true, + menu : new Common.UI.Menu({ + additionalAlign: this.menuAddAlign, + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnFillColor.render($('#format-rules-fillcolor')); + // this.btnFillColor.on('click', _.bind(this.onTextColor, this)); + this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor"); + + this.afterRender(); + }, + + afterRender: function() { + this.updateThemeColors(); + + this._setDefaults(this.props); + this.setTitle((this.isEdit) ? this.txtTitleEdit : this.txtTitleNew); + }, + + show: function() { + Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); + }, + + _setDefaults: function (props) { + if (props) { + var type = props.asc_getType(), + ruleType; + var rec = this.ruleStore.findWhere({type: type}); + if (!rec) { + var store = this.ruleStore; + for (var i=0; i0) && this.cmbRule.setValue((type!==undefined) ? type : cmbData[0].value); + } + this.setControls(index); + }, + + setControls: function(index) { + var hasformat = this.$window.find('.hasformat'); + hasformat.toggleClass('hidden', index>=7 && index<=10); + }, + + onSelectData: function(cmp) { + var me = this; + if (me.api) { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + cmp.setValue(dlg.getSettings()); + cmp.checkValidate(); + } + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api, + range : (!_.isEmpty(cmp.getValue()) && (cmp.checkValidate()==true)) ? cmp.getValue() : '', + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + }, + + updateThemeColors: function() { + this.mnuTextColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.mnuFillColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + }, + + getSettings: function() { + return {}; + }, + + onPrimary: function() { + this.onDlgBtnClick('ok'); + return false; + }, + + onDlgBtnClick: function(event) { + var me = this; + var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; + if (state == 'ok') { + // var checkname = this.inputName.checkValidate(), + // checkrange = this.txtDataRange.checkValidate(); + // if (checkname !== true) { + // this.inputName.cmpEl.find('input').focus(); + // this.isInputFirstChange = true; + // return; + // } + // if (checkrange !== true) { + // this.txtDataRange.cmpEl.find('input').focus(); + // return; + // } + this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined); + } + + this.close(); + }, + + txtTitleNew: 'New Formatting Rule', + txtTitleEdit: 'Edit Formatting Rule', + textSelectData: 'Select Data', + textApply: 'Apply to Range', + textRule: 'Rule', + txtEmpty: 'This field is required', + textInvalidRange: 'ERROR! Invalid cells range', + notcriticalErrorTitle: 'Warning', + textFormat: 'Format', + textValue: 'Value is', + textGreater: 'Greater than', + textGreaterEq: 'Greater than or equal to', + textLess: 'Less than', + textLessEq: 'Less than or equal to', + textEqual: 'Equal to', + textNotEqual: 'Not equal to', + textBetween: 'Between', + textNotBetween: 'Not between', + textRanked: 'Ranked', + textTop10: 'Top 10 items', + textTop10Per: 'Top 10%', + textBottom10: 'Bottom 10 items', + textBottom10Per: 'Bottom 10%', + textText: 'Text', + textDate: 'Date', + textBlank: 'Blank', + textDuplicate: 'Duplicate', + textDataBars: 'Data Bars', + textColorScales: 'Color Scales', + textIconSets: 'Icon Sets', + textCustom: 'Custom', + textNewColor: 'Add New Custom Color', + textBold: 'Bold', + textItalic: 'Italic', + textUnderline: 'Underline', + textStrikeout: 'Strikeout', + textSuperscript: 'Superscript', + textSubscript: 'Subscript', + textColor: 'Text color', + fillColor: 'Background color' + + }, SSE.Views.FormatRulesEditDlg || {})); +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index a8f0a1415..998335446 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -43,7 +43,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa 'common/main/lib/view/AdvancedSettingsWindow', 'common/main/lib/component/ComboBox', 'common/main/lib/component/ListView', - 'common/main/lib/component/InputField' + 'common/main/lib/component/InputField', + 'spreadsheeteditor/main/app/view/FormatRulesEditDlg' ], function (contentTemplate) { 'use strict'; @@ -323,37 +324,23 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa }, onEditRule: function (isEdit) { - return; - var me = this, xy = me.$window.offset(), - rec = this.rangeList.getSelectedRec(), - idx = _.indexOf(this.rangeList.store.models, rec), - oldname = (isEdit && rec) ? new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('isTable'), undefined, undefined, undefined, true) : null; + rec = this.rulesList.getSelectedRec(); - var win = new SSE.Views.NamedRangeEditDlg({ + var win = new SSE.Views.FormatRulesEditDlg({ api: me.api, - sheets : this.sheets, - props : (isEdit) ? oldname : this.props, + props : (isEdit && rec) ? rec.get('props') : null, isEdit : isEdit, handler : function(result, settings) { if (result == 'ok' && settings) { if (isEdit) { - me.currentNamedRange = settings; - me.api.asc_editDefinedNames(oldname, settings); } else { - me.cmbFilter.setValue(0); - me.currentNamedRange = settings; - me.api.asc_setDefinedNames(settings); - me.updateButtons(); } } } }).on('close', function() { me.show(); - _.delay(function () { - me.rangeList.cmpEl.find('.listview').focus(); - }, 100, me); }); me.hide(); From 753ff60e2d4b3d3a19ad8a2052ac3ce104d4d034 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 17 Apr 2020 14:16:09 +0300 Subject: [PATCH 08/63] [SSE] Refactoring conditional formatting --- .../main/app/controller/Toolbar.js | 18 ++- .../main/app/view/FormatRulesEditDlg.js | 128 ++++++++++-------- .../main/app/view/Toolbar.js | 63 +++++++-- 3 files changed, 135 insertions(+), 74 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 64b9cb194..bed69994d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -385,6 +385,9 @@ define([ toolbar.btnPrintTitles.on('click', _.bind(this.onPrintTitlesClick, this)); if (toolbar.btnCondFormat.rendered) { toolbar.btnCondFormat.menu.on('item:click', _.bind(this.onCondFormatMenu, this)); + toolbar.btnCondFormat.menu.items[7].menu.on('item:click', _.bind(this.onCondFormatMenu, this)); + toolbar.btnCondFormat.menu.items[9].menu.on('item:click', _.bind(this.onCondFormatMenu, this)); + toolbar.btnCondFormat.menu.items[21].menu.on('item:click', _.bind(this.onCondFormatMenu, this)); } Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); @@ -1454,8 +1457,8 @@ define([ }, onCondFormatMenu: function(menu, item) { + var me = this; if (item.value == 'manage') { - var me = this; (new SSE.Views.FormatRulesManagerDlg({ api: me.api, handler: function (result, settings) { @@ -1463,6 +1466,19 @@ define([ } } })).show(); + } else if (item.value == 'clear') { + } else { + (new SSE.Views.FormatRulesEditDlg({ + api: me.api, + props : null, + type : item.options.type, + subtype : item.value, + isEdit : false, + handler : function(result, settings) { + if (result == 'ok' && settings) { + } + } + })).show(); } }, diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 258efa9f6..64d39d745 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -108,6 +108,8 @@ define([ this.handler = options.handler; this.isEdit = options.isEdit || false; this.props = options.props; + this.type = options.type; // rule category + this.subtype = options.subtype; // rule Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -120,40 +122,38 @@ define([ name: this.textValue, type: Asc.c_oAscCFType.cellIs, rules: [ - { name: this.textGreater}, - { name: this.textGreaterEq}, - { name: this.textLess}, - { name: this.textLessEq}, - { name: this.textEqual}, - { name: this.textNotEqual}, - { name: this.textBetween}, - { name: this.textNotBetween} + { name: this.textGreater, subtype: 0}, + { name: this.textGreaterEq, subtype: 1}, + { name: this.textLess, subtype: 2}, + { name: this.textLessEq, subtype: 3}, + { name: this.textEqual, subtype: 4}, + { name: this.textNotEqual, subtype: 5}, + { name: this.textBetween, subtype: 6}, + { name: this.textNotBetween, subtype: 7} ] }, { name: this.textRanked, type: Asc.c_oAscCFType.top10, rules: [ - { name: this.textTop10}, - { name: this.textTop10Per}, - { name: this.textBottom10}, - { name: this.textBottom10Per} + { name: this.textTop, subtype: 0}, + { name: this.textBottom, subtype: 1} ] }, { name: 'Average', type: Asc.c_oAscCFType.aboveAverage, rules: [ - { name: 'Above'}, - { name: 'Below'}, - { name: 'Equal or above'}, - { name: 'Equal or below'}, - { name: '1 std dev above'}, - { name: '1 std dev below'}, - { name: '2 std dev above'}, - { name: '2 std dev below'}, - { name: '3 std dev above'}, - { name: '3 std dev below'} + { name: 'Above', subtype: 0}, + { name: 'Below', subtype: 1}, + { name: 'Equal or above', subtype: 2}, + { name: 'Equal or below', subtype: 3}, + { name: '1 std dev above', subtype: 4}, + { name: '1 std dev below', subtype: 5}, + { name: '2 std dev above', subtype: 6}, + { name: '2 std dev below', subtype: 7}, + { name: '3 std dev above', subtype: 8}, + { name: '3 std dev below', subtype: 9} ] }, { @@ -170,16 +170,16 @@ define([ name: 'Date', type: Asc.c_oAscCFType.timePeriod, rules: [ - { name: 'Yesterday'}, - { name: 'Today'}, - { name: 'Tomorrow'}, - { name: 'In the last 7 days'}, - { name: 'Last week'}, - { name: 'This week'}, - { name: 'Next week'}, - { name: 'Last month'}, - { name: 'This month'}, - { name: 'Next month'} + { name: 'Yesterday', subtype: 0}, + { name: 'Today', subtype: 1}, + { name: 'Tomorrow', subtype: 2}, + { name: 'In the last 7 days', subtype: 3}, + { name: 'Last week', subtype: 4}, + { name: 'This week', subtype: 5}, + { name: 'Next week', subtype: 6}, + { name: 'Last month', subtype: 7}, + { name: 'This month', subtype: 8}, + { name: 'Next month', subtype: 9} ] }, { @@ -231,7 +231,8 @@ define([ rule.rules && _.each(rule.rules, function(item, idx){ arr.push({ name : item.name, - type : (item.type!==undefined) ? item.type : rule.type, + type : item.type, + subtype : item.subtype, allowSelected : true, selected: false }); @@ -442,32 +443,45 @@ define([ }, _setDefaults: function (props) { - if (props) { - var type = props.asc_getType(), - ruleType; - var rec = this.ruleStore.findWhere({type: type}); - if (!rec) { - var store = this.ruleStore; - for (var i=0; i0) && this.cmbRule.setValue((type!==undefined) ? type : cmbData[0].value); @@ -571,10 +585,8 @@ define([ textBetween: 'Between', textNotBetween: 'Not between', textRanked: 'Ranked', - textTop10: 'Top 10 items', - textTop10Per: 'Top 10%', - textBottom10: 'Bottom 10 items', - textBottom10Per: 'Bottom 10%', + textTop: 'Top', + textBottom: 'Bottom', textText: 'Text', textDate: 'Date', textBlank: 'Blank', diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index ce2498f07..0afe07136 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1878,56 +1878,75 @@ define([ items: [ { caption : this.textGreater, - value : Asc.c_oAscCustomAutoFilter.isGreaterThan + type : Asc.c_oAscCFType.cellIs, + value : 0 }, { caption : this.textLess, - value : Asc.c_oAscCustomAutoFilter.isLessThan + type : Asc.c_oAscCFType.cellIs, + value : 2 }, { caption : this.textEqual, - value : Asc.c_oAscCustomAutoFilter.equals + type : Asc.c_oAscCFType.cellIs, + value : 4 }, {caption: '--'}, { caption : this.textBetween, - value : Asc.c_oAscCustomAutoFilter.between + type : Asc.c_oAscCFType.cellIs, + value : 6 }, { caption : this.textTop10, - value : Asc.c_oAscCustomAutoFilter.top10 + type : Asc.c_oAscCFType.top10, + value : 0 }, {caption: '--'}, { caption : this.textText, - value : Asc.c_oAscCustomAutoFilter.text, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', - items: [] + items: [ + { caption: 'Contains', type: Asc.c_oAscCFType.containsText }, + { caption: 'Does not contain', type: Asc.c_oAscCFType.notContainsText }, + { caption: 'Begins with', type: Asc.c_oAscCFType.beginsWith }, + { caption: 'Ends with', type: Asc.c_oAscCFType.endsWith } + ] }) }, {caption: '--'}, { caption : this.textDate, - value : Asc.c_oAscCustomAutoFilter.date, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', - items: [] + items: [ + { caption: 'Yesterday', type: Asc.c_oAscCFType.timePeriod, value: 0 }, + { caption: 'Today', type: Asc.c_oAscCFType.timePeriod, value: 1}, + { caption: 'Tomorrow', type: Asc.c_oAscCFType.timePeriod, value: 2}, + { caption: 'In the last 7 days', type: Asc.c_oAscCFType.timePeriod, value: 3}, + { caption: 'Last week', type: Asc.c_oAscCFType.timePeriod, value: 4}, + { caption: 'This week', type: Asc.c_oAscCFType.timePeriod, value: 5}, + { caption: 'Next week', type: Asc.c_oAscCFType.timePeriod, value: 6}, + { caption: 'Last month', type: Asc.c_oAscCFType.timePeriod, value: 7}, + { caption: 'This month', type: Asc.c_oAscCFType.timePeriod, value: 8}, + { caption: 'Next month', type: Asc.c_oAscCFType.timePeriod, value: 9} + ] }) }, {caption: '--'}, { caption : this.textBlank, - value : Asc.c_oAscCustomAutoFilter.blank + type : Asc.c_oAscCFType.containsBlanks }, { caption : this.textDuplicate, - value : Asc.c_oAscCustomAutoFilter.duplicate + type : Asc.c_oAscCFType.duplicateValues }, {caption: '--'}, { caption : this.textDataBars, - value : Asc.c_oAscCustomAutoFilter.bars, + type : Asc.c_oAscCFType.dataBar, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', items: [] @@ -1935,7 +1954,7 @@ define([ }, { caption : this.textColorScales, - value : Asc.c_oAscCustomAutoFilter.scales, + type : Asc.c_oAscCFType.colorScale, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', items: [] @@ -1943,13 +1962,18 @@ define([ }, { caption : this.textIconSets, - value : Asc.c_oAscCustomAutoFilter.icons, + type : Asc.c_oAscCFType.iconSet, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', items: [] }) }, {caption: '--'}, + { + caption : 'Formula', + type : Asc.c_oAscCFType.expression + }, + {caption: '--'}, { caption : this.textNewRule, value : 'new' @@ -1958,7 +1982,12 @@ define([ caption : this.textClearRule, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', - items: [] + items: [ + { value: 'clear', type: Asc.c_oAscSelectionForCFType.selection, caption: this.textSelection }, + { value: 'clear', type: Asc.c_oAscSelectionForCFType.worksheet, caption: this.textThisSheet }, + { value: 'clear', type: Asc.c_oAscSelectionForCFType.table, caption: this.textThisTable }, + { value: 'clear', type: Asc.c_oAscSelectionForCFType.pivot, caption: this.textThisPivot } + ] }) }, { @@ -2517,6 +2546,10 @@ define([ textIconSets: 'Icon Sets', textNewRule: 'New Rule', textClearRule: 'Clear Rules', + textSelection: 'From current selection', + textThisSheet: 'From this worksheet', + textThisTable: 'From this table', + textThisPivot: 'From this pivot', textManageRule: 'Manage Rules' }, SSE.Views.Toolbar || {})); From afef3613f3a392d7ec4afd5bfebfbc940dd16c05 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 20 Apr 2020 13:49:38 +0300 Subject: [PATCH 09/63] [SSE] Show rule settings --- .../main/app/view/FormatRulesEditDlg.js | 76 ++++++++++++------- .../main/app/view/Toolbar.js | 28 +++---- 2 files changed, 63 insertions(+), 41 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 64d39d745..2985cf98e 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -122,14 +122,14 @@ define([ name: this.textValue, type: Asc.c_oAscCFType.cellIs, rules: [ - { name: this.textGreater, subtype: 0}, - { name: this.textGreaterEq, subtype: 1}, - { name: this.textLess, subtype: 2}, - { name: this.textLessEq, subtype: 3}, - { name: this.textEqual, subtype: 4}, - { name: this.textNotEqual, subtype: 5}, - { name: this.textBetween, subtype: 6}, - { name: this.textNotBetween, subtype: 7} + { name: this.textGreater, subtype: Asc.c_oAscCFOperator.greaterThan}, + { name: this.textGreaterEq, subtype: Asc.c_oAscCFOperator.greaterThanOrEqual}, + { name: this.textLess, subtype: Asc.c_oAscCFOperator.lessThan}, + { name: this.textLessEq, subtype: Asc.c_oAscCFOperator.lessThanOrEqual}, + { name: this.textEqual, subtype: Asc.c_oAscCFOperator.equal}, + { name: this.textNotEqual, subtype: Asc.c_oAscCFOperator.notEqual}, + { name: this.textBetween, subtype: Asc.c_oAscCFOperator.between}, + { name: this.textNotBetween, subtype: Asc.c_oAscCFOperator.notBetween} ] }, { @@ -170,16 +170,16 @@ define([ name: 'Date', type: Asc.c_oAscCFType.timePeriod, rules: [ - { name: 'Yesterday', subtype: 0}, - { name: 'Today', subtype: 1}, - { name: 'Tomorrow', subtype: 2}, - { name: 'In the last 7 days', subtype: 3}, - { name: 'Last week', subtype: 4}, - { name: 'This week', subtype: 5}, - { name: 'Next week', subtype: 6}, - { name: 'Last month', subtype: 7}, - { name: 'This month', subtype: 8}, - { name: 'Next month', subtype: 9} + { name: 'Yesterday', subtype: Asc.c_oAscTimePeriod.yesterday}, + { name: 'Today', subtype: Asc.c_oAscTimePeriod.today}, + { name: 'Tomorrow', subtype: Asc.c_oAscTimePeriod.tomorrow}, + { name: 'In the last 7 days', subtype: Asc.c_oAscTimePeriod.last7Days}, + { name: 'Last week', subtype: Asc.c_oAscTimePeriod.lastWeek}, + { name: 'This week', subtype: Asc.c_oAscTimePeriod.thisWeek}, + { name: 'Next week', subtype: Asc.c_oAscTimePeriod.nextWeek}, + { name: 'Last month', subtype: Asc.c_oAscTimePeriod.lastMonth}, + { name: 'This month', subtype: Asc.c_oAscTimePeriod.thisMonth}, + { name: 'Next month', subtype: Asc.c_oAscTimePeriod.nextMonth} ] }, { @@ -277,8 +277,9 @@ define([ editable : false, cls : 'input-group-nr', data : [] + }).on('selected', function(combo, record) { + me.setControls(me.cmbCategory.getValue(), record.value); }); - // this.cmbRule.on('selected', _.bind(this.onRuleSelect, this)); this.txtRange1 = new Common.UI.InputFieldBtn({ el : $('#format-rules-edit-txt-r1'), @@ -444,7 +445,27 @@ define([ _setDefaults: function (props) { var type = props ? props.asc_getType() : this.type, - ruleType; + ruleType, + subtype = this.subtype; + + if (props) { + var value; + switch (type) { + case Asc.c_oAscCFType.containsText: + case Asc.c_oAscCFType.notContainsText: + case Asc.c_oAscCFType.beginsWith: + case Asc.c_oAscCFType.endsWith: + value = props.asc_getContainsText(); + this.txtRange1.setValue(value); + break; + case Asc.c_oAscCFType.timePeriod: + subtype = props.asc_getTimePeriod(); + break; + case Asc.c_oAscCFType.cellIs: + subtype = props.asc_getOperator(); + break; + } + } var rec = this.ruleStore.findWhere({type: type}); if (!rec) { @@ -464,8 +485,6 @@ define([ ruleType = type; } else { // find by subtype - // var subtype = (props) ? props.asc_getSubtype() : this.subtype; - var subtype = this.subtype; if ((subtype!==undefined) && rules && rules.findWhere({subtype: subtype})) { ruleType = subtype; } @@ -485,7 +504,7 @@ define([ } }, - refreshRules: function(index, type) { + refreshRules: function(index, ruleType) { var rec = this.ruleStore.findWhere({index: index}); if (rec) { var rules = rec.get('rules'), @@ -494,14 +513,17 @@ define([ cmbData.push({value: (rule.get('type')!==undefined) ? rule.get('type') : rule.get('subtype'), displayValue: rule.get('name')}); }); this.cmbRule.setData(cmbData); - (cmbData.length>0) && this.cmbRule.setValue((type!==undefined) ? type : cmbData[0].value); + (cmbData.length>0) && this.cmbRule.setValue((ruleType!==undefined) ? ruleType : cmbData[0].value); } - this.setControls(index); + this.setControls(index, this.cmbRule.getValue()); }, - setControls: function(index) { + setControls: function(category, rule) { var hasformat = this.$window.find('.hasformat'); - hasformat.toggleClass('hidden', index>=7 && index<=10); + hasformat.toggleClass('hidden', category>=7 && category<=10); + + this.txtRange1.setVisible(category==0 || category==3); + this.txtRange2.setVisible(category==0 && (rule == Asc.c_oAscCFOperator.between || rule == Asc.c_oAscCFOperator.notBetween)); }, onSelectData: function(cmp) { diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 0afe07136..519b1f003 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1879,23 +1879,23 @@ define([ { caption : this.textGreater, type : Asc.c_oAscCFType.cellIs, - value : 0 + value : Asc.c_oAscCFOperator.greaterThan }, { caption : this.textLess, type : Asc.c_oAscCFType.cellIs, - value : 2 + value : Asc.c_oAscCFOperator.lessThan }, { caption : this.textEqual, type : Asc.c_oAscCFType.cellIs, - value : 4 + value : Asc.c_oAscCFOperator.equal }, {caption: '--'}, { caption : this.textBetween, type : Asc.c_oAscCFType.cellIs, - value : 6 + value : Asc.c_oAscCFOperator.between }, { caption : this.textTop10, @@ -1921,16 +1921,16 @@ define([ menu : new Common.UI.Menu({ menuAlign : 'tl-tr', items: [ - { caption: 'Yesterday', type: Asc.c_oAscCFType.timePeriod, value: 0 }, - { caption: 'Today', type: Asc.c_oAscCFType.timePeriod, value: 1}, - { caption: 'Tomorrow', type: Asc.c_oAscCFType.timePeriod, value: 2}, - { caption: 'In the last 7 days', type: Asc.c_oAscCFType.timePeriod, value: 3}, - { caption: 'Last week', type: Asc.c_oAscCFType.timePeriod, value: 4}, - { caption: 'This week', type: Asc.c_oAscCFType.timePeriod, value: 5}, - { caption: 'Next week', type: Asc.c_oAscCFType.timePeriod, value: 6}, - { caption: 'Last month', type: Asc.c_oAscCFType.timePeriod, value: 7}, - { caption: 'This month', type: Asc.c_oAscCFType.timePeriod, value: 8}, - { caption: 'Next month', type: Asc.c_oAscCFType.timePeriod, value: 9} + { caption: 'Yesterday', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.yesterday }, + { caption: 'Today', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.today}, + { caption: 'Tomorrow', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.tomorrow}, + { caption: 'In the last 7 days', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.last7Days}, + { caption: 'Last week', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.lastWeek}, + { caption: 'This week', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.thisWeek}, + { caption: 'Next week', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.nextWeek}, + { caption: 'Last month', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.lastMonth}, + { caption: 'This month', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.thisMonth}, + { caption: 'Next month', type: Asc.c_oAscCFType.timePeriod, value: Asc.c_oAscTimePeriod.nextMonth} ] }) }, From 9695c0b7cea1c72bb33e13912f4dd8baff5cde1d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 20 Apr 2020 15:39:40 +0300 Subject: [PATCH 10/63] Fix InputFieldBtn component --- apps/common/main/resources/less/input.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/common/main/resources/less/input.less b/apps/common/main/resources/less/input.less index 1500060e1..006d637f9 100644 --- a/apps/common/main/resources/less/input.less +++ b/apps/common/main/resources/less/input.less @@ -108,4 +108,8 @@ textarea.form-control:focus { right: 22px; } } + + input { + padding-right: 20px; + } } \ No newline at end of file From 943a3b3429161086d20640bbd2807d64813a1b11 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 20 Apr 2020 15:40:16 +0300 Subject: [PATCH 11/63] [SSE] Show rule settings --- .../main/app/view/FormatRulesEditDlg.js | 67 ++++++++++++++++++- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 2985cf98e..8a0e292bf 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -82,6 +82,8 @@ define([ '
', '
', '
', + '
', + '
', '', '', '', @@ -301,6 +303,38 @@ define([ }); this.txtRange2.on('button:click', _.bind(this.onSelectData, this)); + // top 10 + this.cmbPercent = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-percent'), + style : 'width: 100px;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : [ + {value: 0, displayValue: 'Item'}, + {value: 1, displayValue: 'Percent'} + ] + }).on('selected', function(combo, record) { + var percent = !!record.value; + me.numRank.setMaxValue(percent ? 100 : 1000); + me.numRank.setValue(me.numRank.getNumberValue()); + }); + this.cmbPercent.setValue(0); + + this.numRank = new Common.UI.MetricSpinner({ + el: $('#format-rules-edit-spin-rank'), + step: 1, + width: 100, + defaultUnit : "", + defaultValue : 10, + allowDecimal: false, + value: '10', + maxValue: 1000, + minValue: 1 + }); + this.numRank.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + }, this)); + // Format var color_data = [ { value: 'ffeb9c', displayValue: 'absdef', color: '#ffeb9c', displayColor: '9c6500' }, @@ -456,13 +490,35 @@ define([ case Asc.c_oAscCFType.beginsWith: case Asc.c_oAscCFType.endsWith: value = props.asc_getContainsText(); - this.txtRange1.setValue(value); + this.txtRange1.setValue(value || ''); break; case Asc.c_oAscCFType.timePeriod: subtype = props.asc_getTimePeriod(); break; + case Asc.c_oAscCFType.aboveAverage: + var above = props.asc_getAboveAverage(), + eq = props.asc_getEqualAverage(), + stddev = props.asc_getStdDev(); + subtype = (above) ? 0 : 1; + if (eq) + subtype += 2; + else if (stddev) { + subtype += (3 + stddev); + } + break; + case Asc.c_oAscCFType.top10: + subtype = props.asc_getBottom() ? 1 : 0; + this.cmbPercent.setValue(props.asc_getPercent() ? 1 : 0); + this.numRank.setValue(props.asc_getRank() ? props.asc_getRank() : 10); + break; case Asc.c_oAscCFType.cellIs: subtype = props.asc_getOperator(); + this.txtRange1.setValue(props.asc_getValue1() || ''); + this.txtRange2.setValue(props.asc_getValue2() || ''); + break; + case Asc.c_oAscCFType.expression: + subtype = props.asc_getOperator(); + this.txtRange1.setValue(props.asc_getValue1() || ''); break; } } @@ -522,8 +578,15 @@ define([ var hasformat = this.$window.find('.hasformat'); hasformat.toggleClass('hidden', category>=7 && category<=10); - this.txtRange1.setVisible(category==0 || category==3); + this.cmbRule.setVisible(category<7); + + this.txtRange1.setVisible(category==0 || category==3 || category==11); this.txtRange2.setVisible(category==0 && (rule == Asc.c_oAscCFOperator.between || rule == Asc.c_oAscCFOperator.notBetween)); + + this.cmbPercent.setVisible(category==1); + this.numRank.setVisible(category==1); + + this.txtRange1.cmpEl.width(category==11 ? 305 : 150); }, onSelectData: function(cmp) { From c36f3a35cdbafefaf143f0187f2f7e74efc362cf Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 24 Apr 2020 14:19:22 +0300 Subject: [PATCH 12/63] [SSE] Show setting for scale rules --- .../main/app/view/FormatRulesEditDlg.js | 151 +++++++++++++++++- 1 file changed, 148 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 8a0e292bf..7be8f519a 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -98,6 +98,28 @@ define([ '
', '', '', + '', + '', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '', + '', '', '
', '
', @@ -463,6 +485,58 @@ define([ // this.btnFillColor.on('click', _.bind(this.onTextColor, this)); this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor"); + // Scale + this.scaleControls = []; + this.lblMidScale = this.$window.find('#format-rules-edit-lbl-scale-2'); + + var data = [ + {value: Asc.c_oAscCfvoType.Number, displayValue: 'Number'}, + {value: Asc.c_oAscCfvoType.Percent, displayValue: 'Percentage'}, + {value: Asc.c_oAscCfvoType.Formula, displayValue: 'Formula'}, + {value: Asc.c_oAscCfvoType.Percentile, displayValue: 'Percentile'} + ]; + for (var i=0; i<3; i++) { + var arr = data; + if (i==0) + arr = [{value: Asc.c_oAscCfvoType.Minimum, displayValue: 'Minimum'}].concat(arr); + else if (i==2) + arr = [{value: Asc.c_oAscCfvoType.Maximum, displayValue: 'Maximum'}].concat(arr); + var combo = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-scale-' + (i+1)), + style : 'width: 100%;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : arr, + type : i + }).on('selected', function(combo, record) { + me.scaleControls[combo.options.type].range.setDisabled(record.value==Asc.c_oAscCfvoType.Minimum || record.value==Asc.c_oAscCfvoType.Maximum); + }); + combo.setValue((i==1) ? Asc.c_oAscCfvoType.Percentile : arr[0].value); + + var range = new Common.UI.InputFieldBtn({ + el : $('#format-rules-edit-txt-scale-' + (i+1)), + name : 'range', + style : 'width: 100%;', + allowBlank : true, + btnHint : this.textSelectData, + validateOnChange: false, + type : i, + disabled : (i!=1) + }); + range.setValue((i==1) ? 50 : ''); + range.on('button:click', _.bind(this.onSelectData, this)); + + var color = new Common.UI.ColorButton({ + style: "width:45px;", + menu : true, + type : i + }); + color.render( $('#format-rules-edit-color-scale-' + (i+1))); + color.setColor('000000'); + this.scaleControls.push({combo: combo, range: range, color: color}); + } + this.afterRender(); }, @@ -520,11 +594,51 @@ define([ subtype = props.asc_getOperator(); this.txtRange1.setValue(props.asc_getValue1() || ''); break; + case Asc.c_oAscCFType.colorScale: + value = props.asc_getColorScaleOrDataBarOrIconSetRule(); + var scales = value.asc_getCFVOs(), + colors = value.asc_getColors(); + subtype = scales.length; + var arr = (scales.length==2) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; + for (var i=0; i1) { + if (type == Asc.c_oAscCFType.colorScale) { + rec = (subtype == rec[0].get('num')) ? rec[0] : rec[1]; + } + } else if (rec.length==0) { var store = this.ruleStore; for (var i=0; i8); + if (category==7 || category==8) { + this.scaleControls[1].combo.setVisible(category==8); + this.scaleControls[1].range.setVisible(category==8); + this.scaleControls[1].color.setVisible(category==8); + this.lblMidScale.toggleClass('hidden', category==7); + } }, onSelectData: function(cmp) { @@ -617,6 +740,25 @@ define([ }, updateThemeColors: function() { + for (var i=0; i
') }, + { template: _.template('' + this.textNewColor + '') } + ] + })); + var colorPicker = new Common.UI.ThemeColorPalette({ + el: this.$window.find('#' + id), + transparent: false, + type: i + }); + // colorPicker.on('select', _.bind(this.onColorsSelect, this)); + colorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // btn.items[1].on('click', _.bind(this.addNewColor, this, colorPicker, btn)); + this.scaleControls[i].colorPicker = colorPicker; + } this.mnuTextColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.mnuFillColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, @@ -688,7 +830,10 @@ define([ textSuperscript: 'Superscript', textSubscript: 'Subscript', textColor: 'Text color', - fillColor: 'Background color' + fillColor: 'Background color', + textMinpoint: 'Minpoint', + textMidpoint: 'Midpoint', + textMaxpoint: 'Maxpoint' }, SSE.Views.FormatRulesEditDlg || {})); }); \ No newline at end of file From a4e93cefd8cdfac643fe1fe6db13bf0377895f42 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 27 Apr 2020 22:17:43 +0300 Subject: [PATCH 13/63] [SSE] Show data bar rule settings --- .../main/app/view/FormatRulesEditDlg.js | 364 ++++++++++++++++-- .../main/app/view/FormatRulesManagerDlg.js | 2 +- 2 files changed, 333 insertions(+), 33 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 7be8f519a..6f4f22643 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -51,8 +51,8 @@ define([ SSE.Views.FormatRulesEditDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { alias: 'FormatRulesEditDlg', - contentWidth: 480, - height: 350 + contentWidth: 490, + height: 445 }, initialize: function (options) { @@ -65,24 +65,24 @@ define([ '
', '
', '', - '', - '', - '', '', '', '', '', '', '', @@ -100,13 +100,13 @@ define([ '', '', '', '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', '
', - '', - '
', - '
', - '', - '
', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', '
', - '
', - '
', + '
', + '
', '
', - '
', + '
', '
', '
', - '
', + '
', '', '
', '
', '
', '
', - '
', + '
', '', '
', '
', @@ -120,6 +120,72 @@ define([ '
', '
', + '
', + '', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '', + '
', + '', + '
', + '
', + '
', '
', '
', @@ -498,9 +564,9 @@ define([ for (var i=0; i<3; i++) { var arr = data; if (i==0) - arr = [{value: Asc.c_oAscCfvoType.Minimum, displayValue: 'Minimum'}].concat(arr); + arr = [{value: Asc.c_oAscCfvoType.Minimum, displayValue: this.textMinimum}].concat(arr); else if (i==2) - arr = [{value: Asc.c_oAscCfvoType.Maximum, displayValue: 'Maximum'}].concat(arr); + arr = [{value: Asc.c_oAscCfvoType.Maximum, displayValue: this.textMaximum}].concat(arr); var combo = new Common.UI.ComboBox({ el : $('#format-rules-edit-combo-scale-' + (i+1)), style : 'width: 100%;', @@ -537,6 +603,168 @@ define([ this.scaleControls.push({combo: combo, range: range, color: color}); } + // Data Bar + this.barControls = []; + + for (var i=0; i<2; i++) { + var arr = data; + if (i==0) { + arr = [{value: Asc.c_oAscCfvoType.Minimum, displayValue: this.textMinimum}].concat(arr); + arr.push({value: Asc.c_oAscCfvoType.AutoMin, displayValue: 'Automatic'}); + } else { + arr = [{value: Asc.c_oAscCfvoType.Maximum, displayValue: this.textMaximum}].concat(arr); + arr.push({value: Asc.c_oAscCfvoType.AutoMax, displayValue: 'Automatic'}); + } + var combo = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-bar-' + (i+1)), + style : 'width: 100%;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : arr, + type : i + }).on('selected', function(combo, record) { + me.barControls[combo.options.type].range.setDisabled(record.value==Asc.c_oAscCfvoType.Minimum || record.value==Asc.c_oAscCfvoType.Maximum || + record.value==Asc.c_oAscCfvoType.AutoMin || record.value==Asc.c_oAscCfvoType.AutoMax); + }); + combo.setValue(arr[1].value); + + var range = new Common.UI.InputFieldBtn({ + el : $('#format-rules-edit-txt-bar-' + (i+1)), + name : 'range', + style : 'width: 100%;', + allowBlank : true, + btnHint : this.textSelectData, + validateOnChange: false, + type : i + }); + range.setValue(''); + range.on('button:click', _.bind(this.onSelectData, this)); + this.barControls.push({combo: combo, range: range}); + } + + // Fill + this.cmbFill = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-fill'), + style : 'width: 100%;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : [ + {value: false, displayValue: 'Solid'}, + {value: true, displayValue: 'Gradient'} + ] + }).on('selected', function(combo, record) { + }); + this.cmbFill.setValue(false); + + this.btnPosFill = new Common.UI.ColorButton({ + style: "width:45px;", + menu : true + }); + this.btnPosFill.render( $('#format-rules-edit-color-pos-fill')); + this.btnPosFill.setColor('000000'); + + this.btnNegFill = new Common.UI.ColorButton({ + style: "width:45px;", + menu : true + }); + this.btnNegFill.render( $('#format-rules-edit-color-neg-fill')); + this.btnNegFill.setColor('000000'); + + this.chFill = new Common.UI.CheckBox({ + el: $('#format-rules-edit-chk-fill'), + labelText: 'Same as positive' + }); + this.chFill.on('change', function(field, newValue, oldValue, eOpts){ + me.btnNegFill.setDisabled(field.getValue()=='checked'); + }); + + // Border + this.cmbBorder = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-border'), + style : 'width: 100%;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : [ + {value: false, displayValue: 'Solid'}, + {value: true, displayValue: 'None'} + ] + }).on('selected', function(combo, record) { + me.btnPosBorder.setDisabled(record.value); + me.btnNegBorder.setDisabled(record.value || me.chBorder.getValue()=='checked'); + me.chBorder.setDisabled(record.value); + }); + this.cmbBorder.setValue(false); + + this.btnPosBorder = new Common.UI.ColorButton({ + style: "width:45px;", + menu : true + }); + this.btnPosBorder.render( $('#format-rules-edit-color-pos-border')); + this.btnPosBorder.setColor('000000'); + + this.btnNegBorder = new Common.UI.ColorButton({ + style: "width:45px;", + menu : true + }); + this.btnNegBorder.render( $('#format-rules-edit-color-neg-border')); + this.btnNegBorder.setColor('000000'); + + this.chBorder = new Common.UI.CheckBox({ + el: $('#format-rules-edit-chk-border'), + labelText: 'Same as positive' + }); + this.chBorder.on('change', function(field, newValue, oldValue, eOpts){ + me.btnNegBorder.setDisabled(field.getValue()=='checked'); + }); + + // Axis + this.cmbBarDirection = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-direction'), + style : 'width: 100%;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : [ + {value: Asc.c_oAscDataBarDirection.context, displayValue: 'Context'}, + {value: Asc.c_oAscDataBarDirection.leftToRight, displayValue: 'Left to right'}, + {value: Asc.c_oAscDataBarDirection.rightToLeft, displayValue: 'Right to left'} + ] + }).on('selected', function(combo, record) { + }); + this.cmbBarDirection.setValue(Asc.c_oAscDataBarDirection.context); + + this.chShowBar = new Common.UI.CheckBox({ + el: $('#format-rules-edit-chk-show-bar'), + labelText: 'Show bar only' + }); + // this.chShowBar.on('change', _.bind(this.onShowBarChange, this)); + + this.cmbAxisPos = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-axis-pos'), + style : 'width: 150px;', + menuStyle : 'min-width: 100%;max-height: 211px;', + editable : false, + cls : 'input-group-nr', + data : [ + {value: Asc.c_oAscDataBarAxisPosition.automatic, displayValue: 'Automatic'}, + {value: Asc.c_oAscDataBarAxisPosition.middle, displayValue: 'Cell midpoint'}, + {value: Asc.c_oAscDataBarAxisPosition.none, displayValue: 'None'} + ] + }).on('selected', function(combo, record) { + me.btnAxisColor.setDisabled(record.value == Asc.c_oAscDataBarAxisPosition.none); + }); + this.cmbAxisPos.setValue(Asc.c_oAscDataBarDirection.context); + + this.btnAxisColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : true + }); + this.btnAxisColor.render( $('#format-rules-edit-color-axis-color')); + this.btnAxisColor.setColor('000000'); + this.afterRender(); }, @@ -556,6 +784,24 @@ define([ ruleType, subtype = this.subtype; + var setColor = function(color, control) { + color = Common.Utils.ThemeColor.colorValue2EffectId(color); + control.setColor(color); + if (_.isObject(color)) { + var isselected = false; + for (var j = 0; j < 10; j++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue) { + control.colorPicker.select(color, true); + isselected = true; + break; + } + } + if (!isselected) control.colorPicker.clearSelection(); + } else { + control.colorPicker.select(color, true); + } + }; + if (props) { var value; switch (type) { @@ -608,24 +854,43 @@ define([ controls.combo.setValue(scaletype); controls.range.setDisabled(scaletype == Asc.c_oAscCfvoType.Minimum || scaletype == Asc.c_oAscCfvoType.Maximum); controls.range.setValue((scaletype !== Asc.c_oAscCfvoType.Minimum && scaletype !== Asc.c_oAscCfvoType.Maximum && val!==null && val!==undefined) ? val : ''); - controls.color.setColor(color); - if (_.isObject(color)) { - var isselected = false; - for (var j = 0; j < 10; j++) { - if (Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue) { - controls.colorPicker.select(color, true); - isselected = true; - break; - } - } - if (!isselected) controls.colorPicker.clearSelection(); - } else { - controls.colorPicker.select(color, true); - } + setColor(color, controls.color); } break; case Asc.c_oAscCFType.dataBar: value = props.asc_getColorScaleOrDataBarOrIconSetRule(); + var bars = value.asc_getCFVOs(); + var arr = this.barControls; + for (var i=0; i') }, + { template: _.template('' + me.textNewColor + '') } + ] + })); + var colorPicker = new Common.UI.ThemeColorPalette({ + el: me.$window.find('#' + id), + transparent: false, + type: i + }); + colorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // btn.items[1].on('click', _.bind(this.addNewColor, this, colorPicker, btn)); + btn.colorPicker = colorPicker; + }; + initColor(this.btnPosFill); + // this.btnPosFill.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + initColor(this.btnNegFill); + // this.btnNegFill.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + initColor(this.btnPosBorder); + // this.btnPosBorder.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + initColor(this.btnNegBorder); + // this.btnNegBorder.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + initColor(this.btnAxisColor); + // this.btnAxisColor.colorPicker.on('select', _.bind(this.onAxisColorsSelect, this)); + this.mnuTextColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.mnuFillColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, @@ -833,7 +1130,10 @@ define([ fillColor: 'Background color', textMinpoint: 'Minpoint', textMidpoint: 'Midpoint', - textMaxpoint: 'Maxpoint' + textMaxpoint: 'Maxpoint', + textMinimum: 'Minimum', + textMaximum: 'Maximum', + textAppearance: 'Bar Appearance' }, SSE.Views.FormatRulesEditDlg || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 998335446..18282658c 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -344,7 +344,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa }); me.hide(); - win.show(xy.left + 65, xy.top + 77); + win.show(); }, onDeleteRule: function () { From ab2ff6f06ff34f0602aec5e5616a71dbb3579af0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 28 Apr 2020 15:42:19 +0300 Subject: [PATCH 14/63] [SSE] Fix rule descriptions --- .../main/app/view/FormatRulesEditDlg.js | 7 +- .../main/app/view/FormatRulesManagerDlg.js | 144 +++++++++++++++--- 2 files changed, 130 insertions(+), 21 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 6f4f22643..3b6671067 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -236,8 +236,8 @@ define([ rules: [ { name: 'Above', subtype: 0}, { name: 'Below', subtype: 1}, - { name: 'Equal or above', subtype: 2}, - { name: 'Equal or below', subtype: 3}, + { name: 'Equal to or above', subtype: 2}, + { name: 'Equal to or below', subtype: 3}, { name: '1 std dev above', subtype: 4}, { name: '1 std dev below', subtype: 5}, { name: '2 std dev above', subtype: 6}, @@ -823,7 +823,7 @@ define([ if (eq) subtype += 2; else if (stddev) { - subtype += (3 + stddev); + subtype += (2 + stddev*2); } break; case Asc.c_oAscCFType.top10: @@ -837,7 +837,6 @@ define([ this.txtRange2.setValue(props.asc_getValue2() || ''); break; case Asc.c_oAscCFType.expression: - subtype = props.asc_getOperator(); this.txtRange1.setValue(props.asc_getValue1() || ''); break; case Asc.c_oAscCFType.colorScale: diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 18282658c..73d4f0e45 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -191,10 +191,12 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa var arr = []; if (levels) { for (var i=0; i Date: Tue, 28 Apr 2020 15:49:34 +0300 Subject: [PATCH 15/63] [SSE] Rule settings: hide source range --- .../main/app/view/FormatRulesEditDlg.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 3b6671067..e1e421162 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -71,10 +71,10 @@ define([ '', '
', '', - '
', - '', - '
', - '
', + // '
', + // '', + // '
', + // '
', '', '', '', @@ -339,15 +339,15 @@ define([ }); this.ruleStore = new Backbone.Collection(arrrules); - this.txtScope = new Common.UI.InputFieldBtn({ - el : $('#format-rules-edit-txt-scope'), - name : 'range', - style : 'width: 150px;', - allowBlank : true, - btnHint : this.textSelectData, - validateOnChange: false - }); - this.txtScope.on('button:click', _.bind(this.onSelectData, this)); + // this.txtScope = new Common.UI.InputFieldBtn({ + // el : $('#format-rules-edit-txt-scope'), + // name : 'range', + // style : 'width: 150px;', + // allowBlank : true, + // btnHint : this.textSelectData, + // validateOnChange: false + // }); + // this.txtScope.on('button:click', _.bind(this.onSelectData, this)); this.cmbCategory = new Common.UI.ComboBox({ el : $('#format-rules-edit-combo-category'), @@ -933,8 +933,8 @@ define([ } if (props) { - var val = props.asc_getLocation(); - this.txtScope.setValue((val) ? val : ''); + // var val = props.asc_getLocation(); + // this.txtScope.setValue((val) ? val : ''); } else { } }, From e8e8520f986a6736461858545cf2ad88d356d7de Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 30 Apr 2020 16:58:45 +0300 Subject: [PATCH 16/63] [SSE] Debug rule settings --- apps/common/main/lib/util/utils.js | 2 +- .../main/app/view/FormatRulesEditDlg.js | 103 +++++++----------- .../main/app/view/FormatRulesManagerDlg.js | 4 +- 3 files changed, 43 insertions(+), 66 deletions(-) diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 39bbf45a9..99ce4f5c1 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -290,7 +290,7 @@ Common.Utils.ThemeColor = new(function() { }, colorValue2EffectId: function(clr){ - if (typeof(clr) == 'object' && clr.effectValue !== undefined && this.effectcolors) { + if (typeof(clr) == 'object' && clr && clr.effectValue !== undefined && this.effectcolors) { for (var i = 0; i < this.effectcolors.length; i++) { if (this.effectcolors[i].effectValue===clr.effectValue && clr.color.toUpperCase()===this.effectcolors[i].color.toUpperCase()) { clr.effectId = this.effectcolors[i].effectId; diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index e1e421162..0b7906082 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -444,59 +444,59 @@ define([ // this.cmbFormats.on('selected', _.bind(this.onFormatsSelect, this)); this.btnBold = new Common.UI.Button({ + parentEl: $('#format-rules-bold'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-bold', enableToggle: true, hint: this.textBold }); - this.btnBold.render($('#format-rules-bold')) ; // this.btnBold.on('click', _.bind(this.onBoldClick, this)); this.btnItalic = new Common.UI.Button({ + parentEl: $('#format-rules-italic'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-italic', enableToggle: true, hint: this.textItalic }); - this.btnItalic.render($('#format-rules-italic')) ; // this.btnItalic.on('click', _.bind(this.onItalicClick, this)); this.btnUnderline = new Common.UI.Button({ + parentEl: $('#format-rules-underline'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-underline', enableToggle: true, hint: this.textUnderline }); - this.btnUnderline.render($('#format-rules-underline')) ; // this.btnUnderline.on('click', _.bind(this.onUnderlineClick, this)); this.btnStrikeout = new Common.UI.Button({ + parentEl: $('#format-rules-strikeout'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-strikeout', enableToggle: true, hint: this.textStrikeout }); - this.btnStrikeout.render($('#format-rules-strikeout')) ; // this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this)); this.btnSuperscript = new Common.UI.Button({ + parentEl: $('#format-rules-superscript'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-superscript', enableToggle: true, toggleGroup: 'superscriptFRGroup', hint: this.textSuperscript }); - this.btnSuperscript.render($('#format-rules-superscript')) ; // this.btnSuperscript.on('click', _.bind(this.onSuperscriptClick, this)); this.btnSubscript = new Common.UI.Button({ + parentEl: $('#format-rules-subscript'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-subscript', enableToggle: true, toggleGroup: 'superscriptFRGroup', hint: this.textSubscript }); - this.btnSubscript.render($('#format-rules-subscript')) ; // this.btnSubscript.on('click', _.bind(this.onSubscriptClick, this)); var initNewColor = function(btn, picker_el) { @@ -518,6 +518,7 @@ define([ }; this.btnTextColor = new Common.UI.Button({ + parentEl: $('#format-rules-fontcolor'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-fontcolor', hint : this.textColor, @@ -530,11 +531,11 @@ define([ ] }) }); - this.btnTextColor.render($('#format-rules-fontcolor')); // this.btnTextColor.on('click', _.bind(this.onTextColor, this)); this.mnuTextColorPicker = initNewColor(this.btnTextColor, "#format-rules-menu-fontcolor"); this.btnFillColor = new Common.UI.Button({ + parentEl: $('#format-rules-fillcolor'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-paracolor', hint : this.fillColor, @@ -547,7 +548,6 @@ define([ ] }) }); - this.btnFillColor.render($('#format-rules-fillcolor')); // this.btnFillColor.on('click', _.bind(this.onTextColor, this)); this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor"); @@ -594,12 +594,11 @@ define([ range.on('button:click', _.bind(this.onSelectData, this)); var color = new Common.UI.ColorButton({ - style: "width:45px;", + parentEl: $('#format-rules-edit-color-scale-' + (i+1)), menu : true, - type : i + type : i, + color : '000000' }); - color.render( $('#format-rules-edit-color-scale-' + (i+1))); - color.setColor('000000'); this.scaleControls.push({combo: combo, range: range, color: color}); } @@ -659,18 +658,18 @@ define([ this.cmbFill.setValue(false); this.btnPosFill = new Common.UI.ColorButton({ + parentEl: $('#format-rules-edit-color-pos-fill'), style: "width:45px;", - menu : true + menu : true, + color : '000000' }); - this.btnPosFill.render( $('#format-rules-edit-color-pos-fill')); - this.btnPosFill.setColor('000000'); this.btnNegFill = new Common.UI.ColorButton({ + parentEl: $('#format-rules-edit-color-neg-fill'), style: "width:45px;", - menu : true + menu : true, + color : '000000' }); - this.btnNegFill.render( $('#format-rules-edit-color-neg-fill')); - this.btnNegFill.setColor('000000'); this.chFill = new Common.UI.CheckBox({ el: $('#format-rules-edit-chk-fill'), @@ -699,18 +698,18 @@ define([ this.cmbBorder.setValue(false); this.btnPosBorder = new Common.UI.ColorButton({ + parentEl: $('#format-rules-edit-color-pos-border'), style: "width:45px;", - menu : true + menu : true, + color : '000000' }); - this.btnPosBorder.render( $('#format-rules-edit-color-pos-border')); - this.btnPosBorder.setColor('000000'); this.btnNegBorder = new Common.UI.ColorButton({ + parentEl: $('#format-rules-edit-color-neg-border'), style: "width:45px;", - menu : true + menu : true, + color : '000000' }); - this.btnNegBorder.render( $('#format-rules-edit-color-neg-border')); - this.btnNegBorder.setColor('000000'); this.chBorder = new Common.UI.CheckBox({ el: $('#format-rules-edit-chk-border'), @@ -759,11 +758,11 @@ define([ this.cmbAxisPos.setValue(Asc.c_oAscDataBarDirection.context); this.btnAxisColor = new Common.UI.ColorButton({ + parentEl: $('#format-rules-edit-color-axis-color'), style: "width:45px;", - menu : true + menu : true, + color : '000000' }); - this.btnAxisColor.render( $('#format-rules-edit-color-axis-color')); - this.btnAxisColor.setColor('000000'); this.afterRender(); }, @@ -879,7 +878,7 @@ define([ this.btnPosBorder.setDisabled(color===null); if (color) { setColor(value.asc_getBorderColor(), this.btnPosBorder); - setColor(value.asc_getNegativeBorderColor(), this.btnNegBorder); + setColor(value.asc_getNegativeBorderColor() || value.asc_getBorderColor(), this.btnNegBorder); } this.chBorder.setValue(value.asc_getNegativeBarBorderColorSameAsPositive()); this.chBorder.setDisabled(color===null); @@ -888,7 +887,7 @@ define([ this.cmbBarDirection.setValue(value.asc_getDirection()); this.chShowBar.setValue(!value.asc_getShowValue()); this.cmbAxisPos.setValue(value.asc_getAxisPosition()); - setColor(value.asc_getAxisColor(), this.btnAxisColor); + value.asc_getAxisColor() && setColor(value.asc_getAxisColor(), this.btnAxisColor); this.btnAxisColor.setDisabled(value.asc_getAxisPosition() == Asc.c_oAscDataBarAxisPosition.none); break; case Asc.c_oAscCFType.iconSet: @@ -1007,53 +1006,32 @@ define([ updateThemeColors: function() { for (var i=0; i') }, - { template: _.template('' + this.textNewColor + '') } - ] - })); - var colorPicker = new Common.UI.ThemeColorPalette({ - el: this.$window.find('#' + id), - transparent: false, - type: i - }); - // colorPicker.on('select', _.bind(this.onColorsSelect, this)); + var btn = this.scaleControls[i].color; + btn.setMenu(); + var colorPicker = btn.getPicker(); + colorPicker.options.type = i; colorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - // btn.items[1].on('click', _.bind(this.addNewColor, this, colorPicker, btn)); this.scaleControls[i].colorPicker = colorPicker; + // btn.on('color:select', _.bind(this.onColorsSelect, this)); } var me = this; var initColor = function(btn) { - var id = Common.UI.getId(); - btn.setMenu( new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - })); - var colorPicker = new Common.UI.ThemeColorPalette({ - el: me.$window.find('#' + id), - transparent: false, - type: i - }); + btn.setMenu(); + var colorPicker = btn.getPicker(); colorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - // btn.items[1].on('click', _.bind(this.addNewColor, this, colorPicker, btn)); btn.colorPicker = colorPicker; }; initColor(this.btnPosFill); - // this.btnPosFill.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + // this.btnPosFill.on('color:select', _.bind(this.onBarColorsSelect, this)); initColor(this.btnNegFill); - // this.btnNegFill.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + // this.btnNegFill.on('color:select', _.bind(this.onBarColorsSelect, this)); initColor(this.btnPosBorder); - // this.btnPosBorder.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + // this.btnPosBorder.on('color:select', _.bind(this.onBarColorsSelect, this)); initColor(this.btnNegBorder); - // this.btnNegBorder.colorPicker.on('select', _.bind(this.onBarColorsSelect, this)); + // this.btnNegBorder.on('color:select', _.bind(this.onBarColorsSelect, this)); initColor(this.btnAxisColor); - // this.btnAxisColor.colorPicker.on('select', _.bind(this.onAxisColorsSelect, this)); + // this.btnAxisColor.on('color:select', _.bind(this.onAxisColorsSelect, this)); this.mnuTextColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.mnuFillColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); @@ -1118,7 +1096,6 @@ define([ textColorScales: 'Color Scales', textIconSets: 'Icon Sets', textCustom: 'Custom', - textNewColor: 'Add New Custom Color', textBold: 'Bold', textItalic: 'Italic', textUnderline: 'Underline', diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 73d4f0e45..663632ddf 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -158,19 +158,19 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa this.btnDelete.on('click', _.bind(this.onDeleteRule, this)); this.btnUp = new Common.UI.Button({ + parentEl: $('#format-manager-btn-up'), cls: 'btn-toolbar', iconCls: 'caret-up', hint: this.textUp }); - this.btnUp.render($('#format-manager-btn-up')) ; this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); this.btnDown = new Common.UI.Button({ + parentEl: $('#format-manager-btn-down'), cls: 'btn-toolbar', iconCls: 'caret-down', hint: this.textDown }); - this.btnDown.render($('#format-manager-btn-down')) ; this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); this.afterRender(); From 291417d667caace67bd870108edd85d93337357d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 8 May 2020 16:38:15 +0300 Subject: [PATCH 17/63] [SSE] Fix color for formatting rules --- .../main/app/view/FormatRulesEditDlg.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 0b7906082..ad771d6e6 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -784,11 +784,18 @@ define([ subtype = this.subtype; var setColor = function(color, control) { - color = Common.Utils.ThemeColor.colorValue2EffectId(color); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + color = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else { + color = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + + } control.setColor(color); if (_.isObject(color)) { var isselected = false; - for (var j = 0; j < 10; j++) { + for (var i = 0; i < 10; i++) { if (Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue) { control.colorPicker.select(color, true); isselected = true; @@ -847,7 +854,7 @@ define([ for (var i=0; i Date: Tue, 19 May 2020 19:57:24 +0300 Subject: [PATCH 18/63] [SSE] Add format settings to conditional formatting --- .../main/app/controller/Toolbar.js | 5 + .../main/app/view/FormatRulesEditDlg.js | 292 ++++++++++++++++-- .../main/app/view/FormatRulesManagerDlg.js | 2 + .../main/resources/less/toolbar.less | 3 +- 4 files changed, 279 insertions(+), 23 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 008d1a4e4..c2f07dd3b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1472,9 +1472,13 @@ define([ onCondFormatMenu: function(menu, item) { var me = this; + var value = this.api.asc_getLocale(); + (!value) && (value = ((this.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)) : 0x0409)); + if (item.value == 'manage') { (new SSE.Views.FormatRulesManagerDlg({ api: me.api, + langId: value, handler: function (result, settings) { if (me && me.api) { } @@ -1488,6 +1492,7 @@ define([ type : item.options.type, subtype : item.value, isEdit : false, + langId : value, handler : function(result, settings) { if (result == 'ok' && settings) { } diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index ad771d6e6..39564934f 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -93,8 +93,10 @@ define([ '
', '
','
', '
','
', - '
','
', + // '
','
', '
','
', + '
', + '
', '', '', '', @@ -200,6 +202,7 @@ define([ this.props = options.props; this.type = options.type; // rule category this.subtype = options.subtype; // rule + this.langId = options.langId; // rule Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -428,8 +431,7 @@ define([ { value: 'ffeb9c', displayValue: 'absdef', color: '#ffeb9c', displayColor: '9c6500' }, { value: 'ffc7ce', displayValue: 'absdef', color: '#ffc7ce', displayColor: 'b32e35' }, { value: 'c6efce', displayValue: 'absdef', color: '#c6efce', displayColor: '2e8230' }, - { value: 'ffcc99', displayValue: 'absdef', color: '#ffcc99', displayColor: '56507b' }, - { value: -1, displayValue: this.textCustom, color: null } + { value: 'ffcc99', displayValue: 'absdef', color: '#ffcc99', displayColor: '56507b' } ]; this.cmbFormats = new Common.UI.ComboBoxColor({ el : $('#format-rules-format-preset'), @@ -479,24 +481,24 @@ define([ }); // this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this)); - this.btnSuperscript = new Common.UI.Button({ - parentEl: $('#format-rules-superscript'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-superscript', - enableToggle: true, - toggleGroup: 'superscriptFRGroup', - hint: this.textSuperscript - }); - // this.btnSuperscript.on('click', _.bind(this.onSuperscriptClick, this)); - - this.btnSubscript = new Common.UI.Button({ - parentEl: $('#format-rules-subscript'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-subscript', - enableToggle: true, - toggleGroup: 'superscriptFRGroup', - hint: this.textSubscript - }); + // this.btnSuperscript = new Common.UI.Button({ + // parentEl: $('#format-rules-superscript'), + // cls: 'btn-toolbar', + // iconCls: 'toolbar__icon btn-superscript', + // enableToggle: true, + // toggleGroup: 'superscriptFRGroup', + // hint: this.textSuperscript + // }); + // // this.btnSuperscript.on('click', _.bind(this.onSuperscriptClick, this)); + // + // this.btnSubscript = new Common.UI.Button({ + // parentEl: $('#format-rules-subscript'), + // cls: 'btn-toolbar', + // iconCls: 'toolbar__icon btn-subscript', + // enableToggle: true, + // toggleGroup: 'superscriptFRGroup', + // hint: this.textSubscript + // }); // this.btnSubscript.on('click', _.bind(this.onSubscriptClick, this)); var initNewColor = function(btn, picker_el) { @@ -551,6 +553,212 @@ define([ // this.btnFillColor.on('click', _.bind(this.onTextColor, this)); this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor"); + this.btnBorders = new Common.UI.Button({ + parentEl : $('#format-rules-borders'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-border-out', + hint : this.tipBorders, + icls : 'btn-border-out', + borderId : 'outer', + borderswidth: Asc.c_oAscBorderStyles.Thin, + split : true, + menu : new Common.UI.Menu({ + items: [ + { + caption : this.textOutBorders, + iconCls : 'menu__icon btn-border-out', + icls : 'btn-border-out', + borderId : 'outer' + }, + { + caption : this.textAllBorders, + iconCls : 'menu__icon btn-border-all', + icls : 'btn-border-all', + borderId : 'all' + }, + { + caption : this.textTopBorders, + iconCls : 'menu__icon btn-border-top', + icls : 'btn-border-top', + borderId : Asc.c_oAscBorderOptions.Top + }, + { + caption : this.textBottomBorders, + iconCls : 'menu__icon btn-border-bottom', + icls : 'btn-border-bottom', + borderId : Asc.c_oAscBorderOptions.Bottom + }, + { + caption : this.textLeftBorders, + iconCls : 'menu__icon btn-border-left', + icls : 'btn-border-left', + borderId : Asc.c_oAscBorderOptions.Left + }, + { + caption : this.textRightBorders, + iconCls : 'menu__icon btn-border-right', + icls : 'btn-border-right', + borderId : Asc.c_oAscBorderOptions.Right + }, + { + caption : this.textNoBorders, + iconCls : 'menu__icon btn-border-no', + icls : 'btn-border-no', + borderId : 'none' + }, + {caption: '--'}, + { + caption : this.textInsideBorders, + iconCls : 'menu__icon btn-border-inside', + icls : 'btn-border-center', + borderId : 'inner' + }, + { + caption : this.textCenterBorders, + iconCls : 'menu__icon btn-border-insidevert', + icls : 'btn-border-vmiddle', + borderId : Asc.c_oAscBorderOptions.InnerV + }, + { + caption : this.textMiddleBorders, + iconCls : 'menu__icon btn-border-insidehor', + icls : 'btn-border-hmiddle', + borderId : Asc.c_oAscBorderOptions.InnerH + }, + { + caption : this.textDiagUpBorder, + iconCls : 'menu__icon btn-border-diagup', + icls : 'btn-border-diagup', + borderId : Asc.c_oAscBorderOptions.DiagU + }, + { + caption : this.textDiagDownBorder, + iconCls : 'menu__icon btn-border-diagdown', + icls : 'btn-border-diagdown', + borderId : Asc.c_oAscBorderOptions.DiagD + }, + {caption: '--'}, + { + id : 'format-rules-borders-border-width', + caption : this.textBordersStyle, + iconCls : 'menu__icon btn-border-style', + menu : (function(){ + var itemTemplate = _.template('
'); + me.mnuBorderWidth = new Common.UI.Menu({ + style : 'min-width: 100px;', + menuAlign : 'tl-tr', + items: [ + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.Thin , offsety: 0, checked:true}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.Hair, offsety: 20}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.Dotted, offsety: 40}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.Dashed, offsety: 60}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.DashDot, offsety: 80}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.DashDotDot, offsety: 100}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.Medium, offsety: 120}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.MediumDashed, offsety: 140}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.MediumDashDot, offsety: 160}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.MediumDashDotDot, offsety: 180}, + { template: itemTemplate, stopPropagation: true, checkable: true, toggleGroup: 'border-width', value: Asc.c_oAscBorderStyles.Thick, offsety: 200} + ] + }); + + return me.mnuBorderWidth; + })() + }, + this.mnuBorderColor = new Common.UI.MenuItem({ + id : 'format-rules-borders-border-color', + caption : this.textBordersColor, + iconCls : 'mnu-icon-item mnu-border-color', + template : _.template('<%= caption %>'), + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items : [ + { template: _.template('
'), stopPropagation: true }, + { template: _.template('' + this.textNewColor + ''), stopPropagation: true } + ] + }) + }) + ] + }) + }); + var colorVal = $('
'); + $('button:first-child', this.btnBorders.cmpEl).append(colorVal); + colorVal.css('background-color', this.btnBorders.currentColor || 'transparent'); + this.mnuBorderColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#format-rules-borders-menu-bordercolor') + }); + this.mnuBorderColorPicker.on('select', _.bind(this.onBordersColor, this)); + $('#format-rules-borders-menu-new-bordercolor').on('click', _.bind(function() { + me.mnuBorderColorPicker.addNewColor(); + }, this)); + + this.mnuBorderWidth.on('item:toggle', _.bind(this.onBordersWidth, this)); + + this.ascFormatOptions = { + General : 'General', + Number : '0.00', + Currency : '$#,##0.00', + Accounting : '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)', + DateShort : 'm/d/yyyy', + DateLong : '[$-F800]dddd, mmmm dd, yyyy', + Time : '[$-F400]h:mm:ss AM/PM', + Percentage : '0.00%', + Percent : '0%', + Fraction : '# ?/?', + Scientific : '0.00E+00', + Text : '@' + }; + + this.numFormatData = [ + { value: Asc.c_oAscNumFormatType.General, format: this.ascFormatOptions.General, displayValue: this.txtGeneral, exampleval: '100' }, + { value: Asc.c_oAscNumFormatType.Number, format: this.ascFormatOptions.Number, displayValue: this.txtNumber, exampleval: '100,00' }, + { value: Asc.c_oAscNumFormatType.Scientific,format: this.ascFormatOptions.Scientific, displayValue: this.txtScientific, exampleval: '1,00E+02' }, + { value: Asc.c_oAscNumFormatType.Accounting,format: this.ascFormatOptions.Accounting, displayValue: this.txtAccounting, exampleval: '100,00 $' }, + { value: Asc.c_oAscNumFormatType.Currency, format: this.ascFormatOptions.Currency, displayValue: this.txtCurrency, exampleval: '100,00 $' }, + { value: Asc.c_oAscNumFormatType.Date, format: 'MM-dd-yyyy', displayValue: this.txtDate, exampleval: '04-09-1900' }, + { value: Asc.c_oAscNumFormatType.Time, format: 'HH:MM:ss', displayValue: this.txtTime, exampleval: '00:00:00' }, + { value: Asc.c_oAscNumFormatType.Percent, format: this.ascFormatOptions.Percentage, displayValue: this.txtPercentage, exampleval: '100,00%' }, + { value: Asc.c_oAscNumFormatType.Fraction, format: this.ascFormatOptions.Fraction, displayValue: this.txtFraction, exampleval: '100' }, + { value: Asc.c_oAscNumFormatType.Text, format: this.ascFormatOptions.Text, displayValue: this.txtText, exampleval: '100' } + ]; + + if (this.api) { + var me = this, + info = new Asc.asc_CFormatCellsInfo(); + info.asc_setType(Asc.c_oAscNumFormatType.None); + info.asc_setSymbol(this.langId); + var arr = this.api.asc_getFormatCells(info); // all formats + this.numFormatData.forEach( function(item, index) { + item.format = arr[index]; + item.exampleval = me.api.asc_getLocaleExample(item.format, 100); + }); + } + + var formatTemplate = + _.template([ + '<% _.each(items, function(item) { %>', + '
  • ', + '
    <%= scope.getDisplayValue(item) %>
    ', + '
    <%= item.exampleval ? item.exampleval : "" %>
    ', + '
  • ', + '<% }); %>' + // ,'
  • ', + // '
  • ' + me.textMoreFormats + '
  • ' + ].join('')); + + this.cmbNumberFormat = new Common.UI.ComboBox({ + el : $('#format-rules-edit-combo-num-format'), + cls : 'input-group-nr', + style : 'width: 100px;', + menuStyle : 'min-width: 100%;max-height: 211px;', + hint : this.tipNumFormat, + itemsTemplate: formatTemplate, + editable : false, + data : this.numFormatData + }); + this.cmbNumberFormat.setValue(Asc.c_oAscNumFormatType.General); + // this.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this)); + // Scale this.scaleControls = []; this.lblMidScale = this.$window.find('#format-rules-edit-lbl-scale-2'); @@ -1011,6 +1219,18 @@ define([ } }, + onBordersWidth: function(menu, item, state) { + if (state) { + this.btnBorders.options.borderswidth = item.value; + } + }, + + onBordersColor: function(picker, color) { + $('#format-rules-borders-border-color .menu-item-icon').css('border-color', '#' + ((typeof(color) == 'object') ? color.color : color)); + this.mnuBorderColor.onUnHoverItem(); + this.btnBorders.options.borderscolor = Common.Utils.ThemeColor.getRgbColor(color); + }, + updateThemeColors: function() { for (var i=0; i Date: Tue, 19 May 2020 22:13:07 +0300 Subject: [PATCH 19/63] [SSE] Conditional formatting: load format settings --- .../main/app/view/FormatRulesEditDlg.js | 54 ++++++++++++++++--- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 39564934f..a14629c6a 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -515,7 +515,8 @@ define([ btn.menu.cmpEl.on('click', picker_el+'-new', _.bind(function() { picker.addNewColor((typeof(btn.color) == 'object') ? btn.color.color : btn.color); }, me)); - // picker.on('select', _.bind(me.onColorSelect, me, btn)); + picker.on('select', _.bind(me.onFormatColorSelect, me, btn)); + btn.on('click', _.bind(me.onFormatColor, me, picker)); return picker; }; @@ -991,29 +992,32 @@ define([ ruleType, subtype = this.subtype; - var setColor = function(color, control) { + var setColor = function(color, control, picker) { + picker = control ? control.colorPicker : picker; if (color) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { color = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; } else { color = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); } - + } else { + color = picker.options.transparent ? 'transparent' : '000000'; } - control.setColor(color); + control && control.setColor(color); if (_.isObject(color)) { var isselected = false; for (var i = 0; i < 10; i++) { if (Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue) { - control.colorPicker.select(color, true); + picker.select(color, true); isselected = true; break; } } - if (!isselected) control.colorPicker.clearSelection(); + if (!isselected) picker.clearSelection(); } else { - control.colorPicker.select(color, true); + picker.select(color, true); } + return color; }; if (props) { @@ -1149,6 +1153,30 @@ define([ if (props) { // var val = props.asc_getLocation(); // this.txtScope.setValue((val) ? val : ''); + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { + var xfs = props.asc_getDxf(); + this.btnBold.toggle(xfs.asc_getFontBold() === true, true); + this.btnItalic.toggle(xfs.asc_getFontItalic() === true, true); + this.btnUnderline.toggle(xfs.asc_getFontUnderline() === true, true); + this.btnStrikeout.toggle(xfs.asc_getFontStrikeout() === true, true); + + var color = setColor(xfs.asc_getFontColor(), null, this.mnuTextColorPicker); + this.btnTextColor.currentColor = color; + this.mnuTextColorPicker.currentColor = color; + color = (typeof(color) == 'object') ? color.color : color; + $('.btn-color-value-line', this.btnTextColor.cmpEl).css('background-color', '#' + color); + + color = setColor(xfs.asc_getFillColor(), null, this.mnuFillColorPicker); + this.btnFillColor.currentColor = color; + this.mnuFillColorPicker.currentColor = color; + color = (typeof(color) == 'object') ? color.color : color; + $('.btn-color-value-line', this.btnFillColor.cmpEl).css('background-color', '#' + color); + + var val = xfs.asc_getNumFormatInfo(); + val && this.cmbNumberFormat.setValue(val.asc_getType(), this.textCustom); + } } else { } }, @@ -1231,6 +1259,18 @@ define([ this.btnBorders.options.borderscolor = Common.Utils.ThemeColor.getRgbColor(color); }, + onFormatColorSelect: function(btn, picker, color, fromBtn) { + var clr = (typeof(color) == 'object') ? color.color : color; + btn.currentColor = color; + $('.btn-color-value-line', btn.cmpEl).css('background-color', '#' + clr); + + picker.currentColor = color; + }, + + onFormatColor: function(picker, btn, e) { + picker.trigger('select', picker, picker.currentColor, true); + }, + updateThemeColors: function() { for (var i=0; i Date: Tue, 26 Jan 2021 11:38:05 +0300 Subject: [PATCH 20/63] [SSE] Apply settings for conditional formatting --- .../main/app/controller/Toolbar.js | 1 + .../main/app/view/FormatRulesEditDlg.js | 120 +++++++++++++++++- .../main/app/view/FormatRulesManagerDlg.js | 13 ++ 3 files changed, 129 insertions(+), 5 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 9713c56cf..6333640ad 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1487,6 +1487,7 @@ define([ langId: value, handler: function (result, settings) { if (me && me.api) { + me.api.asc_setCF(settings); } } })).show(); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index a14629c6a..9fec175cb 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -670,7 +670,7 @@ define([ id : 'format-rules-borders-border-color', caption : this.textBordersColor, iconCls : 'mnu-icon-item mnu-border-color', - template : _.template('<%= caption %>'), + template : _.template('<%= caption %>'), menu : new Common.UI.Menu({ menuAlign : 'tl-tr', items : [ @@ -1181,6 +1181,120 @@ define([ } }, + getSettings: function() { + var props; + var rec = this.ruleStore.findWhere({index: this.cmbCategory.getValue()}); + + if (rec) { + props = new AscCommonExcel.CConditionalFormattingRule(); + var type = rec.get('type'); + props.asc_setType(type); + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { + var xfs = new AscCommonExcel.CellXfs(); + xfs.asc_setFontBold(this.btnBold.isActive()); + xfs.asc_setFontItalic(this.btnItalic.isActive()); + xfs.asc_setFontUnderline(this.btnUnderline.isActive()); + xfs.asc_setFontStrikeout(this.btnStrikeout.isActive()); + + this.mnuTextColorPicker.currentColor && xfs.asc_setFontColor(Common.Utils.ThemeColor.getRgbColor(this.mnuTextColorPicker.currentColor)); + this.mnuFillColorPicker.currentColor && xfs.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(this.mnuFillColorPicker.currentColor)); + this.cmbNumberFormat.getSelectedRecord() && xfs.asc_setNumFormatInfo(this.cmbNumberFormat.getValue()); + props.asc_setDxf(xfs); + } + + switch (type) { + case Asc.c_oAscCFType.containsText: + case Asc.c_oAscCFType.notContainsText: + case Asc.c_oAscCFType.beginsWith: + case Asc.c_oAscCFType.endsWith: + var value = this.txtRange1.setValue(); + value && props.asc_setContainsText(value); + break; + case Asc.c_oAscCFType.timePeriod: + props.asc_setTimePeriod(this.cmbRule.getValue()); + break; + case Asc.c_oAscCFType.aboveAverage: + var val = this.cmbRule.getValue(); + var above = !(val%2); + props.asc_setAboveAverage(above); + props.asc_setEqualAverage(val==2 || val==3); + props.asc_setStdDev(val>3 ? (val/2 - 1) : 0); + break; + case Asc.c_oAscCFType.top10: + props.asc_setBottom(!!this.cmbRule.getValue()); + props.asc_setPercent(!!this.cmbPercent.getValue()); + (this.numRank.getValue()!=='') && props.asc_setRank(this.numRank.getNumberValue()); + break; + case Asc.c_oAscCFType.cellIs: + props.asc_setOperator(this.cmbRule.getValue()); + props.asc_setValue1(this.txtRange1.getValue()); + props.asc_setValue2(this.txtRange2.getValue()); + break; + case Asc.c_oAscCFType.expression: + props.asc_getValue1(this.txtRange1.getValue()); + break; + case Asc.c_oAscCFType.colorScale: + var scaleProps = new AscCommonExcel.CColorScale(); + var scalesCount = rec.get('num'); + var arr = (scalesCount) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; + var colors = [], scales = []; + for (var i=0; i Date: Tue, 26 Jan 2021 18:50:59 +0300 Subject: [PATCH 21/63] [SSE] Set and preview format settings --- .../main/app/view/FormatRulesEditDlg.js | 156 +++++++++++++++--- .../main/app/view/FormatRulesManagerDlg.js | 7 +- 2 files changed, 134 insertions(+), 29 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 9fec175cb..ee3584e98 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -100,6 +100,14 @@ define([ '', '', '', + '', + '', + '', + '
    ', + '
    ', + '
    ', + '', + '', '', '', '
    ', @@ -452,7 +460,7 @@ define([ enableToggle: true, hint: this.textBold }); - // this.btnBold.on('click', _.bind(this.onBoldClick, this)); + this.btnBold.on('click', _.bind(this.onBoldClick, this)); this.btnItalic = new Common.UI.Button({ parentEl: $('#format-rules-italic'), @@ -461,7 +469,7 @@ define([ enableToggle: true, hint: this.textItalic }); - // this.btnItalic.on('click', _.bind(this.onItalicClick, this)); + this.btnItalic.on('click', _.bind(this.onItalicClick, this)); this.btnUnderline = new Common.UI.Button({ parentEl: $('#format-rules-underline'), @@ -470,7 +478,7 @@ define([ enableToggle: true, hint: this.textUnderline }); - // this.btnUnderline.on('click', _.bind(this.onUnderlineClick, this)); + this.btnUnderline.on('click', _.bind(this.onUnderlineClick, this)); this.btnStrikeout = new Common.UI.Button({ parentEl: $('#format-rules-strikeout'), @@ -479,7 +487,7 @@ define([ enableToggle: true, hint: this.textStrikeout }); - // this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this)); + this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this)); // this.btnSuperscript = new Common.UI.Button({ // parentEl: $('#format-rules-superscript'), @@ -515,8 +523,6 @@ define([ btn.menu.cmpEl.on('click', picker_el+'-new', _.bind(function() { picker.addNewColor((typeof(btn.color) == 'object') ? btn.color.color : btn.color); }, me)); - picker.on('select', _.bind(me.onFormatColorSelect, me, btn)); - btn.on('click', _.bind(me.onFormatColor, me, picker)); return picker; }; @@ -534,8 +540,9 @@ define([ ] }) }); - // this.btnTextColor.on('click', _.bind(this.onTextColor, this)); this.mnuTextColorPicker = initNewColor(this.btnTextColor, "#format-rules-menu-fontcolor"); + this.mnuTextColorPicker.on('select', _.bind(me.onFormatTextColorSelect, me)); + this.btnTextColor.on('click', _.bind(me.onFormatTextColor, me)); this.btnFillColor = new Common.UI.Button({ parentEl: $('#format-rules-fillcolor'), @@ -551,8 +558,9 @@ define([ ] }) }); - // this.btnFillColor.on('click', _.bind(this.onTextColor, this)); this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor"); + this.mnuFillColorPicker.on('select', _.bind(me.onFormatFillColorSelect, me)); + this.btnFillColor.on('click', _.bind(me.onFormatFillColor, me)); this.btnBorders = new Common.UI.Button({ parentEl : $('#format-rules-borders'), @@ -682,6 +690,8 @@ define([ ] }) }); + this.btnBorders.menu.on('item:click', _.bind(this.onBordersMenu, this)); + this.btnBorders.on('click', _.bind(this.onBorders, this)); var colorVal = $('
    '); $('button:first-child', this.btnBorders.cmpEl).append(colorVal); colorVal.css('background-color', this.btnBorders.currentColor || 'transparent'); @@ -758,7 +768,7 @@ define([ data : this.numFormatData }); this.cmbNumberFormat.setValue(Asc.c_oAscNumFormatType.General); - // this.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this)); + this.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this)); // Scale this.scaleControls = []; @@ -1176,9 +1186,14 @@ define([ var val = xfs.asc_getNumFormatInfo(); val && this.cmbNumberFormat.setValue(val.asc_getType(), this.textCustom); + this.xfsFormat = xfs; } } else { } + if (!this.xfsFormat) { + this.xfsFormat = new AscCommonExcel.CellXfs(); + } + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); }, getSettings: function() { @@ -1192,16 +1207,7 @@ define([ if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { - var xfs = new AscCommonExcel.CellXfs(); - xfs.asc_setFontBold(this.btnBold.isActive()); - xfs.asc_setFontItalic(this.btnItalic.isActive()); - xfs.asc_setFontUnderline(this.btnUnderline.isActive()); - xfs.asc_setFontStrikeout(this.btnStrikeout.isActive()); - - this.mnuTextColorPicker.currentColor && xfs.asc_setFontColor(Common.Utils.ThemeColor.getRgbColor(this.mnuTextColorPicker.currentColor)); - this.mnuFillColorPicker.currentColor && xfs.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(this.mnuFillColorPicker.currentColor)); - this.cmbNumberFormat.getSelectedRecord() && xfs.asc_setNumFormatInfo(this.cmbNumberFormat.getValue()); - props.asc_setDxf(xfs); + props.asc_setDxf(this.xfsFormat); } switch (type) { @@ -1361,6 +1367,25 @@ define([ } }, + onBoldClick: function() { + this.xfsFormat.asc_setFontBold(this.btnBold.isActive()); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + }, + + onItalicClick: function() { + this.xfsFormat.asc_setFontItalic(this.btnItalic.isActive()); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + }, + + onUnderlineClick: function() { + this.xfsFormat.asc_setFontUnderline(this.btnUnderline.isActive()); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + }, + onStrikeoutClick: function() { + this.xfsFormat.asc_setFontStrikeout(this.btnStrikeout.isActive()); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + }, + onBordersWidth: function(menu, item, state) { if (state) { this.btnBorders.options.borderswidth = item.value; @@ -1373,16 +1398,91 @@ define([ this.btnBorders.options.borderscolor = Common.Utils.ThemeColor.getRgbColor(color); }, - onFormatColorSelect: function(btn, picker, color, fromBtn) { - var clr = (typeof(color) == 'object') ? color.color : color; - btn.currentColor = color; - $('.btn-color-value-line', btn.cmpEl).css('background-color', '#' + clr); + onBorders: function(btn) { + var menuItem; - picker.currentColor = color; + _.each(btn.menu.items, function(item) { + if (btn.options.borderId == item.options.borderId) { + menuItem = item; + return false; + } + }); + + if (menuItem) { + this.onBordersMenu(btn.menu, menuItem); + } }, - onFormatColor: function(picker, btn, e) { - picker.trigger('select', picker, picker.currentColor, true); + onBordersMenu: function(menu, item) { + var me = this; + if (!_.isUndefined(item.options.borderId)) { + var btnBorders = me.btnBorders, + new_borders = [], + bordersWidth = btnBorders.options.borderswidth, + bordersColor = btnBorders.options.borderscolor; + + if ( btnBorders.rendered ) { + btnBorders.$icon.removeClass(btnBorders.options.icls).addClass(item.options.icls); + btnBorders.options.icls = item.options.icls; + } + + btnBorders.options.borderId = item.options.borderId; + + if (item.options.borderId == 'inner') { + new_borders[Asc.c_oAscBorderOptions.InnerV] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.InnerH] = new Asc.asc_CBorder(bordersWidth, bordersColor); + } else if (item.options.borderId == 'all') { + new_borders[Asc.c_oAscBorderOptions.InnerV] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.InnerH] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Left] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Top] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Right] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Bottom] = new Asc.asc_CBorder(bordersWidth, bordersColor); + } else if (item.options.borderId == 'outer') { + new_borders[Asc.c_oAscBorderOptions.Left] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Top] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Right] = new Asc.asc_CBorder(bordersWidth, bordersColor); + new_borders[Asc.c_oAscBorderOptions.Bottom] = new Asc.asc_CBorder(bordersWidth, bordersColor); + } else if (item.options.borderId != 'none') { + new_borders[item.options.borderId] = new Asc.asc_CBorder(bordersWidth, bordersColor); + } + this.xfsFormat.asc_setFontStrikeout(this.btnStrikeout.isActive()); + this.xfsFormat.asc_setBorder(new_borders); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + } + }, + + onFormatTextColorSelect: function(picker, color, fromBtn) { + var clr = (typeof(color) == 'object') ? color.color : color; + this.btnTextColor.currentColor = color; + $('.btn-color-value-line', this.btnTextColor.cmpEl).css('background-color', '#' + clr); + picker.currentColor = color; + + this.xfsFormat.asc_setFontColor(Common.Utils.ThemeColor.getRgbColor(this.mnuTextColorPicker.currentColor)); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + }, + + onFormatTextColor: function(btn, e) { + this.mnuTextColorPicker.trigger('select', this.mnuTextColorPicker, this.mnuTextColorPicker.currentColor, true); + }, + + onFormatFillColorSelect: function(picker, color, fromBtn) { + var clr = (typeof(color) == 'object') ? color.color : color; + this.mnuFillColorPicker.currentColor = color; + $('.btn-color-value-line', this.mnuFillColorPicker.cmpEl).css('background-color', '#' + clr); + picker.currentColor = color; + + this.xfsFormat.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(this.mnuFillColorPicker.currentColor)); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); + }, + + onFormatFillColor: function(picker, btn, e) { + this.mnuFillColorPicker.trigger('select', this.mnuFillColorPicker, this.mnuFillColorPicker.currentColor, true); + }, + + onNumberFormatSelect: function(combo, record) { + this.xfsFormat.asc_setNumFormatInfo(record.value); + this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); }, updateThemeColors: function() { @@ -1514,7 +1614,9 @@ define([ textBordersStyle: 'Border Style', textBordersColor: 'Borders Color', textNewColor: 'Add New Custom Color', - tipNumFormat: 'Number Format' + tipNumFormat: 'Number Format', + textPreview: 'Preview', + exampleText: 'AaBbCcYyZz' }, SSE.Views.FormatRulesEditDlg || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 32160cdde..28fa617a0 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -188,7 +188,9 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa }, refreshRuleList: function(scope) { - var levels = this.api.asc_getCF(scope, (scope==Asc.c_oAscSelectionForCFType.worksheet) ? this.api.asc_getActiveWorksheetIndex() : undefined); + var obj = this.api.asc_getCF(scope, (scope==Asc.c_oAscSelectionForCFType.worksheet) ? this.api.asc_getActiveWorksheetIndex() : undefined); + var levels = obj[0]; + this.currentRange = obj[1]; var arr = []; if (levels) { for (var i=0; i Date: Tue, 26 Jan 2021 19:30:37 +0300 Subject: [PATCH 22/63] [SSE] Apply number format --- apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index ee3584e98..6c8f41417 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -1481,7 +1481,7 @@ define([ }, onNumberFormatSelect: function(combo, record) { - this.xfsFormat.asc_setNumFormatInfo(record.value); + this.xfsFormat.asc_setNumFormatInfo(record.format); this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); }, From e8359bea7abcac0ae3a1f06a42bed8202b362a23 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 26 Jan 2021 19:41:51 +0300 Subject: [PATCH 23/63] Refactoring --- 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 6333640ad..e2ef7b06b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1486,7 +1486,7 @@ define([ api: me.api, langId: value, handler: function (result, settings) { - if (me && me.api) { + if (me && me.api && result=='ok') { me.api.asc_setCF(settings); } } From d29a058ce69bb1df0da7e9a6b55120ef783f1b24 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 27 Jan 2021 00:32:45 +0300 Subject: [PATCH 24/63] [SSE] Fix editing rule settings --- .../main/app/view/FormatRulesEditDlg.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 6c8f41417..a29208e7f 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -1204,19 +1204,21 @@ define([ props = new AscCommonExcel.CConditionalFormattingRule(); var type = rec.get('type'); props.asc_setType(type); - if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || - type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.duplicateValues || + type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { props.asc_setDxf(this.xfsFormat); } switch (type) { case Asc.c_oAscCFType.containsText: - case Asc.c_oAscCFType.notContainsText: - case Asc.c_oAscCFType.beginsWith: - case Asc.c_oAscCFType.endsWith: - var value = this.txtRange1.setValue(); + var value = this.txtRange1.getValue(); value && props.asc_setContainsText(value); + props.asc_setType(this.cmbRule.getValue()); + break; + case Asc.c_oAscCFType.containsBlanks: + case Asc.c_oAscCFType.duplicateValues: + props.asc_setType(this.cmbRule.getValue()); break; case Asc.c_oAscCFType.timePeriod: props.asc_setTimePeriod(this.cmbRule.getValue()); @@ -1239,7 +1241,7 @@ define([ props.asc_setValue2(this.txtRange2.getValue()); break; case Asc.c_oAscCFType.expression: - props.asc_getValue1(this.txtRange1.getValue()); + props.asc_setValue1(this.txtRange1.getValue()); break; case Asc.c_oAscCFType.colorScale: var scaleProps = new AscCommonExcel.CColorScale(); From d622183c6ad664eccea1c90d554790a7ff4e2e80 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Jan 2021 00:57:04 +0300 Subject: [PATCH 25/63] [SSE] Fix rules settings --- .../main/app/view/FormatRulesEditDlg.js | 9 +- .../main/app/view/FormatRulesManagerDlg.js | 82 +++++++++++++++---- 2 files changed, 68 insertions(+), 23 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index a29208e7f..4a227d02b 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -692,9 +692,6 @@ define([ }); this.btnBorders.menu.on('item:click', _.bind(this.onBordersMenu, this)); this.btnBorders.on('click', _.bind(this.onBorders, this)); - var colorVal = $('
    '); - $('button:first-child', this.btnBorders.cmpEl).append(colorVal); - colorVal.css('background-color', this.btnBorders.currentColor || 'transparent'); this.mnuBorderColorPicker = new Common.UI.ThemeColorPalette({ el: $('#format-rules-borders-menu-bordercolor') }); @@ -1161,8 +1158,6 @@ define([ } if (props) { - // var val = props.asc_getLocation(); - // this.txtScope.setValue((val) ? val : ''); if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { @@ -1470,8 +1465,8 @@ define([ onFormatFillColorSelect: function(picker, color, fromBtn) { var clr = (typeof(color) == 'object') ? color.color : color; - this.mnuFillColorPicker.currentColor = color; - $('.btn-color-value-line', this.mnuFillColorPicker.cmpEl).css('background-color', '#' + clr); + this.btnFillColor.currentColor = color; + $('.btn-color-value-line', this.btnFillColor.cmpEl).css('background-color', '#' + clr); picker.currentColor = color; this.xfsFormat.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(this.mnuFillColorPicker.currentColor)); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 28fa617a0..f4fdb61cb 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -58,10 +58,23 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa me.template = me.options.template || me.template; - me.listenTo(me.model, 'change:sort', function() { + me.listenTo(me.model, 'change:name', function() { me.render(); me.trigger('change', me, me.model); }); + me.listenTo(me.model, 'change:tip', function() { + var el = me.$el || $(me.el), + tip = el.data('bs.tooltip'); + if (tip) { + var zIndex = tip.options.zIndex; + el.removeData('bs.tooltip'); + el.tooltip({ + title : me.model.get('tip'), + placement : 'cursor', + zIndex : zIndex + }); + } + }); me.listenTo(me.model, 'change:selected', function() { var el = me.$el || $(me.el); el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); @@ -107,19 +120,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa this.cmbScope = new Common.UI.ComboBox({ el : $('#format-manager-combo-scope'), - menuStyle : 'min-width: 100%;', + menuStyle : 'min-width: 100%;max-height: 211px;', editable : false, cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection }, - { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet }, - { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable }, - { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot } - ] + data : [] }).on('selected', function(combo, record) { - me.refreshRuleList(record.value); + me.refreshRuleList(record); }); - this.cmbScope.setValue(Asc.c_oAscSelectionForCFType.selection); this.rulesList = new Common.UI.ListView({ el: $('#format-manager-rules-list', this.$window), @@ -130,7 +137,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa '
    ', '
    <%= name %>
    ', '
    ', - '
    ', + '
    ', '
    ' ].join('')) }); @@ -184,23 +191,50 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa _setDefaults: function (props) { this.rulesList.on('item:add', _.bind(this.addControls, this)); this.rulesList.on('item:change', _.bind(this.addControls, this)); - this.refreshRuleList(this.cmbScope.getValue()); + this.refreshScopeList(); + this.refreshRuleList(this.cmbScope.getSelectedRecord()); + }, + + refreshScopeList: function() { + var wc = this.api.asc_getWorksheetsCount(), i = -1, + currentSheet = this.api.asc_getActiveWorksheetIndex(); + var items = [ + { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection }, + { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet, sheetIndex: currentSheet }, + { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable }, + { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot } + ]; + if (wc>1) { + while (++i < wc) { + if (!this.api.asc_isWorksheetHidden(i) && i!==currentSheet) { + items.push({ + displayValue:this.api.asc_getWorksheetName(i), + value: Asc.c_oAscSelectionForCFType.worksheet, + sheetIndex: i + }); + } + } + } + this.cmbScope.setData(items); + this.cmbScope.setValue(Asc.c_oAscSelectionForCFType.selection); }, refreshRuleList: function(scope) { - var obj = this.api.asc_getCF(scope, (scope==Asc.c_oAscSelectionForCFType.worksheet) ? this.api.asc_getActiveWorksheetIndex() : undefined); + var obj = this.api.asc_getCF(scope.value, (scope.value==Asc.c_oAscSelectionForCFType.worksheet) ? scope.sheetIndex : undefined); var levels = obj[0]; this.currentRange = obj[1]; var arr = []; if (levels) { for (var i=0; i Date: Thu, 28 Jan 2021 14:00:40 +0300 Subject: [PATCH 26/63] [SSE] Fix rule format settings --- .../main/app/view/FormatRulesEditDlg.js | 58 +++++++++--------- .../main/app/view/FormatRulesManagerDlg.js | 59 ++++++++++--------- 2 files changed, 61 insertions(+), 56 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 4a227d02b..7bdca4dd2 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -509,14 +509,15 @@ define([ // }); // this.btnSubscript.on('click', _.bind(this.onSubscriptClick, this)); - var initNewColor = function(btn, picker_el) { + var initNewColor = function(btn, picker_el, transparent) { if (btn && btn.cmpEl) { btn.currentColor = '#000000'; var colorVal = $('
    '); $('button:first-child', btn.cmpEl).append(colorVal); colorVal.css('background-color', btn.currentColor); var picker = new Common.UI.ThemeColorPalette({ - el: $(picker_el) + el: $(picker_el), + transparent: transparent }); picker.currentColor = btn.currentColor; } @@ -558,7 +559,7 @@ define([ ] }) }); - this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor"); + this.mnuFillColorPicker = initNewColor(this.btnFillColor, "#format-rules-menu-fillcolor", true); this.mnuFillColorPicker.on('select', _.bind(me.onFormatFillColorSelect, me)); this.btnFillColor.on('click', _.bind(me.onFormatFillColor, me)); @@ -1157,36 +1158,35 @@ define([ this.refreshRules(rec.get('index'), ruleType); } + this.xfsFormat = new AscCommonExcel.CellXfs(); if (props) { if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { - var xfs = props.asc_getDxf(); - this.btnBold.toggle(xfs.asc_getFontBold() === true, true); - this.btnItalic.toggle(xfs.asc_getFontItalic() === true, true); - this.btnUnderline.toggle(xfs.asc_getFontUnderline() === true, true); - this.btnStrikeout.toggle(xfs.asc_getFontStrikeout() === true, true); - - var color = setColor(xfs.asc_getFontColor(), null, this.mnuTextColorPicker); - this.btnTextColor.currentColor = color; - this.mnuTextColorPicker.currentColor = color; - color = (typeof(color) == 'object') ? color.color : color; - $('.btn-color-value-line', this.btnTextColor.cmpEl).css('background-color', '#' + color); - - color = setColor(xfs.asc_getFillColor(), null, this.mnuFillColorPicker); - this.btnFillColor.currentColor = color; - this.mnuFillColorPicker.currentColor = color; - color = (typeof(color) == 'object') ? color.color : color; - $('.btn-color-value-line', this.btnFillColor.cmpEl).css('background-color', '#' + color); - - var val = xfs.asc_getNumFormatInfo(); - val && this.cmbNumberFormat.setValue(val.asc_getType(), this.textCustom); - this.xfsFormat = xfs; + this.xfsFormat = props.asc_getDxf(); } - } else { } - if (!this.xfsFormat) { - this.xfsFormat = new AscCommonExcel.CellXfs(); + if (this.xfsFormat) { + var xfs = this.xfsFormat; + this.btnBold.toggle(xfs.asc_getFontBold() === true, true); + this.btnItalic.toggle(xfs.asc_getFontItalic() === true, true); + this.btnUnderline.toggle(xfs.asc_getFontUnderline() === true, true); + this.btnStrikeout.toggle(xfs.asc_getFontStrikeout() === true, true); + + var color = setColor(xfs.asc_getFontColor(), null, this.mnuTextColorPicker); + this.btnTextColor.currentColor = color; + this.mnuTextColorPicker.currentColor = color; + color = (typeof(color) == 'object') ? color.color : color; + $('.btn-color-value-line', this.btnTextColor.cmpEl).css('background-color', '#' + color); + + color = setColor(xfs.asc_getFillColor(), null, this.mnuFillColorPicker); + this.btnFillColor.currentColor = color; + this.mnuFillColorPicker.currentColor = color; + color = (typeof(color) == 'object') ? color.color : color; + $('.btn-color-value-line', this.btnFillColor.cmpEl).css('background-color', color=='transparent' ? 'transparent' : '#' + color); + + var val = xfs.asc_getNumFormatInfo(); + val && this.cmbNumberFormat.setValue(val.asc_getType(), this.textCustom); } this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); }, @@ -1466,10 +1466,10 @@ define([ onFormatFillColorSelect: function(picker, color, fromBtn) { var clr = (typeof(color) == 'object') ? color.color : color; this.btnFillColor.currentColor = color; - $('.btn-color-value-line', this.btnFillColor.cmpEl).css('background-color', '#' + clr); + $('.btn-color-value-line', this.btnFillColor.cmpEl).css('background-color', clr=='transparent' ? 'transparent' : '#' + clr); picker.currentColor = color; - this.xfsFormat.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(this.mnuFillColorPicker.currentColor)); + this.xfsFormat.asc_setFillColor(this.mnuFillColorPicker.currentColor == 'transparent' ? null : Common.Utils.ThemeColor.getRgbColor(this.mnuFillColorPicker.currentColor)); this.api.asc_getPreviewCF('format-rules-edit-preview-format', this.xfsFormat, this.exampleText); }, diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index f4fdb61cb..325c418b0 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -108,7 +108,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa this.handler = options.handler; this.props = options.props; this.langId = options.langId; - this.levels = []; + this.rules = []; this.rulesStore = new Common.UI.DataViewStore(); @@ -134,10 +134,10 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa emptyText: '', template: _.template(['
    '].join('')), itemTemplate: _.template([ - '
    ', + '
    ', '
    <%= name %>
    ', - '
    ', - '
    ', + '
    ', + '
    ', '
    ' ].join('')) }); @@ -220,22 +220,25 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa }, refreshRuleList: function(scope) { + this.rules = []; + var obj = this.api.asc_getCF(scope.value, (scope.value==Asc.c_oAscSelectionForCFType.worksheet) ? scope.sheetIndex : undefined); - var levels = obj[0]; + var rules = obj[0]; this.currentRange = obj[1]; var arr = []; - if (levels) { - for (var i=0; i0) && this.rulesList.selectByIndex(index Date: Thu, 28 Jan 2021 18:21:07 +0300 Subject: [PATCH 27/63] [SSE] Add/remove rules --- .../main/app/controller/Toolbar.js | 2 +- .../main/app/view/FormatRulesManagerDlg.js | 133 +++++++++++++----- 2 files changed, 96 insertions(+), 39 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index e2ef7b06b..afa184f43 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1487,7 +1487,7 @@ define([ langId: value, handler: function (result, settings) { if (me && me.api && result=='ok') { - me.api.asc_setCF(settings); + me.api.asc_setCF(settings.rules, settings.deleted); } } })).show(); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 325c418b0..12fb58c0f 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -109,8 +109,9 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa this.props = options.props; this.langId = options.langId; this.rules = []; - - this.rulesStore = new Common.UI.DataViewStore(); + this.rulesStores = {}; + this.rulesDeleted = []; + this.listSettings = {length: 0, min: 0, max: 0}; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -191,22 +192,22 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa _setDefaults: function (props) { this.rulesList.on('item:add', _.bind(this.addControls, this)); this.rulesList.on('item:change', _.bind(this.addControls, this)); + this.currentSheet = this.api.asc_getActiveWorksheetIndex(); this.refreshScopeList(); this.refreshRuleList(this.cmbScope.getSelectedRecord()); }, refreshScopeList: function() { - var wc = this.api.asc_getWorksheetsCount(), i = -1, - currentSheet = this.api.asc_getActiveWorksheetIndex(); + var wc = this.api.asc_getWorksheetsCount(), i = -1; var items = [ - { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection }, - { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet, sheetIndex: currentSheet }, - { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable }, - { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot } + { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection, sheetIndex: -1 }, + { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet, sheetIndex: -1 }, + { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable, sheetIndex: -1 }, + { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot, sheetIndex: -1 } ]; if (wc>1) { while (++i < wc) { - if (!this.api.asc_isWorksheetHidden(i) && i!==currentSheet) { + if (!this.api.asc_isWorksheetHidden(i) && i!==this.currentSheet) { items.push({ displayValue:this.api.asc_getWorksheetName(i), value: Asc.c_oAscSelectionForCFType.worksheet, @@ -221,30 +222,48 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa refreshRuleList: function(scope) { this.rules = []; - - var obj = this.api.asc_getCF(scope.value, (scope.value==Asc.c_oAscSelectionForCFType.worksheet) ? scope.sheetIndex : undefined); - var rules = obj[0]; - this.currentRange = obj[1]; - var arr = []; - if (rules) { - for (var i=0; i0) && this.rulesList.selectByIndex(0); + var sheetIndex = (scope.sheetIndex>-1) ? scope.sheetIndex : this.currentSheet; + var ruleStore = this.rulesStores[sheetIndex]; + if (!ruleStore) { + ruleStore = new Common.UI.DataViewStore(); + this.rulesStores[sheetIndex] = ruleStore; + + var obj = this.api.asc_getCF(Asc.c_oAscSelectionForCFType.worksheet, sheetIndex); + var rules = obj[0]; + this.currentRange = obj[1]; + var arr = []; + if (rules) { + for (var i=0; i
    ', '', '', + '', + '', + '', + '
    ', + '
    ', + '
    ', + '', + '', '', '', '
    ', @@ -1121,6 +1129,11 @@ define([ value = props.asc_getColorScaleOrDataBarOrIconSetRule(); break; } + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { + this.xfsFormat = props.asc_getDxf(); + } } var rec = this.ruleStore.where({type: type}); @@ -1158,13 +1171,6 @@ define([ this.refreshRules(rec.get('index'), ruleType); } - if (props) { - if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || - type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || - type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { - this.xfsFormat = props.asc_getDxf(); - } - } var xfs = this.xfsFormat ? this.xfsFormat : (new AscCommonExcel.CellXfs()); if (xfs) { this.btnBold.toggle(xfs.asc_getFontBold() === true, true); @@ -1240,7 +1246,7 @@ define([ case Asc.c_oAscCFType.colorScale: var scaleProps = new AscCommonExcel.CColorScale(); var scalesCount = rec.get('num'); - var arr = (scalesCount) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; + var arr = (scalesCount==2) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; var colors = [], scales = []; for (var i=0; i0) && this.cmbRule.setValue((ruleType!==undefined) ? ruleType : cmbData[0].value); } this.setControls(index, this.cmbRule.getValue()); + + if (rec) { + var type = rec.get('type'); + this._changedProps = new AscCommonExcel.CConditionalFormattingRule(); + this._changedProps.asc_setType(type); + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.duplicateValues || + type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { + this.xfsFormat && this._changedProps.asc_setDxf(this.xfsFormat); + } else if (type == Asc.c_oAscCFType.colorScale) { + var scalesCount = rec.get('num'); + var arr = (scalesCount==2) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; + var colors = [], scales = []; + for (var i=0; i=this.listSettings.min; i--) { + if (store.at(i).get('cls')!=='hidden') { + return i; + } + } + return this.listSettings.min; + } + }, + + getNextRuleIndex: function(index) { + var store = this.rulesList.store; + if (this.cmbScope.getValue() == Asc.c_oAscSelectionForCFType.worksheet) { + return Math.min(store.length-1, index+1); + } else { + for (var i=index+1; i<=this.listSettings.max; i++) { + if (store.at(i).get('cls')!=='hidden') { + return i; + } + } + return this.listSettings.max; + } + }, + updateRulesCount: function() { var store = this.rulesList.store; if (this.cmbScope.getValue() == Asc.c_oAscSelectionForCFType.worksheet) { @@ -621,6 +655,14 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa } }, + + updateRulesPriority: function(store) { + for (var i=1; i Date: Tue, 2 Feb 2021 15:38:59 +0300 Subject: [PATCH 31/63] [SSE] Fix scale settings --- apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 26b365455..3a294bf71 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -1580,7 +1580,7 @@ define([ if (this.scaleProps ) { var colors = this.scaleProps.asc_getColors(); - colors[picker.options.type] = Common.Utils.ThemeColor.getRgbColor(picker.currentColor); + colors[Math.min(picker.options.type, colors.length-1)] = Common.Utils.ThemeColor.getRgbColor(picker.currentColor); this.scaleProps.asc_setColors(colors); this.previewFormat(); } From 8ab9c050b69d492bb435fc3aa0cbd44903d3989f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 2 Feb 2021 17:01:24 +0300 Subject: [PATCH 32/63] [SSE] Fix applying scales formatting --- apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 3a294bf71..dc90c868a 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -1004,6 +1004,7 @@ define([ }, _setDefaults: function (props) { + this._originalProps = props; var type = props ? props.asc_getType() : this.type, ruleType, subtype = this.subtype; @@ -1201,7 +1202,7 @@ define([ var rec = this.ruleStore.findWhere({index: this.cmbCategory.getValue()}); if (rec) { - props = new AscCommonExcel.CConditionalFormattingRule(); + props = this._originalProps || new AscCommonExcel.CConditionalFormattingRule(); var type = rec.get('type'); props.asc_setType(type); if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.duplicateValues || @@ -1576,11 +1577,11 @@ define([ }, onScaleColorsSelect: function(picker, color) { - picker.currentColor = color; + picker.colorPicker.currentColor = color; if (this.scaleProps ) { var colors = this.scaleProps.asc_getColors(); - colors[Math.min(picker.options.type, colors.length-1)] = Common.Utils.ThemeColor.getRgbColor(picker.currentColor); + colors[Math.min(picker.options.type, colors.length-1)] = Common.Utils.ThemeColor.getRgbColor(picker.colorPicker.currentColor); this.scaleProps.asc_setColors(colors); this.previewFormat(); } From 0c981b760fe1fa1c0751f24d0507348aa5ccfd52 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 5 Feb 2021 21:09:35 +0300 Subject: [PATCH 33/63] [SSE] Fix applying format settings --- .../main/app/view/FormatRulesEditDlg.js | 2 ++ .../main/app/view/FormatRulesManagerDlg.js | 21 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index dc90c868a..56920d46c 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -1034,6 +1034,8 @@ define([ } else { picker.select(color, true); } + picker && (picker.currentColor = color); + control && (control.currentColor = color); return color; }; diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 19eaec00f..4d9cf424b 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -453,7 +453,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa allowBlank : true, disabled : !item.get('activeSheet'), validateOnChange: true - }).on('button:click', _.bind(this.onSelectData, this, rule)); + }).on('button:click', _.bind(this.onSelectData, this, rule, item)); var val = item.get('range'); (val!==null) && input.setValue(val); @@ -479,14 +479,16 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa props.asc_getPreview(this.rules[rule.get('ruleIndex')].previewDiv, text); }, - onSelectData: function(item, cmp) { + onSelectData: function(rule, item) { var me = this; if (me.api) { var handlerDlg = function(dlg, result) { if (result == 'ok') { - item.dataRangeValid = dlg.getSettings(); - item.txtDataRange.setValue(item.dataRangeValid); - item.txtDataRange.checkValidate(); + rule.dataRangeValid = dlg.getSettings(); + rule.txtDataRange.setValue(rule.dataRangeValid); + rule.txtDataRange.checkValidate(); + item.set('ruleChanged', true); + item.get('props').asc_setLocation(rule.dataRangeValid); } }; @@ -501,7 +503,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa win.show(xy.left + 160, xy.top + 125); win.setSettings({ api : me.api, - range : (!_.isEmpty(item.txtDataRange.getValue()) && (item.txtDataRange.checkValidate()==true)) ? item.txtDataRange.getValue() : item.dataRangeValid, + range : (!_.isEmpty(rule.txtDataRange.getValue()) && (rule.txtDataRange.checkValidate()==true)) ? rule.txtDataRange.getValue() : rule.dataRangeValid, type : Asc.c_oAscSelectionDialogType.Chart }); } @@ -670,8 +672,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa var store = this.rulesStores[sheet]; var arr = []; store && store.each(function(item) { + var props = item.get('props'); + if (item.get('priority')!==props.asc_getPriority()) { + props.asc_setPriority(item.get('priority')); + item.set('ruleChanged', true); + } if (item.get('ruleChanged')) - arr.push(item.get('props')); + arr.push(props); }); (arr.length>0) && (sheets[sheet] = arr); } From 40a35856b59f15c8a30a2709b2c5a4a6d9aac9f9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Feb 2021 18:49:05 +0300 Subject: [PATCH 34/63] [SSE] Fix rule settings --- .../main/app/controller/Toolbar.js | 1 + .../main/app/view/FormatRulesEditDlg.js | 19 ++++++++++++------- .../main/app/view/FormatRulesManagerDlg.js | 6 +++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 0b75a230e..9dcc4e4f4 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1603,6 +1603,7 @@ define([ } })).show(); } else if (item.value == 'clear') { + me.api.asc_clearCF(item.options.type); } else { (new SSE.Views.FormatRulesEditDlg({ api: me.api, diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 56920d46c..af9717f83 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -520,9 +520,7 @@ define([ var initNewColor = function(btn, picker_el, transparent) { if (btn && btn.cmpEl) { btn.currentColor = '#000000'; - var colorVal = $('
    '); - $('button:first-child', btn.cmpEl).append(colorVal); - colorVal.css('background-color', btn.currentColor); + btn.setColor(btn.currentColor); var picker = new Common.UI.ThemeColorPalette({ el: $(picker_el), transparent: transparent @@ -535,7 +533,7 @@ define([ return picker; }; - this.btnTextColor = new Common.UI.Button({ + this.btnTextColor = new Common.UI.ButtonColored({ parentEl: $('#format-rules-fontcolor'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-fontcolor', @@ -553,7 +551,7 @@ define([ this.mnuTextColorPicker.on('select', _.bind(me.onFormatTextColorSelect, me)); this.btnTextColor.on('click', _.bind(me.onFormatTextColor, me)); - this.btnFillColor = new Common.UI.Button({ + this.btnFillColor = new Common.UI.ButtonColored({ parentEl: $('#format-rules-fillcolor'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-paracolor', @@ -1132,8 +1130,12 @@ define([ value = props.asc_getColorScaleOrDataBarOrIconSetRule(); break; } + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || - type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.notContainsBlanks || + type == Asc.c_oAscCFType.duplicateValues || type == Asc.c_oAscCFType.uniqueValues || + type == Asc.c_oAscCFType.containsErrors || type == Asc.c_oAscCFType.notContainsErrors || + type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { this.xfsFormat = props.asc_getDxf(); } @@ -1528,7 +1530,10 @@ define([ previewFormat: function() { if (this._changedProps) { var type = this._changedProps.asc_getType(); - if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.duplicateValues || + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.notContainsBlanks || + type == Asc.c_oAscCFType.duplicateValues || type == Asc.c_oAscCFType.uniqueValues || + type == Asc.c_oAscCFType.containsErrors || type == Asc.c_oAscCFType.notContainsErrors || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { this.xfsFormat && !this._changedProps.asc_getDxf() && this._changedProps.asc_setDxf(this.xfsFormat); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 4d9cf424b..89d93375a 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -471,8 +471,12 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa var props = rule.get('props'), type = props.asc_getType(), text = ''; + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || - type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.notContainsBlanks || + type == Asc.c_oAscCFType.duplicateValues || type == Asc.c_oAscCFType.uniqueValues || + type == Asc.c_oAscCFType.containsErrors || type == Asc.c_oAscCFType.notContainsErrors || + type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { text = props.asc_getDxf() ? Common.define.conditionalData.exampleText : Common.define.conditionalData.noFormatText; } From afd23e77bd923f3db646abb7d83c6591e35f300a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Feb 2021 21:48:40 +0300 Subject: [PATCH 35/63] [SSE] Set and preview databar settings --- .../main/app/view/FormatRulesEditDlg.js | 183 ++++++++++++------ 1 file changed, 121 insertions(+), 62 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index af9717f83..a0c20fa44 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -160,48 +160,52 @@ define([ '', '', '
    ', - '', + '', '
    ', '
    ', - '', + '', '
    ', '
    ', '
    ', - '', + '', '
    ', '
    ', '
    ', '
    ', '
    ', - '', + '', '
    ', '
    ', - '', + '', '
    ', '
    ', '
    ', - '', + '', '
    ', '
    ', '
    ', '
    ', '
    ', - '', + '', '
    ', '
    ', '
    ', '', '', '', - '', - '', - '', - '', - '', - '', - '', - '
    ', - '
    ', + '', + '
    ', + '', + '', + '
    ', + '
    ', + '
    ', + '
    ', + '', + '
    ', + '
    ', + '
    ', + '
    ', '', '', '', @@ -877,6 +881,10 @@ define([ {value: true, displayValue: this.textGradient} ] }).on('selected', function(combo, record) { + if (me.barProps) { + me.barProps.asc_setGradient(record.value); + me.previewFormat(); + } }); this.cmbFill.setValue(false); @@ -896,7 +904,7 @@ define([ this.chFill = new Common.UI.CheckBox({ el: $('#format-rules-edit-chk-fill'), - labelText: 'Same as positive' + labelText: this.textSameAs }); this.chFill.on('change', function(field, newValue, oldValue, eOpts){ me.btnNegFill.setDisabled(field.getValue()=='checked'); @@ -914,9 +922,17 @@ define([ {value: true, displayValue: this.textNone} ] }).on('selected', function(combo, record) { - me.btnPosBorder.setDisabled(record.value); - me.btnNegBorder.setDisabled(record.value || me.chBorder.getValue()=='checked'); - me.chBorder.setDisabled(record.value); + var hasBorder = !record.value; + me.btnPosBorder.setDisabled(!hasBorder); + me.btnNegBorder.setDisabled(!hasBorder || me.chBorder.getValue()=='checked'); + me.chBorder.setDisabled(!hasBorder); + if (me.barProps) { + if (hasBorder) { + me.barProps.asc_setBorderColor(Common.Utils.ThemeColor.getRgbColor(me.btnPosBorder.colorPicker.currentColor)); + } else + me.barProps.asc_setBorderColor(null); + me.previewFormat(); + } }); this.cmbBorder.setValue(false); @@ -936,7 +952,7 @@ define([ this.chBorder = new Common.UI.CheckBox({ el: $('#format-rules-edit-chk-border'), - labelText: 'Same as positive' + labelText: this.textSameAs }); this.chBorder.on('change', function(field, newValue, oldValue, eOpts){ me.btnNegBorder.setDisabled(field.getValue()=='checked'); @@ -955,14 +971,17 @@ define([ {value: Asc.c_oAscDataBarDirection.rightToLeft, displayValue: this.textRight2Left} ] }).on('selected', function(combo, record) { + if (me.barProps) { + me.barProps.asc_setDirection(record.value); + me.previewFormat(); + } }); this.cmbBarDirection.setValue(Asc.c_oAscDataBarDirection.context); this.chShowBar = new Common.UI.CheckBox({ el: $('#format-rules-edit-chk-show-bar'), - labelText: 'Show bar only' + labelText: this.textShowBar }); - // this.chShowBar.on('change', _.bind(this.onShowBarChange, this)); this.cmbAxisPos = new Common.UI.ComboBox({ el : $('#format-rules-edit-combo-axis-pos'), @@ -1266,39 +1285,40 @@ define([ props.asc_setColorScaleOrDataBarOrIconSetRule(scaleProps); break; case Asc.c_oAscCFType.dataBar: - // value = props.asc_getColorScaleOrDataBarOrIconSetRule(); - // var bars = value.asc_getCFVOs(); - // var arr = this.barControls; - // for (var i=0; i Date: Wed, 24 Feb 2021 22:06:11 +0300 Subject: [PATCH 36/63] [SSE] Fix default databar settings --- apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index a0c20fa44..54eccfe1b 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -892,14 +892,14 @@ define([ parentEl: $('#format-rules-edit-color-pos-fill'), style: "width:45px;", menu : true, - color : '000000' + color : '638EC6' }); this.btnNegFill = new Common.UI.ColorButton({ parentEl: $('#format-rules-edit-color-neg-fill'), style: "width:45px;", menu : true, - color : '000000' + color : 'FF0000' }); this.chFill = new Common.UI.CheckBox({ @@ -1598,9 +1598,8 @@ define([ var colorPicker = btn.getPicker(); colorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); btn.colorPicker = colorPicker; - colorPicker.currentColor = '000000'; + colorPicker.currentColor = btn.color; colorPicker.select(colorPicker.currentColor, true); - btn.setColor(colorPicker.currentColor); }; initColor(this.btnPosFill); this.btnPosFill.on('color:select', _.bind(this.onBarColorsSelect, this, 'pos')); From 9b97878274cafb9709c33883af60f7a8ff28cccb Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Feb 2021 22:39:04 +0300 Subject: [PATCH 37/63] [SSE] Refactoring --- .../main/app/view/FormatRulesEditDlg.js | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 54eccfe1b..3ccf840c0 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -804,6 +804,7 @@ define([ type : i }).on('selected', function(combo, record) { me.scaleControls[combo.options.type].range.setDisabled(record.value==Asc.c_oAscCfvoType.Minimum || record.value==Asc.c_oAscCfvoType.Maximum); + me.setDefComboValue(combo.options.type, record.value, me.scaleControls[combo.options.type].range); }); combo.setValue((i==1) ? Asc.c_oAscCfvoType.Percentile : arr[0].value); @@ -852,6 +853,7 @@ define([ }).on('selected', function(combo, record) { me.barControls[combo.options.type].range.setDisabled(record.value==Asc.c_oAscCfvoType.Minimum || record.value==Asc.c_oAscCfvoType.Maximum || record.value==Asc.c_oAscCfvoType.AutoMin || record.value==Asc.c_oAscCfvoType.AutoMax); + me.setDefComboValue(combo.options.type, record.value, me.barControls[combo.options.type].range); }); combo.setValue(arr[1].value); @@ -864,7 +866,7 @@ define([ validateOnChange: false, type : i }); - range.setValue(''); + range.setValue(0); range.on('button:click', _.bind(this.onSelectData, this)); this.barControls.push({combo: combo, range: range}); } @@ -1639,8 +1641,21 @@ define([ } }, - onAxisColorsSelect: function(picker, color) { - picker.colorPicker.currentColor = color; + setDefComboValue: function(index, type, range) { + var category = this.cmbCategory.getValue(), + value = ''; + switch (type) { + case Asc.c_oAscCfvoType.Number: + value = 0; + break; + case Asc.c_oAscCfvoType.Percent: + value = (index==0) ? 0 : (index==1 && category==8 ? 50 : 100); + break; + case Asc.c_oAscCfvoType.Percentile: + value = (index==0) ? 10 : (index==1 && category==8 ? 50 : 90); + break; + } + range.setValue(value); }, onPrimary: function() { From f6e15bda2aec99d908e9bf0d67bd6f846df4205b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 25 Feb 2021 18:45:24 +0300 Subject: [PATCH 38/63] [SSE] Add presets for conditional formatting --- apps/common/main/resources/less/toolbar.less | 34 ++ .../app/collection/ConditionalFormatIcons.js | 56 +++ .../main/app/controller/Main.js | 18 +- .../main/app/controller/Toolbar.js | 85 ++++- .../main/app/view/Toolbar.js | 15 +- apps/spreadsheeteditor/main/index.html | 1 + apps/spreadsheeteditor/main/index.html.deploy | 1 + apps/spreadsheeteditor/main/index_loader.html | 1 + .../main/index_loader.html.deploy | 1 + .../main/resources/img/cf-icons.svg | 330 ++++++++++++++++++ 10 files changed, 534 insertions(+), 8 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js create mode 100644 apps/spreadsheeteditor/main/resources/img/cf-icons.svg diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 1fd780939..61a9f3eab 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -634,3 +634,37 @@ border: @scaled-one-px-value solid @border-regular-control; .background-ximage-v2('toolbar/math.png', 1500px); } + +.item-databar { + .icon { + width: 20px; + height: 22px; + } + + svg.icon { + display: inline-block; + vertical-align: middle; + fill: @icon-normal-ie; + fill: @icon-normal; + } + + width: 20px; + height: 22px; +} + +.item-colorscale { + .icon { + width: 20px; + height: 21px; + } + + svg.icon { + display: inline-block; + vertical-align: middle; + fill: @icon-normal-ie; + fill: @icon-normal; + } + + width: 20px; + height: 21px; +} diff --git a/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js b/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js new file mode 100644 index 000000000..a1f2b6ec3 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js @@ -0,0 +1,56 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2021 + * + * 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 + * +*/ +/** + * ConditionalFormatIcons.js + * + * Created by Julia Radzhabova on 25.02.21 + * Copyright (c) 2021 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'backbone' +], function(Backbone){ 'use strict'; + + SSE.Collections.ConditionalFormatIcons = Backbone.Collection.extend({ + model: Backbone.Model.extend({ + defaults: function() { + return { + id: Common.UI.getId(), + data: 0, + icons: null + } + } + }) + }); +}); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 9303a01b3..84caa4c05 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -55,6 +55,7 @@ define([ 'spreadsheeteditor/main/app/collection/ShapeGroups', 'spreadsheeteditor/main/app/collection/TableTemplates', 'spreadsheeteditor/main/app/collection/EquationGroups', + 'spreadsheeteditor/main/app/collection/ConditionalFormatIcons', 'spreadsheeteditor/main/app/controller/FormulaDialog' ], function () { 'use strict'; @@ -87,6 +88,7 @@ define([ 'ShapeGroups', 'EquationGroups', 'TableTemplates', + 'ConditionalFormatIcons', 'Common.Collections.TextArt' ], views: [], @@ -2034,7 +2036,21 @@ define([ }); artStore.reset(arr); }, - + + fillCondFormatIcons: function(iconSets){ + if (_.isEmpty(iconSets)) return; + + var arr = [], + store = this.getCollection('ConditionalFormatIcons'); + _.each(iconSets, function(iconSet, index){ + arr.push({ + icons : iconSet, + data : index + }); + }); + store.reset(arr); + }, + updateThemeColors: function() { var me = this; setTimeout(function(){ diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 9dcc4e4f4..758744a96 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -393,6 +393,7 @@ define([ }); toolbar.btnPrintTitles.on('click', _.bind(this.onPrintTitlesClick, this)); if (toolbar.btnCondFormat.rendered) { + toolbar.btnCondFormat.menu.on('show:before', _.bind(this.onShowBeforeCondFormat, this)); toolbar.btnCondFormat.menu.on('item:click', _.bind(this.onCondFormatMenu, this)); toolbar.btnCondFormat.menu.items[7].menu.on('item:click', _.bind(this.onCondFormatMenu, this)); toolbar.btnCondFormat.menu.items[9].menu.on('item:click', _.bind(this.onCondFormatMenu, this)); @@ -1587,6 +1588,88 @@ define([ } }, + onShowBeforeCondFormat: function() { + var collection = SSE.getCollection('ConditionalFormatIcons'); + if (collection.length>0) return; + + SSE.getController('Main').fillCondFormatIcons(this.api.asc_getCFIcons()); + + var me = this; + var menuItem = this.toolbar.mnuDataBars; + menuItem.menu.addItem(new Common.UI.MenuItem({ + template: _.template('') + })); + var picker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-databar', menuItem.$el), + parentMenu: menuItem.menu, + itemTemplate: _.template('
    \">
    ') + }); + picker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) { + me.api.asc_setCF([], [], [Asc.c_oAscCFRuleTypeSettings.dataBar, record.get('data').index]); + } + if (e.type !== 'click') + me.toolbar.btnCondFormat.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnCondFormat); + } + }); + var arr = [ + { data: {name: 'gradient-blue', index: 0} }, + { data: {name: 'gradient-green', index: 1} }, + { data: {name: 'gradient-red', index: 2} }, + { data: {name: 'gradient-yellow', index: 3} }, + { data: {name: 'gradient-lightblue', index: 4} }, + { data: {name: 'gradient-purple', index: 5} }, + { data: {name: 'solid-blue', index: 6} }, + { data: {name: 'solid-green', index: 7} }, + { data: {name: 'solid-red', index: 8} }, + { data: {name: 'solid-yellow', index: 9} }, + { data: {name: 'solid-lightblue', index: 10} }, + { data: {name: 'solid-purple', index: 11} } + ]; + picker.setStore(new Common.UI.DataViewStore(arr)); + + menuItem = this.toolbar.mnuColorScales; + menuItem.menu.addItem(new Common.UI.MenuItem({ + template: _.template('') + })); + picker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-colorscales', menuItem.$el), + parentMenu: menuItem.menu, + itemTemplate: _.template('
    \">
    ') + }); + picker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) { + me.api.asc_setCF([], [], [Asc.c_oAscCFRuleTypeSettings.colorScale, record.get('data').index]); + } + if (e.type !== 'click') + me.toolbar.btnCondFormat.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnCondFormat); + } + }); + arr = [ + { data: {name: 'green-yellow-red', index: 0} }, + { data: {name: 'red-yellow-green', index: 1} }, + { data: {name: 'green-white-red', index: 2} }, + { data: {name: 'red-white-green', index: 3} }, + { data: {name: 'blue-white-red', index: 4} }, + { data: {name: 'red-white-blue', index: 5} }, + { data: {name: 'white-red', index: 6} }, + { data: {name: 'red-white', index: 7} }, + { data: {name: 'green-white', index: 8} }, + { data: {name: 'white-green', index: 9} }, + { data: {name: 'green-yellow', index: 10} }, + { data: {name: 'yellow-green', index: 11} } + ]; + picker.setStore(new Common.UI.DataViewStore(arr)); + + this.toolbar.mnuIconSets.menu.addItem(new Common.UI.MenuItem({ + template: _.template('') + })); + }, + onCondFormatMenu: function(menu, item) { var me = this; var value = this.api.asc_getLocale(); @@ -2909,7 +2992,7 @@ define([ el: $('#id-toolbar-menu-shapegroup' + i, menu.items[i].$el), store: shapesStore.at(i).get('groupStore'), parentMenu: menu.items[i].menu, - itemTemplate: _.template('
    \">
    ') + itemTemplate: _.template('
    \">
    ') }); shapePicker.on('item:click', function(picker, item, record, e) { if (me.api) { diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 23303b1c7..0cb7f67de 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -2012,30 +2012,33 @@ define([ type : Asc.c_oAscCFType.duplicateValues }, {caption: '--'}, - { + this.mnuDataBars = new Common.UI.MenuItem({ caption : this.textDataBars, type : Asc.c_oAscCFType.dataBar, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', + style: 'min-width: auto;', items: [] }) - }, - { + }), + this.mnuColorScales = new Common.UI.MenuItem({ caption : this.textColorScales, type : Asc.c_oAscCFType.colorScale, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', + style: 'min-width: auto;', items: [] }) - }, - { + }), + this.mnuIconSets = new Common.UI.MenuItem({ caption : Common.define.conditionalData.textIconSets, type : Asc.c_oAscCFType.iconSet, menu : new Common.UI.Menu({ menuAlign : 'tl-tr', + style: 'min-width: auto;', items: [] }) - }, + }), {caption: '--'}, { caption : Common.define.conditionalData.textFormula, diff --git a/apps/spreadsheeteditor/main/index.html b/apps/spreadsheeteditor/main/index.html index b117371d5..77b37bf69 100644 --- a/apps/spreadsheeteditor/main/index.html +++ b/apps/spreadsheeteditor/main/index.html @@ -319,6 +319,7 @@ + diff --git a/apps/spreadsheeteditor/main/index_loader.html b/apps/spreadsheeteditor/main/index_loader.html index 8eb226bba..658170876 100644 --- a/apps/spreadsheeteditor/main/index_loader.html +++ b/apps/spreadsheeteditor/main/index_loader.html @@ -264,6 +264,7 @@ +