33
44// Timing report widget — path summary + detail tables.
55
6- import { isStaticMode , makeResizableHeaders , withBusyCursor }
7- from './ui-utils.js' ;
6+ import {
7+ ColumnWidths , isStaticMode , makeResizableHeaders , withBusyCursor ,
8+ } from './ui-utils.js' ;
89
910// The rows a path's detail table shows, as the Qt GUI's "Expand clock"
1011// setting does. Collapsed (the default), the clock network -- every clock
@@ -33,6 +34,8 @@ export class TimingWidget {
3334 this . _currentTab = 'setup' ;
3435 this . _setupPaths = [ ] ;
3536 this . _holdPaths = [ ] ;
37+ this . _pathColumns = new ColumnWidths ( ) ;
38+ this . _detailColumns = new ColumnWidths ( ) ;
3639 this . _selectedPathIndex = - 1 ;
3740 this . _detailTab = 'data' ;
3841 this . _selectedDetailIndex = - 1 ;
@@ -426,13 +429,20 @@ export class TimingWidget {
426429 this . _setupTab . classList . remove ( 'active' ) ;
427430 }
428431 this . _applySort ( ) ;
432+ this . _resetColumnWidths ( ) ;
429433 this . _selectedPathIndex = - 1 ;
430434 this . _pathCountLabel . textContent = paths . length + ' paths' ;
431435 this . _renderPathTable ( ) ;
432436 this . _renderDetailTable ( ) ;
433437 this . _clearTimingHighlight ( ) ;
434438 }
435439
440+ // New paths: both tables measure their columns afresh.
441+ _resetColumnWidths ( ) {
442+ this . _pathColumns . reset ( ) ;
443+ this . _detailColumns . reset ( ) ;
444+ }
445+
436446 async update ( ) {
437447 const generation = ++ this . _updateGeneration ;
438448 this . _updateBtn . disabled = true ;
@@ -460,6 +470,7 @@ export class TimingWidget {
460470 hold : { ...reportOptions } ,
461471 } ;
462472 this . _applySort ( ) ;
473+ this . _resetColumnWidths ( ) ;
463474 this . _selectedPathIndex = - 1 ;
464475 this . _renderPathTable ( ) ;
465476 this . _renderDetailTable ( ) ;
@@ -604,10 +615,6 @@ export class TimingWidget {
604615 const paths = this . _currentTab === 'setup' ? this . _setupPaths : this . _holdPaths ;
605616 this . _pathCountLabel . textContent = paths . length + ' paths' ;
606617
607- // Preserve column widths across re-renders.
608- const oldHeaders = this . _pathTable . querySelectorAll ( 'thead th' ) ;
609- const savedWidths = Array . from ( oldHeaders , th => th . style . width ) ;
610-
611618 this . _pathTable . innerHTML = '' ;
612619
613620 const thead = document . createElement ( 'thead' ) ;
@@ -681,9 +688,7 @@ export class TimingWidget {
681688
682689 this . _pathTable . appendChild ( tbody ) ;
683690
684- // Install resize grips, reusing any previously saved widths to
685- // avoid a measuring reflow.
686- makeResizableHeaders ( this . _pathTable , savedWidths ) ;
691+ makeResizableHeaders ( this . _pathTable , this . _pathColumns ) ;
687692 }
688693
689694 _selectDetailRow ( idx ) {
@@ -707,10 +712,6 @@ export class TimingWidget {
707712 }
708713
709714 _renderDetailTable ( ) {
710- // Preserve column widths across re-renders.
711- const oldHeaders = this . _detailTable . querySelectorAll ( 'thead th' ) ;
712- const savedWidths = Array . from ( oldHeaders , th => th . style . width ) ;
713-
714715 this . _detailTable . innerHTML = '' ;
715716 this . _selectedDetailIndex = - 1 ;
716717 const paths = this . _currentTab === 'setup' ? this . _setupPaths : this . _holdPaths ;
@@ -764,16 +765,7 @@ export class TimingWidget {
764765 } ) ;
765766 this . _detailTable . appendChild ( tbody ) ;
766767
767- // Install resize grips, reusing any previously saved widths to
768- // avoid a measuring reflow.
769- makeResizableHeaders ( this . _detailTable , savedWidths ) ;
770- if ( ! savedWidths [ 0 ] ) {
771- // Pin column: set initial width to 30 characters
772- const pinTh = this . _detailTable . querySelector ( 'thead th' ) ;
773- if ( pinTh ) {
774- pinTh . style . width = '30ch' ;
775- }
776- }
768+ makeResizableHeaders ( this . _detailTable , this . _detailColumns ) ;
777769 }
778770
779771}
0 commit comments