@leankylin-sheet/excel 7.0.9 → 7.0.10

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.
@@ -1,4 +1,4 @@
1
- import { IFortuneFile, IFortuneFileInfo, IfortuneSheet, IfortuneSheetCelldata, IfortuneSheetConfig, IfortuneSheetCelldataValue, IfortuneSheetCelldataValueMerge, IFortuneSheetCellFormat, IfortuneSheetConfigMerges, IfortuneSheetConfigMerge, IfortuneSheetborderInfoCellValue, IfortuneSheetborderInfoCellValueStyle, IfortuneSheetborderInfoCellForImp, IfortuneSheetRowAndColumnLen, IfortuneSheetRowAndColumnHidden, IfortuneSheetSelection, IfortunesheetFrozen, IfortuneSheetChart, IfortuneSheetPivotTable, IfortunesheetConditionFormat, IfortunesheetCalcChain, IFortuneInlineString, IfortuneImage, IfortuneImageBorder, IfortuneImageCrop, IfortuneImageDefault, IfortuneImages, IfortunesheetHyperlink, IfortunesheetDataVerification } from "./IFortune";
1
+ import { IFortuneFile, IFortuneFileInfo, IfortuneSheet, IfortuneSheetCelldata, IfortuneSheetConfig, IfortuneSheetCelldataValue, IfortuneSheetCelldataValueMerge, IFortuneSheetCellFormat, IfortuneSheetConfigMerges, IfortuneSheetConfigMerge, IfortuneSheetborderInfoCellValue, IfortuneSheetborderInfoCellValueStyle, IfortuneSheetborderInfoCellForImp, IfortuneSheetRowAndColumnLen, IfortuneSheetRowAndColumnHidden, IfortuneSheetSelection, IfortunesheetFrozen, IfortuneSheetFrozen, IfortuneSheetChart, IfortuneSheetPivotTable, IfortunesheetConditionFormat, IfortunesheetCalcChain, IFortuneInlineString, IfortuneImage, IfortuneImageBorder, IfortuneImageCrop, IfortuneImageDefault, IfortuneImages, IfortunesheetHyperlink, IfortunesheetDataVerification } from "./IFortune";
2
2
  export declare class FortuneFileBase implements IFortuneFile {
3
3
  info: IFortuneFileInfo;
4
4
  sheets: IfortuneSheet[];
@@ -25,6 +25,7 @@ export declare class FortuneSheetBase implements IfortuneSheet {
25
25
  pivotTable: IfortuneSheetPivotTable;
26
26
  luckysheet_conditionformat_save: IfortunesheetConditionFormat[];
27
27
  freezen: IfortunesheetFrozen;
28
+ frozen: IfortuneSheetFrozen;
28
29
  calcChain: IfortunesheetCalcChain[];
29
30
  images: IfortuneImages;
30
31
  dataVerification: IfortunesheetDataVerification;
@@ -29,6 +29,7 @@ export interface IfortuneSheet {
29
29
  pivotTable?: IfortuneSheetPivotTable;
30
30
  luckysheet_conditionformat_save?: IfortunesheetConditionFormat[];
31
31
  freezen?: IfortunesheetFrozen;
32
+ frozen?: IfortuneSheetFrozen;
32
33
  calcChain?: IfortunesheetCalcChain[];
33
34
  zoomRatio: number;
34
35
  showGridLines: string;
@@ -90,6 +91,13 @@ export interface IfortunesheetFrozen {
90
91
  horizen: number | undefined;
91
92
  vertical: number | undefined;
92
93
  }
94
+ export interface IfortuneSheetFrozen {
95
+ type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
96
+ range?: {
97
+ row_focus: number;
98
+ column_focus: number;
99
+ };
100
+ }
93
101
  export interface IfortunesheetConditionFormat {
94
102
  type: string;
95
103
  cellrange: IfortuneSheetSelection[];
package/dist/index.esm.js CHANGED
@@ -1909,6 +1909,7 @@ var FortuneSheetBase = /*#__PURE__*/_createClass(function FortuneSheetBase() {
1909
1909
  this.pivotTable = void 0;
1910
1910
  this.luckysheet_conditionformat_save = void 0;
1911
1911
  this.freezen = void 0;
1912
+ this.frozen = void 0;
1912
1913
  this.calcChain = void 0;
1913
1914
  this.images = void 0;
1914
1915
  this.dataVerification = void 0;
@@ -2016,6 +2017,18 @@ var FortuneImageBase = /*#__PURE__*/_createClass(function FortuneImageBase() {
2016
2017
  this.type = void 0;
2017
2018
  });
2018
2019
 
2020
+ var DEFAULT_STYLE_VALUES = {
2021
+ bg: "#FFFFFF",
2022
+ fc: "#000000",
2023
+ ff: "微软雅黑"
2024
+ };
2025
+ function isDefaultValue(key, value) {
2026
+ if (value == null) {
2027
+ return false;
2028
+ }
2029
+ var normalized = key === "bg" || key === "fc" ? value.toUpperCase() : value;
2030
+ return normalized === DEFAULT_STYLE_VALUES[key];
2031
+ }
2019
2032
  var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2020
2033
  function FortuneSheetCelldata(cell, styles, sharedStrings, mergeCells, sheetFile, ReadXml) {
2021
2034
  var _this;
@@ -2197,7 +2210,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2197
2210
  var fillIdNum = parseInt(fillId);
2198
2211
  var fill = fills[fillIdNum];
2199
2212
  var bg = this.getBackgroundByFill(fill, clrScheme);
2200
- if (bg != null) {
2213
+ if (bg != null && !isDefaultValue("bg", bg)) {
2201
2214
  cellValue.bg = bg;
2202
2215
  }
2203
2216
  }
@@ -2223,7 +2236,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2223
2236
  if (colors != null && colors.length > 0) {
2224
2237
  var color = colors[0];
2225
2238
  var fc = getColor(color, this.styles);
2226
- if (fc != null) {
2239
+ if (fc != null && !isDefaultValue("fc", fc)) {
2227
2240
  cellValue.fc = fc;
2228
2241
  }
2229
2242
  }
@@ -2235,7 +2248,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2235
2248
  }
2236
2249
  if (family != null && family.length > 0) {
2237
2250
  var _val = family[0].attributeList.val;
2238
- if (_val != null) {
2251
+ if (_val != null && !isDefaultValue("ff", _val)) {
2239
2252
  cellValue.ff = _val;
2240
2253
  }
2241
2254
  }
@@ -2356,28 +2369,49 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2356
2369
  var diagonal = this.getBorderInfo(diagonals);
2357
2370
  var start = this.getBorderInfo(starts);
2358
2371
  var end = this.getBorderInfo(ends);
2372
+ var skipLeft = false,
2373
+ skipRight = false,
2374
+ skipTop = false,
2375
+ skipBottom = false;
2376
+ if (this.mergeCells != null) {
2377
+ for (var m = 0; m < this.mergeCells.length; m++) {
2378
+ var mref = this.mergeCells[m].attributeList.ref;
2379
+ if (mref == null) {
2380
+ continue;
2381
+ }
2382
+ var mrange = getcellrange(mref);
2383
+ if (mrange == null || this.r < mrange.row[0] || this.r > mrange.row[1] || this.c < mrange.column[0] || this.c > mrange.column[1]) {
2384
+ continue;
2385
+ }
2386
+ skipLeft = this.c > mrange.column[0];
2387
+ skipRight = this.c < mrange.column[1];
2388
+ skipTop = this.r > mrange.row[0];
2389
+ skipBottom = this.r < mrange.row[1];
2390
+ break;
2391
+ }
2392
+ }
2359
2393
  var isAdd = false;
2360
- if (start != null && start.color != null) {
2394
+ if (start != null && start.color != null && !skipLeft) {
2361
2395
  borderCellValue.l = start;
2362
2396
  isAdd = true;
2363
2397
  }
2364
- if (end != null && end.color != null) {
2398
+ if (end != null && end.color != null && !skipRight) {
2365
2399
  borderCellValue.r = end;
2366
2400
  isAdd = true;
2367
2401
  }
2368
- if (left != null && left.color != null) {
2402
+ if (left != null && left.color != null && !skipLeft) {
2369
2403
  borderCellValue.l = left;
2370
2404
  isAdd = true;
2371
2405
  }
2372
- if (right != null && right.color != null) {
2406
+ if (right != null && right.color != null && !skipRight) {
2373
2407
  borderCellValue.r = right;
2374
2408
  isAdd = true;
2375
2409
  }
2376
- if (top != null && top.color != null) {
2410
+ if (top != null && top.color != null && !skipTop) {
2377
2411
  borderCellValue.t = top;
2378
2412
  isAdd = true;
2379
2413
  }
2380
- if (bottom != null && bottom.color != null) {
2414
+ if (bottom != null && bottom.color != null && !skipBottom) {
2381
2415
  borderCellValue.b = bottom;
2382
2416
  isAdd = true;
2383
2417
  }
@@ -2648,7 +2682,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2648
2682
  cellValue.ct = _cellFormat3;
2649
2683
  }
2650
2684
  } else if (t == ST_CellType["InlineString"] && v != null) {
2651
- cellValue.v = "'" + value;
2685
+ cellValue.v = escapeCharacter(value);
2652
2686
  } else {
2653
2687
  value = escapeCharacter(value);
2654
2688
  cellValue.v = value;
@@ -2781,6 +2815,45 @@ var FortuneSheet = /*#__PURE__*/function (_FortuneSheetBase) {
2781
2815
  _this.luckysheet_select_save = [];
2782
2816
  _this.luckysheet_select_save.push(range);
2783
2817
  }
2818
+ var panes = sheetView[0].getInnerElements("pane");
2819
+ if (panes != null && panes.length > 0) {
2820
+ var paneAttr = panes[0].attributeList;
2821
+ if (getXmlAttibute(paneAttr, "state", "") == "frozen") {
2822
+ var xSplit = parseInt(getXmlAttibute(paneAttr, "xSplit", "0"));
2823
+ var ySplit = parseInt(getXmlAttibute(paneAttr, "ySplit", "0"));
2824
+ if (isNaN(xSplit)) {
2825
+ xSplit = 0;
2826
+ }
2827
+ if (isNaN(ySplit)) {
2828
+ ySplit = 0;
2829
+ }
2830
+ if (xSplit > 0 && ySplit > 0) {
2831
+ _this.frozen = {
2832
+ type: "both",
2833
+ range: {
2834
+ row_focus: ySplit - 1,
2835
+ column_focus: xSplit - 1
2836
+ }
2837
+ };
2838
+ } else if (ySplit > 0) {
2839
+ _this.frozen = {
2840
+ type: "rangeRow",
2841
+ range: {
2842
+ row_focus: ySplit - 1,
2843
+ column_focus: -1
2844
+ }
2845
+ };
2846
+ } else if (xSplit > 0) {
2847
+ _this.frozen = {
2848
+ type: "rangeColumn",
2849
+ range: {
2850
+ row_focus: -1,
2851
+ column_focus: xSplit - 1
2852
+ }
2853
+ };
2854
+ }
2855
+ }
2856
+ }
2784
2857
  }
2785
2858
  _this.showGridLines = showGridLines;
2786
2859
  _this.status = tabSelected;
@@ -2878,7 +2951,6 @@ var FortuneSheet = /*#__PURE__*/function (_FortuneSheetBase) {
2878
2951
  _this.calcChain.push(_chain2);
2879
2952
  }
2880
2953
  }
2881
- _this.dataVerification = _this.generateConfigDataValidations();
2882
2954
  _this.hyperlink = _this.generateConfigHyperlinks();
2883
2955
  _this.hide = _this.hide;
2884
2956
  if (_this.mergeCells != null) {
@@ -4751,7 +4823,7 @@ var FortuneFile = /*#__PURE__*/function () {
4751
4823
  var _iterator = _createForOfIteratorHelper(this.sheets),
4752
4824
  _step;
4753
4825
  try {
4754
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
4826
+ var _loop = function _loop() {
4755
4827
  var _sheet$config;
4756
4828
  var sheet = _step.value;
4757
4829
  var sheetout = {};
@@ -4814,7 +4886,7 @@ var FortuneFile = /*#__PURE__*/function () {
4814
4886
  rs: rs,
4815
4887
  cs: cs
4816
4888
  });
4817
- for (var i = r + 1; i < r + rs; i++) for (var j = c + 1; j < c + cs; j++) merges.set("".concat(i, "_").concat(j), {
4889
+ for (var i = r; i < r + rs; i++) for (var j = c; j < c + cs; j++) if (i !== r || j !== c) merges.set("".concat(i, "_").concat(j), {
4818
4890
  r: r,
4819
4891
  c: c
4820
4892
  });
@@ -4822,6 +4894,7 @@ var FortuneFile = /*#__PURE__*/function () {
4822
4894
  }
4823
4895
  if (sheet.celldata != null) {
4824
4896
  sheetout.celldata = [];
4897
+ var presentCells = new Set();
4825
4898
  var _iterator2 = _createForOfIteratorHelper(sheet.celldata),
4826
4899
  _step2;
4827
4900
  try {
@@ -4830,6 +4903,7 @@ var FortuneFile = /*#__PURE__*/function () {
4830
4903
  _r = _step2$value.r,
4831
4904
  _c = _step2$value.c,
4832
4905
  v = _step2$value.v;
4906
+ presentCells.add("".concat(_r, "_").concat(_c));
4833
4907
  if (_typeof(v) === "object") {
4834
4908
  var _v = v,
4835
4909
  xv = _extends({}, (_objectDestructuringEmpty(_v), _v));
@@ -4856,6 +4930,22 @@ var FortuneFile = /*#__PURE__*/function () {
4856
4930
  } finally {
4857
4931
  _iterator2.f();
4858
4932
  }
4933
+ merges.forEach(function (mergeInfo, key) {
4934
+ if (presentCells.has(key)) {
4935
+ return;
4936
+ }
4937
+ var _key$split$map = key.split("_").map(Number),
4938
+ _key$split$map2 = _slicedToArray(_key$split$map, 2),
4939
+ mr = _key$split$map2[0],
4940
+ mc = _key$split$map2[1];
4941
+ sheetout.celldata.push({
4942
+ r: mr,
4943
+ c: mc,
4944
+ v: {
4945
+ mc: mergeInfo
4946
+ }
4947
+ });
4948
+ });
4859
4949
  }
4860
4950
  if (sheet.chart != null) {
4861
4951
  sheetout.chart = sheet.chart;
@@ -4872,6 +4962,9 @@ var FortuneFile = /*#__PURE__*/function () {
4872
4962
  if (sheet.freezen != null) {
4873
4963
  sheetout.freezen = sheet.freezen;
4874
4964
  }
4965
+ if (sheet.frozen != null) {
4966
+ sheetout.frozen = sheet.frozen;
4967
+ }
4875
4968
  if (sheet.calcChain != null) {
4876
4969
  sheetout.calcChain = sheet.calcChain;
4877
4970
  }
@@ -4888,6 +4981,9 @@ var FortuneFile = /*#__PURE__*/function () {
4888
4981
  sheetout.hide = sheet.hide;
4889
4982
  }
4890
4983
  FortuneOutPutFile.sheets.push(sheetout);
4984
+ };
4985
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
4986
+ _loop();
4891
4987
  }
4892
4988
  } catch (err) {
4893
4989
  _iterator.e(err);
@@ -6528,28 +6624,7 @@ var transformExcelToFortune = /*#__PURE__*/function () {
6528
6624
  setKey(function (k) {
6529
6625
  return k + 1;
6530
6626
  });
6531
- setTimeout(function () {
6532
- var _iterator = _createForOfIteratorHelper(lsh.sheets),
6533
- _step;
6534
- try {
6535
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6536
- var _sheetRef$current, _sheetRef$current2;
6537
- var sheet = _step.value;
6538
- var config = sheet.config;
6539
- (_sheetRef$current = sheetRef.current) === null || _sheetRef$current === void 0 ? void 0 : _sheetRef$current.setColumnWidth((config === null || config === void 0 ? void 0 : config.columnlen) || {}, {
6540
- id: sheet.id
6541
- });
6542
- (_sheetRef$current2 = sheetRef.current) === null || _sheetRef$current2 === void 0 ? void 0 : _sheetRef$current2.setRowHeight((config === null || config === void 0 ? void 0 : config.rowlen) || {}, {
6543
- id: sheet.id
6544
- });
6545
- }
6546
- } catch (err) {
6547
- _iterator.e(err);
6548
- } finally {
6549
- _iterator.f();
6550
- }
6551
- }, 1);
6552
- case 12:
6627
+ case 11:
6553
6628
  case "end":
6554
6629
  return _context.stop();
6555
6630
  }
package/dist/index.js CHANGED
@@ -1921,6 +1921,7 @@ var FortuneSheetBase = /*#__PURE__*/_createClass(function FortuneSheetBase() {
1921
1921
  this.pivotTable = void 0;
1922
1922
  this.luckysheet_conditionformat_save = void 0;
1923
1923
  this.freezen = void 0;
1924
+ this.frozen = void 0;
1924
1925
  this.calcChain = void 0;
1925
1926
  this.images = void 0;
1926
1927
  this.dataVerification = void 0;
@@ -2028,6 +2029,18 @@ var FortuneImageBase = /*#__PURE__*/_createClass(function FortuneImageBase() {
2028
2029
  this.type = void 0;
2029
2030
  });
2030
2031
 
2032
+ var DEFAULT_STYLE_VALUES = {
2033
+ bg: "#FFFFFF",
2034
+ fc: "#000000",
2035
+ ff: "微软雅黑"
2036
+ };
2037
+ function isDefaultValue(key, value) {
2038
+ if (value == null) {
2039
+ return false;
2040
+ }
2041
+ var normalized = key === "bg" || key === "fc" ? value.toUpperCase() : value;
2042
+ return normalized === DEFAULT_STYLE_VALUES[key];
2043
+ }
2031
2044
  var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2032
2045
  function FortuneSheetCelldata(cell, styles, sharedStrings, mergeCells, sheetFile, ReadXml) {
2033
2046
  var _this;
@@ -2209,7 +2222,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2209
2222
  var fillIdNum = parseInt(fillId);
2210
2223
  var fill = fills[fillIdNum];
2211
2224
  var bg = this.getBackgroundByFill(fill, clrScheme);
2212
- if (bg != null) {
2225
+ if (bg != null && !isDefaultValue("bg", bg)) {
2213
2226
  cellValue.bg = bg;
2214
2227
  }
2215
2228
  }
@@ -2235,7 +2248,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2235
2248
  if (colors != null && colors.length > 0) {
2236
2249
  var color = colors[0];
2237
2250
  var fc = getColor(color, this.styles);
2238
- if (fc != null) {
2251
+ if (fc != null && !isDefaultValue("fc", fc)) {
2239
2252
  cellValue.fc = fc;
2240
2253
  }
2241
2254
  }
@@ -2247,7 +2260,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2247
2260
  }
2248
2261
  if (family != null && family.length > 0) {
2249
2262
  var _val = family[0].attributeList.val;
2250
- if (_val != null) {
2263
+ if (_val != null && !isDefaultValue("ff", _val)) {
2251
2264
  cellValue.ff = _val;
2252
2265
  }
2253
2266
  }
@@ -2368,28 +2381,49 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2368
2381
  var diagonal = this.getBorderInfo(diagonals);
2369
2382
  var start = this.getBorderInfo(starts);
2370
2383
  var end = this.getBorderInfo(ends);
2384
+ var skipLeft = false,
2385
+ skipRight = false,
2386
+ skipTop = false,
2387
+ skipBottom = false;
2388
+ if (this.mergeCells != null) {
2389
+ for (var m = 0; m < this.mergeCells.length; m++) {
2390
+ var mref = this.mergeCells[m].attributeList.ref;
2391
+ if (mref == null) {
2392
+ continue;
2393
+ }
2394
+ var mrange = getcellrange(mref);
2395
+ if (mrange == null || this.r < mrange.row[0] || this.r > mrange.row[1] || this.c < mrange.column[0] || this.c > mrange.column[1]) {
2396
+ continue;
2397
+ }
2398
+ skipLeft = this.c > mrange.column[0];
2399
+ skipRight = this.c < mrange.column[1];
2400
+ skipTop = this.r > mrange.row[0];
2401
+ skipBottom = this.r < mrange.row[1];
2402
+ break;
2403
+ }
2404
+ }
2371
2405
  var isAdd = false;
2372
- if (start != null && start.color != null) {
2406
+ if (start != null && start.color != null && !skipLeft) {
2373
2407
  borderCellValue.l = start;
2374
2408
  isAdd = true;
2375
2409
  }
2376
- if (end != null && end.color != null) {
2410
+ if (end != null && end.color != null && !skipRight) {
2377
2411
  borderCellValue.r = end;
2378
2412
  isAdd = true;
2379
2413
  }
2380
- if (left != null && left.color != null) {
2414
+ if (left != null && left.color != null && !skipLeft) {
2381
2415
  borderCellValue.l = left;
2382
2416
  isAdd = true;
2383
2417
  }
2384
- if (right != null && right.color != null) {
2418
+ if (right != null && right.color != null && !skipRight) {
2385
2419
  borderCellValue.r = right;
2386
2420
  isAdd = true;
2387
2421
  }
2388
- if (top != null && top.color != null) {
2422
+ if (top != null && top.color != null && !skipTop) {
2389
2423
  borderCellValue.t = top;
2390
2424
  isAdd = true;
2391
2425
  }
2392
- if (bottom != null && bottom.color != null) {
2426
+ if (bottom != null && bottom.color != null && !skipBottom) {
2393
2427
  borderCellValue.b = bottom;
2394
2428
  isAdd = true;
2395
2429
  }
@@ -2660,7 +2694,7 @@ var FortuneSheetCelldata = /*#__PURE__*/function (_FortuneSheetCelldata2) {
2660
2694
  cellValue.ct = _cellFormat3;
2661
2695
  }
2662
2696
  } else if (t == ST_CellType["InlineString"] && v != null) {
2663
- cellValue.v = "'" + value;
2697
+ cellValue.v = escapeCharacter(value);
2664
2698
  } else {
2665
2699
  value = escapeCharacter(value);
2666
2700
  cellValue.v = value;
@@ -2793,6 +2827,45 @@ var FortuneSheet = /*#__PURE__*/function (_FortuneSheetBase) {
2793
2827
  _this.luckysheet_select_save = [];
2794
2828
  _this.luckysheet_select_save.push(range);
2795
2829
  }
2830
+ var panes = sheetView[0].getInnerElements("pane");
2831
+ if (panes != null && panes.length > 0) {
2832
+ var paneAttr = panes[0].attributeList;
2833
+ if (getXmlAttibute(paneAttr, "state", "") == "frozen") {
2834
+ var xSplit = parseInt(getXmlAttibute(paneAttr, "xSplit", "0"));
2835
+ var ySplit = parseInt(getXmlAttibute(paneAttr, "ySplit", "0"));
2836
+ if (isNaN(xSplit)) {
2837
+ xSplit = 0;
2838
+ }
2839
+ if (isNaN(ySplit)) {
2840
+ ySplit = 0;
2841
+ }
2842
+ if (xSplit > 0 && ySplit > 0) {
2843
+ _this.frozen = {
2844
+ type: "both",
2845
+ range: {
2846
+ row_focus: ySplit - 1,
2847
+ column_focus: xSplit - 1
2848
+ }
2849
+ };
2850
+ } else if (ySplit > 0) {
2851
+ _this.frozen = {
2852
+ type: "rangeRow",
2853
+ range: {
2854
+ row_focus: ySplit - 1,
2855
+ column_focus: -1
2856
+ }
2857
+ };
2858
+ } else if (xSplit > 0) {
2859
+ _this.frozen = {
2860
+ type: "rangeColumn",
2861
+ range: {
2862
+ row_focus: -1,
2863
+ column_focus: xSplit - 1
2864
+ }
2865
+ };
2866
+ }
2867
+ }
2868
+ }
2796
2869
  }
2797
2870
  _this.showGridLines = showGridLines;
2798
2871
  _this.status = tabSelected;
@@ -2890,7 +2963,6 @@ var FortuneSheet = /*#__PURE__*/function (_FortuneSheetBase) {
2890
2963
  _this.calcChain.push(_chain2);
2891
2964
  }
2892
2965
  }
2893
- _this.dataVerification = _this.generateConfigDataValidations();
2894
2966
  _this.hyperlink = _this.generateConfigHyperlinks();
2895
2967
  _this.hide = _this.hide;
2896
2968
  if (_this.mergeCells != null) {
@@ -4763,7 +4835,7 @@ var FortuneFile = /*#__PURE__*/function () {
4763
4835
  var _iterator = _createForOfIteratorHelper(this.sheets),
4764
4836
  _step;
4765
4837
  try {
4766
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
4838
+ var _loop = function _loop() {
4767
4839
  var _sheet$config;
4768
4840
  var sheet = _step.value;
4769
4841
  var sheetout = {};
@@ -4826,7 +4898,7 @@ var FortuneFile = /*#__PURE__*/function () {
4826
4898
  rs: rs,
4827
4899
  cs: cs
4828
4900
  });
4829
- for (var i = r + 1; i < r + rs; i++) for (var j = c + 1; j < c + cs; j++) merges.set("".concat(i, "_").concat(j), {
4901
+ for (var i = r; i < r + rs; i++) for (var j = c; j < c + cs; j++) if (i !== r || j !== c) merges.set("".concat(i, "_").concat(j), {
4830
4902
  r: r,
4831
4903
  c: c
4832
4904
  });
@@ -4834,6 +4906,7 @@ var FortuneFile = /*#__PURE__*/function () {
4834
4906
  }
4835
4907
  if (sheet.celldata != null) {
4836
4908
  sheetout.celldata = [];
4909
+ var presentCells = new Set();
4837
4910
  var _iterator2 = _createForOfIteratorHelper(sheet.celldata),
4838
4911
  _step2;
4839
4912
  try {
@@ -4842,6 +4915,7 @@ var FortuneFile = /*#__PURE__*/function () {
4842
4915
  _r = _step2$value.r,
4843
4916
  _c = _step2$value.c,
4844
4917
  v = _step2$value.v;
4918
+ presentCells.add("".concat(_r, "_").concat(_c));
4845
4919
  if (_typeof(v) === "object") {
4846
4920
  var _v = v,
4847
4921
  xv = _extends({}, (_objectDestructuringEmpty(_v), _v));
@@ -4868,6 +4942,22 @@ var FortuneFile = /*#__PURE__*/function () {
4868
4942
  } finally {
4869
4943
  _iterator2.f();
4870
4944
  }
4945
+ merges.forEach(function (mergeInfo, key) {
4946
+ if (presentCells.has(key)) {
4947
+ return;
4948
+ }
4949
+ var _key$split$map = key.split("_").map(Number),
4950
+ _key$split$map2 = _slicedToArray(_key$split$map, 2),
4951
+ mr = _key$split$map2[0],
4952
+ mc = _key$split$map2[1];
4953
+ sheetout.celldata.push({
4954
+ r: mr,
4955
+ c: mc,
4956
+ v: {
4957
+ mc: mergeInfo
4958
+ }
4959
+ });
4960
+ });
4871
4961
  }
4872
4962
  if (sheet.chart != null) {
4873
4963
  sheetout.chart = sheet.chart;
@@ -4884,6 +4974,9 @@ var FortuneFile = /*#__PURE__*/function () {
4884
4974
  if (sheet.freezen != null) {
4885
4975
  sheetout.freezen = sheet.freezen;
4886
4976
  }
4977
+ if (sheet.frozen != null) {
4978
+ sheetout.frozen = sheet.frozen;
4979
+ }
4887
4980
  if (sheet.calcChain != null) {
4888
4981
  sheetout.calcChain = sheet.calcChain;
4889
4982
  }
@@ -4900,6 +4993,9 @@ var FortuneFile = /*#__PURE__*/function () {
4900
4993
  sheetout.hide = sheet.hide;
4901
4994
  }
4902
4995
  FortuneOutPutFile.sheets.push(sheetout);
4996
+ };
4997
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
4998
+ _loop();
4903
4999
  }
4904
5000
  } catch (err) {
4905
5001
  _iterator.e(err);
@@ -6540,28 +6636,7 @@ var transformExcelToFortune = /*#__PURE__*/function () {
6540
6636
  setKey(function (k) {
6541
6637
  return k + 1;
6542
6638
  });
6543
- setTimeout(function () {
6544
- var _iterator = _createForOfIteratorHelper(lsh.sheets),
6545
- _step;
6546
- try {
6547
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6548
- var _sheetRef$current, _sheetRef$current2;
6549
- var sheet = _step.value;
6550
- var config = sheet.config;
6551
- (_sheetRef$current = sheetRef.current) === null || _sheetRef$current === void 0 ? void 0 : _sheetRef$current.setColumnWidth((config === null || config === void 0 ? void 0 : config.columnlen) || {}, {
6552
- id: sheet.id
6553
- });
6554
- (_sheetRef$current2 = sheetRef.current) === null || _sheetRef$current2 === void 0 ? void 0 : _sheetRef$current2.setRowHeight((config === null || config === void 0 ? void 0 : config.rowlen) || {}, {
6555
- id: sheet.id
6556
- });
6557
- }
6558
- } catch (err) {
6559
- _iterator.e(err);
6560
- } finally {
6561
- _iterator.f();
6562
- }
6563
- }, 1);
6564
- case 12:
6639
+ case 11:
6565
6640
  case "end":
6566
6641
  return _context.stop();
6567
6642
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/excel",
3
- "version": "7.0.9",
3
+ "version": "7.0.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.esm.js",