Skip to content

Commit 86c67ed

Browse files
Merge branch '26_1' into 26_1_regenerate_wrappers
2 parents d0fac10 + c706390 commit 86c67ed

4 files changed

Lines changed: 339 additions & 818 deletions

File tree

packages/devextreme/js/__internal/ui/splitter/splitter.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -726,18 +726,38 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
726726
direction,
727727
);
728728

729+
this._recalculateLayout(collapsedDelta, paneIndex);
730+
}
731+
732+
_recalculateLayout(delta: number, paneIndex: number | undefined): void {
729733
this._itemRestrictions.forEach((pane) => {
730-
pane.maxSize = undefined;
731734
pane.resizable = undefined;
732735
});
733736

734-
this._layout = getNextLayout(
735-
this.getLayout(),
736-
collapsedDelta,
737+
const currentLayout = this.getLayout();
738+
739+
let newLayout = getNextLayout(
740+
currentLayout,
741+
delta,
737742
paneIndex,
738743
this._itemRestrictions,
739744
);
740745

746+
if (newLayout === currentLayout) {
747+
this._itemRestrictions.forEach((pane) => {
748+
pane.maxSize = undefined;
749+
});
750+
751+
newLayout = getNextLayout(
752+
currentLayout,
753+
delta,
754+
paneIndex,
755+
this._itemRestrictions,
756+
);
757+
}
758+
759+
this._layout = newLayout;
760+
741761
this._applyStylesFromLayout(this.getLayout());
742762
this._updateItemSizes();
743763
}
@@ -846,22 +866,7 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
846866
this._collapseDirection,
847867
);
848868

849-
this._itemRestrictions.forEach((pane) => {
850-
if (item.collapsed) {
851-
pane.maxSize = undefined;
852-
}
853-
pane.resizable = undefined;
854-
});
855-
856-
this._layout = getNextLayout(
857-
this.getLayout(),
858-
collapsedDelta,
859-
this._activeResizeHandleIndex,
860-
this._itemRestrictions,
861-
);
862-
863-
this._applyStylesFromLayout(this.getLayout());
864-
this._updateItemSizes();
869+
this._recalculateLayout(collapsedDelta, this._activeResizeHandleIndex);
865870

866871
this._updateResizeHandlesResizableState();
867872
this._updateResizeHandlesCollapsibleState();

packages/devextreme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
"vinyl-named": "1.1.0",
214214
"webpack": "5.105.4",
215215
"webpack-stream": "7.0.0",
216-
"yaml": "2.5.0",
216+
"yaml": "2.8.3",
217217
"yargs": "17.7.2"
218218
},
219219
"scripts": {

packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js

Lines changed: 151 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,62 @@ QUnit.module('Pane sizing', moduleConfig, () => {
901901
{ targetButton: 'next', resizeHandleIndex: 1, expectedLayout: ['10.1626', '89.8374', '0'] },
902902
{ targetButton: 'prev', resizeHandleIndex: 1, expectedLayout: ['10.1626', '79.6748', '10.1626'] },
903903
],
904+
},
905+
{
906+
items: [ { resizable: true, collapsed: false, collapsible: true, size: '200px', minSize: '100px', maxSize: '250px' }, { resizable: true, size: '200px', minSize: '100px', maxSize: '200px' }, { }],
907+
scenarios: [
908+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['0', '20.3252', '79.6748'] },
909+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['20.3252', '10.1626', '69.5122'] },
910+
],
911+
},
912+
{
913+
items: [{ collapsible: true }, { collapsible: true, maxSize: 300 }],
914+
scenarios: [
915+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['0', '100'] },
916+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['69.7581', '30.2419'] },
917+
],
918+
},
919+
{
920+
items: [{ collapsible: true, maxSize: 300 }, { collapsible: true }],
921+
scenarios: [
922+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['0', '100'] },
923+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['30.2419', '69.7581'] },
924+
],
925+
},
926+
{
927+
items: [{ collapsible: true, maxSize: 300 }, { collapsible: true }],
928+
scenarios: [
929+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['0', '100'] },
930+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['30.2419', '69.7581'] },
931+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['100', '0'] },
932+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['30.2419', '69.7581'] },
933+
],
934+
},
935+
{
936+
items: [{ collapsible: true }, { collapsible: true, maxSize: 200 }, { collapsible: true }],
937+
scenarios: [
938+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['0', '20.3252', '79.6748'] },
939+
],
940+
},
941+
{
942+
items: [{ collapsible: true }, { collapsible: true, maxSize: 200 }, { collapsible: true, maxSize: 200 }],
943+
scenarios: [
944+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['0', '79.6748', '20.3252'] },
945+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['59.3496', '20.3252', '20.3252'] },
946+
],
947+
},
948+
{
949+
items: [{ collapsible: true }, { collapsible: true, maxSize: 200 }, { collapsible: true }],
950+
scenarios: [
951+
{ targetButton: 'next', resizeHandleIndex: 1, expectedLayout: ['79.6748', '20.3252', '0'] },
952+
],
953+
},
954+
{
955+
items: [{ collapsible: true, collapsedSize: 100 }, { collapsible: true, maxSize: 300 }],
956+
scenarios: [
957+
{ targetButton: 'prev', resizeHandleIndex: 0, expectedLayout: ['10.0806', '89.9194'] },
958+
{ targetButton: 'next', resizeHandleIndex: 0, expectedLayout: ['69.7581', '30.2419'] },
959+
],
904960
}
905961
].forEach(({ items, scenarios }) => {
906962
QUnit.test(`The pane should restore its size after collapsing and expanding by click, items: ${JSON.stringify(items)}`, function(assert) {
@@ -1603,11 +1659,104 @@ QUnit.module('Pane visibility', moduleConfig, () => {
16031659
paneIndex: 1,
16041660
visible: false,
16051661
expected: {
1606-
layout: ['10.2459', '0', '69.2623', '20.4918'],
1607-
itemSizes: [100.812, 0, 681.539, 201.617],
1662+
layout: ['10.2459', '0', '25.4065', '64.3476'],
1663+
itemSizes: [100.812, 0, 250, 633.18],
16081664
handlesCount: 2
16091665
}
16101666
}]
1667+
}, {
1668+
dataSource: [{ visible: true }, { size: '300px', maxSize: '300px' }],
1669+
scenarios: [{
1670+
paneIndex: 0,
1671+
visible: false,
1672+
expected: {
1673+
layout: ['0', '100'],
1674+
itemSizes: [0, 1000],
1675+
handlesCount: 0
1676+
}
1677+
}, {
1678+
paneIndex: 0,
1679+
visible: true,
1680+
expected: {
1681+
layout: ['69.7581', '30.2419'],
1682+
itemSizes: [692, 300],
1683+
handlesCount: 1
1684+
}
1685+
}]
1686+
}, {
1687+
dataSource: [{ size: '300px', maxSize: '300px' }, { visible: true }],
1688+
scenarios: [{
1689+
paneIndex: 1,
1690+
visible: false,
1691+
expected: {
1692+
layout: ['100', '0'],
1693+
itemSizes: [1000, 0],
1694+
handlesCount: 0
1695+
}
1696+
}, {
1697+
paneIndex: 1,
1698+
visible: true,
1699+
expected: {
1700+
layout: ['30.2419', '69.7581'],
1701+
itemSizes: [300, 692],
1702+
handlesCount: 1
1703+
}
1704+
}]
1705+
}, {
1706+
dataSource: [{ visible: true, size: '400px' }, { size: '200px', maxSize: '250px' }, {}],
1707+
scenarios: [{
1708+
paneIndex: 0,
1709+
visible: false,
1710+
expected: {
1711+
layout: ['0', '25.2016', '74.7984'],
1712+
itemSizes: [0, 250, 742],
1713+
handlesCount: 1
1714+
}
1715+
}]
1716+
}, {
1717+
dataSource: [{ size: 200, maxSize: 250 }, { visible: true }, { size: 200, maxSize: 250 }],
1718+
scenarios: [{
1719+
paneIndex: 1,
1720+
visible: false,
1721+
expected: {
1722+
layout: ['20.3252', '0', '79.6748'],
1723+
itemSizes: [201.625, 0, 790.375],
1724+
handlesCount: 1
1725+
}
1726+
}]
1727+
}, {
1728+
dataSource: [{}, { size: '200px', maxSize: '250px' }, { visible: true, size: '300px' }],
1729+
scenarios: [{
1730+
paneIndex: 2,
1731+
visible: false,
1732+
expected: {
1733+
layout: ['74.7984', '25.2016', '0'],
1734+
itemSizes: [742, 250, 0],
1735+
handlesCount: 1
1736+
}
1737+
}]
1738+
}, {
1739+
dataSource: [{ visible: true, size: '300px' }, { size: '100px', minSize: '80px', maxSize: '200px' }, {}],
1740+
scenarios: [{
1741+
paneIndex: 0,
1742+
visible: false,
1743+
expected: {
1744+
layout: ['0', '20.1613', '79.8387'],
1745+
itemSizes: [0, 200, 792],
1746+
handlesCount: 1
1747+
}
1748+
}]
1749+
}, {
1750+
dataSource: [{ visible: false }, { maxSize: '300px' }],
1751+
scenarios: [{
1752+
paneIndex: 0,
1753+
visible: true,
1754+
expected: {
1755+
layout: ['69.7581', '30.2419'],
1756+
itemSizes: [692, 300],
1757+
handlesCount: 1
1758+
}
1759+
}]
16111760
}].forEach(({ dataSource, scenarios }) => {
16121761
QUnit.test(`Size distribution after changing pane.visibility at runtime, dataSource: ${JSON.stringify(dataSource)}, ${orientation} orientation`, function(assert) {
16131762
this.reinit({

0 commit comments

Comments
 (0)