@deephaven/grid 0.13.2-beta.0 → 0.13.2-beta.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.
@@ -4,8 +4,10 @@ import { BoxCoordinates, Coordinate, CoordinateMap, VisibleIndex, IndexModelMap,
4
4
  import type { GridMetrics } from './GridMetrics';
5
5
  import { GridTheme } from './GridTheme';
6
6
  import { GridWheelEvent } from './GridMouseHandler';
7
- export declare type AxisRange = [start: VisibleIndex, end: VisibleIndex];
8
- export declare type GridAxisRange = [start: GridRangeIndex, end: GridRangeIndex];
7
+ declare type Range<T> = [start: T, end: T];
8
+ export declare type AxisRange = Range<VisibleIndex>;
9
+ export declare type BoundedAxisRange = Range<number>;
10
+ export declare type GridAxisRange = Range<GridRangeIndex>;
9
11
  export declare type GridPoint = {
10
12
  x: Coordinate;
11
13
  y: Coordinate;
@@ -219,6 +221,24 @@ export declare class GridUtils {
219
221
  * @returns The model index of the item
220
222
  */
221
223
  static getModelIndex(visibleIndex: VisibleIndex, movedItems?: MoveOperation[]): ModelIndex;
224
+ /**
225
+ * Applies the items moves to the AxisRange
226
+ * @param start The start index of the range
227
+ * @param end The end index of the range
228
+ * @param movedItems The move operations to apply
229
+ * @param reverse If the moved items should be applied in reverse (this reverses the effects of the moves)
230
+ * @returns A list of AxisRanges in the translated space. Possibly multiple non-continuous ranges
231
+ */
232
+ private static applyItemMoves;
233
+ /**
234
+ * Applies the items moves to the givengrid range
235
+ * @param range The grid range to translate
236
+ * @param movedColumns The moved columns
237
+ * @param movedRows The moved rows
238
+ * @param reverse If the moved items should be reversed (i.e. visible to model range)
239
+ * @returns A list of grid ranges in the translated space. Possibly multiple non-continuous ranges
240
+ */
241
+ static translateRange(range: GridRange, movedColumns: MoveOperation[], movedRows: MoveOperation[], reverse: boolean): GridRange[];
222
242
  /**
223
243
  * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.
224
244
  * Since moved items can split apart a range, multiple pairs of indexes are returned
@@ -249,6 +269,36 @@ export declare class GridUtils {
249
269
  * @returns The model ranges after translation.
250
270
  */
251
271
  static getModelRanges(uiRanges: GridRange[], movedColumns?: MoveOperation[], movedRows?: MoveOperation[]): GridRange[];
272
+ /**
273
+ * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.
274
+ * Since moved items can split apart a range, multiple pairs of indexes are returned
275
+ *
276
+ * @param start Start item in one dimension
277
+ * @param end End item in one dimension
278
+ * @param movedItems Moved item pairs in this dimension
279
+ * @returns Array of start/end pairs of the indexes after transformations applied.
280
+ */
281
+ static getVisibleRangeIndexes(start: GridRangeIndex, end: GridRangeIndex, movedItems: MoveOperation[]): GridAxisRange[];
282
+ /**
283
+ * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.
284
+ * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
285
+ *
286
+ * @param uiRange The currently selected UI ranges
287
+ * @param movedColumns The moved column pairs
288
+ * @param movedRows The moved row pairs
289
+ * @returns The model ranges after translation.
290
+ */
291
+ static getVisibleRange(modelRange: GridRange, movedColumns?: MoveOperation[], movedRows?: MoveOperation[]): GridRange[];
292
+ /**
293
+ * Translate the provided model ranges into visible ranges, using the `movedColumns` and `movedRows` to apply the necessary transforms.
294
+ * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
295
+ *
296
+ * @param modelRanges The model ranges
297
+ * @param movedColumns The moved column pairs
298
+ * @param movedRows The moved row pairs
299
+ * @returns The model ranges after translation.
300
+ */
301
+ static getVisibleRanges(modelRanges: GridRange[], movedColumns?: MoveOperation[], movedRows?: MoveOperation[]): GridRange[];
252
302
  /**
253
303
  * Retrieve the visible index given the currently moved items
254
304
  * @param modelIndex The model index to get the visible index for
@@ -1 +1 @@
1
- {"version":3,"file":"GridUtils.d.ts","sourceRoot":"","sources":["../src/GridUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAA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Q9C;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CACtB,KAAK,EAAE,UAAU,GAAG,aAAa,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,UAAU,GACzE,OAAO;IAKV;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CACtB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,YAAY,GAC7B,OAAO;IAIV;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAC1B,OAAO,EAAE,UAAU,EAAE,EACrB,gBAAgB,EAAE,YAAY,GAC7B,OAAO;IAOV;;;;;;;OAOG;IACH,MAAM,CAAC,mBAAmB,CACxB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,cAAc,GACrB,cAAc;IAyCjB;;;;;;;;;OASG;IACH,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,cAAc,EAC1B,SAAS,SAAO,EAChB,UAAU,SAAM,EAChB,SAAS,SAAK,EACd,UAAU,SAAK,GACd;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CA6CtC;AAED,eAAe,SAAS,CAAC"}
package/dist/GridUtils.js CHANGED
@@ -655,97 +655,89 @@ export class GridUtils {
655
655
 
656
656
  static getModelIndex(visibleIndex) {
657
657
  var movedItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
658
- var modelIndex = visibleIndex;
659
-
660
- for (var i = movedItems.length - 1; i >= 0; i -= 1) {
661
- var movedItem = movedItems[i];
662
-
663
- if (modelIndex === movedItem.to) {
664
- ({
665
- from: modelIndex
666
- } = movedItem);
667
- } else if (movedItem.from <= modelIndex && modelIndex < movedItem.to) {
668
- modelIndex += 1;
669
- } else if (movedItem.to < modelIndex && modelIndex <= movedItem.from) {
670
- modelIndex -= 1;
671
- }
672
- }
673
-
658
+ var modelIndex = GridUtils.applyItemMoves(visibleIndex, visibleIndex, movedItems, true)[0][0];
674
659
  return modelIndex;
675
660
  }
676
661
  /**
677
- * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.
678
- * Since moved items can split apart a range, multiple pairs of indexes are returned
679
- *
680
- * @param start Start item in one dimension
681
- * @param end End item in one dimension
682
- * @param movedItems Moved item pairs in this dimension
683
- * @returns Array of start/end pairs of the indexes after transformations applied.
662
+ * Applies the items moves to the AxisRange
663
+ * @param start The start index of the range
664
+ * @param end The end index of the range
665
+ * @param movedItems The move operations to apply
666
+ * @param reverse If the moved items should be applied in reverse (this reverses the effects of the moves)
667
+ * @returns A list of AxisRanges in the translated space. Possibly multiple non-continuous ranges
684
668
  */
685
669
 
686
670
 
687
- static getModelRangeIndexes(start, end, movedItems) {
688
- if (start == null || end == null) {
689
- return [[start, end]];
690
- }
691
-
671
+ static applyItemMoves(start, end, movedItems) {
672
+ var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
692
673
  var result = [[start, end]];
693
674
 
694
- if (start == null) {
695
- return result;
696
- } // movedItems is built by adding a new item whenever an item in the UI is dragged/moved, transforming a model
697
- // index to the new UI index. We want to find the model index from the UI index here, so we unwind the
698
- // transformations applied - the start/end axis range passed in is the current UI range, so we need to apply
699
- // the transformations starting at the end of the chain backward to find the appropriate model indexes
700
-
701
-
702
- for (var i = movedItems.length - 1; i >= 0; i -= 1) {
675
+ for (var i = reverse ? movedItems.length - 1 : 0; reverse ? i >= 0 : i < movedItems.length; reverse ? i -= 1 : i += 1) {
703
676
  var {
704
- from,
705
- to
677
+ from: fromItem,
678
+ to: toItem
706
679
  } = movedItems[i];
680
+ var from = reverse ? toItem : fromItem;
681
+ var to = reverse ? fromItem : toItem;
707
682
  var nextResult = [];
708
683
 
709
684
  for (var j = 0; j < result.length; j += 1) {
710
- var [currentStart, currentEnd] = result[j];
685
+ var _result$j$, _result$j$2;
686
+
687
+ var currentStart = (_result$j$ = result[j][0]) !== null && _result$j$ !== void 0 ? _result$j$ : Number.NEGATIVE_INFINITY;
688
+ var currentEnd = (_result$j$2 = result[j][1]) !== null && _result$j$2 !== void 0 ? _result$j$2 : Number.POSITIVE_INFINITY;
711
689
  var startLength = nextResult.length;
712
690
 
713
- if (from <= currentStart) {
691
+ if (from < currentStart) {
714
692
  // From before
715
- if (to > currentEnd) {
693
+ if (to >= currentEnd) {
716
694
  // To after
717
- nextResult.push([currentStart + 1, currentEnd + 1]);
695
+ nextResult.push([currentStart - 1, currentEnd - 1]);
718
696
  } else if (to >= currentStart) {
719
697
  // To within
720
- nextResult.push([from, from]);
721
- nextResult.push([currentStart + 1, currentEnd]);
698
+ nextResult.push([currentStart - 1, to - 1]);
699
+ nextResult.push([to + 1, currentEnd]);
722
700
  }
723
701
  } else if (from > currentEnd) {
724
702
  // From after
725
- if (to < currentStart) {
703
+ if (to <= currentStart) {
726
704
  // To before
727
- nextResult.push([currentStart - 1, currentEnd - 1]);
705
+ nextResult.push([currentStart + 1, currentEnd + 1]);
728
706
  } else if (to <= currentEnd) {
729
707
  // To within
730
- nextResult.push([from, from]);
731
- nextResult.push([currentStart, currentEnd - 1]);
708
+ nextResult.push([currentStart, to - 1]);
709
+ nextResult.push([to + 1, currentEnd + 1]);
732
710
  }
733
711
  } else if (to < currentStart) {
734
712
  // From within to before
735
- nextResult.push([currentStart - 1, from - 1]);
736
- nextResult.push([from + 1, currentEnd]);
713
+ if (from > currentStart) {
714
+ nextResult.push([currentStart + 1, from]);
715
+ }
716
+
717
+ nextResult.push([to, to]);
718
+
719
+ if (from < currentEnd) {
720
+ nextResult.push([from + 1, currentEnd]);
721
+ }
737
722
  } else if (to > currentEnd) {
738
723
  // From within to after
739
- nextResult.push([currentStart, from - 1]);
740
- nextResult.push([from + 1, currentEnd + 1]);
724
+ if (from > currentStart) {
725
+ nextResult.push([currentStart, from - 1]);
726
+ }
727
+
728
+ nextResult.push([to, to]);
729
+
730
+ if (from < currentEnd) {
731
+ nextResult.push([from, currentEnd - 1]);
732
+ }
741
733
  } else if (from > to) {
742
734
  // From within after to within before
743
735
  if (to > currentStart) {
744
736
  nextResult.push([currentStart, to - 1]);
745
737
  }
746
738
 
747
- nextResult.push([from, from]);
748
- nextResult.push([to, from - 1]);
739
+ nextResult.push([to + 1, from]);
740
+ nextResult.push([to, to]);
749
741
 
750
742
  if (from < currentEnd) {
751
743
  nextResult.push([from + 1, currentEnd]);
@@ -756,10 +748,10 @@ export class GridUtils {
756
748
  nextResult.push([currentStart, from - 1]);
757
749
  }
758
750
 
759
- nextResult.push([from + 1, to]);
760
- nextResult.push([from, from]);
751
+ nextResult.push([to, to]);
752
+ nextResult.push([from, to - 1]);
761
753
 
762
- if (from < currentEnd) {
754
+ if (to < currentEnd) {
763
755
  nextResult.push([to + 1, currentEnd]);
764
756
  }
765
757
  }
@@ -768,29 +760,30 @@ export class GridUtils {
768
760
  // No modifications were made, add the original range indexes
769
761
  nextResult.push([currentStart, currentEnd]);
770
762
  }
771
- }
763
+ } // Return infinity values back to null
764
+
772
765
 
773
- result = nextResult;
766
+ result = nextResult.map(_ref => {
767
+ var [s, e] = _ref;
768
+ return [Number.isFinite(s) ? s : null, Number.isFinite(e) ? e : null];
769
+ });
774
770
  }
775
771
 
776
772
  return result;
777
773
  }
778
774
  /**
779
- * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.
780
- * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
781
- *
782
- * @param uiRange The currently selected UI ranges
783
- * @param movedColumns The moved column pairs
784
- * @param movedRows The moved row pairs
785
- * @returns The model ranges after translation.
775
+ * Applies the items moves to the givengrid range
776
+ * @param range The grid range to translate
777
+ * @param movedColumns The moved columns
778
+ * @param movedRows The moved rows
779
+ * @param reverse If the moved items should be reversed (i.e. visible to model range)
780
+ * @returns A list of grid ranges in the translated space. Possibly multiple non-continuous ranges
786
781
  */
787
782
 
788
783
 
789
- static getModelRange(uiRange) {
790
- var movedColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
791
- var movedRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
792
- var columnRanges = GridUtils.getModelRangeIndexes(uiRange.startColumn, uiRange.endColumn, movedColumns);
793
- var rowRanges = GridUtils.getModelRangeIndexes(uiRange.startRow, uiRange.endRow, movedRows);
784
+ static translateRange(range, movedColumns, movedRows, reverse) {
785
+ var columnRanges = GridUtils.applyItemMoves(range.startColumn, range.endColumn, movedColumns, reverse);
786
+ var rowRanges = GridUtils.applyItemMoves(range.startRow, range.endRow, movedRows, reverse);
794
787
  var ranges = [];
795
788
 
796
789
  for (var i = 0; i < columnRanges.length; i += 1) {
@@ -804,6 +797,36 @@ export class GridUtils {
804
797
 
805
798
  return ranges;
806
799
  }
800
+ /**
801
+ * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.
802
+ * Since moved items can split apart a range, multiple pairs of indexes are returned
803
+ *
804
+ * @param start Start item in one dimension
805
+ * @param end End item in one dimension
806
+ * @param movedItems Moved item pairs in this dimension
807
+ * @returns Array of start/end pairs of the indexes after transformations applied.
808
+ */
809
+
810
+
811
+ static getModelRangeIndexes(start, end, movedItems) {
812
+ return GridUtils.applyItemMoves(start, end, movedItems, true);
813
+ }
814
+ /**
815
+ * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.
816
+ * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
817
+ *
818
+ * @param uiRange The currently selected UI ranges
819
+ * @param movedColumns The moved column pairs
820
+ * @param movedRows The moved row pairs
821
+ * @returns The model ranges after translation.
822
+ */
823
+
824
+
825
+ static getModelRange(uiRange) {
826
+ var movedColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
827
+ var movedRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
828
+ return GridUtils.translateRange(uiRange, movedColumns, movedRows, true);
829
+ }
807
830
  /**
808
831
  * Translate the provided UI range into model ranges, using the `movedColumns` and `movedRows` to apply the necessary transforms.
809
832
  * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
@@ -826,6 +849,58 @@ export class GridUtils {
826
849
 
827
850
  return modelRanges;
828
851
  }
852
+ /**
853
+ * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.
854
+ * Since moved items can split apart a range, multiple pairs of indexes are returned
855
+ *
856
+ * @param start Start item in one dimension
857
+ * @param end End item in one dimension
858
+ * @param movedItems Moved item pairs in this dimension
859
+ * @returns Array of start/end pairs of the indexes after transformations applied.
860
+ */
861
+
862
+
863
+ static getVisibleRangeIndexes(start, end, movedItems) {
864
+ return GridUtils.applyItemMoves(start, end, movedItems, false);
865
+ }
866
+ /**
867
+ * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.
868
+ * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
869
+ *
870
+ * @param uiRange The currently selected UI ranges
871
+ * @param movedColumns The moved column pairs
872
+ * @param movedRows The moved row pairs
873
+ * @returns The model ranges after translation.
874
+ */
875
+
876
+
877
+ static getVisibleRange(modelRange) {
878
+ var movedColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
879
+ var movedRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
880
+ return this.translateRange(modelRange, movedColumns, movedRows, false);
881
+ }
882
+ /**
883
+ * Translate the provided model ranges into visible ranges, using the `movedColumns` and `movedRows` to apply the necessary transforms.
884
+ * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
885
+ *
886
+ * @param modelRanges The model ranges
887
+ * @param movedColumns The moved column pairs
888
+ * @param movedRows The moved row pairs
889
+ * @returns The model ranges after translation.
890
+ */
891
+
892
+
893
+ static getVisibleRanges(modelRanges) {
894
+ var movedColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
895
+ var movedRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
896
+ var visibleRanges = [];
897
+
898
+ for (var i = 0; i < modelRanges.length; i += 1) {
899
+ visibleRanges.push(...GridUtils.getVisibleRange(modelRanges[i], movedColumns, movedRows));
900
+ }
901
+
902
+ return visibleRanges;
903
+ }
829
904
  /**
830
905
  * Retrieve the visible index given the currently moved items
831
906
  * @param modelIndex The model index to get the visible index for
@@ -836,22 +911,7 @@ export class GridUtils {
836
911
 
837
912
  static getVisibleIndex(modelIndex) {
838
913
  var movedItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
839
- var visibleIndex = modelIndex;
840
-
841
- for (var i = 0; i < movedItems.length; i += 1) {
842
- var movedItem = movedItems[i];
843
-
844
- if (visibleIndex === movedItem.from) {
845
- ({
846
- to: visibleIndex
847
- } = movedItem);
848
- } else if (movedItem.from < visibleIndex && visibleIndex <= movedItem.to) {
849
- visibleIndex -= 1;
850
- } else if (movedItem.to <= visibleIndex && visibleIndex < movedItem.from) {
851
- visibleIndex += 1;
852
- }
853
- }
854
-
914
+ var visibleIndex = GridUtils.applyItemMoves(modelIndex, modelIndex, movedItems)[0][0];
855
915
  return visibleIndex;
856
916
  }
857
917
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/GridUtils.ts"],"names":["GridRange","GridUtils","getGridPointFromXY","x","y","metrics","column","getColumnAtX","row","getRowAtY","getCellInfoFromXY","visibleColumnWidths","visibleRowHeights","visibleColumnXs","visibleRowYs","modelColumns","modelRows","modelRow","get","modelColumn","left","top","columnWidth","rowHeight","iterateFloatingStart","start","total","callback","i","result","undefined","iterateFloatingEnd","end","iterateFloating","iterateAllItems","visibleStart","visibleEnd","floatingStartCount","floatingEndCount","totalCount","visibleStartIndex","Math","max","visibleEndIndex","min","isInItem","itemIndex","itemCoordinates","itemSizes","coordinate","itemX","itemSize","getItemAtOffset","offset","itemCount","floatingStart","floatingEnd","items","floatingItem","item","length","columnCount","floatingLeftColumnCount","floatingRightColumnCount","visibleColumns","gridX","floatingTopRowCount","floatingBottomRowCount","rowCount","visibleRows","gridY","getNextShownItem","startIndex","modelIndexes","visibleItems","userSizes","visibleItemIndex","findIndex","value","modelIndex","getNextShownColumn","userColumnWidths","getNextShownRow","userRowHeights","getColumnSeparatorIndex","theme","rowHeaderWidth","columnHeaderHeight","floatingColumns","floatingLeftWidth","allowColumnResize","headerSeparatorHandleSize","halfSeparatorSize","isPreviousColumnHidden","columnX","isColumnHidden","midX","minX","maxX","isItemHidden","visibleSizes","columnIndex","isFloatingRow","isFloatingColumn","getHiddenItems","hiddenItems","push","getHiddenColumns","getRowSeparatorIndex","allowRowResize","isPreviousRowHidden","rowY","isRowHidden","midY","minY","maxY","rowIndex","getHiddenRows","moveItem","from","to","oldMovedItems","movedItems","getModelIndex","visibleIndex","movedItem","getModelRangeIndexes","nextResult","j","currentStart","currentEnd","startLength","getModelRange","uiRange","movedColumns","movedRows","columnRanges","startColumn","endColumn","rowRanges","startRow","endRow","ranges","c","r","getModelRanges","uiRanges","modelRanges","getVisibleIndex","isMacPlatform","platform","window","navigator","startsWith","getModifierKey","isModifierKeyDown","event","modifierKey","checkColumnHidden","checkAllColumnsHidden","columns","size","every","getScrollDragBounds","width","height","floatingRightWidth","floatingTopHeight","floatingBottomHeight","x1","y1","x2","y2","getScrollDelta","wheelEvent","pageWidth","pageHeight","lineWidth","lineHeight","deltaX","deltaY","shiftKey","deltaMode","WheelEvent","DOM_DELTA_PAGE","DOM_DELTA_LINE","round","PIXELS_PER_LINE"],"mappings":";;;;;;OACOA,S;AAwCP,OAAO,MAAMC,SAAN,CAAgB;AACrB;AACA;;AAGA;AACF;AACA;AACA;AACA;AACA;AACA;AAC2B,SAAlBC,kBAAkB,CACvBC,CADuB,EAEvBC,CAFuB,EAGvBC,OAHuB,EAIZ;AACX,QAAMC,MAAM,GAAGL,SAAS,CAACM,YAAV,CAAuBJ,CAAvB,EAA0BE,OAA1B,CAAf;AACA,QAAMG,GAAG,GAAGP,SAAS,CAACQ,SAAV,CAAoBL,CAApB,EAAuBC,OAAvB,CAAZ;AAEA,WAAO;AAAEF,MAAAA,CAAF;AAAKC,MAAAA,CAAL;AAAQI,MAAAA,GAAR;AAAaF,MAAAA;AA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O,IAAI,CAAAF,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEQ,SAAZ,MAA0BC,UAAU,CAACE,cAAzC,EAAyD;AAC9D;AACA;AACA;AACA,UAAIxL,SAAS,CAACoJ,aAAV,EAAJ,EAA+B;AAC7B;AACA;AACA8B,QAAAA,MAAM,GAAG1I,IAAI,CAACiJ,KAAL,CAAWP,MAAM,GAAGF,SAApB,CAAT;AACAG,QAAAA,MAAM,GAAG3I,IAAI,CAACiJ,KAAL,CAAWN,MAAM,GAAGF,UAApB,CAAT;AACD,OALD,MAKO;AACL;AACA;AACA;AACAC,QAAAA,MAAM,GAAG1I,IAAI,CAACiJ,KAAL,CAAWP,MAAM,GAAG,KAAKQ,eAAzB,CAAT;AACAP,QAAAA,MAAM,GAAG3I,IAAI,CAACiJ,KAAL,CAAWN,MAAM,GAAG,KAAKO,eAAzB,CAAT;AACD;AACF;;AAED,WAAO;AAAER,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KAAP;AACD;;AAxjCoB;;gBAAVnL,S,qBAGc,MAAM,C;;AAwjCjC,eAAeA,SAAf","sourcesContent":["import React from 'react';\nimport GridRange, { GridRangeIndex } from './GridRange';\nimport {\n BoxCoordinates,\n Coordinate,\n CoordinateMap,\n VisibleIndex,\n IndexModelMap,\n ModelIndex,\n ModelSizeMap,\n MoveOperation,\n SizeMap,\n} from './GridMetrics';\nimport type { GridMetrics } from './GridMetrics';\nimport { GridTheme } from './GridTheme';\nimport { GridWheelEvent } from './GridMouseHandler';\n\nexport type AxisRange = [start: VisibleIndex, end: VisibleIndex];\n\nexport type GridAxisRange = [start: GridRangeIndex, end: GridRangeIndex];\n\nexport type GridPoint = {\n x: Coordinate;\n y: Coordinate;\n column: GridRangeIndex;\n row: GridRangeIndex;\n};\n\nexport interface CellInfo {\n row: VisibleIndex | null;\n column: VisibleIndex | null;\n modelRow: ModelIndex | null;\n modelColumn: ModelIndex | null;\n left: Coordinate | null;\n top: Coordinate | null;\n columnWidth: number | null;\n rowHeight: number | null;\n}\n\nexport type IndexCallback<T> = (itemIndex: VisibleIndex) => T | undefined;\n\nexport class GridUtils {\n // use same constant as chrome source for windows\n // https://github.com/chromium/chromium/blob/973af9d461b6b5dc60208c8d3d66adc27e53da78/ui/events/blink/web_input_event_builders_win.cc#L285\n static PIXELS_PER_LINE = 100 / 3;\n\n /**\n * Get the GridPoint for the coordinates provided\n * @param x The grid x coordinate\n * @param y The grid y coordinate\n * @param metrics The grid metrics\n * @returns The GridPoint including the column/row information\n */\n static getGridPointFromXY(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics\n ): GridPoint {\n const column = GridUtils.getColumnAtX(x, metrics);\n const row = GridUtils.getRowAtY(y, metrics);\n\n return { x, y, row, column };\n }\n\n static getCellInfoFromXY(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics\n ): CellInfo {\n const { row, column } = GridUtils.getGridPointFromXY(x, y, metrics);\n\n const {\n visibleColumnWidths,\n visibleRowHeights,\n visibleColumnXs,\n visibleRowYs,\n modelColumns,\n modelRows,\n } = metrics;\n\n const modelRow = row !== null ? modelRows.get(row) : null;\n const modelColumn = column !== null ? modelColumns.get(column) : null;\n const left = column !== null ? visibleColumnXs.get(column) : null;\n const top = row !== null ? visibleRowYs.get(row) : null;\n const columnWidth =\n column !== null ? visibleColumnWidths.get(column) : null;\n const rowHeight = row !== null ? visibleRowHeights.get(row) : null;\n\n return {\n row,\n column,\n modelRow: modelRow ?? null,\n modelColumn: modelColumn ?? null,\n left: left ?? null,\n top: top ?? null,\n columnWidth: columnWidth ?? null,\n rowHeight: rowHeight ?? null,\n };\n }\n\n /**\n * Iterate through each floating item at the start and call a callback, returning the first result\n * @param start The count of floating items at the start\n * @param total The total number of items\n * @param callback Function to call for each item\n * @returns The result from the callback\n */\n static iterateFloatingStart<T>(\n start: number,\n total: number,\n callback: IndexCallback<T>\n ): T | undefined {\n for (let i = 0; i < start && i < total; i += 1) {\n const result = callback(i);\n if (result !== undefined) {\n return result;\n }\n }\n\n return undefined;\n }\n\n /**\n * Iterate through floating items at the end. Iterates in increasing order.\n * @param end The count of floating items at the end\n * @param total The total number of items\n * @param callback Function to call for each item\n * @returns The result from the callback\n */\n static iterateFloatingEnd<T>(\n end: number,\n total: number,\n callback: IndexCallback<T>\n ): T | undefined {\n for (let i = 0; i < end && total - (end - i) >= 0; i += 1) {\n const result = callback(total - (end - i));\n if (result !== undefined) {\n return result;\n }\n }\n\n return undefined;\n }\n\n /**\n * Iterate through all floating items in increasing order, starting with the top items.\n * @param start Count of start floating rows, e.g. floatingTopRowCount\n * @param end Count of end floating rows, e.g. floatingBottomRowCount\n * @param total Total number of items\n * @param callback Callback called for each value, stopping the iterating and returning the value if one is returned\n */\n static iterateFloating<T>(\n start: number,\n end: number,\n total: number,\n callback: IndexCallback<T>\n ): T | undefined {\n const result = GridUtils.iterateFloatingStart(start, total, callback);\n if (result !== undefined) {\n return result;\n }\n return GridUtils.iterateFloatingEnd(end, total, callback);\n }\n\n /**\n * Iterate through all items in one dimension on the grid - first floating, then visible.\n * Call the callback for each item, break if a result is returned and return that result.\n * @param visibleStart Index of the start of the visible viewport\n * @param visibleEnd Index of the end of the visible viewport\n * @param floatingStartCount Number of items floating at the start\n * @param floatingEndCount Number of items floating at the end\n * @param totalCount Total number of items\n * @param callback Callback to call for each item\n * @returns The first result from the callback called, or undefined\n */\n static iterateAllItems<T>(\n visibleStart: VisibleIndex,\n visibleEnd: VisibleIndex,\n floatingStartCount: number,\n floatingEndCount: number,\n totalCount: number,\n callback: IndexCallback<T>\n ): T | undefined {\n const visibleStartIndex = Math.max(visibleStart, floatingStartCount);\n const visibleEndIndex = Math.min(\n visibleEnd,\n totalCount - floatingEndCount - 1\n );\n let result = GridUtils.iterateFloating(\n floatingStartCount,\n floatingEndCount,\n totalCount,\n callback\n );\n if (result !== undefined) {\n return result;\n }\n\n for (let i = visibleStartIndex; i <= visibleEndIndex; i += 1) {\n result = callback(i);\n if (result !== undefined) {\n return result;\n }\n }\n\n return undefined;\n }\n\n /**\n * Check if the coordinate is within the item specified in this dimension\n * @param itemIndex Index of the item to check\n * @param itemCoordinatess Coordinate of all items in this dimension\n * @param itemSizes Size of all items in this dimension\n * @param coordinate The coordinate to check\n * @returns True if the coordinate is within the item specified, false otherwise\n */\n static isInItem(\n itemIndex: VisibleIndex,\n itemCoordinates: CoordinateMap,\n itemSizes: SizeMap,\n coordinate: Coordinate\n ): boolean {\n const itemX = itemCoordinates.get(itemIndex) ?? 0;\n const itemSize = itemSizes.get(itemIndex) ?? 0;\n return itemX <= coordinate && coordinate <= itemX + itemSize;\n }\n\n /**\n * Get the Index of the item at the provided offset\n * @param offset Coordinate of the offset to get the item of\n * @param itemCount The total count of items\n * @param floatingStart Count of floating items at the start\n * @param floatingEnd Count of floating items at the end\n * @param items Index of all items\n * @param itemCoordinates The coordinate of each item\n * @param itemSizes The size of each item\n * @returns The item index, or null if no item matches\n */\n static getItemAtOffset(\n offset: Coordinate,\n itemCount: number,\n floatingStart: number,\n floatingEnd: number,\n items: VisibleIndex[],\n itemCoordinates: CoordinateMap,\n itemSizes: SizeMap\n ): VisibleIndex | null {\n const floatingItem = GridUtils.iterateFloating(\n floatingStart,\n floatingEnd,\n itemCount,\n item => {\n if (GridUtils.isInItem(item, itemCoordinates, itemSizes, offset)) {\n return item;\n }\n return undefined;\n }\n );\n if (floatingItem !== undefined) {\n return floatingItem;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (GridUtils.isInItem(item, itemCoordinates, itemSizes, offset)) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Get the index of the column at the specified x coordinate\n * @param x Coordinate to get the item of\n * @param metrics Grid metrics\n * @returns Index of the column at that coordinate, or null if no column matches\n */\n static getColumnAtX(\n x: Coordinate,\n metrics: GridMetrics\n ): VisibleIndex | null {\n const {\n columnCount,\n floatingLeftColumnCount,\n floatingRightColumnCount,\n visibleColumns,\n visibleColumnXs,\n visibleColumnWidths,\n gridX,\n } = metrics;\n\n if (x < gridX) {\n return null;\n }\n\n return this.getItemAtOffset(\n x - gridX,\n columnCount,\n floatingLeftColumnCount,\n floatingRightColumnCount,\n visibleColumns,\n visibleColumnXs,\n visibleColumnWidths\n );\n }\n\n /**\n * Get the index of the row at the specified y coordinate\n * @param y Coordinate to get the item of\n * @param metrics Grid metrics\n * @returns Index of the row at that coordinate, or null if no row matches\n */\n static getRowAtY(y: Coordinate, metrics: GridMetrics): VisibleIndex | null {\n const {\n floatingTopRowCount,\n floatingBottomRowCount,\n rowCount,\n visibleRows,\n visibleRowYs,\n visibleRowHeights,\n gridY,\n } = metrics;\n\n if (y < gridY) {\n return null;\n }\n\n return this.getItemAtOffset(\n y - gridY,\n rowCount,\n floatingTopRowCount,\n floatingBottomRowCount,\n visibleRows,\n visibleRowYs,\n visibleRowHeights\n );\n }\n\n /**\n * Iterate backward through the visible items until a shown item is hit\n * @param startIndex The index to start from\n * @param modelIndexes The mapping of model indexes\n * @param visibleItems The visible items\n * @param userSizes The user set sizes\n * @returns Index of the next visible item, or null if no more are visible\n */\n static getNextShownItem(\n startIndex: VisibleIndex,\n modelIndexes: IndexModelMap,\n visibleItems: VisibleIndex[],\n userSizes: ModelSizeMap\n ): VisibleIndex | null {\n let visibleItemIndex =\n visibleItems.findIndex(value => value === startIndex) || 0;\n visibleItemIndex -= 1;\n while (visibleItemIndex != null && visibleItemIndex >= 0) {\n const item = visibleItems[visibleItemIndex];\n const modelIndex = modelIndexes.get(item);\n if (modelIndex != null && userSizes.get(modelIndex) !== 0) {\n return item;\n }\n\n visibleItemIndex -= 1;\n }\n\n return null;\n }\n\n /**\n * Iterate backward through the visible columns until a shown column is hit\n * @param columnIndex The column index to start iterating backward from\n * @param metrics The GridMetricCalculator metrics\n * @returns Index of the next visible item, or null if no more are visible\n */\n static getNextShownColumn(\n startIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex | null {\n const { modelColumns, visibleColumns, userColumnWidths } = metrics;\n return GridUtils.getNextShownItem(\n startIndex,\n modelColumns,\n visibleColumns,\n userColumnWidths\n );\n }\n\n /**\n * Iterate backward through the visible rows until a shown row is hit\n * @param rowIndex The row index to start iterating backward from\n * @param metrics The GridMetricCalculator metrics\n * @returns Index of the next visible item, or null if no more are visible\n */\n static getNextShownRow(\n startIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex | null {\n const { modelRows, visibleRows, userRowHeights } = metrics;\n return GridUtils.getNextShownItem(\n startIndex,\n modelRows,\n visibleRows,\n userRowHeights\n );\n }\n\n /**\n * Gets the column index if the x/y coordinates provided are close enough to the separator, otherwise null\n * @param x Mouse x coordinate\n * @param y Mouse y coordinate\n * @param metrics The grid metrics\n * @param theme The grid theme with potential user overrides\n * @returns Index of the column separator at the coordinates provided, or null if none match\n */\n static getColumnSeparatorIndex(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics,\n theme: GridTheme\n ): VisibleIndex | null {\n const {\n rowHeaderWidth,\n columnHeaderHeight,\n floatingColumns,\n floatingLeftWidth,\n visibleColumns,\n visibleColumnXs,\n visibleColumnWidths,\n } = metrics;\n const { allowColumnResize, headerSeparatorHandleSize } = theme;\n\n if (\n columnHeaderHeight < y ||\n !allowColumnResize ||\n headerSeparatorHandleSize <= 0\n ) {\n return null;\n }\n\n const gridX = x - rowHeaderWidth;\n const halfSeparatorSize = headerSeparatorHandleSize * 0.5;\n\n // Iterate through the floating columns first since they're on top\n let isPreviousColumnHidden = false;\n for (let i = floatingColumns.length - 1; i >= 0; i -= 1) {\n const column = floatingColumns[i];\n const columnX = visibleColumnXs.get(column) ?? 0;\n const columnWidth = visibleColumnWidths.get(column) ?? 0;\n const isColumnHidden = columnWidth === 0;\n if (!isPreviousColumnHidden || !isColumnHidden) {\n let midX = columnX + columnWidth;\n if (isColumnHidden) {\n midX += halfSeparatorSize;\n } else if (isPreviousColumnHidden) {\n midX -= halfSeparatorSize;\n }\n\n const minX = midX - halfSeparatorSize;\n const maxX = midX + halfSeparatorSize;\n if (minX <= gridX && gridX <= maxX) {\n return column;\n }\n\n isPreviousColumnHidden = isColumnHidden;\n }\n }\n\n // Iterate backward so that you can reveal hidden columns properly\n isPreviousColumnHidden = false;\n for (let i = visibleColumns.length - 1; i >= 0; i -= 1) {\n const column = visibleColumns[i];\n const columnX = visibleColumnXs.get(column) ?? 0;\n const columnWidth = visibleColumnWidths.get(column) ?? 0;\n const isColumnHidden = columnWidth === 0;\n\n // If this column is under the floating columns \"layer\". Terminate early.\n if (columnX < floatingLeftWidth - columnWidth) {\n return null;\n }\n\n if (!isPreviousColumnHidden || !isColumnHidden) {\n let midX = columnX + columnWidth;\n if (isColumnHidden) {\n midX += halfSeparatorSize;\n } else if (isPreviousColumnHidden) {\n midX -= halfSeparatorSize;\n }\n\n const minX = midX - halfSeparatorSize;\n const maxX = midX + halfSeparatorSize;\n if (minX <= gridX && gridX <= maxX) {\n return column;\n }\n\n isPreviousColumnHidden = isColumnHidden;\n }\n }\n\n return null;\n }\n\n /**\n * Check if the item specified is hidden\n * @param itemIndex Index of the item to check\n * @param visibleSizes Sizes of all visible items\n * @returns True if the item is hidden, false otherwise\n */\n static isItemHidden(itemIndex: VisibleIndex, visibleSizes: SizeMap): boolean {\n return visibleSizes.get(itemIndex) === 0;\n }\n\n /**\n * Check if the column specified is hidden\n * @param columnIndex Index of the column to check\n * @param metrics Grid metrics\n * @returns True if the column is hidden, false otherwise\n */\n static isColumnHidden(\n columnIndex: VisibleIndex,\n metrics: GridMetrics\n ): boolean {\n const { visibleColumnWidths } = metrics;\n return GridUtils.isItemHidden(columnIndex, visibleColumnWidths);\n }\n\n /**\n * Check if the provided row is a floating row\n * @param row The row index to check\n * @param metrics The grid metrics to check against\n * @returns True if it's a floating row, false otherwise\n */\n static isFloatingRow(row: VisibleIndex, metrics: GridMetrics): boolean {\n if (row == null) {\n return false;\n }\n\n const { floatingTopRowCount, floatingBottomRowCount, rowCount } = metrics;\n return (\n row < floatingTopRowCount || row >= rowCount - floatingBottomRowCount\n );\n }\n\n /**\n * Check if the provided column is a floating column\n * @param column The column index to check\n * @param metrics The grid metrics to check against\n * @returns True if it's a floating column, false otherwise\n */\n static isFloatingColumn(column: VisibleIndex, metrics: GridMetrics): boolean {\n if (column == null) {\n return false;\n }\n\n const {\n floatingLeftColumnCount,\n floatingRightColumnCount,\n columnCount,\n } = metrics;\n return (\n column < floatingLeftColumnCount ||\n column >= columnCount - floatingRightColumnCount\n );\n }\n\n /**\n * Get all the items that are hidden under the same Index\n * E.g. If columns are 1, 2, 3, 4, 5, and column 2, 3, 4 are hidden, and we check for item 4, the return will be [2, 3, 4]\n * @param itemIndex Index of the item to start at\n * @param visibleSizes Visible size map\n * @param visibleItems Visible items\n * @returns Array of items that are hidden\n */\n static getHiddenItems(\n itemIndex: VisibleIndex,\n visibleSizes: SizeMap,\n visibleItems: VisibleIndex[]\n ): VisibleIndex[] {\n if (!GridUtils.isItemHidden(itemIndex, visibleSizes)) {\n return [];\n }\n\n const hiddenItems = [itemIndex];\n const visibleItemIndex = visibleItems.findIndex(\n value => value === itemIndex\n );\n for (let i = visibleItemIndex - 1; i >= 0; i -= 1) {\n const item = visibleItems[i];\n if (!GridUtils.isItemHidden(item, visibleSizes)) {\n break;\n }\n\n hiddenItems.push(item);\n }\n\n return hiddenItems;\n }\n\n /**\n * Get all the columns that are hidden under the same Index\n * @param columnIndex Index of the item to start at\n * @param metrics Grid metrics\n * @returns Array of items that are hidden\n */\n static getHiddenColumns(\n columnIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex[] {\n const { visibleColumns, visibleColumnWidths } = metrics;\n return GridUtils.getHiddenItems(\n columnIndex,\n visibleColumnWidths,\n visibleColumns\n );\n }\n\n /**\n * Returns the row index if the x/y coordinates provided are close enough to the separator, otherwise null\n * @param x X coordinate to check\n * @param y Y coordinate to check\n * @param metrics The grid metrics\n * @param theme The grid theme\n * @returns Index of the row separator at the coordinates provided, or null if none match\n */\n static getRowSeparatorIndex(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics,\n theme: GridTheme\n ): VisibleIndex | null {\n const {\n rowHeaderWidth,\n columnHeaderHeight,\n visibleRows,\n visibleRowYs,\n visibleRowHeights,\n } = metrics;\n const { allowRowResize, headerSeparatorHandleSize } = theme;\n\n if (\n rowHeaderWidth < x ||\n !allowRowResize ||\n headerSeparatorHandleSize <= 0\n ) {\n return null;\n }\n\n const gridY = y - columnHeaderHeight;\n const halfSeparatorSize = headerSeparatorHandleSize * 0.5;\n\n // Iterate backward so you can reveal hidden rows properly\n let isPreviousRowHidden = false;\n for (let i = visibleRows.length - 1; i >= 0; i -= 1) {\n const row = visibleRows[i];\n const rowY = visibleRowYs.get(row) ?? 0;\n const rowHeight = visibleRowHeights.get(row) ?? 0;\n const isRowHidden = rowHeight === 0;\n if (!isPreviousRowHidden || !isRowHidden) {\n let midY = rowY + rowHeight;\n if (isRowHidden) {\n midY += halfSeparatorSize;\n } else if (isPreviousRowHidden) {\n midY -= halfSeparatorSize;\n }\n\n const minY = midY - halfSeparatorSize;\n const maxY = midY + halfSeparatorSize;\n\n if (minY <= gridY && gridY <= maxY) {\n return row;\n }\n\n isPreviousRowHidden = isRowHidden;\n }\n }\n\n return null;\n }\n\n /**\n * Check if the row specified is hidden\n * @param rowIndex Index of the row to check\n * @param metrics Grid metrics\n * @returns True if the row is hidden, false otherwise\n */\n static isRowHidden(rowIndex: VisibleIndex, metrics: GridMetrics): boolean {\n const { visibleRowHeights } = metrics;\n return GridUtils.isItemHidden(rowIndex, visibleRowHeights);\n }\n\n /**\n * Get all the rows that are hidden under the same Index\n * @param rowIndex Index of the item to start at\n * @param metrics Grid metrics\n * @returns Array of items that are hidden\n */\n static getHiddenRows(\n rowIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex[] {\n const { visibleRows, visibleRowHeights } = metrics;\n return GridUtils.getHiddenItems(rowIndex, visibleRowHeights, visibleRows);\n }\n\n /**\n * Set a new order for items in the grid\n * @param from The visible index to move from\n * @param to The visible index to move the itme to\n * @param oldMovedItems The old reordered items\n * @returns The new reordered items\n */\n static moveItem(\n from: VisibleIndex,\n to: VisibleIndex,\n oldMovedItems: MoveOperation[] = []\n ): MoveOperation[] {\n if (from === to) {\n return oldMovedItems;\n }\n\n const movedItems: MoveOperation[] = [...oldMovedItems];\n\n if (\n movedItems.length > 0 &&\n movedItems[movedItems.length - 1].to === from\n ) {\n movedItems[movedItems.length - 1] = {\n ...movedItems[movedItems.length - 1],\n to,\n };\n } else {\n movedItems.push({ from, to });\n }\n\n return movedItems;\n }\n\n /**\n * Retrieve the model index given the currently moved items\n * @param visibleIndex The visible index of the item to get the model index for\n * @param movedItems The moved items\n * @returns The model index of the item\n */\n static getModelIndex(\n visibleIndex: VisibleIndex,\n movedItems: MoveOperation[] = []\n ): ModelIndex {\n let modelIndex = visibleIndex;\n\n for (let i = movedItems.length - 1; i >= 0; i -= 1) {\n const movedItem = movedItems[i];\n if (modelIndex === movedItem.to) {\n ({ from: modelIndex } = movedItem);\n } else if (movedItem.from <= modelIndex && modelIndex < movedItem.to) {\n modelIndex += 1;\n } else if (movedItem.to < modelIndex && modelIndex <= movedItem.from) {\n modelIndex -= 1;\n }\n }\n\n return modelIndex;\n }\n\n /**\n * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.\n * Since moved items can split apart a range, multiple pairs of indexes are returned\n *\n * @param start Start item in one dimension\n * @param end End item in one dimension\n * @param movedItems Moved item pairs in this dimension\n * @returns Array of start/end pairs of the indexes after transformations applied.\n */\n static getModelRangeIndexes(\n start: GridRangeIndex,\n end: GridRangeIndex,\n movedItems: MoveOperation[]\n ): GridAxisRange[] {\n if (start == null || end == null) {\n return [[start, end]];\n }\n\n let result: [VisibleIndex, VisibleIndex][] = [[start, end]];\n if (start == null) {\n return result;\n }\n\n // movedItems is built by adding a new item whenever an item in the UI is dragged/moved, transforming a model\n // index to the new UI index. We want to find the model index from the UI index here, so we unwind the\n // transformations applied - the start/end axis range passed in is the current UI range, so we need to apply\n // the transformations starting at the end of the chain backward to find the appropriate model indexes\n for (let i = movedItems.length - 1; i >= 0; i -= 1) {\n const { from, to } = movedItems[i];\n const nextResult: [VisibleIndex, VisibleIndex][] = [];\n for (let j = 0; j < result.length; j += 1) {\n const [currentStart, currentEnd] = result[j];\n const startLength = nextResult.length;\n if (from <= currentStart) {\n // From before\n if (to > currentEnd) {\n // To after\n nextResult.push([currentStart + 1, currentEnd + 1]);\n } else if (to >= currentStart) {\n // To within\n nextResult.push([from, from]);\n nextResult.push([currentStart + 1, currentEnd]);\n }\n } else if (from > currentEnd) {\n // From after\n if (to < currentStart) {\n // To before\n nextResult.push([currentStart - 1, currentEnd - 1]);\n } else if (to <= currentEnd) {\n // To within\n nextResult.push([from, from]);\n nextResult.push([currentStart, currentEnd - 1]);\n }\n } else if (to < currentStart) {\n // From within to before\n nextResult.push([currentStart - 1, from - 1]);\n nextResult.push([from + 1, currentEnd]);\n } else if (to > currentEnd) {\n // From within to after\n nextResult.push([currentStart, from - 1]);\n nextResult.push([from + 1, currentEnd + 1]);\n } else if (from > to) {\n // From within after to within before\n if (to > currentStart) {\n nextResult.push([currentStart, to - 1]);\n }\n nextResult.push([from, from]);\n nextResult.push([to, from - 1]);\n if (from < currentEnd) {\n nextResult.push([from + 1, currentEnd]);\n }\n } else if (from < to) {\n // From within before to within after\n if (from > currentStart) {\n nextResult.push([currentStart, from - 1]);\n }\n nextResult.push([from + 1, to]);\n nextResult.push([from, from]);\n if (from < currentEnd) {\n nextResult.push([to + 1, currentEnd]);\n }\n }\n\n if (startLength === nextResult.length) {\n // No modifications were made, add the original range indexes\n nextResult.push([currentStart, currentEnd]);\n }\n }\n result = nextResult;\n }\n return result;\n }\n\n /**\n * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.\n * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items\n *\n * @param uiRange The currently selected UI ranges\n * @param movedColumns The moved column pairs\n * @param movedRows The moved row pairs\n * @returns The model ranges after translation.\n */\n static getModelRange(\n uiRange: GridRange,\n movedColumns: MoveOperation[] = [],\n movedRows: MoveOperation[] = []\n ): GridRange[] {\n const columnRanges = GridUtils.getModelRangeIndexes(\n uiRange.startColumn,\n uiRange.endColumn,\n movedColumns\n );\n const rowRanges = GridUtils.getModelRangeIndexes(\n uiRange.startRow,\n uiRange.endRow,\n movedRows\n );\n const ranges: GridRange[] = [];\n for (let i = 0; i < columnRanges.length; i += 1) {\n const c = columnRanges[i];\n for (let j = 0; j < rowRanges.length; j += 1) {\n const r = rowRanges[j];\n ranges.push(new GridRange(c[0], r[0], c[1], r[1]));\n }\n }\n return ranges;\n }\n\n /**\n * Translate the provided UI range into model ranges, using the `movedColumns` and `movedRows` to apply the necessary transforms.\n * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items\n *\n * @param uiRanges The currently selected UI ranges\n * @param movedColumns The moved column pairs\n * @param movedRows The moved row pairs\n * @returns The model ranges after translation.\n */\n static getModelRanges(\n uiRanges: GridRange[],\n movedColumns: MoveOperation[] = [],\n movedRows: MoveOperation[] = []\n ): GridRange[] {\n const modelRanges = [];\n for (let i = 0; i < uiRanges.length; i += 1) {\n modelRanges.push(\n ...GridUtils.getModelRange(uiRanges[i], movedColumns, movedRows)\n );\n }\n return modelRanges;\n }\n\n /**\n * Retrieve the visible index given the currently moved items\n * @param modelIndex The model index to get the visible index for\n * @param movedItems Moved items\n * @returns The visible index of the item\n */\n static getVisibleIndex(\n modelIndex: ModelIndex,\n movedItems: MoveOperation[] = []\n ): VisibleIndex {\n let visibleIndex = modelIndex;\n\n for (let i = 0; i < movedItems.length; i += 1) {\n const movedItem = movedItems[i];\n if (visibleIndex === movedItem.from) {\n ({ to: visibleIndex } = movedItem);\n } else if (\n movedItem.from < visibleIndex &&\n visibleIndex <= movedItem.to\n ) {\n visibleIndex -= 1;\n } else if (\n movedItem.to <= visibleIndex &&\n visibleIndex < movedItem.from\n ) {\n visibleIndex += 1;\n }\n }\n\n return visibleIndex;\n }\n\n /**\n * Check if the current platform is Mac\n * @returns True if this platform is a Mac, false otherwise\n */\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Get the modifier key for the current platform\n * @returns The modifier key for the current platform\n */\n static getModifierKey(): 'metaKey' | 'ctrlKey' {\n if (GridUtils.isMacPlatform()) {\n return 'metaKey';\n }\n\n return 'ctrlKey';\n }\n\n /**\n * Check if the modifier key is down for the given event\n * @param event The event to check\n * @returns True if the modifier key is down, false otherwise\n */\n static isModifierKeyDown(\n event: MouseEvent | KeyboardEvent | React.KeyboardEvent | React.MouseEvent\n ): boolean {\n const modifierKey = GridUtils.getModifierKey();\n return event[modifierKey];\n }\n\n /**\n * Check if the user has hidden the specified column\n * @param modelIndex The model index to check\n * @param userColumnWidths The user set column widths\n * @returns True if the user has hidden the column\n */\n static checkColumnHidden(\n modelIndex: ModelIndex,\n userColumnWidths: ModelSizeMap\n ): boolean {\n return userColumnWidths.get(modelIndex) === 0;\n }\n\n /**\n * Check if all the columns specified are hidden\n * @param columns Columns to check\n * @param userColumnWidths The user set column widths\n * @returns True if the user has hidden all of the columns\n */\n static checkAllColumnsHidden(\n columns: ModelIndex[],\n userColumnWidths: ModelSizeMap\n ): boolean {\n if (userColumnWidths.size === 0) {\n return false;\n }\n return columns.every(column => userColumnWidths.get(column) === 0);\n }\n\n /**\n * Get the bounds the mouse needs to be dragged outside of from an initial selection before scrolling occurs.\n * Taking into account any floating rows that may be covering the viewport.\n * @param metrics Grid metrics\n * @param row The row they started dragging in\n * @param column The column they started the drag from\n * @returns Dimensions of the drag area in relation to the canvas they need to drag outside of to start scrolling\n */\n static getScrollDragBounds(\n metrics: GridMetrics,\n row: GridRangeIndex,\n column: GridRangeIndex\n ): BoxCoordinates {\n const {\n gridX,\n gridY,\n width,\n height,\n floatingTopRowCount,\n floatingBottomRowCount,\n floatingLeftColumnCount,\n floatingRightColumnCount,\n floatingLeftWidth,\n floatingRightWidth,\n floatingTopHeight,\n floatingBottomHeight,\n columnCount,\n rowCount,\n } = metrics;\n let x1 = gridX;\n let y1 = gridY;\n let x2 = width;\n let y2 = height;\n if (column != null) {\n if (column > floatingLeftColumnCount) {\n x1 += floatingLeftWidth;\n }\n if (column < columnCount - floatingRightColumnCount) {\n x2 -= floatingRightWidth;\n }\n }\n\n if (row != null) {\n if (row > floatingTopRowCount) {\n y1 += floatingTopHeight;\n }\n if (row < rowCount - floatingBottomRowCount) {\n y2 -= floatingBottomHeight;\n }\n }\n return { x1, y1, x2, y2 };\n }\n\n /**\n * Converts the delta coordinates from the provided wheel event to pixels\n * Different platforms have different ways of providing the delta so this normalizes it\n * @param wheelEvent The mouse wheel event to get the scrolling delta for\n * @param pageWidth The width of the page that is scrolling\n * @param pageHeight The height of the page that is scrolling\n * @param lineWidth The width of the line scrolling in line mode\n * @param lineHeight The height of the line scrolling in line mode\n * @returns The delta coordinates normalized to pixels\n */\n static getScrollDelta(\n wheelEvent: GridWheelEvent,\n pageWidth = 1024,\n pageHeight = 768,\n lineWidth = 20,\n lineHeight = 20\n ): { deltaX: number; deltaY: number } {\n let { deltaX, deltaY } = wheelEvent;\n\n // Flip scroll direction if shiftKey is held on windows/linux.\n // On mac, deltaX/Y values are switched at the event level when shiftKey=true.\n // Guard on strictly Y only changing, to ignore trackpad diagonal motion,\n // through that guard may not be necessary, but it is difficult to determine for\n // all platforms/browser/scroll method combos.\n if (\n !GridUtils.isMacPlatform() &&\n wheelEvent.shiftKey &&\n wheelEvent.deltaX === 0 &&\n wheelEvent.deltaY !== 0\n ) {\n deltaX = wheelEvent.deltaY;\n deltaY = wheelEvent.deltaX;\n }\n\n // Normalize other deltaMode values to pixel units\n // deltaMode 0, is already in pixel units\n if (wheelEvent?.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n // Users can set OS to be in deltaMode page\n // scrolly by page units as pixels\n deltaX *= pageWidth;\n deltaY *= pageHeight;\n } else if (wheelEvent?.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n // Firefox reports deltaMode line\n // Normalize distance travelled between browsers\n // but remain ~platform/browser combo consistent\n if (GridUtils.isMacPlatform()) {\n // for mac treat lines as a standard row height\n // on mac, firefox travels less distance then chrome per tick\n deltaX = Math.round(deltaX * lineWidth);\n deltaY = Math.round(deltaY * lineHeight);\n } else {\n // for windows convert to pixels using the same method as chrome\n // chrome goes 100 per 3 lines, and firefox would go 102 per 3 (17 lineheight * 3 lines * 2)\n // make the behaviour the same between as it's close enough\n deltaX = Math.round(deltaX * this.PIXELS_PER_LINE);\n deltaY = Math.round(deltaY * this.PIXELS_PER_LINE);\n }\n }\n\n return { deltaX, deltaY };\n }\n}\n\nexport default GridUtils;\n"],"file":"GridUtils.js"}
1
+ {"version":3,"sources":["../src/GridUtils.ts"],"names":["GridRange","GridUtils","getGridPointFromXY","x","y","metrics","column","getColumnAtX","row","getRowAtY","getCellInfoFromXY","visibleColumnWidths","visibleRowHeights","visibleColumnXs","visibleRowYs","modelColumns","modelRows","modelRow","get","modelColumn","left","top","columnWidth","rowHeight","iterateFloatingStart","start","total","callback","i","result","undefined","iterateFloatingEnd","end","iterateFloating","iterateAllItems","visibleStart","visibleEnd","floatingStartCount","floatingEndCount","totalCount","visibleStartIndex","Math","max","visibleEndIndex","min","isInItem","itemIndex","itemCoordinates","itemSizes","coordinate","itemX","itemSize","getItemAtOffset","offset","itemCount","floatingStart","floatingEnd","items","floatingItem","item","length","columnCount","floatingLeftColumnCount","floatingRightColumnCount","visibleColumns","gridX","floatingTopRowCount","floatingBottomRowCount","rowCount","visibleRows","gridY","getNextShownItem","startIndex","modelIndexes","visibleItems","userSizes","visibleItemIndex","findIndex","value","modelIndex","getNextShownColumn","userColumnWidths","getNextShownRow","userRowHeights","getColumnSeparatorIndex","theme","rowHeaderWidth","columnHeaderHeight","floatingColumns","floatingLeftWidth","allowColumnResize","headerSeparatorHandleSize","halfSeparatorSize","isPreviousColumnHidden","columnX","isColumnHidden","midX","minX","maxX","isItemHidden","visibleSizes","columnIndex","isFloatingRow","isFloatingColumn","getHiddenItems","hiddenItems","push","getHiddenColumns","getRowSeparatorIndex","allowRowResize","isPreviousRowHidden","rowY","isRowHidden","midY","minY","maxY","rowIndex","getHiddenRows","moveItem","from","to","oldMovedItems","movedItems","getModelIndex","visibleIndex","applyItemMoves","reverse","fromItem","toItem","nextResult","j","currentStart","Number","NEGATIVE_INFINITY","currentEnd","POSITIVE_INFINITY","startLength","map","s","e","isFinite","translateRange","range","movedColumns","movedRows","columnRanges","startColumn","endColumn","rowRanges","startRow","endRow","ranges","c","r","getModelRangeIndexes","getModelRange","uiRange","getModelRanges","uiRanges","modelRanges","getVisibleRangeIndexes","getVisibleRange","modelRange","getVisibleRanges","visibleRanges","getVisibleIndex","isMacPlatform","platform","window","navigator","startsWith","getModifierKey","isModifierKeyDown","event","modifierKey","checkColumnHidden","checkAllColumnsHidden","columns","size","every","getScrollDragBounds","width","height","floatingRightWidth","floatingTopHeight","floatingBottomHeight","x1","y1","x2","y2","getScrollDelta","wheelEvent","pageWidth","pageHeight","lineWidth","lineHeight","deltaX","deltaY","shiftKey","deltaMode","WheelEvent","DOM_DELTA_PAGE","DOM_DELTA_LINE","round","PIXELS_PER_LINE"],"mappings":";;;;;;OACOA,S;AA4CP,OAAO,MAAMC,SAAN,CAAgB;AACrB;AACA;;AAGA;AACF;AACA;AACA;AACA;AACA;AACA;AAC2B,SAAlBC,kBAAkB,CACvBC,CADuB,EAEvBC,CAFuB,EAGvBC,OAHuB,EAIZ;AACX,QAAMC,MAAM,GAAGL,SAAS,CAACM,YAAV,CAAuBJ,CAAvB,EAA0BE,OAA1B,CAAf;AACA,QAAMG,GAAG,GAAGP,SAAS,CAACQ,SAAV,CAAoBL,CAApB,EAAuBC,OAAvB,CAAZ;AAEA,WAAO;AAAEF,MAAAA,CAAF;AAAKC,MAAAA,CAAL;AAAQI,MAAAA,GAAR;AAAaF,MAAAA;AAAb,KAAP;AACD;;AAEuB,SAAjBI,iBAAiB,CACtBP,CADsB,EAEtBC,CAF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CAAAF,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEQ,SAAZ,MAA0BC,UAAU,CAACE,cAAzC,EAAyD;AAC9D;AACA;AACA;AACA,UAAIzM,SAAS,CAACqK,aAAV,EAAJ,EAA+B;AAC7B;AACA;AACA8B,QAAAA,MAAM,GAAG3J,IAAI,CAACkK,KAAL,CAAWP,MAAM,GAAGF,SAApB,CAAT;AACAG,QAAAA,MAAM,GAAG5J,IAAI,CAACkK,KAAL,CAAWN,MAAM,GAAGF,UAApB,CAAT;AACD,OALD,MAKO;AACL;AACA;AACA;AACAC,QAAAA,MAAM,GAAG3J,IAAI,CAACkK,KAAL,CAAWP,MAAM,GAAG,KAAKQ,eAAzB,CAAT;AACAP,QAAAA,MAAM,GAAG5J,IAAI,CAACkK,KAAL,CAAWN,MAAM,GAAG,KAAKO,eAAzB,CAAT;AACD;AACF;;AAED,WAAO;AAAER,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KAAP;AACD;;AA7oCoB;;gBAAVpM,S,qBAGc,MAAM,C;;AA6oCjC,eAAeA,SAAf","sourcesContent":["import React from 'react';\nimport GridRange, { GridRangeIndex } from './GridRange';\nimport {\n BoxCoordinates,\n Coordinate,\n CoordinateMap,\n VisibleIndex,\n IndexModelMap,\n ModelIndex,\n ModelSizeMap,\n MoveOperation,\n SizeMap,\n} from './GridMetrics';\nimport type { GridMetrics } from './GridMetrics';\nimport { GridTheme } from './GridTheme';\nimport { GridWheelEvent } from './GridMouseHandler';\n\ntype Range<T> = [start: T, end: T];\n\nexport type AxisRange = Range<VisibleIndex>;\n\nexport type BoundedAxisRange = Range<number>;\n\nexport type GridAxisRange = Range<GridRangeIndex>;\n\nexport type GridPoint = {\n x: Coordinate;\n y: Coordinate;\n column: GridRangeIndex;\n row: GridRangeIndex;\n};\n\nexport interface CellInfo {\n row: VisibleIndex | null;\n column: VisibleIndex | null;\n modelRow: ModelIndex | null;\n modelColumn: ModelIndex | null;\n left: Coordinate | null;\n top: Coordinate | null;\n columnWidth: number | null;\n rowHeight: number | null;\n}\n\nexport type IndexCallback<T> = (itemIndex: VisibleIndex) => T | undefined;\n\nexport class GridUtils {\n // use same constant as chrome source for windows\n // https://github.com/chromium/chromium/blob/973af9d461b6b5dc60208c8d3d66adc27e53da78/ui/events/blink/web_input_event_builders_win.cc#L285\n static PIXELS_PER_LINE = 100 / 3;\n\n /**\n * Get the GridPoint for the coordinates provided\n * @param x The grid x coordinate\n * @param y The grid y coordinate\n * @param metrics The grid metrics\n * @returns The GridPoint including the column/row information\n */\n static getGridPointFromXY(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics\n ): GridPoint {\n const column = GridUtils.getColumnAtX(x, metrics);\n const row = GridUtils.getRowAtY(y, metrics);\n\n return { x, y, row, column };\n }\n\n static getCellInfoFromXY(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics\n ): CellInfo {\n const { row, column } = GridUtils.getGridPointFromXY(x, y, metrics);\n\n const {\n visibleColumnWidths,\n visibleRowHeights,\n visibleColumnXs,\n visibleRowYs,\n modelColumns,\n modelRows,\n } = metrics;\n\n const modelRow = row !== null ? modelRows.get(row) : null;\n const modelColumn = column !== null ? modelColumns.get(column) : null;\n const left = column !== null ? visibleColumnXs.get(column) : null;\n const top = row !== null ? visibleRowYs.get(row) : null;\n const columnWidth =\n column !== null ? visibleColumnWidths.get(column) : null;\n const rowHeight = row !== null ? visibleRowHeights.get(row) : null;\n\n return {\n row,\n column,\n modelRow: modelRow ?? null,\n modelColumn: modelColumn ?? null,\n left: left ?? null,\n top: top ?? null,\n columnWidth: columnWidth ?? null,\n rowHeight: rowHeight ?? null,\n };\n }\n\n /**\n * Iterate through each floating item at the start and call a callback, returning the first result\n * @param start The count of floating items at the start\n * @param total The total number of items\n * @param callback Function to call for each item\n * @returns The result from the callback\n */\n static iterateFloatingStart<T>(\n start: number,\n total: number,\n callback: IndexCallback<T>\n ): T | undefined {\n for (let i = 0; i < start && i < total; i += 1) {\n const result = callback(i);\n if (result !== undefined) {\n return result;\n }\n }\n\n return undefined;\n }\n\n /**\n * Iterate through floating items at the end. Iterates in increasing order.\n * @param end The count of floating items at the end\n * @param total The total number of items\n * @param callback Function to call for each item\n * @returns The result from the callback\n */\n static iterateFloatingEnd<T>(\n end: number,\n total: number,\n callback: IndexCallback<T>\n ): T | undefined {\n for (let i = 0; i < end && total - (end - i) >= 0; i += 1) {\n const result = callback(total - (end - i));\n if (result !== undefined) {\n return result;\n }\n }\n\n return undefined;\n }\n\n /**\n * Iterate through all floating items in increasing order, starting with the top items.\n * @param start Count of start floating rows, e.g. floatingTopRowCount\n * @param end Count of end floating rows, e.g. floatingBottomRowCount\n * @param total Total number of items\n * @param callback Callback called for each value, stopping the iterating and returning the value if one is returned\n */\n static iterateFloating<T>(\n start: number,\n end: number,\n total: number,\n callback: IndexCallback<T>\n ): T | undefined {\n const result = GridUtils.iterateFloatingStart(start, total, callback);\n if (result !== undefined) {\n return result;\n }\n return GridUtils.iterateFloatingEnd(end, total, callback);\n }\n\n /**\n * Iterate through all items in one dimension on the grid - first floating, then visible.\n * Call the callback for each item, break if a result is returned and return that result.\n * @param visibleStart Index of the start of the visible viewport\n * @param visibleEnd Index of the end of the visible viewport\n * @param floatingStartCount Number of items floating at the start\n * @param floatingEndCount Number of items floating at the end\n * @param totalCount Total number of items\n * @param callback Callback to call for each item\n * @returns The first result from the callback called, or undefined\n */\n static iterateAllItems<T>(\n visibleStart: VisibleIndex,\n visibleEnd: VisibleIndex,\n floatingStartCount: number,\n floatingEndCount: number,\n totalCount: number,\n callback: IndexCallback<T>\n ): T | undefined {\n const visibleStartIndex = Math.max(visibleStart, floatingStartCount);\n const visibleEndIndex = Math.min(\n visibleEnd,\n totalCount - floatingEndCount - 1\n );\n let result = GridUtils.iterateFloating(\n floatingStartCount,\n floatingEndCount,\n totalCount,\n callback\n );\n if (result !== undefined) {\n return result;\n }\n\n for (let i = visibleStartIndex; i <= visibleEndIndex; i += 1) {\n result = callback(i);\n if (result !== undefined) {\n return result;\n }\n }\n\n return undefined;\n }\n\n /**\n * Check if the coordinate is within the item specified in this dimension\n * @param itemIndex Index of the item to check\n * @param itemCoordinatess Coordinate of all items in this dimension\n * @param itemSizes Size of all items in this dimension\n * @param coordinate The coordinate to check\n * @returns True if the coordinate is within the item specified, false otherwise\n */\n static isInItem(\n itemIndex: VisibleIndex,\n itemCoordinates: CoordinateMap,\n itemSizes: SizeMap,\n coordinate: Coordinate\n ): boolean {\n const itemX = itemCoordinates.get(itemIndex) ?? 0;\n const itemSize = itemSizes.get(itemIndex) ?? 0;\n return itemX <= coordinate && coordinate <= itemX + itemSize;\n }\n\n /**\n * Get the Index of the item at the provided offset\n * @param offset Coordinate of the offset to get the item of\n * @param itemCount The total count of items\n * @param floatingStart Count of floating items at the start\n * @param floatingEnd Count of floating items at the end\n * @param items Index of all items\n * @param itemCoordinates The coordinate of each item\n * @param itemSizes The size of each item\n * @returns The item index, or null if no item matches\n */\n static getItemAtOffset(\n offset: Coordinate,\n itemCount: number,\n floatingStart: number,\n floatingEnd: number,\n items: VisibleIndex[],\n itemCoordinates: CoordinateMap,\n itemSizes: SizeMap\n ): VisibleIndex | null {\n const floatingItem = GridUtils.iterateFloating(\n floatingStart,\n floatingEnd,\n itemCount,\n item => {\n if (GridUtils.isInItem(item, itemCoordinates, itemSizes, offset)) {\n return item;\n }\n return undefined;\n }\n );\n if (floatingItem !== undefined) {\n return floatingItem;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (GridUtils.isInItem(item, itemCoordinates, itemSizes, offset)) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Get the index of the column at the specified x coordinate\n * @param x Coordinate to get the item of\n * @param metrics Grid metrics\n * @returns Index of the column at that coordinate, or null if no column matches\n */\n static getColumnAtX(\n x: Coordinate,\n metrics: GridMetrics\n ): VisibleIndex | null {\n const {\n columnCount,\n floatingLeftColumnCount,\n floatingRightColumnCount,\n visibleColumns,\n visibleColumnXs,\n visibleColumnWidths,\n gridX,\n } = metrics;\n\n if (x < gridX) {\n return null;\n }\n\n return this.getItemAtOffset(\n x - gridX,\n columnCount,\n floatingLeftColumnCount,\n floatingRightColumnCount,\n visibleColumns,\n visibleColumnXs,\n visibleColumnWidths\n );\n }\n\n /**\n * Get the index of the row at the specified y coordinate\n * @param y Coordinate to get the item of\n * @param metrics Grid metrics\n * @returns Index of the row at that coordinate, or null if no row matches\n */\n static getRowAtY(y: Coordinate, metrics: GridMetrics): VisibleIndex | null {\n const {\n floatingTopRowCount,\n floatingBottomRowCount,\n rowCount,\n visibleRows,\n visibleRowYs,\n visibleRowHeights,\n gridY,\n } = metrics;\n\n if (y < gridY) {\n return null;\n }\n\n return this.getItemAtOffset(\n y - gridY,\n rowCount,\n floatingTopRowCount,\n floatingBottomRowCount,\n visibleRows,\n visibleRowYs,\n visibleRowHeights\n );\n }\n\n /**\n * Iterate backward through the visible items until a shown item is hit\n * @param startIndex The index to start from\n * @param modelIndexes The mapping of model indexes\n * @param visibleItems The visible items\n * @param userSizes The user set sizes\n * @returns Index of the next visible item, or null if no more are visible\n */\n static getNextShownItem(\n startIndex: VisibleIndex,\n modelIndexes: IndexModelMap,\n visibleItems: VisibleIndex[],\n userSizes: ModelSizeMap\n ): VisibleIndex | null {\n let visibleItemIndex =\n visibleItems.findIndex(value => value === startIndex) || 0;\n visibleItemIndex -= 1;\n while (visibleItemIndex != null && visibleItemIndex >= 0) {\n const item = visibleItems[visibleItemIndex];\n const modelIndex = modelIndexes.get(item);\n if (modelIndex != null && userSizes.get(modelIndex) !== 0) {\n return item;\n }\n\n visibleItemIndex -= 1;\n }\n\n return null;\n }\n\n /**\n * Iterate backward through the visible columns until a shown column is hit\n * @param columnIndex The column index to start iterating backward from\n * @param metrics The GridMetricCalculator metrics\n * @returns Index of the next visible item, or null if no more are visible\n */\n static getNextShownColumn(\n startIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex | null {\n const { modelColumns, visibleColumns, userColumnWidths } = metrics;\n return GridUtils.getNextShownItem(\n startIndex,\n modelColumns,\n visibleColumns,\n userColumnWidths\n );\n }\n\n /**\n * Iterate backward through the visible rows until a shown row is hit\n * @param rowIndex The row index to start iterating backward from\n * @param metrics The GridMetricCalculator metrics\n * @returns Index of the next visible item, or null if no more are visible\n */\n static getNextShownRow(\n startIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex | null {\n const { modelRows, visibleRows, userRowHeights } = metrics;\n return GridUtils.getNextShownItem(\n startIndex,\n modelRows,\n visibleRows,\n userRowHeights\n );\n }\n\n /**\n * Gets the column index if the x/y coordinates provided are close enough to the separator, otherwise null\n * @param x Mouse x coordinate\n * @param y Mouse y coordinate\n * @param metrics The grid metrics\n * @param theme The grid theme with potential user overrides\n * @returns Index of the column separator at the coordinates provided, or null if none match\n */\n static getColumnSeparatorIndex(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics,\n theme: GridTheme\n ): VisibleIndex | null {\n const {\n rowHeaderWidth,\n columnHeaderHeight,\n floatingColumns,\n floatingLeftWidth,\n visibleColumns,\n visibleColumnXs,\n visibleColumnWidths,\n } = metrics;\n const { allowColumnResize, headerSeparatorHandleSize } = theme;\n\n if (\n columnHeaderHeight < y ||\n !allowColumnResize ||\n headerSeparatorHandleSize <= 0\n ) {\n return null;\n }\n\n const gridX = x - rowHeaderWidth;\n const halfSeparatorSize = headerSeparatorHandleSize * 0.5;\n\n // Iterate through the floating columns first since they're on top\n let isPreviousColumnHidden = false;\n for (let i = floatingColumns.length - 1; i >= 0; i -= 1) {\n const column = floatingColumns[i];\n const columnX = visibleColumnXs.get(column) ?? 0;\n const columnWidth = visibleColumnWidths.get(column) ?? 0;\n const isColumnHidden = columnWidth === 0;\n if (!isPreviousColumnHidden || !isColumnHidden) {\n let midX = columnX + columnWidth;\n if (isColumnHidden) {\n midX += halfSeparatorSize;\n } else if (isPreviousColumnHidden) {\n midX -= halfSeparatorSize;\n }\n\n const minX = midX - halfSeparatorSize;\n const maxX = midX + halfSeparatorSize;\n if (minX <= gridX && gridX <= maxX) {\n return column;\n }\n\n isPreviousColumnHidden = isColumnHidden;\n }\n }\n\n // Iterate backward so that you can reveal hidden columns properly\n isPreviousColumnHidden = false;\n for (let i = visibleColumns.length - 1; i >= 0; i -= 1) {\n const column = visibleColumns[i];\n const columnX = visibleColumnXs.get(column) ?? 0;\n const columnWidth = visibleColumnWidths.get(column) ?? 0;\n const isColumnHidden = columnWidth === 0;\n\n // If this column is under the floating columns \"layer\". Terminate early.\n if (columnX < floatingLeftWidth - columnWidth) {\n return null;\n }\n\n if (!isPreviousColumnHidden || !isColumnHidden) {\n let midX = columnX + columnWidth;\n if (isColumnHidden) {\n midX += halfSeparatorSize;\n } else if (isPreviousColumnHidden) {\n midX -= halfSeparatorSize;\n }\n\n const minX = midX - halfSeparatorSize;\n const maxX = midX + halfSeparatorSize;\n if (minX <= gridX && gridX <= maxX) {\n return column;\n }\n\n isPreviousColumnHidden = isColumnHidden;\n }\n }\n\n return null;\n }\n\n /**\n * Check if the item specified is hidden\n * @param itemIndex Index of the item to check\n * @param visibleSizes Sizes of all visible items\n * @returns True if the item is hidden, false otherwise\n */\n static isItemHidden(itemIndex: VisibleIndex, visibleSizes: SizeMap): boolean {\n return visibleSizes.get(itemIndex) === 0;\n }\n\n /**\n * Check if the column specified is hidden\n * @param columnIndex Index of the column to check\n * @param metrics Grid metrics\n * @returns True if the column is hidden, false otherwise\n */\n static isColumnHidden(\n columnIndex: VisibleIndex,\n metrics: GridMetrics\n ): boolean {\n const { visibleColumnWidths } = metrics;\n return GridUtils.isItemHidden(columnIndex, visibleColumnWidths);\n }\n\n /**\n * Check if the provided row is a floating row\n * @param row The row index to check\n * @param metrics The grid metrics to check against\n * @returns True if it's a floating row, false otherwise\n */\n static isFloatingRow(row: VisibleIndex, metrics: GridMetrics): boolean {\n if (row == null) {\n return false;\n }\n\n const { floatingTopRowCount, floatingBottomRowCount, rowCount } = metrics;\n return (\n row < floatingTopRowCount || row >= rowCount - floatingBottomRowCount\n );\n }\n\n /**\n * Check if the provided column is a floating column\n * @param column The column index to check\n * @param metrics The grid metrics to check against\n * @returns True if it's a floating column, false otherwise\n */\n static isFloatingColumn(column: VisibleIndex, metrics: GridMetrics): boolean {\n if (column == null) {\n return false;\n }\n\n const {\n floatingLeftColumnCount,\n floatingRightColumnCount,\n columnCount,\n } = metrics;\n return (\n column < floatingLeftColumnCount ||\n column >= columnCount - floatingRightColumnCount\n );\n }\n\n /**\n * Get all the items that are hidden under the same Index\n * E.g. If columns are 1, 2, 3, 4, 5, and column 2, 3, 4 are hidden, and we check for item 4, the return will be [2, 3, 4]\n * @param itemIndex Index of the item to start at\n * @param visibleSizes Visible size map\n * @param visibleItems Visible items\n * @returns Array of items that are hidden\n */\n static getHiddenItems(\n itemIndex: VisibleIndex,\n visibleSizes: SizeMap,\n visibleItems: VisibleIndex[]\n ): VisibleIndex[] {\n if (!GridUtils.isItemHidden(itemIndex, visibleSizes)) {\n return [];\n }\n\n const hiddenItems = [itemIndex];\n const visibleItemIndex = visibleItems.findIndex(\n value => value === itemIndex\n );\n for (let i = visibleItemIndex - 1; i >= 0; i -= 1) {\n const item = visibleItems[i];\n if (!GridUtils.isItemHidden(item, visibleSizes)) {\n break;\n }\n\n hiddenItems.push(item);\n }\n\n return hiddenItems;\n }\n\n /**\n * Get all the columns that are hidden under the same Index\n * @param columnIndex Index of the item to start at\n * @param metrics Grid metrics\n * @returns Array of items that are hidden\n */\n static getHiddenColumns(\n columnIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex[] {\n const { visibleColumns, visibleColumnWidths } = metrics;\n return GridUtils.getHiddenItems(\n columnIndex,\n visibleColumnWidths,\n visibleColumns\n );\n }\n\n /**\n * Returns the row index if the x/y coordinates provided are close enough to the separator, otherwise null\n * @param x X coordinate to check\n * @param y Y coordinate to check\n * @param metrics The grid metrics\n * @param theme The grid theme\n * @returns Index of the row separator at the coordinates provided, or null if none match\n */\n static getRowSeparatorIndex(\n x: Coordinate,\n y: Coordinate,\n metrics: GridMetrics,\n theme: GridTheme\n ): VisibleIndex | null {\n const {\n rowHeaderWidth,\n columnHeaderHeight,\n visibleRows,\n visibleRowYs,\n visibleRowHeights,\n } = metrics;\n const { allowRowResize, headerSeparatorHandleSize } = theme;\n\n if (\n rowHeaderWidth < x ||\n !allowRowResize ||\n headerSeparatorHandleSize <= 0\n ) {\n return null;\n }\n\n const gridY = y - columnHeaderHeight;\n const halfSeparatorSize = headerSeparatorHandleSize * 0.5;\n\n // Iterate backward so you can reveal hidden rows properly\n let isPreviousRowHidden = false;\n for (let i = visibleRows.length - 1; i >= 0; i -= 1) {\n const row = visibleRows[i];\n const rowY = visibleRowYs.get(row) ?? 0;\n const rowHeight = visibleRowHeights.get(row) ?? 0;\n const isRowHidden = rowHeight === 0;\n if (!isPreviousRowHidden || !isRowHidden) {\n let midY = rowY + rowHeight;\n if (isRowHidden) {\n midY += halfSeparatorSize;\n } else if (isPreviousRowHidden) {\n midY -= halfSeparatorSize;\n }\n\n const minY = midY - halfSeparatorSize;\n const maxY = midY + halfSeparatorSize;\n\n if (minY <= gridY && gridY <= maxY) {\n return row;\n }\n\n isPreviousRowHidden = isRowHidden;\n }\n }\n\n return null;\n }\n\n /**\n * Check if the row specified is hidden\n * @param rowIndex Index of the row to check\n * @param metrics Grid metrics\n * @returns True if the row is hidden, false otherwise\n */\n static isRowHidden(rowIndex: VisibleIndex, metrics: GridMetrics): boolean {\n const { visibleRowHeights } = metrics;\n return GridUtils.isItemHidden(rowIndex, visibleRowHeights);\n }\n\n /**\n * Get all the rows that are hidden under the same Index\n * @param rowIndex Index of the item to start at\n * @param metrics Grid metrics\n * @returns Array of items that are hidden\n */\n static getHiddenRows(\n rowIndex: VisibleIndex,\n metrics: GridMetrics\n ): VisibleIndex[] {\n const { visibleRows, visibleRowHeights } = metrics;\n return GridUtils.getHiddenItems(rowIndex, visibleRowHeights, visibleRows);\n }\n\n /**\n * Set a new order for items in the grid\n * @param from The visible index to move from\n * @param to The visible index to move the itme to\n * @param oldMovedItems The old reordered items\n * @returns The new reordered items\n */\n static moveItem(\n from: VisibleIndex,\n to: VisibleIndex,\n oldMovedItems: MoveOperation[] = []\n ): MoveOperation[] {\n if (from === to) {\n return oldMovedItems;\n }\n\n const movedItems: MoveOperation[] = [...oldMovedItems];\n\n if (\n movedItems.length > 0 &&\n movedItems[movedItems.length - 1].to === from\n ) {\n movedItems[movedItems.length - 1] = {\n ...movedItems[movedItems.length - 1],\n to,\n };\n } else {\n movedItems.push({ from, to });\n }\n\n return movedItems;\n }\n\n /**\n * Retrieve the model index given the currently moved items\n * @param visibleIndex The visible index of the item to get the model index for\n * @param movedItems The moved items\n * @returns The model index of the item\n */\n static getModelIndex(\n visibleIndex: VisibleIndex,\n movedItems: MoveOperation[] = []\n ): ModelIndex {\n const modelIndex = GridUtils.applyItemMoves(\n visibleIndex,\n visibleIndex,\n movedItems,\n true\n )[0][0];\n\n return modelIndex;\n }\n\n /**\n * Applies the items moves to the AxisRange\n * @param start The start index of the range\n * @param end The end index of the range\n * @param movedItems The move operations to apply\n * @param reverse If the moved items should be applied in reverse (this reverses the effects of the moves)\n * @returns A list of AxisRanges in the translated space. Possibly multiple non-continuous ranges\n */\n private static applyItemMoves<T extends number | GridRangeIndex>(\n start: T,\n end: T,\n movedItems: MoveOperation[],\n reverse = false\n ): Range<T>[] {\n let result: Range<T>[] = [[start, end]];\n\n for (\n let i = reverse ? movedItems.length - 1 : 0;\n reverse ? i >= 0 : i < movedItems.length;\n reverse ? (i -= 1) : (i += 1)\n ) {\n const { from: fromItem, to: toItem } = movedItems[i];\n const from = reverse ? toItem : fromItem;\n const to = reverse ? fromItem : toItem;\n const nextResult: Range<number>[] = [];\n for (let j = 0; j < result.length; j += 1) {\n const currentStart = result[j][0] ?? Number.NEGATIVE_INFINITY;\n const currentEnd = result[j][1] ?? Number.POSITIVE_INFINITY;\n const startLength = nextResult.length;\n if (from < currentStart) {\n // From before\n if (to >= currentEnd) {\n // To after\n nextResult.push([currentStart - 1, currentEnd - 1]);\n } else if (to >= currentStart) {\n // To within\n nextResult.push([currentStart - 1, to - 1]);\n nextResult.push([to + 1, currentEnd]);\n }\n } else if (from > currentEnd) {\n // From after\n if (to <= currentStart) {\n // To before\n nextResult.push([currentStart + 1, currentEnd + 1]);\n } else if (to <= currentEnd) {\n // To within\n nextResult.push([currentStart, to - 1]);\n nextResult.push([to + 1, currentEnd + 1]);\n }\n } else if (to < currentStart) {\n // From within to before\n if (from > currentStart) {\n nextResult.push([currentStart + 1, from]);\n }\n nextResult.push([to, to]);\n if (from < currentEnd) {\n nextResult.push([from + 1, currentEnd]);\n }\n } else if (to > currentEnd) {\n // From within to after\n if (from > currentStart) {\n nextResult.push([currentStart, from - 1]);\n }\n nextResult.push([to, to]);\n if (from < currentEnd) {\n nextResult.push([from, currentEnd - 1]);\n }\n } else if (from > to) {\n // From within after to within before\n if (to > currentStart) {\n nextResult.push([currentStart, to - 1]);\n }\n nextResult.push([to + 1, from]);\n nextResult.push([to, to]);\n if (from < currentEnd) {\n nextResult.push([from + 1, currentEnd]);\n }\n } else if (from < to) {\n // From within before to within after\n if (from > currentStart) {\n nextResult.push([currentStart, from - 1]);\n }\n nextResult.push([to, to]);\n nextResult.push([from, to - 1]);\n if (to < currentEnd) {\n nextResult.push([to + 1, currentEnd]);\n }\n }\n\n if (startLength === nextResult.length) {\n // No modifications were made, add the original range indexes\n nextResult.push([currentStart, currentEnd]);\n }\n }\n\n // Return infinity values back to null\n result = nextResult.map(([s, e]) => [\n Number.isFinite(s) ? s : null,\n Number.isFinite(e) ? e : null,\n ]) as Range<T>[];\n }\n return result;\n }\n\n /**\n * Applies the items moves to the givengrid range\n * @param range The grid range to translate\n * @param movedColumns The moved columns\n * @param movedRows The moved rows\n * @param reverse If the moved items should be reversed (i.e. visible to model range)\n * @returns A list of grid ranges in the translated space. Possibly multiple non-continuous ranges\n */\n static translateRange(\n range: GridRange,\n movedColumns: MoveOperation[],\n movedRows: MoveOperation[],\n reverse: boolean\n ): GridRange[] {\n const columnRanges = GridUtils.applyItemMoves(\n range.startColumn,\n range.endColumn,\n movedColumns,\n reverse\n );\n const rowRanges = GridUtils.applyItemMoves(\n range.startRow,\n range.endRow,\n movedRows,\n reverse\n );\n const ranges: GridRange[] = [];\n for (let i = 0; i < columnRanges.length; i += 1) {\n const c = columnRanges[i];\n for (let j = 0; j < rowRanges.length; j += 1) {\n const r = rowRanges[j];\n ranges.push(new GridRange(c[0], r[0], c[1], r[1]));\n }\n }\n return ranges;\n }\n\n /**\n * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.\n * Since moved items can split apart a range, multiple pairs of indexes are returned\n *\n * @param start Start item in one dimension\n * @param end End item in one dimension\n * @param movedItems Moved item pairs in this dimension\n * @returns Array of start/end pairs of the indexes after transformations applied.\n */\n static getModelRangeIndexes(\n start: GridRangeIndex,\n end: GridRangeIndex,\n movedItems: MoveOperation[]\n ): GridAxisRange[] {\n return GridUtils.applyItemMoves(start, end, movedItems, true);\n }\n\n /**\n * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.\n * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items\n *\n * @param uiRange The currently selected UI ranges\n * @param movedColumns The moved column pairs\n * @param movedRows The moved row pairs\n * @returns The model ranges after translation.\n */\n static getModelRange(\n uiRange: GridRange,\n movedColumns: MoveOperation[] = [],\n movedRows: MoveOperation[] = []\n ): GridRange[] {\n return GridUtils.translateRange(uiRange, movedColumns, movedRows, true);\n }\n\n /**\n * Translate the provided UI range into model ranges, using the `movedColumns` and `movedRows` to apply the necessary transforms.\n * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items\n *\n * @param uiRanges The currently selected UI ranges\n * @param movedColumns The moved column pairs\n * @param movedRows The moved row pairs\n * @returns The model ranges after translation.\n */\n static getModelRanges(\n uiRanges: GridRange[],\n movedColumns: MoveOperation[] = [],\n movedRows: MoveOperation[] = []\n ): GridRange[] {\n const modelRanges = [];\n for (let i = 0; i < uiRanges.length; i += 1) {\n modelRanges.push(\n ...GridUtils.getModelRange(uiRanges[i], movedColumns, movedRows)\n );\n }\n return modelRanges;\n }\n\n /**\n * Translate the provided UI start/end indexes to the model start/end indexes by applying the `movedItems` transformations.\n * Since moved items can split apart a range, multiple pairs of indexes are returned\n *\n * @param start Start item in one dimension\n * @param end End item in one dimension\n * @param movedItems Moved item pairs in this dimension\n * @returns Array of start/end pairs of the indexes after transformations applied.\n */\n static getVisibleRangeIndexes(\n start: GridRangeIndex,\n end: GridRangeIndex,\n movedItems: MoveOperation[]\n ): GridAxisRange[] {\n return GridUtils.applyItemMoves(start, end, movedItems, false);\n }\n\n /**\n * Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.\n * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items\n *\n * @param uiRange The currently selected UI ranges\n * @param movedColumns The moved column pairs\n * @param movedRows The moved row pairs\n * @returns The model ranges after translation.\n */\n static getVisibleRange(\n modelRange: GridRange,\n movedColumns: MoveOperation[] = [],\n movedRows: MoveOperation[] = []\n ): GridRange[] {\n return this.translateRange(modelRange, movedColumns, movedRows, false);\n }\n\n /**\n * Translate the provided model ranges into visible ranges, using the `movedColumns` and `movedRows` to apply the necessary transforms.\n * `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items\n *\n * @param modelRanges The model ranges\n * @param movedColumns The moved column pairs\n * @param movedRows The moved row pairs\n * @returns The model ranges after translation.\n */\n static getVisibleRanges(\n modelRanges: GridRange[],\n movedColumns: MoveOperation[] = [],\n movedRows: MoveOperation[] = []\n ): GridRange[] {\n const visibleRanges = [];\n for (let i = 0; i < modelRanges.length; i += 1) {\n visibleRanges.push(\n ...GridUtils.getVisibleRange(modelRanges[i], movedColumns, movedRows)\n );\n }\n return visibleRanges;\n }\n\n /**\n * Retrieve the visible index given the currently moved items\n * @param modelIndex The model index to get the visible index for\n * @param movedItems Moved items\n * @returns The visible index of the item\n */\n static getVisibleIndex(\n modelIndex: ModelIndex,\n movedItems: MoveOperation[] = []\n ): VisibleIndex {\n const visibleIndex = GridUtils.applyItemMoves(\n modelIndex,\n modelIndex,\n movedItems\n )[0][0];\n\n return visibleIndex;\n }\n\n /**\n * Check if the current platform is Mac\n * @returns True if this platform is a Mac, false otherwise\n */\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Get the modifier key for the current platform\n * @returns The modifier key for the current platform\n */\n static getModifierKey(): 'metaKey' | 'ctrlKey' {\n if (GridUtils.isMacPlatform()) {\n return 'metaKey';\n }\n\n return 'ctrlKey';\n }\n\n /**\n * Check if the modifier key is down for the given event\n * @param event The event to check\n * @returns True if the modifier key is down, false otherwise\n */\n static isModifierKeyDown(\n event: MouseEvent | KeyboardEvent | React.KeyboardEvent | React.MouseEvent\n ): boolean {\n const modifierKey = GridUtils.getModifierKey();\n return event[modifierKey];\n }\n\n /**\n * Check if the user has hidden the specified column\n * @param modelIndex The model index to check\n * @param userColumnWidths The user set column widths\n * @returns True if the user has hidden the column\n */\n static checkColumnHidden(\n modelIndex: ModelIndex,\n userColumnWidths: ModelSizeMap\n ): boolean {\n return userColumnWidths.get(modelIndex) === 0;\n }\n\n /**\n * Check if all the columns specified are hidden\n * @param columns Columns to check\n * @param userColumnWidths The user set column widths\n * @returns True if the user has hidden all of the columns\n */\n static checkAllColumnsHidden(\n columns: ModelIndex[],\n userColumnWidths: ModelSizeMap\n ): boolean {\n if (userColumnWidths.size === 0) {\n return false;\n }\n return columns.every(column => userColumnWidths.get(column) === 0);\n }\n\n /**\n * Get the bounds the mouse needs to be dragged outside of from an initial selection before scrolling occurs.\n * Taking into account any floating rows that may be covering the viewport.\n * @param metrics Grid metrics\n * @param row The row they started dragging in\n * @param column The column they started the drag from\n * @returns Dimensions of the drag area in relation to the canvas they need to drag outside of to start scrolling\n */\n static getScrollDragBounds(\n metrics: GridMetrics,\n row: GridRangeIndex,\n column: GridRangeIndex\n ): BoxCoordinates {\n const {\n gridX,\n gridY,\n width,\n height,\n floatingTopRowCount,\n floatingBottomRowCount,\n floatingLeftColumnCount,\n floatingRightColumnCount,\n floatingLeftWidth,\n floatingRightWidth,\n floatingTopHeight,\n floatingBottomHeight,\n columnCount,\n rowCount,\n } = metrics;\n let x1 = gridX;\n let y1 = gridY;\n let x2 = width;\n let y2 = height;\n if (column != null) {\n if (column > floatingLeftColumnCount) {\n x1 += floatingLeftWidth;\n }\n if (column < columnCount - floatingRightColumnCount) {\n x2 -= floatingRightWidth;\n }\n }\n\n if (row != null) {\n if (row > floatingTopRowCount) {\n y1 += floatingTopHeight;\n }\n if (row < rowCount - floatingBottomRowCount) {\n y2 -= floatingBottomHeight;\n }\n }\n return { x1, y1, x2, y2 };\n }\n\n /**\n * Converts the delta coordinates from the provided wheel event to pixels\n * Different platforms have different ways of providing the delta so this normalizes it\n * @param wheelEvent The mouse wheel event to get the scrolling delta for\n * @param pageWidth The width of the page that is scrolling\n * @param pageHeight The height of the page that is scrolling\n * @param lineWidth The width of the line scrolling in line mode\n * @param lineHeight The height of the line scrolling in line mode\n * @returns The delta coordinates normalized to pixels\n */\n static getScrollDelta(\n wheelEvent: GridWheelEvent,\n pageWidth = 1024,\n pageHeight = 768,\n lineWidth = 20,\n lineHeight = 20\n ): { deltaX: number; deltaY: number } {\n let { deltaX, deltaY } = wheelEvent;\n\n // Flip scroll direction if shiftKey is held on windows/linux.\n // On mac, deltaX/Y values are switched at the event level when shiftKey=true.\n // Guard on strictly Y only changing, to ignore trackpad diagonal motion,\n // through that guard may not be necessary, but it is difficult to determine for\n // all platforms/browser/scroll method combos.\n if (\n !GridUtils.isMacPlatform() &&\n wheelEvent.shiftKey &&\n wheelEvent.deltaX === 0 &&\n wheelEvent.deltaY !== 0\n ) {\n deltaX = wheelEvent.deltaY;\n deltaY = wheelEvent.deltaX;\n }\n\n // Normalize other deltaMode values to pixel units\n // deltaMode 0, is already in pixel units\n if (wheelEvent?.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n // Users can set OS to be in deltaMode page\n // scrolly by page units as pixels\n deltaX *= pageWidth;\n deltaY *= pageHeight;\n } else if (wheelEvent?.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n // Firefox reports deltaMode line\n // Normalize distance travelled between browsers\n // but remain ~platform/browser combo consistent\n if (GridUtils.isMacPlatform()) {\n // for mac treat lines as a standard row height\n // on mac, firefox travels less distance then chrome per tick\n deltaX = Math.round(deltaX * lineWidth);\n deltaY = Math.round(deltaY * lineHeight);\n } else {\n // for windows convert to pixels using the same method as chrome\n // chrome goes 100 per 3 lines, and firefox would go 102 per 3 (17 lineheight * 3 lines * 2)\n // make the behaviour the same between as it's close enough\n deltaX = Math.round(deltaX * this.PIXELS_PER_LINE);\n deltaY = Math.round(deltaY * this.PIXELS_PER_LINE);\n }\n }\n\n return { deltaX, deltaY };\n }\n}\n\nexport default GridUtils;\n"],"file":"GridUtils.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/grid",
3
- "version": "0.13.2-beta.0+062934a",
3
+ "version": "0.13.2-beta.2+d54359d",
4
4
  "description": "Deephaven React grid component",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  "react": "^17.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@deephaven/tsconfig": "^0.13.2-beta.0+062934a"
36
+ "@deephaven/tsconfig": "^0.13.2-beta.2+d54359d"
37
37
  },
38
38
  "files": [
39
39
  "dist"
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "062934a0e4d8eede6f21802c3b3a4f8c7a66eea6"
53
+ "gitHead": "d54359d08d9ef59e1e8f2c83b9c1e8bc189f748a"
54
54
  }