@@ -324,10 +324,18 @@ export const ToniqListTable = defineToniqElement<ListTableInputs>()({
324
324
if ( container instanceof HTMLElement ) {
325
325
state . debouncedResize ( ( ) => {
326
326
requestAnimationFrame ( ( ) => {
327
- updateState ( {
328
- canScroll : container . scrollWidth > container . clientWidth ,
329
- tableListLeft : container . getBoundingClientRect ( ) . left ,
330
- } ) ;
327
+ const newCanScroll = container . scrollWidth > container . clientWidth ;
328
+ const newTableListLeft = container . getBoundingClientRect ( ) . left ;
329
+
330
+ if (
331
+ newCanScroll !== state . canScroll ||
332
+ newTableListLeft !== state . tableListLeft
333
+ ) {
334
+ updateState ( {
335
+ canScroll : newCanScroll ,
336
+ tableListLeft : newTableListLeft ,
337
+ } ) ;
338
+ }
331
339
} ) ;
332
340
} ) ;
333
341
}
@@ -366,54 +374,52 @@ export const ToniqListTable = defineToniqElement<ListTableInputs>()({
366
374
isSticky ? calculateLeft ( columnItem . key as string ) : undefined ,
367
375
) }
368
376
>
369
- ${ guard ( [ rows ] , ( ) =>
370
- repeat (
371
- rows ,
372
- ( row , rowIndex ) => rowIndex ,
373
- ( row , rowIndex ) => {
374
- const rowItem = {
375
- contents : row . cells [ columnItem . key as keyof typeof row ] ,
376
- rowActions : row . rowActions ,
377
- } as {
378
- contents : HtmlInterpolation ;
379
- rowActions : typeof row . rowActions ;
380
- } ;
381
-
382
- return html `
383
- < div
384
- class ="column-content "
385
- ${ rowIndex > 0
386
- ? listen ( 'click' , ( clickEvent ) => {
387
- rowItem ?. rowActions ?. click ?.( {
388
- clickEvent,
389
- dispatch,
390
- } ) ;
391
- } )
392
- : nothing }
393
- >
394
- ${ renderIf (
395
- rowIndex === 0 ,
396
- html `
397
- < span class ="header " style =${ columnItem . style } >
398
- ${ columnItem . title }
399
- </ span >
400
- ` ,
401
- html `
402
- < div
403
- class ="content-wrapper "
404
- ${ listen ( 'click' , ( event ) => {
405
- event . preventDefault ( ) ;
406
- event . stopPropagation ( ) ;
407
- } ) }
408
- >
409
- ${ rowItem . contents }
410
- </ div >
411
- ` ,
412
- ) }
413
- </ div >
414
- ` ;
415
- } ,
416
- ) ,
377
+ ${ repeat (
378
+ rows ,
379
+ ( row , rowIndex ) => rowIndex ,
380
+ ( row , rowIndex ) => {
381
+ const rowItem = {
382
+ contents : row . cells [ columnItem . key as keyof typeof row ] ,
383
+ rowActions : row . rowActions ,
384
+ } as {
385
+ contents : HtmlInterpolation ;
386
+ rowActions : typeof row . rowActions ;
387
+ } ;
388
+
389
+ return html `
390
+ < div
391
+ class ="column-content "
392
+ ${ rowIndex > 0
393
+ ? listen ( 'click' , ( clickEvent ) => {
394
+ rowItem ?. rowActions ?. click ?.( {
395
+ clickEvent,
396
+ dispatch,
397
+ } ) ;
398
+ } )
399
+ : nothing }
400
+ >
401
+ ${ renderIf (
402
+ rowIndex === 0 ,
403
+ html `
404
+ < span class ="header " style =${ columnItem . style } >
405
+ ${ columnItem . title }
406
+ </ span >
407
+ ` ,
408
+ html `
409
+ < div
410
+ class ="content-wrapper "
411
+ ${ listen ( 'click' , ( event ) => {
412
+ event . preventDefault ( ) ;
413
+ event . stopPropagation ( ) ;
414
+ } ) }
415
+ >
416
+ ${ guard ( [ rowIndex ] , ( ) => rowItem . contents ) }
417
+ </ div >
418
+ ` ,
419
+ ) }
420
+ </ div >
421
+ ` ;
422
+ } ,
417
423
) }
418
424
</ div >
419
425
` ;
@@ -467,14 +473,10 @@ export const ToniqListTable = defineToniqElement<ListTableInputs>()({
467
473
}
468
474
} ) }
469
475
>
470
- ${ guard ( [ enabledColumns ] , ( ) =>
471
- repeat (
472
- enabledColumns ,
473
- ( columnItem , columnIndex ) => columnIndex ,
474
- ( columnItem ) => {
475
- return listItem ( columnItem ) ;
476
- } ,
477
- ) ,
476
+ ${ repeat (
477
+ enabledColumns ,
478
+ ( columnItem , columnIndex ) => columnIndex ,
479
+ ( columnItem ) => listItem ( columnItem ) ,
478
480
) }
479
481
${ renderIf (
480
482
state . canScroll ,
0 commit comments