[SSE] Add presets for freeze panes

This commit is contained in:
Julia Radzhabova 2021-05-21 19:12:54 +03:00
parent 63c7c9aa31
commit a095cc56f4
3 changed files with 30 additions and 9 deletions

View file

@ -120,9 +120,9 @@ define([
{array: [this.view.btnCloseView]}); {array: [this.view.btnCloseView]});
}, },
onFreeze: function(state) { onFreeze: function(type) {
if (this.api) { if (this.api) {
this.api.asc_freezePane(); this.api.asc_freezePane(type);
} }
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
}, },
@ -206,7 +206,7 @@ define([
var params = this.api.asc_getSheetViewSettings(); var params = this.api.asc_getSheetViewSettings();
this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true); this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true);
this.view.chGridlines.setValue(!!params.asc_getShowGridLines(), 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(); var currentSheet = this.api.asc_getActiveWorksheetIndex();
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet)); this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));

View file

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

View file

@ -3412,5 +3412,8 @@
"SSE.Views.ViewTab.tipClose": "Close sheet view", "SSE.Views.ViewTab.tipClose": "Close sheet view",
"SSE.Views.ViewTab.tipCreate": "Create sheet view", "SSE.Views.ViewTab.tipCreate": "Create sheet view",
"SSE.Views.ViewTab.tipFreeze": "Freeze panes", "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"
} }