@@ -295,35 +295,35 @@ export class KolTableStateless implements TableStatelessAPI {
295295 return max ;
296296 }
297297
298- private getThePrimaryHeadersWithKeysIfExists ( headers : KoliBriTableHeaderCell [ ] [ ] ) : KoliBriTableHeaderCell [ ] {
299- const primaryHeadersWithKeys : KoliBriTableHeaderCell [ ] = [ ] ;
298+ private getThePrimaryHeadersWithKeyOrRenderFunction ( headers : KoliBriTableHeaderCell [ ] [ ] ) : KoliBriTableHeaderCell [ ] {
299+ const primaryHeaders : KoliBriTableHeaderCell [ ] = [ ] ;
300300
301301 headers . forEach ( ( cells ) => {
302302 cells . forEach ( ( cell ) => {
303- if ( typeof cell . key === 'string' ) {
304- primaryHeadersWithKeys . push ( cell ) ;
303+ if ( typeof cell . key === 'string' || typeof cell . render === 'function' ) {
304+ primaryHeaders . push ( cell ) ;
305305 }
306306 } ) ;
307307 } ) ;
308308
309- return primaryHeadersWithKeys ;
309+ return primaryHeaders ;
310310 }
311311
312312 private getPrimaryHeaders ( headers : KoliBriTableHeaders ) : KoliBriTableHeaderCell [ ] {
313- let primaryHeadersWithKeys : KoliBriTableHeaderCell [ ] = this . getThePrimaryHeadersWithKeysIfExists ( headers . horizontal ?? [ ] ) ;
313+ let primaryHeaders : KoliBriTableHeaderCell [ ] = this . getThePrimaryHeadersWithKeyOrRenderFunction ( headers . horizontal ?? [ ] ) ;
314314
315315 /**
316316 * It is important to note that the rendering direction of the data is implicitly set,
317317 * if either the horizontal or vertical header cells have keys.
318318 */
319319 this . horizontal = true ;
320- if ( primaryHeadersWithKeys . length === 0 ) {
321- primaryHeadersWithKeys = this . getThePrimaryHeadersWithKeysIfExists ( headers . vertical ?? [ ] ) ;
322- if ( primaryHeadersWithKeys . length > 0 ) {
320+ if ( primaryHeaders . length === 0 ) {
321+ primaryHeaders = this . getThePrimaryHeadersWithKeyOrRenderFunction ( headers . vertical ?? [ ] ) ;
322+ if ( primaryHeaders . length > 0 ) {
323323 this . horizontal = false ;
324324 }
325325 }
326- return primaryHeadersWithKeys ;
326+ return primaryHeaders ;
327327 }
328328
329329 private getColumnPositionMap ( ) : Map < string , number > {
@@ -398,9 +398,9 @@ export class KolTableStateless implements TableStatelessAPI {
398398 if (
399399 typeof sortedPrimaryHeader [ j ] === 'object' &&
400400 sortedPrimaryHeader [ j ] !== null &&
401- typeof sortedPrimaryHeader [ j ] . key === 'string' &&
402401 typeof row === 'object' &&
403- row !== null
402+ row !== null &&
403+ ( typeof sortedPrimaryHeader [ j ] . key === 'string' || typeof sortedPrimaryHeader [ j ] . render === 'function' )
404404 ) {
405405 dataRow . push ( {
406406 ...sortedPrimaryHeader [ j ] ,
@@ -414,9 +414,9 @@ export class KolTableStateless implements TableStatelessAPI {
414414 if (
415415 typeof sortedPrimaryHeader [ i ] === 'object' &&
416416 sortedPrimaryHeader [ i ] !== null &&
417- typeof sortedPrimaryHeader [ i ] . key === 'string' &&
418417 typeof data [ j ] === 'object' &&
419- data [ j ] !== null
418+ data [ j ] !== null &&
419+ ( typeof sortedPrimaryHeader [ i ] . key === 'string' || typeof sortedPrimaryHeader [ i ] . render === 'function' )
420420 ) {
421421 dataRow . push ( {
422422 ...sortedPrimaryHeader [ i ] ,
0 commit comments