@guardian/interactive-component-library 0.1.0-alpha.36 → 0.1.0-alpha.38
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.
|
@@ -1200,6 +1200,11 @@
|
|
|
1200
1200
|
return (a, b) => {
|
|
1201
1201
|
const valueA = a[accessor];
|
|
1202
1202
|
const valueB = b[accessor];
|
|
1203
|
+
if (valueA === null) {
|
|
1204
|
+
return -1;
|
|
1205
|
+
} else if (valueB === null) {
|
|
1206
|
+
return 1;
|
|
1207
|
+
}
|
|
1203
1208
|
if (valueA < valueB)
|
|
1204
1209
|
return -1;
|
|
1205
1210
|
if (valueA > valueB)
|
|
@@ -1211,6 +1216,11 @@
|
|
|
1211
1216
|
return (a, b) => {
|
|
1212
1217
|
const valueA = a[accessor];
|
|
1213
1218
|
const valueB = b[accessor];
|
|
1219
|
+
if (valueA === null) {
|
|
1220
|
+
return 1;
|
|
1221
|
+
} else if (valueB === null) {
|
|
1222
|
+
return -1;
|
|
1223
|
+
}
|
|
1214
1224
|
if (valueA > valueB)
|
|
1215
1225
|
return -1;
|
|
1216
1226
|
if (valueA < valueB)
|
|
@@ -1313,21 +1323,23 @@
|
|
|
1313
1323
|
const rowData = JSON.stringify(this.row, null, 2);
|
|
1314
1324
|
throw new Error(`Missing value for key ${this.column.accessor} in ${rowData}`);
|
|
1315
1325
|
}
|
|
1316
|
-
return this.row[this.column.accessor].toString();
|
|
1326
|
+
return this.row[this.column.accessor] !== null ? this.row[this.column.accessor].toString() : "null";
|
|
1317
1327
|
}
|
|
1318
1328
|
}
|
|
1319
|
-
const table = "
|
|
1320
|
-
const hideHeader = "
|
|
1321
|
-
const hideHeaderNoBorder = "
|
|
1322
|
-
const headerCell = "
|
|
1323
|
-
const
|
|
1324
|
-
const
|
|
1325
|
-
const
|
|
1329
|
+
const table = "_table_fhbur_9";
|
|
1330
|
+
const hideHeader = "_hideHeader_fhbur_20";
|
|
1331
|
+
const hideHeaderNoBorder = "_hideHeaderNoBorder_fhbur_29";
|
|
1332
|
+
const headerCell = "_headerCell_fhbur_33";
|
|
1333
|
+
const stickyHeader = "_stickyHeader_fhbur_42";
|
|
1334
|
+
const headerCellButton = "_headerCellButton_fhbur_49";
|
|
1335
|
+
const bodyRow = "_bodyRow_fhbur_58";
|
|
1336
|
+
const bodyCell = "_bodyCell_fhbur_62";
|
|
1326
1337
|
const defaultStyles$f = {
|
|
1327
1338
|
table,
|
|
1328
1339
|
hideHeader,
|
|
1329
1340
|
hideHeaderNoBorder,
|
|
1330
1341
|
headerCell,
|
|
1342
|
+
stickyHeader,
|
|
1331
1343
|
headerCellButton,
|
|
1332
1344
|
bodyRow,
|
|
1333
1345
|
bodyCell
|
|
@@ -1336,6 +1348,7 @@
|
|
|
1336
1348
|
columns,
|
|
1337
1349
|
data,
|
|
1338
1350
|
hideHeader: hideHeader2 = false,
|
|
1351
|
+
stickyHeader: stickyHeader2 = false,
|
|
1339
1352
|
styles: styles2
|
|
1340
1353
|
}) {
|
|
1341
1354
|
const [sortState, setSortState] = hooks.useState(() => {
|
|
@@ -1374,9 +1387,13 @@
|
|
|
1374
1387
|
children: jsxRuntime.jsx("tr", {
|
|
1375
1388
|
children: table2.columns.map((column, index) => {
|
|
1376
1389
|
var _a;
|
|
1390
|
+
let columnStyle = mergeStyles(styles2.headerCell, (_a = column.styles) == null ? void 0 : _a.headerCell);
|
|
1391
|
+
if (stickyHeader2) {
|
|
1392
|
+
columnStyle = mergeStyles(columnStyle, styles2.stickyHeader);
|
|
1393
|
+
}
|
|
1377
1394
|
return jsxRuntime.jsx("th", {
|
|
1378
1395
|
scope: "col",
|
|
1379
|
-
className:
|
|
1396
|
+
className: columnStyle,
|
|
1380
1397
|
children: jsxRuntime.jsx(HeaderCell, {
|
|
1381
1398
|
styles: mergeStyles(styles2, column.styles),
|
|
1382
1399
|
onClick: () => sortByColumn(index),
|
|
@@ -1856,11 +1873,11 @@
|
|
|
1856
1873
|
})]
|
|
1857
1874
|
});
|
|
1858
1875
|
});
|
|
1859
|
-
const borderTop = "
|
|
1860
|
-
const section = "
|
|
1861
|
-
const fullWidth = "
|
|
1862
|
-
const header = "
|
|
1863
|
-
const content = "
|
|
1876
|
+
const borderTop = "_borderTop_gph7y_9";
|
|
1877
|
+
const section = "_section_gph7y_13";
|
|
1878
|
+
const fullWidth = "_fullWidth_gph7y_19";
|
|
1879
|
+
const header = "_header_gph7y_95";
|
|
1880
|
+
const content = "_content_gph7y_132";
|
|
1864
1881
|
const defaultStyles$9 = {
|
|
1865
1882
|
borderTop,
|
|
1866
1883
|
section,
|