@leankylin-sheet/excel 7.0.30 → 7.0.32

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.
@@ -14,6 +14,8 @@ export declare class FortuneSheetCelldata extends FortuneSheetCelldataBase {
14
14
  private mergeCells;
15
15
  constructor(cell: Element, styles: IStyleCollections, sharedStrings: Element[], mergeCells: Element[], sheetFile: string, ReadXml: ReadXml);
16
16
  private generateValue;
17
+ private applyDisplayValue;
18
+ private toFormatValue;
17
19
  private replaceSpecialWrap;
18
20
  private getBackgroundByFill;
19
21
  private getBorderInfo;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { update } from '@leankylin-sheet/core';
2
3
  import dayjs from 'dayjs';
3
4
  import JSZip from 'jszip';
4
5
  import ExcelJS from 'exceljs';
@@ -2691,8 +2692,36 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2691
2692
  if (quotePrefix != null) {
2692
2693
  cellValue.qp = parseInt(quotePrefix);
2693
2694
  }
2695
+ this.applyDisplayValue(cellValue);
2694
2696
  return cellValue;
2695
2697
  }
2698
+ }, {
2699
+ key: "applyDisplayValue",
2700
+ value: function applyDisplayValue(cellValue) {
2701
+ var v = cellValue.v;
2702
+ if (v == null) {
2703
+ return;
2704
+ }
2705
+ var fa = cellValue.ct != null ? cellValue.ct.fa : undefined;
2706
+ try {
2707
+ var formatted = update(fa != null ? fa : "General", v);
2708
+ cellValue.m = formatted == null ? v : String(formatted);
2709
+ } catch (e) {
2710
+ cellValue.m = v;
2711
+ }
2712
+ }
2713
+ }, {
2714
+ key: "toFormatValue",
2715
+ value: function toFormatValue(v, fa) {
2716
+ if (fa == null || fa === "General" || fa === "@") {
2717
+ return v;
2718
+ }
2719
+ var num = Number(v);
2720
+ if (!Number.isNaN(num) && v.trim() !== "") {
2721
+ return num;
2722
+ }
2723
+ return v;
2724
+ }
2696
2725
  }, {
2697
2726
  key: "replaceSpecialWrap",
2698
2727
  value: function replaceSpecialWrap(text) {
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
+ var core = require('@leankylin-sheet/core');
6
7
  var dayjs = require('dayjs');
7
8
  var JSZip = require('jszip');
8
9
  var ExcelJS = require('exceljs');
@@ -2703,8 +2704,36 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2703
2704
  if (quotePrefix != null) {
2704
2705
  cellValue.qp = parseInt(quotePrefix);
2705
2706
  }
2707
+ this.applyDisplayValue(cellValue);
2706
2708
  return cellValue;
2707
2709
  }
2710
+ }, {
2711
+ key: "applyDisplayValue",
2712
+ value: function applyDisplayValue(cellValue) {
2713
+ var v = cellValue.v;
2714
+ if (v == null) {
2715
+ return;
2716
+ }
2717
+ var fa = cellValue.ct != null ? cellValue.ct.fa : undefined;
2718
+ try {
2719
+ var formatted = core.update(fa != null ? fa : "General", v);
2720
+ cellValue.m = formatted == null ? v : String(formatted);
2721
+ } catch (e) {
2722
+ cellValue.m = v;
2723
+ }
2724
+ }
2725
+ }, {
2726
+ key: "toFormatValue",
2727
+ value: function toFormatValue(v, fa) {
2728
+ if (fa == null || fa === "General" || fa === "@") {
2729
+ return v;
2730
+ }
2731
+ var num = Number(v);
2732
+ if (!Number.isNaN(num) && v.trim() !== "") {
2733
+ return num;
2734
+ }
2735
+ return v;
2736
+ }
2708
2737
  }, {
2709
2738
  key: "replaceSpecialWrap",
2710
2739
  value: function replaceSpecialWrap(text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/excel",
3
- "version": "7.0.30",
3
+ "version": "7.0.32",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.esm.js",
@@ -20,6 +20,7 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
+ "@leankylin-sheet/core": "7.0.32",
23
24
  "dayjs": "^1.11.10",
24
25
  "exceljs": "^4.4.0",
25
26
  "file-saver": "^2.0.5",