@gridkitjs/core 0.18.0 → 0.20.0

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.
@@ -259,10 +259,16 @@ function partitionByValue(rows, column, direction) {
259
259
  });
260
260
  return groups;
261
261
  }
262
+ function withGroupPosition(rows, depth) {
263
+ return rows.map((row, index) => ({
264
+ ...row,
265
+ groupPosition: { level: depth, position: index + 1, setSize: rows.length }
266
+ }));
267
+ }
262
268
  function buildLevel(rows, levels, parentPath, expansion, byId, out) {
263
269
  const level = levels[0];
264
270
  if (level === void 0) {
265
- out.push(...rows);
271
+ out.push(...withGroupPosition(rows, parentPath.length));
266
272
  return;
267
273
  }
268
274
  const column = byId.get(level.columnId);
@@ -272,7 +278,7 @@ function buildLevel(rows, levels, parentPath, expansion, byId, out) {
272
278
  }
273
279
  const rest = levels.slice(1);
274
280
  const groups = partitionByValue(rows, column, level.direction ?? "asc");
275
- for (const group of groups) {
281
+ for (const [index, group] of groups.entries()) {
276
282
  const path = [...parentPath, group.value];
277
283
  const groupId = groupRowId(path);
278
284
  const expanded = isGroupExpanded(expansion, groupId);
@@ -285,6 +291,8 @@ function buildLevel(rows, levels, parentPath, expansion, byId, out) {
285
291
  path,
286
292
  expanded,
287
293
  count: group.rows.length,
294
+ position: index + 1,
295
+ setSize: groups.length,
288
296
  // Both set by `groupRows` once it has the whole flattened array.
289
297
  rowIndex: -1,
290
298
  datasetIndex: -1,
@@ -388,6 +396,34 @@ function moveColumnBefore(orderedIds, movedId, beforeId) {
388
396
  next.splice(target, 0, movedId);
389
397
  return next.every((id, index) => id === orderedIds[index]) ? orderedIds : next;
390
398
  }
399
+ var PIN_GROUP_RANK = {
400
+ start: 0,
401
+ none: 1,
402
+ end: 2
403
+ };
404
+ function moveColumnInPinGroup(orderedIds, pinOf, movedId, beforeId) {
405
+ if (beforeId !== null && !orderedIds.includes(beforeId)) {
406
+ return orderedIds;
407
+ }
408
+ const next = moveColumnBefore(
409
+ orderedIds,
410
+ movedId,
411
+ beforeIdInGroup(orderedIds, pinOf, pinOf(movedId), beforeId)
412
+ );
413
+ const grouped = (ids) => ids.toSorted((a, b) => PIN_GROUP_RANK[pinOf(a)] - PIN_GROUP_RANK[pinOf(b)]);
414
+ const before = grouped(orderedIds);
415
+ return grouped(next).every((id, index) => id === before[index]) ? orderedIds : next;
416
+ }
417
+ function beforeIdInGroup(orderedIds, pinOf, pin, beforeId) {
418
+ if (beforeId === null) {
419
+ return null;
420
+ }
421
+ const distance = PIN_GROUP_RANK[pinOf(beforeId)] - PIN_GROUP_RANK[pin];
422
+ if (distance === 0) {
423
+ return beforeId;
424
+ }
425
+ return distance > 0 ? null : orderedIds.find((id) => pinOf(id) === pin) ?? null;
426
+ }
391
427
  function movesColumn(orderedIds, movedId, beforeId) {
392
428
  return moveColumnBefore(orderedIds, movedId, beforeId) !== orderedIds;
393
429
  }
@@ -410,6 +446,182 @@ function resolveKeyboardDropTarget(orderedIds, columnId, direction) {
410
446
  return orderedIds[targetIndex] ?? null;
411
447
  }
412
448
 
449
+ // src/util/pinning.ts
450
+ function resolveColumnPin(column, pinning) {
451
+ return pinning[getColumnId(column)] ?? column.pinned ?? "none";
452
+ }
453
+ function partitionPinnedColumns(columns, pinning) {
454
+ const parts = {
455
+ start: [],
456
+ none: [],
457
+ end: []
458
+ };
459
+ for (const entry of columns) {
460
+ parts[resolveColumnPin(entry.column, pinning)].push(entry);
461
+ }
462
+ return { start: parts.start, unpinned: parts.none, end: parts.end };
463
+ }
464
+ function applyColumnPinning(columns, pinning) {
465
+ const { start, unpinned, end } = partitionPinnedColumns(columns, pinning);
466
+ const ordered = [...start, ...unpinned, ...end];
467
+ return ordered.every((entry, index) => entry === columns[index]) ? columns : ordered;
468
+ }
469
+ function setColumnPin(columns, pinning, columnId, pin) {
470
+ const entry = columns.find((candidate) => candidate.id === columnId);
471
+ if (entry === void 0 || resolveColumnPin(entry.column, pinning) === pin) {
472
+ return pinning;
473
+ }
474
+ return { ...pinning, [columnId]: pin };
475
+ }
476
+ function placePinnedColumns(columns) {
477
+ const lastStart = columns.findLastIndex((entry) => entry.pinned === "start");
478
+ const firstEnd = columns.findIndex((entry) => entry.pinned === "end");
479
+ const startOffsets = widthsBefore(columns, "start");
480
+ const endOffsets = widthsBefore(columns.toReversed(), "end").toReversed();
481
+ return columns.map((entry, index) => {
482
+ switch (entry.pinned) {
483
+ case "start":
484
+ return {
485
+ ...entry,
486
+ pinOffset: startOffsets[index] ?? 0,
487
+ pinEdge: index === lastStart
488
+ };
489
+ case "end":
490
+ return {
491
+ ...entry,
492
+ pinOffset: endOffsets[index] ?? 0,
493
+ pinEdge: index === firstEnd
494
+ };
495
+ case "none":
496
+ return { ...entry, pinOffset: 0, pinEdge: false };
497
+ }
498
+ });
499
+ }
500
+ function widthsBefore(columns, pin) {
501
+ let sum = 0;
502
+ return columns.map((entry) => {
503
+ const before = sum;
504
+ if (entry.pinned === pin) {
505
+ sum += entry.width;
506
+ }
507
+ return before;
508
+ });
509
+ }
510
+ function pinnedWidths(columns) {
511
+ let start = 0;
512
+ let end = 0;
513
+ for (const entry of columns) {
514
+ if (entry.pinned === "start") {
515
+ start += entry.width;
516
+ } else if (entry.pinned === "end") {
517
+ end += entry.width;
518
+ }
519
+ }
520
+ return { start, end };
521
+ }
522
+
523
+ // src/util/selection.ts
524
+ var NO_CHANGE = { added: [], removed: [] };
525
+ function sameSelection(a, b) {
526
+ return a.length === b.length && a.every((id, index) => id === b[index]);
527
+ }
528
+ function toggleSelection(selection, id, mode) {
529
+ if (mode === false) {
530
+ return selection;
531
+ }
532
+ if (selection.includes(id)) {
533
+ return selection.filter((selectedId) => selectedId !== id);
534
+ }
535
+ return mode === "single" ? [id] : [...selection, id];
536
+ }
537
+ function selectOnly(selection, id, mode) {
538
+ if (mode === false) {
539
+ return selection;
540
+ }
541
+ return selection.length === 1 && selection[0] === id ? selection : [id];
542
+ }
543
+ function selectRange(selection, orderedIds, anchorId, focusId, mode) {
544
+ if (mode !== "multiple") {
545
+ return selectOnly(selection, focusId, mode);
546
+ }
547
+ const anchor = orderedIds.indexOf(anchorId);
548
+ const focus = orderedIds.indexOf(focusId);
549
+ if (anchor === -1 || focus === -1) {
550
+ return selection;
551
+ }
552
+ const next = orderedIds.slice(
553
+ Math.min(anchor, focus),
554
+ Math.max(anchor, focus) + 1
555
+ );
556
+ return sameSelection(selection, next) ? selection : next;
557
+ }
558
+ function selectAll(selection, orderedIds, mode) {
559
+ if (mode !== "multiple") {
560
+ return selection;
561
+ }
562
+ return sameSelection(selection, orderedIds) ? selection : orderedIds;
563
+ }
564
+ function clearSelection(selection) {
565
+ return selection.length === 0 ? selection : [];
566
+ }
567
+ function diffSelection(previous, next) {
568
+ if (previous === next) {
569
+ return NO_CHANGE;
570
+ }
571
+ const before = new Set(previous);
572
+ const after = new Set(next);
573
+ return {
574
+ added: next.filter((id) => !before.has(id)),
575
+ removed: previous.filter((id) => !after.has(id))
576
+ };
577
+ }
578
+ var NO_CELL_SELECTED = { kind: "none" };
579
+ function isSameCell(a, b) {
580
+ if (a.kind === "none" || b.kind === "none") {
581
+ return a.kind === b.kind;
582
+ }
583
+ return a.rowId === b.rowId && a.columnId === b.columnId;
584
+ }
585
+ function holdsCell(selection, cell) {
586
+ return selection.kind === "cell" && selection.rowId === cell.rowId && selection.columnId === cell.columnId;
587
+ }
588
+ function selectCell(selection, cell, mode) {
589
+ if (mode === false || holdsCell(selection, cell)) {
590
+ return selection;
591
+ }
592
+ return { kind: "cell", rowId: cell.rowId, columnId: cell.columnId };
593
+ }
594
+ function toggleCellSelection(selection, cell, mode) {
595
+ if (mode === false) {
596
+ return selection;
597
+ }
598
+ return holdsCell(selection, cell) ? NO_CELL_SELECTED : { kind: "cell", rowId: cell.rowId, columnId: cell.columnId };
599
+ }
600
+ function clearCellSelection(selection) {
601
+ return selection.kind === "none" ? selection : NO_CELL_SELECTED;
602
+ }
603
+ function intentOf(event, options) {
604
+ if (event.shiftKey) {
605
+ return "range";
606
+ }
607
+ if (event.ctrlKey || event.metaKey) {
608
+ return "toggle";
609
+ }
610
+ return options?.toggleOnClick === true ? "toggle" : "replace";
611
+ }
612
+ function applySelectionIntent(selection, orderedIds, anchorId, id, intent, mode) {
613
+ switch (intent) {
614
+ case "toggle":
615
+ return toggleSelection(selection, id, mode);
616
+ // A range with no anchor yet spans from the id to itself, which is the
617
+ // plain click a first Shift-click may as well be.
618
+ case "range":
619
+ return selectRange(selection, orderedIds, anchorId ?? id, id, mode);
620
+ default:
621
+ return selectOnly(selection, id, mode);
622
+ }
623
+ }
624
+
413
625
  // src/util/filterOperators.ts
414
626
  var matchNothing = () => false;
415
627
  function kindOf(type) {
@@ -740,151 +952,6 @@ function filterRows(rows, filter, columns) {
740
952
  return renumberRows(filtered);
741
953
  }
742
954
 
743
- // src/util/rows.ts
744
- function resolveShownRows(rows, filter, sort, columns) {
745
- return sortRows(filterRows(rows, filter, columns), sort, columns);
746
- }
747
- function unknownDisplayRow(entry) {
748
- const { kind } = entry;
749
- throw new TypeError(
750
- `GridKit: \`${String(kind)}\` is not a display row kind.`
751
- );
752
- }
753
- function resolveRows(rowsById, ids) {
754
- return ids.map((id) => rowsById.get(id)).filter((row) => row !== void 0);
755
- }
756
- function resolveColumns(columns, ids) {
757
- return ids.map((id) => {
758
- const columnIndex = columns.findIndex((entry) => entry.id === id);
759
- const column = columns[columnIndex];
760
- return column === void 0 ? void 0 : { columnId: id, column, columnIndex };
761
- }).filter((column) => column !== void 0);
762
- }
763
- function resolveCell(rowsById, columns, cell) {
764
- if (cell === null) {
765
- return null;
766
- }
767
- const entry = rowsById.get(cell.rowId);
768
- const columnIndex = columns.findIndex(
769
- (candidate) => candidate.id === cell.columnId
770
- );
771
- const column = columns[columnIndex];
772
- if (entry === void 0 || column === void 0) {
773
- return null;
774
- }
775
- return {
776
- rowId: cell.rowId,
777
- columnId: cell.columnId,
778
- row: entry.row,
779
- column,
780
- rowIndex: entry.rowIndex,
781
- columnIndex,
782
- value: accessDotted(entry.row, column.column.field)
783
- };
784
- }
785
-
786
- // src/util/selection.ts
787
- var NO_CHANGE = { added: [], removed: [] };
788
- function sameSelection(a, b) {
789
- return a.length === b.length && a.every((id, index) => id === b[index]);
790
- }
791
- function toggleSelection(selection, id, mode) {
792
- if (mode === false) {
793
- return selection;
794
- }
795
- if (selection.includes(id)) {
796
- return selection.filter((selectedId) => selectedId !== id);
797
- }
798
- return mode === "single" ? [id] : [...selection, id];
799
- }
800
- function selectOnly(selection, id, mode) {
801
- if (mode === false) {
802
- return selection;
803
- }
804
- return selection.length === 1 && selection[0] === id ? selection : [id];
805
- }
806
- function selectRange(selection, orderedIds, anchorId, focusId, mode) {
807
- if (mode !== "multiple") {
808
- return selectOnly(selection, focusId, mode);
809
- }
810
- const anchor = orderedIds.indexOf(anchorId);
811
- const focus = orderedIds.indexOf(focusId);
812
- if (anchor === -1 || focus === -1) {
813
- return selection;
814
- }
815
- const next = orderedIds.slice(
816
- Math.min(anchor, focus),
817
- Math.max(anchor, focus) + 1
818
- );
819
- return sameSelection(selection, next) ? selection : next;
820
- }
821
- function selectAll(selection, orderedIds, mode) {
822
- if (mode !== "multiple") {
823
- return selection;
824
- }
825
- return sameSelection(selection, orderedIds) ? selection : orderedIds;
826
- }
827
- function clearSelection(selection) {
828
- return selection.length === 0 ? selection : [];
829
- }
830
- function diffSelection(previous, next) {
831
- if (previous === next) {
832
- return NO_CHANGE;
833
- }
834
- const before = new Set(previous);
835
- const after = new Set(next);
836
- return {
837
- added: next.filter((id) => !before.has(id)),
838
- removed: previous.filter((id) => !after.has(id))
839
- };
840
- }
841
- var NO_CELL_SELECTED = { kind: "none" };
842
- function isSameCell(a, b) {
843
- if (a.kind === "none" || b.kind === "none") {
844
- return a.kind === b.kind;
845
- }
846
- return a.rowId === b.rowId && a.columnId === b.columnId;
847
- }
848
- function holdsCell(selection, cell) {
849
- return selection.kind === "cell" && selection.rowId === cell.rowId && selection.columnId === cell.columnId;
850
- }
851
- function selectCell(selection, cell, mode) {
852
- if (mode === false || holdsCell(selection, cell)) {
853
- return selection;
854
- }
855
- return { kind: "cell", rowId: cell.rowId, columnId: cell.columnId };
856
- }
857
- function toggleCellSelection(selection, cell, mode) {
858
- if (mode === false) {
859
- return selection;
860
- }
861
- return holdsCell(selection, cell) ? NO_CELL_SELECTED : { kind: "cell", rowId: cell.rowId, columnId: cell.columnId };
862
- }
863
- function clearCellSelection(selection) {
864
- return selection.kind === "none" ? selection : NO_CELL_SELECTED;
865
- }
866
- function intentOf(event, options) {
867
- if (event.shiftKey) {
868
- return "range";
869
- }
870
- if (event.ctrlKey || event.metaKey) {
871
- return "toggle";
872
- }
873
- return options?.toggleOnClick === true ? "toggle" : "replace";
874
- }
875
- function applySelectionIntent(selection, orderedIds, anchorId, id, intent, mode) {
876
- switch (intent) {
877
- case "toggle":
878
- return toggleSelection(selection, id, mode);
879
- // A range with no anchor yet spans from the id to itself, which is the
880
- // plain click a first Shift-click may as well be.
881
- case "range":
882
- return selectRange(selection, orderedIds, anchorId ?? id, id, mode);
883
- default:
884
- return selectOnly(selection, id, mode);
885
- }
886
- }
887
-
888
955
  // src/util/sizing.ts
889
956
  var DEFAULT_COLUMN_SIZES = {
890
957
  width: 150,
@@ -907,7 +974,8 @@ function clampColumnWidth(width, constraints) {
907
974
  }
908
975
  function resolveColumnWidths(columns, sizing, options) {
909
976
  const resolved = withDefaults(options?.sizes);
910
- return columns.map((column) => {
977
+ const pinning = options?.pinning ?? {};
978
+ const sized = columns.map((column) => {
911
979
  const id = getColumnId(column);
912
980
  const stored = sizing[id];
913
981
  return {
@@ -922,9 +990,13 @@ function resolveColumnWidths(columns, sizing, options) {
922
990
  resizable: column.resizable ?? options?.resizable ?? false,
923
991
  reorderable: column.reorderable ?? options?.reorderable ?? false,
924
992
  groupByDraggable: column.groupByDraggable ?? options?.groupByDraggable ?? false,
925
- alignment: column.alignment ?? alignmentForType(column.type ?? "string")
993
+ alignment: column.alignment ?? alignmentForType(column.type ?? "string"),
994
+ pinned: resolveColumnPin(column, pinning),
995
+ pinOffset: 0,
996
+ pinEdge: false
926
997
  };
927
998
  });
999
+ return placePinnedColumns(sized);
928
1000
  }
929
1001
  function totalColumnWidth(resolved) {
930
1002
  return resolved.reduce((total, entry) => total + entry.width, 0);
@@ -937,9 +1009,10 @@ function beginColumnResize(column, startWidth, startPosition, defaults) {
937
1009
  constraints: resolveColumnConstraints(column, defaults)
938
1010
  };
939
1011
  }
940
- function applyColumnResize(session, position) {
1012
+ function applyColumnResize(session, position, direction = "ltr") {
1013
+ const moved = position - session.startPosition;
941
1014
  return clampColumnWidth(
942
- session.startWidth + (position - session.startPosition),
1015
+ session.startWidth + (direction === "rtl" ? -moved : moved),
943
1016
  session.constraints
944
1017
  );
945
1018
  }
@@ -1002,7 +1075,7 @@ function fitColumnsToWidth(resolved, availableWidth, defaults) {
1002
1075
  (item) => growing ? Math.floor(item.width) : Math.ceil(item.width)
1003
1076
  );
1004
1077
  let remainder = target - rounded.reduce((total2, width) => total2 + width, 0);
1005
- return entries.map((item, index) => {
1078
+ const fitted = entries.map((item, index) => {
1006
1079
  let width = rounded[index] ?? item.width;
1007
1080
  const hasRoom = growing ? width < item.bound : width > item.bound;
1008
1081
  if (remainder !== 0 && item.adjustable && hasRoom) {
@@ -1011,6 +1084,7 @@ function fitColumnsToWidth(resolved, availableWidth, defaults) {
1011
1084
  }
1012
1085
  return { ...item.entry, width };
1013
1086
  });
1087
+ return placePinnedColumns(fitted);
1014
1088
  }
1015
1089
  function sizeColumnToContent(measuredWidth, constraints, padding = 2) {
1016
1090
  return clampColumnWidth(Math.ceil(measuredWidth + padding), constraints);
@@ -1196,6 +1270,49 @@ function withGroupAggregates(displayRows, flatRows, groupBy, specs, columns, dis
1196
1270
  return renumberRows(out);
1197
1271
  }
1198
1272
 
1273
+ // src/util/rows.ts
1274
+ function resolveShownRows(rows, filter, sort, columns) {
1275
+ return sortRows(filterRows(rows, filter, columns), sort, columns);
1276
+ }
1277
+ function unknownDisplayRow(entry) {
1278
+ const { kind } = entry;
1279
+ throw new TypeError(
1280
+ `GridKit: \`${String(kind)}\` is not a display row kind.`
1281
+ );
1282
+ }
1283
+ function resolveRows(rowsById, ids) {
1284
+ return ids.map((id) => rowsById.get(id)).filter((row) => row !== void 0);
1285
+ }
1286
+ function resolveColumns(columns, ids) {
1287
+ return ids.map((id) => {
1288
+ const columnIndex = columns.findIndex((entry) => entry.id === id);
1289
+ const column = columns[columnIndex];
1290
+ return column === void 0 ? void 0 : { columnId: id, column, columnIndex };
1291
+ }).filter((column) => column !== void 0);
1292
+ }
1293
+ function resolveCell(rowsById, columns, cell) {
1294
+ if (cell === null) {
1295
+ return null;
1296
+ }
1297
+ const entry = rowsById.get(cell.rowId);
1298
+ const columnIndex = columns.findIndex(
1299
+ (candidate) => candidate.id === cell.columnId
1300
+ );
1301
+ const column = columns[columnIndex];
1302
+ if (entry === void 0 || column === void 0) {
1303
+ return null;
1304
+ }
1305
+ return {
1306
+ rowId: cell.rowId,
1307
+ columnId: cell.columnId,
1308
+ row: entry.row,
1309
+ column,
1310
+ rowIndex: entry.rowIndex,
1311
+ columnIndex,
1312
+ value: accessDotted(entry.row, column.column.field)
1313
+ };
1314
+ }
1315
+
1199
1316
  // src/util/visibility.ts
1200
1317
  function isColumnVisible(column, visibility) {
1201
1318
  return visibility[getColumnId(column)] ?? column.hidden !== true;
@@ -2169,6 +2286,9 @@ function createDefaultMessages(locale) {
2169
2286
  pageButtonLabel: (page) => `Page ${n(page)}`,
2170
2287
  pageStatus: (page, pageCount) => `Page ${n(page)} of ${n(pageCount)}`,
2171
2288
  loadingMore: "Loading more\u2026",
2289
+ loading: "Loading\u2026",
2290
+ noRows: "No rows to show",
2291
+ noMatchingRows: "No rows match the current filter",
2172
2292
  booleanTrue: "true",
2173
2293
  booleanFalse: "false",
2174
2294
  blankGroupValue: "(blank)",
@@ -2195,6 +2315,8 @@ function createDefaultMessages(locale) {
2195
2315
  columnShown: (columnName2) => `${columnName2}, column shown`,
2196
2316
  columnsHidden: (count) => columnCount(n, count, "hidden"),
2197
2317
  columnsShown: (count) => columnCount(n, count, "shown"),
2318
+ columnPinned: (columnName2, edge) => `${columnName2}, pinned to ${edge}`,
2319
+ columnUnpinned: (columnName2) => `${columnName2}, unpinned`,
2198
2320
  columnsAutoFitted: (count) => columnCount(n, count, "autofitted"),
2199
2321
  headerMenuLabel: (columnName2) => `${columnName2} column menu`,
2200
2322
  cellMenuLabel: "Row menu",
@@ -2209,6 +2331,9 @@ function createDefaultMessages(locale) {
2209
2331
  expandAllGroups: "Expand all groups",
2210
2332
  collapseAllGroups: "Collapse all groups",
2211
2333
  hideColumn: "Hide column",
2334
+ pinToStart: "Pin to start",
2335
+ pinToEnd: "Pin to end",
2336
+ unpinColumn: "Unpin",
2212
2337
  autoFitColumn: "Autofit column",
2213
2338
  autoFitAllColumns: "Autofit all columns",
2214
2339
  selectAllRows: "Select all rows",
@@ -2737,6 +2862,19 @@ function copyCommand({
2737
2862
  }
2738
2863
  };
2739
2864
  }
2865
+ function pinCommand(id, pin, label) {
2866
+ return columnCommand({
2867
+ id,
2868
+ label: ({ messages }) => label(messages),
2869
+ find: (context) => {
2870
+ const column = columnOn(context, ["header"]);
2871
+ return column !== null && resolveColumnPin(column.column, context.state.columnPinning) !== pin ? column : null;
2872
+ },
2873
+ execute: (column, { actions }) => {
2874
+ actions.pinColumn(column.id, pin);
2875
+ }
2876
+ });
2877
+ }
2740
2878
  function sortCommand(direction) {
2741
2879
  return columnCommand({
2742
2880
  id: direction === "asc" ? "sort.ascending" : "sort.descending",
@@ -2829,6 +2967,9 @@ function builtInCommands() {
2829
2967
  actions.hideColumns([column.id]);
2830
2968
  }
2831
2969
  }),
2970
+ pinCommand("column.pinStart", "start", (messages) => messages.pinToStart),
2971
+ pinCommand("column.pinEnd", "end", (messages) => messages.pinToEnd),
2972
+ pinCommand("column.unpin", "none", (messages) => messages.unpinColumn),
2832
2973
  columnCommand({
2833
2974
  id: "column.autoFit",
2834
2975
  label: ({ messages }) => messages.autoFitColumn,
@@ -3131,7 +3272,11 @@ var defaultContextMenu = {
3131
3272
  "column.autoFitAll",
3132
3273
  "separator",
3133
3274
  "column.hide",
3134
- "column.choose"
3275
+ "column.choose",
3276
+ "separator",
3277
+ "column.pinStart",
3278
+ "column.pinEnd",
3279
+ "column.unpin"
3135
3280
  ],
3136
3281
  cell: [
3137
3282
  "copy.cell",
@@ -3196,6 +3341,19 @@ function contextMenuEntries(contextMenu, context) {
3196
3341
  }
3197
3342
  }
3198
3343
 
3344
+ // src/util/direction.ts
3345
+ function inlineStep(key, direction = "ltr") {
3346
+ const forward = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
3347
+ const backward = direction === "rtl" ? "ArrowRight" : "ArrowLeft";
3348
+ if (key === forward) {
3349
+ return 1;
3350
+ }
3351
+ if (key === backward) {
3352
+ return -1;
3353
+ }
3354
+ return null;
3355
+ }
3356
+
3199
3357
  // src/util/navigation.ts
3200
3358
  function headerFocus(columnIndex) {
3201
3359
  return { area: "header", columnIndex };
@@ -3243,7 +3401,7 @@ function skipSkippableRows(target, direction, rowCount, isSkippableRow, fallback
3243
3401
  }
3244
3402
  return bodyFocus(rowIndex, target.columnIndex);
3245
3403
  }
3246
- function nextFocusForKey(key, modifiers, focus, rowCount, columnCount2, pageSize, isSkippableRow = noRowsSkippable) {
3404
+ function nextFocusForKey(key, modifiers, focus, rowCount, columnCount2, pageSize, isSkippableRow = noRowsSkippable, direction = "ltr") {
3247
3405
  if (modifiers.altKey) {
3248
3406
  return null;
3249
3407
  }
@@ -3257,13 +3415,11 @@ function nextFocusForKey(key, modifiers, focus, rowCount, columnCount2, pageSize
3257
3415
  focus
3258
3416
  );
3259
3417
  }
3418
+ const step = inlineStep(key, direction);
3419
+ if (step !== null) {
3420
+ return modifiers.ctrlKey ? null : { ...focus, columnIndex: columnIndex + step };
3421
+ }
3260
3422
  switch (key) {
3261
- case "ArrowLeft":
3262
- if (modifiers.ctrlKey) return null;
3263
- return { ...focus, columnIndex: columnIndex - 1 };
3264
- case "ArrowRight":
3265
- if (modifiers.ctrlKey) return null;
3266
- return { ...focus, columnIndex: columnIndex + 1 };
3267
3423
  case "ArrowUp":
3268
3424
  return moveRows(-1);
3269
3425
  case "ArrowDown":
@@ -3318,23 +3474,14 @@ export {
3318
3474
  applyColumnOrder,
3319
3475
  resolveDataColumns,
3320
3476
  moveColumnBefore,
3477
+ moveColumnInPinGroup,
3321
3478
  movesColumn,
3322
3479
  resolveDropBefore,
3323
3480
  resolveKeyboardDropTarget,
3324
- isDateType,
3325
- toDate,
3326
- isScalarList,
3327
- unknownFilterEntry,
3328
- matchesQuery,
3329
- filterQueryFor,
3330
- setColumnFilter,
3331
- clearAllFilters,
3332
- filterRows,
3333
- resolveShownRows,
3334
- unknownDisplayRow,
3335
- resolveRows,
3336
- resolveColumns,
3337
- resolveCell,
3481
+ resolveColumnPin,
3482
+ applyColumnPinning,
3483
+ setColumnPin,
3484
+ pinnedWidths,
3338
3485
  reportError,
3339
3486
  toggleSelection,
3340
3487
  selectOnly,
@@ -3349,6 +3496,15 @@ export {
3349
3496
  clearCellSelection,
3350
3497
  intentOf,
3351
3498
  applySelectionIntent,
3499
+ isDateType,
3500
+ toDate,
3501
+ isScalarList,
3502
+ unknownFilterEntry,
3503
+ matchesQuery,
3504
+ filterQueryFor,
3505
+ setColumnFilter,
3506
+ clearAllFilters,
3507
+ filterRows,
3352
3508
  DEFAULT_COLUMN_SIZES,
3353
3509
  KEYBOARD_STEP,
3354
3510
  resolveColumnConstraints,
@@ -3362,6 +3518,11 @@ export {
3362
3518
  revertColumnSize,
3363
3519
  computeAggregates,
3364
3520
  withGroupAggregates,
3521
+ resolveShownRows,
3522
+ unknownDisplayRow,
3523
+ resolveRows,
3524
+ resolveColumns,
3525
+ resolveCell,
3365
3526
  isColumnVisible,
3366
3527
  applyColumnVisibility,
3367
3528
  setColumnVisibility,
@@ -3413,9 +3574,10 @@ export {
3413
3574
  defaultContextMenu,
3414
3575
  hasContextMenu,
3415
3576
  contextMenuEntries,
3577
+ inlineStep,
3416
3578
  headerFocus,
3417
3579
  bodyFocus,
3418
3580
  clampFocus,
3419
3581
  nextFocusForKey
3420
3582
  };
3421
- //# sourceMappingURL=chunk-QGKPKQIO.js.map
3583
+ //# sourceMappingURL=chunk-RYMILPCT.js.map