@corbe30/fortune-excel 1.0.9 → 1.2.2

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.
Files changed (44) hide show
  1. package/.storybook/main.ts +3 -6
  2. package/.storybook/preview.ts +1 -3
  3. package/.storybook/webpack.config.js +12 -0
  4. package/dist/ToExcel/ExcelBorder.js +46 -43
  5. package/dist/ToExcel/ExcelConfig.d.ts +2 -0
  6. package/dist/ToExcel/ExcelConfig.js +13 -0
  7. package/dist/ToExcel/ExcelConvert.js +14 -9
  8. package/dist/ToExcel/ExcelFile.js +46 -12
  9. package/dist/ToExcel/ExcelImage.js +4 -1
  10. package/dist/ToExcel/ExcelStyle.js +8 -5
  11. package/dist/ToExcel/ExcelValidation.d.ts +2 -0
  12. package/dist/ToExcel/ExcelValidation.js +67 -0
  13. package/dist/ToFortuneSheet/FortuneBase.js +17 -14
  14. package/dist/ToFortuneSheet/FortuneCell.js +36 -33
  15. package/dist/ToFortuneSheet/FortuneFile.d.ts +1 -1
  16. package/dist/ToFortuneSheet/FortuneFile.js +43 -40
  17. package/dist/ToFortuneSheet/FortuneImage.d.ts +1 -1
  18. package/dist/ToFortuneSheet/FortuneImage.js +12 -9
  19. package/dist/ToFortuneSheet/FortuneSheet.js +75 -69
  20. package/dist/{HandleZip.d.ts → ToFortuneSheet/HandleZip.d.ts} +1 -1
  21. package/dist/{HandleZip.js → ToFortuneSheet/HandleZip.js} +9 -3
  22. package/dist/ToFortuneSheet/IFortune.js +2 -1
  23. package/dist/{ImportHelper.js → ToFortuneSheet/ImportHelper.js} +12 -5
  24. package/dist/ToFortuneSheet/ReadXml.d.ts +1 -1
  25. package/dist/ToFortuneSheet/ReadXml.js +13 -8
  26. package/dist/{ICommon.d.ts → common/ICommon.d.ts} +1 -1
  27. package/dist/common/ICommon.js +2 -0
  28. package/dist/{ToolbarItem.js → common/ToolbarItem.js} +16 -8
  29. package/dist/{Transform.js → common/Transform.js} +13 -8
  30. package/dist/common/constant.d.ts +3 -1
  31. package/dist/common/constant.js +45 -24
  32. package/dist/common/emf.js +117 -112
  33. package/dist/common/method.d.ts +1 -1
  34. package/dist/common/method.js +60 -33
  35. package/dist/icons/ExportIcon.js +10 -5
  36. package/dist/icons/ImportIcon.js +10 -5
  37. package/dist/main.d.ts +2 -2
  38. package/dist/main.js +18 -2
  39. package/package.json +6 -3
  40. package/tsconfig.json +4 -1
  41. package/dist/ICommon.js +0 -1
  42. /package/dist/{ImportHelper.d.ts → ToFortuneSheet/ImportHelper.d.ts} +0 -0
  43. /package/dist/{ToolbarItem.d.ts → common/ToolbarItem.d.ts} +0 -0
  44. /package/dist/{Transform.d.ts → common/Transform.d.ts} +0 -0
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setDataValidations = void 0;
4
+ var constant_1 = require("../common/constant");
5
+ function rowColToCell(rowColumn) {
6
+ var _a = rowColumn.split("_").map(Number), row = _a[0], col = _a[1];
7
+ function columnToLetters(colIndex) {
8
+ var letters = "";
9
+ while (colIndex >= 0) {
10
+ letters = String.fromCharCode((colIndex % 26) + 65) + letters;
11
+ colIndex = Math.floor(colIndex / 26) - 1;
12
+ }
13
+ return letters;
14
+ }
15
+ var columnLetters = columnToLetters(col);
16
+ var rowNumber = row + 1;
17
+ return "".concat(columnLetters).concat(rowNumber);
18
+ }
19
+ // TODO: define contants
20
+ function getExcelValidation(cellVerification) {
21
+ var excelValidation = {
22
+ type: constant_1.DATA_VERIFICATION_REV_MAP[cellVerification.type],
23
+ showInputMessage: !!cellVerification.hintShow,
24
+ showErrorMessage: !!cellVerification.prohibitInput,
25
+ prompt: cellVerification.hintValue,
26
+ };
27
+ switch (cellVerification.type) {
28
+ case "dropdown":
29
+ excelValidation.formulae = ['"' + cellVerification.value1 + '"'];
30
+ break;
31
+ case "number":
32
+ case "number_integer":
33
+ case "number_decimal":
34
+ excelValidation.operator = constant_1.OPERATOR_MAP[cellVerification.type2];
35
+ excelValidation.formulae = [
36
+ parseFloat(cellVerification.value1),
37
+ parseFloat(cellVerification.value2),
38
+ ];
39
+ break;
40
+ case "text_length":
41
+ excelValidation.operator = constant_1.OPERATOR_MAP[cellVerification.type2];
42
+ excelValidation.formulae = [
43
+ parseInt(cellVerification.value1),
44
+ parseInt(cellVerification.value2),
45
+ ];
46
+ if (!excelValidation.formulae[1])
47
+ excelValidation.formulae.pop();
48
+ break;
49
+ case "date":
50
+ excelValidation.operator = constant_1.OPERATOR_MAP[cellVerification.type2];
51
+ excelValidation.formulae = [
52
+ new Date(cellVerification.value1),
53
+ new Date(cellVerification.value2),
54
+ ];
55
+ break;
56
+ default:
57
+ return {};
58
+ }
59
+ return excelValidation;
60
+ }
61
+ function setDataValidations(table, worksheet) {
62
+ for (var key in table.dataVerification) {
63
+ var cell = rowColToCell(key);
64
+ worksheet.getCell(cell).dataValidation = getExcelValidation(table.dataVerification[key]);
65
+ }
66
+ }
67
+ exports.setDataValidations = setDataValidations;
@@ -1,84 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FortuneImageBase = exports.FortunesheetCalcChain = exports.FortuneSheetConfigMerge = exports.FortuneSheetborderInfoCellValueStyle = exports.FortuneSheetborderInfoCellValue = exports.FortuneSheetborderInfoCellForImp = exports.FortuneConfig = exports.FortuneInlineString = exports.FortuneSheetCellFormat = exports.FortuneSheetCelldataValue = exports.FortuneSheetCelldataBase = exports.FortuneFileInfo = exports.FortuneSheetBase = exports.FortuneFileBase = void 0;
1
4
  var FortuneFileBase = /** @class */ (function () {
2
5
  function FortuneFileBase() {
3
6
  }
4
7
  return FortuneFileBase;
5
8
  }());
6
- export { FortuneFileBase };
9
+ exports.FortuneFileBase = FortuneFileBase;
7
10
  var FortuneSheetBase = /** @class */ (function () {
8
11
  function FortuneSheetBase() {
9
12
  }
10
13
  return FortuneSheetBase;
11
14
  }());
12
- export { FortuneSheetBase };
15
+ exports.FortuneSheetBase = FortuneSheetBase;
13
16
  var FortuneFileInfo = /** @class */ (function () {
14
17
  function FortuneFileInfo() {
15
18
  }
16
19
  return FortuneFileInfo;
17
20
  }());
18
- export { FortuneFileInfo };
21
+ exports.FortuneFileInfo = FortuneFileInfo;
19
22
  var FortuneSheetCelldataBase = /** @class */ (function () {
20
23
  function FortuneSheetCelldataBase() {
21
24
  }
22
25
  return FortuneSheetCelldataBase;
23
26
  }());
24
- export { FortuneSheetCelldataBase };
27
+ exports.FortuneSheetCelldataBase = FortuneSheetCelldataBase;
25
28
  var FortuneSheetCelldataValue = /** @class */ (function () {
26
29
  function FortuneSheetCelldataValue() {
27
30
  }
28
31
  return FortuneSheetCelldataValue;
29
32
  }());
30
- export { FortuneSheetCelldataValue };
33
+ exports.FortuneSheetCelldataValue = FortuneSheetCelldataValue;
31
34
  var FortuneSheetCellFormat = /** @class */ (function () {
32
35
  function FortuneSheetCellFormat() {
33
36
  }
34
37
  return FortuneSheetCellFormat;
35
38
  }());
36
- export { FortuneSheetCellFormat };
39
+ exports.FortuneSheetCellFormat = FortuneSheetCellFormat;
37
40
  var FortuneInlineString = /** @class */ (function () {
38
41
  function FortuneInlineString() {
39
42
  }
40
43
  return FortuneInlineString;
41
44
  }());
42
- export { FortuneInlineString };
45
+ exports.FortuneInlineString = FortuneInlineString;
43
46
  var FortuneConfig = /** @class */ (function () {
44
47
  function FortuneConfig() {
45
48
  }
46
49
  return FortuneConfig;
47
50
  }());
48
- export { FortuneConfig };
51
+ exports.FortuneConfig = FortuneConfig;
49
52
  var FortuneSheetborderInfoCellForImp = /** @class */ (function () {
50
53
  function FortuneSheetborderInfoCellForImp() {
51
54
  }
52
55
  return FortuneSheetborderInfoCellForImp;
53
56
  }());
54
- export { FortuneSheetborderInfoCellForImp };
57
+ exports.FortuneSheetborderInfoCellForImp = FortuneSheetborderInfoCellForImp;
55
58
  var FortuneSheetborderInfoCellValue = /** @class */ (function () {
56
59
  function FortuneSheetborderInfoCellValue() {
57
60
  }
58
61
  return FortuneSheetborderInfoCellValue;
59
62
  }());
60
- export { FortuneSheetborderInfoCellValue };
63
+ exports.FortuneSheetborderInfoCellValue = FortuneSheetborderInfoCellValue;
61
64
  var FortuneSheetborderInfoCellValueStyle = /** @class */ (function () {
62
65
  function FortuneSheetborderInfoCellValueStyle() {
63
66
  }
64
67
  return FortuneSheetborderInfoCellValueStyle;
65
68
  }());
66
- export { FortuneSheetborderInfoCellValueStyle };
69
+ exports.FortuneSheetborderInfoCellValueStyle = FortuneSheetborderInfoCellValueStyle;
67
70
  var FortuneSheetConfigMerge = /** @class */ (function () {
68
71
  function FortuneSheetConfigMerge() {
69
72
  }
70
73
  return FortuneSheetConfigMerge;
71
74
  }());
72
- export { FortuneSheetConfigMerge };
75
+ exports.FortuneSheetConfigMerge = FortuneSheetConfigMerge;
73
76
  var FortunesheetCalcChain = /** @class */ (function () {
74
77
  function FortunesheetCalcChain() {
75
78
  }
76
79
  return FortunesheetCalcChain;
77
80
  }());
78
- export { FortunesheetCalcChain };
81
+ exports.FortunesheetCalcChain = FortunesheetCalcChain;
79
82
  var FortuneImageBase = /** @class */ (function () {
80
83
  function FortuneImageBase() {
81
84
  }
82
85
  return FortuneImageBase;
83
86
  }());
84
- export { FortuneImageBase };
87
+ exports.FortuneImageBase = FortuneImageBase;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __extends = (this && this.__extends) || (function () {
2
3
  var extendStatics = function (d, b) {
3
4
  extendStatics = Object.setPrototypeOf ||
@@ -13,10 +14,12 @@ var __extends = (this && this.__extends) || (function () {
13
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
15
  };
15
16
  })();
16
- import { getColor, getlineStringAttr, } from "./ReadXml.js";
17
- import { getcellrange, escapeCharacter, isChinese, isJapanese, isKoera, } from "../common/method.js";
18
- import { ST_CellType, borderTypes, fontFamilys, } from "../common/constant.js";
19
- import { FortuneSheetborderInfoCellValueStyle, FortuneSheetborderInfoCellForImp, FortuneSheetborderInfoCellValue, FortuneSheetCelldataBase, FortuneSheetCelldataValue, FortuneSheetCellFormat, } from "./FortuneBase.js";
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.FortuneSheetCelldata = void 0;
19
+ var ReadXml_js_1 = require("./ReadXml.js");
20
+ var method_js_1 = require("../common/method.js");
21
+ var constant_js_1 = require("../common/constant.js");
22
+ var FortuneBase_js_1 = require("./FortuneBase.js");
20
23
  var FortuneSheetCelldata = /** @class */ (function (_super) {
21
24
  __extends(FortuneSheetCelldata, _super);
22
25
  function FortuneSheetCelldata(cell, styles, sharedStrings, mergeCells, sheetFile, ReadXml) {
@@ -30,7 +33,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
30
33
  _this.mergeCells = mergeCells;
31
34
  var attrList = cell.attributeList;
32
35
  var r = attrList.r, s = attrList.s, t = attrList.t;
33
- var range = getcellrange(r);
36
+ var range = (0, method_js_1.getcellrange)(r);
34
37
  _this.r = range.row[0];
35
38
  _this.c = range.column[0];
36
39
  _this.v = _this.generateValue(s, t);
@@ -56,7 +59,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
56
59
  var numfmts = this.styles["numfmts"];
57
60
  var clrScheme = this.styles["clrScheme"];
58
61
  var sharedStrings = this.sharedStrings;
59
- var cellValue = new FortuneSheetCelldataValue();
62
+ var cellValue = new FortuneBase_js_1.FortuneSheetCelldataValue();
60
63
  if (f != null) {
61
64
  var formula = f[0], attrList = formula.attributeList;
62
65
  var t_1 = attrList.t, ref = attrList.ref, si = attrList.si;
@@ -68,7 +71,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
68
71
  }
69
72
  // console.log(ref, t, si);
70
73
  if (ref != null || (formulaValue != null && formulaValue.length > 0)) {
71
- formulaValue = escapeCharacter(formulaValue);
74
+ formulaValue = (0, method_js_1.escapeCharacter)(formulaValue);
72
75
  cellValue.f = (formulaValue.startsWith('=') ? "" : "=") + formulaValue;
73
76
  }
74
77
  }
@@ -179,8 +182,8 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
179
182
  }
180
183
  if (numFmtId != undefined) {
181
184
  var numf = numfmts[parseInt(numFmtId)];
182
- var cellFormat = new FortuneSheetCellFormat();
183
- cellFormat.fa = escapeCharacter(numf);
185
+ var cellFormat = new FortuneBase_js_1.FortuneSheetCellFormat();
186
+ cellFormat.fa = (0, method_js_1.escapeCharacter)(numf);
184
187
  // console.log(numf, numFmtId, this.v);
185
188
  cellFormat.t = t || "n";
186
189
  cellValue.ct = cellFormat;
@@ -215,7 +218,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
215
218
  }
216
219
  if (colors != null && colors.length > 0) {
217
220
  var color = colors[0];
218
- var fc = getColor(color, this.styles, "t");
221
+ var fc = (0, ReadXml_js_1.getColor)(color, this.styles, "t");
219
222
  if (fc != null) {
220
223
  cellValue.fc = fc;
221
224
  }
@@ -223,7 +226,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
223
226
  if (familyOverrides != null && familyOverrides.length > 0) {
224
227
  var val = familyOverrides[0].attributeList.val;
225
228
  if (val != null) {
226
- familyFont = fontFamilys[val];
229
+ familyFont = constant_js_1.fontFamilys[val];
227
230
  }
228
231
  }
229
232
  if (family != null && family.length > 0) {
@@ -382,10 +385,10 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
382
385
  var borderIdNum = parseInt(borderId);
383
386
  var border = borders[borderIdNum];
384
387
  // this._borderId = borderIdNum;
385
- var borderObject = new FortuneSheetborderInfoCellForImp();
388
+ var borderObject = new FortuneBase_js_1.FortuneSheetborderInfoCellForImp();
386
389
  borderObject.rangeType = "cell";
387
390
  // borderObject.cells = [];
388
- var borderCellValue = new FortuneSheetborderInfoCellValue();
391
+ var borderCellValue = new FortuneBase_js_1.FortuneSheetborderInfoCellValue();
389
392
  borderCellValue.row_index = this.r;
390
393
  borderCellValue.col_index = this.c;
391
394
  var lefts = border.getInnerElements("left");
@@ -442,7 +445,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
442
445
  if (/&#\d+;/.test(value)) {
443
446
  value = this.htmlDecode(value);
444
447
  }
445
- if (t == ST_CellType["SharedString"]) {
448
+ if (t == constant_js_1.ST_CellType["SharedString"]) {
446
449
  var siIndex = parseInt(v[0].value);
447
450
  var sharedSI = sharedStrings[siIndex];
448
451
  var rFlag = sharedSI.getInnerElements("r");
@@ -453,7 +456,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
453
456
  tFlag.forEach(function (t) {
454
457
  text_1 += t.value;
455
458
  });
456
- text_1 = escapeCharacter(text_1);
459
+ text_1 = (0, method_js_1.escapeCharacter)(text_1);
457
460
  //isContainMultiType(text) &&
458
461
  if (familyFont == "Roman" && text_1.length > 0) {
459
462
  var textArray = text_1.split("");
@@ -464,7 +467,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
464
467
  }
465
468
  var cellFormat = cellValue.ct;
466
469
  if (cellFormat == null) {
467
- cellFormat = new FortuneSheetCellFormat();
470
+ cellFormat = new FortuneBase_js_1.FortuneSheetCellFormat();
468
471
  }
469
472
  if (cellFormat.s == null) {
470
473
  cellFormat.s = [];
@@ -472,15 +475,15 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
472
475
  for (var i = 0; i < textArray.length; i++) {
473
476
  var w = textArray[i];
474
477
  var type = null, ff = wholef;
475
- if (isChinese(w)) {
478
+ if ((0, method_js_1.isChinese)(w)) {
476
479
  type = "c";
477
480
  ff = "宋体";
478
481
  }
479
- else if (isJapanese(w)) {
482
+ else if ((0, method_js_1.isJapanese)(w)) {
480
483
  type = "j";
481
484
  ff = "Yu Gothic";
482
485
  }
483
- else if (isKoera(w)) {
486
+ else if ((0, method_js_1.isKoera)(w)) {
484
487
  type = "k";
485
488
  ff = "Malgun Gothic";
486
489
  }
@@ -567,7 +570,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
567
570
  InlineString.v = text_1;
568
571
  var cellFormat = cellValue.ct;
569
572
  if (cellFormat == null) {
570
- cellFormat = new FortuneSheetCellFormat();
573
+ cellFormat = new FortuneBase_js_1.FortuneSheetCellFormat();
571
574
  }
572
575
  if (cellValue.ff != null) {
573
576
  InlineString.ff = cellValue.ff;
@@ -610,15 +613,15 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
610
613
  if (tFlag != null && tFlag.length > 0) {
611
614
  var text = tFlag[0].value;
612
615
  text = _this.replaceSpecialWrap(text);
613
- text = escapeCharacter(text);
616
+ text = (0, method_js_1.escapeCharacter)(text);
614
617
  InlineString.v = text;
615
618
  }
616
619
  if (rPr != null && rPr.length > 0) {
617
620
  var frpr = rPr[0];
618
- var sz = getlineStringAttr(frpr, "sz"), rFont = getlineStringAttr(frpr, "rFont"), family = getlineStringAttr(frpr, "family"), charset = getlineStringAttr(frpr, "charset"), scheme = getlineStringAttr(frpr, "scheme"), b = getlineStringAttr(frpr, "b"), i = getlineStringAttr(frpr, "i"), u = getlineStringAttr(frpr, "u"), strike = getlineStringAttr(frpr, "strike"), vertAlign = getlineStringAttr(frpr, "vertAlign"), color = void 0;
621
+ var sz = (0, ReadXml_js_1.getlineStringAttr)(frpr, "sz"), rFont = (0, ReadXml_js_1.getlineStringAttr)(frpr, "rFont"), family = (0, ReadXml_js_1.getlineStringAttr)(frpr, "family"), charset = (0, ReadXml_js_1.getlineStringAttr)(frpr, "charset"), scheme = (0, ReadXml_js_1.getlineStringAttr)(frpr, "scheme"), b = (0, ReadXml_js_1.getlineStringAttr)(frpr, "b"), i = (0, ReadXml_js_1.getlineStringAttr)(frpr, "i"), u = (0, ReadXml_js_1.getlineStringAttr)(frpr, "u"), strike = (0, ReadXml_js_1.getlineStringAttr)(frpr, "strike"), vertAlign = (0, ReadXml_js_1.getlineStringAttr)(frpr, "vertAlign"), color = void 0;
619
622
  var cEle = frpr.getInnerElements("color");
620
623
  if (cEle != null && cEle.length > 0) {
621
- color = getColor(cEle[0], _this.styles, "t");
624
+ color = (0, ReadXml_js_1.getColor)(cEle[0], _this.styles, "t");
622
625
  }
623
626
  var ff = void 0;
624
627
  // if(family!=null){
@@ -708,7 +711,7 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
708
711
  });
709
712
  var cellFormat = cellValue.ct;
710
713
  if (cellFormat == null) {
711
- cellFormat = new FortuneSheetCellFormat();
714
+ cellFormat = new FortuneBase_js_1.FortuneSheetCellFormat();
712
715
  }
713
716
  cellFormat.t = "inlineStr";
714
717
  cellFormat.s = styles_1;
@@ -716,11 +719,11 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
716
719
  }
717
720
  }
718
721
  // to be confirmed
719
- else if (t == ST_CellType["InlineString"] && v != null) {
722
+ else if (t == constant_js_1.ST_CellType["InlineString"] && v != null) {
720
723
  cellValue.v = "'" + value;
721
724
  }
722
725
  else {
723
- value = escapeCharacter(value);
726
+ value = (0, method_js_1.escapeCharacter)(value);
724
727
  cellValue.v = value;
725
728
  }
726
729
  }
@@ -746,11 +749,11 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
746
749
  var fg = void 0, bg = void 0;
747
750
  if (fgColors != null) {
748
751
  var fgColor = fgColors[0];
749
- fg = getColor(fgColor, this.styles);
752
+ fg = (0, ReadXml_js_1.getColor)(fgColor, this.styles);
750
753
  }
751
754
  if (bgColors != null) {
752
755
  var bgColor = bgColors[0];
753
- bg = getColor(bgColor, this.styles);
756
+ bg = (0, ReadXml_js_1.getColor)(bgColor, this.styles);
754
757
  }
755
758
  // console.log(fgColors,bgColors,clrScheme);
756
759
  if (fg != null) {
@@ -782,13 +785,13 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
782
785
  var colorRet = "#000000";
783
786
  if (colors != null) {
784
787
  var color = colors[0];
785
- colorRet = getColor(color, this.styles, "b");
788
+ colorRet = (0, ReadXml_js_1.getColor)(color, this.styles, "b");
786
789
  if (colorRet == null) {
787
790
  colorRet = "#000000";
788
791
  }
789
792
  }
790
- var ret = new FortuneSheetborderInfoCellValueStyle();
791
- ret.style = borderTypes[style];
793
+ var ret = new FortuneBase_js_1.FortuneSheetborderInfoCellValueStyle();
794
+ ret.style = constant_js_1.borderTypes[style];
792
795
  ret.color = colorRet;
793
796
  return ret;
794
797
  };
@@ -798,5 +801,5 @@ var FortuneSheetCelldata = /** @class */ (function (_super) {
798
801
  });
799
802
  };
800
803
  return FortuneSheetCelldata;
801
- }(FortuneSheetCelldataBase));
802
- export { FortuneSheetCelldata };
804
+ }(FortuneBase_js_1.FortuneSheetCelldataBase));
805
+ exports.FortuneSheetCelldata = FortuneSheetCelldata;
@@ -1,4 +1,4 @@
1
- import { IuploadfileList } from "../ICommon.js";
1
+ import { IuploadfileList } from "../common/ICommon.js";
2
2
  import { FortuneFileBase } from "./FortuneBase.js";
3
3
  export declare class FortuneFile {
4
4
  private files;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,42 +10,44 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { FortuneSheet } from "./FortuneSheet.js";
13
- import { workBookFile, coreFile, appFile, stylesFile, sharedStringsFile, numFmtDefault, theme1File, calcChainFile, workbookRels, numFmtDefaultMap, } from "../common/constant.js";
14
- import { ReadXml } from "./ReadXml.js";
15
- import { getXmlAttibute } from "../common/method.js";
16
- import { FortuneFileBase, FortuneFileInfo, } from "./FortuneBase.js";
17
- import { ImageList } from "./FortuneImage.js";
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.FortuneFile = void 0;
15
+ var FortuneSheet_js_1 = require("./FortuneSheet.js");
16
+ var constant_js_1 = require("../common/constant.js");
17
+ var ReadXml_js_1 = require("./ReadXml.js");
18
+ var method_js_1 = require("../common/method.js");
19
+ var FortuneBase_js_1 = require("./FortuneBase.js");
20
+ var FortuneImage_js_1 = require("./FortuneImage.js");
18
21
  var FortuneFile = /** @class */ (function () {
19
22
  function FortuneFile(files, fileName) {
20
23
  this.columnWidthSet = [];
21
24
  this.rowHeightSet = [];
22
25
  this.files = files;
23
26
  this.fileName = fileName;
24
- this.readXml = new ReadXml(files);
27
+ this.readXml = new ReadXml_js_1.ReadXml(files);
25
28
  this.getSheetNameList();
26
- this.sharedStrings = this.readXml.getElementsByTagName("sst/si", sharedStringsFile);
27
- this.calcChain = this.readXml.getElementsByTagName("calcChain/c", calcChainFile);
29
+ this.sharedStrings = this.readXml.getElementsByTagName("sst/si", constant_js_1.sharedStringsFile);
30
+ this.calcChain = this.readXml.getElementsByTagName("calcChain/c", constant_js_1.calcChainFile);
28
31
  this.styles = {};
29
- this.styles["cellXfs"] = this.readXml.getElementsByTagName("cellXfs/xf", stylesFile);
30
- this.styles["cellStyleXfs"] = this.readXml.getElementsByTagName("cellStyleXfs/xf", stylesFile);
31
- this.styles["cellStyles"] = this.readXml.getElementsByTagName("cellStyles/cellStyle", stylesFile);
32
- this.styles["fonts"] = this.readXml.getElementsByTagName("fonts/font", stylesFile);
33
- this.styles["fills"] = this.readXml.getElementsByTagName("fills/fill", stylesFile);
34
- this.styles["borders"] = this.readXml.getElementsByTagName("borders/border", stylesFile);
35
- this.styles["clrScheme"] = this.readXml.getElementsByTagName("a:clrScheme/a:dk1|a:lt1|a:dk2|a:lt2|a:accent1|a:accent2|a:accent3|a:accent4|a:accent5|a:accent6|a:hlink|a:folHlink", theme1File);
36
- this.styles["indexedColors"] = this.readXml.getElementsByTagName("colors/indexedColors/rgbColor", stylesFile);
37
- this.styles["mruColors"] = this.readXml.getElementsByTagName("colors/mruColors/color", stylesFile);
38
- this.imageList = new ImageList(files);
39
- var numfmts = this.readXml.getElementsByTagName("numFmt/numFmt", stylesFile);
40
- var numFmtDefaultC = JSON.parse(JSON.stringify(numFmtDefault));
32
+ this.styles["cellXfs"] = this.readXml.getElementsByTagName("cellXfs/xf", constant_js_1.stylesFile);
33
+ this.styles["cellStyleXfs"] = this.readXml.getElementsByTagName("cellStyleXfs/xf", constant_js_1.stylesFile);
34
+ this.styles["cellStyles"] = this.readXml.getElementsByTagName("cellStyles/cellStyle", constant_js_1.stylesFile);
35
+ this.styles["fonts"] = this.readXml.getElementsByTagName("fonts/font", constant_js_1.stylesFile);
36
+ this.styles["fills"] = this.readXml.getElementsByTagName("fills/fill", constant_js_1.stylesFile);
37
+ this.styles["borders"] = this.readXml.getElementsByTagName("borders/border", constant_js_1.stylesFile);
38
+ this.styles["clrScheme"] = this.readXml.getElementsByTagName("a:clrScheme/a:dk1|a:lt1|a:dk2|a:lt2|a:accent1|a:accent2|a:accent3|a:accent4|a:accent5|a:accent6|a:hlink|a:folHlink", constant_js_1.theme1File);
39
+ this.styles["indexedColors"] = this.readXml.getElementsByTagName("colors/indexedColors/rgbColor", constant_js_1.stylesFile);
40
+ this.styles["mruColors"] = this.readXml.getElementsByTagName("colors/mruColors/color", constant_js_1.stylesFile);
41
+ this.imageList = new FortuneImage_js_1.ImageList(files);
42
+ var numfmts = this.readXml.getElementsByTagName("numFmt/numFmt", constant_js_1.stylesFile);
43
+ var numFmtDefaultC = JSON.parse(JSON.stringify(constant_js_1.numFmtDefault));
41
44
  for (var i = 0; i < numfmts.length; i++) {
42
45
  var attrList = numfmts[i].attributeList;
43
- var numfmtid = getXmlAttibute(attrList, "numFmtId", "49");
44
- var formatcode = getXmlAttibute(attrList, "formatCode", "@");
46
+ var numfmtid = (0, method_js_1.getXmlAttibute)(attrList, "numFmtId", "49");
47
+ var formatcode = (0, method_js_1.getXmlAttibute)(attrList, "formatCode", "@");
45
48
  // console.log(numfmtid, formatcode);
46
- if (!(numfmtid in numFmtDefault)) {
47
- numFmtDefaultC[numfmtid] = numFmtDefaultMap[formatcode] || formatcode;
49
+ if (!(numfmtid in constant_js_1.numFmtDefault)) {
50
+ numFmtDefaultC[numfmtid] = constant_js_1.numFmtDefaultMap[formatcode] || formatcode;
48
51
  }
49
52
  }
50
53
  // console.log(JSON.stringify(numFmtDefaultC), numfmts);
@@ -54,7 +57,7 @@ var FortuneFile = /** @class */ (function () {
54
57
  * @return All sheet name of workbook
55
58
  */
56
59
  FortuneFile.prototype.getSheetNameList = function () {
57
- var workbookRelList = this.readXml.getElementsByTagName("Relationships/Relationship", workbookRels);
60
+ var workbookRelList = this.readXml.getElementsByTagName("Relationships/Relationship", constant_js_1.workbookRels);
58
61
  if (workbookRelList == null) {
59
62
  return;
60
63
  }
@@ -91,13 +94,13 @@ var FortuneFile = /** @class */ (function () {
91
94
  * @return workBook information
92
95
  */
93
96
  FortuneFile.prototype.getWorkBookInfo = function () {
94
- var Company = this.readXml.getElementsByTagName("Company", appFile);
95
- var AppVersion = this.readXml.getElementsByTagName("AppVersion", appFile);
96
- var creator = this.readXml.getElementsByTagName("dc:creator", coreFile);
97
- var lastModifiedBy = this.readXml.getElementsByTagName("cp:lastModifiedBy", coreFile);
98
- var created = this.readXml.getElementsByTagName("dcterms:created", coreFile);
99
- var modified = this.readXml.getElementsByTagName("dcterms:modified", coreFile);
100
- this.info = new FortuneFileInfo();
97
+ var Company = this.readXml.getElementsByTagName("Company", constant_js_1.appFile);
98
+ var AppVersion = this.readXml.getElementsByTagName("AppVersion", constant_js_1.appFile);
99
+ var creator = this.readXml.getElementsByTagName("dc:creator", constant_js_1.coreFile);
100
+ var lastModifiedBy = this.readXml.getElementsByTagName("cp:lastModifiedBy", constant_js_1.coreFile);
101
+ var created = this.readXml.getElementsByTagName("dcterms:created", constant_js_1.coreFile);
102
+ var modified = this.readXml.getElementsByTagName("dcterms:modified", constant_js_1.coreFile);
103
+ this.info = new FortuneBase_js_1.FortuneFileInfo();
101
104
  this.info.name = this.fileName;
102
105
  this.info.creator = creator.length > 0 ? creator[0].value : "";
103
106
  this.info.lastmodifiedby =
@@ -112,7 +115,7 @@ var FortuneFile = /** @class */ (function () {
112
115
  */
113
116
  FortuneFile.prototype.getSheetsFull = function (isInitialCell) {
114
117
  if (isInitialCell === void 0) { isInitialCell = true; }
115
- var sheets = this.readXml.getElementsByTagName("sheets/sheet", workBookFile);
118
+ var sheets = this.readXml.getElementsByTagName("sheets/sheet", constant_js_1.workBookFile);
116
119
  var sheetList = {};
117
120
  for (var key in sheets) {
118
121
  var sheet = sheets[key];
@@ -130,14 +133,14 @@ var FortuneFile = /** @class */ (function () {
130
133
  var drawing = this.readXml.getElementsByTagName("worksheet/drawing", sheetFile), drawingFile = void 0, drawingRelsFile = void 0;
131
134
  if (drawing != null && drawing.length > 0) {
132
135
  var attrList = drawing[0].attributeList;
133
- var rid_1 = getXmlAttibute(attrList, "r:id", null);
136
+ var rid_1 = (0, method_js_1.getXmlAttibute)(attrList, "r:id", null);
134
137
  if (rid_1 != null) {
135
138
  drawingFile = this.getDrawingFile(rid_1, sheetFile);
136
139
  drawingRelsFile = this.getDrawingRelsFile(drawingFile);
137
140
  }
138
141
  }
139
142
  if (sheetFile != null) {
140
- var sheet_1 = new FortuneSheet(sheetName, sheetId, order, isInitialCell, {
143
+ var sheet_1 = new FortuneSheet_js_1.FortuneSheet(sheetName, sheetId, order, isInitialCell, {
141
144
  sheetFile: sheetFile,
142
145
  readXml: this.readXml,
143
146
  sheetList: sheetList,
@@ -278,9 +281,9 @@ var FortuneFile = /** @class */ (function () {
278
281
  for (var i = 0; i < drawing.length; i++) {
279
282
  var relationship = drawing[i];
280
283
  var attrList = relationship.attributeList;
281
- var relationshipId = getXmlAttibute(attrList, "Id", null);
284
+ var relationshipId = (0, method_js_1.getXmlAttibute)(attrList, "Id", null);
282
285
  if (relationshipId == rid) {
283
- var target = getXmlAttibute(attrList, "Target", null);
286
+ var target = (0, method_js_1.getXmlAttibute)(attrList, "Target", null);
284
287
  if (target != null) {
285
288
  return target.replace(/\.\.\//g, "");
286
289
  }
@@ -311,7 +314,7 @@ var FortuneFile = /** @class */ (function () {
311
314
  };
312
315
  FortuneFile.prototype.serialize = function () {
313
316
  var _a;
314
- var FortuneOutPutFile = new FortuneFileBase();
317
+ var FortuneOutPutFile = new FortuneBase_js_1.FortuneFileBase();
315
318
  FortuneOutPutFile.info = this.info;
316
319
  FortuneOutPutFile.sheets = [];
317
320
  for (var _i = 0, _b = this.sheets; _i < _b.length; _i++) {
@@ -435,4 +438,4 @@ var FortuneFile = /** @class */ (function () {
435
438
  };
436
439
  return FortuneFile;
437
440
  }());
438
- export { FortuneFile };
441
+ exports.FortuneFile = FortuneFile;
@@ -1,4 +1,4 @@
1
- import { IuploadfileList } from "../ICommon.js";
1
+ import { IuploadfileList } from "../common/ICommon.js";
2
2
  import { FortuneImageBase } from "./FortuneBase.js";
3
3
  export declare class ImageList {
4
4
  private images;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __extends = (this && this.__extends) || (function () {
2
3
  var extendStatics = function (d, b) {
3
4
  extendStatics = Object.setPrototypeOf ||
@@ -13,8 +14,10 @@ var __extends = (this && this.__extends) || (function () {
13
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
15
  };
15
16
  })();
16
- import { FortuneImageBase } from "./FortuneBase.js";
17
- import { FromEMF, ToContext2D } from "../common/emf.js";
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ImageList = void 0;
19
+ var FortuneBase_js_1 = require("./FortuneBase.js");
20
+ var emf_js_1 = require("../common/emf.js");
18
21
  var ImageList = /** @class */ (function () {
19
22
  function ImageList(files) {
20
23
  if (files == null) {
@@ -31,15 +34,15 @@ var ImageList = /** @class */ (function () {
31
34
  if (suffix == "emf") {
32
35
  var pNum = 0; // number of the page, that you want to render
33
36
  var scale = 1; // the scale of the document
34
- var wrt = new ToContext2D(pNum, scale);
37
+ var wrt = new emf_js_1.ToContext2D(pNum, scale);
35
38
  var inp, out, stt;
36
- FromEMF.K = [];
37
- inp = FromEMF.C;
38
- out = FromEMF.K;
39
+ emf_js_1.FromEMF.K = [];
40
+ inp = emf_js_1.FromEMF.C;
41
+ out = emf_js_1.FromEMF.K;
39
42
  stt = 4;
40
43
  for (var p in inp)
41
44
  out[inp[p]] = p.slice(stt);
42
- FromEMF.Parse(files[fileKey], wrt);
45
+ emf_js_1.FromEMF.Parse(files[fileKey], wrt);
43
46
  this.images[fileKey] = wrt.canvas.toDataURL("image/png");
44
47
  }
45
48
  else {
@@ -58,7 +61,7 @@ var ImageList = /** @class */ (function () {
58
61
  };
59
62
  return ImageList;
60
63
  }());
61
- export { ImageList };
64
+ exports.ImageList = ImageList;
62
65
  var Image = /** @class */ (function (_super) {
63
66
  __extends(Image, _super);
64
67
  function Image(pathName, base64) {
@@ -68,4 +71,4 @@ var Image = /** @class */ (function (_super) {
68
71
  }
69
72
  Image.prototype.setDefault = function () { };
70
73
  return Image;
71
- }(FortuneImageBase));
74
+ }(FortuneBase_js_1.FortuneImageBase));