Merge pull request #896 from ONLYOFFICE/feature/freeze-panes

[SSE] Add presets for freeze panes
This commit is contained in:
Julia Radzhabova 2021-05-24 11:33:04 +03:00 committed by GitHub
commit 033f78275f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 9 deletions

View file

@ -120,9 +120,9 @@ define([
{array: [this.view.btnCloseView]});
},
onFreeze: function(state) {
onFreeze: function(type) {
if (this.api) {
this.api.asc_freezePane();
this.api.asc_freezePane(type);
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
@ -206,7 +206,7 @@ define([
var params = this.api.asc_getSheetViewSettings();
this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true);
this.view.chGridlines.setValue(!!params.asc_getShowGridLines(), true);
this.view.btnFreezePanes.toggle(!!params.asc_getIsFreezePane(), true);
this.view.btnFreezePanes.menu.items && this.view.btnFreezePanes.menu.items[0].setCaption(!!params.asc_getIsFreezePane() ? this.view.textUnFreeze : this.view.capBtnFreeze);
var currentSheet = this.api.asc_getActiveWorksheetIndex();
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));

View file

@ -57,8 +57,8 @@ define([
});
}
me.btnFreezePanes.on('click', function (btn, e) {
me.fireEvent('viewtab:freeze', [btn.pressed]);
me.btnFreezePanes.menu.on('item:click', function (menu, item, e) {
me.fireEvent('viewtab:freeze', [item.value]);
});
this.chFormula.on('change', function (field, value) {
me.fireEvent('viewtab:formula', [0, value]);
@ -125,8 +125,7 @@ define([
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-freeze-panes',
caption: this.capBtnFreeze,
split: false,
enableToggle: true,
menu: true,
lock: [_set.sheetLock, _set.lostConnect, _set.coAuth]
});
this.lockedControls.push(this.btnFreezePanes);
@ -196,6 +195,22 @@ define([
me.btnCreateView.updateHint(me.tipCreate);
me.btnCloseView.updateHint(me.tipClose);
}
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
}
]
}));
me.btnFreezePanes.updateHint(me.tipFreeze);
setEvents.call(me);
@ -315,7 +330,10 @@ define([
textClose: 'Close',
textFormula: 'Formula bar',
textHeadings: 'Headings',
textGridlines: 'Gridlines'
textGridlines: 'Gridlines',
textFreezeRow: 'Freeze Top Row',
textFreezeCol: 'Freeze Top Column',
textUnFreeze: 'Unfreeze Panes'
}
}()), SSE.Views.ViewTab || {}));
});

View file

@ -3411,5 +3411,8 @@
"SSE.Views.ViewTab.tipClose": "Close sheet view",
"SSE.Views.ViewTab.tipCreate": "Create sheet view",
"SSE.Views.ViewTab.tipFreeze": "Freeze panes",
"SSE.Views.ViewTab.tipSheetView": "Sheet view"
"SSE.Views.ViewTab.tipSheetView": "Sheet view",
"SSE.Views.ViewTab.textFreezeRow": "Freeze Top Row",
"SSE.Views.ViewTab.textFreezeCol": "Freeze Top Column",
"SSE.Views.ViewTab.textUnFreeze": "Unfreeze Panes"
}