|
5 | 5 | <div |
6 | 6 | class="hds-advanced-table__container |
7 | 7 | {{(if this.isStickyHeaderPinned 'hds-advanced-table__container--header-is-pinned')}}" |
8 | | - {{this._didUpdateModel}} |
| 8 | + {{did-update this.setupTableModelData @columns @model @sortBy @sortOrder}} |
9 | 9 | ...attributes |
10 | 10 | > |
11 | 11 | {{! Caption }} |
|
30 | 30 | <div class={{this.theadClassNames}} role="rowgroup" {{this._setUpThead}}> |
31 | 31 | <Hds::AdvancedTable::Tr |
32 | 32 | @selectionScope="col" |
33 | | - @onClickSortBySelected={{if @selectableColumnKey (fn this.setSortBy @selectableColumnKey)}} |
34 | | - @sortBySelectedOrder={{if (eq this._sortBy @selectableColumnKey) this._sortOrder}} |
| 33 | + @onClickSortBySelected={{if @selectableColumnKey (fn this._tableModel.setSortBy @selectableColumnKey)}} |
| 34 | + @sortBySelectedOrder={{if (eq this._tableModel.sortBy @selectableColumnKey) this._tableModel.sortOrder}} |
35 | 35 | @isSelectable={{this.isSelectable}} |
36 | 36 | @onSelectionChange={{this.onSelectionAllChange}} |
37 | 37 | @didInsert={{this.didInsertSelectAllCheckbox}} |
|
40 | 40 | @hasStickyColumn={{@hasStickyFirstColumn}} |
41 | 41 | @isStickyColumnPinned={{this.isStickyColumnPinned}} |
42 | 42 | > |
43 | | - {{#each @columns as |column index|}} |
| 43 | + {{#each this._tableModel.columns as |column index|}} |
44 | 44 | {{#if column.isSortable}} |
45 | 45 | <Hds::AdvancedTable::ThSort |
46 | | - @sortOrder={{if (eq column.key this._sortBy) this._sortOrder}} |
47 | | - @onClickSort={{fn this.setSortBy column.key}} |
| 46 | + @column={{column}} |
| 47 | + @sortOrder={{if (eq column.key this._tableModel.sortBy) this._tableModel.sortOrder}} |
| 48 | + @onClickSort={{if column.key (fn this._tableModel.setSortBy column.key)}} |
48 | 49 | @align={{column.align}} |
49 | 50 | @tooltip={{column.tooltip}} |
| 51 | + @hasResizableColumns={{@hasResizableColumns}} |
| 52 | + @isLastColumn={{eq index (sub this._tableModel.columns.length 1)}} |
50 | 53 | @isStickyColumn={{if (and (eq index 0) @hasStickyFirstColumn) true}} |
51 | 54 | @isStickyColumnPinned={{this.isStickyColumnPinned}} |
| 55 | + @previousColumn={{get this._tableModel.columns (sub index 1)}} |
| 56 | + @nextColumn={{get this._tableModel.columns (add index 1)}} |
| 57 | + @tableHeight={{this._tableHeight}} |
| 58 | + @onColumnResize={{@onColumnResize}} |
| 59 | + {{this._setColumnWidth column}} |
52 | 60 | > |
53 | 61 | {{column.label}} |
54 | 62 | </Hds::AdvancedTable::ThSort> |
55 | 63 | {{else}} |
56 | 64 | <Hds::AdvancedTable::Th |
57 | 65 | @align={{column.align}} |
58 | | - @tooltip={{column.tooltip}} |
59 | | - @isVisuallyHidden={{column.isVisuallyHidden}} |
60 | | - @isExpandable={{column.isExpandable}} |
61 | | - @onClickToggle={{this._tableModel.toggleAll}} |
62 | | - @isExpanded={{this._tableModel.expandState}} |
| 66 | + @column={{column}} |
63 | 67 | @hasExpandAllButton={{this._tableModel.hasRowsWithChildren}} |
| 68 | + @hasResizableColumns={{@hasResizableColumns}} |
| 69 | + @isExpanded={{this._tableModel.expandState}} |
| 70 | + @isExpandable={{column.isExpandable}} |
| 71 | + @isLastColumn={{eq index (sub this._tableModel.columns.length 1)}} |
64 | 72 | @isStickyColumn={{if (and (eq index 0) @hasStickyFirstColumn) true}} |
65 | 73 | @isStickyColumnPinned={{this.isStickyColumnPinned}} |
| 74 | + @isVisuallyHidden={{column.isVisuallyHidden}} |
| 75 | + @previousColumn={{get this._tableModel.columns (sub index 1)}} |
| 76 | + @nextColumn={{get this._tableModel.columns (add index 1)}} |
| 77 | + @tableHeight={{this._tableHeight}} |
| 78 | + @tooltip={{column.tooltip}} |
| 79 | + @onClickToggle={{this._tableModel.toggleAll}} |
| 80 | + @onColumnResize={{@onColumnResize}} |
| 81 | + {{this._setColumnWidth column}} |
66 | 82 | > |
67 | 83 | {{column.label}} |
68 | 84 | </Hds::AdvancedTable::Th> |
|
78 | 94 | we yield the Tr/Td/Th elements _and_ the record itself as `data` |
79 | 95 | this means the consumer will *have to* use the `data` key to access it in their template |
80 | 96 | -------------------------------------------------------------------------------------------- }} |
81 | | - {{! @glint-expect-error: [HDS-4380](https://hashicorp.atlassian.net/browse/HDS-4380) }} |
82 | | - {{#each (sort-by this.getSortCriteria this._tableModel.rows) key=this.identityKey as |record index|}} |
| 97 | + {{#each this._tableModel.sortedRows key=this.identityKey as |record index|}} |
83 | 98 | {{#if this._tableModel.hasRowsWithChildren}} |
84 | 99 | <Hds::AdvancedTable::ExpandableTrGroup |
85 | 100 | @record={{record}} |
|
145 | 160 | {{/each}} |
146 | 161 | </div> |
147 | 162 | </div> |
| 163 | + |
148 | 164 | {{#if this.showScrollIndicatorLeft}} |
149 | 165 | <div |
150 | 166 | class="hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-left" |
|
0 commit comments