Merge pull request 'feature/table-design-tab' (#612) from feature/table-design-tab into develop

This commit is contained in:
Julia Radzhabova
2025-08-06 10:35:24 +00:00
13 changed files with 1147 additions and 40 deletions

View File

@ -410,6 +410,38 @@
}
.combo-table-template {
.combo-template(56px);
top: -4px;
position: absolute;
.padding-right-12();
.more-container & {
position: static;
}
.view .dataview, .dropdown-menu {
padding: 1px;
}
.dropdown-menu {
padding: 5px 1px 5px 1px;
.dataview {
.group-description {
padding: 3px 0 3px 10px;
.font-weight-bold();
.rtl & {
padding: 3px 10px 3px 0;
}
}
}
}
}
.combo-slicer-style {
.combo-textart(60px, 4px);
}

View File

@ -145,6 +145,7 @@ require([
'PivotTable',
'DataTab',
'ViewTab',
'TableDesignTab',
'Search',
'WBProtection',
'Common.Controllers.Fonts',
@ -182,6 +183,7 @@ require([
'spreadsheeteditor/main/app/controller/PivotTable',
'spreadsheeteditor/main/app/controller/DataTab',
'spreadsheeteditor/main/app/controller/ViewTab',
'spreadsheeteditor/main/app/controller/TableDesignTab',
'spreadsheeteditor/main/app/controller/Search',
'spreadsheeteditor/main/app/controller/WBProtection',
// 'spreadsheeteditor/main/app/view/ParagraphSettings',

View File

@ -471,6 +471,7 @@ define([
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
this.appOptions.canFeaturePivot = true;
this.appOptions.canFeatureTable = true;
this.appOptions.canFeatureViews = true;
this.appOptions.canRequestReferenceData = this.editorConfig.canRequestReferenceData;
this.appOptions.canRequestOpen = this.editorConfig.canRequestOpen;
@ -1052,7 +1053,6 @@ define([
chatController = application.getController('Common.Controllers.Chat'),
pluginsController = application.getController('Common.Controllers.Plugins'),
spellcheckController = application.getController('Spellcheck');
leftMenuView.getMenu('file').loadDocument({doc:me.appOptions.spreadsheet});
leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api);
@ -1719,6 +1719,9 @@ define([
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle && me.appOptions.canFeaturePivot)
application.getController('PivotTable').setMode(me.appOptions);
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle && me.appOptions.canFeatureTable)
application.getController('TableDesignTab').setMode(me.appOptions);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
viewport.applyEditorMode();
rightmenuController.getView('RightMenu').setMode(me.appOptions).setApi(me.api);

View File

@ -71,6 +71,9 @@ define([
'TableSettings': {
'pivottable:create': _.bind(this.onCreateClick, this)
},
'TableDesignTab': {
'pivottable:create': _.bind(this.onCreateClick, this)
},
'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this)
}

View File

@ -60,7 +60,7 @@ define([
'insertshape': this.onInsertShape.bind(this),
'insertchart': this.onInsertChart.bind(this),
'inserttextart': this.onInsertTextArt.bind(this),
'inserttable': this.onInsertTable.bind(this)
// 'inserttable': this.onInsertTable.bind(this)
},
'RightMenu': {
'rightmenuclick': this.onRightMenuClick,
@ -100,7 +100,7 @@ define([
this._settings[Common.Utils.documentSettingsType.Shape] = {panelId: "id-shape-settings", panel: rightMenu.shapeSettings, btn: rightMenu.btnShape, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Table] = {panelId: "id-table-settings", panel: rightMenu.tableSettings, btn: rightMenu.btnTable, hidden: 1, locked: false};
// this._settings[Common.Utils.documentSettingsType.Table] = {panelId: "id-table-settings", panel: rightMenu.tableSettings, btn: rightMenu.btnTable, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Pivot] = {panelId: "id-pivot-settings", panel: rightMenu.pivotSettings, btn: rightMenu.btnPivot, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false};
this._settings[Common.Utils.documentSettingsType.Cell] = {panelId: "id-cell-settings", panel: rightMenu.cellSettings, btn: rightMenu.btnCell, hidden: 1, locked: false};
@ -132,12 +132,12 @@ define([
Common.Utils.InternalSettings.set("sse-rightpanel-active-pivot", 1);
else if (type == Common.Utils.documentSettingsType.Chart && !this._settings[Common.Utils.documentSettingsType.Cell].hidden) {//sparkline
Common.Utils.InternalSettings.set("sse-rightpanel-active-spark", 2);
if (!this._settings[Common.Utils.documentSettingsType.Table].hidden) {
Common.Utils.InternalSettings.set("sse-rightpanel-active-table", Math.min(Common.Utils.InternalSettings.get("sse-rightpanel-active-table"), 1));
}
// if (!this._settings[Common.Utils.documentSettingsType.Table].hidden) {
// Common.Utils.InternalSettings.set("sse-rightpanel-active-table", Math.min(Common.Utils.InternalSettings.get("sse-rightpanel-active-table"), 1));
// }
} else if (Common.Utils.documentSettingsType.Cell) {
if (!this._settings[Common.Utils.documentSettingsType.Table].hidden)
Common.Utils.InternalSettings.set("sse-rightpanel-active-table", 0);
// if (!this._settings[Common.Utils.documentSettingsType.Table].hidden)
// Common.Utils.InternalSettings.set("sse-rightpanel-active-table", 0);
if (!this._settings[Common.Utils.documentSettingsType.Pivot].hidden)
Common.Utils.InternalSettings.set("sse-rightpanel-active-pivot", 0);
if (!this._settings[Common.Utils.documentSettingsType.Chart].hidden)
@ -237,12 +237,12 @@ define([
this._settings[Common.Utils.documentSettingsType.Paragraph].locked = this._state.wsProps['Objects'] && locktext;
}
if (formatTableInfo) {
settingsType = Common.Utils.documentSettingsType.Table;
this._settings[settingsType].props = formatTableInfo;
this._settings[settingsType].locked = isTableLocked;
this._settings[settingsType].hidden = 0;
}
// if (formatTableInfo) {
// settingsType = Common.Utils.documentSettingsType.Table;
// // this._settings[settingsType].props = formatTableInfo;
// this._settings[settingsType].locked = isTableLocked;
// this._settings[settingsType].hidden = 0;
// }
if (sparkLineInfo) {
settingsType = Common.Utils.documentSettingsType.Chart;
@ -313,19 +313,21 @@ define([
}
if (priorityactive<0 && !this._settings[Common.Utils.documentSettingsType.Cell].hidden &&
(!this._settings[Common.Utils.documentSettingsType.Table].hidden || !this._settings[Common.Utils.documentSettingsType.Pivot].hidden ||
(!this._settings[Common.Utils.documentSettingsType.Pivot].hidden ||
!this._settings[Common.Utils.documentSettingsType.Chart].hidden)) {
var tableactive = Common.Utils.InternalSettings.get("sse-rightpanel-active-table"),
pivotactive = Common.Utils.InternalSettings.get("sse-rightpanel-active-pivot"),
sparkactive = Common.Utils.InternalSettings.get("sse-rightpanel-active-spark");
if (!this._settings[Common.Utils.documentSettingsType.Table].hidden && !this._settings[Common.Utils.documentSettingsType.Chart].hidden) {
if (tableactive == sparkactive)
priorityactive = (tableactive===0) ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Chart;
else
priorityactive = (tableactive > sparkactive) ? Common.Utils.documentSettingsType.Table : Common.Utils.documentSettingsType.Chart;
} else if (!this._settings[Common.Utils.documentSettingsType.Table].hidden) {
priorityactive = (tableactive===0) ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Table;
} else if (!this._settings[Common.Utils.documentSettingsType.Chart].hidden) {
// if (!this._settings[Common.Utils.documentSettingsType.Table].hidden && !this._settings[Common.Utils.documentSettingsType.Chart].hidden) {
// if (tableactive == sparkactive)
// priorityactive = (tableactive===0) ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Chart;
// else
// priorityactive = (tableactive > sparkactive) ? Common.Utils.documentSettingsType.Table : Common.Utils.documentSettingsType.Chart;
// }
// else if (!this._settings[Common.Utils.documentSettingsType.Table].hidden) {
// priorityactive = (tableactive===0) ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Table;
// }
if (!this._settings[Common.Utils.documentSettingsType.Chart].hidden) {
priorityactive = (sparkactive===0) ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Chart;
}
if (!this._settings[Common.Utils.documentSettingsType.Pivot].hidden)
@ -353,7 +355,7 @@ define([
this._settings[Common.Utils.documentSettingsType.Image].needShow = false;
this._settings[Common.Utils.documentSettingsType.Chart].needShow = false;
this._settings[Common.Utils.documentSettingsType.Table].needShow = false;
// this._settings[Common.Utils.documentSettingsType.Table].needShow = false;
pivotInfo && (this._settings[Common.Utils.documentSettingsType.Pivot].needShow = false);
},
@ -378,9 +380,9 @@ define([
this._settings[Common.Utils.documentSettingsType.TextArt].needShow = true;
},
onInsertTable: function() {
// this._settings[Common.Utils.documentSettingsType.Table].needShow = true;
},
// onInsertTable: function() {
// // this._settings[Common.Utils.documentSettingsType.Table].needShow = true;
// },
onInsertPivot: function() {
this._settings[Common.Utils.documentSettingsType.Pivot].needShow = true;
@ -468,7 +470,7 @@ define([
this.rightmenu.shapeSettings.disableControls(disabled);
this.rightmenu.imageSettings.disableControls(disabled);
this.rightmenu.chartSettings.disableControls(disabled);
this.rightmenu.tableSettings.disableControls(disabled);
// this.rightmenu.tableSettings.disableControls(disabled);
this.rightmenu.pivotSettings.disableControls(disabled);
this.rightmenu.cellSettings.disableControls(disabled);
this.rightmenu.slicerSettings.disableControls(disabled);
@ -480,7 +482,7 @@ define([
if (disabled) {
this.rightmenu.btnText.setDisabled(disabled);
this.rightmenu.btnTable.setDisabled(disabled);
// this.rightmenu.btnTable.setDisabled(disabled);
this.rightmenu.btnImage.setDisabled(disabled);
this.rightmenu.btnShape.setDisabled(disabled);
this.rightmenu.btnTextArt.setDisabled(disabled);

View File

@ -0,0 +1,484 @@
/*
* (c) Copyright Ascensio System SIA 2010-2024
*
* 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-6 Ernesta Birznieka-Upish
* 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
*
*/
/**
* TableDesignTab.js
*
* Created on 07.07.2025
*
*/
define([
'core',
'spreadsheeteditor/main/app/view/TableDesignTab'
], function () {
'use strict';
SSE.Controllers.TableDesignTab = Backbone.Controller.extend(_.extend({
models : [],
collections : [
],
views : [
'TableDesignTab'
],
sdkViewName : '#id_main',
initialize: function () {
this._state = {
TableName: '',
TemplateName: '',
Range: '',
CheckHeader: false,
CheckTotal: false,
CheckBanded: false,
CheckFirst: false,
CheckLast: false,
CheckColBanded: false,
CheckFilter: false,
DisabledControls: false,
TableNameError: false
};
this.lockedControls = [];
this._locked = false;
this._originalProps = null;
this.addListeners({
'TableDesignTab': {
'tabledesigntab:insertslicer': _.bind(this.onInsertSlicer, this),
'tabledesigntab:advanced': _.bind(this.openAdvancedSettings, this),
'tabledesigntab:style': _.bind(this.onTableStyleSelect, this),
'tabledesigntab:selectdata': _.bind(this.onSelectData, this),
'tabledesign:namechanged': _.bind(this.onTableNameChanged, this),
'tabledesigntab:convertrange': _.bind(this.convertToRange, this),
'tabledesigntab:edit': _.bind(this.onEditClick, this),
'tabledesigntab:stylechange': _.bind(this.changeTableInfo, this)
},
});
},
onSelectData: function() {
var me = this;
if (me.api) {
var handlerDlg = function(dlg, result) {
if (result == 'ok') {
me.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None);
var settings = dlg.getSettings();
if (settings.selectionType == Asc.c_oAscSelectionType.RangeMax || settings.selectionType == Asc.c_oAscSelectionType.RangeRow ||
settings.selectionType == Asc.c_oAscSelectionType.RangeCol)
Common.UI.warning({
title: me.textLongOperation,
msg: me.warnLongOperation,
buttons: ['ok', 'cancel'],
callback: function(btn) {
if (btn == 'ok')
setTimeout(function() { me.api.asc_changeTableRange(me._state.TableName, settings.range)}, 1);
Common.NotificationCenter.trigger('edit:complete', me);
}
});
else
me.api.asc_changeTableRange(me._state.TableName, settings.range);
}
Common.NotificationCenter.trigger('edit:complete', me);
};
var win = new SSE.Views.TableOptionsDialog({
handler: handlerDlg
});
win.show();
win.setSettings({
api : me.api,
range : me._state.Range,
title: me.textResize
});
}
},
onTableNameChanged: function(input, newValue, oldValue) {
var oldName = this._state.TableName;
this._state.TableName = '';
if (oldName.toLowerCase() == newValue.toLowerCase()) {
Common.NotificationCenter.trigger('edit:complete', this);
return;
}
var me = this,
isvalid = this.api.asc_checkDefinedName(newValue, null);
if (isvalid.asc_getStatus() === true) isvalid = true;
else {
switch (isvalid.asc_getReason()) {
case Asc.c_oAscDefinedNameReason.IsLocked:
isvalid = this.textIsLocked;
break;
case Asc.c_oAscDefinedNameReason.Existed:
isvalid = this.textExistName;
break;
case Asc.c_oAscDefinedNameReason.NameReserved:
isvalid = this.textReservedName;
break;
default:
isvalid = this.textInvalidName;
}
}
if (isvalid === true) {
this.api.asc_changeDisplayNameTable(oldName, newValue);
Common.NotificationCenter.trigger('edit:complete', this);
} else if (!this._state.TableNameError) {
this._state.TableNameError = true;
Common.UI.alert({
msg: isvalid,
title: this.notcriticalErrorTitle,
iconCls: 'warn',
buttons: ['ok'],
callback: function(btn){
Common.NotificationCenter.trigger('edit:complete', this);
me._state.TableNameError = false;
}
});
}
},
ChangeSettings: function(props) {
if (props )//formatTableInfo
{
this._originalProps = props;
this.view._originalProps = props;
var view = this.view;
var value = props.asc_getTableName();
if (this._state.TableName!==value) {
view.txtTableName.setValue(value);
this._state.TableName=value;
}
this._state.Range = props.asc_getTableRange();
var needTablePictures = false;
value = props.asc_getFirstRow();
if (this._state.CheckHeader!==value) {
view.chHeaderRow.setValue(value, true);
this._state.CheckHeader=value;
needTablePictures = true;
}
value = props.asc_getLastRow();
if (this._state.CheckTotal!==value) {
view.chTotalRow.setValue(value, true);
this._state.CheckTotal=value;
needTablePictures = true;
}
value = props.asc_getBandHor();
if (this._state.CheckBanded!==value) {
view.chBandedRows.setValue(value, true);
this._state.CheckBanded=value;
needTablePictures = true;
}
value = props.asc_getFirstCol();
if (this._state.CheckFirst!==value) {
view.chFirstColumn.setValue(value, true);
this._state.CheckFirst=value;
needTablePictures = true;
}
value = props.asc_getLastCol();
if (this._state.CheckLast!==value) {
view.chLastColumn.setValue(value, true);
this._state.CheckLast=value;
needTablePictures = true;
}
value = props.asc_getBandVer();
if (this._state.CheckColBanded!==value) {
view.chBandedColumns.setValue(value, true);
this._state.CheckColBanded=value;
needTablePictures = true;
}
value = props.asc_getFilterButton();
if (this._state.CheckFilter!==value) {
view.chFilterButton.setValue(value, true);
this._state.CheckFilter=value;
}
Common.Utils.lockControls(Common.enumLock.isFilterAvailable, !this._state.CheckHeader || value===null, {array: [this.view.chFilterButton]});
if (needTablePictures)
this.onApiInitTableStyles(this.api.asc_getTablePictures(props));
// for table-template
value = props.asc_getTableStyleName();
if (this._state.TemplateName!==value || this._isTemplatesChanged) {
view.tableStyles.suspendEvents();
var rec = view.tableStyles.menuPicker.store.findWhere({
name: value
});
view.tableStyles.menuPicker.selectRecord(rec);
view.tableStyles.resumeEvents();
if (this._isTemplatesChanged) {
if (rec)
view.tableStyles.fillComboView(view.tableStyles.menuPicker.getSelectedRec(),true);
else
view.tableStyles.fillComboView(view.tableStyles.menuPicker.store.at(0), true);
}
this._state.TemplateName=value;
}
this._isTemplatesChanged = false;
}
},
onTableStyleSelect: function(record){
if (this.api) {
this.api.asc_changeAutoFilter(this._state.TableName, Asc.c_oAscChangeFilterOptions.style, record.get('name'));
}
Common.NotificationCenter.trigger('edit:complete', this);
},
convertToRange: function(btn) {
if (this.api) this.api.asc_convertTableToRange(this._state.TableName);
Common.NotificationCenter.trigger('edit:complete', this);
},
changeTableInfo: function(type, stateName, newValue) {
this._state[stateName] = undefined;
if (this.api)
this.api.asc_changeFormatTableInfo(this._state.TableName, type, newValue=='checked');
Common.NotificationCenter.trigger('edit:complete', this);
},
onEditClick: function(item) {
if (this.api) {
if (item.options.idx>=0 && item.options.idx<4)
this.api.asc_changeSelectionFormatTable(this._state.TableName, item.value);
else if (item.options.idx>=4 && item.options.idx<8) {
this.api.asc_insertCellsInTable(this._state.TableName, item.value);
} else {
this.api.asc_deleteCellsInTable(this._state.TableName, item.value);
}
}
Common.NotificationCenter.trigger('edit:complete', this);
},
setApi: function(api) {
if (api) {
this.api = api;
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
}
return this;
},
onSendThemeColors: function() {
if (this.view.tableStyles && this._originalProps) {
this.onApiInitTableStyles(this.api.asc_getTablePictures(this._originalProps));
this.view.tableStyles.menuPicker.scroller.update({alwaysVisibleY: true});
}
},
onApiInitTableStyles: function(Templates){
var self = this,
styles = this.view.tableStyles;
this._isTemplatesChanged = true;
var count = styles.menuPicker.store.length;
if (count>0 && count==Templates.length) {
var data = styles.menuPicker.dataViewItems;
var findDataViewItem = function(template) {
for(var i = 0; i < data.length; i++) {
if(data[i].model.get('name') && data[i].model.get('name') === template.asc_getName()) return data[i];
else if(data[i].model.get('caption') === template.asc_getDisplayName()) return data[i];
}
return undefined;
};
data && _.each(Templates, function(template, index){
var img = template.asc_getImage();
var dataViewItem = findDataViewItem(template);
dataViewItem && dataViewItem.model.set('imageUrl', img, {silent: true});
dataViewItem && $(dataViewItem.el).find('img').attr('src', img);
});
styles.fieldPicker.store.reset(styles.fieldPicker.store.models);
} else {
styles.menuPicker.store.reset([]);
var templates = [];
var groups = [
{id: 'menu-table-group-custom', caption: self.view.txtGroupTable_Custom, templates: []},
{id: 'menu-table-group-light', caption: self.view.txtGroupTable_Light, templates: []},
{id: 'menu-table-group-medium', caption: self.view.txtGroupTable_Medium, templates: []},
{id: 'menu-table-group-dark', caption: self.view.txtGroupTable_Dark, templates: []},
{id: 'menu-table-group-no-name', caption: '&nbsp', templates: []},
];
_.each(Templates, function(template, index){
var tip = template.asc_getDisplayName(),
groupItem = '',
lastWordInTip = null;
if (template.asc_getType()==0) {
var arr = tip.split(' ');
lastWordInTip = arr.pop();
if(template.asc_getName() === null){
groupItem = 'menu-table-group-light';
}
else {
if(arr.length > 0){
groupItem = 'menu-table-group-' + arr[arr.length - 1].toLowerCase();
}
if(groups.some(function(item) {return item.id === groupItem;}) == false) {
groupItem = 'menu-table-group-no-name';
}
}
arr = 'txtTable_' + arr.join('');
tip = self.view[arr] ? self.view[arr] + ' ' + lastWordInTip : tip;
lastWordInTip = parseInt(lastWordInTip);
}
else {
groupItem = 'menu-table-group-custom'
}
groups.filter(function(item){ return item.id == groupItem; })[0].templates.push({
id : Common.UI.getId(),
name : template.asc_getName(),
caption : template.asc_getDisplayName(),
type : template.asc_getType(),
imageUrl : template.asc_getImage(),
group : groupItem,
allowSelected : true,
selected : false,
tip : tip,
numInGroup : (lastWordInTip != null && !isNaN(lastWordInTip) ? lastWordInTip : null)
});
});
var sortFunc = function(a, b) {
var aNum = a.numInGroup,
bNum = b.numInGroup;
return aNum - bNum;
};
groups[1].templates.sort(sortFunc);
groups[2].templates.sort(sortFunc);
groups[3].templates.sort(sortFunc);
groups = groups.filter(function(item, index){
return item.templates.length > 0
});
groups.forEach(function(item){
templates = templates.concat(item.templates);
delete item.templates;
});
styles.groups.reset(groups);
styles.menuPicker.store.reset(templates);
}
},
setMode: function(mode) {
this.appConfig = mode;
return this;
},
openAdvancedSettings: function(e) {
var me = this;
var win;
if (me.api && !this._locked){
(new SSE.Views.TableSettingsAdvanced(
{
tableProps: me._originalProps,
api: me.api,
handler: function(result, value) {
if (result == 'ok' && me.api && value) {
me.api.asc_changeFormatTableInfo(me._state.TableName, Asc.c_oAscChangeTableStyleInfo.advancedSettings, value);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show();
}
},
setConfig: function(config) {
this.view = this.createView('TableDesignTab', {
toolbar: config.toolbar.toolbar
});
},
SetDisabled: function(state) {
this.view && this.view.SetDisabled(state);
},
onInsertSlicer: function() {
var me = this,
props = me.api.asc_beforeInsertSlicer();
if (props) {
(new SSE.Views.SlicerAddDialog({
props: props,
handler: function (result, settings) {
if (me && me.api && result == 'ok') {
me.api.asc_insertSlicer(settings);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show();
}
},
createToolbarPanel: function() {
return this.view.getPanel();
},
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.rangeSelectionMode || !this.appConfig.isEdit || !this.view) return;
var tableInfo = info.asc_getFormatTableInfo();
if (tableInfo)
this.ChangeSettings(tableInfo);
},
onCellsRange: function(status) {
this.rangeSelectionMode = (status != Asc.c_oAscSelectionDialogType.None);
},
}, SSE.Controllers.TableDesignTab || {}));
});

View File

@ -204,7 +204,8 @@ define([
is_lockText: false,
is_lockShape: false,
isUserProtected: false,
showPivotTab: false
showPivotTab: false,
showTableDesignTab: false
};
this.binding = {};
@ -3161,7 +3162,7 @@ define([
}
need_disable = this._state.controlsdisabled.filters || (val===null);
toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable,
{ array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation) });
{ array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnInsertTable, toolbar.btnDataValidation).concat(toolbar.btnsRemoveDuplicates)});
toolbar.lockToolbar(Common.enumLock.tableHasSlicer, filterInfo && filterInfo.asc_getIsSlicerAdded(), { array: toolbar.btnsSetAutofilter });
@ -3195,6 +3196,16 @@ define([
this._state.multiselect = info.asc_getMultiselect();
toolbar.lockToolbar(Common.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]});
var intabledesign = info.asc_getFormatTableInfo();
if (this._state.intabledesign !== intabledesign) {
if ( !intabledesign && this.toolbar.isTabActive('tabledesign') )
this.toolbar.setTab('home');
this.toolbar.setVisible('tabledesign', !!intabledesign);
if (intabledesign && this._state.showTableDesignTab)
this.toolbar.setTab('tabledesign');
this._state.intabledesign = intabledesign;
}
var inpivot = !!info.asc_getPivotTableInfo();
if (this._state.inpivot !== inpivot) {
if ( !inpivot && this.toolbar.isTabActive('pivot') )
@ -3204,13 +3215,12 @@ define([
this.toolbar.setTab('pivot');
this._state.inpivot = inpivot;
}
toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)});
toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnDataValidation).concat(toolbar.btnsRemoveDuplicates)});
toolbar.lockToolbar(Common.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]});
need_disable = !this.appConfig.canModifyFilter;
toolbar.lockToolbar(Common.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate,
toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)});
toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], toolbar.btnInsertTable, toolbar.btnDataValidation).concat(toolbar.btnsRemoveDuplicates).concat(toolbar.btnsTableDesign)});
}
val = xfs.asc_getNumFormatInfo();
@ -4544,7 +4554,7 @@ define([
me.toolbar.btnsSetAutofilter = datatab.getButtons('set-filter');
me.toolbar.btnsClearAutofilter = datatab.getButtons('clear-filter');
me.toolbar.btnCustomSort = datatab.getButtons('sort-custom');
me.toolbar.btnRemoveDuplicates = datatab.getButtons('rem-duplicates');
me.toolbar.btnsRemoveDuplicates = [datatab.getButtons('rem-duplicates')];
me.toolbar.btnDataValidation = datatab.getButtons('data-validation');
var formulatab = me.getApplication().getController('FormulaDialog');
@ -4567,6 +4577,22 @@ define([
}
}
if ( config.canFeatureTable ) {
tab = {caption: 'Table Design', action: 'tabledesign', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-tabledesign', dataHintTitle: 'B'};
var tabledesigntab = me.getApplication().getController('TableDesignTab');
tabledesigntab.setApi(me.api).setConfig({toolbar: me});
var view = tabledesigntab.getView('TableDesignTab');
var tabledesignbuttons = view.getButtons();
var $panel = tabledesigntab.createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, Common.UI.LayoutManager.lastTabIdx+1);
me._state.intabledesign && me.toolbar.setVisible('tabledesign', true);
Array.prototype.push.apply(me.toolbar.lockControls, tabledesignbuttons);
}
me.toolbar.btnsRemoveDuplicates.push(view.getButtons('rem-duplicates'));
me.toolbar.btnsTableDesign = tabledesignbuttons;
}
if (!config.compactHeader) {
// hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();

View File

@ -16,7 +16,7 @@
<div class="tool-menu-btns" role="menubar" aria-label="<%= scope.ariaRightMenu %>" aria-orientation="vertical">
<div class="ct-btn-category arrow-left"></div>
<button id="id-right-menu-cell" class="btn btn-category arrow-left" data-hint="0" data-hint-direction="left" data-hint-offset="big" content-target="id-cell-settings"><i class="icon toolbar__icon btn-menu-cell">&nbsp;</i></button>
<button id="id-right-menu-table" class="btn btn-category arrow-left" data-hint="0" data-hint-direction="left" data-hint-offset="big" content-target="id-table-settings"><i class="icon toolbar__icon btn-menu-table">&nbsp;</i></button>
<!-- <button id="id-right-menu-table" class="btn btn-category arrow-left" data-hint="0" data-hint-direction="left" data-hint-offset="big" content-target="id-table-settings"><i class="icon toolbar__icon btn-menu-table">&nbsp;</i></button> -->
<button id="id-right-menu-shape" class="btn btn-category arrow-left" data-hint="0" data-hint-direction="left" data-hint-offset="big" content-target="id-shape-settings"><i class="icon toolbar__icon btn-menu-shape">&nbsp;</i></button>
<button id="id-right-menu-image" class="btn btn-category arrow-left" data-hint="0" data-hint-direction="left" data-hint-offset="big" content-target="id-image-settings"><i class="icon toolbar__icon btn-menu-image">&nbsp;</i></button>
<button id="id-right-menu-chart" class="btn btn-category arrow-left" data-hint="0" data-hint-direction="left" data-hint-offset="big" content-target="id-chart-settings"><i class="icon toolbar__icon btn-menu-chart">&nbsp;</i></button>

View File

@ -230,7 +230,7 @@ define([
this.chartSettings = new SSE.Views.ChartSettings();
this.shapeSettings = new SSE.Views.ShapeSettings();
this.textartSettings = new SSE.Views.TextArtSettings();
this.tableSettings = new SSE.Views.TableSettings();
// this.tableSettings = new SSE.Views.TableSettings();
this.pivotSettings = new SSE.Views.PivotSettings();
this.cellSettings = new SSE.Views.CellSettings();
this.slicerSettings = new SSE.Views.SlicerSettings();
@ -280,7 +280,7 @@ define([
this.chartSettings.setApi(api).on('updatescroller', _updateScroller);
this.shapeSettings.setApi(api).on('eyedropper', _.bind(_isEyedropperStart, this)).on('updatescroller', _updateScroller);
this.textartSettings.setApi(api).on('eyedropper', _.bind(_isEyedropperStart, this)).on('updatescroller', _updateScroller);
this.tableSettings.setApi(api);
// this.tableSettings.setApi(api);
this.pivotSettings.setApi(api);
this.cellSettings.setApi(api).on('eyedropper', _.bind(_isEyedropperStart, this));
this.slicerSettings.setApi(api);
@ -292,7 +292,7 @@ define([
this.mode = mode;
this.imageSettings && this.imageSettings.setMode(mode);
this.shapeSettings && this.shapeSettings.setMode(mode);
this.tableSettings && this.tableSettings.setMode(mode);
// this.tableSettings && this.tableSettings.setMode(mode);
return this;
},

View File

@ -0,0 +1,508 @@
/*
* (c) Copyright Ascensio System SIA 2010-2024
*
* 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-6 Ernesta Birznieka-Upish
* 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
*
*/
/**
* TableDesignTab.js
*
* Created on 07.07.2025
*
*/
define([
'common/main/lib/util/utils',
'common/main/lib/component/Button',
'common/main/lib/component/BaseView',
'common/main/lib/component/Layout'
], function () {
'use strict';
SSE.Views.TableDesignTab = Common.UI.BaseView.extend(_.extend((function(){
var template = '<section id="table-styles-panel" class="panel" data-tab="tabledesign" role="tabpanel" aria-labelledby="view">' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-resize-table"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-rows-cols"></span>' +
'</div>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-remove-duplicates"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-convert-to-range"></span>' +
'</div>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group">' +
'<span class="btn-slot text x-huge" id="slot-btn-insert-slicer"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-insert-pivot"></span>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-header-row"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-total-row"></span>' +
'</div>' +
'</div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-first-column"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-last-column"></span>' +
'</div>' +
'</div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-banded-rows"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-banded-columns"></span>' +
'</div>' +
'</div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-filter-button"></span>' +
'</div>' +
'<div class="elset"></div>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group">' +
'<span class="btn-slot text x-huge" id="slot-btn-alt-text"></span>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group flex small" id="slot-field-table-styles" style="width: 100%; min-width: 105px;" data-group-width="100%">' +
'</div>' +
'</section>';
function setEvents() {
var me = this;
me.btnResizeTable.on('click', function (btn, e) {
me.fireEvent('tabledesigntab:selectdata');
});
me.btnAltText.on('click', function (btn, e) {
me.fireEvent('tabledesigntab:advanced');
});
this.tableStyles.on('click', function (combo, record) {
me.fireEvent('tabledesigntab:style', [record]);
});
this.btnInsertSlicer.on('click', function (btn, e) {
me.fireEvent('tabledesigntab:insertslicer');
});
this.txtTableName.on('click', function (btn, e) {
me.fireEvent('tabledesign:namechanged');
});
this.btnConvertRange.on('click', function (btn, e) {
me.fireEvent('tabledesigntab:convertrange')
});
this.btnInsertPivot.on('click', function () {
me.fireEvent('pivottable:create');
});
this.btnRemDuplicates.on('click', function(btn){
Common.NotificationCenter.trigger('data:remduplicates', this);
});
this.btnEdit.menu.on('item:click', function(menu, item, e) {
me.fireEvent('tabledesigntab:edit', [item])
});
this.tableStyles.openButton.menu.on('show:after', function () {
me.tableStyles.menuPicker.scroller.update({alwaysVisibleY: true});
});
}
return {
initialize: function (options) {
var controller = SSE.getController('TableDesignTab');
this._state = controller._state
Common.UI.BaseView.prototype.initialize.call(this);
this.lockedControls = [];
var me = this,
_set = Common.enumLock;
this.btnResizeTable = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-resize-table',
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
caption: this.txtResize,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
this.lockedControls.push(this.btnResizeTable);
this.btnEdit = new Common.UI.Button({
cls : 'btn-toolbar align-left',
iconCls : 'toolbar__icon btn-rows-and-columns',
caption : this.txtRowsCols,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
style : 'width: 100%;',
menu: new Common.UI.Menu({
menuAlign: 'tr-br',
items: [
{ caption: this.selectRowText, value: Asc.c_oAscChangeSelectionFormatTable.row, idx: 0 },
{ caption: this.selectColumnText, value: Asc.c_oAscChangeSelectionFormatTable.column, idx: 1 },
{ caption: this.selectColumnData, value: Asc.c_oAscChangeSelectionFormatTable.data, idx: 2 },
{ caption: this.selectTableText, value: Asc.c_oAscChangeSelectionFormatTable.all, idx: 3 },
{ caption: '--' },
{ caption: this.insertRowAboveText, value: Asc.c_oAscInsertOptions.InsertTableRowAbove, idx: 4 },
{ caption: this.insertRowBelowText, value: Asc.c_oAscInsertOptions.InsertTableRowBelow, idx: 5 },
{ caption: this.insertColumnLeftText, value: Asc.c_oAscInsertOptions.InsertTableColLeft, idx: 6 },
{ caption: this.insertColumnRightText, value: Asc.c_oAscInsertOptions.InsertTableColRight, idx: 7 },
{ caption: '--' },
{ caption: this.deleteRowText, value: Asc.c_oAscDeleteOptions.DeleteRows, idx: 8 },
{ caption: this.deleteColumnText, value: Asc.c_oAscDeleteOptions.DeleteColumns, idx: 9 },
{ caption: this.deleteTableText, value: Asc.c_oAscDeleteOptions.DeleteTable, idx: 10 }
]
}),
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnEdit);
this.btnEdit.menu.on('show:after', _.bind( function(menu){
menu.items[5].setDisabled(!this._originalProps.asc_getIsInsertRowAbove());
menu.items[6].setDisabled(!this._originalProps.asc_getIsInsertRowBelow());
menu.items[7].setDisabled(!this._originalProps.asc_getIsInsertColumnLeft());
menu.items[8].setDisabled(!this._originalProps.asc_getIsInsertColumnRight());
menu.items[10].setDisabled(!this._originalProps.asc_getIsDeleteRow());
menu.items[11].setDisabled(!this._originalProps.asc_getIsDeleteColumn());
menu.items[12].setDisabled(!this._originalProps.asc_getIsDeleteTable());
}, this));
this.lockedControls.push(this.btnEdit);
this.btnRemDuplicates = new Common.UI.Button({
cls : 'btn-toolbar align-left',
iconCls : 'toolbar__icon btn-remove-duplicates',
caption : this.txtRemDuplicates,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
style : 'width: 100%;',
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnRemDuplicates);
this.btnConvertRange = new Common.UI.Button({
cls : 'btn-toolbar align-left',
iconCls : 'toolbar__icon btn-convert-to-range',
caption : this.txtConvertToRange,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
style : 'width: 100%;',
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnConvertRange);
this.btnInsertSlicer = new Common.UI.Button({
cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-big-slicer',
caption : this.txtSlicer,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
style : 'width: 100%;',
dataHint : '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnInsertSlicer);
this.btnInsertPivot = new Common.UI.Button({
cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-big-pivot-sum',
caption : this.txtPivot,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
style : 'width: 100%;',
dataHint : '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnInsertPivot);
this.chHeaderRow = new Common.UI.CheckBox({
labelText: this.txtHeaderRow,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set.wsLock, _set.cantModifyFilter],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chHeaderRow);
this.chTotalRow = new Common.UI.CheckBox({
labelText: this.txtTotalRow,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set.wsLock, _set.cantModifyFilter],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chTotalRow);
this.chFirstColumn = new Common.UI.CheckBox({
labelText: this.txtFirstColumn,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set['FormatCells'], _set.cantModifyFilter],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chFirstColumn);
this.chLastColumn = new Common.UI.CheckBox({
labelText: this.txtLastColumn,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set['FormatCells'], _set.cantModifyFilter],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chLastColumn);
this.chBandedRows = new Common.UI.CheckBox({
labelText: this.txtBandedRows,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set['FormatCells'], _set.cantModifyFilter],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chBandedRows);
this.chBandedColumns = new Common.UI.CheckBox({
labelText: this.txtBandedColumns,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set['FormatCells'], _set.cantModifyFilter],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chBandedColumns);
this.chFilterButton = new Common.UI.CheckBox({
labelText: this.txtFilterButton,
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell, _set.wsLock, _set.cantModifyFilter, _set.isFilterAvailable],
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.chFilterButton);
this.btnAltText = new Common.UI.Button({
cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-big-pivot-sum',
caption : this.txtAltText,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
style : 'width: 100%;',
dataHint : '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnAltText);
this.txtTableName = new Common.UI.InputField({
el : $('#table-txt-name'),
name : 'tablename',
style : 'width: 100%;',
validateOnBlur: false
});
this.lockedControls.push(this.txtTableName);
this.tableStyles = new Common.UI.ComboDataView({
cls : 'combo-table-template',
style : 'min-width: 103px; max-width: 517px;',
enableKeyEvents : true,
itemWidth : 60,
itemHeight : 44,
menuMaxHeight : 300,
groups : new Common.UI.DataViewGroupStore(),
autoWidth : true,
lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.wsLock, _set.cantModifyFilter],
beforeOpenHandler: function(e) {
var cmp = this,
menu = cmp.openButton.menu,
columnCount = 7;
if (menu.cmpEl) {
var itemEl = $(cmp.cmpEl.find('.dataview.inner .style').get(0)).parent();
var itemMargin = 8;
var itemWidth = itemEl.is(':visible') ? parseFloat(itemEl.css('width')) :
(cmp.itemWidth + parseFloat(itemEl.css('padding-left')) + parseFloat(itemEl.css('padding-right')) +
parseFloat(itemEl.css('border-left-width')) + parseFloat(itemEl.css('border-right-width')));
menu.menuAlignEl = cmp.cmpEl;
menu.menuAlign = 'tl-tl';
var menuWidth = columnCount * (itemMargin + itemWidth) + 17, // for scroller
buttonOffsetLeft = Common.Utils.getOffset(cmp.openButton.$el).left;
if (menuWidth>Common.Utils.innerWidth())
menuWidth = Math.max(Math.floor((Common.Utils.innerWidth()-17)/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth) + 17;
var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - Math.min(menuWidth, buttonOffsetLeft) - 1;
if (Common.UI.isRTL()) {
offset = cmp.openButton.$el.width() + parseFloat($(cmp.$el.find('.combo-dataview').get(0)).css('padding-left'));
}
menu.setOffset(Common.UI.isRTL() ? offset : Math.min(offset, 0));
menu.cmpEl.css({
'width': menuWidth,
'min-height': cmp.cmpEl.height()
});
}
},
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: '-16, 0'
});
this.lockedControls.push(this.tableStyles);
this.chHeaderRow.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.rowHeader, 'CheckHeader'));
this.chTotalRow.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.rowTotal, 'CheckTotal'));
this.chBandedRows.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.rowBanded, 'CheckBanded'));
this.chFirstColumn.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.columnFirst, 'CheckFirst'));
this.chLastColumn.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.columnLast, 'CheckLast'));
this.chBandedColumns.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.columnBanded, 'CheckColBanded'));
this.chFilterButton.on('change', _.bind(this.onCheckStyleChange, this, Asc.c_oAscChangeTableStyleInfo.filterButton, 'CheckFilter'));
Common.UI.LayoutManager.addControls(this.lockedControls);
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},
onCheckStyleChange: function(type, stateName, field, newValue, oldValue, eOpts) {
var me = this;
me.fireEvent('tabledesigntab:stylechange', [type, stateName, newValue]);
},
render: function (el) {
if ( el ) el.html( this.getPanel() );
return this;
},
getPanel: function () {
this.$el = $(_.template(template)( {} ));
var $host = this.$el;
this.btnResizeTable && this.btnResizeTable.render($host.find('#slot-btn-resize-table'));
this.btnEdit && this.btnEdit.render($host.find('#slot-btn-rows-cols'));
this.btnConvertRange && this.btnConvertRange.render($host.find('#slot-btn-convert-to-range'));
this.btnInsertSlicer && this.btnInsertSlicer.render($host.find('#slot-btn-insert-slicer'));
this.btnInsertPivot && this.btnInsertPivot.render($host.find('#slot-btn-insert-pivot'));
this.chHeaderRow && this.chHeaderRow.render($host.find('#slot-chk-header-row'));
this.chTotalRow && this.chTotalRow.render($host.find('#slot-chk-total-row'));
this.chFirstColumn && this.chFirstColumn.render($host.find('#slot-chk-first-column'));
this.chLastColumn && this.chLastColumn.render($host.find('#slot-chk-last-column'));
this.chBandedRows && this.chBandedRows.render($host.find('#slot-chk-banded-rows'));
this.chBandedColumns && this.chBandedColumns.render($host.find('#slot-chk-banded-columns'));
this.chFilterButton && this.chFilterButton.render($host.find('#slot-chk-filter-button'));
this.btnAltText && this.btnAltText.render($host.find('#slot-btn-alt-text'));
this.btnRemDuplicates && this.btnRemDuplicates.render($host.find('#slot-btn-remove-duplicates'));
this.tableStyles.render(this.$el.find('#slot-field-table-styles'));
return this.$el;
},
onAppReady: function (config) {
var me = this;
(new Promise(function (accept, reject) {
accept();
})).then(function(){
me.btnResizeTable.updateHint(me.tipResize);
me.btnEdit.updateHint(me.tipRowsCols);
me.btnConvertRange.updateHint(me.tipConvertRange);
me.btnInsertSlicer.updateHint(me.tipInsertSlicer);
me.btnInsertPivot.updateHint(me.tipInsertPivot);
me.btnAltText.updateHint(me.tipAltText);
me.btnRemDuplicates.updateHint(me.tipRemDuplicates);
setEvents.call(me);
});
},
show: function () {
Common.UI.BaseView.prototype.show.call(this);
this.fireEvent('show', this);
},
getButtons: function(type) {
if (type===undefined) {
return this.lockedControls;
} else if (type==='rem-duplicates') {
return this.btnRemDuplicates
}
return [];
},
SetDisabled: function (state) {
this.lockedControls && this.lockedControls.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
},
txtResize: 'Resize table',
txtRowsCols: 'Rows & Columns',
tipRowsCols: 'Rows & Columns',
txtGroupTable_Custom: 'Custom',
txtGroupTable_Light: 'Light',
txtGroupTable_Medium: 'Medium',
txtGroupTable_Dark: 'Dark',
tipResize: 'Change the size of this table by adding or removing rows and columns.',
tipRemDuplicates: 'Removing duplicate lines from a sheet.',
tipConvertRange: 'Convert this table to a regular range of cells.',
tipInsertSlicer: 'Insert slicer',
tipInsertPivot: 'Insert Pivot Table',
tipHeaderRow: 'Show or hide the header row in a table.',
tipAltText: 'Set alternative title and description for a table.',
selectRowText: 'Select row',
selectColumnText: 'Select entire column',
selectColumnData: 'Select column data',
selectTableText: 'Select table',
insertRowAboveText: 'Insert row above',
insertRowBelowText: 'Insert row below',
insertColumnLeftText: 'Insert column left',
insertColumnRightText: 'Insert column right',
deleteRowText: 'Delete row',
deleteColumnText: 'Delete column',
deleteTableText: 'Delete table',
txtRemDuplicates: 'Remove duplicates',
txtConvertToRange: 'Convert to range',
txtSlicer: 'Slicer',
txtPivot: 'Pivot',
txtHeaderRow: 'Header row',
txtTotalRow: 'Total row',
txtFirstColumn: 'First column',
txtLastColumn: 'Last column',
txtBandedRows: 'Banded rows',
txtBandedColumns: 'Banded columns',
txtFilterButton: 'Filter button',
txtAltText: 'Alt text'
}
}()), SSE.Views.TableDesignTab || {}));
});

View File

@ -49,7 +49,7 @@ define([
'use strict';
SSE.Views.TableSettings = Backbone.View.extend(_.extend({
el: '#id-table-settings',
// el: '#id-table-settings',
// Compile our stats template
template: _.template(menuTemplate),

View File

@ -135,6 +135,7 @@ require([
'PivotTable',
'DataTab',
'ViewTab',
'TableDesignTab',
'Search',
'WBProtection',
'Common.Controllers.Fonts',
@ -172,6 +173,7 @@ require([
'spreadsheeteditor/main/app/controller/PivotTable',
'spreadsheeteditor/main/app/controller/DataTab',
'spreadsheeteditor/main/app/controller/ViewTab',
'spreadsheeteditor/main/app/controller/TableDesignTab',
'spreadsheeteditor/main/app/controller/Search',
'spreadsheeteditor/main/app/controller/WBProtection',
// 'spreadsheeteditor/main/app/view/ParagraphSettings',

View File

@ -1990,6 +1990,14 @@
"SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar",
"SSE.Controllers.Viewport.textHideGridlines": "Hide Gridlines",
"SSE.Controllers.Viewport.textHideHeadings": "Hide Headings",
"SSE.Controllers.TableDesignTab.textLongOperation": "Long operation",
"SSE.Controllers.TableDesignTab.warnLongOperation": "The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?",
"SSE.Controllers.TableDesignTab.textResize": "Resize table",
"SSE.Controllers.TableDesignTab.textExistName": "ERROR! A range with such a name already exists",
"SSE.Controllers.TableDesignTab.textInvalidName": "ERROR! Invalid table name",
"SSE.Controllers.TableDesignTab.textIsLocked": "This element is being edited by another user.",
"SSE.Controllers.TableDesignTab.textReservedName": "The name you are trying to use is already referenced in cell formulas. Please use some other name.",
"SSE.Controllers.TableDesignTab.notcriticalErrorTitle": "Warning",
"SSE.Views.AdvancedSeparatorDialog.strDecimalSeparator": "Decimal separator",
"SSE.Views.AdvancedSeparatorDialog.strThousandsSeparator": "Thousands separator",
"SSE.Views.AdvancedSeparatorDialog.textLabel": "Settings used to recognize numeric data",
@ -4631,6 +4639,43 @@
"SSE.Views.ViewTab.tipViewPageBreak": "See where the page breaks will appear when your document is printed",
"SSE.Views.ViewTab.txtViewNormal": "Normal",
"SSE.Views.ViewTab.txtViewPageBreak": "Page Break Preview",
"SSE.Views.TableDesignTab.txtResize": "Resize table",
"SSE.Views.TableDesignTab.txtRowsCols": "Rows & Columns",
"SSE.Views.TableDesignTab.tipRowsCols": "Rows & Columns",
"SSE.Views.TableDesignTab.txtGroupTable_Custom": "Custom",
"SSE.Views.TableDesignTab.txtGroupTable_Light": "Light",
"SSE.Views.TableDesignTab.txtGroupTable_Medium": "Medium",
"SSE.Views.TableDesignTab.txtGroupTable_Dark": "Dark",
"SSE.Views.TableDesignTab.tipResize": "Change the size of this table by adding or removing rows and columns.",
"SSE.Views.TableDesignTab.tipRemDuplicates": "Removing duplicate lines from a sheet.",
"SSE.Views.TableDesignTab.tipConvertRange": "Convert this table to a regular range of cells.",
"SSE.Views.TableDesignTab.tipInsertSlicer": "Insert slicer",
"SSE.Views.TableDesignTab.tipInsertPivot": "Insert Pivot Table",
"SSE.Views.TableDesignTab.tipHeaderRow": "Show or hide the header row in a table.",
"SSE.Views.TableDesignTab.tipAltText": "Set alternative title and description for a table.",
"SSE.Views.TableDesignTab.selectRowText": "Select row",
"SSE.Views.TableDesignTab.selectColumnText": "Select entire column",
"SSE.Views.TableDesignTab.selectColumnData": "Select column data",
"SSE.Views.TableDesignTab.selectTableText": "Select table",
"SSE.Views.TableDesignTab.insertRowAboveText": "Insert row above",
"SSE.Views.TableDesignTab.insertRowBelowText": "Insert row below",
"SSE.Views.TableDesignTab.insertColumnLeftText": "Insert column left",
"SSE.Views.TableDesignTab.insertColumnRightText": "Insert column right",
"SSE.Views.TableDesignTab.deleteRowText": "Delete row",
"SSE.Views.TableDesignTab.deleteColumnText": "Delete column",
"SSE.Views.TableDesignTab.deleteTableText": "Delete table",
"SSE.Views.TableDesignTab.txtRemDuplicates": "Remove duplicates",
"SSE.Views.TableDesignTab.txtConvertToRange": "Convert to range",
"SSE.Views.TableDesignTab.txtSlicer": "Slicer",
"SSE.Views.TableDesignTab.txtPivot": "Pivot",
"SSE.Views.TableDesignTab.txtHeaderRow": "Header row",
"SSE.Views.TableDesignTab.txtTotalRow": "Total row",
"SSE.Views.TableDesignTab.txtFirstColumn": "First column",
"SSE.Views.TableDesignTab.txtLastColumn": "Last column",
"SSE.Views.TableDesignTab.txtBandedRows": "Banded rows",
"SSE.Views.TableDesignTab.txtBandedColumns": "Banded columns",
"SSE.Views.TableDesignTab.txtFilterButton": "Filter button",
"SSE.Views.TableDesignTab.txtAltText": "Alt text",
"SSE.Views.WatchDialog.closeButtonText": "Close",
"SSE.Views.WatchDialog.textAdd": "Add watch",
"SSE.Views.WatchDialog.textBook": "Book",