-
Notifications
You must be signed in to change notification settings - Fork 279
Expand file tree
/
Copy pathTableHeaderRowTemplate.tsx
More file actions
92 lines (84 loc) · 2.73 KB
/
TableHeaderRowTemplate.tsx
File metadata and controls
92 lines (84 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import CheckBox from "./CheckBox.js";
import TableHeaderCell from "./TableHeaderCell.js";
import Icon from "./Icon.js";
import IconMode from "./types/IconMode.js";
import ClearAll from "@ui5/webcomponents-icons/dist/clear-all.js";
import IconDesign from "./types/IconDesign.js";
import type TableHeaderRow from "./TableHeaderRow.js";
export default function TableHeaderRowTemplate(this: TableHeaderRow, ariaColIndex: number = 1) {
return (
<>
{ this._hasSelector &&
<TableHeaderCell id="selection-cell"
aria-selected={this._isSelected}
aria-label={this._i18nSelection}
aria-description={this._selectionCellAriaDescription}
aria-colindex={ariaColIndex++}
data-ui5-table-selection-cell
data-ui5-acc-text=""
>
{ !this._isMultiSelect ?
<></>
:
this._shouldRenderClearAll ?
<Icon
name={ClearAll}
mode={IconMode.Decorative}
showTooltip={true}
accessibleName={this._i18nDeselectAllRows}
design={this._hasSelectedRows ? IconDesign.Default : IconDesign.NonInteractive}
onClick={this._onSelectionChange}
></Icon>
:
<CheckBox id="selection-component"
tabindex={-1}
checked={this._isSelected}
onChange={this._onSelectionChange}
accessibleName={this._i18nRowSelector}
title={this._isSelected ? this._i18nDeselectAllRows : this._i18nSelectAllRows}
></CheckBox>
}
</TableHeaderCell>
}
{ this.cells.flatMap(cell => {
if (cell._popin) {
cell.role = null;
cell.ariaColIndex = null;
return [];
}
cell.role ??= cell.ariaRole;
cell.ariaColIndex = (cell.role === cell.ariaRole) ? `${ariaColIndex++}` : null;
return [<slot name={cell._individualSlot}></slot>];
})}
{ this._renderDummyCell && this._hasPopin &&
<TableHeaderCell id="dummy-cell" role="none" aria-hidden={true}
data-excluded-from-navigation="">
</TableHeaderCell>
}
{ this._rowActionCount > 0 &&
<TableHeaderCell id="actions-cell" aria-colindex={ariaColIndex++}>
<div id="actions-cell-content">{this._i18nRowActions}</div>
</TableHeaderCell>
}
{ this._renderNavigated &&
<TableHeaderCell id="navigated-cell"
data-excluded-from-navigation
aria-hidden={true}
role="none"
>
<div id="navigated"></div>
</TableHeaderCell>
}
{ this._renderDummyCell && !this._hasPopin &&
<TableHeaderCell id="dummy-cell" role="none" aria-hidden={true}
data-excluded-from-navigation="nofocus">
</TableHeaderCell>
}
{ this._hasPopin &&
<TableHeaderCell id="popin-cell" aria-colindex={ariaColIndex++} data-excluded-from-navigation>
<div id="popin-cell-content">{this._i18nRowPopin}</div>
</TableHeaderCell>
}
</>
);
}