@urbanos/react-discovery-ui 2.1.49 → 2.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -142,6 +142,9 @@ var DataTable = function DataTable(_ref) {
|
|
|
142
142
|
col: col
|
|
143
143
|
});
|
|
144
144
|
};
|
|
145
|
+
var dataRows = table.getRowModel().rows;
|
|
146
|
+
var pageIndex = pagination.pageIndex;
|
|
147
|
+
var pageSize = pagination.pageSize;
|
|
145
148
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
146
149
|
style: {
|
|
147
150
|
height: '400px',
|
|
@@ -149,51 +152,68 @@ var DataTable = function DataTable(_ref) {
|
|
|
149
152
|
}
|
|
150
153
|
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
151
154
|
ref: tableRef,
|
|
155
|
+
role: "grid",
|
|
156
|
+
"aria-rowcount": dataRows.length + 1,
|
|
157
|
+
"aria-colcount": columns.length,
|
|
152
158
|
style: {
|
|
153
159
|
minWidth: "".concat(columns.length * 120, "px")
|
|
154
160
|
}
|
|
155
161
|
}, /*#__PURE__*/_react.default.createElement("caption", null, datasetName ? "".concat(datasetName, " Dataset Preview") : 'Dataset Preview'), /*#__PURE__*/_react.default.createElement("thead", null, table.getHeaderGroups().map(function (headerGroup) {
|
|
156
162
|
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
157
|
-
key: headerGroup.id
|
|
163
|
+
key: headerGroup.id,
|
|
164
|
+
role: "row",
|
|
165
|
+
"aria-rowindex": 1
|
|
158
166
|
}, headerGroup.headers.map(function (header, colIndex) {
|
|
159
167
|
var _header$column$column;
|
|
160
168
|
return /*#__PURE__*/_react.default.createElement("th", {
|
|
161
169
|
key: header.id,
|
|
170
|
+
role: "columnheader",
|
|
162
171
|
scope: "col",
|
|
163
172
|
tabIndex: tabIndex(0, colIndex),
|
|
164
173
|
"data-row": 0,
|
|
165
174
|
"data-col": colIndex,
|
|
175
|
+
"aria-colindex": colIndex + 1,
|
|
166
176
|
onFocus: function onFocus() {
|
|
167
177
|
return onCellFocus(0, colIndex);
|
|
168
178
|
},
|
|
169
179
|
className: ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.headerClassName) || 'table-header'
|
|
170
180
|
}, header.isPlaceholder ? null : (0, _reactTable.flexRender)(header.column.columnDef.header, header.getContext()));
|
|
171
181
|
}));
|
|
172
|
-
})), /*#__PURE__*/_react.default.createElement("tbody", null,
|
|
182
|
+
})), /*#__PURE__*/_react.default.createElement("tbody", null, dataRows.length === 0 ? /*#__PURE__*/_react.default.createElement("tr", {
|
|
183
|
+
role: "row"
|
|
184
|
+
}, /*#__PURE__*/_react.default.createElement("td", {
|
|
185
|
+
role: "gridcell",
|
|
173
186
|
colSpan: columns.length,
|
|
174
187
|
className: "no-data-message"
|
|
175
|
-
}, "No rows found")) :
|
|
188
|
+
}, "No rows found")) : dataRows.map(function (row, rowIndex) {
|
|
176
189
|
var tableRow = rowIndex + 1;
|
|
190
|
+
var ariaRowIndex = pageIndex * pageSize + rowIndex + 2; // +1 for header, +1 for 1-based
|
|
177
191
|
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
178
192
|
key: row.id,
|
|
193
|
+
role: "row",
|
|
194
|
+
"aria-rowindex": ariaRowIndex,
|
|
179
195
|
className: rowIndex % 2 === 0 ? 'striped-row' : ''
|
|
180
196
|
}, row.getVisibleCells().map(function (cell, colIndex) {
|
|
181
197
|
var content = (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
182
198
|
return colIndex === 0 ? /*#__PURE__*/_react.default.createElement("th", {
|
|
183
199
|
key: cell.id,
|
|
200
|
+
role: "rowheader",
|
|
184
201
|
scope: "row",
|
|
185
202
|
tabIndex: tabIndex(tableRow, colIndex),
|
|
186
203
|
"data-row": tableRow,
|
|
187
204
|
"data-col": colIndex,
|
|
205
|
+
"aria-colindex": 1,
|
|
188
206
|
onFocus: function onFocus() {
|
|
189
207
|
return onCellFocus(tableRow, colIndex);
|
|
190
208
|
},
|
|
191
209
|
className: "row-header"
|
|
192
210
|
}, content) : /*#__PURE__*/_react.default.createElement("td", {
|
|
193
211
|
key: cell.id,
|
|
212
|
+
role: "gridcell",
|
|
194
213
|
tabIndex: tabIndex(tableRow, colIndex),
|
|
195
214
|
"data-row": tableRow,
|
|
196
215
|
"data-col": colIndex,
|
|
216
|
+
"aria-colindex": colIndex + 1,
|
|
197
217
|
onFocus: function onFocus() {
|
|
198
218
|
return onCellFocus(tableRow, colIndex);
|
|
199
219
|
}
|