|
2 | 2 | Copyright (c) HashiCorp, Inc.
|
3 | 3 | SPDX-License-Identifier: MPL-2.0
|
4 | 4 | }}
|
| 5 | + |
5 | 6 | <div
|
6 | 7 | class="hds-advanced-table__container
|
7 | 8 | {{(if this.isStickyHeaderPinned 'hds-advanced-table__container--header-is-pinned')}}"
|
8 | 9 | {{did-update this.setupTableModelData @columns @model @sortBy @sortOrder}}
|
| 10 | + {{did-update this.updateTableModelColumnOrder @columnOrder}} |
9 | 11 | ...attributes
|
10 | 12 | >
|
11 | 13 | {{! Caption }}
|
12 | 14 | <div id={{this._captionId}} class="sr-only hds-advanced-table__caption" aria-live="polite">
|
13 | 15 | {{@caption}}
|
14 | 16 | {{this.sortedMessageText}}
|
| 17 | + {{this.reorderedMessageText}} |
15 | 18 | </div>
|
16 | 19 |
|
17 | 20 | {{! Grid }}
|
|
28 | 31 | {{this._setUpScrollWrapper}}
|
29 | 32 | >
|
30 | 33 | {{! Header }}
|
31 |
| - <div class={{this.theadClassNames}} role="rowgroup" {{this._setUpThead}}> |
| 34 | + <div |
| 35 | + class={{this.theadClassNames}} |
| 36 | + role="rowgroup" |
| 37 | + {{this._setUpThead}} |
| 38 | + {{on "dragleave" (fn (mut this._tableModel.reorderHoveredColumn) null)}} |
| 39 | + > |
32 | 40 | <Hds::AdvancedTable::Tr
|
33 | 41 | @selectionScope="col"
|
34 | 42 | @onClickSortBySelected={{if @selectableColumnKey (fn this._tableModel.setSortBy @selectableColumnKey)}}
|
|
41 | 49 | @hasStickyColumn={{this.hasStickyFirstColumn}}
|
42 | 50 | @isStickyColumnPinned={{this.isStickyColumnPinned}}
|
43 | 51 | >
|
44 |
| - {{#each this._tableModel.columns as |column|}} |
| 52 | + {{#each this._tableModel.orderedColumns as |column|}} |
45 | 53 | {{#if column.isSortable}}
|
46 | 54 | <Hds::AdvancedTable::ThSort
|
47 | 55 | @column={{column}}
|
48 | 56 | @sortOrder={{if (eq column.key this._tableModel.sortBy) this._tableModel.sortOrder}}
|
49 | 57 | @onClickSort={{if column.key (fn this._tableModel.setSortBy column.key)}}
|
50 | 58 | @align={{column.align}}
|
51 | 59 | @tooltip={{column.tooltip}}
|
| 60 | + @hasReorderableColumns={{@hasReorderableColumns}} |
52 | 61 | @hasResizableColumns={{@hasResizableColumns}}
|
| 62 | + @hasSelectableRows={{this.isSelectable}} |
53 | 63 | @isStickyColumn={{this._isStickyColumn column}}
|
54 | 64 | @isStickyColumnPinned={{this.isStickyColumnPinned}}
|
55 | 65 | @tableHeight={{this._tableHeight}}
|
56 | 66 | @onColumnResize={{@onColumnResize}}
|
57 | 67 | @onPinFirstColumn={{this._onPinFirstColumn}}
|
| 68 | + @onReorderDragEnd={{fn (mut this._tableModel.reorderDraggedColumn) null}} |
| 69 | + @onReorderDragStart={{fn (mut this._tableModel.reorderDraggedColumn)}} |
| 70 | + @onReorderDrop={{this._tableModel.moveColumnToDropTarget}} |
58 | 71 | {{this._registerThElement column}}
|
59 | 72 | >
|
60 | 73 | {{column.label}}
|
|
64 | 77 | @align={{column.align}}
|
65 | 78 | @column={{column}}
|
66 | 79 | @hasExpandAllButton={{this._tableModel.hasRowsWithChildren}}
|
| 80 | + @hasReorderableColumns={{@hasReorderableColumns}} |
67 | 81 | @hasResizableColumns={{@hasResizableColumns}}
|
| 82 | + @hasSelectableRows={{this.isSelectable}} |
68 | 83 | @isExpanded={{this._tableModel.expandState}}
|
69 | 84 | @isExpandable={{column.isExpandable}}
|
70 | 85 | @isStickyColumn={{this._isStickyColumn column}}
|
|
75 | 90 | @onClickToggle={{this._tableModel.toggleAll}}
|
76 | 91 | @onColumnResize={{@onColumnResize}}
|
77 | 92 | @onPinFirstColumn={{this._onPinFirstColumn}}
|
| 93 | + @onReorderDragEnd={{fn (mut this._tableModel.reorderDraggedColumn) null}} |
| 94 | + @onReorderDragStart={{fn (mut this._tableModel.reorderDraggedColumn)}} |
| 95 | + @onReorderDrop={{this._tableModel.moveColumnToDropTarget}} |
78 | 96 | {{this._registerThElement column}}
|
79 | 97 | >
|
80 | 98 | {{column.label}}
|
81 | 99 | </Hds::AdvancedTable::Th>
|
82 | 100 | {{/if}}
|
83 | 101 | {{/each}}
|
84 | 102 | </Hds::AdvancedTable::Tr>
|
| 103 | + |
| 104 | + {{#if this.showScrollIndicatorTop}} |
| 105 | + <div class="hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-top" /> |
| 106 | + {{/if}} |
85 | 107 | </div>
|
86 | 108 |
|
87 | 109 | {{! Body }}
|
|
107 | 129 | isParentRow=T.isExpandable
|
108 | 130 | depth=T.depth
|
109 | 131 | displayRow=T.shouldDisplayChildRows
|
| 132 | + data=T.data |
110 | 133 | )
|
111 | 134 | Th=(component
|
112 | 135 | "hds/advanced-table/th"
|
|
140 | 163 | selectionAriaLabelSuffix=@selectionAriaLabelSuffix
|
141 | 164 | hasStickyColumn=this.hasStickyFirstColumn
|
142 | 165 | isStickyColumnPinned=this.isStickyColumnPinned
|
| 166 | + data=record |
143 | 167 | )
|
144 | 168 | Th=(component
|
145 | 169 | "hds/advanced-table/th"
|
|
172 | 196 | />
|
173 | 197 | {{/if}}
|
174 | 198 |
|
175 |
| - {{#if this.showScrollIndicatorTop}} |
176 |
| - <div |
177 |
| - class="hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-top" |
178 |
| - {{style top=this.scrollIndicatorDimensions.top width=this.scrollIndicatorDimensions.width}} |
179 |
| - /> |
180 |
| - {{/if}} |
181 |
| - |
182 | 199 | {{#if this.showScrollIndicatorBottom}}
|
183 | 200 | <div
|
184 | 201 | class="hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-bottom"
|
|
0 commit comments