sheet-happens 0.0.17 → 0.0.19

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.
package/dist/index.d.ts CHANGED
@@ -32,9 +32,15 @@ export interface SheetMouseEvent extends MouseEvent {
32
32
  cellX: number;
33
33
  cellY: number;
34
34
  }
35
- export interface SheetProps {
35
+ export interface SheetStyle {
36
+ hideGridlines?: boolean;
37
+ hideColumnHeaders?: boolean;
38
+ hideRowHeaders?: boolean;
36
39
  freezeColumns?: number;
37
40
  freezeRows?: number;
41
+ hideScrollBars?: boolean;
42
+ }
43
+ export interface SheetProps {
38
44
  cellWidth?: RowOrColumnProperty<number>;
39
45
  cellHeight?: RowOrColumnProperty<number>;
40
46
  columnHeaders?: RowOrColumnProperty<CellContentType>;
@@ -45,6 +51,7 @@ export interface SheetProps {
45
51
  displayData?: CellProperty<CellContentType>;
46
52
  editData?: CellProperty<string>;
47
53
  editKeys?: CellProperty<string>;
54
+ sheetStyle?: SheetStyle;
48
55
  inputComponent?: (x: number, y: number, props: SheetInputProps, commitEditingCell?: () => void) => ReactElement | undefined;
49
56
  onSelectionChanged?: (x1: number, y1: number, x2: number, y2: number) => void;
50
57
  onRightClick?: (e: SheetMouseEvent) => void;
package/dist/index.js CHANGED
@@ -71,11 +71,11 @@ var selBackColor = '#e9f0fd';
71
71
  var knobSize = 6;
72
72
  var gridColor = '#e2e3e3';
73
73
  var knobAreaBorderColor = '#707070';
74
- var rowHeaderWidth = 50;
74
+ var kRowHeaderWidth = 50;
75
75
  var rowHeaderBackgroundColor = '#f8f9fa';
76
76
  var rowHeaderTextColor = '#666666';
77
77
  var rowHeaderSelectedBackgroundColor = '#e8eaed';
78
- var columnHeaderHeight = 22;
78
+ var kColumnHeaderHeight = 22;
79
79
  var columnHeaderBackgroundColor = rowHeaderBackgroundColor;
80
80
  var columnHeaderSelectedBackgroundColor = rowHeaderSelectedBackgroundColor;
81
81
  var xBinSize = 10;
@@ -84,7 +84,7 @@ var scrollSpeed = 30;
84
84
  var resizeColumnRowMouseThreshold = 4;
85
85
  var minimumColumnWidth = 50;
86
86
  var minimumRowHeight = 22;
87
- var rowColHeaderSelectionColor = '#AAAAAA';
87
+ var rowColHeaderSelectionColor = '#cccccc';
88
88
  var maxSearchableRowOrCol = 65536;
89
89
  var defaultCellStyle = {
90
90
  textAlign: 'left',
@@ -335,8 +335,8 @@ function absCoordianteToCell(absX, absY, rowSizes, columnSizes) {
335
335
  };
336
336
  }
337
337
 
338
- function cellToAbsCoordinate(cellX, cellY, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight) {
339
- var absX = rowHeaderWidth;
338
+ function cellToAbsCoordinate(cellX, cellY, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle) {
339
+ var absX = sheetStyle.rowHeaderWidth;
340
340
  var indX = columnSizes.index.findIndex(function (i) {
341
341
  return i === cellX;
342
342
  });
@@ -353,7 +353,7 @@ function cellToAbsCoordinate(cellX, cellY, rowSizes, columnSizes, dataOffset, ce
353
353
  }
354
354
  }
355
355
 
356
- var absY = columnHeaderHeight;
356
+ var absY = sheetStyle.columnHeaderHeight;
357
357
  var indY = rowSizes.index.findIndex(function (i) {
358
358
  return i === cellY;
359
359
  });
@@ -503,16 +503,16 @@ function findInDisplayData(displayData, start, direction) {
503
503
  return i;
504
504
  }
505
505
 
506
- function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates) {
506
+ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle) {
507
507
  resizeCanvas(context.canvas);
508
508
  context.clearRect(0, 0, context.canvas.width, context.canvas.height);
509
509
  context.fillStyle = 'white';
510
510
  context.fillRect(0, 0, context.canvas.width, context.canvas.height);
511
- var yCoord1 = columnHeaderHeight;
511
+ var yCoord1 = sheetStyle.columnHeaderHeight;
512
512
 
513
513
  for (var _iterator2 = _createForOfIteratorHelperLoose(rowSizes.index), _step2; !(_step2 = _iterator2()).done;) {
514
514
  var y = _step2.value;
515
- var xCoord1 = rowHeaderWidth;
515
+ var xCoord1 = sheetStyle.rowHeaderWidth;
516
516
 
517
517
  for (var _iterator8 = _createForOfIteratorHelperLoose(columnSizes.index), _step8; !(_step8 = _iterator8()).done;) {
518
518
  var x = _step8.value;
@@ -549,8 +549,8 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
549
549
  var selectionActive = selx1 !== -1 && selx2 !== -1 || sely1 !== -1 && sely2 !== -1;
550
550
  var rowSelectionActive = selx1 === -1 && selx2 === -1 && sely1 !== -1 && sely2 !== -1;
551
551
  var colSelectionActive = selx1 !== -1 && selx2 !== -1 && sely1 === -1 && sely2 === -1;
552
- var p1 = cellToAbsCoordinate(selx1, sely1, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
553
- var p2 = cellToAbsCoordinate(selx2, sely2, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
552
+ var p1 = cellToAbsCoordinate(selx1, sely1, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
553
+ var p2 = cellToAbsCoordinate(selx2, sely2, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
554
554
  p2.x += cellWidth(selx2);
555
555
  p2.y += cellHeight(sely2);
556
556
 
@@ -596,87 +596,119 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
596
596
  }
597
597
  }
598
598
 
599
- context.fillStyle = rowHeaderBackgroundColor;
600
- context.fillRect(0, 0, rowHeaderWidth, context.canvas.height);
599
+ if (!sheetStyle.hideRowHeaders) {
600
+ context.fillStyle = rowHeaderBackgroundColor;
601
+ context.fillRect(0, 0, sheetStyle.rowHeaderWidth, context.canvas.height);
601
602
 
602
- if (selectionActive) {
603
- context.fillStyle = rowHeaderSelectedBackgroundColor;
604
- context.fillRect(0, p1.y, rowHeaderWidth, p2.y - p1.y);
603
+ if (selectionActive) {
604
+ context.fillStyle = rowHeaderSelectedBackgroundColor;
605
+ context.fillRect(0, p1.y, sheetStyle.rowHeaderWidth, p2.y - p1.y);
606
+ }
605
607
  }
606
608
 
607
- context.fillStyle = columnHeaderBackgroundColor;
608
- context.fillRect(0, 0, context.canvas.width, columnHeaderHeight);
609
+ if (!sheetStyle.hideColumnHeaders) {
610
+ context.fillStyle = columnHeaderBackgroundColor;
611
+ context.fillRect(0, 0, context.canvas.width, sheetStyle.columnHeaderHeight);
609
612
 
610
- if (selectionActive) {
611
- context.fillStyle = columnHeaderSelectedBackgroundColor;
612
- context.fillRect(p1.x, 0, p2.x - p1.x, columnHeaderHeight);
613
+ if (selectionActive) {
614
+ context.fillStyle = columnHeaderSelectedBackgroundColor;
615
+ context.fillRect(p1.x, 0, p2.x - p1.x, sheetStyle.columnHeaderHeight);
616
+ }
613
617
  }
614
618
 
615
619
  context.strokeStyle = gridColor;
616
620
  context.lineWidth = 1;
617
- var startX = rowHeaderWidth;
621
+ var startX = sheetStyle.rowHeaderWidth;
622
+ var startY = sheetStyle.columnHeaderHeight;
623
+ var first = true;
624
+ var yGridlineEnd = sheetStyle.hideGridlines ? sheetStyle.columnHeaderHeight : context.canvas.height;
618
625
 
619
626
  for (var _iterator3 = _createForOfIteratorHelperLoose(columnSizes.index), _step3; !(_step3 = _iterator3()).done;) {
620
- var col = _step3.value;
627
+ var _col = _step3.value;
621
628
  context.beginPath();
622
629
  context.moveTo(startX, 0);
623
- context.lineTo(startX, context.canvas.height);
630
+
631
+ if (first) {
632
+ if (!sheetStyle.hideRowHeaders) {
633
+ context.lineTo(startX, context.canvas.height);
634
+ }
635
+
636
+ first = false;
637
+ } else {
638
+ context.lineTo(startX, yGridlineEnd);
639
+ }
640
+
624
641
  context.stroke();
625
- startX += cellWidth(col);
642
+ startX += cellWidth(_col);
626
643
  }
627
644
 
628
- var startY = columnHeaderHeight;
645
+ var xGridlineEnd = sheetStyle.hideGridlines ? sheetStyle.rowHeaderWidth : context.canvas.width;
646
+ first = true;
629
647
 
630
648
  for (var _iterator4 = _createForOfIteratorHelperLoose(rowSizes.index), _step4; !(_step4 = _iterator4()).done;) {
631
- var row = _step4.value;
649
+ var _row = _step4.value;
632
650
  context.beginPath();
633
651
  context.moveTo(0, startY);
634
- context.lineTo(context.canvas.width, startY);
635
- context.stroke();
636
- startY += cellHeight(row);
637
- }
638
652
 
639
- startY = columnHeaderHeight;
640
- context.textBaseline = 'middle';
641
- context.textAlign = 'center';
642
- context.font = defaultCellStyle.fontSize + 'px ' + defaultCellStyle.fontFamily;
643
- context.fillStyle = rowHeaderTextColor;
644
-
645
- for (var _iterator5 = _createForOfIteratorHelperLoose(rowSizes.index), _step5; !(_step5 = _iterator5()).done;) {
646
- var _row = _step5.value;
647
- var cellContent = _row + 1;
648
- var chStyle = {};
649
-
650
- if (rowSelectionActive && sely1 <= _row && sely2 >= _row) {
651
- chStyle = _extends({}, chStyle, {
652
- backgroundColor: rowColHeaderSelectionColor
653
- });
653
+ if (first) {
654
+ if (!sheetStyle.hideColumnHeaders) {
655
+ context.lineTo(context.canvas.width, startY);
656
+ }
657
+
658
+ first = false;
659
+ } else {
660
+ context.lineTo(xGridlineEnd, startY);
654
661
  }
655
662
 
656
- drawCell(context, '' + cellContent, chStyle, defaultColumnHeaderStyle, 0, startY, rowHeaderWidth, cellHeight(_row));
663
+ context.stroke();
657
664
  startY += cellHeight(_row);
658
665
  }
659
666
 
660
- startX = rowHeaderWidth;
661
- context.textBaseline = 'middle';
662
- context.textAlign = 'center';
667
+ if (!sheetStyle.hideRowHeaders) {
668
+ startY = sheetStyle.columnHeaderHeight;
669
+ context.textBaseline = 'middle';
670
+ context.textAlign = 'center';
671
+ context.font = defaultCellStyle.fontSize + 'px ' + defaultCellStyle.fontFamily;
672
+ context.fillStyle = rowHeaderTextColor;
673
+
674
+ for (var _iterator5 = _createForOfIteratorHelperLoose(rowSizes.index), _step5; !(_step5 = _iterator5()).done;) {
675
+ var row = _step5.value;
676
+ var cellContent = row + 1;
677
+ var chStyle = {};
678
+
679
+ if (rowSelectionActive && sely1 <= row && sely2 >= row) {
680
+ chStyle = _extends({}, chStyle, {
681
+ backgroundColor: rowColHeaderSelectionColor
682
+ });
683
+ }
663
684
 
664
- for (var _iterator6 = _createForOfIteratorHelperLoose(columnSizes.index), _step6; !(_step6 = _iterator6()).done;) {
665
- var _col = _step6.value;
666
- var cw = cellWidth(_col);
667
- var ch = columnHeaders(_col);
668
- var chcontent = ch !== null ? ch : excelHeaderString(_col + 1);
685
+ drawCell(context, '' + cellContent, chStyle, defaultColumnHeaderStyle, 0, startY, sheetStyle.rowHeaderWidth, cellHeight(row));
686
+ startY += cellHeight(row);
687
+ }
688
+ }
669
689
 
670
- var _chStyle = columnHeaderStyle(_col);
690
+ if (!sheetStyle.hideColumnHeaders) {
691
+ startX = sheetStyle.rowHeaderWidth;
692
+ context.textBaseline = 'middle';
693
+ context.textAlign = 'center';
671
694
 
672
- if (colSelectionActive && selx1 <= _col && selx2 >= _col) {
673
- _chStyle = _extends({}, _chStyle, {
674
- backgroundColor: rowColHeaderSelectionColor
675
- });
676
- }
695
+ for (var _iterator6 = _createForOfIteratorHelperLoose(columnSizes.index), _step6; !(_step6 = _iterator6()).done;) {
696
+ var col = _step6.value;
697
+ var cw = cellWidth(col);
698
+ var ch = columnHeaders(col);
699
+ var chcontent = ch !== null ? ch : excelHeaderString(col + 1);
700
+
701
+ var _chStyle = columnHeaderStyle(col);
702
+
703
+ if (colSelectionActive && selx1 <= col && selx2 >= col) {
704
+ _chStyle = _extends({}, _chStyle, {
705
+ backgroundColor: rowColHeaderSelectionColor
706
+ });
707
+ }
677
708
 
678
- drawCell(context, chcontent, _chStyle, defaultColumnHeaderStyle, startX, 0, cw, columnHeaderHeight);
679
- startX += cw;
709
+ drawCell(context, chcontent, _chStyle, defaultColumnHeaderStyle, startX, 0, cw, sheetStyle.columnHeaderHeight);
710
+ startX += cw;
711
+ }
680
712
  }
681
713
 
682
714
  if (selectionActive) {
@@ -720,8 +752,8 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
720
752
  ky2 = knobArea.y1;
721
753
  }
722
754
 
723
- var knobPoint1 = cellToAbsCoordinate(kx1, ky1, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
724
- var knobPoint2 = cellToAbsCoordinate(kx2 + 1, ky2 + 1, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
755
+ var knobPoint1 = cellToAbsCoordinate(kx1, ky1, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
756
+ var knobPoint2 = cellToAbsCoordinate(kx2 + 1, ky2 + 1, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
725
757
  context.strokeStyle = knobAreaBorderColor;
726
758
  context.setLineDash([3, 3]);
727
759
  context.lineWidth = 1;
@@ -745,11 +777,11 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
745
777
  }
746
778
 
747
779
  context.textBaseline = 'middle';
748
- var yCoord = columnHeaderHeight;
780
+ var yCoord = sheetStyle.columnHeaderHeight;
749
781
 
750
782
  for (var _iterator7 = _createForOfIteratorHelperLoose(rowSizes.index), _step7; !(_step7 = _iterator7()).done;) {
751
783
  var _y = _step7.value;
752
- var xCoord = rowHeaderWidth;
784
+ var xCoord = sheetStyle.rowHeaderWidth;
753
785
 
754
786
  var _ch = cellHeight(_y);
755
787
 
@@ -774,7 +806,7 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
774
806
  }
775
807
 
776
808
  function Sheet(props) {
777
- var _props$inputComponent;
809
+ var _props$sheetStyle9, _props$sheetStyle10, _props$sheetStyle11, _props$sheetStyle12, _props$sheetStyle13, _props$sheetStyle14, _props$inputComponent;
778
810
 
779
811
  var canvasRef = React.useRef(null);
780
812
  var overlayRef = React.useRef(null);
@@ -875,8 +907,6 @@ function Sheet(props) {
875
907
  _useResizeObserver$he = _useResizeObserver.height,
876
908
  canvasHeight = _useResizeObserver$he === void 0 ? 3000 : _useResizeObserver$he;
877
909
 
878
- var freezeColumns = props.freezeColumns || 0;
879
- var freezeRows = props.freezeRows || 0;
880
910
  var cellWidth = React.useMemo(function () {
881
911
  return createRowOrColumnPropFunction(props.cellWidth, 100);
882
912
  }, [props.cellWidth]);
@@ -907,6 +937,20 @@ function Sheet(props) {
907
937
  var cellStyle = React.useMemo(function () {
908
938
  return createCellPropFunction(props.cellStyle, defaultCellStyle);
909
939
  }, [props.cellStyle]);
940
+ var sheetStyle = React.useMemo(function () {
941
+ var _props$sheetStyle, _props$sheetStyle2, _props$sheetStyle3, _props$sheetStyle4, _props$sheetStyle5, _props$sheetStyle6, _props$sheetStyle7, _props$sheetStyle8;
942
+
943
+ return {
944
+ freezeColumns: ((_props$sheetStyle = props.sheetStyle) === null || _props$sheetStyle === void 0 ? void 0 : _props$sheetStyle.freezeColumns) || 0,
945
+ freezeRows: ((_props$sheetStyle2 = props.sheetStyle) === null || _props$sheetStyle2 === void 0 ? void 0 : _props$sheetStyle2.freezeRows) || 0,
946
+ hideColumnHeaders: ((_props$sheetStyle3 = props.sheetStyle) === null || _props$sheetStyle3 === void 0 ? void 0 : _props$sheetStyle3.hideColumnHeaders) || false,
947
+ hideRowHeaders: ((_props$sheetStyle4 = props.sheetStyle) === null || _props$sheetStyle4 === void 0 ? void 0 : _props$sheetStyle4.hideRowHeaders) || false,
948
+ hideGridlines: ((_props$sheetStyle5 = props.sheetStyle) === null || _props$sheetStyle5 === void 0 ? void 0 : _props$sheetStyle5.hideGridlines) || false,
949
+ columnHeaderHeight: (_props$sheetStyle6 = props.sheetStyle) !== null && _props$sheetStyle6 !== void 0 && _props$sheetStyle6.hideColumnHeaders ? 1 : kColumnHeaderHeight,
950
+ rowHeaderWidth: (_props$sheetStyle7 = props.sheetStyle) !== null && _props$sheetStyle7 !== void 0 && _props$sheetStyle7.hideRowHeaders ? 1 : kRowHeaderWidth,
951
+ hideScrollBars: ((_props$sheetStyle8 = props.sheetStyle) === null || _props$sheetStyle8 === void 0 ? void 0 : _props$sheetStyle8.hideScrollBars) || false
952
+ };
953
+ }, [(_props$sheetStyle9 = props.sheetStyle) === null || _props$sheetStyle9 === void 0 ? void 0 : _props$sheetStyle9.freezeColumns, (_props$sheetStyle10 = props.sheetStyle) === null || _props$sheetStyle10 === void 0 ? void 0 : _props$sheetStyle10.freezeRows, (_props$sheetStyle11 = props.sheetStyle) === null || _props$sheetStyle11 === void 0 ? void 0 : _props$sheetStyle11.hideColumnHeaders, (_props$sheetStyle12 = props.sheetStyle) === null || _props$sheetStyle12 === void 0 ? void 0 : _props$sheetStyle12.hideGridlines, (_props$sheetStyle13 = props.sheetStyle) === null || _props$sheetStyle13 === void 0 ? void 0 : _props$sheetStyle13.hideRowHeaders, (_props$sheetStyle14 = props.sheetStyle) === null || _props$sheetStyle14 === void 0 ? void 0 : _props$sheetStyle14.hideScrollBars]);
910
954
  React.useEffect(function () {
911
955
  var currEditKey = editKeys ? editKeys(editCell.x, editCell.y) : '';
912
956
 
@@ -919,11 +963,11 @@ function Sheet(props) {
919
963
  }
920
964
  }, [editKeys]);
921
965
  var columnSizes = React.useMemo(function () {
922
- return calculateRowsOrColsSizes(freezeColumns, cellWidth, rowHeaderWidth, dataOffset.x, canvasWidth);
923
- }, [props.freezeColumns, cellWidth, dataOffset.x, canvasWidth]);
966
+ return calculateRowsOrColsSizes(sheetStyle.freezeColumns, cellWidth, sheetStyle.rowHeaderWidth, dataOffset.x, canvasWidth);
967
+ }, [sheetStyle, cellWidth, dataOffset.x, canvasWidth]);
924
968
  var rowSizes = React.useMemo(function () {
925
- return calculateRowsOrColsSizes(freezeRows, cellHeight, columnHeaderHeight, dataOffset.y, canvasHeight);
926
- }, [props.freezeRows, cellHeight, dataOffset.y, canvasHeight]);
969
+ return calculateRowsOrColsSizes(sheetStyle.freezeRows, cellHeight, sheetStyle.columnHeaderHeight, dataOffset.y, canvasHeight);
970
+ }, [sheetStyle, cellHeight, dataOffset.y, canvasHeight]);
927
971
 
928
972
  var changeSelection = function changeSelection(x1, y1, x2, y2, scrollToP2) {
929
973
  if (scrollToP2 === void 0) {
@@ -949,7 +993,7 @@ function Sheet(props) {
949
993
 
950
994
  if (x2 !== -1 && (!columnSizes.index.includes(x2) || columnSizes.index[columnSizes.index.length - 1] === x2)) {
951
995
  var lastVisibleColumnIndex = columnSizes.index[columnSizes.index.length - 1];
952
- var firstVisibleColumnIndex = columnSizes.index[freezeColumns];
996
+ var firstVisibleColumnIndex = columnSizes.index[sheetStyle.freezeColumns];
953
997
  var increment = 0;
954
998
 
955
999
  if (x2 >= lastVisibleColumnIndex) {
@@ -958,13 +1002,13 @@ function Sheet(props) {
958
1002
  increment = x2 - firstVisibleColumnIndex;
959
1003
  }
960
1004
 
961
- var newX = Math.max(dataOffset.x, freezeColumns) + increment;
1005
+ var newX = Math.max(dataOffset.x, sheetStyle.freezeColumns) + increment;
962
1006
  newDataOffset.x = newX;
963
1007
  newScrollLeft = newX * scrollSpeed;
964
1008
  }
965
1009
 
966
1010
  if (y2 !== -1 && (!rowSizes.index.includes(y2) || rowSizes.index[rowSizes.index.length - 1] === y2)) {
967
- var firstVisibleRowIndex = rowSizes.index[freezeRows];
1011
+ var firstVisibleRowIndex = rowSizes.index[sheetStyle.freezeRows];
968
1012
  var lastVisibleRowIndex = rowSizes.index[rowSizes.index.length - 1];
969
1013
  var _increment = 0;
970
1014
 
@@ -974,7 +1018,7 @@ function Sheet(props) {
974
1018
  _increment = y2 - firstVisibleRowIndex;
975
1019
  }
976
1020
 
977
- var newY = Math.max(dataOffset.y, freezeRows) + _increment;
1021
+ var newY = Math.max(dataOffset.y, sheetStyle.freezeRows) + _increment;
978
1022
 
979
1023
  newDataOffset.y = newY;
980
1024
  newScrollTop = newY * scrollSpeed;
@@ -1033,7 +1077,7 @@ function Sheet(props) {
1033
1077
  sely2 = selection.y1;
1034
1078
  }
1035
1079
 
1036
- var c = cellToAbsCoordinate(0, sely2, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
1080
+ var c = cellToAbsCoordinate(0, sely2, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
1037
1081
  return {
1038
1082
  x: c.x + knobSize * 0.5,
1039
1083
  y: c.y + cellHeight(sely2)
@@ -1047,7 +1091,7 @@ function Sheet(props) {
1047
1091
  selx2 = selection.x1;
1048
1092
  }
1049
1093
 
1050
- var _c = cellToAbsCoordinate(selx2, 0, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
1094
+ var _c = cellToAbsCoordinate(selx2, 0, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
1051
1095
 
1052
1096
  return {
1053
1097
  x: _c.x + cellWidth(selx2),
@@ -1068,7 +1112,7 @@ function Sheet(props) {
1068
1112
  _sely = selection.y1;
1069
1113
  }
1070
1114
 
1071
- var _c2 = cellToAbsCoordinate(_selx, _sely, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
1115
+ var _c2 = cellToAbsCoordinate(_selx, _sely, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
1072
1116
 
1073
1117
  return {
1074
1118
  x: _c2.x + cellWidth(_selx),
@@ -1080,7 +1124,7 @@ function Sheet(props) {
1080
1124
  x: -1,
1081
1125
  y: -1
1082
1126
  };
1083
- }, [selection, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight]);
1127
+ }, [selection, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle]);
1084
1128
  var hitMap = React.useMemo(function () {
1085
1129
  var hitM = {};
1086
1130
  var canvas = canvasRef.current;
@@ -1090,8 +1134,8 @@ function Sheet(props) {
1090
1134
  }
1091
1135
 
1092
1136
  resizeCanvas(canvas);
1093
- var yCoord = columnHeaderHeight;
1094
- var xCoord = rowHeaderWidth;
1137
+ var yCoord = sheetStyle.columnHeaderHeight;
1138
+ var xCoord = sheetStyle.rowHeaderWidth;
1095
1139
 
1096
1140
  for (var _iterator10 = _createForOfIteratorHelperLoose(columnSizes.index), _step10; !(_step10 = _iterator10()).done;) {
1097
1141
  var x = _step10.value;
@@ -1111,7 +1155,7 @@ function Sheet(props) {
1111
1155
 
1112
1156
  var w = obj.content instanceof HTMLImageElement ? obj.width || cellW : 0;
1113
1157
  var absX1 = applyAlignment(xCoord, cellW, finalStyle, w, obj.horiozntalAlign) + obj.x;
1114
- var absY1 = columnHeaderHeight * 0.5 + obj.y;
1158
+ var absY1 = sheetStyle.columnHeaderHeight * 0.5 + obj.y;
1115
1159
  var absX2 = absX1 + (obj.width || 0);
1116
1160
  var absY2 = absY1 + (obj.height || 0);
1117
1161
  var hitTarget = {
@@ -1150,7 +1194,7 @@ function Sheet(props) {
1150
1194
 
1151
1195
  for (var _iterator11 = _createForOfIteratorHelperLoose(rowSizes.index), _step11; !(_step11 = _iterator11()).done;) {
1152
1196
  var y = _step11.value;
1153
- xCoord = rowHeaderWidth;
1197
+ xCoord = sheetStyle.rowHeaderWidth;
1154
1198
 
1155
1199
  for (var _iterator13 = _createForOfIteratorHelperLoose(columnSizes.index), _step13; !(_step13 = _iterator13()).done;) {
1156
1200
  var _x2 = _step13.value;
@@ -1229,7 +1273,7 @@ function Sheet(props) {
1229
1273
  }
1230
1274
 
1231
1275
  return hitM;
1232
- }, [displayData, props.cellWidth, props.cellHeight, canvasRef, columnSizes, rowSizes, dataOffset.x, dataOffset.y]);
1276
+ }, [displayData, props.cellWidth, props.cellHeight, canvasRef, columnSizes, rowSizes, dataOffset.x, dataOffset.y, sheetStyle]);
1233
1277
  React.useEffect(function () {
1234
1278
  var canvas = canvasRef.current;
1235
1279
 
@@ -1244,12 +1288,12 @@ function Sheet(props) {
1244
1288
  }
1245
1289
 
1246
1290
  var animationFrameId = window.requestAnimationFrame(function () {
1247
- renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates);
1291
+ renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle);
1248
1292
  });
1249
1293
  return function () {
1250
1294
  window.cancelAnimationFrame(animationFrameId);
1251
1295
  };
1252
- }, [canvasRef, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates]);
1296
+ }, [canvasRef, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle]);
1253
1297
 
1254
1298
  var setFocusToTextArea = function setFocusToTextArea() {
1255
1299
  if (copyPasteTextAreaRef.current) {
@@ -1651,7 +1695,7 @@ function Sheet(props) {
1651
1695
  }
1652
1696
  }
1653
1697
 
1654
- if (y < columnHeaderHeight) {
1698
+ if (!sheetStyle.hideColumnHeaders && y < sheetStyle.columnHeaderHeight) {
1655
1699
  for (var colIdx = 0; colIdx < columnSizes.index.length; colIdx++) {
1656
1700
  var start = columnSizes.start[colIdx];
1657
1701
  var end = columnSizes.end[colIdx];
@@ -1684,7 +1728,7 @@ function Sheet(props) {
1684
1728
  }
1685
1729
  }
1686
1730
 
1687
- if (x < rowHeaderWidth) {
1731
+ if (!sheetStyle.hideRowHeaders && x < sheetStyle.rowHeaderWidth) {
1688
1732
  for (var rowIdx = 0; rowIdx < rowSizes.index.length; rowIdx++) {
1689
1733
  var _start = rowSizes.start[rowIdx];
1690
1734
  var _end = rowSizes.end[rowIdx];
@@ -1741,7 +1785,7 @@ function Sheet(props) {
1741
1785
 
1742
1786
  var scrollToP2 = true;
1743
1787
 
1744
- if (x < rowHeaderWidth) {
1788
+ if (!sheetStyle.hideRowHeaders && x < sheetStyle.rowHeaderWidth) {
1745
1789
  scrollToP2 = false;
1746
1790
  setRowSelectionInProgress(true);
1747
1791
  sel1.x = -1;
@@ -1750,7 +1794,7 @@ function Sheet(props) {
1750
1794
  setRowSelectionInProgress(false);
1751
1795
  }
1752
1796
 
1753
- if (y < columnHeaderHeight) {
1797
+ if (!sheetStyle.hideColumnHeaders && y < sheetStyle.columnHeaderHeight) {
1754
1798
  scrollToP2 = false;
1755
1799
  setColumnSelectionInProgress(true);
1756
1800
  sel1.y = -1;
@@ -1942,8 +1986,8 @@ function Sheet(props) {
1942
1986
  }
1943
1987
  }
1944
1988
 
1945
- if (props.onCellWidthChange && y < columnHeaderHeight) {
1946
- var xx = rowHeaderWidth;
1989
+ if (!sheetStyle.hideColumnHeaders && props.onCellWidthChange && y < sheetStyle.columnHeaderHeight) {
1990
+ var xx = sheetStyle.rowHeaderWidth;
1947
1991
 
1948
1992
  for (var _iterator21 = _createForOfIteratorHelperLoose(columnSizes.index), _step21; !(_step21 = _iterator21()).done;) {
1949
1993
  var col = _step21.value;
@@ -1957,8 +2001,8 @@ function Sheet(props) {
1957
2001
  }
1958
2002
  }
1959
2003
 
1960
- if (props.onCellHeightChange && x < rowHeaderWidth) {
1961
- var yy = columnHeaderHeight;
2004
+ if (!sheetStyle.hideRowHeaders && props.onCellHeightChange && x < sheetStyle.rowHeaderWidth) {
2005
+ var yy = sheetStyle.columnHeaderHeight;
1962
2006
 
1963
2007
  for (var _iterator22 = _createForOfIteratorHelperLoose(rowSizes.index), _step22; !(_step22 = _iterator22()).done;) {
1964
2008
  var row = _step22.value;
@@ -2302,7 +2346,7 @@ function Sheet(props) {
2302
2346
  y2 = _ref2[1];
2303
2347
  }
2304
2348
 
2305
- if (!(y > columnHeaderHeight && x > rowHeaderWidth)) {
2349
+ if (!(y > sheetStyle.columnHeaderHeight && x > sheetStyle.rowHeaderWidth)) {
2306
2350
  return;
2307
2351
  }
2308
2352
 
@@ -2330,7 +2374,7 @@ function Sheet(props) {
2330
2374
  var editTextTextAlign = 'right';
2331
2375
 
2332
2376
  if (editMode) {
2333
- editTextPosition = cellToAbsCoordinate(editCell.x, editCell.y, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight);
2377
+ editTextPosition = cellToAbsCoordinate(editCell.x, editCell.y, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
2334
2378
  var style = cellStyle(editCell.x, editCell.y);
2335
2379
  editTextPosition.x += 1;
2336
2380
  editTextPosition.y += 1;
@@ -2360,17 +2404,36 @@ function Sheet(props) {
2360
2404
  var input = (_props$inputComponent = props.inputComponent) === null || _props$inputComponent === void 0 ? void 0 : _props$inputComponent.call(props, editCell.x, editCell.y, _extends({}, inputProps, {
2361
2405
  onChange: setEditValue
2362
2406
  }), commitEditingCell);
2407
+ var overlayDivClassName = styles.sheetscroll;
2408
+ var overlayDivStyles = {
2409
+ position: 'absolute',
2410
+ width: '100%',
2411
+ height: '100%',
2412
+ top: 0,
2413
+ left: 0,
2414
+ overflow: 'scroll',
2415
+ borderBottom: '1px solid #ddd'
2416
+ };
2417
+ var canvasStyles = {
2418
+ width: 'calc(100% - 14px)',
2419
+ height: 'calc(100% - 15px)',
2420
+ outline: '1px solid #ddd'
2421
+ };
2422
+
2423
+ if (sheetStyle.hideScrollBars) {
2424
+ delete canvasStyles['outline'];
2425
+ delete overlayDivStyles['borderBottom'];
2426
+ overlayDivClassName = '';
2427
+ canvasStyles.width = 'calc(100%)';
2428
+ }
2429
+
2363
2430
  return React__default.createElement("div", {
2364
2431
  style: {
2365
2432
  position: 'relative',
2366
2433
  height: '100%'
2367
2434
  }
2368
2435
  }, React__default.createElement("canvas", {
2369
- style: {
2370
- width: 'calc(100% - 14px)',
2371
- height: 'calc(100% - 15px)',
2372
- outline: '1px solid #ddd'
2373
- },
2436
+ style: canvasStyles,
2374
2437
  ref: canvasRef
2375
2438
  }), React__default.createElement("div", {
2376
2439
  ref: overlayRef,
@@ -2380,16 +2443,8 @@ function Sheet(props) {
2380
2443
  onMouseLeave: onMouseLeave,
2381
2444
  onContextMenu: onContextMenu,
2382
2445
  onScroll: onScroll,
2383
- className: styles.sheetscroll,
2384
- style: {
2385
- position: 'absolute',
2386
- width: '100%',
2387
- height: '100%',
2388
- top: 0,
2389
- left: 0,
2390
- overflow: 'scroll',
2391
- borderBottom: '1px solid #ddd'
2392
- }
2446
+ className: overlayDivClassName,
2447
+ style: overlayDivStyles
2393
2448
  }, React__default.createElement("div", {
2394
2449
  style: {
2395
2450
  position: 'absolute',