@leankylin-sheet/core 2.0.2 → 2.0.4

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
@@ -45083,25 +45091,20 @@ var intThousands = function intThousands(number) {
45083
45091
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45084
45092
  return String(number).replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
45085
45093
  };
45086
- var numberThousands = function numberThousands(number) {
45094
+ var numberThousands = function numberThousands(num) {
45087
45095
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45088
45096
  var precision = arguments.length > 2 ? arguments[2] : undefined;
45089
- if (number === 0) return '0';
45090
- if (!number) return number;
45091
- var _number = !['', undefined].includes(precision) ? formatNumber(number, precision) : number;
45092
- if (String(_number).includes('.')) {
45093
- var _String$split = String(_number).split('.'),
45094
- _String$split2 = _slicedToArray(_String$split, 2),
45095
- init = _String$split2[0],
45096
- decimal = _String$split2[1];
45097
+ var number = Number(num).toFixed(precision);
45098
+ var _String$split = String(number).split('.'),
45099
+ _String$split2 = _slicedToArray(_String$split, 2),
45100
+ init = _String$split2[0],
45101
+ decimal = _String$split2[1];
45102
+ if (precision) {
45097
45103
  return intThousands(init, groupSeparator) + '.' + decimal;
45098
45104
  } else {
45099
- return intThousands(_number, groupSeparator);
45105
+ return intThousands(init, groupSeparator);
45100
45106
  }
45101
45107
  };
45102
- function formatNumber(num, precision) {
45103
- return parseFloat(Number(num).toFixed(precision));
45104
- }
45105
45108
 
45106
45109
  var base1904 = new Date(1900, 2, 1, 0, 0, 0);
45107
45110
  function datenum_local(v, date1904) {
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
@@ -45093,25 +45101,20 @@ var intThousands = function intThousands(number) {
45093
45101
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45094
45102
  return String(number).replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
45095
45103
  };
45096
- var numberThousands = function numberThousands(number) {
45104
+ var numberThousands = function numberThousands(num) {
45097
45105
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45098
45106
  var precision = arguments.length > 2 ? arguments[2] : undefined;
45099
- if (number === 0) return '0';
45100
- if (!number) return number;
45101
- var _number = !['', undefined].includes(precision) ? formatNumber(number, precision) : number;
45102
- if (String(_number).includes('.')) {
45103
- var _String$split = String(_number).split('.'),
45104
- _String$split2 = _slicedToArray(_String$split, 2),
45105
- init = _String$split2[0],
45106
- decimal = _String$split2[1];
45107
+ var number = Number(num).toFixed(precision);
45108
+ var _String$split = String(number).split('.'),
45109
+ _String$split2 = _slicedToArray(_String$split, 2),
45110
+ init = _String$split2[0],
45111
+ decimal = _String$split2[1];
45112
+ if (precision) {
45107
45113
  return intThousands(init, groupSeparator) + '.' + decimal;
45108
45114
  } else {
45109
- return intThousands(_number, groupSeparator);
45115
+ return intThousands(init, groupSeparator);
45110
45116
  }
45111
45117
  };
45112
- function formatNumber(num, precision) {
45113
- return parseFloat(Number(num).toFixed(precision));
45114
- }
45115
45118
 
45116
45119
  var base1904 = new Date(1900, 2, 1, 0, 0, 0);
45117
45120
  function datenum_local(v, date1904) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
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.2",
16
+ "@leankylin-sheet/formula-parser": "^2.0.4",
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
+ }