@gridsheet/react-core 0.12.3 → 0.12.4-alpha.0

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 (307) hide show
  1. package/dist/components/Cell.d.ts.map +1 -1
  2. package/dist/components/Emitter.d.ts.map +1 -1
  3. package/dist/components/GridSheet.d.ts.map +1 -1
  4. package/dist/components/HeaderLeftCell.d.ts.map +1 -1
  5. package/dist/components/HeaderTopCell.d.ts.map +1 -1
  6. package/dist/components/Resizer.d.ts.map +1 -1
  7. package/dist/components/SearchBox.d.ts.map +1 -1
  8. package/dist/components/Tabular.d.ts.map +1 -1
  9. package/dist/constants.d.ts.map +1 -1
  10. package/dist/formula/evaluator.d.ts.map +1 -1
  11. package/dist/formula/functions/__base.d.ts.map +1 -1
  12. package/dist/formula/solver.d.ts.map +1 -1
  13. package/dist/index.d.ts +1824 -1
  14. package/dist/index.js +5205 -11
  15. package/dist/lib/structs.d.ts.map +1 -1
  16. package/dist/lib/table.d.ts.map +1 -1
  17. package/dist/lib/time.d.ts.map +1 -1
  18. package/dist/lib/virtualization.d.ts.map +1 -1
  19. package/dist/parsers/core.d.ts.map +1 -1
  20. package/dist/renderers/core.d.ts.map +1 -1
  21. package/dist/store/actions.d.ts.map +1 -1
  22. package/dist/store/index.d.ts.map +1 -1
  23. package/dist/types.d.ts.map +1 -1
  24. package/package.json +13 -3
  25. package/dist/components/Cell.d.ts +0 -8
  26. package/dist/components/Cell.js +0 -199
  27. package/dist/components/Cell.js.map +0 -1
  28. package/dist/components/ContextMenu.d.ts +0 -3
  29. package/dist/components/ContextMenu.js +0 -207
  30. package/dist/components/ContextMenu.js.map +0 -1
  31. package/dist/components/Editor.d.ts +0 -3
  32. package/dist/components/Editor.js +0 -304
  33. package/dist/components/Editor.js.map +0 -1
  34. package/dist/components/Emitter.d.ts +0 -9
  35. package/dist/components/Emitter.js +0 -26
  36. package/dist/components/Emitter.js.map +0 -1
  37. package/dist/components/GridSheet.d.ts +0 -4
  38. package/dist/components/GridSheet.js +0 -110
  39. package/dist/components/GridSheet.js.map +0 -1
  40. package/dist/components/HeaderLeftCell.d.ts +0 -7
  41. package/dist/components/HeaderLeftCell.js +0 -67
  42. package/dist/components/HeaderLeftCell.js.map +0 -1
  43. package/dist/components/HeaderTopCell.d.ts +0 -7
  44. package/dist/components/HeaderTopCell.js +0 -68
  45. package/dist/components/HeaderTopCell.js.map +0 -1
  46. package/dist/components/Resizer.d.ts +0 -3
  47. package/dist/components/Resizer.js +0 -83
  48. package/dist/components/Resizer.js.map +0 -1
  49. package/dist/components/SearchBox.d.ts +0 -3
  50. package/dist/components/SearchBox.js +0 -52
  51. package/dist/components/SearchBox.js.map +0 -1
  52. package/dist/components/StoreInitializer.d.ts +0 -4
  53. package/dist/components/StoreInitializer.js +0 -68
  54. package/dist/components/StoreInitializer.js.map +0 -1
  55. package/dist/components/Tabular.d.ts +0 -9
  56. package/dist/components/Tabular.js +0 -84
  57. package/dist/components/Tabular.js.map +0 -1
  58. package/dist/constants.d.ts +0 -18
  59. package/dist/constants.js +0 -21
  60. package/dist/constants.js.map +0 -1
  61. package/dist/formula/evaluator.d.ts +0 -91
  62. package/dist/formula/evaluator.js +0 -541
  63. package/dist/formula/evaluator.js.map +0 -1
  64. package/dist/formula/functions/__base.d.ts +0 -23
  65. package/dist/formula/functions/__base.js +0 -16
  66. package/dist/formula/functions/__base.js.map +0 -1
  67. package/dist/formula/functions/__utils.d.ts +0 -6
  68. package/dist/formula/functions/__utils.js +0 -102
  69. package/dist/formula/functions/__utils.js.map +0 -1
  70. package/dist/formula/functions/abs.d.ts +0 -12
  71. package/dist/formula/functions/abs.js +0 -21
  72. package/dist/formula/functions/abs.js.map +0 -1
  73. package/dist/formula/functions/abs.spec.d.ts +0 -2
  74. package/dist/formula/functions/abs.spec.js +0 -29
  75. package/dist/formula/functions/abs.spec.js.map +0 -1
  76. package/dist/formula/functions/acos.d.ts +0 -12
  77. package/dist/formula/functions/acos.js +0 -29
  78. package/dist/formula/functions/acos.js.map +0 -1
  79. package/dist/formula/functions/add.d.ts +0 -13
  80. package/dist/formula/functions/add.js +0 -50
  81. package/dist/formula/functions/add.js.map +0 -1
  82. package/dist/formula/functions/and.d.ts +0 -19
  83. package/dist/formula/functions/and.js +0 -28
  84. package/dist/formula/functions/and.js.map +0 -1
  85. package/dist/formula/functions/asin.d.ts +0 -12
  86. package/dist/formula/functions/asin.js +0 -29
  87. package/dist/formula/functions/asin.js.map +0 -1
  88. package/dist/formula/functions/atan.d.ts +0 -12
  89. package/dist/formula/functions/atan.js +0 -26
  90. package/dist/formula/functions/atan.js.map +0 -1
  91. package/dist/formula/functions/atan2.d.ts +0 -12
  92. package/dist/formula/functions/atan2.js +0 -32
  93. package/dist/formula/functions/atan2.js.map +0 -1
  94. package/dist/formula/functions/average.d.ts +0 -19
  95. package/dist/formula/functions/average.js +0 -41
  96. package/dist/formula/functions/average.js.map +0 -1
  97. package/dist/formula/functions/col.d.ts +0 -14
  98. package/dist/formula/functions/col.js +0 -30
  99. package/dist/formula/functions/col.js.map +0 -1
  100. package/dist/formula/functions/concat.d.ts +0 -12
  101. package/dist/formula/functions/concat.js +0 -27
  102. package/dist/formula/functions/concat.js.map +0 -1
  103. package/dist/formula/functions/concatenate.d.ts +0 -19
  104. package/dist/formula/functions/concatenate.js +0 -25
  105. package/dist/formula/functions/concatenate.js.map +0 -1
  106. package/dist/formula/functions/cos.d.ts +0 -12
  107. package/dist/formula/functions/cos.js +0 -26
  108. package/dist/formula/functions/cos.js.map +0 -1
  109. package/dist/formula/functions/count.d.ts +0 -19
  110. package/dist/formula/functions/count.js +0 -35
  111. package/dist/formula/functions/count.js.map +0 -1
  112. package/dist/formula/functions/counta.d.ts +0 -19
  113. package/dist/formula/functions/counta.js +0 -35
  114. package/dist/formula/functions/counta.js.map +0 -1
  115. package/dist/formula/functions/countif.d.ts +0 -13
  116. package/dist/formula/functions/countif.js +0 -30
  117. package/dist/formula/functions/countif.js.map +0 -1
  118. package/dist/formula/functions/divide.d.ts +0 -12
  119. package/dist/formula/functions/divide.js +0 -33
  120. package/dist/formula/functions/divide.js.map +0 -1
  121. package/dist/formula/functions/eq.d.ts +0 -12
  122. package/dist/formula/functions/eq.js +0 -25
  123. package/dist/formula/functions/eq.js.map +0 -1
  124. package/dist/formula/functions/exp.d.ts +0 -12
  125. package/dist/formula/functions/exp.js +0 -28
  126. package/dist/formula/functions/exp.js.map +0 -1
  127. package/dist/formula/functions/gt.d.ts +0 -12
  128. package/dist/formula/functions/gt.js +0 -27
  129. package/dist/formula/functions/gt.js.map +0 -1
  130. package/dist/formula/functions/gte.d.ts +0 -12
  131. package/dist/formula/functions/gte.js +0 -27
  132. package/dist/formula/functions/gte.js.map +0 -1
  133. package/dist/formula/functions/hlookup.d.ts +0 -18
  134. package/dist/formula/functions/hlookup.js +0 -74
  135. package/dist/formula/functions/hlookup.js.map +0 -1
  136. package/dist/formula/functions/if.d.ts +0 -17
  137. package/dist/formula/functions/if.js +0 -36
  138. package/dist/formula/functions/if.js.map +0 -1
  139. package/dist/formula/functions/iferror.d.ts +0 -20
  140. package/dist/formula/functions/iferror.js +0 -41
  141. package/dist/formula/functions/iferror.js.map +0 -1
  142. package/dist/formula/functions/iferror.spec.d.ts +0 -2
  143. package/dist/formula/functions/iferror.spec.js +0 -61
  144. package/dist/formula/functions/iferror.spec.js.map +0 -1
  145. package/dist/formula/functions/len.d.ts +0 -12
  146. package/dist/formula/functions/len.js +0 -26
  147. package/dist/formula/functions/len.js.map +0 -1
  148. package/dist/formula/functions/lenb.d.ts +0 -12
  149. package/dist/formula/functions/lenb.js +0 -26
  150. package/dist/formula/functions/lenb.js.map +0 -1
  151. package/dist/formula/functions/ln.d.ts +0 -12
  152. package/dist/formula/functions/ln.js +0 -29
  153. package/dist/formula/functions/ln.js.map +0 -1
  154. package/dist/formula/functions/log.d.ts +0 -12
  155. package/dist/formula/functions/log.js +0 -35
  156. package/dist/formula/functions/log.js.map +0 -1
  157. package/dist/formula/functions/log10.d.ts +0 -12
  158. package/dist/formula/functions/log10.js +0 -29
  159. package/dist/formula/functions/log10.js.map +0 -1
  160. package/dist/formula/functions/lt.d.ts +0 -12
  161. package/dist/formula/functions/lt.js +0 -27
  162. package/dist/formula/functions/lt.js.map +0 -1
  163. package/dist/formula/functions/lte.d.ts +0 -12
  164. package/dist/formula/functions/lte.js +0 -27
  165. package/dist/formula/functions/lte.js.map +0 -1
  166. package/dist/formula/functions/max.d.ts +0 -19
  167. package/dist/formula/functions/max.js +0 -44
  168. package/dist/formula/functions/max.js.map +0 -1
  169. package/dist/formula/functions/min.d.ts +0 -19
  170. package/dist/formula/functions/min.js +0 -44
  171. package/dist/formula/functions/min.js.map +0 -1
  172. package/dist/formula/functions/minus.d.ts +0 -13
  173. package/dist/formula/functions/minus.js +0 -50
  174. package/dist/formula/functions/minus.js.map +0 -1
  175. package/dist/formula/functions/mod.d.ts +0 -12
  176. package/dist/formula/functions/mod.js +0 -31
  177. package/dist/formula/functions/mod.js.map +0 -1
  178. package/dist/formula/functions/mod.spec.d.ts +0 -2
  179. package/dist/formula/functions/mod.spec.js +0 -52
  180. package/dist/formula/functions/mod.spec.js.map +0 -1
  181. package/dist/formula/functions/multiply.d.ts +0 -12
  182. package/dist/formula/functions/multiply.js +0 -27
  183. package/dist/formula/functions/multiply.js.map +0 -1
  184. package/dist/formula/functions/ne.d.ts +0 -12
  185. package/dist/formula/functions/ne.js +0 -25
  186. package/dist/formula/functions/ne.js.map +0 -1
  187. package/dist/formula/functions/not.d.ts +0 -12
  188. package/dist/formula/functions/not.js +0 -30
  189. package/dist/formula/functions/not.js.map +0 -1
  190. package/dist/formula/functions/now.d.ts +0 -9
  191. package/dist/formula/functions/now.js +0 -21
  192. package/dist/formula/functions/now.js.map +0 -1
  193. package/dist/formula/functions/or.d.ts +0 -19
  194. package/dist/formula/functions/or.js +0 -28
  195. package/dist/formula/functions/or.js.map +0 -1
  196. package/dist/formula/functions/pi.d.ts +0 -9
  197. package/dist/formula/functions/pi.js +0 -19
  198. package/dist/formula/functions/pi.js.map +0 -1
  199. package/dist/formula/functions/power.d.ts +0 -12
  200. package/dist/formula/functions/power.js +0 -24
  201. package/dist/formula/functions/power.js.map +0 -1
  202. package/dist/formula/functions/product.d.ts +0 -19
  203. package/dist/formula/functions/product.js +0 -37
  204. package/dist/formula/functions/product.js.map +0 -1
  205. package/dist/formula/functions/radians.d.ts +0 -12
  206. package/dist/formula/functions/radians.js +0 -26
  207. package/dist/formula/functions/radians.js.map +0 -1
  208. package/dist/formula/functions/rand.d.ts +0 -9
  209. package/dist/formula/functions/rand.js +0 -19
  210. package/dist/formula/functions/rand.js.map +0 -1
  211. package/dist/formula/functions/round.d.ts +0 -17
  212. package/dist/formula/functions/round.js +0 -34
  213. package/dist/formula/functions/round.js.map +0 -1
  214. package/dist/formula/functions/rounddown.d.ts +0 -17
  215. package/dist/formula/functions/rounddown.js +0 -34
  216. package/dist/formula/functions/rounddown.js.map +0 -1
  217. package/dist/formula/functions/roundup.d.ts +0 -17
  218. package/dist/formula/functions/roundup.js +0 -34
  219. package/dist/formula/functions/roundup.js.map +0 -1
  220. package/dist/formula/functions/row.d.ts +0 -14
  221. package/dist/formula/functions/row.js +0 -30
  222. package/dist/formula/functions/row.js.map +0 -1
  223. package/dist/formula/functions/sin.d.ts +0 -12
  224. package/dist/formula/functions/sin.js +0 -26
  225. package/dist/formula/functions/sin.js.map +0 -1
  226. package/dist/formula/functions/sqrt.d.ts +0 -12
  227. package/dist/formula/functions/sqrt.js +0 -29
  228. package/dist/formula/functions/sqrt.js.map +0 -1
  229. package/dist/formula/functions/sum.d.ts +0 -19
  230. package/dist/formula/functions/sum.js +0 -44
  231. package/dist/formula/functions/sum.js.map +0 -1
  232. package/dist/formula/functions/sum.spec.d.ts +0 -2
  233. package/dist/formula/functions/sum.spec.js +0 -40
  234. package/dist/formula/functions/sum.spec.js.map +0 -1
  235. package/dist/formula/functions/sumif.d.ts +0 -18
  236. package/dist/formula/functions/sumif.js +0 -59
  237. package/dist/formula/functions/sumif.js.map +0 -1
  238. package/dist/formula/functions/tan.d.ts +0 -12
  239. package/dist/formula/functions/tan.js +0 -26
  240. package/dist/formula/functions/tan.js.map +0 -1
  241. package/dist/formula/functions/uminus.d.ts +0 -12
  242. package/dist/formula/functions/uminus.js +0 -23
  243. package/dist/formula/functions/uminus.js.map +0 -1
  244. package/dist/formula/functions/vlookup.d.ts +0 -18
  245. package/dist/formula/functions/vlookup.js +0 -74
  246. package/dist/formula/functions/vlookup.js.map +0 -1
  247. package/dist/formula/mapping.d.ts +0 -114
  248. package/dist/formula/mapping.js +0 -114
  249. package/dist/formula/mapping.js.map +0 -1
  250. package/dist/formula/solver.d.ts +0 -12
  251. package/dist/formula/solver.js +0 -64
  252. package/dist/formula/solver.js.map +0 -1
  253. package/dist/index.js.map +0 -1
  254. package/dist/lib/autofill.d.ts +0 -17
  255. package/dist/lib/autofill.js +0 -389
  256. package/dist/lib/autofill.js.map +0 -1
  257. package/dist/lib/clipboard.d.ts +0 -3
  258. package/dist/lib/clipboard.js +0 -45
  259. package/dist/lib/clipboard.js.map +0 -1
  260. package/dist/lib/converters.d.ts +0 -10
  261. package/dist/lib/converters.js +0 -127
  262. package/dist/lib/converters.js.map +0 -1
  263. package/dist/lib/structs.d.ts +0 -60
  264. package/dist/lib/structs.js +0 -251
  265. package/dist/lib/structs.js.map +0 -1
  266. package/dist/lib/table.d.ts +0 -299
  267. package/dist/lib/table.js +0 -989
  268. package/dist/lib/table.js.map +0 -1
  269. package/dist/lib/time.d.ts +0 -14
  270. package/dist/lib/time.js +0 -60
  271. package/dist/lib/time.js.map +0 -1
  272. package/dist/lib/virtualization.d.ts +0 -30
  273. package/dist/lib/virtualization.js +0 -114
  274. package/dist/lib/virtualization.js.map +0 -1
  275. package/dist/parsers/core.d.ts +0 -36
  276. package/dist/parsers/core.js +0 -123
  277. package/dist/parsers/core.js.map +0 -1
  278. package/dist/renderers/checkbox.d.ts +0 -5
  279. package/dist/renderers/checkbox.js +0 -10
  280. package/dist/renderers/checkbox.js.map +0 -1
  281. package/dist/renderers/core.d.ts +0 -48
  282. package/dist/renderers/core.js +0 -143
  283. package/dist/renderers/core.js.map +0 -1
  284. package/dist/renderers/thousand_separator.d.ts +0 -5
  285. package/dist/renderers/thousand_separator.js +0 -14
  286. package/dist/renderers/thousand_separator.js.map +0 -1
  287. package/dist/store/actions.d.ts +0 -198
  288. package/dist/store/actions.js +0 -519
  289. package/dist/store/actions.js.map +0 -1
  290. package/dist/store/helpers.d.ts +0 -28
  291. package/dist/store/helpers.js +0 -78
  292. package/dist/store/helpers.js.map +0 -1
  293. package/dist/store/index.d.ts +0 -11
  294. package/dist/store/index.js +0 -3
  295. package/dist/store/index.js.map +0 -1
  296. package/dist/styles/embedder.d.ts +0 -2
  297. package/dist/styles/embedder.js +0 -16
  298. package/dist/styles/embedder.js.map +0 -1
  299. package/dist/styles/minified.d.ts +0 -3
  300. package/dist/styles/minified.js +0 -4
  301. package/dist/styles/minified.js.map +0 -1
  302. package/dist/types.d.ts +0 -213
  303. package/dist/types.js +0 -2
  304. package/dist/types.js.map +0 -1
  305. package/dist/utils.d.ts +0 -2
  306. package/dist/utils.js +0 -7
  307. package/dist/utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tabular.js","sourceRoot":"","sources":["../../src/components/Tabular.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,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4BAC7C,4BAAI,SAAS,EAAC,aAAa,GAAG,CAC3B,CAAC,CAAC;oBACT,CAAC,CAAC,CAEE,CACF,CACJ,CACF,CACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- export declare const DUMMY_IMG: HTMLImageElement;
2
- export declare const HISTORY_LIMIT = 10;
3
- export declare const DEFAULT_HEIGHT = 24;
4
- export declare const DEFAULT_WIDTH = 90;
5
- export declare const SHEET_HEIGHT = 500;
6
- export declare const SHEET_WIDTH = 1000;
7
- export declare const HEADER_HEIGHT = 24;
8
- export declare const HEADER_WIDTH = 50;
9
- export declare const MIN_WIDTH = 5;
10
- export declare const MIN_HEIGHT = 5;
11
- export declare const OVERSCAN_X = 5;
12
- export declare const OVERSCAN_Y = 10;
13
- export declare const DEFAULT_ALPHABET_CACHE_SIZE = 1000;
14
- export declare class Special {
15
- name: string;
16
- constructor(name: string);
17
- }
18
- //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js DELETED
@@ -1,21 +0,0 @@
1
- export const DUMMY_IMG = document.createElement("img");
2
- DUMMY_IMG.src =
3
- "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
4
- export const HISTORY_LIMIT = 10;
5
- export const DEFAULT_HEIGHT = 24;
6
- export const DEFAULT_WIDTH = 90;
7
- export const SHEET_HEIGHT = 500;
8
- export const SHEET_WIDTH = 1000;
9
- export const HEADER_HEIGHT = 24;
10
- export const HEADER_WIDTH = 50;
11
- export const MIN_WIDTH = 5;
12
- export const MIN_HEIGHT = 5;
13
- export const OVERSCAN_X = 5;
14
- export const OVERSCAN_Y = 10;
15
- export const DEFAULT_ALPHABET_CACHE_SIZE = 1000;
16
- export class Special {
17
- constructor(name) {
18
- this.name = name;
19
- }
20
- }
21
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACvD,SAAS,CAAC,GAAG;IACX,4EAA4E,CAAC;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC;AAEhC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAE7B,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEhD,MAAM,OAAO,OAAO;IAElB,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -1,91 +0,0 @@
1
- import { Table } from "../lib/table";
2
- declare type EvaluateProps = {
3
- table: Table;
4
- };
5
- export declare class FormulaError {
6
- code: string;
7
- message: string;
8
- error?: Error;
9
- constructor(code: string, message: string, error?: Error);
10
- }
11
- declare class Entity<T = any> {
12
- value: T;
13
- constructor(value: T);
14
- }
15
- export declare class Value extends Entity {
16
- evaluate({}: EvaluateProps): any;
17
- }
18
- export declare class Unreferenced extends Entity {
19
- evaluate({}: EvaluateProps): void;
20
- }
21
- export declare class InvalidRef extends Entity {
22
- evaluate({}: EvaluateProps): void;
23
- }
24
- export declare class Ref extends Entity {
25
- constructor(value: string);
26
- evaluate({ table }: EvaluateProps): Table;
27
- id(table: Table): any;
28
- }
29
- export declare class Range extends Entity<string> {
30
- constructor(value: string);
31
- evaluate({ table }: EvaluateProps): Table;
32
- idRange(table: Table): string;
33
- private complementRange;
34
- }
35
- export declare class Id extends Entity {
36
- evaluate({ table }: EvaluateProps): import("../lib/table").ReadonlyTable;
37
- ref(table: Table, slideY?: number, slideX?: number): string | undefined;
38
- slide(table: Table, slideY?: number, slideX?: number): string | undefined;
39
- }
40
- export declare class IdRange extends Entity<string> {
41
- evaluate({ table }: EvaluateProps): Table;
42
- range(table: Table, slideY?: number, slideX?: number): string;
43
- slide(table: Table, slideY?: number, slideX?: number): string;
44
- }
45
- export declare class Function {
46
- args: Expression[];
47
- name: string;
48
- precedence: number;
49
- constructor(name: string, precedence?: number, args?: Expression[]);
50
- evaluate({ table }: EvaluateProps): any;
51
- }
52
- export declare type Expression = Value | Ref | Range | Id | IdRange | Function | Unreferenced | InvalidRef;
53
- export declare type TokenType = "VALUE" | "REF" | "RANGE" | "ID" | "ID_RANGE" | "FUNCTION" | "PREFIX_OPERATOR" | "INFIX_OPERATOR" | "OPEN" | "CLOSE" | "COMMA" | "SPACE" | "UNREFERENCED" | "INVALID_REF";
54
- export declare class Token {
55
- type: TokenType;
56
- entity: any;
57
- precedence: number;
58
- constructor(type: TokenType, entity: any, precedence?: number);
59
- convert(): Value | Unreferenced | InvalidRef | Ref | Range | Id | IdRange | Function | undefined;
60
- }
61
- export declare class Lexer {
62
- private index;
63
- tokens: Token[];
64
- private formula;
65
- constructor(formula: string);
66
- private isWhiteSpace;
67
- private next;
68
- private get;
69
- private getToken;
70
- stringifyToId(table: Table, slideY?: number, slideX?: number): string;
71
- stringifyToRef(table: Table): string;
72
- tokenize(): void;
73
- private skipSpaces;
74
- private getString;
75
- }
76
- export declare class Parser {
77
- index: number;
78
- depth: number;
79
- tokens: Token[];
80
- constructor(tokens: Token[]);
81
- build(): Expression | undefined;
82
- private parse;
83
- }
84
- export declare const convertFormulaAbsolute: ({ value, table, slideY, slideX, }: {
85
- value: any;
86
- table: Table;
87
- slideY?: number | undefined;
88
- slideX?: number | undefined;
89
- }) => any;
90
- export {};
91
- //# sourceMappingURL=evaluator.d.ts.map
@@ -1,541 +0,0 @@
1
- import { rangeToArea } from "../lib/structs";
2
- import { a2p, x2c } from "../lib/converters";
3
- // strip sharp and dollars
4
- const getId = (idString, stripAbsolute = true) => {
5
- let id = idString.slice(1);
6
- if (stripAbsolute && id.startsWith("$")) {
7
- id = id.slice(1);
8
- }
9
- if (stripAbsolute && id.endsWith("$")) {
10
- id = id.slice(0, -1);
11
- }
12
- return id;
13
- };
14
- export class FormulaError {
15
- constructor(code, message, error) {
16
- this.code = code;
17
- this.message = message;
18
- this.error = error;
19
- }
20
- }
21
- class Entity {
22
- constructor(value) {
23
- this.value = value;
24
- }
25
- }
26
- export class Value extends Entity {
27
- evaluate({}) {
28
- return this.value;
29
- }
30
- }
31
- export class Unreferenced extends Entity {
32
- evaluate({}) {
33
- throw new FormulaError("#REF!", `Reference does not exist.`);
34
- }
35
- }
36
- export class InvalidRef extends Entity {
37
- evaluate({}) {
38
- throw new FormulaError("#NAME?", `Invalid ref: ${this.value}`);
39
- }
40
- }
41
- export class Ref extends Entity {
42
- constructor(value) {
43
- super(value.toUpperCase());
44
- }
45
- evaluate({ table }) {
46
- const { y, x } = a2p(this.value);
47
- return table.trim({ top: y, left: x, bottom: y, right: x });
48
- }
49
- id(table) {
50
- const id = table.getIdByAddress(this.value);
51
- if (id) {
52
- return id;
53
- }
54
- return this.value;
55
- }
56
- }
57
- export class Range extends Entity {
58
- constructor(value) {
59
- super(value.toUpperCase());
60
- }
61
- evaluate({ table }) {
62
- const area = rangeToArea(this.complementRange(table));
63
- return table.trim(area);
64
- }
65
- idRange(table) {
66
- return this.value
67
- .split(":")
68
- .map((ref) => table.getIdByAddress(ref))
69
- .join(":");
70
- }
71
- complementRange(table) {
72
- const cells = this.value.split(":");
73
- let [start = "", end = ""] = cells;
74
- if (!start.match(/[1-9]\d*/)) {
75
- start += "1";
76
- }
77
- if (!start.match(/[a-zA-Z]/)) {
78
- start = "A" + start;
79
- }
80
- if (!end.match(/[1-9]\d*/)) {
81
- end += table.getNumRows();
82
- }
83
- if (!end.match(/[a-zA-Z]/)) {
84
- end = x2c(table.getNumCols() + 1) + end;
85
- }
86
- return `${start}:${end}`;
87
- }
88
- }
89
- export class Id extends Entity {
90
- evaluate({ table }) {
91
- const id = getId(this.value);
92
- const { y, x } = table.getPointById(id);
93
- return table.trim({ top: y, left: x, bottom: y, right: x });
94
- }
95
- ref(table, slideY = 0, slideX = 0) {
96
- return table.getAddressById(getId(this.value, false), slideY, slideX);
97
- }
98
- slide(table, slideY = 0, slideX = 0) {
99
- const address = this.ref(table, slideY, slideX);
100
- if (address == null || address.length < 2) {
101
- return "#REF!";
102
- }
103
- return table.getIdByAddress(address);
104
- }
105
- }
106
- export class IdRange extends Entity {
107
- evaluate({ table }) {
108
- const ids = this.value.split(":");
109
- const [p1, p2] = ids
110
- .map((id) => getId(id))
111
- .map((id) => table.getPointById(id));
112
- return table.trim({ top: p1.y, left: p1.x, bottom: p2.y, right: p2.x });
113
- }
114
- range(table, slideY = 0, slideX = 0) {
115
- return this.value
116
- .split(":")
117
- .map((id) => getId(id, false))
118
- .map((id) => table.getAddressById(id, slideY, slideX))
119
- .join(":");
120
- }
121
- slide(table, slideY = 0, slideX = 0) {
122
- const range = this.range(table, slideY, slideX);
123
- return new Range(range).idRange(table);
124
- }
125
- }
126
- export class Function {
127
- constructor(name, precedence = 0, args = []) {
128
- this.name = name;
129
- this.precedence = precedence;
130
- this.args = args;
131
- }
132
- evaluate({ table }) {
133
- const name = this.name.toLowerCase();
134
- const Func = table.getFunction(name);
135
- if (Func == null) {
136
- throw new FormulaError("#NAME?", `Unknown function: ${name}`);
137
- }
138
- const func = new Func({ args: this.args, table });
139
- return func.call();
140
- }
141
- }
142
- const ZERO = new Value(0);
143
- const INFIX_FUNCTION_NAME_MAP = {
144
- "+": "add",
145
- "-": "minus",
146
- "/": "divide",
147
- "*": "multiply",
148
- "^": "power",
149
- "&": "concat",
150
- "=": "eq",
151
- "<>": "ne",
152
- ">": "gt",
153
- ">=": "gte",
154
- "<": "lt",
155
- "<=": "lte",
156
- };
157
- const PREFIX_FUNCTION_NAME_MAP = {
158
- "-": "uminus",
159
- };
160
- export class Token {
161
- constructor(type, entity, precedence = 0) {
162
- this.type = type;
163
- this.entity = entity;
164
- this.precedence = precedence;
165
- }
166
- convert() {
167
- switch (this.type) {
168
- case "VALUE":
169
- return new Value(this.entity);
170
- case "ID":
171
- return new Id(this.entity);
172
- case "ID_RANGE":
173
- return new IdRange(this.entity);
174
- case "REF":
175
- return new Ref(this.entity);
176
- case "RANGE":
177
- return new Range(this.entity);
178
- case "INFIX_OPERATOR": {
179
- const name = INFIX_FUNCTION_NAME_MAP[this.entity];
180
- return new Function(name, this.precedence);
181
- }
182
- case "PREFIX_OPERATOR": {
183
- const name = PREFIX_FUNCTION_NAME_MAP[this.entity];
184
- return new Function(name, this.precedence);
185
- }
186
- case "FUNCTION":
187
- return new Function(this.entity);
188
- case "UNREFERENCED":
189
- return new Unreferenced(this.entity);
190
- case "INVALID_REF":
191
- return new InvalidRef(this.entity);
192
- }
193
- }
194
- }
195
- const isWhiteSpace = (char) => {
196
- return char === " " || char === "\n" || char === "\t";
197
- };
198
- const TOKEN_OPEN = new Token("OPEN", "("), TOKEN_CLOSE = new Token("CLOSE", ")"), TOKEN_COMMA = new Token("COMMA", ","), TOKEN_ADD = new Token("INFIX_OPERATOR", "+", 3), TOKEN_MINUS = new Token("INFIX_OPERATOR", "-", 3), TOKEN_UMINUS = new Token("PREFIX_OPERATOR", "-", 6), TOKEN_DIVIDE = new Token("INFIX_OPERATOR", "/", 4), TOKEN_MULTIPLY = new Token("INFIX_OPERATOR", "*", 4), TOKEN_POWER = new Token("INFIX_OPERATOR", "^", 5), TOKEN_CONCAT = new Token("INFIX_OPERATOR", "&", 4), TOKEN_GTE = new Token("INFIX_OPERATOR", ">=", 2), TOKEN_GT = new Token("INFIX_OPERATOR", ">", 2), TOKEN_LTE = new Token("INFIX_OPERATOR", "<=", 2), TOKEN_LT = new Token("INFIX_OPERATOR", "<", 2), TOKEN_NE = new Token("INFIX_OPERATOR", "<>", 1), TOKEN_EQ = new Token("INFIX_OPERATOR", "=", 1);
199
- const BOOLS = { ["true"]: true, ["false"]: false };
200
- export class Lexer {
201
- constructor(formula) {
202
- this.tokens = [];
203
- this.formula = formula;
204
- this.index = 0;
205
- this.tokens = [];
206
- }
207
- isWhiteSpace() {
208
- return isWhiteSpace(this.formula[this.index]);
209
- }
210
- next(base = 1) {
211
- this.index += base;
212
- }
213
- get(base = 0) {
214
- const c = this.formula[this.index + base];
215
- return c;
216
- }
217
- getToken(base = 0) {
218
- return this.tokens[this.tokens.length + base];
219
- }
220
- stringifyToId(table, slideY = 0, slideX = 0) {
221
- return this.tokens
222
- .map((t) => {
223
- switch (t.type) {
224
- case "VALUE":
225
- if (typeof t.entity === "number" || typeof t.entity === "boolean") {
226
- return t.entity;
227
- }
228
- return `"${t.entity}"`;
229
- case "ID":
230
- return new Id(t.entity).slide(table, slideY, slideX);
231
- case "ID_RANGE":
232
- return new IdRange(t.entity).slide(table, slideY, slideX);
233
- case "REF":
234
- return new Ref(t.entity).id(table);
235
- case "RANGE":
236
- return new Range(t.entity).idRange(table);
237
- }
238
- return t.entity;
239
- })
240
- .join("");
241
- }
242
- stringifyToRef(table) {
243
- return this.tokens
244
- .map((t) => {
245
- switch (t.type) {
246
- case "VALUE":
247
- if (typeof t.entity === "number" || typeof t.entity === "boolean") {
248
- return t.entity;
249
- }
250
- return `"${t.entity}"`;
251
- case "ID":
252
- return new Id(t.entity).ref(table);
253
- case "ID_RANGE":
254
- return new IdRange(t.entity).range(table);
255
- }
256
- return t.entity;
257
- })
258
- .join("");
259
- }
260
- tokenize() {
261
- var _a, _b;
262
- while (this.index <= this.formula.length) {
263
- this.skipSpaces();
264
- const char = this.get();
265
- this.next();
266
- switch (char) {
267
- case undefined:
268
- return;
269
- case "(":
270
- this.tokens.push(TOKEN_OPEN);
271
- continue;
272
- case ")":
273
- this.tokens.push(TOKEN_CLOSE);
274
- continue;
275
- case ",":
276
- this.tokens.push(TOKEN_COMMA);
277
- continue;
278
- case "+":
279
- this.tokens.push(TOKEN_ADD);
280
- continue;
281
- case "-": {
282
- const prev1 = (_a = this.getToken(-1)) === null || _a === void 0 ? void 0 : _a.type;
283
- const prev2 = (_b = this.getToken(-2)) === null || _b === void 0 ? void 0 : _b.type;
284
- if (prev1 === "INFIX_OPERATOR" ||
285
- (prev1 === "SPACE" && prev2 === "INFIX_OPERATOR")) {
286
- this.tokens.push(TOKEN_UMINUS);
287
- }
288
- else {
289
- this.tokens.push(TOKEN_MINUS);
290
- }
291
- continue;
292
- }
293
- case "/":
294
- this.tokens.push(TOKEN_DIVIDE);
295
- continue;
296
- case "*":
297
- this.tokens.push(TOKEN_MULTIPLY);
298
- continue;
299
- case "^":
300
- this.tokens.push(TOKEN_POWER);
301
- continue;
302
- case "&":
303
- this.tokens.push(TOKEN_CONCAT);
304
- continue;
305
- case "=":
306
- this.tokens.push(TOKEN_EQ);
307
- continue;
308
- case ">":
309
- if (this.get() === "=") {
310
- this.next();
311
- this.tokens.push(TOKEN_GTE);
312
- continue;
313
- }
314
- this.tokens.push(TOKEN_GT);
315
- continue;
316
- case "<":
317
- if (this.get() === "=") {
318
- this.next();
319
- this.tokens.push(TOKEN_LTE);
320
- continue;
321
- }
322
- if (this.get() === ">") {
323
- this.next();
324
- this.tokens.push(TOKEN_NE);
325
- continue;
326
- }
327
- this.tokens.push(TOKEN_LT);
328
- continue;
329
- case '"': {
330
- const buf = this.getString();
331
- this.tokens.push(new Token("VALUE", buf));
332
- continue;
333
- }
334
- } // switch end
335
- let buf = char;
336
- while (true) {
337
- const c = this.get();
338
- if (c === "(") {
339
- this.tokens.push(new Token("FUNCTION", buf), TOKEN_OPEN);
340
- this.next();
341
- break;
342
- }
343
- if (c == null || c.match(/[ +\-/*^&=<>),]/)) {
344
- if (buf.length === 0) {
345
- break;
346
- }
347
- if (buf.match(/^[+-]?(\d*[.])?\d+$/)) {
348
- this.tokens.push(new Token("VALUE", parseFloat(buf)));
349
- }
350
- else {
351
- // @ts-ignore
352
- const bool = BOOLS[buf.toLowerCase()];
353
- if (bool != null) {
354
- this.tokens.push(new Token("VALUE", bool));
355
- }
356
- else if (buf.startsWith("#")) {
357
- if (buf === "#REF!") {
358
- this.tokens.push(new Token("UNREFERENCED", buf));
359
- }
360
- else if (buf.indexOf(":") !== -1) {
361
- this.tokens.push(new Token("ID_RANGE", buf));
362
- }
363
- else {
364
- this.tokens.push(new Token("ID", buf));
365
- }
366
- }
367
- else if (buf.indexOf(":") !== -1) {
368
- this.tokens.push(new Token("RANGE", buf));
369
- }
370
- else {
371
- // @ts-ignore
372
- if (isNaN(buf[buf.length - 1])) {
373
- this.tokens.push(new Token("INVALID_REF", buf));
374
- }
375
- else {
376
- this.tokens.push(new Token("REF", buf));
377
- }
378
- }
379
- }
380
- break;
381
- }
382
- buf += c;
383
- this.next();
384
- }
385
- }
386
- }
387
- skipSpaces() {
388
- let space = "";
389
- while (this.isWhiteSpace()) {
390
- space += this.formula[this.index++];
391
- }
392
- if (space !== "") {
393
- this.tokens.push(new Token("SPACE", space));
394
- }
395
- }
396
- getString() {
397
- let buf = "";
398
- while (true) {
399
- const c = this.get();
400
- this.next();
401
- if (c == null) {
402
- break;
403
- }
404
- if (c === '"') {
405
- if (this.get() === '"') {
406
- // escape
407
- buf += '"';
408
- this.next();
409
- continue;
410
- }
411
- else {
412
- break;
413
- }
414
- }
415
- else {
416
- buf += c;
417
- }
418
- }
419
- return buf;
420
- }
421
- }
422
- export class Parser {
423
- constructor(tokens) {
424
- this.index = 0;
425
- this.depth = 0;
426
- this.tokens = tokens;
427
- }
428
- build() {
429
- const { expr } = this.parse(false);
430
- return expr;
431
- }
432
- parse(underFunction) {
433
- const stack = [];
434
- let lastOperator;
435
- const complement = (hasNext = false) => {
436
- if (lastOperator) {
437
- const outer = stack.pop();
438
- lastOperator.args.push(outer);
439
- }
440
- return { hasNext, expr: stack.shift() };
441
- };
442
- while (this.tokens.length > this.index) {
443
- const token = this.tokens[this.index++];
444
- if (token.type === "SPACE") {
445
- continue;
446
- }
447
- if (token.type === "COMMA") {
448
- if (!underFunction) {
449
- throw new FormulaError("#ERROR!", "Invalid comma");
450
- }
451
- return complement(true);
452
- }
453
- else if (token.type === "VALUE" ||
454
- token.type === "ID" ||
455
- token.type === "ID_RANGE" ||
456
- token.type === "REF" ||
457
- token.type === "RANGE" ||
458
- token.type === "UNREFERENCED" ||
459
- token.type === "INVALID_REF") {
460
- const expr = token.convert();
461
- stack.push(expr);
462
- }
463
- else if (token.type === "FUNCTION") {
464
- this.index++;
465
- this.depth++;
466
- const func = token.convert();
467
- stack.push(func);
468
- while (true) {
469
- const { expr, hasNext } = this.parse(true);
470
- if (expr) {
471
- func.args.push(expr);
472
- }
473
- if (!hasNext) {
474
- break;
475
- }
476
- }
477
- }
478
- else if (token.type === "OPEN") {
479
- this.depth++;
480
- const { expr } = this.parse(false);
481
- stack.push(expr);
482
- }
483
- else if (token.type === "CLOSE") {
484
- if (this.depth-- === 0) {
485
- throw new FormulaError("#ERROR!", "Unexpected end paren");
486
- }
487
- return complement();
488
- }
489
- else if (token.type === "INFIX_OPERATOR") {
490
- const operator = token.convert();
491
- let left = stack.pop();
492
- if (left == null) {
493
- if (operator.name === "minus" || operator.name === "add") {
494
- left = ZERO;
495
- }
496
- else {
497
- throw new FormulaError("#ERROR!", "Missing left expression");
498
- }
499
- }
500
- if (lastOperator == null) {
501
- operator.args.push(left);
502
- stack.unshift(operator);
503
- }
504
- else if (operator.precedence > lastOperator.precedence) {
505
- operator.args.push(left);
506
- lastOperator.args.push(operator);
507
- stack.unshift(lastOperator);
508
- }
509
- else {
510
- const outer = stack.shift();
511
- operator.args.push(outer);
512
- lastOperator.args.push(left);
513
- stack.unshift(operator);
514
- }
515
- lastOperator = operator;
516
- }
517
- else if (token.type === "PREFIX_OPERATOR") {
518
- const operator = token.convert();
519
- if (lastOperator) {
520
- lastOperator.args.push(operator);
521
- }
522
- else {
523
- stack.unshift(operator);
524
- }
525
- lastOperator = operator;
526
- }
527
- }
528
- return complement();
529
- }
530
- }
531
- export const convertFormulaAbsolute = ({ value, table, slideY = 0, slideX = 0, }) => {
532
- if (typeof value === "string" || value instanceof String) {
533
- if (value.charAt(0) === "=") {
534
- const lexer = new Lexer(value.substring(1));
535
- lexer.tokenize();
536
- return "=" + lexer.stringifyToId(table, slideY, slideX);
537
- }
538
- }
539
- return value;
540
- };
541
- //# sourceMappingURL=evaluator.js.map