Merge pull request #180 from ONLYOFFICE/feature/sse-data-tab
Feature/sse data tab
This commit is contained in:
commit
2303266c74
|
@ -781,6 +781,45 @@ Common.Utils.InternalSettings = new(function() {
|
|||
}
|
||||
});
|
||||
|
||||
Common.Utils.lockControls = function(causes, lock, opts, defControls) {
|
||||
!opts && (opts = {});
|
||||
|
||||
var controls = opts.array || defControls;
|
||||
opts.merge && (controls = _.union(defControls,controls));
|
||||
|
||||
function doLock(cmp, cause) {
|
||||
if ( cmp && _.contains(cmp.options.lock, cause) ) {
|
||||
var index = cmp.keepState.indexOf(cause);
|
||||
if (lock) {
|
||||
if (index < 0) {
|
||||
cmp.keepState.push(cause);
|
||||
}
|
||||
} else {
|
||||
if (!(index < 0)) {
|
||||
cmp.keepState.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_.each(controls, function(item) {
|
||||
if (item && _.isFunction(item.setDisabled)) {
|
||||
!item.keepState && (item.keepState = []);
|
||||
if (opts.clear && opts.clear.length > 0 && item.keepState.length > 0) {
|
||||
item.keepState = _.difference(item.keepState, opts.clear);
|
||||
}
|
||||
|
||||
_.isArray(causes) ? _.each(causes, function(c) {doLock(item, c)}) : doLock(item, causes);
|
||||
|
||||
if (!(item.keepState.length > 0)) {
|
||||
item.isDisabled() && item.setDisabled(false);
|
||||
} else {
|
||||
!item.isDisabled() && item.setDisabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Common.Utils.InternalSettings.set('toolbar-height-tabs', 32);
|
||||
Common.Utils.InternalSettings.set('toolbar-height-tabs-top-title', 28);
|
||||
Common.Utils.InternalSettings.set('toolbar-height-controls', 67);
|
||||
|
|
|
@ -426,6 +426,7 @@ define([
|
|||
|
||||
onCmbDelimiterSelect: function(combo, record){
|
||||
this.inputDelimiter.setVisible(record.value == -1);
|
||||
(record.value == -1) && this.inputDelimiter.cmpEl.find('input').focus();
|
||||
if (this.preview)
|
||||
this.updatePreview();
|
||||
},
|
||||
|
|
|
@ -833,42 +833,7 @@ define([
|
|||
},
|
||||
|
||||
lockControls: function(causes, lock, opts) {
|
||||
!opts && (opts = {});
|
||||
|
||||
var controls = opts.array || this.emptyDBControls;
|
||||
opts.merge && (controls = _.union(this.emptyDBControls,controls));
|
||||
|
||||
function doLock(cmp, cause) {
|
||||
if ( _.contains(cmp.options.lock, cause) ) {
|
||||
var index = cmp.keepState.indexOf(cause);
|
||||
if (lock) {
|
||||
if (index < 0) {
|
||||
cmp.keepState.push(cause);
|
||||
}
|
||||
} else {
|
||||
if (!(index < 0)) {
|
||||
cmp.keepState.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_.each(controls, function(item) {
|
||||
if (_.isFunction(item.setDisabled)) {
|
||||
!item.keepState && (item.keepState = []);
|
||||
if (opts.clear && opts.clear.length > 0 && item.keepState.length > 0) {
|
||||
item.keepState = _.difference(item.keepState, opts.clear);
|
||||
}
|
||||
|
||||
_.isArray(causes) ? _.each(causes, function(c) {doLock(item, c)}) : doLock(item, causes);
|
||||
|
||||
if (!(item.keepState.length > 0)) {
|
||||
item.isDisabled() && item.setDisabled(false);
|
||||
} else {
|
||||
!item.isDisabled() && item.setDisabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
Common.Utils.lockControls(causes, lock, opts, this.emptyDBControls);
|
||||
},
|
||||
|
||||
textDataSource: 'Data Source',
|
||||
|
|
|
@ -826,44 +826,7 @@ define([
|
|||
},
|
||||
|
||||
lockToolbar: function (causes, lock, opts) {
|
||||
!opts && (opts = {});
|
||||
|
||||
var controls = opts.array || this.lockControls;
|
||||
opts.merge && (controls = _.union(this.lockControls, controls));
|
||||
|
||||
function doLock(cmp, cause) {
|
||||
if (_.contains(cmp.options.lock, cause)) {
|
||||
var index = cmp.keepState.indexOf(cause);
|
||||
if (lock) {
|
||||
if (index < 0) {
|
||||
cmp.keepState.push(cause);
|
||||
}
|
||||
} else {
|
||||
if (!(index < 0)) {
|
||||
cmp.keepState.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_.each(controls, function (item) {
|
||||
if (_.isFunction(item.setDisabled)) {
|
||||
!item.keepState && (item.keepState = []);
|
||||
if (opts.clear && opts.clear.length > 0 && item.keepState.length > 0) {
|
||||
item.keepState = _.difference(item.keepState, opts.clear);
|
||||
}
|
||||
|
||||
_.isArray(causes) ? _.each(causes, function (c) {
|
||||
doLock(item, c)
|
||||
}) : doLock(item, causes);
|
||||
|
||||
if (!(item.keepState.length > 0)) {
|
||||
item.isDisabled() && item.setDisabled(false);
|
||||
} else {
|
||||
!item.isDisabled() && item.setDisabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
Common.Utils.lockControls(causes, lock, opts, this.lockControls);
|
||||
},
|
||||
|
||||
render: function (mode) {
|
||||
|
|
|
@ -156,6 +156,7 @@ require([
|
|||
'LeftMenu',
|
||||
'Main',
|
||||
'PivotTable',
|
||||
'DataTab',
|
||||
'Common.Controllers.Fonts',
|
||||
'Common.Controllers.Chat',
|
||||
'Common.Controllers.Comments',
|
||||
|
@ -178,6 +179,7 @@ require([
|
|||
'spreadsheeteditor/main/app/controller/Main',
|
||||
'spreadsheeteditor/main/app/controller/Print',
|
||||
'spreadsheeteditor/main/app/controller/PivotTable',
|
||||
'spreadsheeteditor/main/app/controller/DataTab',
|
||||
'spreadsheeteditor/main/app/view/FileMenuPanels',
|
||||
'spreadsheeteditor/main/app/view/ParagraphSettings',
|
||||
'spreadsheeteditor/main/app/view/ImageSettings',
|
||||
|
|
198
apps/spreadsheeteditor/main/app/controller/DataTab.js
Normal file
198
apps/spreadsheeteditor/main/app/controller/DataTab.js
Normal file
|
@ -0,0 +1,198 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* DataTab.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 30.05.2019
|
||||
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'core',
|
||||
'spreadsheeteditor/main/app/view/DataTab',
|
||||
'spreadsheeteditor/main/app/view/GroupDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
SSE.Controllers.DataTab = Backbone.Controller.extend(_.extend({
|
||||
models : [],
|
||||
collections : [
|
||||
],
|
||||
views : [
|
||||
'DataTab'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
|
||||
initialize: function () {
|
||||
|
||||
this.addListeners({
|
||||
'DataTab': {
|
||||
'data:group': this.onGroup,
|
||||
'data:ungroup': this.onUngroup,
|
||||
'data:tocolumns': this.onTextToColumn,
|
||||
'data:show': this.onShowClick,
|
||||
'data:hide': this.onHideClick
|
||||
}
|
||||
});
|
||||
|
||||
this._state = {
|
||||
CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '')
|
||||
};
|
||||
},
|
||||
onLaunch: function () {
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
if (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setConfig: function(config) {
|
||||
this.toolbar = config.toolbar;
|
||||
this.view = this.createView('DataTab', {
|
||||
toolbar: this.toolbar.toolbar
|
||||
});
|
||||
},
|
||||
|
||||
SetDisabled: function(state) {
|
||||
this.view && this.view.SetDisabled(state);
|
||||
},
|
||||
|
||||
getView: function(name) {
|
||||
return !name && this.view ?
|
||||
this.view : Backbone.Controller.prototype.getView.call(this, name);
|
||||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.SetDisabled(true);
|
||||
},
|
||||
|
||||
onSelectionChanged: function(info) {
|
||||
if (!this.toolbar.editMode || !this.view) return;
|
||||
|
||||
// special disable conditions
|
||||
Common.Utils.lockControls(SSE.enumLock.multiselectCols, info.asc_getSelectedColsCount()>1, {array: [this.view.btnTextToColumns]});
|
||||
Common.Utils.lockControls(SSE.enumLock.multiselect, info.asc_getFlags().asc_getMultiselect(), {array: [this.view.btnTextToColumns]});
|
||||
},
|
||||
|
||||
onUngroup: function(type) {
|
||||
var me = this;
|
||||
if (type=='rows') {
|
||||
(me.api.asc_checkAddGroup(true)!==undefined) && me.api.asc_ungroup(true)
|
||||
} else if (type=='columns') {
|
||||
(me.api.asc_checkAddGroup(true)!==undefined) && me.api.asc_ungroup(false)
|
||||
} else if (type=='clear') {
|
||||
me.api.asc_clearOutline();
|
||||
} else {
|
||||
var val = me.api.asc_checkAddGroup(true);
|
||||
if (val===null) {
|
||||
(new SSE.Views.GroupDialog({
|
||||
title: me.view.capBtnUngroup,
|
||||
props: 'rows',
|
||||
handler: function (dlg, result) {
|
||||
if (result=='ok') {
|
||||
me.api.asc_ungroup(dlg.getSettings());
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
}
|
||||
})).show();
|
||||
} else if (val!==undefined) //undefined - error, true - rows, false - columns
|
||||
me.api.asc_ungroup(val);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
},
|
||||
|
||||
onGroup: function(btn) {
|
||||
var me = this,
|
||||
val = me.api.asc_checkAddGroup();
|
||||
if (val===null) {
|
||||
(new SSE.Views.GroupDialog({
|
||||
title: me.view.capBtnGroup,
|
||||
props: 'rows',
|
||||
handler: function (dlg, result) {
|
||||
if (result=='ok') {
|
||||
me.api.asc_group(dlg.getSettings());
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
}
|
||||
})).show();
|
||||
} else if (val!==undefined) //undefined - error, true - rows, false - columns
|
||||
me.api.asc_group(val);
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
},
|
||||
|
||||
onTextToColumn: function() {
|
||||
this.api.asc_TextImport(this._state.CSVOptions, _.bind(this.onTextToColumnCallback, this), false);
|
||||
},
|
||||
|
||||
onTextToColumnCallback: function(data) {
|
||||
if (!data || !data.length) return;
|
||||
|
||||
var me = this;
|
||||
(new Common.Views.OpenDialog({
|
||||
title: me.textWizard,
|
||||
closable: true,
|
||||
type: Common.Utils.importTextType.Columns,
|
||||
preview: true,
|
||||
previewData: data,
|
||||
settings: me._state.CSVOptions,
|
||||
api: me.api,
|
||||
handler: function (result, encoding, delimiter, delimiterChar) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_TextToColumns(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
|
||||
}
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
onShowClick: function() {
|
||||
this.api.asc_changeGroupDetails(true);
|
||||
},
|
||||
|
||||
onHideClick: function() {
|
||||
this.api.asc_changeGroupDetails(false);
|
||||
},
|
||||
|
||||
textWizard: 'Text to Columns Wizard'
|
||||
|
||||
}, SSE.Controllers.DataTab || {}));
|
||||
});
|
|
@ -1358,6 +1358,10 @@ define([
|
|||
config.msg = this.errorNoDataToParse;
|
||||
break;
|
||||
|
||||
case Asc.c_oAscError.ID.CannotUngroupError:
|
||||
config.msg = this.errorCannotUngroup;
|
||||
break;
|
||||
|
||||
default:
|
||||
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
||||
break;
|
||||
|
@ -2356,6 +2360,7 @@ define([
|
|||
txtTable: 'Table',
|
||||
textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.',
|
||||
errorNoDataToParse: 'No data was selected to parse.',
|
||||
errorCannotUngroup: 'Cannot ungroup. To start an outline, select the detail rows or columns and group them.',
|
||||
waitText: 'Please, wait...'
|
||||
}
|
||||
})(), SSE.Controllers.Main || {}))
|
||||
|
|
|
@ -118,6 +118,11 @@ define([
|
|||
'go:editor': function() {
|
||||
Common.Gateway.requestEditRights();
|
||||
}
|
||||
},
|
||||
'DataTab': {
|
||||
'data:sort': this.onSortType,
|
||||
'data:setfilter': this.onAutoFilter,
|
||||
'data:clearfilter': this.onClearFilter
|
||||
}
|
||||
});
|
||||
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
|
||||
|
@ -312,14 +317,6 @@ define([
|
|||
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
|
||||
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
|
||||
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
|
||||
toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
|
||||
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
|
||||
toolbar.mnuitemSortAZ.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
|
||||
toolbar.mnuitemSortZA.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
|
||||
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
|
||||
toolbar.mnuitemAutoFilter.on('click', _.bind(this.onAutoFilter, this));
|
||||
toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this));
|
||||
toolbar.mnuitemClearFilter.on('click', _.bind(this.onClearFilter, this));
|
||||
toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this));
|
||||
toolbar.btnPercentStyle.on('click', _.bind(this.onNumberFormat, this));
|
||||
toolbar.btnCurrencyStyle.on('click', _.bind(this.onNumberFormat, this));
|
||||
|
@ -1679,7 +1676,6 @@ define([
|
|||
toolbar.btnClearStyle.menu.items[2],
|
||||
toolbar.btnClearStyle.menu.items[3],
|
||||
toolbar.btnClearStyle.menu.items[4],
|
||||
toolbar.mnuitemClearFilter,
|
||||
toolbar.btnNamedRange.menu.items[0],
|
||||
toolbar.btnNamedRange.menu.items[1]
|
||||
],
|
||||
|
@ -2192,14 +2188,14 @@ define([
|
|||
|
||||
val = (filterInfo) ? filterInfo.asc_getIsAutoFilter() : null;
|
||||
if (this._state.filter !== val) {
|
||||
toolbar.btnSetAutofilter.toggle(val===true, true);
|
||||
toolbar.mnuitemAutoFilter.setChecked(val===true, true);
|
||||
toolbar.btnsSetAutofilter.forEach(function(button) {
|
||||
button.toggle(val===true, true);
|
||||
});
|
||||
this._state.filter = val;
|
||||
}
|
||||
need_disable = this._state.controlsdisabled.filters || (val===null);
|
||||
toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
||||
{ array: [toolbar.btnSortDown, toolbar.btnSortUp, toolbar.mnuitemSortAZ, toolbar.mnuitemSortZA,
|
||||
toolbar.btnTableTemplate,toolbar.btnSetAutofilter,toolbar.mnuitemAutoFilter,toolbar.btnAutofilter] });
|
||||
{ array: [toolbar.btnTableTemplate].concat(toolbar.btnsSetAutofilter).concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp) });
|
||||
|
||||
val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null;
|
||||
if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) {
|
||||
|
@ -2214,7 +2210,7 @@ define([
|
|||
}
|
||||
|
||||
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
||||
toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array:[toolbar.btnClearAutofilter,toolbar.mnuitemClearFilter]});
|
||||
toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: toolbar.btnsClearAutofilter});
|
||||
|
||||
var old_name = this._state.tablename;
|
||||
this._state.tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined;
|
||||
|
@ -2229,11 +2225,10 @@ define([
|
|||
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]});
|
||||
|
||||
this._state.inpivot = !!info.asc_getPivotTableInfo();
|
||||
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: [toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnSetAutofilter, toolbar.btnClearAutofilter, toolbar.btnSortDown, toolbar.btnSortUp, toolbar.btnAutofilter]});
|
||||
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: [toolbar.btnMerge, toolbar.btnInsertHyperlink].concat(toolbar.btnsSetAutofilter).concat(toolbar.btnsClearAutofilter).concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp)});
|
||||
|
||||
need_disable = !this.appConfig.canModifyFilter;
|
||||
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: [toolbar.btnSortDown, toolbar.btnSortUp, toolbar.mnuitemSortAZ, toolbar.mnuitemSortZA, toolbar.btnSetAutofilter,
|
||||
toolbar.btnAutofilter, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2] ]});
|
||||
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: [toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2] ].concat(toolbar.btnsSetAutofilter).concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp)});
|
||||
|
||||
}
|
||||
|
||||
|
@ -2424,16 +2419,15 @@ define([
|
|||
val = filterInfo ? filterInfo.asc_getIsAutoFilter() : null;
|
||||
if ( this._state.filter !== val ) {
|
||||
me.toolbar.btnSetAutofilter.toggle(val===true, true);
|
||||
// toolbar.mnuitemAutoFilter.setChecked(val===true, true);
|
||||
this._state.filter = val;
|
||||
}
|
||||
|
||||
need_disable = this._state.controlsdisabled.filters || (val===null);
|
||||
me.toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
||||
{ array: [me.toolbar.btnSortDown, me.toolbar.btnSortUp, me.toolbar.btnSetAutofilter] });
|
||||
{ array: [me.toolbar.btnSetAutofilter, me.toolbar.btnSortDown, me.toolbar.btnSortUp] });
|
||||
|
||||
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
||||
me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array:[me.toolbar.btnClearAutofilter]});
|
||||
me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2882,11 +2876,7 @@ define([
|
|||
toolbar.btnClearStyle.menu.items[1],
|
||||
toolbar.btnClearStyle.menu.items[2],
|
||||
toolbar.btnClearStyle.menu.items[3],
|
||||
toolbar.btnClearStyle.menu.items[4],
|
||||
toolbar.mnuitemSortAZ,
|
||||
toolbar.mnuitemSortZA,
|
||||
toolbar.mnuitemAutoFilter,
|
||||
toolbar.mnuitemClearFilter
|
||||
toolbar.btnClearStyle.menu.items[4]
|
||||
],
|
||||
merge: true,
|
||||
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
|
||||
|
@ -3104,11 +3094,21 @@ define([
|
|||
me.toolbar.setApi(me.api);
|
||||
|
||||
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
|
||||
var datatab = me.getApplication().getController('DataTab');
|
||||
datatab.setApi(me.api).setConfig({toolbar: me});
|
||||
|
||||
datatab = datatab.getView('DataTab');
|
||||
Array.prototype.push.apply(me.toolbar.lockControls, datatab.getButtons());
|
||||
me.toolbar.btnsSortDown = datatab.getButtons('sort-down');
|
||||
me.toolbar.btnsSortUp = datatab.getButtons('sort-up');
|
||||
me.toolbar.btnsSetAutofilter = datatab.getButtons('set-filter');
|
||||
me.toolbar.btnsClearAutofilter = datatab.getButtons('clear-filter');
|
||||
|
||||
if ( !config.isOffline ) {
|
||||
tab = {action: 'pivot', caption: me.textPivot};
|
||||
$panel = me.getApplication().getController('PivotTable').createToolbarPanel();
|
||||
if ($panel) {
|
||||
me.toolbar.addTab(tab, $panel, 3);
|
||||
me.toolbar.addTab(tab, $panel, 4);
|
||||
me.toolbar.setVisible('pivot', true);
|
||||
}
|
||||
}
|
||||
|
@ -3116,7 +3116,7 @@ define([
|
|||
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
|
||||
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
|
||||
if ( $panel )
|
||||
me.toolbar.addTab(tab, $panel, 4);
|
||||
me.toolbar.addTab(tab, $panel, 5);
|
||||
|
||||
if (!(config.customization && config.customization.compactHeader)) {
|
||||
// hide 'print' and 'save' buttons group and next separator
|
||||
|
@ -3135,7 +3135,7 @@ define([
|
|||
tab = {action: 'protect', caption: me.toolbar.textTabProtect};
|
||||
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
|
||||
if ($panel)
|
||||
me.toolbar.addTab(tab, $panel, 5);
|
||||
me.toolbar.addTab(tab, $panel, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,15 +60,5 @@
|
|||
<div id="cell-spin-angle" style="display: inline-block;margin-left:5px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<button type="button" class="btn btn-text-default" id="cell-btn-text-to-column" style="width:100%;"><%= scope.textTextToColumn %></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="finish-cell"></tr>
|
||||
</table>
|
|
@ -76,12 +76,12 @@
|
|||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-sortdesc"></span>
|
||||
<span class="btn-slot" id="slot-btn-sortasc"></span>
|
||||
<span class="btn-slot split slot-sortdesc"></span>
|
||||
<span class="btn-slot slot-sortasc"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-setfilter"></span>
|
||||
<span class="btn-slot" id="slot-btn-clear-filter"></span>
|
||||
<span class="btn-slot split slot-btn-setfilter"></span>
|
||||
<span class="btn-slot slot-btn-clear-filter"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
|
@ -152,6 +152,35 @@
|
|||
<span class="btn-slot text x-huge" id="slot-img-movebkwd"></span>
|
||||
</div>
|
||||
</section>
|
||||
<section class="panel" data-tab="data">
|
||||
<div class="group">
|
||||
<div class="elset">
|
||||
<span class="btn-slot split slot-sortdesc"></span>
|
||||
<span class="btn-slot slot-sortasc"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot split slot-btn-setfilter"></span>
|
||||
<span class="btn-slot slot-btn-clear-filter"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-text-column"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-group"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-ungroup"></span>
|
||||
</div>
|
||||
<!--<div class="group">-->
|
||||
<!--<div class="elset">-->
|
||||
<!--<span class="btn-slot" id="slot-btn-show-details" style="width:auto;"></span>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="elset">-->
|
||||
<!--<span class="btn-slot" id="slot-btn-hide-details" style="width:auto;"></span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
|
@ -71,13 +71,11 @@ define([
|
|||
this._state = {
|
||||
BackColor: undefined,
|
||||
DisabledControls: true,
|
||||
CellAngle: undefined,
|
||||
CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '')
|
||||
CellAngle: undefined
|
||||
};
|
||||
this.lockedControls = [];
|
||||
this._locked = true;
|
||||
this.isEditCell = false;
|
||||
this.isMultiSelect = false;
|
||||
this.BorderType = 1;
|
||||
|
||||
this.render();
|
||||
|
@ -141,32 +139,6 @@ define([
|
|||
this.api && this.api.asc_setCellAngle(field.getNumberValue());
|
||||
},
|
||||
|
||||
onTextToColumn: function() {
|
||||
this.api.asc_TextImport(this._state.CSVOptions, _.bind(this.onTextToColumnCallback, this), false);
|
||||
},
|
||||
|
||||
onTextToColumnCallback: function(data) {
|
||||
if (!data || !data.length) return;
|
||||
|
||||
var me = this;
|
||||
(new Common.Views.OpenDialog({
|
||||
title: me.textWizard,
|
||||
closable: true,
|
||||
type: Common.Utils.importTextType.Columns,
|
||||
preview: true,
|
||||
previewData: data,
|
||||
settings: this._state.CSVOptions,
|
||||
api: me.api,
|
||||
handler: function (result, encoding, delimiter, delimiterChar) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_TextToColumns(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
|
||||
}
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var el = $(this.el);
|
||||
el.html(this.template({
|
||||
|
@ -178,7 +150,6 @@ define([
|
|||
this.api = o;
|
||||
if (o) {
|
||||
this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this));
|
||||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
@ -267,13 +238,6 @@ define([
|
|||
});
|
||||
this.lockedControls.push(this.spnAngle);
|
||||
this.spnAngle.on('change', _.bind(this.onAngleChange, this));
|
||||
|
||||
this.btnTextToColumn = new Common.UI.Button({
|
||||
el: $('#cell-btn-text-to-column'),
|
||||
disabled: this._locked
|
||||
});
|
||||
this.btnTextToColumn.on('click', _.bind(this.onTextToColumn, this));
|
||||
this.lockedControls.push(this.btnTextToColumn);
|
||||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
|
@ -371,10 +335,6 @@ define([
|
|||
this.disableControls(this._locked);
|
||||
},
|
||||
|
||||
onApiSelectionChanged: function(info) {
|
||||
this.isMultiSelect = info.asc_getFlags().asc_getMultiselect() || info.asc_getSelectedColsCount()>1;
|
||||
},
|
||||
|
||||
setLocked: function (locked) {
|
||||
this._locked = locked;
|
||||
},
|
||||
|
@ -389,7 +349,6 @@ define([
|
|||
item.setDisabled(disable);
|
||||
});
|
||||
}
|
||||
this.btnTextToColumn.setDisabled(disable || this.isMultiSelect);
|
||||
},
|
||||
|
||||
textBorders: 'Border\'s Style',
|
||||
|
|
287
apps/spreadsheeteditor/main/app/view/DataTab.js
Normal file
287
apps/spreadsheeteditor/main/app/view/DataTab.js
Normal file
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* DataTab.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 30.05.2019
|
||||
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/BaseView',
|
||||
'common/main/lib/component/Layout'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
SSE.Views.DataTab = Common.UI.BaseView.extend(_.extend((function(){
|
||||
function setEvents() {
|
||||
var me = this;
|
||||
me.btnUngroup.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('data:ungroup', [item.value]);
|
||||
});
|
||||
me.btnUngroup.on('click', function (b, e) {
|
||||
me.fireEvent('data:ungroup');
|
||||
});
|
||||
me.btnGroup.on('click', function (b, e) {
|
||||
me.fireEvent('data:group');
|
||||
});
|
||||
me.btnTextToColumns.on('click', function (b, e) {
|
||||
me.fireEvent('data:tocolumns');
|
||||
});
|
||||
me.btnShow.on('click', function (b, e) {
|
||||
me.fireEvent('data:show');
|
||||
});
|
||||
me.btnHide.on('click', function (b, e) {
|
||||
me.fireEvent('data:hide');
|
||||
});
|
||||
me.btnsSortDown.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('data:sort', [Asc.c_oAscSortOptions.Ascending]);
|
||||
});
|
||||
});
|
||||
me.btnsSortUp.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('data:sort', [Asc.c_oAscSortOptions.Descending]);
|
||||
});
|
||||
});
|
||||
me.btnsSetAutofilter.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('data:setfilter', [Asc.c_oAscSortOptions.Descending]);
|
||||
});
|
||||
});
|
||||
me.btnsClearAutofilter.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('data:clearfilter', [Asc.c_oAscSortOptions.Descending]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
options: {},
|
||||
|
||||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this);
|
||||
this.toolbar = options.toolbar;
|
||||
|
||||
this.lockedControls = [];
|
||||
this.btnsSortDown = [];
|
||||
this.btnsSortUp = [];
|
||||
this.btnsSetAutofilter = [];
|
||||
this.btnsClearAutofilter = [];
|
||||
|
||||
var me = this,
|
||||
$host = me.toolbar.$el,
|
||||
_set = SSE.enumLock;
|
||||
|
||||
var _injectComponent = function (id, cmp) {
|
||||
var $slot = $host.find(id);
|
||||
if ($slot.length)
|
||||
cmp.rendered ? $slot.append(cmp.$el) : cmp.render($slot);
|
||||
};
|
||||
|
||||
var _injectComponents = function ($slots, iconCls, split, menu, caption, toggle, lock, btnsArr) {
|
||||
$slots.each(function(index, el) {
|
||||
var _cls = 'btn-toolbar';
|
||||
/x-huge/.test(el.className) && (_cls += ' x-huge icon-top');
|
||||
|
||||
var button = new Common.UI.Button({
|
||||
id: "id-toolbar-" + iconCls + index,
|
||||
cls: _cls,
|
||||
iconCls: iconCls,
|
||||
caption: caption,
|
||||
split: split,
|
||||
menu: menu,
|
||||
lock: lock,
|
||||
disabled: true
|
||||
}).render( $slots.eq(index) );
|
||||
|
||||
btnsArr.push(button);
|
||||
me.lockedControls.push(button);
|
||||
});
|
||||
};
|
||||
|
||||
this.btnGroup = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-img-group',
|
||||
caption: this.capBtnGroup,
|
||||
split: false,
|
||||
disabled: true,
|
||||
lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
_injectComponent('#slot-btn-group', this.btnGroup);
|
||||
this.lockedControls.push(this.btnGroup);
|
||||
|
||||
this.btnUngroup = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-img-group',
|
||||
caption: this.capBtnUngroup,
|
||||
split: true,
|
||||
menu: true,
|
||||
disabled: true,
|
||||
lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
_injectComponent('#slot-btn-ungroup', this.btnUngroup);
|
||||
this.lockedControls.push(this.btnUngroup);
|
||||
|
||||
this.btnTextToColumns = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-img-group',
|
||||
caption: this.capBtnTextToCol,
|
||||
split: false,
|
||||
disabled: true,
|
||||
lock: [_set.multiselect, _set.multiselectCols, _set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
_injectComponent('#slot-btn-text-column', this.btnTextToColumns);
|
||||
this.lockedControls.push(this.btnTextToColumns);
|
||||
|
||||
this.btnShow = new Common.UI.Button({
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-show-details',
|
||||
style: 'padding-right: 2px;',
|
||||
caption: this.capBtnTextShow,
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
_injectComponent('#slot-btn-show-details', this.btnShow);
|
||||
this.lockedControls.push(this.btnShow);
|
||||
|
||||
this.btnHide = new Common.UI.Button({
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-hide-details',
|
||||
style: 'padding-right: 2px;',
|
||||
caption: this.capBtnTextHide,
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
_injectComponent('#slot-btn-hide-details', this.btnHide);
|
||||
this.lockedControls.push(this.btnHide);
|
||||
|
||||
_injectComponents($host.find('.slot-sortdesc'), 'btn-sort-down', false, false, '', false,
|
||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||
this.btnsSortDown);
|
||||
|
||||
_injectComponents($host.find('.slot-sortasc'), 'btn-sort-up', false, false, '', false,
|
||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||
this.btnsSortUp);
|
||||
|
||||
_injectComponents($host.find('.slot-btn-setfilter'), 'btn-autofilter', false, false, '', true,
|
||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||
this.btnsSetAutofilter);
|
||||
|
||||
_injectComponents($host.find('.slot-btn-clear-filter'), 'btn-clear-filter', false, false, '', false,
|
||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot],
|
||||
this.btnsClearAutofilter);
|
||||
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
},
|
||||
|
||||
render: function (el) {
|
||||
return this;
|
||||
},
|
||||
|
||||
onAppReady: function (config) {
|
||||
var me = this;
|
||||
(new Promise(function (accept, reject) {
|
||||
accept();
|
||||
})).then(function(){
|
||||
me.btnUngroup.updateHint( me.tipUngroup );
|
||||
var _menu = new Common.UI.Menu({
|
||||
items: [
|
||||
{caption: me.textRows, value: 'rows'},
|
||||
{caption: me.textColumns, value: 'columns'},
|
||||
{caption: me.textClear, value: 'clear'}
|
||||
]
|
||||
});
|
||||
me.btnUngroup.setMenu(_menu);
|
||||
|
||||
me.btnGroup.updateHint(me.tipGroup);
|
||||
me.btnTextToColumns.updateHint(me.tipToColumns);
|
||||
|
||||
me.btnsSortDown.forEach( function(btn) {
|
||||
btn.updateHint(me.toolbar.txtSortAZ);
|
||||
});
|
||||
me.btnsSortUp.forEach( function(btn) {
|
||||
btn.updateHint(me.toolbar.txtSortZA);
|
||||
});
|
||||
me.btnsSetAutofilter.forEach( function(btn) {
|
||||
btn.updateHint(me.toolbar.txtFilter + ' (Ctrl+Shift+L)');
|
||||
});
|
||||
me.btnsClearAutofilter.forEach( function(btn) {
|
||||
btn.updateHint(me.toolbar.txtClearFilter);
|
||||
});
|
||||
|
||||
setEvents.call(me);
|
||||
});
|
||||
},
|
||||
|
||||
show: function () {
|
||||
Common.UI.BaseView.prototype.show.call(this);
|
||||
this.fireEvent('show', this);
|
||||
},
|
||||
|
||||
getButtons: function(type) {
|
||||
if (type == 'sort-down')
|
||||
return this.btnsSortDown;
|
||||
else if (type == 'sort-up')
|
||||
return this.btnsSortUp;
|
||||
else if (type == 'set-filter')
|
||||
return this.btnsSetAutofilter;
|
||||
else if (type == 'clear-filter')
|
||||
return this.btnsClearAutofilter;
|
||||
else if (type===undefined)
|
||||
return this.lockedControls;
|
||||
return [];
|
||||
},
|
||||
|
||||
SetDisabled: function (state) {
|
||||
this.lockedControls && this.lockedControls.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
capBtnGroup: 'Group',
|
||||
capBtnUngroup: 'Ungroup',
|
||||
textRows: 'Ungroup rows',
|
||||
textColumns: 'Ungroup columns',
|
||||
textClear: 'Clear outline',
|
||||
tipGroup: 'Group range of cells',
|
||||
tipUngroup: 'Ungroup range of cells',
|
||||
capBtnTextToCol: 'Text to Columns',
|
||||
tipToColumns: 'Separate cell text into columns',
|
||||
capBtnTextShow: 'Show details',
|
||||
capBtnTextHide: 'Hide details'
|
||||
}
|
||||
}()), SSE.Views.DataTab || {}));
|
||||
});
|
119
apps/spreadsheeteditor/main/app/view/GroupDialog.js
Normal file
119
apps/spreadsheeteditor/main/app/view/GroupDialog.js
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* GroupDialog.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 30.05.2019
|
||||
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
define([
|
||||
'common/main/lib/component/Window',
|
||||
'common/main/lib/component/ComboBox'
|
||||
], function () { 'use strict';
|
||||
|
||||
SSE.Views.GroupDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 214,
|
||||
header: true,
|
||||
style: 'min-width: 214px;',
|
||||
cls: 'modal-dlg'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box">',
|
||||
'<div id="group-radio-rows" style="margin-bottom: 5px;"></div>',
|
||||
'<div id="group-radio-cols"></div>',
|
||||
'<div class="footer center">',
|
||||
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
|
||||
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
this.radioRows = new Common.UI.RadioBox({
|
||||
el: $('#group-radio-rows'),
|
||||
labelText: this.textRows,
|
||||
name: 'asc-radio-group-cells',
|
||||
checked: this.options.props=='rows'
|
||||
});
|
||||
|
||||
this.radioColumns = new Common.UI.RadioBox({
|
||||
el: $('#group-radio-cols'),
|
||||
labelText: this.textColumns,
|
||||
name: 'asc-radio-group-cells',
|
||||
checked: this.options.props=='columns'
|
||||
});
|
||||
(this.options.props=='rows') ? this.radioRows.setValue(true) : this.radioColumns.setValue(true);
|
||||
|
||||
var $window = this.getChild();
|
||||
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||
},
|
||||
|
||||
_handleInput: function(state) {
|
||||
if (this.options.handler) {
|
||||
this.options.handler.call(this, this, state);
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
||||
onBtnClick: function(event) {
|
||||
this._handleInput(event.currentTarget.attributes['result'].value);
|
||||
},
|
||||
|
||||
getSettings: function() {
|
||||
return this.radioRows.getValue();
|
||||
},
|
||||
|
||||
onPrimary: function() {
|
||||
this._handleInput('ok');
|
||||
return false;
|
||||
},
|
||||
|
||||
cancelButtonText: 'Cancel',
|
||||
okButtonText: 'Ok',
|
||||
textRows: 'Rows',
|
||||
textColumns: 'Columns'
|
||||
}, SSE.Views.GroupDialog || {}))
|
||||
});
|
|
@ -87,7 +87,8 @@ define([
|
|||
cantGroupUngroup: 'cant-group-ungroup',
|
||||
docPropsLock: 'doc-props-lock',
|
||||
printAreaLock: 'print-area-lock',
|
||||
namedRangeLock: 'named-range-lock'
|
||||
namedRangeLock: 'named-range-lock',
|
||||
multiselectCols:'is-multiselect-cols'
|
||||
};
|
||||
|
||||
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
|
||||
|
@ -150,42 +151,7 @@ define([
|
|||
},
|
||||
|
||||
lockToolbar: function(causes, lock, opts) {
|
||||
!opts && (opts = {});
|
||||
|
||||
var controls = opts.array || this.lockControls;
|
||||
opts.merge && (controls = _.union(this.lockControls,controls));
|
||||
|
||||
function doLock(cmp, cause) {
|
||||
if ( cmp && _.contains(cmp.options.lock, cause) ) {
|
||||
var index = cmp.keepState.indexOf(cause);
|
||||
if (lock) {
|
||||
if (index < 0) {
|
||||
cmp.keepState.push(cause);
|
||||
}
|
||||
} else {
|
||||
if (!(index < 0)) {
|
||||
cmp.keepState.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_.each(controls, function(item) {
|
||||
if (item && _.isFunction(item.setDisabled)) {
|
||||
!item.keepState && (item.keepState = []);
|
||||
if (opts.clear && opts.clear.length > 0 && item.keepState.length > 0) {
|
||||
item.keepState = _.difference(item.keepState, opts.clear);
|
||||
}
|
||||
|
||||
_.isArray(causes) ? _.each(causes, function(c) {doLock(item, c)}) : doLock(item, causes);
|
||||
|
||||
if (!(item.keepState.length > 0)) {
|
||||
item.isDisabled() && item.setDisabled(false);
|
||||
} else {
|
||||
!item.isDisabled() && item.setDisabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
Common.Utils.lockControls(causes, lock, opts, this.lockControls);
|
||||
},
|
||||
|
||||
applyLayout: function (config) {
|
||||
|
@ -346,7 +312,8 @@ define([
|
|||
{ caption: me.textTabFile, action: 'file', extcls: 'canedit', haspanel:false},
|
||||
{ caption: me.textTabHome, action: 'home', extcls: 'canedit'},
|
||||
{ caption: me.textTabInsert, action: 'ins', extcls: 'canedit'},
|
||||
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit'}
|
||||
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit'},
|
||||
{caption: me.textTabData, action: 'data', extcls: 'canedit'}
|
||||
]}
|
||||
);
|
||||
|
||||
|
@ -749,35 +716,6 @@ define([
|
|||
menu : new Common.UI.Menu({cls: 'menu-shapes'})
|
||||
});
|
||||
|
||||
me.btnSortDown = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-sort-down',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-sort-down',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter]
|
||||
});
|
||||
|
||||
me.btnSortUp = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-sort-up',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-sort-up',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter]
|
||||
});
|
||||
|
||||
me.btnSetAutofilter = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-setautofilter',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-autofilter',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||
enableToggle: true
|
||||
});
|
||||
|
||||
me.btnClearAutofilter = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-clearfilter',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-clear-filter',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot]
|
||||
});
|
||||
|
||||
me.btnTableTemplate = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-ttempl',
|
||||
cls : 'btn-toolbar',
|
||||
|
@ -1164,52 +1102,6 @@ define([
|
|||
})
|
||||
});
|
||||
|
||||
me.btnAutofilter = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-autofilter',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'btn-autofilter',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
|
||||
menu : new Common.UI.Menu({
|
||||
items : [
|
||||
me.mnuitemSortAZ = new Common.UI.MenuItem({
|
||||
caption : me.txtSortAZ,
|
||||
iconCls : 'mnu-sort-asc',
|
||||
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleFilter, _set.cantModifyFilter],
|
||||
value : Asc.c_oAscSortOptions.Ascending
|
||||
}),
|
||||
me.mnuitemSortZA = new Common.UI.MenuItem({
|
||||
caption : me.txtSortZA,
|
||||
iconCls : 'mnu-sort-desc',
|
||||
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleFilter, _set.cantModifyFilter],
|
||||
value : Asc.c_oAscSortOptions.Descending
|
||||
}),
|
||||
me.mnuitemAutoFilter = new Common.UI.MenuItem({
|
||||
caption : me.txtFilter,
|
||||
iconCls : 'mnu-filter-add',
|
||||
checkable: true,
|
||||
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleFilter],
|
||||
value : 'set-filter'
|
||||
}),
|
||||
me.mnuitemClearFilter = new Common.UI.MenuItem({
|
||||
caption : me.txtClearFilter,
|
||||
iconCls : 'mnu-filter-clear',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleDelFilter],
|
||||
value : 'clear-filter'
|
||||
})
|
||||
/*,{
|
||||
caption : me.txtTableTemplate,
|
||||
iconCls : 'mnu-filter-clear',
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
items: [
|
||||
{ template: _.template('<div id="id-toolbar-short-menu-table-templates" style="width: 288px; height: 300px; margin: 0px 4px;"></div>') }
|
||||
]
|
||||
})
|
||||
} */
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
var hidetip = Common.localStorage.getItem("sse-hide-synch");
|
||||
me.showSynchTip = !(hidetip && parseInt(hidetip) == 1);
|
||||
// me.needShowSynchTip = false;
|
||||
|
@ -1500,7 +1392,7 @@ define([
|
|||
me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell,
|
||||
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
|
||||
me.btnInsertChart, me.btnColorSchemas,
|
||||
me.btnAutofilter, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint,
|
||||
me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint,
|
||||
/*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle,
|
||||
me.btnPageMargins, me.btnPageSize, me.btnPageOrient, me.btnPrintArea, me.btnImgAlign, me.btnImgBackward, me.btnImgForward, me.btnImgGroup, me.btnEditHeader
|
||||
];
|
||||
|
@ -1671,7 +1563,6 @@ define([
|
|||
|
||||
// replacePlacholder('#id-toolbar-short-placeholder-btn-halign', this.btnHorizontalAlign);
|
||||
// replacePlacholder('#id-toolbar-short-placeholder-btn-valign', this.btnVerticalAlign);
|
||||
// replacePlacholder('#id-toolbar-short-placeholder-btn-filter', this.btnAutofilter);
|
||||
|
||||
return $host;
|
||||
},
|
||||
|
@ -1736,7 +1627,6 @@ define([
|
|||
_updateHint(this.btnColorSchemas, this.tipColorSchemas);
|
||||
_updateHint(this.btnHorizontalAlign, this.tipHAligh);
|
||||
_updateHint(this.btnVerticalAlign, this.tipVAligh);
|
||||
_updateHint(this.btnAutofilter, this.tipAutofilter);
|
||||
_updateHint(this.btnPageOrient, this.tipPageOrient);
|
||||
_updateHint(this.btnPageSize, this.tipPageSize);
|
||||
_updateHint(this.btnPageMargins, this.tipPageMargins);
|
||||
|
@ -2465,6 +2355,7 @@ define([
|
|||
textAddPrintArea: 'Add to Print Area',
|
||||
tipPrintArea: 'Print Area',
|
||||
capBtnInsHeader: 'Header/Footer',
|
||||
tipEditHeader: 'Edit header or footer'
|
||||
tipEditHeader: 'Edit header or footer',
|
||||
textTabData: 'Data'
|
||||
}, SSE.Views.Toolbar || {}));
|
||||
});
|
|
@ -146,6 +146,7 @@ require([
|
|||
'LeftMenu',
|
||||
'Main',
|
||||
'PivotTable',
|
||||
'DataTab',
|
||||
'Common.Controllers.Fonts',
|
||||
'Common.Controllers.Chat',
|
||||
'Common.Controllers.Comments',
|
||||
|
@ -168,6 +169,7 @@ require([
|
|||
'spreadsheeteditor/main/app/controller/Main',
|
||||
'spreadsheeteditor/main/app/controller/Print',
|
||||
'spreadsheeteditor/main/app/controller/PivotTable',
|
||||
'spreadsheeteditor/main/app/controller/DataTab',
|
||||
'spreadsheeteditor/main/app/view/FileMenuPanels',
|
||||
'spreadsheeteditor/main/app/view/ParagraphSettings',
|
||||
'spreadsheeteditor/main/app/view/ImageSettings',
|
||||
|
|
|
@ -223,6 +223,7 @@
|
|||
"Common.Views.SignSettingsDialog.textShowDate": "Show sign date in signature line",
|
||||
"Common.Views.SignSettingsDialog.textTitle": "Signature Setup",
|
||||
"Common.Views.SignSettingsDialog.txtEmpty": "This field is required",
|
||||
"SSE.Controllers.DataTab.textWizard": "Text to Columns Wizard",
|
||||
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
|
||||
"SSE.Controllers.DocumentHolder.centerText": "Center",
|
||||
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",
|
||||
|
@ -403,6 +404,7 @@
|
|||
"SSE.Controllers.Main.errorAutoFilterDataRange": "The operation could not be done for the selected range of cells.<br>Select a uniform data range different from the existing one and try again.",
|
||||
"SSE.Controllers.Main.errorAutoFilterHiddenRange": "The operation cannot be performed because the area contains filtered cells.<br>Please unhide the filtered elements and try again.",
|
||||
"SSE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect",
|
||||
"SSE.Controllers.Main.errorCannotUngroup": "Cannot ungroup. To start an outline, select the detail rows or columns and group them.",
|
||||
"SSE.Controllers.Main.errorChangeArray": "You cannot change part of an array.",
|
||||
"SSE.Controllers.Main.errorCoAuthoringDisconnect": "Server connection lost. The document cannot be edited right now.",
|
||||
"SSE.Controllers.Main.errorConnectToServer": "The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the 'OK' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href=\"%1\" target=\"_blank\">here</a>",
|
||||
|
@ -1134,8 +1136,8 @@
|
|||
"SSE.Views.CellSettings.textNewColor": "Add New Custom Color",
|
||||
"SSE.Views.CellSettings.textOrientation": "Text Orientation",
|
||||
"SSE.Views.CellSettings.textSelectBorders": "Select borders you want to change applying style chosen above",
|
||||
"SSE.Views.CellSettings.textTextToColumn": "Text to Columns",
|
||||
"SSE.Views.CellSettings.textWizard": "Text to Columns Wizard",
|
||||
"del_SSE.Views.CellSettings.textTextToColumn": "Text to Columns",
|
||||
"del_SSE.Views.CellSettings.textWizard": "Text to Columns Wizard",
|
||||
"SSE.Views.CellSettings.tipAll": "Set outer border and all inner lines",
|
||||
"SSE.Views.CellSettings.tipBottom": "Set outer bottom border only",
|
||||
"SSE.Views.CellSettings.tipDiagD": "Set Diagonal Down Border",
|
||||
|
@ -1317,6 +1319,15 @@
|
|||
"SSE.Views.ChartSettingsDlg.textYAxisTitle": "Y Axis Title",
|
||||
"SSE.Views.ChartSettingsDlg.textZero": "Zero",
|
||||
"SSE.Views.ChartSettingsDlg.txtEmpty": "This field is required",
|
||||
"SSE.Views.DataTab.capBtnGroup": "Group",
|
||||
"SSE.Views.DataTab.capBtnTextToCol": "Text to Columns",
|
||||
"SSE.Views.DataTab.capBtnUngroup": "Ungroup",
|
||||
"SSE.Views.DataTab.textClear": "Clear outline",
|
||||
"SSE.Views.DataTab.textColumns": "Ungroup columns",
|
||||
"SSE.Views.DataTab.textRows": "Ungroup rows",
|
||||
"SSE.Views.DataTab.tipGroup": "Group range of cells",
|
||||
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
|
||||
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
||||
"SSE.Views.DigitalFilterDialog.cancelButtonText": "Cancel",
|
||||
"SSE.Views.DigitalFilterDialog.capAnd": "And",
|
||||
"SSE.Views.DigitalFilterDialog.capCondition1": "equals",
|
||||
|
@ -1582,6 +1593,10 @@
|
|||
"SSE.Views.FormulaDialog.textGroupDescription": "Select Function Group",
|
||||
"SSE.Views.FormulaDialog.textListDescription": "Select Function",
|
||||
"SSE.Views.FormulaDialog.txtTitle": "Insert Function",
|
||||
"SSE.Views.GroupDialog.cancelButtonText": "Cancel",
|
||||
"SSE.Views.GroupDialog.okButtonText": "Ok",
|
||||
"SSE.Views.GroupDialog.textRows": "Rows",
|
||||
"SSE.Views.GroupDialog.textColumns": "Columns",
|
||||
"SSE.Views.HeaderFooterDialog.cancelButtonText": "Cancel",
|
||||
"SSE.Views.HeaderFooterDialog.okButtonText": "Ok",
|
||||
"SSE.Views.HeaderFooterDialog.tipFontName": "Font",
|
||||
|
@ -2337,6 +2352,7 @@
|
|||
"SSE.Views.Toolbar.txtYen": "¥ Yen",
|
||||
"SSE.Views.Toolbar.capBtnInsHeader": "Header/Footer",
|
||||
"SSE.Views.Toolbar.tipEditHeader": "Edit header or footer",
|
||||
"SSE.Views.Toolbar.textTabData": "Data",
|
||||
"SSE.Views.Top10FilterDialog.cancelButtonText": "Cancel",
|
||||
"SSE.Views.Top10FilterDialog.okButtonText": "OK",
|
||||
"SSE.Views.Top10FilterDialog.textType": "Show",
|
||||
|
|
|
@ -161,6 +161,8 @@
|
|||
.toolbar-btn-icon(rotate-270, 90, @toolbar-icon-size);
|
||||
.toolbar-btn-icon(flip-hor, 91, @toolbar-icon-size);
|
||||
.toolbar-btn-icon(flip-vert, 92, @toolbar-icon-size);
|
||||
.toolbar-btn-icon(btn-show-details, 73, @toolbar-icon-size);
|
||||
.toolbar-btn-icon(btn-hide-details, 73, @toolbar-icon-size);
|
||||
|
||||
@menu-icon-size: 22px;
|
||||
.menu-btn-icon(mnu-align-center, 0, @menu-icon-size);
|
||||
|
|
Loading…
Reference in a new issue