@@ -105,6 +105,7 @@ export function getColumns(
105105 columns : ColumnData ,
106106 level = 0 ,
107107 types ?: ColumnTypes ,
108+ resFromRoot ?: Partial < ColumnCollection >
108109) : ColumnCollection {
109110 const collection : ColumnCollection = {
110111 // columns as they are in stores per type
@@ -121,10 +122,10 @@ export function getColumns(
121122 colPinStart : [ ] ,
122123 colPinEnd : [ ] ,
123124 } ,
124- // max depth level for column grouping
125- maxLevel : level ,
126125 // sorting
127126 sort : { } ,
127+ // max depth level for column grouping
128+ maxLevel : level ,
128129 } ;
129130
130131 return reduce (
@@ -135,7 +136,8 @@ export function getColumns(
135136 res = gatherGroup (
136137 res ,
137138 colData ,
138- getColumns ( colData . children , level + 1 , types ) ,
139+ getColumns ( colData . children , level + 1 , types , res ) ,
140+ resFromRoot ?. columns ,
139141 level ,
140142 ) ;
141143 return res ;
@@ -164,7 +166,7 @@ export function getColumns(
164166 res . columnByProp [ regularColumn . prop ] . push ( regularColumn ) ;
165167
166168 // trigger setup hook if present
167- regularColumn . beforeSetup && regularColumn . beforeSetup ( regularColumn ) ;
169+ regularColumn . beforeSetup ?. ( regularColumn ) ;
168170 return res ;
169171 } ,
170172 collection ,
@@ -175,6 +177,7 @@ export function gatherGroup<T extends ColumnCollection>(
175177 res : T ,
176178 colData : ColumnGrouping ,
177179 collection : T ,
180+ existingColumnsByType ?: ColumnCollection [ 'columns' ] ,
178181 level = 0 ,
179182) : T {
180183 // group template
@@ -195,7 +198,7 @@ export function gatherGroup<T extends ColumnCollection>(
195198 // fill grouping
196199 const itemLength = collectionItem . length ;
197200 if ( itemLength ) {
198- const columnLength = resultItem . length ;
201+ const columnLength = [ ... ( existingColumnsByType ?. [ type ] || [ ] ) , ... resultItem ] . length ;
199202 // fill columns
200203 resultItem . push ( ...collectionItem ) ;
201204
0 commit comments