sheet-happens 0.0.49 → 0.0.50
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.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +10 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/render.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1203,7 +1203,7 @@ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editD
|
|
|
1203
1203
|
var _getScrollPosition5 = getScrollPosition(e),
|
|
1204
1204
|
currentScroll = _getScrollPosition5[0];
|
|
1205
1205
|
|
|
1206
|
-
var newWidth = Math.max(size + x - anchor + scroll - currentScroll, SIZES.minimumWidth * indices.length);
|
|
1206
|
+
var newWidth = Math.round(Math.max(size + x - anchor + scroll - currentScroll, SIZES.minimumWidth * indices.length));
|
|
1207
1207
|
onInvalidateColumn === null || onInvalidateColumn === void 0 ? void 0 : onInvalidateColumn(indices[0] - 1);
|
|
1208
1208
|
onCellWidthChange(indices, indices.map(function (_) {
|
|
1209
1209
|
return Math.round(newWidth / indices.length);
|
|
@@ -1223,7 +1223,7 @@ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editD
|
|
|
1223
1223
|
var _getScrollPosition6 = getScrollPosition(e),
|
|
1224
1224
|
_currentScroll = _getScrollPosition6[1];
|
|
1225
1225
|
|
|
1226
|
-
var newHeight = Math.max(_size4 + y - _anchor + _scroll4 - _currentScroll, SIZES.minimumHeight * _indices5.length);
|
|
1226
|
+
var newHeight = Math.round(Math.max(_size4 + y - _anchor + _scroll4 - _currentScroll, SIZES.minimumHeight * _indices5.length));
|
|
1227
1227
|
onInvalidateRow === null || onInvalidateRow === void 0 ? void 0 : onInvalidateRow(_indices5[0] - 1);
|
|
1228
1228
|
onCellHeightChange(_indices5, _indices5.map(function (_) {
|
|
1229
1229
|
return newHeight / _indices5.length;
|
|
@@ -1644,6 +1644,7 @@ var useKeyboard = function useKeyboard(arrowKeyCommitMode, overlayRef, cellReadO
|
|
|
1644
1644
|
return;
|
|
1645
1645
|
}
|
|
1646
1646
|
|
|
1647
|
+
if (e.key === 'Enter') e.preventDefault();
|
|
1647
1648
|
onEdit === null || onEdit === void 0 ? void 0 : onEdit(cell, e.key !== 'Enter');
|
|
1648
1649
|
return;
|
|
1649
1650
|
}
|
|
@@ -2845,7 +2846,7 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
|
|
|
2845
2846
|
var clickables = [];
|
|
2846
2847
|
var freeze = [freezeColumns, freezeRows];
|
|
2847
2848
|
var indent = [rowHeaderWidth, columnHeaderHeight];
|
|
2848
|
-
resizeCanvas(canvas);
|
|
2849
|
+
var pixelRatio = resizeCanvas(canvas);
|
|
2849
2850
|
context.clearRect(0, 0, width, height);
|
|
2850
2851
|
context.fillStyle = 'white';
|
|
2851
2852
|
context.fillRect(0, 0, width, height);
|
|
@@ -2990,7 +2991,7 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
|
|
|
2990
2991
|
|
|
2991
2992
|
var _bottom2 = rowToPixel(row, 1);
|
|
2992
2993
|
|
|
2993
|
-
clickables.push.apply(clickables, renderCell(context, content, resolvedStyle, 0, _top2, rowHeaderWidth, _bottom2 - _top2));
|
|
2994
|
+
clickables.push.apply(clickables, renderCell(context, content, resolvedStyle, 0, _top2, rowHeaderWidth, _bottom2 - _top2, pixelRatio));
|
|
2994
2995
|
}
|
|
2995
2996
|
}
|
|
2996
2997
|
|
|
@@ -3020,7 +3021,7 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
|
|
|
3020
3021
|
|
|
3021
3022
|
var _content = (_columnHeaders = columnHeaders(column, _style)) != null ? _columnHeaders : excelHeaderString(column + 1);
|
|
3022
3023
|
|
|
3023
|
-
clickables.push.apply(clickables, renderCell(context, _content, _style, _left2, 0, _right2 - _left2, columnHeaderHeight));
|
|
3024
|
+
clickables.push.apply(clickables, renderCell(context, _content, _style, _left2, 0, _right2 - _left2, columnHeaderHeight, pixelRatio));
|
|
3024
3025
|
}
|
|
3025
3026
|
}
|
|
3026
3027
|
|
|
@@ -3190,14 +3191,14 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
|
|
|
3190
3191
|
var cellContent = displayData(_x, _y, _style2);
|
|
3191
3192
|
|
|
3192
3193
|
if (cellContent !== null && cellContent !== undefined) {
|
|
3193
|
-
clickables.push.apply(clickables, renderCell(context, cellContent, _style2, _left9, _top9, _right10 - _left9, _bottom10 - _top9));
|
|
3194
|
+
clickables.push.apply(clickables, renderCell(context, cellContent, _style2, _left9, _top9, _right10 - _left9, _bottom10 - _top9, pixelRatio));
|
|
3194
3195
|
}
|
|
3195
3196
|
}
|
|
3196
3197
|
}
|
|
3197
3198
|
|
|
3198
3199
|
return clickables;
|
|
3199
3200
|
};
|
|
3200
|
-
var renderCell = function renderCell(context, cellContent, style, xCoord, yCoord, cellWidth, cellHeight) {
|
|
3201
|
+
var renderCell = function renderCell(context, cellContent, style, xCoord, yCoord, cellWidth, cellHeight, pixelRatio) {
|
|
3201
3202
|
var clickables = [];
|
|
3202
3203
|
|
|
3203
3204
|
if (cellContent === null) {
|
|
@@ -3207,7 +3208,7 @@ var renderCell = function renderCell(context, cellContent, style, xCoord, yCoord
|
|
|
3207
3208
|
context.fillStyle = style.color;
|
|
3208
3209
|
context.font = style.weight + ' ' + style.fontSize + 'px ' + style.fontFamily;
|
|
3209
3210
|
context.textAlign = style.textAlign;
|
|
3210
|
-
var yy = Math.
|
|
3211
|
+
var yy = Math.round((yCoord + cellHeight * 0.5) * pixelRatio) / pixelRatio;
|
|
3211
3212
|
context.save();
|
|
3212
3213
|
context.beginPath();
|
|
3213
3214
|
context.rect(xCoord, yCoord, cellWidth, cellHeight);
|
|
@@ -3413,11 +3414,9 @@ var resizeCanvas = function resizeCanvas(canvas) {
|
|
|
3413
3414
|
canvas.height = newCanvasHeight;
|
|
3414
3415
|
context.scale(ratio, ratio);
|
|
3415
3416
|
}
|
|
3416
|
-
|
|
3417
|
-
return true;
|
|
3418
3417
|
}
|
|
3419
3418
|
|
|
3420
|
-
return
|
|
3419
|
+
return ratio;
|
|
3421
3420
|
};
|
|
3422
3421
|
|
|
3423
3422
|
var excelHeaderString = function excelHeaderString(num) {
|