add evaluating jf initial swiper slide in diagram types (#976)

Co-authored-by: Polina <polina.hudyakova@onlyoffice.com>
Co-committed-by: Polina <polina.hudyakova@onlyoffice.com>
This commit is contained in:
Polina
2026-02-13 18:14:14 +00:00
committed by Maxim Kadushkin
parent 45b8e5a9ab
commit 6ed4fef78c
3 changed files with 28 additions and 4 deletions

View File

@ -177,6 +177,14 @@ const PageChartType = props => {
const chartProperties = storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties();
const curType = chartProperties && chartProperties.getType();
let initialSlide = 0;
if (curType !== undefined && types && types.length) {
const rowIndex = types.findIndex(row => row.some(item => item.type === curType));
if (rowIndex >= 0) {
initialSlide = Math.min(Math.floor(rowIndex / countTypesSlide), countSlides - 1);
}
}
return (
<Page>
<Navbar backLink={t('Edit.textBack')} title={t('Edit.textType')} />
@ -184,7 +192,7 @@ const PageChartType = props => {
<div id={"edit-chart-type"} className="page-content no-padding-top dataview">
<div className="chart-types">
{types && types.length ? (
<Swiper pagination={true}>
<Swiper pagination={true} initialSlide={initialSlide}>
{arraySlides.map((_, indexSlide) => {
let typesSlide = types.slice(indexSlide * countTypesSlide, (indexSlide * countTypesSlide) + countTypesSlide);

View File

@ -184,7 +184,15 @@ const PageChartType = props => {
const storeFocusObjects = props.storeFocusObjects;
const chartProperties = storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties();
const curType = chartProperties && chartProperties.getType();
let initialSlide = 0;
if (curType !== undefined && types && types.length) {
const rowIndex = types.findIndex(row => row.some(item => item.type === curType));
if (rowIndex >= 0) {
initialSlide = Math.min(Math.floor(rowIndex / countTypesSlide), countSlides - 1);
}
}
return (
<Page>
<Navbar backLink={t('View.Edit.textBack')} title={t('View.Edit.textType')} />
@ -192,7 +200,7 @@ const PageChartType = props => {
<div id={"edit-chart-type"} className="page-content no-padding-top dataview">
<div className="chart-types">
{types && types.length ? (
<Swiper pagination={true}>
<Swiper pagination={true} initialSlide={initialSlide}>
{arraySlides.map((_, indexSlide) => {
let typesSlide = types.slice(indexSlide * countTypesSlide, (indexSlide * countTypesSlide) + countTypesSlide);

View File

@ -178,13 +178,21 @@ const PageChartType = props => {
const chartProperties = storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties();
const curType = chartProperties && chartProperties.getType();
let initialSlide = 0;
if (curType !== undefined && types && types.length) {
const rowIndex = types.findIndex(row => row.some(item => item.type === curType));
if (rowIndex >= 0) {
initialSlide = Math.min(Math.floor(rowIndex / countTypesSlide), countSlides - 1);
}
}
return (
<Page>
<Navbar backLink={t('View.Edit.textBack')} title={t('View.Edit.textType')} />
<div id={"edit-chart-type"} className="page-content no-padding-top dataview">
<div className="chart-types">
{types && types.length ? (
<Swiper pagination={true}>
<Swiper pagination={true} initialSlide={initialSlide}>
{arraySlides.map((_, indexSlide) => {
let typesSlide = types.slice(indexSlide * countTypesSlide, (indexSlide * countTypesSlide) + countTypesSlide);