diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js
index c09d9ac0d..5fe81fb6b 100644
--- a/apps/spreadsheeteditor/main/app/controller/DataTab.js
+++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js
@@ -43,7 +43,8 @@ define([
'core',
'spreadsheeteditor/main/app/view/DataTab',
'spreadsheeteditor/main/app/view/GroupDialog',
- 'spreadsheeteditor/main/app/view/SortDialog'
+ 'spreadsheeteditor/main/app/view/SortDialog',
+ 'spreadsheeteditor/main/app/view/RemoveDuplicatesDialog'
], function () {
'use strict';
@@ -88,7 +89,8 @@ define([
'data:show': this.onShowClick,
'data:hide': this.onHideClick,
'data:groupsettings': this.onGroupSettings,
- 'data:sortcustom': this.onCustomSort
+ 'data:sortcustom': this.onCustomSort,
+ 'data:remduplicates': this.onRemoveDuplicates
},
'Statusbar': {
'sheet:changed': this.onApiSheetChanged
@@ -258,6 +260,49 @@ define([
}
},
+ onRemoveDuplicates: function() {
+ var me = this;
+ if (this.api) {
+ var res = this.api.asc_sortCellsRangeExpand();
+ if (res) {
+ var config = {
+ width: 500,
+ title: this.txtRemDuplicates,
+ msg: this.txtExpandRemDuplicates,
+
+ buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
+ {caption: this.txtRemSelected, primary: true, value: 'remove'},
+ 'cancel'],
+ callback: function(btn){
+ if (btn == 'expand' || btn == 'remove') {
+ setTimeout(function(){
+ me.showRemDuplicates(btn == 'expand');
+ },1);
+ }
+ }
+ };
+ Common.UI.alert(config);
+ } else
+ me.showRemDuplicates(res !== null);
+ }
+ },
+
+ showRemDuplicates: function(expand) {
+ var me = this,
+ props = me.api.asc_getRemoveDuplicates(expand);
+ if (props) {
+ (new SSE.Views.RemoveDuplicatesDialog({
+ props: props,
+ api: me.api,
+ handler: function (result, settings) {
+ if (me && me.api) {
+ me.api.asc_setRemoveDuplicates(settings, result != 'ok');
+ }
+ }
+ })).show();
+ }
+ },
+
onWorksheetLocked: function(index,locked) {
if (index == this.api.asc_getActiveWorksheetIndex()) {
Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
@@ -271,7 +316,11 @@ define([
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));
},
- textWizard: 'Text to Columns Wizard'
+ textWizard: 'Text to Columns Wizard',
+ txtRemDuplicates: 'Remove Duplicates',
+ txtExpandRemDuplicates: 'The data next to the selection will not be removed. Do you want to expand the selection to include the adjacent data or continue with the currently selected cells only?',
+ txtExpand: 'Expand',
+ txtRemSelected: 'Remove in selected'
}, SSE.Controllers.DataTab || {}));
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template
index 0cc1fe7b9..958f2d26d 100644
--- a/apps/spreadsheeteditor/main/app/template/Toolbar.template
+++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template
@@ -205,6 +205,7 @@
+
diff --git a/apps/spreadsheeteditor/main/app/view/DataTab.js b/apps/spreadsheeteditor/main/app/view/DataTab.js
index 5b2f59a8d..9475023bd 100644
--- a/apps/spreadsheeteditor/main/app/view/DataTab.js
+++ b/apps/spreadsheeteditor/main/app/view/DataTab.js
@@ -66,6 +66,9 @@ define([
me.btnTextToColumns.on('click', function (b, e) {
me.fireEvent('data:tocolumns');
});
+ me.btnRemoveDuplicates.on('click', function (b, e) {
+ me.fireEvent('data:remduplicates');
+ });
// isn't used for awhile
// me.btnShow.on('click', function (b, e) {
// me.fireEvent('data:show');
@@ -166,6 +169,16 @@ define([
// Common.Utils.injectComponent($host.find('#slot-btn-hide-details'), this.btnHide);
// this.lockedControls.push(this.btnHide);
+ this.btnRemoveDuplicates = new Common.UI.Button({
+ cls: 'btn-toolbar x-huge icon-top',
+ iconCls: 'toolbar__icon btn-custom-sort',
+ caption: this.capBtnTextRemDuplicates,
+ disabled: true,
+ lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter, _set.sheetLock]
+ });
+ Common.Utils.injectComponent($host.find('#slot-btn-rem-duplicates'), this.btnRemoveDuplicates);
+ this.lockedControls.push(this.btnRemoveDuplicates);
+
this.btnCustomSort = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-custom-sort',
@@ -226,6 +239,7 @@ define([
me.btnGroup.setMenu(_menu);
me.btnTextToColumns.updateHint(me.tipToColumns);
+ me.btnRemoveDuplicates.updateHint(me.tipRemDuplicates);
me.btnsSortDown.forEach( function(btn) {
btn.updateHint(me.toolbar.txtSortAZ);
@@ -290,7 +304,9 @@ define([
textBelow: 'Summary rows below detail',
textRightOf: 'Summary columns to right of detail',
capBtnTextCustomSort: 'Custom Sort',
- tipCustomSort: 'Custom sort'
+ tipCustomSort: 'Custom sort',
+ capBtnTextRemDuplicates: 'Remove Duplicates',
+ tipRemDuplicates: 'Remove duplicate rows from a sheet'
}
}()), SSE.Views.DataTab || {}));
});
diff --git a/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js b/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js
new file mode 100644
index 000000000..4e476bd2c
--- /dev/null
+++ b/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js
@@ -0,0 +1,303 @@
+/*
+ *
+ * (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
+ *
+ */
+/**
+ * RemoveDuplicatesDialog.js
+ *
+ * Created by Julia Radzhabova on 07.04.2020
+ * Copyright (c) 2020 Ascensio System SIA. All rights reserved.
+ *
+ */
+
+define([
+ 'common/main/lib/component/Window',
+ 'common/main/lib/component/ComboBox',
+ 'common/main/lib/component/ListView'
+], function () {
+ 'use strict';
+
+ SSE.Views.RemoveDuplicatesDialog = Common.UI.Window.extend(_.extend({
+ options: {
+ width: 350,
+ style: 'min-width: 230px;',
+ cls: 'modal-dlg',
+ buttons: ['ok', 'cancel']
+ },
+
+ initialize : function (options) {
+ var t = this,
+ _options = {};
+
+ _.extend(this.options, {
+ title: this.txtTitle
+ }, options || {});
+
+ this.template = [
+ '