@leankylin-sheet/core 2.0.1 → 2.0.3

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.esm.js CHANGED
@@ -42903,14 +42903,14 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
42903
42903
  var _measureText3 = getMeasureText(str, renderCtx, sheetCtx);
42904
42904
  var _textWidth = _measureText3.width;
42905
42905
  var _textHeight2 = _measureText3.actualBoundingBoxAscent + _measureText3.actualBoundingBoxDescent;
42906
- var _width = _textWidth * Math.cos(rt * Math.PI / 180) + _textHeight2 * Math.sin(rt * Math.PI / 180);
42906
+ var _width2 = _textWidth * Math.cos(rt * Math.PI / 180) + _textHeight2 * Math.sin(rt * Math.PI / 180);
42907
42907
  var _height = _textWidth * Math.sin(rt * Math.PI / 180) + _textHeight2 * Math.cos(rt * Math.PI / 180);
42908
42908
  var _lastWord = str.substr(str.length - 1, 1);
42909
42909
  if (_lastWord === " " || checkWordByteLength(_lastWord) === 2) {
42910
42910
  spaceOrTwoByte = {
42911
42911
  index: _i5,
42912
42912
  str: str,
42913
- width: _width,
42913
+ width: _width2,
42914
42914
  height: _height,
42915
42915
  asc: _measureText3.actualBoundingBoxAscent,
42916
42916
  desc: _measureText3.actualBoundingBoxDescent
@@ -42975,7 +42975,7 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
42975
42975
  _i5 += 1;
42976
42976
  }
42977
42977
  } else {
42978
- if (_width + space_width > cellWidth && !_.isNil(text_all_split[splitIndex])) {
42978
+ if (_width2 + space_width > cellWidth && !_.isNil(text_all_split[splitIndex])) {
42979
42979
  if (!_.isNil(spaceOrTwoByte) && spaceOrTwoByte.index < _i5) {
42980
42980
  anchor = spaceOrTwoByte.index;
42981
42981
  _i5 = spaceOrTwoByte.index + 1;
@@ -43320,13 +43320,21 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
43320
43320
  if (isMode === "onlyWidth") {
43321
43321
  return textContent;
43322
43322
  }
43323
- var _width2 = textWidthAll;
43323
+ var _width3 = textWidthAll;
43324
43324
  var _height2 = textHeightAll;
43325
43325
  var _left3 = space_width + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43326
43326
  if (horizonAlign === "0") {
43327
- _left3 = cellWidth / 2 - _width2 / 2 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43327
+ var _cell$mc, _cell$mc2;
43328
+ var mcCIndex = cell === null || cell === void 0 ? void 0 : (_cell$mc = cell.mc) === null || _cell$mc === void 0 ? void 0 : _cell$mc.c;
43329
+ var mcCs = cell === null || cell === void 0 ? void 0 : (_cell$mc2 = cell.mc) === null || _cell$mc2 === void 0 ? void 0 : _cell$mc2.cs;
43330
+ var startMc = mcCIndex - 1;
43331
+ var endMc = mcCIndex + mcCs - 1;
43332
+ var startX = sheetCtx.visibledatacolumn[startMc] || 0;
43333
+ var endX = sheetCtx.visibledatacolumn[endMc] || 0;
43334
+ var _width = mcCIndex ? endX - startX : cellWidth;
43335
+ _left3 = _width / 2 - _width3 / 2 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43328
43336
  } else if (horizonAlign === "2") {
43329
- _left3 = cellWidth - space_width - _width2 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43337
+ _left3 = cellWidth - space_width - _width3 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43330
43338
  }
43331
43339
  var _top3 = cellHeight - space_height - _height2 + _measureText4.actualBoundingBoxAscent * Math.cos(_rtPI) + _textWidth2 * Math.sin(_rtPI) * isRotateUp;
43332
43340
  if (verticalAlign === "0") {
@@ -43338,7 +43346,7 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
43338
43346
  var _wordGroup2 = {
43339
43347
  content: value,
43340
43348
  style: fontset,
43341
- width: _width2,
43349
+ width: _width3,
43342
43350
  height: _height2,
43343
43351
  left: _left3,
43344
43352
  top: _top3
@@ -62365,7 +62373,7 @@ var Canvas = /*#__PURE__*/function () {
62365
62373
  _startY2 = this.sheetCtx.visibledatarow[_r2 - 1] - scrollHeight - 1;
62366
62374
  }
62367
62375
  _endY2 = this.sheetCtx.visibledatarow[_r2 + mainCell.mc.rs - 1] - scrollHeight;
62368
- _endX2 = this.sheetCtx.visibledatacolumn[_c2 + mainCell.mc.cs - 1] - scrollWidth;
62376
+ _endX2 = Math.min(this.sheetCtx.visibledatacolumn[_c2 + mainCell.mc.cs - 1] - scrollWidth, drawWidth);
62369
62377
  if (_.isNil(_value3) || _value3.toString().length === 0) {
62370
62378
  this.nullCellRender(_r2, _c2, _startY2, _startX2, _endY2, _endX2, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05, true);
62371
62379
  } else {
@@ -63191,27 +63199,6 @@ var Canvas = /*#__PURE__*/function () {
63191
63199
  value: function drawFreezeLine(_ref2) {
63192
63200
  var horizontalTop = _ref2.horizontalTop,
63193
63201
  verticalLeft = _ref2.verticalLeft;
63194
- var renderCtx = this.canvasElement.getContext("2d");
63195
- if (!renderCtx) return;
63196
- renderCtx.save();
63197
- renderCtx.scale(this.sheetCtx.devicePixelRatio, this.sheetCtx.devicePixelRatio);
63198
- renderCtx.strokeStyle = "#ccc";
63199
- renderCtx.lineWidth = 2;
63200
- if (horizontalTop) {
63201
- renderCtx.beginPath();
63202
- renderCtx.moveTo(0, horizontalTop);
63203
- renderCtx.lineTo(this.canvasElement.width, horizontalTop);
63204
- renderCtx.stroke();
63205
- renderCtx.closePath();
63206
- }
63207
- if (verticalLeft) {
63208
- renderCtx.beginPath();
63209
- renderCtx.moveTo(verticalLeft, 0);
63210
- renderCtx.lineTo(verticalLeft, this.canvasElement.height);
63211
- renderCtx.stroke();
63212
- renderCtx.closePath();
63213
- }
63214
- renderCtx.restore();
63215
63202
  }
63216
63203
  }]);
63217
63204
  }();
package/dist/index.js CHANGED
@@ -42913,14 +42913,14 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
42913
42913
  var _measureText3 = getMeasureText(str, renderCtx, sheetCtx);
42914
42914
  var _textWidth = _measureText3.width;
42915
42915
  var _textHeight2 = _measureText3.actualBoundingBoxAscent + _measureText3.actualBoundingBoxDescent;
42916
- var _width = _textWidth * Math.cos(rt * Math.PI / 180) + _textHeight2 * Math.sin(rt * Math.PI / 180);
42916
+ var _width2 = _textWidth * Math.cos(rt * Math.PI / 180) + _textHeight2 * Math.sin(rt * Math.PI / 180);
42917
42917
  var _height = _textWidth * Math.sin(rt * Math.PI / 180) + _textHeight2 * Math.cos(rt * Math.PI / 180);
42918
42918
  var _lastWord = str.substr(str.length - 1, 1);
42919
42919
  if (_lastWord === " " || checkWordByteLength(_lastWord) === 2) {
42920
42920
  spaceOrTwoByte = {
42921
42921
  index: _i5,
42922
42922
  str: str,
42923
- width: _width,
42923
+ width: _width2,
42924
42924
  height: _height,
42925
42925
  asc: _measureText3.actualBoundingBoxAscent,
42926
42926
  desc: _measureText3.actualBoundingBoxDescent
@@ -42985,7 +42985,7 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
42985
42985
  _i5 += 1;
42986
42986
  }
42987
42987
  } else {
42988
- if (_width + space_width > cellWidth && !___default['default'].isNil(text_all_split[splitIndex])) {
42988
+ if (_width2 + space_width > cellWidth && !___default['default'].isNil(text_all_split[splitIndex])) {
42989
42989
  if (!___default['default'].isNil(spaceOrTwoByte) && spaceOrTwoByte.index < _i5) {
42990
42990
  anchor = spaceOrTwoByte.index;
42991
42991
  _i5 = spaceOrTwoByte.index + 1;
@@ -43330,13 +43330,21 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
43330
43330
  if (isMode === "onlyWidth") {
43331
43331
  return textContent;
43332
43332
  }
43333
- var _width2 = textWidthAll;
43333
+ var _width3 = textWidthAll;
43334
43334
  var _height2 = textHeightAll;
43335
43335
  var _left3 = space_width + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43336
43336
  if (horizonAlign === "0") {
43337
- _left3 = cellWidth / 2 - _width2 / 2 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43337
+ var _cell$mc, _cell$mc2;
43338
+ var mcCIndex = cell === null || cell === void 0 ? void 0 : (_cell$mc = cell.mc) === null || _cell$mc === void 0 ? void 0 : _cell$mc.c;
43339
+ var mcCs = cell === null || cell === void 0 ? void 0 : (_cell$mc2 = cell.mc) === null || _cell$mc2 === void 0 ? void 0 : _cell$mc2.cs;
43340
+ var startMc = mcCIndex - 1;
43341
+ var endMc = mcCIndex + mcCs - 1;
43342
+ var startX = sheetCtx.visibledatacolumn[startMc] || 0;
43343
+ var endX = sheetCtx.visibledatacolumn[endMc] || 0;
43344
+ var _width = mcCIndex ? endX - startX : cellWidth;
43345
+ _left3 = _width / 2 - _width3 / 2 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43338
43346
  } else if (horizonAlign === "2") {
43339
- _left3 = cellWidth - space_width - _width2 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43347
+ _left3 = cellWidth - space_width - _width3 + _textHeight3 * Math.sin(_rtPI) * isRotateUp;
43340
43348
  }
43341
43349
  var _top3 = cellHeight - space_height - _height2 + _measureText4.actualBoundingBoxAscent * Math.cos(_rtPI) + _textWidth2 * Math.sin(_rtPI) * isRotateUp;
43342
43350
  if (verticalAlign === "0") {
@@ -43348,7 +43356,7 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
43348
43356
  var _wordGroup2 = {
43349
43357
  content: value,
43350
43358
  style: fontset,
43351
- width: _width2,
43359
+ width: _width3,
43352
43360
  height: _height2,
43353
43361
  left: _left3,
43354
43362
  top: _top3
@@ -62375,7 +62383,7 @@ var Canvas = /*#__PURE__*/function () {
62375
62383
  _startY2 = this.sheetCtx.visibledatarow[_r2 - 1] - scrollHeight - 1;
62376
62384
  }
62377
62385
  _endY2 = this.sheetCtx.visibledatarow[_r2 + mainCell.mc.rs - 1] - scrollHeight;
62378
- _endX2 = this.sheetCtx.visibledatacolumn[_c2 + mainCell.mc.cs - 1] - scrollWidth;
62386
+ _endX2 = Math.min(this.sheetCtx.visibledatacolumn[_c2 + mainCell.mc.cs - 1] - scrollWidth, drawWidth);
62379
62387
  if (___default['default'].isNil(_value3) || _value3.toString().length === 0) {
62380
62388
  this.nullCellRender(_r2, _c2, _startY2, _startX2, _endY2, _endX2, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05, true);
62381
62389
  } else {
@@ -63201,27 +63209,6 @@ var Canvas = /*#__PURE__*/function () {
63201
63209
  value: function drawFreezeLine(_ref2) {
63202
63210
  var horizontalTop = _ref2.horizontalTop,
63203
63211
  verticalLeft = _ref2.verticalLeft;
63204
- var renderCtx = this.canvasElement.getContext("2d");
63205
- if (!renderCtx) return;
63206
- renderCtx.save();
63207
- renderCtx.scale(this.sheetCtx.devicePixelRatio, this.sheetCtx.devicePixelRatio);
63208
- renderCtx.strokeStyle = "#ccc";
63209
- renderCtx.lineWidth = 2;
63210
- if (horizontalTop) {
63211
- renderCtx.beginPath();
63212
- renderCtx.moveTo(0, horizontalTop);
63213
- renderCtx.lineTo(this.canvasElement.width, horizontalTop);
63214
- renderCtx.stroke();
63215
- renderCtx.closePath();
63216
- }
63217
- if (verticalLeft) {
63218
- renderCtx.beginPath();
63219
- renderCtx.moveTo(verticalLeft, 0);
63220
- renderCtx.lineTo(verticalLeft, this.canvasElement.height);
63221
- renderCtx.stroke();
63222
- renderCtx.closePath();
63223
- }
63224
- renderCtx.restore();
63225
63212
  }
63226
63213
  }]);
63227
63214
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -9,8 +9,11 @@
9
9
  ],
10
10
  "repository": "http://114.55.85.79:19999/leankylin-front/leankylin-sheet",
11
11
  "license": "MIT",
12
+ "scripts": {
13
+ "build": "father-build"
14
+ },
12
15
  "dependencies": {
13
- "@leankylin-sheet/formula-parser": "^2.0.1",
16
+ "@leankylin-sheet/formula-parser": "^2.0.3",
14
17
  "dayjs": "^1.11.0",
15
18
  "immer": "^9.0.12",
16
19
  "lodash": "^4.17.21",
@@ -38,8 +41,5 @@
38
41
  ],
39
42
  "publishConfig": {
40
43
  "access": "public"
41
- },
42
- "scripts": {
43
- "build": "father-build"
44
44
  }
45
- }
45
+ }