@corbe30/fortune-excel 1.0.3 → 1.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.
Files changed (102) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/README.md +24 -24
  3. package/dist/HandleZip.js +90 -34
  4. package/dist/ImportHelper.d.ts +2 -0
  5. package/dist/ImportHelper.js +51 -0
  6. package/dist/ToExcel/ExcelBorder.js +141 -141
  7. package/dist/ToExcel/ExcelConvert.js +19 -8
  8. package/dist/ToExcel/ExcelFile.js +66 -22
  9. package/dist/ToExcel/ExcelImage.js +27 -17
  10. package/dist/ToExcel/ExcelStyle.js +7 -7
  11. package/dist/ToFortuneSheet/FortuneBase.js +84 -28
  12. package/dist/ToFortuneSheet/FortuneCell.js +205 -185
  13. package/dist/ToFortuneSheet/FortuneFile.js +117 -111
  14. package/dist/ToFortuneSheet/FortuneImage.js +35 -15
  15. package/dist/ToFortuneSheet/FortuneSheet.js +217 -191
  16. package/dist/ToFortuneSheet/ReadXml.js +114 -87
  17. package/dist/ToolbarItem.d.ts +12 -0
  18. package/dist/ToolbarItem.js +67 -0
  19. package/dist/Transform.d.ts +2 -0
  20. package/dist/Transform.js +78 -0
  21. package/dist/common/constant.js +24 -24
  22. package/dist/common/emf.js +5 -5
  23. package/dist/common/method.js +169 -162
  24. package/dist/icons/ExportIcon.d.ts +3 -0
  25. package/dist/icons/ExportIcon.js +7 -0
  26. package/dist/icons/ImportIcon.d.ts +3 -0
  27. package/dist/icons/ImportIcon.js +7 -0
  28. package/dist/main.d.ts +2 -2
  29. package/dist/main.js +2 -24
  30. package/package.json +2 -2
  31. package/storybook-static/assets/Color-6VNJS4EI-0c01ecf9.js +1 -0
  32. package/storybook-static/assets/DocsRenderer-NNNQARDV-8c85b0e9.js +364 -0
  33. package/storybook-static/assets/Page.stories-2589ebf6.css +1 -0
  34. package/storybook-static/assets/Page.stories-a573643a.js +1948 -0
  35. package/storybook-static/assets/WithTooltip-V3YHNWJZ-a3f0d923.js +1 -0
  36. package/storybook-static/assets/_commonjs-dynamic-modules-302442b1.js +1 -0
  37. package/storybook-static/assets/_commonjsHelpers-de833af9.js +1 -0
  38. package/storybook-static/assets/_getPrototype-1e53b583.js +3 -0
  39. package/storybook-static/assets/entry-preview-b21759a2.js +1 -0
  40. package/storybook-static/assets/entry-preview-docs-d14f77b2.js +54 -0
  41. package/storybook-static/assets/formatter-SWP5E3XI-02b41ceb.js +156 -0
  42. package/storybook-static/assets/iframe-b3040d49.js +1 -0
  43. package/storybook-static/assets/index-1b441bc2.js +1 -0
  44. package/storybook-static/assets/index-356e4a49.js +6 -0
  45. package/storybook-static/assets/index-8b3efc3f.js +9 -0
  46. package/storybook-static/assets/index-9322cee5.js +1 -0
  47. package/storybook-static/assets/preview-0ef86afd.js +7 -0
  48. package/storybook-static/assets/preview-1970e752.js +1 -0
  49. package/storybook-static/assets/preview-2d30111f.js +27 -0
  50. package/storybook-static/assets/preview-2ff2accb.js +1 -0
  51. package/storybook-static/assets/preview-30b54f76.js +20 -0
  52. package/storybook-static/assets/preview-ba2273f4.js +1 -0
  53. package/storybook-static/assets/preview-c56bf6ac.js +1 -0
  54. package/storybook-static/assets/preview-d01b88e8.js +17 -0
  55. package/storybook-static/assets/preview-da31036b.js +396 -0
  56. package/storybook-static/assets/react-18-0a210e0b.js +24 -0
  57. package/storybook-static/assets/syntaxhighlighter-MJWPISIS-6799d638.js +1 -0
  58. package/storybook-static/favicon.svg +7 -0
  59. package/storybook-static/iframe.html +460 -0
  60. package/storybook-static/index.html +127 -0
  61. package/storybook-static/index.json +1 -0
  62. package/storybook-static/project.json +1 -0
  63. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
  64. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
  65. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +12 -0
  66. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
  67. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +63 -0
  68. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +18 -0
  69. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +3 -0
  70. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
  71. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +3 -0
  72. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
  73. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +3 -0
  74. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
  75. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +3 -0
  76. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
  77. package/storybook-static/sb-addons/interactions-8/manager-bundle.js +12 -0
  78. package/storybook-static/sb-addons/interactions-8/manager-bundle.js.LEGAL.txt +0 -0
  79. package/storybook-static/sb-addons/links-0/manager-bundle.js +3 -0
  80. package/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt +0 -0
  81. package/storybook-static/sb-common-assets/fonts.css +31 -0
  82. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  83. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  84. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  85. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  86. package/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-MXTFSDU5.js +1 -0
  87. package/storybook-static/sb-manager/chunk-5QAFKPS7.js +7 -0
  88. package/storybook-static/sb-manager/chunk-7PRFHFSS.js +9 -0
  89. package/storybook-static/sb-manager/chunk-XE6LDGTE.js +406 -0
  90. package/storybook-static/sb-manager/chunk-YDUB7CS6.js +348 -0
  91. package/storybook-static/sb-manager/chunk-ZEU7PDD3.js +1 -0
  92. package/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js +156 -0
  93. package/storybook-static/sb-manager/globals-module-info.js +1 -0
  94. package/storybook-static/sb-manager/globals.js +1 -0
  95. package/storybook-static/sb-manager/index.js +1 -0
  96. package/storybook-static/sb-manager/runtime.js +1 -0
  97. package/storybook-static/sb-manager/syntaxhighlighter-MJWPISIS-JOSCT6CQ.js +1 -0
  98. package/storybook-static/sb-preview/globals.js +1 -0
  99. package/storybook-static/sb-preview/runtime.js +112 -0
  100. package/storybook-static/stories.json +1 -0
  101. package/tsconfig.json +4 -3
  102. package/.github/workflows/main.yml +0 -30
@@ -1,18 +1,35 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
1
16
  import { indexedColors } from "../common/constant.js";
2
17
  import { LightenDarkenColor } from "../common/method.js";
3
- class xmloperation {
18
+ var xmloperation = /** @class */ (function () {
19
+ function xmloperation() {
20
+ }
4
21
  /**
5
22
  * @param tag Search xml tag name , div,title etc.
6
23
  * @param file Xml string
7
24
  * @return Xml element string
8
25
  */
9
- getElementsByOneTag(tag, file) {
26
+ xmloperation.prototype.getElementsByOneTag = function (tag, file) {
10
27
  //<a:[^/>: ]+?>.*?</a:[^/>: ]+?>
11
- let readTagReg;
28
+ var readTagReg;
12
29
  if (tag.indexOf("|") > -1) {
13
- let tags = tag.split("|"), tagsRegTxt = "";
14
- for (let i = 0; i < tags.length; i++) {
15
- let t = tags[i];
30
+ var tags = tag.split("|"), tagsRegTxt = "";
31
+ for (var i = 0; i < tags.length; i++) {
32
+ var t = tags[i];
16
33
  tagsRegTxt +=
17
34
  "|<" +
18
35
  t +
@@ -46,129 +63,136 @@ class xmloperation {
46
63
  tag +
47
64
  "/>", "g");
48
65
  }
49
- let ret = file.match(readTagReg);
66
+ var ret = file.match(readTagReg);
50
67
  if (ret == null) {
51
68
  return [];
52
69
  }
53
70
  else {
54
71
  return ret;
55
72
  }
56
- }
57
- }
58
- export class ReadXml extends xmloperation {
59
- constructor(files) {
60
- super();
61
- this.originFile = files;
73
+ };
74
+ return xmloperation;
75
+ }());
76
+ var ReadXml = /** @class */ (function (_super) {
77
+ __extends(ReadXml, _super);
78
+ function ReadXml(files) {
79
+ var _this = _super.call(this) || this;
80
+ _this.originFile = files;
81
+ return _this;
62
82
  }
63
83
  /**
64
84
  * @param path Search xml tag group , div,title etc.
65
85
  * @param fileName One of uploadfileList, uploadfileList is file group, {key:value}
66
86
  * @return Xml element calss
67
87
  */
68
- getElementsByTagName(path, fileName) {
69
- let file = this.getFileByName(fileName);
70
- let pathArr = path.split("/"), ret;
71
- for (let key in pathArr) {
72
- let path = pathArr[key];
88
+ ReadXml.prototype.getElementsByTagName = function (path, fileName) {
89
+ var file = this.getFileByName(fileName);
90
+ var pathArr = path.split("/"), ret;
91
+ for (var key in pathArr) {
92
+ var path_1 = pathArr[key];
73
93
  if (ret == undefined) {
74
- ret = this.getElementsByOneTag(path, file);
94
+ ret = this.getElementsByOneTag(path_1, file);
75
95
  }
76
96
  else {
77
97
  if (ret instanceof Array) {
78
- let items = [];
79
- for (let key in ret) {
80
- let item = ret[key];
81
- items = items.concat(this.getElementsByOneTag(path, item));
98
+ var items = [];
99
+ for (var key_1 in ret) {
100
+ var item = ret[key_1];
101
+ items = items.concat(this.getElementsByOneTag(path_1, item));
82
102
  }
83
103
  ret = items;
84
104
  }
85
105
  else {
86
- ret = this.getElementsByOneTag(path, ret);
106
+ ret = this.getElementsByOneTag(path_1, ret);
87
107
  }
88
108
  }
89
109
  }
90
- let elements = [];
91
- for (let i = 0; i < ret.length; i++) {
92
- let ele = new Element(ret[i]);
110
+ var elements = [];
111
+ for (var i = 0; i < ret.length; i++) {
112
+ var ele = new Element(ret[i]);
93
113
  elements.push(ele);
94
114
  }
95
115
  return elements;
96
- }
116
+ };
97
117
  /**
98
118
  * @param name One of uploadfileList's name, search for file by this parameter
99
119
  * @retrun Select a file from uploadfileList
100
120
  */
101
- getFileByName(name) {
102
- for (let fileKey in this.originFile) {
121
+ ReadXml.prototype.getFileByName = function (name) {
122
+ for (var fileKey in this.originFile) {
103
123
  if (fileKey.indexOf(name) > -1) {
104
124
  return this.originFile[fileKey];
105
125
  }
106
126
  }
107
127
  return "";
108
- }
109
- }
110
- export class Element extends xmloperation {
111
- constructor(str) {
112
- super();
113
- this.elementString = str;
114
- this.setValue();
115
- const readAttrReg = new RegExp('[a-zA-Z0-9_:]*?=".*?"', "g");
116
- let attrList = this.container.match(readAttrReg);
117
- this.attributeList = {};
128
+ };
129
+ return ReadXml;
130
+ }(xmloperation));
131
+ export { ReadXml };
132
+ var Element = /** @class */ (function (_super) {
133
+ __extends(Element, _super);
134
+ function Element(str) {
135
+ var _this = _super.call(this) || this;
136
+ _this.elementString = str;
137
+ _this.setValue();
138
+ var readAttrReg = new RegExp('[a-zA-Z0-9_:]*?=".*?"', "g");
139
+ var attrList = _this.container.match(readAttrReg);
140
+ _this.attributeList = {};
118
141
  if (attrList != null) {
119
- for (let key in attrList) {
120
- let attrFull = attrList[key];
142
+ for (var key in attrList) {
143
+ var attrFull = attrList[key];
121
144
  // let al= attrFull.split("=");
122
145
  if (attrFull.length == 0) {
123
146
  continue;
124
147
  }
125
- let attrKey = attrFull.substr(0, attrFull.indexOf("="));
126
- let attrValue = attrFull.substr(attrFull.indexOf("=") + 1);
148
+ var attrKey = attrFull.substr(0, attrFull.indexOf("="));
149
+ var attrValue = attrFull.substr(attrFull.indexOf("=") + 1);
127
150
  if (attrKey == null ||
128
151
  attrValue == null ||
129
152
  attrKey.length == 0 ||
130
153
  attrValue.length == 0) {
131
154
  continue;
132
155
  }
133
- this.attributeList[attrKey] = attrValue.substr(1, attrValue.length - 2);
156
+ _this.attributeList[attrKey] = attrValue.substr(1, attrValue.length - 2);
134
157
  }
135
158
  }
159
+ return _this;
136
160
  }
137
161
  /**
138
162
  * @param name Get attribute by key in element
139
163
  * @return Single attribute
140
164
  */
141
- get(name) {
165
+ Element.prototype.get = function (name) {
142
166
  return this.attributeList[name];
143
- }
167
+ };
144
168
  /**
145
169
  * @param tag Get elements by tag in elementString
146
170
  * @return Element group
147
171
  */
148
- getInnerElements(tag) {
149
- let ret = this.getElementsByOneTag(tag, this.elementString);
150
- let elements = [];
151
- for (let i = 0; i < ret.length; i++) {
152
- let ele = new Element(ret[i]);
172
+ Element.prototype.getInnerElements = function (tag) {
173
+ var ret = this.getElementsByOneTag(tag, this.elementString);
174
+ var elements = [];
175
+ for (var i = 0; i < ret.length; i++) {
176
+ var ele = new Element(ret[i]);
153
177
  elements.push(ele);
154
178
  }
155
179
  if (elements.length == 0) {
156
180
  return null;
157
181
  }
158
182
  return elements;
159
- }
183
+ };
160
184
  /**
161
185
  * @desc get xml dom value and container, <container>value</container>
162
186
  */
163
- setValue() {
164
- let str = this.elementString;
187
+ Element.prototype.setValue = function () {
188
+ var str = this.elementString;
165
189
  if (str.substr(str.length - 2, 2) == "/>") {
166
190
  this.value = "";
167
191
  this.container = str;
168
192
  }
169
193
  else {
170
- let firstTag = this.getFirstTag();
171
- const firstTagReg = new RegExp("(<" +
194
+ var firstTag = this.getFirstTag();
195
+ var firstTagReg = new RegExp("(<" +
172
196
  firstTag +
173
197
  " [^>]+?[^/]>)([\\s\\S]*?)</" +
174
198
  firstTag +
@@ -177,7 +201,7 @@ export class Element extends xmloperation {
177
201
  ">)([\\s\\S]*?)</" +
178
202
  firstTag +
179
203
  ">", "g");
180
- let result = firstTagReg.exec(str);
204
+ var result = firstTagReg.exec(str);
181
205
  if (result != null) {
182
206
  if (result[1] != null) {
183
207
  this.container = result[1];
@@ -189,49 +213,52 @@ export class Element extends xmloperation {
189
213
  }
190
214
  }
191
215
  }
192
- }
216
+ };
193
217
  /**
194
218
  * @desc get xml dom first tag, <a><b></b></a>, get a
195
219
  */
196
- getFirstTag() {
197
- let str = this.elementString;
198
- let firstTag = str.substr(0, str.indexOf(" "));
220
+ Element.prototype.getFirstTag = function () {
221
+ var str = this.elementString;
222
+ var firstTag = str.substr(0, str.indexOf(" "));
199
223
  if (firstTag == "" || firstTag.indexOf(">") > -1) {
200
224
  firstTag = str.substr(0, str.indexOf(">"));
201
225
  }
202
226
  firstTag = firstTag.substr(1, firstTag.length);
203
227
  return firstTag;
204
- }
205
- }
228
+ };
229
+ return Element;
230
+ }(xmloperation));
231
+ export { Element };
206
232
  function combineIndexedColor(indexedColorsInner, indexedColors) {
207
- let ret = {};
233
+ var ret = {};
208
234
  if (indexedColorsInner == null || indexedColorsInner.length == 0) {
209
235
  return indexedColors;
210
236
  }
211
- for (let key in indexedColors) {
212
- let value = indexedColors[key], kn = parseInt(key);
213
- let inner = indexedColorsInner[kn];
237
+ for (var key in indexedColors) {
238
+ var value = indexedColors[key], kn = parseInt(key);
239
+ var inner = indexedColorsInner[kn];
214
240
  if (inner == null) {
215
241
  ret[key] = value;
216
242
  }
217
243
  else {
218
- let rgb = inner.attributeList.rgb;
244
+ var rgb = inner.attributeList.rgb;
219
245
  ret[key] = rgb;
220
246
  }
221
247
  }
222
248
  return ret;
223
249
  }
224
250
  //clrScheme:Element[]
225
- export function getColor(color, styles, type = "g") {
226
- let attrList = color.attributeList;
227
- let clrScheme = styles["clrScheme"];
228
- let indexedColorsInner = styles["indexedColors"];
229
- let mruColorsInner = styles["mruColors"];
230
- let indexedColorsList = combineIndexedColor(indexedColorsInner, indexedColors);
231
- let indexed = attrList.indexed, rgb = attrList.rgb, theme = attrList.theme, tint = attrList.tint;
232
- let bg;
251
+ export function getColor(color, styles, type) {
252
+ if (type === void 0) { type = "g"; }
253
+ var attrList = color.attributeList;
254
+ var clrScheme = styles["clrScheme"];
255
+ var indexedColorsInner = styles["indexedColors"];
256
+ var mruColorsInner = styles["mruColors"];
257
+ var indexedColorsList = combineIndexedColor(indexedColorsInner, indexedColors);
258
+ var indexed = attrList.indexed, rgb = attrList.rgb, theme = attrList.theme, tint = attrList.tint;
259
+ var bg;
233
260
  if (indexed != null) {
234
- let indexedNum = parseInt(indexed);
261
+ var indexedNum = parseInt(indexed);
235
262
  bg = indexedColorsList[indexedNum];
236
263
  if (bg != null) {
237
264
  bg = bg.substring(bg.length - 6, bg.length);
@@ -243,7 +270,7 @@ export function getColor(color, styles, type = "g") {
243
270
  bg = "#" + rgb;
244
271
  }
245
272
  else if (theme != null) {
246
- let themeNum = parseInt(theme);
273
+ var themeNum = parseInt(theme);
247
274
  if (themeNum == 0) {
248
275
  themeNum = 1;
249
276
  }
@@ -256,12 +283,12 @@ export function getColor(color, styles, type = "g") {
256
283
  else if (themeNum == 3) {
257
284
  themeNum = 2;
258
285
  }
259
- let clrSchemeElement = clrScheme[themeNum];
286
+ var clrSchemeElement = clrScheme[themeNum];
260
287
  if (clrSchemeElement != null) {
261
- let clrs = clrSchemeElement.getInnerElements("a:sysClr|a:srgbClr");
288
+ var clrs = clrSchemeElement.getInnerElements("a:sysClr|a:srgbClr");
262
289
  if (clrs != null) {
263
- let clr = clrs[0];
264
- let clrAttrList = clr.attributeList;
290
+ var clr = clrs[0];
291
+ var clrAttrList = clr.attributeList;
265
292
  // console.log(clr.container, );
266
293
  if (clr.container.indexOf("sysClr") > -1) {
267
294
  // if(type=="g" && clrAttrList.val=="windowText"){
@@ -286,7 +313,7 @@ export function getColor(color, styles, type = "g") {
286
313
  }
287
314
  }
288
315
  if (tint != null) {
289
- let tintNum = parseFloat(tint);
316
+ var tintNum = parseFloat(tint);
290
317
  if (bg != null) {
291
318
  bg = LightenDarkenColor(bg, tintNum);
292
319
  }
@@ -300,13 +327,13 @@ export function getColor(color, styles, type = "g") {
300
327
  * @return attribute value
301
328
  */
302
329
  export function getlineStringAttr(frpr, attr) {
303
- let attrEle = frpr.getInnerElements(attr), value;
330
+ var attrEle = frpr.getInnerElements(attr), value;
304
331
  if (attrEle != null && attrEle.length > 0) {
305
332
  if (attr == "b" || attr == "i" || attr == "strike") {
306
333
  value = "1";
307
334
  }
308
335
  else if (attr == "u") {
309
- let v = attrEle[0].attributeList.val;
336
+ var v = attrEle[0].attributeList.val;
310
337
  if (v == "double") {
311
338
  value = "2";
312
339
  }
@@ -321,7 +348,7 @@ export function getlineStringAttr(frpr, attr) {
321
348
  }
322
349
  }
323
350
  else if (attr == "vertAlign") {
324
- let v = attrEle[0].attributeList.val;
351
+ var v = attrEle[0].attributeList.val;
325
352
  if (v == "subscript") {
326
353
  value = "1";
327
354
  }
@@ -0,0 +1,12 @@
1
+ export declare const exportToolBarItem: (sheetRef: any) => {
2
+ key: string;
3
+ tooltip: string;
4
+ icon: import("react").JSX.Element;
5
+ onClick: (e: any) => Promise<void>;
6
+ };
7
+ export declare const importToolBarItem: () => {
8
+ key: string;
9
+ tooltip: string;
10
+ icon: import("react").JSX.Element;
11
+ onClick: (e: any) => void;
12
+ };
@@ -0,0 +1,67 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import ExportIcon from "./icons/ExportIcon.js";
38
+ import ImportIcon from "./icons/ImportIcon.js";
39
+ import { transformFortuneToExcel } from "./Transform.js";
40
+ export var exportToolBarItem = function (sheetRef) {
41
+ return {
42
+ key: "export",
43
+ tooltip: "export .xlsl",
44
+ icon: ExportIcon(),
45
+ onClick: function (e) { return __awaiter(void 0, void 0, void 0, function () {
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0: return [4 /*yield*/, transformFortuneToExcel(sheetRef.current)];
49
+ case 1:
50
+ _a.sent();
51
+ return [2 /*return*/];
52
+ }
53
+ });
54
+ }); },
55
+ };
56
+ };
57
+ export var importToolBarItem = function () {
58
+ return {
59
+ key: "import",
60
+ tooltip: "import .xlsl",
61
+ icon: ImportIcon(),
62
+ onClick: function (e) {
63
+ var _a;
64
+ (_a = document.getElementById("ImportHelper")) === null || _a === void 0 ? void 0 : _a.click();
65
+ },
66
+ };
67
+ };
@@ -0,0 +1,2 @@
1
+ export declare const transformExcelToFortune: (e: any, setSheets: any, setKey: any, sheetRef: any) => Promise<void>;
2
+ export declare const transformFortuneToExcel: (luckysheetRef: any) => Promise<void>;
@@ -0,0 +1,78 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { FortuneFile } from "./ToFortuneSheet/FortuneFile.js";
38
+ import { HandleZip } from "./HandleZip.js";
39
+ import { exportSheetExcel } from "./ToExcel/ExcelFile.js";
40
+ export var transformExcelToFortune = function (e, setSheets, setKey, sheetRef) { return __awaiter(void 0, void 0, void 0, function () {
41
+ var excelFile, files, fortuneFile, lsh, config, _i, _a, sheet;
42
+ return __generator(this, function (_b) {
43
+ switch (_b.label) {
44
+ case 0: return [4 /*yield*/, e.target.files[0].arrayBuffer()];
45
+ case 1:
46
+ excelFile = _b.sent();
47
+ return [4 /*yield*/, new HandleZip(excelFile).unzipFile()];
48
+ case 2:
49
+ files = _b.sent();
50
+ fortuneFile = new FortuneFile(files, excelFile.name);
51
+ fortuneFile.Parse();
52
+ lsh = fortuneFile.serialize();
53
+ config = lsh.sheets[0].config;
54
+ for (_i = 0, _a = lsh.sheets; _i < _a.length; _i++) {
55
+ sheet = _a[_i];
56
+ delete sheet.config;
57
+ }
58
+ setSheets(lsh.sheets);
59
+ setKey(function (k) { return k + 1; });
60
+ setTimeout(function () {
61
+ var _a, _b;
62
+ (_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.setColumnWidth((config === null || config === void 0 ? void 0 : config.columnlen) || {});
63
+ (_b = sheetRef.current) === null || _b === void 0 ? void 0 : _b.setRowHeight((config === null || config === void 0 ? void 0 : config.rowlen) || {});
64
+ }, 1);
65
+ return [2 /*return*/];
66
+ }
67
+ });
68
+ }); };
69
+ export var transformFortuneToExcel = function (luckysheetRef) { return __awaiter(void 0, void 0, void 0, function () {
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0: return [4 /*yield*/, exportSheetExcel(luckysheetRef)];
73
+ case 1:
74
+ _a.sent();
75
+ return [2 /*return*/];
76
+ }
77
+ });
78
+ }); };
@@ -1,4 +1,4 @@
1
- export const columeHeader_word = [
1
+ export var columeHeader_word = [
2
2
  "A",
3
3
  "B",
4
4
  "C",
@@ -26,7 +26,7 @@ export const columeHeader_word = [
26
26
  "Y",
27
27
  "Z",
28
28
  ];
29
- export const columeHeader_word_index = {
29
+ export var columeHeader_word_index = {
30
30
  A: 0,
31
31
  B: 1,
32
32
  C: 2,
@@ -54,18 +54,18 @@ export const columeHeader_word_index = {
54
54
  Y: 24,
55
55
  Z: 25,
56
56
  };
57
- export const coreFile = "docProps/core.xml";
58
- export const appFile = "docProps/app.xml";
59
- export const contentTypesFile = "[Content_Types].xml";
60
- export const workBookFile = "xl/workbook.xml";
61
- export const calcChainFile = "xl/calcChain.xml";
62
- export const stylesFile = "xl/styles.xml";
63
- export const sharedStringsFile = "xl/sharedStrings.xml";
64
- export const worksheetFilePath = "xl/worksheets/";
65
- export const theme1File = "xl/theme/theme1.xml";
66
- export const workbookRels = "xl/_rels/workbook.xml.rels";
57
+ export var coreFile = "docProps/core.xml";
58
+ export var appFile = "docProps/app.xml";
59
+ export var contentTypesFile = "[Content_Types].xml";
60
+ export var workBookFile = "xl/workbook.xml";
61
+ export var calcChainFile = "xl/calcChain.xml";
62
+ export var stylesFile = "xl/styles.xml";
63
+ export var sharedStringsFile = "xl/sharedStrings.xml";
64
+ export var worksheetFilePath = "xl/worksheets/";
65
+ export var theme1File = "xl/theme/theme1.xml";
66
+ export var workbookRels = "xl/_rels/workbook.xml.rels";
67
67
  //Excel Built-In cell type
68
- export const ST_CellType = {
68
+ export var ST_CellType = {
69
69
  Boolean: "b",
70
70
  Date: "d",
71
71
  Error: "e",
@@ -75,10 +75,10 @@ export const ST_CellType = {
75
75
  String: "str",
76
76
  };
77
77
  //Excel Built-In cell style
78
- export const BuiltInCellStyles = {
78
+ export var BuiltInCellStyles = {
79
79
  "0": "Normal",
80
80
  };
81
- export let numFmtDefault = {
81
+ export var numFmtDefault = {
82
82
  "0": "General",
83
83
  "1": "0",
84
84
  "2": "0.00",
@@ -108,7 +108,7 @@ export let numFmtDefault = {
108
108
  "48": "##0.0E+0",
109
109
  "49": "@",
110
110
  };
111
- export const indexedColors = {
111
+ export var indexedColors = {
112
112
  "0": "00000000",
113
113
  "1": "00FFFFFF",
114
114
  "2": "00FF0000",
@@ -176,7 +176,7 @@ export const indexedColors = {
176
176
  "64": null, //system Foreground n/a
177
177
  "65": null, //system Background n/a
178
178
  };
179
- export const OEM_CHARSET = {
179
+ export var OEM_CHARSET = {
180
180
  "0": "ANSI_CHARSET",
181
181
  "1": "DEFAULT_CHARSET",
182
182
  "2": "SYMBOL_CHARSET",
@@ -197,7 +197,7 @@ export const OEM_CHARSET = {
197
197
  "238": "EASTEUROPE_CHARSET",
198
198
  "255": "OEM_CHARSET",
199
199
  };
200
- export const borderTypes = {
200
+ export var borderTypes = {
201
201
  none: 0,
202
202
  thin: 1,
203
203
  hair: 2,
@@ -213,12 +213,12 @@ export const borderTypes = {
213
213
  slantDashDot: 12,
214
214
  thick: 13,
215
215
  };
216
- export let numFmtDefaultMap = {
216
+ export var numFmtDefaultMap = {
217
217
  "yyyy/m/d;@": "yyyy/MM/dd",
218
218
  "yyyy&quot;年&quot;m&quot;月&quot;d&quot;日&quot;;@": "yyyy&quot;年&quot;MM&quot;月&quot;dd&quot;日&quot;",
219
219
  "[$-409]yyyy/m/d\\ h:mm\\ AM/PM;@": "yyyy/MM/dd hh:mm AM/PM",
220
220
  };
221
- export const fontFamilys = {
221
+ export var fontFamilys = {
222
222
  "0": "defualt",
223
223
  "1": "Roman",
224
224
  "2": "Swiss",
@@ -226,7 +226,7 @@ export const fontFamilys = {
226
226
  "4": "Script",
227
227
  "5": "Decorative",
228
228
  };
229
- export const DATA_VERIFICATION_MAP = {
229
+ export var DATA_VERIFICATION_MAP = {
230
230
  list: "dropdown",
231
231
  whole: "number_integer",
232
232
  decimal: "number_decimal",
@@ -237,13 +237,13 @@ export const DATA_VERIFICATION_MAP = {
237
237
  unknown2: "checkbox", // no match yet
238
238
  unknown3: "validity", // no match yet
239
239
  };
240
- export const COMMON_TYPE2 = [
240
+ export var COMMON_TYPE2 = [
241
241
  "number",
242
242
  "number_integer",
243
243
  "number_decimal",
244
244
  "text_length",
245
245
  ];
246
- export const DATA_VERIFICATION_TYPE2_MAP = {
246
+ export var DATA_VERIFICATION_TYPE2_MAP = {
247
247
  common: {
248
248
  between: "bw",
249
249
  notBetween: "nb",
@@ -274,4 +274,4 @@ export const DATA_VERIFICATION_TYPE2_MAP = {
274
274
  phone: "phone",
275
275
  },
276
276
  };
277
- export const ALIGNMENT_DEFAULT = -1;
277
+ export var ALIGNMENT_DEFAULT = -1;