[SSE] Fix Bug 56893

This commit is contained in:
Andrey Shimagin 2022-04-28 08:43:22 +03:00
parent d4452051ee
commit e948eb5461
2 changed files with 17 additions and 13 deletions

View file

@ -366,18 +366,6 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props =>
api.asc_showWorksheet(sheetIndex);
f7.popover.close('#idx-all-list');
}
let tab = $$('.sheet-tabs .tab').eq(sheetIndex);
if(tab.length === 0) {
tab = $$('.sheet-tabs .tab').eq(sheetIndex - 1);
setTimeout(() => $$('.sheet-tabs').scrollLeft( tab.offset().left + tab.width(), 500));
} else if(tab.offset().left < 0) {
$$('.sheet-tabs').scrollLeft( $$('.sheet-tabs').scrollLeft() + tab.offset().left - 96, 500);
} else {
$$('.sheet-tabs').scrollLeft( $$('.sheet-tabs').scrollLeft() + (tab.offset().left + tab.width() - $$('.sheet-tabs').width()/1.5), 500);
}
};
return (

View file

@ -1,4 +1,4 @@
import React, { Fragment, useState } from 'react';
import React, { Fragment, useEffect, useState } from 'react';
import {f7, View, Link, Icon, Navbar, Popover, List, ListGroup, ListItem, ListButton, Actions, ActionsGroup, ActionsButton, Sheet, Page } from 'framework7-react';
import { useTranslation } from 'react-i18next';
import { Device } from '../../../../common/mobile/utils/device';
@ -41,6 +41,22 @@ const PageAllList = (props) => {
const { sheets, onTabListClick } = props;
const allSheets = sheets.sheets;
useEffect(() => {
const tabs = $$('.sheet-tabs .tab');
let tab = tabs.eq(sheets.activeWorksheet);
if(sheets.activeWorksheet !== -1) {
if(tab.length === 0) {
tab = tabs.eq(tabs.length - 1);
$$('.sheet-tabs').scrollLeft( tab.offset().left + tab.width(), 500);
} else if(tab.offset().left < 0) {
$$('.sheet-tabs').scrollLeft( $$('.sheet-tabs').scrollLeft() + tab.offset().left - 96, 500);
} else {
$$('.sheet-tabs').scrollLeft( $$('.sheet-tabs').scrollLeft() + (tab.offset().left + tab.width() - $$('.sheet-tabs').width()), 500);
}
}
}, [sheets.activeWorksheet]);
return (
<View style={{height: '240px'}}>
<Page>