2020-07-09 11:53:22 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* (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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* ViewTab.js
|
|
|
|
*
|
|
|
|
* Created by Julia Radzhabova on 08.07.2020
|
|
|
|
* Copyright (c) 2020 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.ViewTab = Common.UI.BaseView.extend(_.extend((function(){
|
2022-02-08 10:01:04 +00:00
|
|
|
var template = '<section class="panel" data-tab="view">' +
|
|
|
|
'<div class="group sheet-views">' +
|
|
|
|
'<span class="btn-slot text x-huge" id="slot-btn-sheet-view"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="group sheet-views small">' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-createview"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-closeview"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="separator long sheet-views"></div>' +
|
|
|
|
'<div class="group small">' +
|
|
|
|
'<div class="elset" style="display: flex;">' +
|
|
|
|
'<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="elset" style="text-align: center;">' +
|
|
|
|
'<span class="btn-slot text" id="slot-lbl-zoom" style="font-size: 11px;text-align: center;margin-top: 4px;"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="separator long"></div>' +
|
|
|
|
'<div class="group">' +
|
|
|
|
'<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>' +
|
|
|
|
'</div>' +
|
2022-05-15 08:25:31 +00:00
|
|
|
'<div class="separator long separator-theme"></div>' +
|
2022-02-08 10:01:04 +00:00
|
|
|
'<div class="group sheet-freeze">' +
|
|
|
|
'<span class="btn-slot text x-huge" id="slot-btn-freeze"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="separator long sheet-freeze"></div>' +
|
|
|
|
'<div class="group small sheet-formula">' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-chk-formula"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-chk-heading"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="group small sheet-gridlines">' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-chk-gridlines"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-chk-zeros"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="separator long separator-formula"></div>' +
|
|
|
|
'<div class="group small">' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-chk-toolbar"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="elset">' +
|
|
|
|
'<span class="btn-slot text" id="slot-chk-statusbar"></span>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'</section>';
|
|
|
|
|
2020-07-09 11:53:22 +00:00
|
|
|
function setEvents() {
|
|
|
|
var me = this;
|
2022-02-08 10:01:04 +00:00
|
|
|
if ( me.appConfig.canFeatureViews && me.appConfig.isEdit) {
|
2020-07-10 12:42:39 +00:00
|
|
|
me.btnCloseView.on('click', function (btn, e) {
|
|
|
|
me.fireEvent('viewtab:openview', [{name: 'default', value: 'default'}]);
|
|
|
|
});
|
|
|
|
me.btnCreateView.on('click', function (btn, e) {
|
|
|
|
me.fireEvent('viewtab:createview');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
me.btnFreezePanes && me.btnFreezePanes.menu.on('item:click', function (menu, item, e) {
|
2021-12-14 10:10:32 +00:00
|
|
|
if (item.value === 'shadow') {
|
|
|
|
me.fireEvent('viewtab:freezeshadow', [item.checked]);
|
|
|
|
} else {
|
|
|
|
me.fireEvent('viewtab:freeze', [item.value]);
|
|
|
|
}
|
2020-07-09 11:53:22 +00:00
|
|
|
});
|
2020-07-09 16:04:54 +00:00
|
|
|
this.chFormula.on('change', function (field, value) {
|
2022-02-06 11:50:17 +00:00
|
|
|
me.fireEvent('viewtab:formula', [0, value=='checked']);
|
2020-07-09 16:04:54 +00:00
|
|
|
});
|
2022-02-08 10:01:04 +00:00
|
|
|
this.chHeadings && this.chHeadings.on('change', function (field, value) {
|
2022-02-06 11:50:17 +00:00
|
|
|
me.fireEvent('viewtab:headings', [1, value=='checked']);
|
2020-07-09 16:04:54 +00:00
|
|
|
});
|
2022-02-08 10:01:04 +00:00
|
|
|
this.chGridlines && this.chGridlines.on('change', function (field, value) {
|
2022-02-06 11:50:17 +00:00
|
|
|
me.fireEvent('viewtab:gridlines', [2, value=='checked']);
|
2020-07-09 16:04:54 +00:00
|
|
|
});
|
2022-02-08 10:01:04 +00:00
|
|
|
this.chZeros && this.chZeros.on('change', function (field, value) {
|
2022-02-06 11:50:17 +00:00
|
|
|
me.fireEvent('viewtab:zeros', [3, value=='checked']);
|
2021-05-21 15:01:49 +00:00
|
|
|
});
|
2021-12-12 14:49:49 +00:00
|
|
|
this.chToolbar.on('change', function (field, value) {
|
|
|
|
me.fireEvent('viewtab:showtoolbar', [field, value !== 'checked']);
|
|
|
|
});
|
|
|
|
this.chStatusbar.on('change', function (field, value) {
|
|
|
|
me.fireEvent('statusbar:setcompact', [field, value === 'checked']);
|
|
|
|
});
|
2021-12-15 15:46:10 +00:00
|
|
|
this.cmbZoom.on('selected', function (combo, record) {
|
|
|
|
me.fireEvent('zoom:selected', [combo, record]);
|
|
|
|
}).on('changed:before', function (combo, record) {
|
|
|
|
me.fireEvent('zoom:changedbefore', [true, combo, record]);
|
|
|
|
}).on('changed:after', function (combo, record) {
|
|
|
|
me.fireEvent('zoom:changedafter', [false, combo, record]);
|
|
|
|
}).on('combo:blur', function () {
|
|
|
|
me.fireEvent('editcomplete', me);
|
2021-12-17 08:10:53 +00:00
|
|
|
}).on('combo:focusin', _.bind(this.onComboOpen, this, false))
|
|
|
|
.on('show:after', _.bind(this.onComboOpen, this, true));
|
2020-07-09 11:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
options: {},
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
Common.UI.BaseView.prototype.initialize.call(this);
|
|
|
|
this.toolbar = options.toolbar;
|
2020-07-10 12:42:39 +00:00
|
|
|
this.appConfig = options.mode;
|
2020-07-09 11:53:22 +00:00
|
|
|
|
|
|
|
this.lockedControls = [];
|
|
|
|
|
|
|
|
var me = this,
|
2021-12-29 16:41:15 +00:00
|
|
|
_set = Common.enumLock;
|
2020-07-09 11:53:22 +00:00
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
if ( me.appConfig.canFeatureViews && me.appConfig.isEdit ) {
|
2020-07-10 12:42:39 +00:00
|
|
|
this.btnSheetView = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
2020-07-17 16:46:51 +00:00
|
|
|
iconCls: 'toolbar__icon btn-sheet-view',
|
2020-07-10 12:42:39 +00:00
|
|
|
caption: me.capBtnSheetView,
|
2021-09-21 10:46:17 +00:00
|
|
|
lock : [_set.lostConnect, _set.coAuth, _set.editCell],
|
2021-08-17 12:39:32 +00:00
|
|
|
menu: true,
|
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'bottom',
|
|
|
|
dataHintOffset: 'small'
|
2020-07-10 12:42:39 +00:00
|
|
|
});
|
|
|
|
this.lockedControls.push(this.btnSheetView);
|
|
|
|
|
|
|
|
this.btnCreateView = new Common.UI.Button({
|
|
|
|
id : 'id-toolbar-btn-createview',
|
|
|
|
cls : 'btn-toolbar',
|
2020-07-17 16:46:51 +00:00
|
|
|
iconCls : 'toolbar__icon btn-sheet-view-new',
|
2020-07-10 12:42:39 +00:00
|
|
|
caption : this.textCreate,
|
2021-09-21 10:46:17 +00:00
|
|
|
lock : [_set.coAuth, _set.lostConnect, _set.editCell],
|
2021-08-17 12:39:32 +00:00
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'big'
|
2020-07-10 12:42:39 +00:00
|
|
|
});
|
|
|
|
this.lockedControls.push(this.btnCreateView);
|
|
|
|
|
|
|
|
this.btnCloseView = new Common.UI.Button({
|
|
|
|
id : 'id-toolbar-btn-closeview',
|
|
|
|
cls : 'btn-toolbar',
|
2020-07-17 16:46:51 +00:00
|
|
|
iconCls : 'toolbar__icon btn-sheet-view-close',
|
2020-07-10 12:42:39 +00:00
|
|
|
caption : this.textClose,
|
2021-09-21 10:46:17 +00:00
|
|
|
lock : [_set.sheetView, _set.coAuth, _set.lostConnect, _set.editCell],
|
2021-08-17 12:39:32 +00:00
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'big'
|
2020-07-10 12:42:39 +00:00
|
|
|
});
|
|
|
|
this.lockedControls.push(this.btnCloseView);
|
|
|
|
}
|
2020-07-09 11:53:22 +00:00
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
if (me.appConfig.isEdit) {
|
|
|
|
this.btnFreezePanes = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'toolbar__icon btn-freeze-panes',
|
|
|
|
caption: this.capBtnFreeze,
|
|
|
|
menu: true,
|
|
|
|
lock: [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell],
|
|
|
|
dataHint: '1',
|
|
|
|
dataHintDirection: 'bottom',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.btnFreezePanes);
|
|
|
|
|
|
|
|
this.chHeadings = new Common.UI.CheckBox({
|
|
|
|
labelText: this.textHeadings,
|
|
|
|
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell],
|
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.chHeadings);
|
|
|
|
|
|
|
|
this.chGridlines = new Common.UI.CheckBox({
|
|
|
|
labelText: this.textGridlines,
|
|
|
|
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell],
|
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.chGridlines);
|
|
|
|
|
|
|
|
this.chZeros = new Common.UI.CheckBox({
|
|
|
|
labelText: this.textZeros,
|
|
|
|
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell],
|
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.chZeros);
|
|
|
|
}
|
2020-07-09 11:53:22 +00:00
|
|
|
|
|
|
|
this.cmbZoom = new Common.UI.ComboBox({
|
|
|
|
cls : 'input-group-nr',
|
|
|
|
menuStyle : 'min-width: 55px;',
|
|
|
|
hint : me.tipFontSize,
|
2021-12-15 15:46:10 +00:00
|
|
|
editable : true,
|
2022-02-08 10:01:04 +00:00
|
|
|
lock : [_set.lostConnect, _set.editCell],
|
2020-07-09 11:53:22 +00:00
|
|
|
data : [
|
|
|
|
{ displayValue: "50%", value: 50 },
|
|
|
|
{ displayValue: "75%", value: 75 },
|
|
|
|
{ displayValue: "100%", value: 100 },
|
|
|
|
{ displayValue: "125%", value: 125 },
|
|
|
|
{ displayValue: "150%", value: 150 },
|
|
|
|
{ displayValue: "175%", value: 175 },
|
2021-11-29 10:20:45 +00:00
|
|
|
{ displayValue: "200%", value: 200 },
|
|
|
|
{ displayValue: "300%", value: 300 },
|
|
|
|
{ displayValue: "400%", value: 400 },
|
|
|
|
{ displayValue: "500%", value: 500 }
|
2021-06-08 14:26:10 +00:00
|
|
|
],
|
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'top',
|
|
|
|
dataHintOffset: 'small'
|
2020-07-09 11:53:22 +00:00
|
|
|
});
|
2021-09-21 10:46:17 +00:00
|
|
|
this.lockedControls.push(this.cmbZoom);
|
2020-07-09 11:53:22 +00:00
|
|
|
|
2021-12-08 11:52:15 +00:00
|
|
|
this.btnInterfaceTheme = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
2021-12-12 17:44:54 +00:00
|
|
|
iconCls: 'toolbar__icon day',
|
2021-12-08 11:52:15 +00:00
|
|
|
caption: this.textInterfaceTheme,
|
|
|
|
menu: true,
|
|
|
|
dataHint: '1',
|
|
|
|
dataHintDirection: 'bottom',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.btnInterfaceTheme);
|
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
this.chFormula = new Common.UI.CheckBox({
|
|
|
|
labelText: this.textFormula,
|
|
|
|
value: !Common.localStorage.getBool('sse-hidden-formula'),
|
|
|
|
lock : [_set.lostConnect, _set.editCell],
|
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.chFormula);
|
|
|
|
|
2021-12-08 11:52:15 +00:00
|
|
|
this.chStatusbar = new Common.UI.CheckBox({
|
|
|
|
labelText: this.textCombineSheetAndStatusBars,
|
2021-12-12 14:49:49 +00:00
|
|
|
value : Common.localStorage.getBool('sse-compact-statusbar', true),
|
2022-02-08 10:01:04 +00:00
|
|
|
lock : [_set.lostConnect, _set.editCell],
|
2021-12-08 11:52:15 +00:00
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.chStatusbar);
|
|
|
|
|
|
|
|
this.chToolbar = new Common.UI.CheckBox({
|
|
|
|
labelText: this.textAlwaysShowToolbar,
|
2021-12-12 14:49:49 +00:00
|
|
|
value : !options.compactToolbar,
|
2022-02-08 10:01:04 +00:00
|
|
|
lock : [_set.lostConnect, _set.editCell],
|
2021-12-08 11:52:15 +00:00
|
|
|
dataHint : '1',
|
|
|
|
dataHintDirection: 'left',
|
|
|
|
dataHintOffset: 'small'
|
|
|
|
});
|
|
|
|
this.lockedControls.push(this.chToolbar);
|
2020-07-09 11:53:22 +00:00
|
|
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function (el) {
|
2022-02-08 10:01:04 +00:00
|
|
|
if ( el ) el.html( this.getPanel() );
|
|
|
|
|
2020-07-09 11:53:22 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
getPanel: function () {
|
|
|
|
this.$el = $(_.template(template)( {} ));
|
|
|
|
var $host = this.$el;
|
|
|
|
|
|
|
|
this.btnSheetView && this.btnSheetView.render($host.find('#slot-btn-sheet-view'));
|
|
|
|
this.btnCreateView && this.btnCreateView.render($host.find('#slot-createview'));
|
|
|
|
this.btnCloseView && this.btnCloseView.render($host.find('#slot-closeview'));
|
|
|
|
this.btnFreezePanes && this.btnFreezePanes.render($host.find('#slot-btn-freeze'));
|
|
|
|
this.cmbZoom.render($host.find('#slot-field-zoom'));
|
|
|
|
this.cmbZoom.setValue(100);
|
|
|
|
$host.find('#slot-lbl-zoom').text(this.textZoom);
|
|
|
|
this.btnInterfaceTheme.render($host.find('#slot-btn-interface-theme'));
|
|
|
|
this.chFormula.render($host.find('#slot-chk-formula'));
|
|
|
|
this.chStatusbar.render($host.find('#slot-chk-statusbar'));
|
|
|
|
this.chToolbar.render($host.find('#slot-chk-toolbar'));
|
|
|
|
this.chHeadings && this.chHeadings.render($host.find('#slot-chk-heading'));
|
|
|
|
this.chGridlines && this.chGridlines.render($host.find('#slot-chk-gridlines'));
|
|
|
|
this.chZeros && this.chZeros.render($host.find('#slot-chk-zeros'));
|
|
|
|
return this.$el;
|
|
|
|
},
|
|
|
|
|
2020-07-09 11:53:22 +00:00
|
|
|
onAppReady: function (config) {
|
|
|
|
var me = this;
|
|
|
|
(new Promise(function (accept, reject) {
|
|
|
|
accept();
|
|
|
|
})).then(function(){
|
2022-02-08 10:01:04 +00:00
|
|
|
if (!(config.canFeatureViews && me.appConfig.isEdit)) {
|
2020-07-10 12:42:39 +00:00
|
|
|
me.toolbar && me.toolbar.$el.find('.group.sheet-views').hide();
|
|
|
|
me.toolbar && me.toolbar.$el.find('.separator.sheet-views').hide();
|
|
|
|
} else {
|
|
|
|
me.btnSheetView.updateHint( me.tipSheetView );
|
|
|
|
me.setButtonMenu(me.btnSheetView);
|
|
|
|
|
|
|
|
me.btnCreateView.updateHint(me.tipCreate);
|
|
|
|
me.btnCloseView.updateHint(me.tipClose);
|
|
|
|
}
|
2020-07-09 11:53:22 +00:00
|
|
|
|
2022-08-10 17:19:26 +00:00
|
|
|
me.btnInterfaceTheme.updateHint(me.tipInterfaceTheme);
|
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
if (config.isEdit) {
|
|
|
|
me.btnFreezePanes.setMenu(new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: me.toolbar && me.toolbar.api && !!me.toolbar.api.asc_getSheetViewSettings().asc_getIsFreezePane() ? me.textUnFreeze : me.capBtnFreeze,
|
|
|
|
value: undefined
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: me.textFreezeRow,
|
|
|
|
value: Asc.c_oAscFrozenPaneAddType.firstRow
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: me.textFreezeCol,
|
|
|
|
value: Asc.c_oAscFrozenPaneAddType.firstCol
|
|
|
|
},
|
|
|
|
{ caption: '--' },
|
|
|
|
{
|
|
|
|
caption: me.textShowFrozenPanesShadow,
|
|
|
|
value: 'shadow',
|
|
|
|
checkable: true,
|
|
|
|
checked: Common.localStorage.getBool('sse-freeze-shadow', true)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}));
|
|
|
|
me.btnFreezePanes.updateHint(me.tipFreeze);
|
|
|
|
} else {
|
|
|
|
me.toolbar && me.toolbar.$el.find('.group.sheet-freeze').hide();
|
|
|
|
me.toolbar && me.toolbar.$el.find('.separator.sheet-freeze').hide();
|
|
|
|
me.toolbar && me.toolbar.$el.find('.group.sheet-gridlines').hide();
|
|
|
|
}
|
|
|
|
|
2022-05-15 08:25:31 +00:00
|
|
|
if (!Common.UI.Themes.available()) {
|
|
|
|
me.btnInterfaceTheme.$el.closest('.group').remove();
|
|
|
|
me.$el.find('.separator-theme').remove();
|
|
|
|
}
|
|
|
|
|
2022-02-08 10:01:04 +00:00
|
|
|
if (config.canBrandingExt && config.customization && config.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) {
|
|
|
|
me.chStatusbar.$el.remove();
|
|
|
|
if (!config.isEdit) {
|
|
|
|
var slotChkFormula = me.chFormula.$el,
|
|
|
|
groupFormula = slotChkFormula.closest('.group'),
|
|
|
|
groupToolbar = me.chToolbar.$el.closest('.group');
|
|
|
|
groupToolbar.find('.elset')[1].append(slotChkFormula[0]);
|
|
|
|
groupFormula.remove();
|
|
|
|
me.$el.find('.separator-formula').remove();
|
|
|
|
}
|
|
|
|
}
|
2022-05-06 08:33:48 +00:00
|
|
|
if (Common.UI.Themes.available()) {
|
2022-06-03 19:03:29 +00:00
|
|
|
function _fill_themes() {
|
|
|
|
var btn = this.btnInterfaceTheme;
|
|
|
|
if ( typeof(btn.menu) == 'object' ) btn.menu.removeAll();
|
|
|
|
else btn.setMenu(new Common.UI.Menu());
|
|
|
|
|
|
|
|
var currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
|
|
|
|
for (var t in Common.UI.Themes.map()) {
|
|
|
|
btn.menu.addItem({
|
|
|
|
value: t,
|
|
|
|
caption: Common.UI.Themes.get(t).text,
|
|
|
|
checked: t === currentTheme,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'interface-theme'
|
|
|
|
});
|
|
|
|
}
|
2022-05-06 08:33:48 +00:00
|
|
|
}
|
2022-06-03 19:03:29 +00:00
|
|
|
|
|
|
|
Common.NotificationCenter.on('uitheme:countchanged', _fill_themes.bind(me));
|
|
|
|
_fill_themes.call(me);
|
|
|
|
|
2022-06-06 16:26:24 +00:00
|
|
|
if (me.btnInterfaceTheme.menu.items.length) {
|
2022-05-06 08:33:48 +00:00
|
|
|
me.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
|
|
|
|
var value = item.value;
|
|
|
|
Common.UI.Themes.setTheme(value);
|
|
|
|
}, me));
|
|
|
|
}
|
2021-12-12 17:44:54 +00:00
|
|
|
}
|
2020-07-09 11:53:22 +00:00
|
|
|
setEvents.call(me);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
setButtonMenu: function(btn) {
|
|
|
|
var me = this,
|
2020-07-09 17:42:25 +00:00
|
|
|
arr = [{caption: me.textDefault, value: 'default', checkable: true, allowDepress: false}];
|
2020-07-09 11:53:22 +00:00
|
|
|
btn.setMenu(new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-sheet-view-menu-" style="display: flex;" class="open"></div>')},
|
|
|
|
{ caption: '--' },
|
|
|
|
{
|
|
|
|
caption: me.textManager,
|
|
|
|
value: 'manager'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}));
|
|
|
|
btn.menu.items[2].on('click', function (item, e) {
|
|
|
|
me.fireEvent('viewtab:manager');
|
|
|
|
});
|
|
|
|
btn.menu.on('show:after', function (menu, e) {
|
|
|
|
var internalMenu = menu._innerMenu;
|
|
|
|
internalMenu.scroller.update({alwaysVisibleY: true});
|
|
|
|
_.delay(function() {
|
|
|
|
menu._innerMenu && menu._innerMenu.cmpEl.focus();
|
|
|
|
}, 10);
|
2020-07-09 17:42:25 +00:00
|
|
|
}).on('show:before', function (menu, e) {
|
|
|
|
me.fireEvent('viewtab:showview');
|
2021-09-19 18:28:47 +00:00
|
|
|
});
|
2020-07-09 11:53:22 +00:00
|
|
|
|
|
|
|
var menu = new Common.UI.Menu({
|
|
|
|
maxHeight: 300,
|
|
|
|
cls: 'internal-menu',
|
2021-09-19 18:28:47 +00:00
|
|
|
items: arr,
|
|
|
|
outerMenu: {menu: btn.menu, index: 0}
|
2020-07-09 11:53:22 +00:00
|
|
|
});
|
|
|
|
menu.render(btn.menu.items[0].cmpEl.children(':first'));
|
|
|
|
menu.cmpEl.css({
|
|
|
|
display : 'block',
|
|
|
|
position : 'relative',
|
|
|
|
left : 0,
|
|
|
|
top : 0
|
|
|
|
});
|
|
|
|
menu.cmpEl.attr({tabindex: "-1"});
|
2020-07-09 17:42:25 +00:00
|
|
|
menu.on('item:toggle', function (menu, item, state, e) {
|
|
|
|
if (!!state)
|
|
|
|
me.fireEvent('viewtab:openview', [{name: item.caption, value: item.value}]);
|
2021-09-19 18:28:47 +00:00
|
|
|
});
|
2020-07-09 11:53:22 +00:00
|
|
|
btn.menu._innerMenu = menu;
|
2021-09-19 18:28:47 +00:00
|
|
|
btn.menu.setInnerMenu([{menu: menu, index: 0}]);
|
2020-07-09 11:53:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
show: function () {
|
|
|
|
Common.UI.BaseView.prototype.show.call(this);
|
|
|
|
this.fireEvent('show', this);
|
|
|
|
},
|
|
|
|
|
|
|
|
getButtons: function(type) {
|
|
|
|
if (type===undefined)
|
|
|
|
return this.lockedControls;
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
|
|
|
|
SetDisabled: function (state) {
|
|
|
|
this.lockedControls && this.lockedControls.forEach(function(button) {
|
|
|
|
if ( button ) {
|
|
|
|
button.setDisabled(state);
|
|
|
|
}
|
|
|
|
}, this);
|
|
|
|
},
|
2021-12-17 08:10:53 +00:00
|
|
|
|
|
|
|
onComboOpen: function (needfocus, combo) {
|
|
|
|
_.delay(function() {
|
|
|
|
var input = $('input', combo.cmpEl).select();
|
|
|
|
if (needfocus) input.focus();
|
|
|
|
else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); });
|
|
|
|
}, 10);
|
|
|
|
},
|
2020-07-09 11:53:22 +00:00
|
|
|
|
|
|
|
capBtnSheetView: 'Sheet View',
|
|
|
|
capBtnFreeze: 'Freeze Panes',
|
|
|
|
textZoom: 'Zoom',
|
|
|
|
tipSheetView: 'Sheet view',
|
|
|
|
textDefault: 'Default',
|
|
|
|
textManager: 'View manager',
|
|
|
|
tipFreeze: 'Freeze panes',
|
|
|
|
tipCreate: 'Create sheet view',
|
|
|
|
tipClose: 'Close sheet view',
|
|
|
|
textCreate: 'New',
|
|
|
|
textClose: 'Close',
|
|
|
|
textFormula: 'Formula bar',
|
|
|
|
textHeadings: 'Headings',
|
2021-05-21 16:12:54 +00:00
|
|
|
textGridlines: 'Gridlines',
|
|
|
|
textFreezeRow: 'Freeze Top Row',
|
2021-05-24 15:47:25 +00:00
|
|
|
textFreezeCol: 'Freeze First Column',
|
2021-05-24 09:48:52 +00:00
|
|
|
textUnFreeze: 'Unfreeze Panes',
|
2021-12-08 11:52:15 +00:00
|
|
|
textZeros: 'Show zeros',
|
|
|
|
textCombineSheetAndStatusBars: 'Combine sheet and status bars',
|
|
|
|
textAlwaysShowToolbar: 'Always show toolbar',
|
|
|
|
textInterfaceTheme: 'Interface theme',
|
2022-08-10 17:19:26 +00:00
|
|
|
textShowFrozenPanesShadow: 'Show frozen panes shadow',
|
|
|
|
tipInterfaceTheme: 'Interface theme'
|
2020-07-09 11:53:22 +00:00
|
|
|
}
|
|
|
|
}()), SSE.Views.ViewTab || {}));
|
|
|
|
});
|