@deephaven/grid 0.15.1 → 0.15.2

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.
Files changed (62) hide show
  1. package/dist/ColumnHeaderGroup.d.ts +9 -0
  2. package/dist/ColumnHeaderGroup.d.ts.map +1 -0
  3. package/dist/ColumnHeaderGroup.js +2 -0
  4. package/dist/ColumnHeaderGroup.js.map +1 -0
  5. package/dist/Grid.d.ts +5 -4
  6. package/dist/Grid.d.ts.map +1 -1
  7. package/dist/Grid.js +5 -6
  8. package/dist/Grid.js.map +1 -1
  9. package/dist/GridAxisRange.d.ts +10 -0
  10. package/dist/GridAxisRange.d.ts.map +1 -0
  11. package/dist/GridAxisRange.js +17 -0
  12. package/dist/GridAxisRange.js.map +1 -0
  13. package/dist/GridMetricCalculator.d.ts +10 -8
  14. package/dist/GridMetricCalculator.d.ts.map +1 -1
  15. package/dist/GridMetricCalculator.js +38 -16
  16. package/dist/GridMetricCalculator.js.map +1 -1
  17. package/dist/GridMetrics.d.ts +8 -4
  18. package/dist/GridMetrics.d.ts.map +1 -1
  19. package/dist/GridModel.d.ts +20 -2
  20. package/dist/GridModel.d.ts.map +1 -1
  21. package/dist/GridModel.js +30 -2
  22. package/dist/GridModel.js.map +1 -1
  23. package/dist/GridMouseHandler.d.ts +0 -1
  24. package/dist/GridMouseHandler.d.ts.map +1 -1
  25. package/dist/GridRenderer.d.ts +33 -6
  26. package/dist/GridRenderer.d.ts.map +1 -1
  27. package/dist/GridRenderer.js +428 -179
  28. package/dist/GridRenderer.js.map +1 -1
  29. package/dist/GridUtils.d.ts +34 -24
  30. package/dist/GridUtils.d.ts.map +1 -1
  31. package/dist/GridUtils.js +99 -61
  32. package/dist/GridUtils.js.map +1 -1
  33. package/dist/MockGridModel.d.ts +1 -1
  34. package/dist/MockGridModel.d.ts.map +1 -1
  35. package/dist/MockGridModel.js +1 -0
  36. package/dist/MockGridModel.js.map +1 -1
  37. package/dist/MockTreeGridModel.d.ts +0 -1
  38. package/dist/MockTreeGridModel.d.ts.map +1 -1
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +2 -0
  42. package/dist/index.js.map +1 -1
  43. package/dist/mouse-handlers/GridColumnMoveMouseHandler.d.ts +44 -4
  44. package/dist/mouse-handlers/GridColumnMoveMouseHandler.d.ts.map +1 -1
  45. package/dist/mouse-handlers/GridColumnMoveMouseHandler.js +486 -80
  46. package/dist/mouse-handlers/GridColumnMoveMouseHandler.js.map +1 -1
  47. package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.d.ts +7 -5
  48. package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.d.ts.map +1 -1
  49. package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js +26 -14
  50. package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js.map +1 -1
  51. package/dist/mouse-handlers/GridRowSeparatorMouseHandler.d.ts +7 -5
  52. package/dist/mouse-handlers/GridRowSeparatorMouseHandler.d.ts.map +1 -1
  53. package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js +11 -14
  54. package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js.map +1 -1
  55. package/dist/mouse-handlers/GridSeparatorMouseHandler.d.ts +11 -4
  56. package/dist/mouse-handlers/GridSeparatorMouseHandler.d.ts.map +1 -1
  57. package/dist/mouse-handlers/GridSeparatorMouseHandler.js +41 -31
  58. package/dist/mouse-handlers/GridSeparatorMouseHandler.js.map +1 -1
  59. package/dist/mouse-handlers/index.d.ts +1 -0
  60. package/dist/mouse-handlers/index.js +1 -0
  61. package/dist/mouse-handlers/index.js.map +1 -1
  62. package/package.json +3 -3
@@ -1,11 +1,13 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
+ import clamp from 'lodash.clamp';
3
4
  import memoizeClear from "./memoizeClear.js";
4
5
  import GridUtils from "./GridUtils.js";
5
6
  import GridColorUtils from "./GridColorUtils.js";
6
7
  import { isExpandableGridModel } from "./ExpandableGridModel.js";
7
8
  import { getOrThrow } from "./GridMetricCalculator.js";
8
9
  import { isEditableGridModel } from "./EditableGridModel.js";
10
+ import GridColumnSeparatorMouseHandler from "./mouse-handlers/GridColumnSeparatorMouseHandler.js";
9
11
 
10
12
  /* eslint react/destructuring-assignment: "off" */
11
13
 
@@ -1134,7 +1136,8 @@ export class GridRenderer {
1134
1136
  theme,
1135
1137
  metrics,
1136
1138
  draggingColumnSeparator,
1137
- isDragging
1139
+ isDragging,
1140
+ model
1138
1141
  } = state;
1139
1142
  var {
1140
1143
  columnHeaderHeight,
@@ -1144,7 +1147,11 @@ export class GridRenderer {
1144
1147
  visibleColumns,
1145
1148
  visibleColumnWidths,
1146
1149
  visibleColumnXs,
1147
- floatingLeftColumnCount
1150
+ floatingLeftColumnCount,
1151
+ floatingLeftWidth,
1152
+ floatingRightWidth,
1153
+ modelColumns,
1154
+ columnHeaderMaxDepth
1148
1155
  } = metrics;
1149
1156
 
1150
1157
  if (columnHeaderHeight <= 0) {
@@ -1152,168 +1159,269 @@ export class GridRenderer {
1152
1159
  }
1153
1160
 
1154
1161
  var {
1155
- headerBackgroundColor,
1156
- headerColor,
1157
1162
  headerHiddenSeparatorSize,
1158
1163
  headerHiddenSeparatorHoverColor,
1159
1164
  headerSeparatorColor,
1160
1165
  headerSeparatorHoverColor
1161
1166
  } = theme;
1162
1167
  var hiddenSeparatorHeight = columnHeaderHeight * 0.5;
1163
- var hiddenY = columnHeaderHeight * 0.5 - hiddenSeparatorHeight * 0.5;
1168
+ var hiddenY = columnHeaderHeight * (columnHeaderMaxDepth - 1) + columnHeaderHeight * 0.5 - hiddenSeparatorHeight * 0.5;
1164
1169
  var containsFrozenColumns = floatingLeftColumnCount > 0;
1165
- var floatingLeftColumnsWidth = 0;
1166
1170
  context.save();
1167
- context.beginPath(); // Fill in the background
1168
-
1169
- context.fillStyle = headerBackgroundColor;
1170
- context.fillRect(0, 0, width, columnHeaderHeight);
1171
- context.fillStyle = headerColor; // Visible columns.
1171
+ this.drawColumnHeadersForRange(context, state, [visibleColumns[0], visibleColumns[visibleColumns.length - 1]], {
1172
+ minX: gridX + floatingLeftWidth,
1173
+ maxX: width - floatingRightWidth
1174
+ });
1172
1175
 
1173
- for (var i = 0; i < visibleColumns.length; i += 1) {
1174
- var column = visibleColumns[i];
1175
- var columnWidth = getOrThrow(visibleColumnWidths, column);
1176
- var x = getOrThrow(visibleColumnXs, column) + gridX;
1177
- this.drawColumnHeader(context, state, column, x, columnWidth);
1176
+ if (containsFrozenColumns) {
1177
+ this.drawColumnHeadersForRange(context, state, [floatingColumns[0], floatingColumns[floatingColumns.length - 1]], {
1178
+ minX: gridX,
1179
+ maxX: gridX + floatingLeftWidth
1180
+ });
1178
1181
  }
1179
1182
 
1180
- if (containsFrozenColumns) {
1181
- floatingLeftColumnsWidth = getOrThrow(visibleColumnXs, floatingLeftColumnCount - 1) + getOrThrow(visibleColumnWidths, floatingLeftColumnCount - 1); // Frozen columns' background
1183
+ if (headerSeparatorColor) {
1184
+ context.strokeStyle = headerSeparatorColor;
1185
+ var hiddenColumns = [...visibleColumnWidths.entries()].filter(_ref => {
1186
+ var [_, w] = _ref;
1187
+ return w === 0;
1188
+ }).map(_ref2 => {
1189
+ var [index] = _ref2;
1190
+ return index;
1191
+ }); // Now draw the hidden column separator boxes
1182
1192
 
1183
- context.fillStyle = headerBackgroundColor;
1184
- context.fillRect(gridX, 0, floatingLeftColumnsWidth, columnHeaderHeight); // Frozen columns.
1193
+ context.beginPath();
1194
+ context.fillStyle = headerSeparatorColor;
1185
1195
 
1186
- context.fillStyle = headerColor;
1196
+ for (var i = 0; i < hiddenColumns.length; i += 1) {
1197
+ var column = hiddenColumns[i];
1198
+ var columnX = getOrThrow(visibleColumnXs, column);
1199
+ var columnWidth = getOrThrow(visibleColumnWidths, column);
1200
+ var minX = gridX + columnX + columnWidth + 0.5 - headerHiddenSeparatorSize * 0.5;
1201
+ context.rect(minX, hiddenY, headerHiddenSeparatorSize, hiddenSeparatorHeight);
1202
+ }
1187
1203
 
1188
- for (var _i5 = 0; _i5 < floatingColumns.length; _i5 += 1) {
1189
- var _column = floatingColumns[_i5];
1204
+ context.fill();
1205
+ }
1190
1206
 
1191
- var _columnWidth = getOrThrow(visibleColumnWidths, _column);
1207
+ if (headerSeparatorHoverColor) {
1208
+ var {
1209
+ index: highlightedSeparator,
1210
+ depth
1211
+ } = draggingColumnSeparator !== null && draggingColumnSeparator !== void 0 ? draggingColumnSeparator : {};
1212
+
1213
+ if (highlightedSeparator == null && mouseX != null && mouseY != null) {
1214
+ var separator = GridColumnSeparatorMouseHandler.getColumnSeparator(GridUtils.getGridPointFromXY(mouseX, mouseY, metrics), metrics, model, theme);
1215
+ highlightedSeparator = separator === null || separator === void 0 ? void 0 : separator.index;
1216
+ depth = separator === null || separator === void 0 ? void 0 : separator.depth;
1217
+ }
1192
1218
 
1193
- var _x4 = getOrThrow(visibleColumnXs, _column) + gridX;
1219
+ var shouldDrawSeparator;
1194
1220
 
1195
- this.drawColumnHeader(context, state, _column, _x4, _columnWidth);
1221
+ if (highlightedSeparator == null) {
1222
+ shouldDrawSeparator = false;
1223
+ } else {
1224
+ var columnIndex = modelColumns.get(highlightedSeparator);
1225
+ var nextColumnIndex = modelColumns.get(highlightedSeparator + 1);
1226
+
1227
+ if (columnIndex == null || nextColumnIndex == null) {
1228
+ shouldDrawSeparator = false;
1229
+ } else {
1230
+ shouldDrawSeparator = model.textForColumnHeader(columnIndex, depth) !== model.textForColumnHeader(nextColumnIndex, depth);
1231
+ }
1196
1232
  }
1197
- } // Draw the separators, visible columns then floating columns.
1198
1233
 
1234
+ if (shouldDrawSeparator && highlightedSeparator != null && depth != null && (!isDragging || draggingColumnSeparator != null)) {
1235
+ context.strokeStyle = headerSeparatorHoverColor;
1199
1236
 
1200
- if (headerSeparatorColor) {
1201
- context.strokeStyle = headerSeparatorColor;
1202
- context.beginPath();
1203
- var hiddenColumns = []; // Draw visible column separators.
1237
+ var _columnX = getOrThrow(visibleColumnXs, highlightedSeparator);
1204
1238
 
1205
- var isPreviousColumnHidden = false;
1239
+ var _columnWidth = getOrThrow(visibleColumnWidths, highlightedSeparator);
1206
1240
 
1207
- for (var _i6 = 0; _i6 < visibleColumns.length; _i6 += 1) {
1208
- var _column2 = visibleColumns[_i6];
1209
- var columnX = getOrThrow(visibleColumnXs, _column2);
1241
+ var x = gridX + _columnX + _columnWidth + 0.5;
1242
+ var visibleColumnIndex = visibleColumns.indexOf(highlightedSeparator);
1243
+ var nextColumn = visibleColumnIndex < visibleColumns.length - 1 ? visibleColumns[visibleColumnIndex + 1] : null;
1244
+ var nextColumnWidth = nextColumn != null ? visibleColumnWidths.get(nextColumn) : null;
1245
+ var isColumnHidden = _columnWidth === 0;
1246
+ var isNextColumnHidden = nextColumnWidth != null && nextColumnWidth === 0;
1210
1247
 
1211
- var _columnWidth2 = getOrThrow(visibleColumnWidths, _column2);
1248
+ if (isColumnHidden) {
1249
+ context.strokeStyle = headerHiddenSeparatorHoverColor;
1250
+ context.fillStyle = headerHiddenSeparatorHoverColor;
1251
+ context.fillRect(x, hiddenY, headerHiddenSeparatorSize * 0.5, hiddenSeparatorHeight);
1252
+ } else if (isNextColumnHidden) {
1253
+ context.fillStyle = headerSeparatorHoverColor;
1254
+ context.fillRect(x - headerHiddenSeparatorSize * 0.5, hiddenY, headerHiddenSeparatorSize * 0.5, hiddenSeparatorHeight);
1255
+ } // column seperator hover line
1212
1256
 
1213
- if (!(columnX < floatingLeftColumnsWidth - _columnWidth2)) {
1214
- if (_columnWidth2 > 0) {
1215
- var _x5 = gridX + columnX + _columnWidth2 + 0.5;
1216
1257
 
1217
- context.moveTo(_x5, 0);
1218
- context.lineTo(_x5, columnHeaderHeight - 0.5);
1219
- isPreviousColumnHidden = false;
1220
- } else if (!isPreviousColumnHidden) {
1221
- isPreviousColumnHidden = true;
1222
- hiddenColumns.push(_column2);
1223
- }
1224
- }
1225
- } // Draw floating column separators.
1258
+ context.beginPath();
1259
+ context.moveTo(x, (columnHeaderMaxDepth - depth - 1) * columnHeaderHeight);
1260
+ context.lineTo(x, (columnHeaderMaxDepth - depth) * columnHeaderHeight - 1);
1261
+ context.stroke();
1262
+ }
1263
+ }
1226
1264
 
1265
+ context.restore();
1266
+ }
1227
1267
 
1228
- isPreviousColumnHidden = false;
1268
+ drawColumnHeadersForRange(context, state, range, bounds) {
1269
+ var {
1270
+ model
1271
+ } = state;
1272
+ var {
1273
+ columnHeaderMaxDepth
1274
+ } = model;
1229
1275
 
1230
- for (var _i7 = 0; _i7 < floatingColumns.length; _i7 += 1) {
1231
- var _column3 = floatingColumns[_i7];
1276
+ if (columnHeaderMaxDepth === 0) {
1277
+ return;
1278
+ }
1232
1279
 
1233
- var _columnX = getOrThrow(visibleColumnXs, _column3);
1280
+ for (var d = 0; d <= columnHeaderMaxDepth; d += 1) {
1281
+ this.drawColumnHeadersAtDepth(context, state, range, bounds, d);
1282
+ }
1283
+ }
1234
1284
 
1235
- var _columnWidth3 = getOrThrow(visibleColumnWidths, _column3);
1285
+ drawColumnHeadersAtDepth(context, state, range, bounds, depth) {
1286
+ var {
1287
+ metrics,
1288
+ model,
1289
+ theme
1290
+ } = state;
1291
+ var {
1292
+ modelColumns,
1293
+ visibleColumnXs,
1294
+ gridX,
1295
+ calculatedColumnWidths,
1296
+ userColumnWidths,
1297
+ visibleColumnWidths,
1298
+ movedColumns
1299
+ } = metrics;
1300
+ var {
1301
+ headerBackgroundColor,
1302
+ headerColor,
1303
+ headerSeparatorColor,
1304
+ columnHeaderHeight,
1305
+ columnWidth
1306
+ } = theme;
1307
+ var {
1308
+ columnHeaderMaxDepth
1309
+ } = model;
1310
+ var {
1311
+ minX,
1312
+ maxX
1313
+ } = bounds;
1314
+ var visibleWidth = maxX - minX;
1236
1315
 
1237
- if (_columnWidth3 > 0) {
1238
- var _x6 = gridX + _columnX + _columnWidth3 + 0.5;
1316
+ if (columnHeaderMaxDepth === 0) {
1317
+ return;
1318
+ }
1239
1319
 
1240
- context.moveTo(_x6, 0);
1241
- context.lineTo(_x6, columnHeaderHeight - 0.5);
1242
- isPreviousColumnHidden = false;
1243
- } else if (!isPreviousColumnHidden) {
1244
- isPreviousColumnHidden = true;
1245
- hiddenColumns.push(_column3);
1246
- }
1247
- } // Bottom Border, should be interior to the header height
1320
+ var startIndex = range[0];
1321
+ var endIndex = range[1];
1322
+ context.save();
1323
+ context.translate(0, (columnHeaderMaxDepth - depth - 1) * columnHeaderHeight);
1248
1324
 
1325
+ if (depth === 0) {
1326
+ // Make sure base column header background always goes to the right edge
1327
+ this.drawColumnHeader(context, state, '', minX, maxX, {
1328
+ backgroundColor: headerBackgroundColor,
1329
+ separatorColor: headerSeparatorColor
1330
+ }); // Draw base column headers
1249
1331
 
1250
- context.moveTo(0, columnHeaderHeight - 0.5);
1251
- context.lineTo(width, columnHeaderHeight - 0.5);
1252
- context.stroke(); // Now draw the hidden column separator boxes
1332
+ for (var i = startIndex; i <= endIndex; i += 1) {
1333
+ this.drawColumnHeaderAtIndex(context, state, i, bounds);
1334
+ }
1335
+ } // Draw column header group
1253
1336
 
1254
- context.beginPath();
1255
- context.fillStyle = headerSeparatorColor;
1256
1337
 
1257
- for (var _i8 = 0; _i8 < hiddenColumns.length; _i8 += 1) {
1258
- var _column4 = hiddenColumns[_i8];
1338
+ if (depth > 0) {
1339
+ var columnIndex = startIndex;
1259
1340
 
1260
- var _columnX2 = getOrThrow(visibleColumnXs, _column4);
1341
+ while (columnIndex <= endIndex) {
1342
+ var modelColumn = getOrThrow(modelColumns, columnIndex);
1343
+ var columnGroupName = model.textForColumnHeader(modelColumn, depth);
1344
+ var columnGroupColor = model.colorForColumnHeader(modelColumn, depth);
1345
+ var columnGroupLeft = getOrThrow(visibleColumnXs, columnIndex) + gridX;
1346
+ var columnGroupRight = columnGroupLeft + getOrThrow(visibleColumnWidths, columnIndex);
1261
1347
 
1262
- var _columnWidth4 = getOrThrow(visibleColumnWidths, _column4);
1348
+ if (columnGroupName != null) {
1349
+ // Need to determine if the column group is at least the width of the bounds
1350
+ // And if the left/right of the group extend past the bounds
1351
+ // The group will be drawn as if it were a column with a max width of the bounds width
1352
+ var prevColumnIndex = columnIndex - 1;
1263
1353
 
1264
- var minX = gridX + _columnX2 + _columnWidth4 + 0.5 - headerHiddenSeparatorSize * 0.5;
1265
- context.rect(minX, hiddenY, headerHiddenSeparatorSize, hiddenSeparatorHeight);
1266
- }
1354
+ while (columnGroupRight - columnGroupLeft < visibleWidth || columnGroupLeft > minX) {
1355
+ var _modelColumns$get, _ref3, _userColumnWidths$get;
1267
1356
 
1268
- context.fill();
1269
- }
1357
+ var prevModelIndex = (_modelColumns$get = modelColumns.get(prevColumnIndex)) !== null && _modelColumns$get !== void 0 ? _modelColumns$get : GridUtils.getModelIndex(prevColumnIndex, movedColumns);
1270
1358
 
1271
- if (headerSeparatorHoverColor) {
1272
- var highlightedSeparator = draggingColumnSeparator;
1359
+ if (prevModelIndex == null || model.textForColumnHeader(prevModelIndex, depth) !== columnGroupName) {
1360
+ // Previous column not in the same group
1361
+ break;
1362
+ } // Use this instead of visibleColumnWidths b/c the columns may be off screen
1273
1363
 
1274
- if (highlightedSeparator == null && mouseX != null && mouseY != null) {
1275
- highlightedSeparator = GridUtils.getColumnSeparatorIndex(mouseX, mouseY, metrics, theme);
1276
- }
1277
1364
 
1278
- if (highlightedSeparator != null && (!isDragging || draggingColumnSeparator != null)) {
1279
- context.strokeStyle = headerSeparatorHoverColor;
1365
+ var prevColumnWidth = (_ref3 = (_userColumnWidths$get = userColumnWidths.get(prevModelIndex)) !== null && _userColumnWidths$get !== void 0 ? _userColumnWidths$get : calculatedColumnWidths.get(prevModelIndex)) !== null && _ref3 !== void 0 ? _ref3 : columnWidth;
1366
+ columnGroupLeft -= prevColumnWidth;
1367
+ prevColumnIndex -= 1;
1368
+ }
1280
1369
 
1281
- var _columnX3 = getOrThrow(visibleColumnXs, highlightedSeparator);
1370
+ var nextColumnIndex = columnIndex + 1;
1282
1371
 
1283
- var _columnWidth5 = getOrThrow(visibleColumnWidths, highlightedSeparator);
1372
+ while (columnGroupRight - columnGroupLeft < visibleWidth || columnGroupRight < maxX) {
1373
+ var _modelColumns$get2, _ref4, _userColumnWidths$get2;
1284
1374
 
1285
- var _x7 = gridX + _columnX3 + _columnWidth5 + 0.5;
1375
+ var nextModelIndex = (_modelColumns$get2 = modelColumns.get(nextColumnIndex)) !== null && _modelColumns$get2 !== void 0 ? _modelColumns$get2 : GridUtils.getModelIndex(nextColumnIndex, movedColumns);
1286
1376
 
1287
- var visibleColumnIndex = visibleColumns.indexOf(highlightedSeparator);
1288
- var nextColumn = visibleColumnIndex < visibleColumns.length - 1 ? visibleColumns[visibleColumnIndex + 1] : null;
1289
- var nextColumnWidth = nextColumn != null ? visibleColumnWidths.get(nextColumn) : null;
1290
- var isColumnHidden = _columnWidth5 === 0;
1291
- var isNextColumnHidden = nextColumnWidth != null && nextColumnWidth === 0;
1377
+ if (model.textForColumnHeader(nextModelIndex, depth) !== columnGroupName) {
1378
+ // Next column not in the same group
1379
+ break;
1380
+ } // Use this instead of visibleColumnWidths b/c the columns may be off screen
1292
1381
 
1293
- if (isColumnHidden) {
1294
- context.strokeStyle = headerHiddenSeparatorHoverColor;
1295
- context.fillStyle = headerHiddenSeparatorHoverColor;
1296
- context.fillRect(_x7, hiddenY, headerHiddenSeparatorSize * 0.5, hiddenSeparatorHeight);
1297
- } else if (isNextColumnHidden) {
1298
- context.fillStyle = headerSeparatorHoverColor;
1299
- context.fillRect(_x7 - headerHiddenSeparatorSize * 0.5, hiddenY, headerHiddenSeparatorSize * 0.5, hiddenSeparatorHeight);
1300
- } // column seperator hover line
1301
1382
 
1383
+ var nextColumnWidth = (_ref4 = (_userColumnWidths$get2 = userColumnWidths.get(nextModelIndex)) !== null && _userColumnWidths$get2 !== void 0 ? _userColumnWidths$get2 : calculatedColumnWidths.get(nextModelIndex)) !== null && _ref4 !== void 0 ? _ref4 : columnWidth;
1384
+ columnGroupRight += nextColumnWidth;
1385
+ nextColumnIndex += 1;
1386
+ } // Set column index to end of the current group
1302
1387
 
1303
- context.beginPath();
1304
- context.moveTo(_x7, 0);
1305
- context.lineTo(_x7, columnHeaderHeight - 1);
1306
- context.stroke();
1388
+
1389
+ columnIndex = nextColumnIndex - 1;
1390
+ var isFullWidth = columnGroupRight - columnGroupLeft >= visibleWidth;
1391
+ var x = columnGroupLeft;
1392
+
1393
+ if (isFullWidth) {
1394
+ if (columnGroupRight < maxX) {
1395
+ x = columnGroupRight - visibleWidth;
1396
+ } else if (columnGroupLeft < minX) {
1397
+ x = minX;
1398
+ }
1399
+ }
1400
+
1401
+ this.drawColumnHeader(context, state, columnGroupName, x, Math.min(columnGroupRight - columnGroupLeft, visibleWidth), {
1402
+ backgroundColor: columnGroupColor !== null && columnGroupColor !== void 0 ? columnGroupColor : headerBackgroundColor,
1403
+ textColor: headerColor,
1404
+ separatorColor: headerSeparatorColor
1405
+ }, bounds);
1406
+ }
1407
+
1408
+ columnIndex += 1;
1307
1409
  }
1308
1410
  }
1309
1411
 
1310
1412
  context.restore();
1311
1413
  }
1414
+ /**
1415
+ * Draws the column header for the given visible index
1416
+ * @param context Canvas context
1417
+ * @param state Grid render state
1418
+ * @param index Visible index of the column header to draw
1419
+ * @param bounds The horizontal bounds the header can be drawn in
1420
+ */
1312
1421
 
1313
- drawColumnHeader(context, state, column, columnX, columnWidth) {
1314
- if (columnWidth <= 0) {
1315
- return;
1316
- }
1422
+
1423
+ drawColumnHeaderAtIndex(context, state, index, bounds) {
1424
+ var _model$colorForColumn;
1317
1425
 
1318
1426
  var {
1319
1427
  metrics,
@@ -1321,44 +1429,131 @@ export class GridRenderer {
1321
1429
  theme
1322
1430
  } = state;
1323
1431
  var {
1324
- modelColumns
1432
+ modelColumns,
1433
+ visibleColumnWidths,
1434
+ visibleColumnXs,
1435
+ gridX
1325
1436
  } = metrics;
1326
- var modelColumn = getOrThrow(modelColumns, column);
1437
+ var width = getOrThrow(visibleColumnWidths, index);
1438
+ var x = getOrThrow(visibleColumnXs, index) + gridX;
1439
+ var modelColumn = getOrThrow(modelColumns, index);
1327
1440
  var text = model.textForColumnHeader(modelColumn);
1328
1441
  var {
1329
- headerHorizontalPadding
1442
+ headerBackgroundColor,
1443
+ headerColor,
1444
+ headerSeparatorColor
1330
1445
  } = theme;
1446
+
1447
+ if (text == null) {
1448
+ return;
1449
+ }
1450
+
1451
+ this.drawColumnHeader(context, state, text, x, width, {
1452
+ backgroundColor: (_model$colorForColumn = model.colorForColumnHeader(modelColumn)) !== null && _model$colorForColumn !== void 0 ? _model$colorForColumn : headerBackgroundColor,
1453
+ textColor: headerColor,
1454
+ separatorColor: headerSeparatorColor
1455
+ }, bounds);
1456
+ }
1457
+
1458
+ drawColumnHeader(context, state, columnText, columnX, columnWidth, style, bounds) {
1459
+ if (columnWidth <= 0) {
1460
+ return;
1461
+ }
1462
+
1331
1463
  var {
1332
- columnHeaderHeight,
1333
- fontWidths
1464
+ metrics,
1465
+ theme
1466
+ } = state;
1467
+ var {
1468
+ headerHorizontalPadding,
1469
+ columnHeaderHeight
1470
+ } = theme;
1471
+ var {
1472
+ fontWidths,
1473
+ width
1334
1474
  } = metrics;
1335
1475
  var fontWidth = fontWidths.get(context.font) || GridRenderer.DEFAULT_FONT_WIDTH;
1336
- var maxLength = (columnWidth - headerHorizontalPadding * 2) / fontWidth;
1476
+ var maxWidth = columnWidth - headerHorizontalPadding * 2;
1477
+ var maxLength = maxWidth / fontWidth;
1478
+ var {
1479
+ backgroundColor,
1480
+ textColor = '#ffffff',
1481
+ separatorColor
1482
+ } = style !== null && style !== void 0 ? style : {};
1483
+ var {
1484
+ minX = 0,
1485
+ maxX = width
1486
+ } = bounds !== null && bounds !== void 0 ? bounds : {};
1487
+ context.save();
1488
+ context.rect(minX, 0, maxX - minX, columnHeaderHeight);
1489
+ context.clip(); // Fill background color if specified
1337
1490
 
1338
- if (maxLength <= 0) {
1339
- return;
1491
+ if (backgroundColor) {
1492
+ context.fillStyle = backgroundColor;
1493
+ context.fillRect(columnX, 0, columnWidth, columnHeaderHeight);
1494
+ }
1495
+
1496
+ if (separatorColor) {
1497
+ context.strokeStyle = separatorColor;
1498
+ context.beginPath(); // Don't draw left separator if column touches the left edge
1499
+
1500
+ if (columnX > 0) {
1501
+ context.moveTo(columnX + 0.5, 0);
1502
+ context.lineTo(columnX + 0.5, columnHeaderHeight);
1503
+ }
1504
+
1505
+ context.moveTo(columnX + columnWidth + 0.5, 0);
1506
+ context.lineTo(columnX + columnWidth + 0.5, columnHeaderHeight); // Bottom Border, should be interior to the header height
1507
+
1508
+ context.moveTo(columnX, columnHeaderHeight - 0.5);
1509
+ context.lineTo(columnX + columnWidth, columnHeaderHeight - 0.5);
1510
+ context.stroke();
1340
1511
  }
1341
1512
 
1342
- context.save();
1343
1513
  context.beginPath();
1344
1514
  context.rect(columnX, 0, columnWidth, columnHeaderHeight);
1345
1515
  context.clip();
1516
+ context.fillStyle = textColor;
1517
+ var renderText = columnText;
1346
1518
 
1347
- if (text.length > maxLength) {
1348
- text = "".concat(text.substring(0, maxLength - 1), "\u2026");
1349
- var x = columnX + headerHorizontalPadding;
1350
- var y = columnHeaderHeight * 0.5;
1351
- context.textAlign = 'left';
1352
- context.fillText(text, x, y);
1353
- } else {
1354
- var _x8 = columnX + columnWidth * 0.5;
1355
-
1356
- var _y5 = columnHeaderHeight * 0.5;
1357
-
1358
- context.textAlign = 'center';
1359
- context.fillText(text, _x8, _y5);
1519
+ if (maxLength <= 0) {
1520
+ renderText = '';
1521
+ } else if (renderText.length > maxLength) {
1522
+ renderText = "".concat(renderText.substring(0, maxLength - 1), "\u2026");
1523
+ }
1524
+
1525
+ var textWidth = renderText.length * fontWidth;
1526
+ var x = columnX + columnWidth * 0.5;
1527
+ var y = columnHeaderHeight * 0.5;
1528
+ minX += headerHorizontalPadding;
1529
+ maxX -= headerHorizontalPadding;
1530
+ var columnLeft = columnX + headerHorizontalPadding;
1531
+ var visibleLeft = clamp(columnLeft, minX, maxX);
1532
+ var columnRight = columnX + columnWidth - headerHorizontalPadding;
1533
+ var visibleRight = clamp(columnRight, minX, maxX);
1534
+ var visibleWidth = visibleRight - visibleLeft;
1535
+ var isBeyondLeft = x - textWidth * 0.5 < minX;
1536
+ var isBeyondRight = x + textWidth * 0.5 > maxX;
1537
+
1538
+ if (isBeyondLeft) {
1539
+ // Column name would be off the left side of the canvas
1540
+ if (textWidth < visibleWidth) {
1541
+ // Can render the entire text in the visible space. Stick to left
1542
+ x = minX + textWidth * 0.5;
1543
+ } else {
1544
+ x = columnRight - textWidth * 0.5;
1545
+ }
1546
+ } else if (isBeyondRight) {
1547
+ if (textWidth < visibleWidth) {
1548
+ // Can render the entire text in the visible space. Stick to right
1549
+ x = maxX - textWidth * 0.5;
1550
+ } else {
1551
+ x = columnLeft + textWidth * 0.5;
1552
+ }
1360
1553
  }
1361
1554
 
1555
+ context.textAlign = 'center';
1556
+ context.fillText(renderText, x, y);
1362
1557
  context.restore();
1363
1558
  }
1364
1559
 
@@ -1431,8 +1626,8 @@ export class GridRenderer {
1431
1626
  context.beginPath();
1432
1627
  context.fillStyle = headerSeparatorColor;
1433
1628
 
1434
- for (var _i9 = 0; _i9 < hiddenRows.length; _i9 += 1) {
1435
- var _row4 = hiddenRows[_i9];
1629
+ for (var _i5 = 0; _i5 < hiddenRows.length; _i5 += 1) {
1630
+ var _row4 = hiddenRows[_i5];
1436
1631
 
1437
1632
  var _rowY = getOrThrow(visibleRowYs, _row4);
1438
1633
 
@@ -1446,7 +1641,9 @@ export class GridRenderer {
1446
1641
  }
1447
1642
 
1448
1643
  if (headerSeparatorHoverColor) {
1449
- var highlightedSeparator = draggingRowSeparator;
1644
+ var {
1645
+ index: highlightedSeparator = null
1646
+ } = draggingRowSeparator !== null && draggingRowSeparator !== void 0 ? draggingRowSeparator : {};
1450
1647
 
1451
1648
  if (highlightedSeparator == null && mouseX != null && mouseY != null) {
1452
1649
  highlightedSeparator = GridUtils.getRowSeparatorIndex(mouseX, mouseY, metrics, theme);
@@ -1459,7 +1656,7 @@ export class GridRenderer {
1459
1656
 
1460
1657
  var _rowHeight2 = getOrThrow(visibleRowHeights, highlightedSeparator);
1461
1658
 
1462
- var _y6 = gridY + _rowY2 + _rowHeight2 + 0.5;
1659
+ var _y5 = gridY + _rowY2 + _rowHeight2 + 0.5;
1463
1660
 
1464
1661
  var visibleRowIndex = visibleRows.indexOf(highlightedSeparator);
1465
1662
  var nextRow = visibleRowIndex < visibleRows.length - 1 ? visibleRows[visibleRowIndex + 1] : null;
@@ -1470,15 +1667,15 @@ export class GridRenderer {
1470
1667
  if (isRowHidden) {
1471
1668
  context.strokeStyle = headerHiddenSeparatorHoverColor;
1472
1669
  context.fillStyle = headerHiddenSeparatorHoverColor;
1473
- context.fillRect(hiddenX, _y6, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1670
+ context.fillRect(hiddenX, _y5, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1474
1671
  } else if (isNextRowHidden) {
1475
1672
  context.fillStyle = headerSeparatorHoverColor;
1476
- context.fillRect(hiddenX, _y6 - headerHiddenSeparatorSize * 0.5, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1673
+ context.fillRect(hiddenX, _y5 - headerHiddenSeparatorSize * 0.5, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1477
1674
  }
1478
1675
 
1479
1676
  context.beginPath();
1480
- context.moveTo(0.5, _y6);
1481
- context.lineTo(rowHeaderWidth + 0.5, _y6);
1677
+ context.moveTo(0.5, _y5);
1678
+ context.lineTo(rowHeaderWidth + 0.5, _y5);
1482
1679
  context.stroke();
1483
1680
  }
1484
1681
  } // Fill in the text
@@ -1490,14 +1687,14 @@ export class GridRenderer {
1490
1687
  context.fillStyle = headerColor;
1491
1688
  context.textAlign = 'right';
1492
1689
 
1493
- for (var _i10 = 0; _i10 < visibleRows.length; _i10 += 1) {
1494
- var _row5 = visibleRows[_i10];
1690
+ for (var _i6 = 0; _i6 < visibleRows.length; _i6 += 1) {
1691
+ var _row5 = visibleRows[_i6];
1495
1692
 
1496
1693
  var _rowHeight3 = getOrThrow(visibleRowHeights, _row5);
1497
1694
 
1498
- var _y7 = getOrThrow(visibleRowYs, _row5) + gridY;
1695
+ var _y6 = getOrThrow(visibleRowYs, _row5) + gridY;
1499
1696
 
1500
- this.drawRowHeader(context, state, _row5, _y7, _rowHeight3);
1697
+ this.drawRowHeader(context, state, _row5, _y6, _rowHeight3);
1501
1698
  }
1502
1699
 
1503
1700
  context.restore();
@@ -1600,8 +1797,8 @@ export class GridRenderer {
1600
1797
  context.beginPath();
1601
1798
  context.fillStyle = headerSeparatorColor;
1602
1799
 
1603
- for (var _i11 = 0; _i11 < hiddenRows.length; _i11 += 1) {
1604
- var _row6 = hiddenRows[_i11];
1800
+ for (var _i7 = 0; _i7 < hiddenRows.length; _i7 += 1) {
1801
+ var _row6 = hiddenRows[_i7];
1605
1802
 
1606
1803
  var _rowY3 = getOrThrow(visibleRowYs, _row6);
1607
1804
 
@@ -1615,7 +1812,9 @@ export class GridRenderer {
1615
1812
  }
1616
1813
 
1617
1814
  if (headerSeparatorHoverColor) {
1618
- var highlightedSeparator = draggingRowSeparator;
1815
+ var {
1816
+ index: highlightedSeparator = null
1817
+ } = draggingRowSeparator !== null && draggingRowSeparator !== void 0 ? draggingRowSeparator : {};
1619
1818
 
1620
1819
  if (highlightedSeparator == null && mouseX != null && mouseY != null) {
1621
1820
  highlightedSeparator = GridUtils.getRowSeparatorIndex(mouseX, mouseY, metrics, theme);
@@ -1628,7 +1827,7 @@ export class GridRenderer {
1628
1827
 
1629
1828
  var _rowHeight5 = getOrThrow(visibleRowHeights, highlightedSeparator);
1630
1829
 
1631
- var _y8 = gridY + _rowY4 + _rowHeight5 + 0.5;
1830
+ var _y7 = gridY + _rowY4 + _rowHeight5 + 0.5;
1632
1831
 
1633
1832
  var visibleRowIndex = visibleRows.indexOf(highlightedSeparator);
1634
1833
  var nextRow = visibleRowIndex < visibleRows.length - 1 ? visibleRows[visibleRowIndex + 1] : null;
@@ -1639,15 +1838,15 @@ export class GridRenderer {
1639
1838
  if (isRowHidden) {
1640
1839
  context.strokeStyle = headerHiddenSeparatorHoverColor;
1641
1840
  context.fillStyle = headerHiddenSeparatorHoverColor;
1642
- context.fillRect(hiddenX, _y8, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1841
+ context.fillRect(hiddenX, _y7, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1643
1842
  } else if (isNextRowHidden) {
1644
1843
  context.fillStyle = headerSeparatorHoverColor;
1645
- context.fillRect(hiddenX, _y8 - headerHiddenSeparatorSize * 0.5, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1844
+ context.fillRect(hiddenX, _y7 - headerHiddenSeparatorSize * 0.5, hiddenSeparatorWidth, headerHiddenSeparatorSize * 0.5);
1646
1845
  }
1647
1846
 
1648
1847
  context.beginPath();
1649
- context.moveTo(x + 0.5, _y8);
1650
- context.lineTo(x + rowFooterWidth + 0.5, _y8);
1848
+ context.moveTo(x + 0.5, _y7);
1849
+ context.lineTo(x + rowFooterWidth + 0.5, _y7);
1651
1850
  context.stroke();
1652
1851
  }
1653
1852
  } // Fill in the text
@@ -1660,8 +1859,8 @@ export class GridRenderer {
1660
1859
  context.textAlign = 'left';
1661
1860
  var textX = x + cellHorizontalPadding;
1662
1861
 
1663
- for (var _i12 = 0; _i12 < visibleRows.length; _i12 += 1) {
1664
- var _row7 = visibleRows[_i12];
1862
+ for (var _i8 = 0; _i8 < visibleRows.length; _i8 += 1) {
1863
+ var _row7 = visibleRows[_i8];
1665
1864
 
1666
1865
  var _rowHeight6 = getOrThrow(visibleRowHeights, _row7);
1667
1866
 
@@ -1740,13 +1939,13 @@ export class GridRenderer {
1740
1939
 
1741
1940
  if (endRow >= top && bottom >= startRow && endColumn >= left && right >= startColumn) {
1742
1941
  // Need to offset the x/y coordinates so that the line draws nice and crisp
1743
- var _x9 = startColumn >= left && visibleColumnXs.has(startColumn) ? Math.round(getOrThrow(visibleColumnXs, startColumn)) + 0.5 : minX;
1942
+ var _x4 = startColumn >= left && visibleColumnXs.has(startColumn) ? Math.round(getOrThrow(visibleColumnXs, startColumn)) + 0.5 : minX;
1744
1943
 
1745
- var _y9 = startRow >= top && visibleRowYs.has(startRow) ? Math.max(Math.round(getOrThrow(visibleRowYs, startRow)) + 0.5, 0.5) : minY;
1944
+ var _y8 = startRow >= top && visibleRowYs.has(startRow) ? Math.max(Math.round(getOrThrow(visibleRowYs, startRow)) + 0.5, 0.5) : minY;
1746
1945
 
1747
1946
  var endX = endColumn <= right && visibleColumnXs.has(endColumn) ? Math.round(getOrThrow(visibleColumnXs, endColumn) + getOrThrow(visibleColumnWidths, endColumn)) - 0.5 : maxX;
1748
1947
  var endY = endRow <= bottom && visibleRowYs.has(endRow) ? Math.round(getOrThrow(visibleRowYs, endRow) + getOrThrow(visibleRowHeights, endRow)) - 0.5 : maxY;
1749
- context.rect(_x9, _y9, endX - _x9, endY - _y9);
1948
+ context.rect(_x4, _y8, endX - _x4, endY - _y8);
1750
1949
  } // draw the inner transparent fill
1751
1950
 
1752
1951
 
@@ -1848,27 +2047,49 @@ export class GridRenderer {
1848
2047
  }
1849
2048
 
1850
2049
  drawDraggingColumn(context, state) {
2050
+ var _modelColumns$get3;
2051
+
1851
2052
  var {
1852
2053
  draggingColumn,
1853
- draggingColumnOffset,
1854
2054
  metrics,
1855
2055
  mouseX,
1856
- theme
2056
+ theme,
2057
+ model
1857
2058
  } = state;
1858
2059
 
1859
2060
  if (draggingColumn == null || mouseX == null) {
1860
2061
  return;
1861
2062
  }
1862
2063
 
2064
+ var {
2065
+ range: draggingColumnVisibleRange,
2066
+ depth: draggingColumnDepth
2067
+ } = draggingColumn;
1863
2068
  var {
1864
2069
  gridX,
1865
2070
  gridY,
1866
2071
  visibleColumnXs,
1867
2072
  visibleColumnWidths,
1868
- height
2073
+ height,
2074
+ width,
2075
+ columnHeaderMaxDepth,
2076
+ columnHeaderHeight,
2077
+ movedColumns,
2078
+ modelColumns,
2079
+ floatingLeftWidth
1869
2080
  } = metrics;
1870
- var x = getOrThrow(visibleColumnXs, draggingColumn);
1871
- var columnWidth = getOrThrow(visibleColumnWidths, draggingColumn) + 1;
2081
+ var draggingModelIndex = (_modelColumns$get3 = modelColumns.get(draggingColumnVisibleRange[0])) !== null && _modelColumns$get3 !== void 0 ? _modelColumns$get3 : GridUtils.getModelIndex(draggingColumnVisibleRange[0], movedColumns);
2082
+ var draggingGroup = model.getColumnHeaderGroup(draggingModelIndex, draggingColumnDepth);
2083
+
2084
+ if (draggingColumnDepth > 0 && !draggingGroup) {
2085
+ return;
2086
+ }
2087
+
2088
+ var [startIndex, endIndex] = draggingColumnVisibleRange;
2089
+ var originalLeft = getOrThrow(visibleColumnXs, startIndex);
2090
+ var originalRight = getOrThrow(visibleColumnXs, endIndex) + getOrThrow(visibleColumnWidths, endIndex);
2091
+ var originalWidth = originalRight - originalLeft;
2092
+ var draggingLeft = draggingColumn.left;
1872
2093
  var {
1873
2094
  backgroundColor,
1874
2095
  font,
@@ -1877,30 +2098,58 @@ export class GridRenderer {
1877
2098
  shadowBlur,
1878
2099
  shadowColor
1879
2100
  } = theme;
2101
+ var columnHeaderOffset = (columnHeaderMaxDepth - draggingColumnDepth - 1) * columnHeaderHeight;
2102
+ context.save();
2103
+ context.translate(gridX, 0);
1880
2104
  context.save();
1881
- context.translate(gridX, 0); // First, we need to draw over the row stripes where the column is coming from
2105
+ context.beginPath(); // Don't draw over frozen columns
2106
+
2107
+ context.rect(floatingLeftWidth, 0, width, height);
2108
+ context.clip(); // First, we need to draw over where the column is coming from
1882
2109
 
1883
2110
  context.fillStyle = backgroundColor;
1884
- context.fillRect(x, 0, columnWidth, height);
1885
- context.translate(mouseX - x - gridX - (draggingColumnOffset !== null && draggingColumnOffset !== void 0 ? draggingColumnOffset : 0), gridY + reorderOffset); // Then draw the shadow of the moving column
2111
+ context.fillRect(originalLeft, columnHeaderOffset, originalWidth, height);
2112
+ context.restore(); // Then draw the shadow of the moving column
1886
2113
 
2114
+ context.translate(0, reorderOffset);
1887
2115
  context.save();
1888
2116
  context.shadowColor = shadowColor;
1889
2117
  context.shadowBlur = shadowBlur;
1890
2118
  context.fillStyle = backgroundColor;
1891
- context.fillRect(x, -gridY, columnWidth, height);
1892
- context.restore(); // Now set the clipping region and pretty much just redraw this column and all it's contents
2119
+ context.fillRect(draggingColumn.left, columnHeaderOffset + reorderOffset, draggingColumn.width, height);
2120
+ context.restore(); // Reset style
2121
+ // Now set the clipping region and pretty much just redraw this column and all it's contents
1893
2122
 
1894
2123
  context.beginPath();
1895
- context.rect(x, -gridY, columnWidth, height);
2124
+ context.rect(draggingColumn.left, columnHeaderOffset, draggingColumn.width + 1, height);
1896
2125
  context.clip();
2126
+ context.translate(draggingLeft - originalLeft, 0);
2127
+ context.font = headerFont;
2128
+ var visibleColumns = [];
2129
+
2130
+ for (var i = draggingColumn.range[0]; i <= draggingColumn.range[1]; i += 1) {
2131
+ visibleColumns.push(i);
2132
+ }
2133
+ /**
2134
+ * This will not draw the header text properly, but extensions of Grid
2135
+ * may draw extra things in the header like sorts and filters
2136
+ */
2137
+
2138
+
2139
+ this.drawColumnHeaders(context, state); // Ensure the column header gets drawn
2140
+
2141
+ this.drawColumnHeadersForRange(context, state, [visibleColumns[0], visibleColumns[visibleColumns.length - 1]], {
2142
+ minX: originalLeft,
2143
+ maxX: width
2144
+ });
2145
+ context.translate(0, gridY);
1897
2146
  context.font = font;
1898
2147
  this.drawGridBackground(context, state);
1899
- this.drawColumnCellContents(context, state, draggingColumn); // Now translate it back up and draw the header
1900
2148
 
1901
- context.translate(-gridX, -gridY);
1902
- context.font = headerFont;
1903
- this.drawColumnHeaders(context, state);
2149
+ for (var _i9 = startIndex; _i9 <= endIndex; _i9 += 1) {
2150
+ this.drawColumnCellContents(context, state, _i9);
2151
+ }
2152
+
1904
2153
  context.restore();
1905
2154
  }
1906
2155
 
@@ -2094,15 +2343,15 @@ export class GridRenderer {
2094
2343
  }
2095
2344
 
2096
2345
  if (hasVerticalBar) {
2097
- var _x10 = width - rowHeaderWidth - vScrollBarSize;
2346
+ var _x5 = width - rowHeaderWidth - vScrollBarSize;
2098
2347
 
2099
- var _y10 = scrollY; // scrollbar casing
2348
+ var _y9 = scrollY; // scrollbar casing
2100
2349
 
2101
2350
  context.fillStyle = scrollBarCasingColor;
2102
- context.fillRect(_x10, 0, vScrollBarSize - scrollBarCasingWidth, barHeight); // scrollbar track
2351
+ context.fillRect(_x5, 0, vScrollBarSize - scrollBarCasingWidth, barHeight); // scrollbar track
2103
2352
 
2104
2353
  context.fillStyle = isVerticalBarHover ? scrollBarHoverBackgroundColor : scrollBarBackgroundColor;
2105
- context.fillRect(_x10 + scrollBarCasingWidth, 0, vScrollBarSize - scrollBarCasingWidth, barHeight); // scrollbar thumb
2354
+ context.fillRect(_x5 + scrollBarCasingWidth, 0, vScrollBarSize - scrollBarCasingWidth, barHeight); // scrollbar thumb
2106
2355
 
2107
2356
  if (isDraggingVerticalScrollBar) {
2108
2357
  context.fillStyle = scrollBarActiveColor;
@@ -2112,7 +2361,7 @@ export class GridRenderer {
2112
2361
  context.fillStyle = scrollBarColor;
2113
2362
  }
2114
2363
 
2115
- context.fillRect(_x10 + scrollBarCasingWidth, _y10, vScrollBarSize - scrollBarCasingWidth, handleHeight);
2364
+ context.fillRect(_x5 + scrollBarCasingWidth, _y9, vScrollBarSize - scrollBarCasingWidth, handleHeight);
2116
2365
 
2117
2366
  if (!autoSelectColumn && scrollBarSelectionTick && scrollBarSelectionTickColor != null && scrollBarActiveSelectionTickColor != null) {
2118
2367
  // Scrollbar Selection Tick
@@ -2141,8 +2390,8 @@ export class GridRenderer {
2141
2390
 
2142
2391
  var _mergedRanges = GridUtils.mergeSortedRanges(_sortedRanges);
2143
2392
 
2144
- for (var _i13 = 0; _i13 < _mergedRanges.length; _i13 += 1) {
2145
- var _range = _mergedRanges[_i13];
2393
+ for (var _i10 = 0; _i10 < _mergedRanges.length; _i10 += 1) {
2394
+ var _range = _mergedRanges[_i10];
2146
2395
  var startRow = _range[0];
2147
2396
  var endRow = _range[1];
2148
2397
 
@@ -2150,7 +2399,7 @@ export class GridRenderer {
2150
2399
  var tickY = getTickY(startRow);
2151
2400
  var trackWidth = vScrollBarSize - scrollBarCasingWidth;
2152
2401
  var tickHeight = Math.max(1, Math.round(getTickY(endRow + 1) - tickY));
2153
- context.fillRect(_x10 + scrollBarCasingWidth + Math.round(trackWidth / 3), tickY, Math.round(trackWidth / 3), tickHeight);
2402
+ context.fillRect(_x5 + scrollBarCasingWidth + Math.round(trackWidth / 3), tickY, Math.round(trackWidth / 3), tickHeight);
2154
2403
  }
2155
2404
  } // Current Active Tick
2156
2405
 
@@ -2162,7 +2411,7 @@ export class GridRenderer {
2162
2411
 
2163
2412
  var _tickHeight = 2;
2164
2413
  context.fillStyle = scrollBarActiveSelectionTickColor;
2165
- context.fillRect(_x10 + scrollBarCasingWidth, _tickY, _trackWidth, _tickHeight);
2414
+ context.fillRect(_x5 + scrollBarCasingWidth, _tickY, _trackWidth, _tickHeight);
2166
2415
  }
2167
2416
  }
2168
2417
  }