@@ -89,6 +89,9 @@ const parseColumnsConfiguration = (columns, currentProfile) => {
8989 * specific configuration. If not specified, any visible column will be displayed
9090 * @property {boolean } horizontalScrollEnabled if true, enable horizontal scroll in case of overflow,
9191 * fixed layout otherwise
92+ * @property {boolean } verticallScrollEnabled if true, enable vertical (table internal) scroll in case of overflow,
93+ * whole page vertical scroll otherwise. Note that for this option to working,
94+ * all predecesors of the node returned by this function must have display property column-flex and height: 100%
9295 */
9396
9497/**
@@ -130,6 +133,7 @@ export const table = (
130133 profile : currentProfile = profiles . none ,
131134 horizontalScrollEnabled = false ,
132135 freezeFirstColumn = false ,
136+ verticalScrollEnabled = false ,
133137 } = tableConfiguration || { } ;
134138 const { idKey, displayedColumns } = parseColumnsConfiguration ( columns , currentProfile ) ;
135139
@@ -142,18 +146,26 @@ export const table = (
142146 Error ( `Unhandled type <${ typeof data } > of data : ${ data ? JSON . stringify ( data ) : data } ` ) ;
143147 }
144148
145- return h ( `.fitting-table-wrapper${ horizontalScrollEnabled ? '.scroll-auto.shadow-level1' : '' } ` , h (
146- `table.table.table-hover.shadow-level1.${ freezeFirstColumn ? '.freeze-first-column' : '' } ` ,
147- {
148- style : `table-layout: ${ horizontalScrollEnabled ? 'auto' : 'fixed' } ` ,
149- } ,
150- [
151- headers ( displayedColumns , models ) ,
152- remoteDataTableBody (
153- remoteData ,
154- ( payload ) => rows ( payload , idKey , displayedColumns , rowsConfiguration ) ,
155- displayedColumns . length ,
156- ) ,
157- ] ,
149+ const scrollEnabled = horizontalScrollEnabled || verticalScrollEnabled ;
150+ const wrapperClassesExpression = scrollEnabled ? '.fitting-table-wrapper.scroll-auto' : '' ;
151+
152+ const optionalTableClassesExpression = freezeFirstColumn && horizontalScrollEnabled ? '.freeze-first-column' : ''
153+
154+ const wrappedTableNode = h ( wrapperClassesExpression ,
155+ h ( `table.table.table-hover.shadow-level1${ optionalTableClassesExpression } ` ,
156+ {
157+ style : `table-layout: ${ horizontalScrollEnabled ? 'auto' : 'fixed' } ` ,
158+ } ,
159+ [
160+ headers ( displayedColumns , models ) ,
161+ remoteDataTableBody (
162+ remoteData ,
163+ ( payload ) => rows ( payload , idKey , displayedColumns , rowsConfiguration ) ,
164+ displayedColumns . length ,
165+ ) ,
166+ ] ,
158167 ) ) ;
168+ return scrollEnabled && ! verticalScrollEnabled
169+ ? h ( '' , wrappedTableNode ) // Disable y-scroll
170+ : wrappedTableNode
159171} ;
0 commit comments