@@ -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 work,
94+ * all predecesors of the node returned by this function must have display property column-flex and height: 100%
9295 */
9396
9497/**
@@ -126,7 +129,12 @@ export const table = (
126129 }
127130
128131 // Extract the profile of the table
129- const { profile : currentProfile = profiles . none , horizontalScrollEnabled = false , freezeFirstColumn = false } = tableConfiguration || { } ;
132+ const {
133+ profile : currentProfile = profiles . none ,
134+ horizontalScrollEnabled = false ,
135+ freezeFirstColumn = false ,
136+ verticalScrollEnabled = false ,
137+ } = tableConfiguration || { } ;
130138 const { idKey, displayedColumns } = parseColumnsConfiguration ( columns , currentProfile ) ;
131139
132140 let remoteData ;
@@ -138,18 +146,29 @@ export const table = (
138146 Error ( `Unhandled type <${ typeof data } > of data : ${ data ? JSON . stringify ( data ) : data } ` ) ;
139147 }
140148
141- return h ( `${ horizontalScrollEnabled ? '.scroll-auto.shadow-level1' : '' } ` , h (
142- `table.table.table-hover.shadow-level1.no-z-index${ freezeFirstColumn ? '.freeze-first-column' : '' } ` ,
143- {
144- style : `table-layout: ${ horizontalScrollEnabled ? 'auto' : 'fixed' } ` ,
145- } ,
146- [
147- headers ( displayedColumns , models ) ,
148- remoteDataTableBody (
149- remoteData ,
150- ( payload ) => rows ( payload , idKey , displayedColumns , rowsConfiguration ) ,
151- displayedColumns . length ,
152- ) ,
153- ] ,
154- ) ) ;
149+ const scrollEnabled = horizontalScrollEnabled || verticalScrollEnabled ;
150+ const wrapperClassesExpression = scrollEnabled ? '.sticky-table-wrapper.scroll-auto' : '' ;
151+
152+ const optionalTableClassesExpression = freezeFirstColumn && horizontalScrollEnabled ? '.freeze-first-column' : '' ;
153+
154+ const wrappedTableNode = h (
155+ wrapperClassesExpression ,
156+ h (
157+ `table.table.table-hover.shadow-level1${ optionalTableClassesExpression } ` ,
158+ {
159+ style : `table-layout: ${ horizontalScrollEnabled ? 'auto' : 'fixed' } ` ,
160+ } ,
161+ [
162+ headers ( displayedColumns , models ) ,
163+ remoteDataTableBody (
164+ remoteData ,
165+ ( payload ) => rows ( payload , idKey , displayedColumns , rowsConfiguration ) ,
166+ displayedColumns . length ,
167+ ) ,
168+ ] ,
169+ ) ,
170+ ) ;
171+ return scrollEnabled && ! verticalScrollEnabled
172+ ? h ( '' , wrappedTableNode ) // Disable y-scroll
173+ : wrappedTableNode ;
155174} ;
0 commit comments