@leankylin-sheet/core 2.0.3 → 2.0.5

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/canvas.d.ts CHANGED
@@ -27,6 +27,7 @@ export declare class Canvas {
27
27
  }): void;
28
28
  getCellOverflowMap(canvas: CanvasRenderingContext2D, colStart: number, colEnd: number, rowStart: number, rowEnd: number): any;
29
29
  nullCellRender(r: number, c: number, startY: number, startX: number, endY: number, endX: number, renderCtx: CanvasRenderingContext2D, afCompute: any, cfCompute: any, offsetLeft: number, offsetTop: number, dynamicArrayCompute: any, cellOverflowMap: any, colStart: number, colEnd: number, scrollHeight: number, scrollWidth: number, bodrder05: any, isMerge?: boolean): void;
30
+ renderLyFlag(renderCtx: CanvasRenderingContext2D, cell: any, startY: number, endX: number, offsetLeft: number, offsetTop: number): void;
30
31
  cellRender(r: number, c: number, startY: number, startX: number, endY: number, endX: number, value: any, renderCtx: CanvasRenderingContext2D, afCompute: any, cfCompute: any, offsetLeft: number, offsetTop: number, dynamicArrayCompute: any, cellOverflowMap: any, colStart: number, colEnd: number, scrollHeight: number, scrollWidth: number, bodrder05: number, isMerge?: boolean): void;
31
32
  cellOverflowRender(r: number, c: number, stc: number, edc: number, renderCtx: CanvasRenderingContext2D, scrollHeight: number, scrollWidth: number, offsetLeft: number, offsetTop: number, afCompute: any, cfCompute: any): void;
32
33
  cellOverflow_trace(r: number, curC: number, traceC: number, traceDir: string, horizonAlign: string, textMetrics: number): any;
package/dist/index.esm.js CHANGED
@@ -45091,25 +45091,20 @@ var intThousands = function intThousands(number) {
45091
45091
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45092
45092
  return String(number).replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
45093
45093
  };
45094
- var numberThousands = function numberThousands(number) {
45094
+ var numberThousands = function numberThousands(num) {
45095
45095
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45096
45096
  var precision = arguments.length > 2 ? arguments[2] : undefined;
45097
- if (number === 0) return '0';
45098
- if (!number) return number;
45099
- var _number = !['', undefined].includes(precision) ? formatNumber(number, precision) : number;
45100
- if (String(_number).includes('.')) {
45101
- var _String$split = String(_number).split('.'),
45102
- _String$split2 = _slicedToArray(_String$split, 2),
45103
- init = _String$split2[0],
45104
- 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) {
45105
45103
  return intThousands(init, groupSeparator) + '.' + decimal;
45106
45104
  } else {
45107
- return intThousands(_number, groupSeparator);
45105
+ return intThousands(init, groupSeparator);
45108
45106
  }
45109
45107
  };
45110
- function formatNumber(num, precision) {
45111
- return parseFloat(Number(num).toFixed(precision));
45112
- }
45113
45108
 
45114
45109
  var base1904 = new Date(1900, 2, 1, 0, 0, 0);
45115
45110
  function datenum_local(v, date1904) {
@@ -62597,7 +62592,7 @@ var Canvas = /*#__PURE__*/function () {
62597
62592
  }, {
62598
62593
  key: "nullCellRender",
62599
62594
  value: function nullCellRender(r, c, startY, startX, endY, endX, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
62600
- var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r2$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62595
+ var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r3$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62601
62596
  var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
62602
62597
  var checksCF = checkCF(r, c, cfCompute);
62603
62598
  var flowdata = getFlowdata(this.sheetCtx);
@@ -62634,7 +62629,8 @@ var Canvas = /*#__PURE__*/function () {
62634
62629
  renderCtx.textBaseline = "bottom";
62635
62630
  renderCtx.fillText(_.isNil(value) ? "" : value, horizonAlignPos, verticalAlignPos);
62636
62631
  }
62637
- if (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : (_flowdata$r2$c = _flowdata$r2[c]) === null || _flowdata$r2$c === void 0 ? void 0 : _flowdata$r2$c.ps) {
62632
+ this.renderLyFlag(renderCtx, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : _flowdata$r2[c], startY, endX, offsetLeft, offsetTop);
62633
+ if (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : (_flowdata$r3$c = _flowdata$r3[c]) === null || _flowdata$r3$c === void 0 ? void 0 : _flowdata$r3$c.ps) {
62638
62634
  var ps_w = 8 * this.sheetCtx.zoomRatio;
62639
62635
  var ps_h = 8 * this.sheetCtx.zoomRatio;
62640
62636
  renderCtx.beginPath();
@@ -62678,10 +62674,27 @@ var Canvas = /*#__PURE__*/function () {
62678
62674
  endX: cellsize[2] + cellsize[0]
62679
62675
  }, renderCtx);
62680
62676
  }
62677
+ }, {
62678
+ key: "renderLyFlag",
62679
+ value: function renderLyFlag(renderCtx, cell, startY, endX, offsetLeft, offsetTop) {
62680
+ var lyFlagColor = cell === null || cell === void 0 ? void 0 : cell.lyFlagColor;
62681
+ if (!lyFlagColor) {
62682
+ return;
62683
+ }
62684
+ var ps_w = 8 * this.sheetCtx.zoomRatio;
62685
+ var ps_h = 8 * this.sheetCtx.zoomRatio;
62686
+ renderCtx.beginPath();
62687
+ renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
62688
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
62689
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
62690
+ renderCtx.fillStyle = lyFlagColor;
62691
+ renderCtx.fill();
62692
+ renderCtx.closePath();
62693
+ }
62681
62694
  }, {
62682
62695
  key: "cellRender",
62683
62696
  value: function cellRender(r, c, startY, startX, endY, endX, value, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
62684
- var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8, _dataVerification, _this$sheetCtx$hooks$9, _this$sheetCtx$hooks9, _flowdata$r3;
62697
+ var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8, _dataVerification, _this$sheetCtx$hooks$9, _this$sheetCtx$hooks9, _flowdata$r4;
62685
62698
  var isMerge = arguments.length > 19 && arguments[19] !== undefined ? arguments[19] : false;
62686
62699
  var flowdata = getFlowdata(this.sheetCtx);
62687
62700
  if (!flowdata) {
@@ -62731,6 +62744,7 @@ var Canvas = /*#__PURE__*/function () {
62731
62744
  renderCtx.fill();
62732
62745
  renderCtx.closePath();
62733
62746
  }
62747
+ this.renderLyFlag(renderCtx, cell, startY, endX, offsetLeft, offsetTop);
62734
62748
  if (cell === null || cell === void 0 ? void 0 : cell.ps) {
62735
62749
  var ps_w = 8 * this.sheetCtx.zoomRatio;
62736
62750
  var ps_h = 8 * this.sheetCtx.zoomRatio;
@@ -62956,7 +62970,7 @@ var Canvas = /*#__PURE__*/function () {
62956
62970
  renderCtx.stroke();
62957
62971
  renderCtx.closePath();
62958
62972
  }
62959
- (_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : _flowdata$r3[c], {
62973
+ (_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c], {
62960
62974
  row: r,
62961
62975
  column: c,
62962
62976
  startX: cellsize[0],
package/dist/index.js CHANGED
@@ -45101,25 +45101,20 @@ var intThousands = function intThousands(number) {
45101
45101
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45102
45102
  return String(number).replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
45103
45103
  };
45104
- var numberThousands = function numberThousands(number) {
45104
+ var numberThousands = function numberThousands(num) {
45105
45105
  var groupSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45106
45106
  var precision = arguments.length > 2 ? arguments[2] : undefined;
45107
- if (number === 0) return '0';
45108
- if (!number) return number;
45109
- var _number = !['', undefined].includes(precision) ? formatNumber(number, precision) : number;
45110
- if (String(_number).includes('.')) {
45111
- var _String$split = String(_number).split('.'),
45112
- _String$split2 = _slicedToArray(_String$split, 2),
45113
- init = _String$split2[0],
45114
- 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) {
45115
45113
  return intThousands(init, groupSeparator) + '.' + decimal;
45116
45114
  } else {
45117
- return intThousands(_number, groupSeparator);
45115
+ return intThousands(init, groupSeparator);
45118
45116
  }
45119
45117
  };
45120
- function formatNumber(num, precision) {
45121
- return parseFloat(Number(num).toFixed(precision));
45122
- }
45123
45118
 
45124
45119
  var base1904 = new Date(1900, 2, 1, 0, 0, 0);
45125
45120
  function datenum_local(v, date1904) {
@@ -62607,7 +62602,7 @@ var Canvas = /*#__PURE__*/function () {
62607
62602
  }, {
62608
62603
  key: "nullCellRender",
62609
62604
  value: function nullCellRender(r, c, startY, startX, endY, endX, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
62610
- var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r2$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62605
+ var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r3$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62611
62606
  var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
62612
62607
  var checksCF = checkCF(r, c, cfCompute);
62613
62608
  var flowdata = getFlowdata(this.sheetCtx);
@@ -62644,7 +62639,8 @@ var Canvas = /*#__PURE__*/function () {
62644
62639
  renderCtx.textBaseline = "bottom";
62645
62640
  renderCtx.fillText(___default['default'].isNil(value) ? "" : value, horizonAlignPos, verticalAlignPos);
62646
62641
  }
62647
- if (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : (_flowdata$r2$c = _flowdata$r2[c]) === null || _flowdata$r2$c === void 0 ? void 0 : _flowdata$r2$c.ps) {
62642
+ this.renderLyFlag(renderCtx, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : _flowdata$r2[c], startY, endX, offsetLeft, offsetTop);
62643
+ if (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : (_flowdata$r3$c = _flowdata$r3[c]) === null || _flowdata$r3$c === void 0 ? void 0 : _flowdata$r3$c.ps) {
62648
62644
  var ps_w = 8 * this.sheetCtx.zoomRatio;
62649
62645
  var ps_h = 8 * this.sheetCtx.zoomRatio;
62650
62646
  renderCtx.beginPath();
@@ -62688,10 +62684,27 @@ var Canvas = /*#__PURE__*/function () {
62688
62684
  endX: cellsize[2] + cellsize[0]
62689
62685
  }, renderCtx);
62690
62686
  }
62687
+ }, {
62688
+ key: "renderLyFlag",
62689
+ value: function renderLyFlag(renderCtx, cell, startY, endX, offsetLeft, offsetTop) {
62690
+ var lyFlagColor = cell === null || cell === void 0 ? void 0 : cell.lyFlagColor;
62691
+ if (!lyFlagColor) {
62692
+ return;
62693
+ }
62694
+ var ps_w = 8 * this.sheetCtx.zoomRatio;
62695
+ var ps_h = 8 * this.sheetCtx.zoomRatio;
62696
+ renderCtx.beginPath();
62697
+ renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
62698
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
62699
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
62700
+ renderCtx.fillStyle = lyFlagColor;
62701
+ renderCtx.fill();
62702
+ renderCtx.closePath();
62703
+ }
62691
62704
  }, {
62692
62705
  key: "cellRender",
62693
62706
  value: function cellRender(r, c, startY, startX, endY, endX, value, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
62694
- var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8, _dataVerification, _this$sheetCtx$hooks$9, _this$sheetCtx$hooks9, _flowdata$r3;
62707
+ var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8, _dataVerification, _this$sheetCtx$hooks$9, _this$sheetCtx$hooks9, _flowdata$r4;
62695
62708
  var isMerge = arguments.length > 19 && arguments[19] !== undefined ? arguments[19] : false;
62696
62709
  var flowdata = getFlowdata(this.sheetCtx);
62697
62710
  if (!flowdata) {
@@ -62741,6 +62754,7 @@ var Canvas = /*#__PURE__*/function () {
62741
62754
  renderCtx.fill();
62742
62755
  renderCtx.closePath();
62743
62756
  }
62757
+ this.renderLyFlag(renderCtx, cell, startY, endX, offsetLeft, offsetTop);
62744
62758
  if (cell === null || cell === void 0 ? void 0 : cell.ps) {
62745
62759
  var ps_w = 8 * this.sheetCtx.zoomRatio;
62746
62760
  var ps_h = 8 * this.sheetCtx.zoomRatio;
@@ -62966,7 +62980,7 @@ var Canvas = /*#__PURE__*/function () {
62966
62980
  renderCtx.stroke();
62967
62981
  renderCtx.closePath();
62968
62982
  }
62969
- (_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : _flowdata$r3[c], {
62983
+ (_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c], {
62970
62984
  row: r,
62971
62985
  column: c,
62972
62986
  startX: cellsize[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "father-build"
14
14
  },
15
15
  "dependencies": {
16
- "@leankylin-sheet/formula-parser": "^2.0.3",
16
+ "@leankylin-sheet/formula-parser": "^2.0.5",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",