@@ -69,13 +69,13 @@ import {
6969 type RenderQueueItem ,
7070} from './utils/types' ;
7171
72- const SPLITTER_CLASS = 'dx-splitter' ;
73- const SPLITTER_ITEM_CLASS = 'dx-splitter-item' ;
74- const SPLITTER_ITEM_HIDDEN_CONTENT_CLASS = 'dx-splitter-item-hidden-content' ;
72+ export const SPLITTER_CLASS = 'dx-splitter' ;
73+ export const SPLITTER_ITEM_CLASS = 'dx-splitter-item' ;
74+ export const SPLITTER_ITEM_HIDDEN_CONTENT_CLASS = 'dx-splitter-item-hidden-content' ;
75+ export const INVISIBLE_STATE_CLASS = 'dx-state-invisible' ;
7576const SPLITTER_ITEM_DATA_KEY = 'dxSplitterItemData' ;
7677const HORIZONTAL_ORIENTATION_CLASS = 'dx-splitter-horizontal' ;
7778const VERTICAL_ORIENTATION_CLASS = 'dx-splitter-vertical' ;
78- const INVISIBLE_STATE_CLASS = 'dx-state-invisible' ;
7979
8080const DEFAULT_RESIZE_HANDLE_SIZE = 8 ;
8181
@@ -118,9 +118,11 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
118118
119119 private _renderQueue : RenderQueueItem [ ] = [ ] ;
120120
121- private _panesCacheSize : ( PaneCache | undefined ) [ ] = [ ] ;
121+ // @ts -expect-error ts-error
122+ private _panesCacheSize : ( PaneCache | undefined ) [ ] ;
122123
123- private _panesCacheSizeVisible : ( PaneCache | undefined ) [ ] = [ ] ;
124+ // @ts -expect-error ts-error
125+ private _panesCacheSizeVisible : ( PaneCache | undefined ) [ ] ;
124126
125127 private _savedCollapsingEvent ?: DxEvent < InteractionEvent > ;
126128
@@ -201,11 +203,11 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
201203
202204 this . _toggleOrientationClass ( ) ;
203205
204- super . _initMarkup ( ) ;
205-
206206 this . _panesCacheSize = [ ] ;
207207 this . _panesCacheSizeVisible = [ ] ;
208208
209+ super . _initMarkup ( ) ;
210+
209211 this . _attachResizeObserverSubscription ( ) ;
210212 }
211213
@@ -240,6 +242,7 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
240242 this . _layout = this . _getDefaultLayoutBasedOnSize ( ) ;
241243
242244 this . _applyStylesFromLayout ( this . _layout ) ;
245+ this . _setPanesCacheSize ( ) ;
243246 this . _updateItemSizes ( ) ;
244247
245248 this . _shouldRecalculateLayout = false ;
@@ -255,6 +258,7 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
255258 if ( this . _isVisible ( ) ) {
256259 this . _layout = this . _getDefaultLayoutBasedOnSize ( ) ;
257260 this . _applyStylesFromLayout ( this . _layout ) ;
261+ this . _setPanesCacheSize ( ) ;
258262
259263 this . _updateItemSizes ( ) ;
260264 } else {
@@ -264,6 +268,45 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
264268 this . _processRenderQueue ( ) ;
265269 }
266270
271+ _setPanesCacheSize ( ) : void {
272+ const { items = [ ] } = this . option ( ) ;
273+
274+ items . forEach ( ( item : Item , index ) => {
275+ const restriction = this . _itemRestrictions [ index ] ;
276+
277+ if ( ! isDefined ( restriction ?. size ) ) {
278+ return ;
279+ }
280+
281+ if ( item . collapsed === true ) {
282+ const isLastNonCollapsed = index >= findLastIndexOfNonCollapsedItem ( items ) ;
283+ const isLastVisible = this . _isLastVisibleItem ( index ) ;
284+
285+ const direction = isLastVisible || isLastNonCollapsed
286+ ? CollapseExpandDirection . Previous
287+ : CollapseExpandDirection . Next ;
288+
289+ this . _panesCacheSize [ index ] = {
290+ size : restriction . size ,
291+ direction,
292+ } ;
293+ }
294+
295+ if ( item . visible === false ) {
296+ const isLastVisible = index >= findLastIndexOfVisibleItem ( items ) ;
297+
298+ const direction = isLastVisible
299+ ? CollapseExpandDirection . Previous
300+ : CollapseExpandDirection . Next ;
301+
302+ this . _panesCacheSizeVisible [ index ] = {
303+ size : restriction . size ,
304+ direction,
305+ } ;
306+ }
307+ } ) ;
308+ }
309+
267310 _processRenderQueue ( ) : void {
268311 if ( this . _isRenderQueueEmpty ( ) ) {
269312 return ;
@@ -665,6 +708,7 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
665708 this . _layout = this . _getDefaultLayoutBasedOnSize ( item ) ;
666709
667710 this . _applyStylesFromLayout ( this . getLayout ( ) ) ;
711+ this . _setPanesCacheSize ( ) ;
668712 this . _updateItemSizes ( ) ;
669713 break ;
670714 case 'maxSize' :
0 commit comments