From fbc99d7b5e4c0fe14bd6c83e0fbbe7f1ebbc5846 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 24 Jun 2022 16:18:26 +0300 Subject: [PATCH 01/10] [SSE] For Bug 52363: add watch dialog --- .../main/app/controller/FormulaDialog.js | 15 +- .../main/app/template/Toolbar.template | 4 + .../main/app/template/WatchDialog.template | 27 +++ .../main/app/view/FormulaTab.js | 21 +- .../main/app/view/WatchDialog.js | 225 ++++++++++++++++++ 5 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/template/WatchDialog.template create mode 100644 apps/spreadsheeteditor/main/app/view/WatchDialog.js diff --git a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js index 29cf784bc..4d06df571 100644 --- a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js @@ -45,7 +45,8 @@ define([ 'spreadsheeteditor/main/app/collection/FormulaGroups', 'spreadsheeteditor/main/app/view/FormulaDialog', 'spreadsheeteditor/main/app/view/FormulaTab', - 'spreadsheeteditor/main/app/view/FormulaWizard' + 'spreadsheeteditor/main/app/view/FormulaWizard', + 'spreadsheeteditor/main/app/view/WatchDialog' ], function () { 'use strict'; @@ -80,7 +81,8 @@ define([ }, 'FormulaTab': { 'function:apply': this.applyFunction, - 'function:calculate': this.onCalculate + 'function:calculate': this.onCalculate, + 'function:watch': this.onWatch }, 'Toolbar': { 'function:apply': this.applyFunction, @@ -409,6 +411,15 @@ define([ } }, + onWatch: function() { + (new SSE.Views.WatchDialog({ + api: this.api, + handler: function(result) { + Common.NotificationCenter.trigger('edit:complete'); + }, + })).show(); + }, + sCategoryAll: 'All', sCategoryLast10: '10 last used', sCategoryLogical: 'Logical', diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 502449a0e..05a9fff2f 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -203,6 +203,10 @@
+
+ +
+
diff --git a/apps/spreadsheeteditor/main/app/template/WatchDialog.template b/apps/spreadsheeteditor/main/app/template/WatchDialog.template new file mode 100644 index 000000000..2c25cbf01 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/template/WatchDialog.template @@ -0,0 +1,27 @@ +
+
+ + + + + + + + + + +
+ + +
+ + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index 9d5b26d81..b13fd8c2c 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -69,6 +69,9 @@ define([ me.btnNamedRange.menu.on('item:click', function (menu, item, e) { me.fireEvent('function:namedrange', [menu, item, e]); }); + me.btnWatch.on('click', function(){ + me.fireEvent('function:watch'); + }); } return { options: {}, @@ -318,6 +321,20 @@ define([ }); this.lockedControls.push(this.btnNamedRange); + this.btnWatch = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-watch-window'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-lookup', + caption: this.txtWatch, + hint: this.tipWatch, + disabled: true, + lock: [_set.editText, _set.lostConnect, _set.coAuth], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnWatch); + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -577,7 +594,9 @@ define([ textCalculateCurrentSheet: 'Calculate current sheet', textAutomatic: 'Automatic', textManual: 'Manual', - tipCalculateTheEntireWorkbook: 'Calculate the entire workbook' + tipCalculateTheEntireWorkbook: 'Calculate the entire workbook', + txtWatch: 'Watch Window', + tipWatch: 'Add cells to the Watch Window list' } }()), SSE.Views.FormulaTab || {})); }); diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js new file mode 100644 index 000000000..76c392aca --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -0,0 +1,225 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2022 + * + * 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 + * +*/ +/** + * + * WatchDialogDialog.js + * + * Created by Julia.Radzhabova on 24.06.22 + * Copyright (c) 2022 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/ListView' +], function (contentTemplate) { + 'use strict'; + + SSE.Views = SSE.Views || {}; + + SSE.Views.WatchDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + + options: { + alias: 'WatchDialog', + contentWidth: 560, + height: 294, + buttons: null + }, + + 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.wrapEvents = { + onRefreshWatchList: _.bind(this.refreshList, this) + }; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + render: function () { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + this.watchList = new Common.UI.ListView({ + el: $('#watch-dialog-list', this.$window), + store: new Common.UI.DataViewStore(), + simpleAddMode: true, + itemTemplate: _.template([ + '
', + '
<%= Common.Utils.String.htmlEncode(book) %>
', + '
<%= Common.Utils.String.htmlEncode(sheet) %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', + '
<%= cell %>
', + '
<%= value %>
', + '
<%= formula %>
', + '
' + ].join('')), + tabindex: 1 + }); + this.watchList.on('item:select', _.bind(this.onSelectWatch, this)) + .on('item:keydown', _.bind(this.onKeyDown, this)); + + this.btnAdd = new Common.UI.Button({ + el: $('#watch-dialog-btn-add', this.$window) + }); + this.btnAdd.on('click', _.bind(this.onAddWatch, this, false)); + + this.btnDelete = new Common.UI.Button({ + el: $('#watch-dialog-btn-delete', this.$window) + }); + this.btnDelete.on('click', _.bind(this.onDeleteWatch, this)); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(); + }, + + getFocusedComponents: function() { + return [ this.btnAdd, this.btnDelete, this.watchList ]; + }, + + getDefaultFocusableComponent: function () { + return this.watchList; + }, + + _setDefaults: function (props) { + this.refreshList(); + this.api.asc_registerCallback('asc_onRefreshWatchList', this.wrapEvents.onRefreshWatchList); + }, + + refreshList: function() { + var arr = []; + var watches = this.api.asc_getCellWatches(); + if (watches) { + for (var i=0; i Date: Fri, 24 Jun 2022 17:41:37 +0300 Subject: [PATCH 02/10] [SSE] Refactoring watch dialog --- .../main/app/template/WatchDialog.template | 14 +++++++------- .../main/app/view/WatchDialog.js | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/WatchDialog.template b/apps/spreadsheeteditor/main/app/template/WatchDialog.template index 2c25cbf01..494666f0b 100644 --- a/apps/spreadsheeteditor/main/app/template/WatchDialog.template +++ b/apps/spreadsheeteditor/main/app/template/WatchDialog.template @@ -9,17 +9,17 @@ - - - - - - + -
+
diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 76c392aca..3e4645c28 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -89,12 +89,12 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', simpleAddMode: true, itemTemplate: _.template([ '
', - '
<%= Common.Utils.String.htmlEncode(book) %>
', - '
<%= Common.Utils.String.htmlEncode(sheet) %>
', - '
<%= Common.Utils.String.htmlEncode(name) %>
', - '
<%= cell %>
', - '
<%= value %>
', - '
<%= formula %>
', + '
<%= Common.Utils.String.htmlEncode(book) %>
', + '
<%= Common.Utils.String.htmlEncode(sheet) %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', + '
<%= cell %>
', + '
<%= value %>
', + '
<%= formula %>
', '
' ].join('')), tabindex: 1 @@ -129,7 +129,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', _setDefaults: function (props) { this.refreshList(); - this.api.asc_registerCallback('asc_onRefreshWatchList', this.wrapEvents.onRefreshWatchList); + this.api.asc_registerCallback('asc_onUpdateCellWatches', this.wrapEvents.onRefreshWatchList); }, refreshList: function() { @@ -185,7 +185,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', onDeleteWatch: function() { var rec = this.watchList.getSelectedRec(); if (rec) { - this.api.asc_deleteCellWatches(rec.get(props)); + this.api.asc_deleteCellWatches([rec.get('props')]); } this.refreshList(); }, @@ -205,7 +205,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', }, close: function () { - this.api.asc_unregisterCallback('asc_onRefreshWatchList', this.wrapEvents.onRefreshWatchList); + this.api.asc_unregisterCallback('asc_onUpdateCellWatches', this.wrapEvents.onRefreshWatchList); Common.Views.AdvancedSettingsWindow.prototype.close.call(this); }, From 5b0769f3263c4dbac1e79b66f1bb9b486e3f8d2c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 24 Jun 2022 17:50:28 +0300 Subject: [PATCH 03/10] [SSE] Fix current cell when watch is added --- apps/spreadsheeteditor/main/app/view/WatchDialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 3e4645c28..6ff13dae1 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -176,7 +176,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', win.show(xy.left + 65, xy.top + 77); win.setSettings({ api : me.api, - range : me.api.asc_getActiveRangeStr(Asc.referenceType.A), + range : me.api.asc_getWorksheetName(me.api.asc_getActiveWorksheetIndex()) + '!' + me.api.asc_getActiveRangeStr(Asc.referenceType.A), type : Asc.c_oAscSelectionDialogType.Chart }); } From 8be25036a9382742eb4f876e066c10417808c151 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 24 Jun 2022 22:37:11 +0300 Subject: [PATCH 04/10] [SSE] Set not-modal watch window --- .../main/app/controller/FormulaDialog.js | 23 +++++++++++++------ .../main/app/view/FormulaTab.js | 7 +++--- .../main/app/view/WatchDialog.js | 4 ++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js index 4d06df571..af5a1c710 100644 --- a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js @@ -411,13 +411,22 @@ define([ } }, - onWatch: function() { - (new SSE.Views.WatchDialog({ - api: this.api, - handler: function(result) { - Common.NotificationCenter.trigger('edit:complete'); - }, - })).show(); + onWatch: function(state) { + if (state) { + var me = this; + this._watchDlg = new SSE.Views.WatchDialog({ + api: this.api, + handler: function(result) { + Common.NotificationCenter.trigger('edit:complete'); + } + }); + this._watchDlg.on('close', function(win){ + me.formulaTab.btnWatch.toggle(false, true); + me._watchDlg = null; + }).show(); + } else if (this._watchDlg) + this._watchDlg.close(); + }, sCategoryAll: 'All', diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index b13fd8c2c..9225588a1 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -69,8 +69,8 @@ define([ me.btnNamedRange.menu.on('item:click', function (menu, item, e) { me.fireEvent('function:namedrange', [menu, item, e]); }); - me.btnWatch.on('click', function(){ - me.fireEvent('function:watch'); + me.btnWatch.on('click', function(b, e){ + me.fireEvent('function:watch', [b.pressed]); }); } return { @@ -328,7 +328,8 @@ define([ caption: this.txtWatch, hint: this.tipWatch, disabled: true, - lock: [_set.editText, _set.lostConnect, _set.coAuth], + enableToggle: true, + lock: [_set.editCell, _set.lostConnect, _set.coAuth], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 6ff13dae1..2424bc9a4 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -53,6 +53,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', alias: 'WatchDialog', contentWidth: 560, height: 294, + modal: false, buttons: null }, @@ -148,9 +149,8 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', props: watch }); } - this.watchList.store.reset(arr); } - + this.watchList.store.reset(arr); this.updateButtons(); }, From 70cc425501ebb7c07d1d89d80afc21a58522c98e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 24 Jun 2022 23:35:42 +0300 Subject: [PATCH 05/10] [SSE] Fix deleting cell watches --- .../main/app/view/WatchDialog.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 2424bc9a4..352beb215 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -151,6 +151,14 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', } } this.watchList.store.reset(arr); + if (this._deletedIndex!==undefined) { + var store = this.watchList.store; + (store.length>0) && this.watchList.selectByIndex(this._deletedIndex Date: Fri, 24 Jun 2022 23:39:01 +0300 Subject: [PATCH 06/10] Add translation --- apps/spreadsheeteditor/main/locale/en.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 330f73e23..538f6529b 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2415,6 +2415,8 @@ "SSE.Views.FormulaTab.txtFormulaTip": "Insert function", "SSE.Views.FormulaTab.txtMore": "More functions", "SSE.Views.FormulaTab.txtRecent": "Recently used", + "SSE.Views.FormulaTab.txtWatch": "Watch Window", + "SSE.Views.FormulaTab.tipWatch": "Add cells to the Watch Window list", "SSE.Views.FormulaWizard.textAny": "any", "SSE.Views.FormulaWizard.textArgument": "Argument", "SSE.Views.FormulaWizard.textFunction": "Function", @@ -3668,6 +3670,16 @@ "SSE.Views.ViewTab.tipCreate": "Create sheet view", "SSE.Views.ViewTab.tipFreeze": "Freeze panes", "SSE.Views.ViewTab.tipSheetView": "Sheet view", + "SSE.Views.WatchDialog.txtTitle": "Watch Window", + "SSE.Views.WatchDialog.textAdd": "Add watch", + "SSE.Views.WatchDialog.textDelete": "Delete watch", + "SSE.Views.WatchDialog.closeButtonText": "Close", + "SSE.Views.WatchDialog.textBook": "Book", + "SSE.Views.WatchDialog.textSheet": "Sheet", + "SSE.Views.WatchDialog.textName": "Name", + "SSE.Views.WatchDialog.textCell": "Cell", + "SSE.Views.WatchDialog.textValue": "Value", + "SSE.Views.WatchDialog.textFormula": "Formula", "SSE.Views.WBProtection.hintAllowRanges": "Allow edit ranges", "SSE.Views.WBProtection.hintProtectSheet": "Protect sheet", "SSE.Views.WBProtection.hintProtectWB": "Protect workbook", From c5669995c6d738152adf80e5357f4492285aab31 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 29 Jun 2022 16:42:12 +0300 Subject: [PATCH 07/10] [SSE] Add warning when add cell watches --- .../main/app/controller/Main.js | 16 +++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index c7afb469b..111e44062 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -2344,6 +2344,18 @@ define([ } }); win.show(); + } else if (id == Asc.c_oAscConfirm.ConfirmAddCellWatches) { + Common.UI.warning({ + title: this.notcriticalErrorTitle, + msg: Common.Utils.String.format(this.confirmAddCellWatches, data), + buttons: ['yes', 'no'], + primary: 'yes', + callback: _.bind(function(btn) { + if (apiCallback) { + apiCallback(btn === 'yes'); + } + }, this) + }); } }, @@ -3598,7 +3610,9 @@ define([ textReconnect: 'Connection is restored', errorCannotUseCommandProtectedSheet: 'You cannot use this command on a protected sheet. To use this command, unprotect the sheet.
You might be requested to enter a password.', textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?', - textRememberMacros: 'Remember my choice for all macros' + textRememberMacros: 'Remember my choice for all macros', + confirmAddCellWatches: 'This action will add {0} cell watches.
Do you want to continue?' + } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 538f6529b..9f3ffba6c 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1105,6 +1105,7 @@ "SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.confirmAddCellWatches": "This action will add {0} cell watches.
Do you want to continue?", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", From 0800af0484c921a3926676ef8ed2f626cc8f1312 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 29 Jun 2022 18:21:21 +0300 Subject: [PATCH 08/10] [SSE] Limit for cell watches --- apps/spreadsheeteditor/main/app/controller/Main.js | 5 +++-- apps/spreadsheeteditor/main/locale/en.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 111e44062..938646c09 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -2347,7 +2347,7 @@ define([ } else if (id == Asc.c_oAscConfirm.ConfirmAddCellWatches) { Common.UI.warning({ title: this.notcriticalErrorTitle, - msg: Common.Utils.String.format(this.confirmAddCellWatches, data), + msg: (data>Asc.c_nAscMaxAddCellWatchesCount) ? Common.Utils.String.format(this.confirmAddCellWatchesMax, Asc.c_nAscMaxAddCellWatchesCount) : Common.Utils.String.format(this.confirmAddCellWatches, data), buttons: ['yes', 'no'], primary: 'yes', callback: _.bind(function(btn) { @@ -3611,7 +3611,8 @@ define([ errorCannotUseCommandProtectedSheet: 'You cannot use this command on a protected sheet. To use this command, unprotect the sheet.
You might be requested to enter a password.', textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?', textRememberMacros: 'Remember my choice for all macros', - confirmAddCellWatches: 'This action will add {0} cell watches.
Do you want to continue?' + confirmAddCellWatches: 'This action will add {0} cell watches.
Do you want to continue?', + confirmAddCellWatchesMax: 'This action will add only {0} cell watches by memory save reason. Do you want to continue?' } })(), SSE.Controllers.Main || {})) diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 9f3ffba6c..f83552b51 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1106,6 +1106,7 @@ "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.confirmAddCellWatches": "This action will add {0} cell watches.
Do you want to continue?", + "SSE.Controllers.Main.confirmAddCellWatchesMax": "This action will add only {0} cell watches by memory save reason. Do you want to continue?", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", From 9475364cfbffb8b1a33b0170a8e3cb2e6174c9ee Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 29 Jun 2022 20:24:40 +0300 Subject: [PATCH 09/10] [SSE] Remove all cell watches --- apps/common/main/resources/less/buttons.less | 4 +++ .../main/app/controller/Main.js | 2 +- .../main/app/template/WatchDialog.template | 14 +++++----- .../main/app/view/WatchDialog.js | 28 +++++++++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 3 +- apps/spreadsheeteditor/main/locale/ru.json | 3 ++ 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index 4540fadef..1f98dfd8b 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -874,6 +874,10 @@ border: @scaled-one-px-value solid @border-regular-control; .border-radius(@border-radius-small); + &.auto { + width: auto; + } + &.dropdown-toggle { width: 13px; } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 938646c09..1d7c28099 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -3612,7 +3612,7 @@ define([ textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?', textRememberMacros: 'Remember my choice for all macros', confirmAddCellWatches: 'This action will add {0} cell watches.
Do you want to continue?', - confirmAddCellWatchesMax: 'This action will add only {0} cell watches by memory save reason. Do you want to continue?' + confirmAddCellWatchesMax: 'This action will add only {0} cell watches by memory save reason.
Do you want to continue?' } })(), SSE.Controllers.Main || {})) diff --git a/apps/spreadsheeteditor/main/app/template/WatchDialog.template b/apps/spreadsheeteditor/main/app/template/WatchDialog.template index 494666f0b..d9dfe4296 100644 --- a/apps/spreadsheeteditor/main/app/template/WatchDialog.template +++ b/apps/spreadsheeteditor/main/app/template/WatchDialog.template @@ -4,17 +4,17 @@ - +
- + diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 352beb215..61ecae435 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -109,10 +109,26 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', this.btnAdd.on('click', _.bind(this.onAddWatch, this, false)); this.btnDelete = new Common.UI.Button({ - el: $('#watch-dialog-btn-delete', this.$window) + parentEl: $('#watch-dialog-btn-delete', this.$window), + cls: 'btn-text-split-default auto', + caption: this.textDelete, + split: true, + menu : new Common.UI.Menu({ + style: 'min-width:100px;', + items: [ + { + caption: this.textDelete, + value: 0 + }, + { + caption: this.textDeleteAll, + value: 1 + }] + }) }); + $(this.btnDelete.cmpEl.find('button')[0]).css('min-width', '87px'); this.btnDelete.on('click', _.bind(this.onDeleteWatch, this)); - + this.btnDelete.menu.on('item:click', _.bind(this.onDeleteMenu, this)); this.afterRender(); }, @@ -197,6 +213,13 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', } }, + onDeleteMenu: function(menu, item) { + if (item.value == 1) { + this.api.asc_deleteCellWatches(undefined, true); + } else + this.onDeleteWatch(); + }, + onSelectWatch: function(lisvView, itemView, record) { this.updateButtons(); }, @@ -222,6 +245,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', txtTitle: 'Watch Window', textAdd: 'Add watch', textDelete: 'Delete watch', + textDeleteAll: 'Delete all', closeButtonText: 'Close', textBook: 'Book', textSheet: 'Sheet', diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index f83552b51..7cbbc188e 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1106,7 +1106,7 @@ "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.confirmAddCellWatches": "This action will add {0} cell watches.
Do you want to continue?", - "SSE.Controllers.Main.confirmAddCellWatchesMax": "This action will add only {0} cell watches by memory save reason. Do you want to continue?", + "SSE.Controllers.Main.confirmAddCellWatchesMax": "This action will add only {0} cell watches by memory save reason.
Do you want to continue?", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", @@ -3675,6 +3675,7 @@ "SSE.Views.WatchDialog.txtTitle": "Watch Window", "SSE.Views.WatchDialog.textAdd": "Add watch", "SSE.Views.WatchDialog.textDelete": "Delete watch", + "SSE.Views.WatchDialog.textDeleteAll": "Delete all", "SSE.Views.WatchDialog.closeButtonText": "Close", "SSE.Views.WatchDialog.textBook": "Book", "SSE.Views.WatchDialog.textSheet": "Sheet", diff --git a/apps/spreadsheeteditor/main/locale/ru.json b/apps/spreadsheeteditor/main/locale/ru.json index b284af0d7..bd27c2476 100644 --- a/apps/spreadsheeteditor/main/locale/ru.json +++ b/apps/spreadsheeteditor/main/locale/ru.json @@ -3664,6 +3664,9 @@ "SSE.Views.ViewTab.tipCreate": "Создать представление листа", "SSE.Views.ViewTab.tipFreeze": "Закрепить области", "SSE.Views.ViewTab.tipSheetView": "Представление листа", + "SSE.Views.WatchDialog.textAdd": "Добавить контрольное значение", + "SSE.Views.WatchDialog.textDelete": "Удалить контрольное значение", + "SSE.Views.WatchDialog.textDeleteAll": "Удалить все", "SSE.Views.WBProtection.hintAllowRanges": "Разрешить редактировать диапазоны", "SSE.Views.WBProtection.hintProtectSheet": "Защитить лист", "SSE.Views.WBProtection.hintProtectWB": "Защитить книгу", From faf7c75f6e864af9ffefffc096d2a232463b84e7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 1 Jul 2022 13:57:19 +0300 Subject: [PATCH 10/10] [SSE] Update watches list --- .../main/app/view/WatchDialog.js | 72 ++++++++++++------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 61ecae435..34cb911c1 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -149,33 +149,55 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', this.api.asc_registerCallback('asc_onUpdateCellWatches', this.wrapEvents.onRefreshWatchList); }, - refreshList: function() { - var arr = []; - var watches = this.api.asc_getCellWatches(); - if (watches) { - for (var i=0; i=0 && index0) && this.watchList.selectByIndex(this._deletedIndex0) && this.watchList.selectByIndex(this._deletedIndex