@gridsheet/react-core 1.4.0-alpha.2 → 1.4.0-alpha.3

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 (235) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +7 -0
  2. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  3. package/dist/_virtual/dayjs.min.js +8 -0
  4. package/dist/_virtual/dayjs.min.js.map +1 -0
  5. package/dist/_virtual/dayjs.min2.js +5 -0
  6. package/dist/_virtual/dayjs.min2.js.map +1 -0
  7. package/dist/_virtual/jsx-runtime.js +6 -0
  8. package/dist/_virtual/jsx-runtime.js.map +1 -0
  9. package/dist/_virtual/jsx-runtime2.js +5 -0
  10. package/dist/_virtual/jsx-runtime2.js.map +1 -0
  11. package/dist/_virtual/react-jsx-runtime.development.js +5 -0
  12. package/dist/_virtual/react-jsx-runtime.development.js.map +1 -0
  13. package/dist/_virtual/react-jsx-runtime.production.js +5 -0
  14. package/dist/_virtual/react-jsx-runtime.production.js.map +1 -0
  15. package/dist/_virtual/timezone.js +8 -0
  16. package/dist/_virtual/timezone.js.map +1 -0
  17. package/dist/_virtual/timezone2.js +5 -0
  18. package/dist/_virtual/timezone2.js.map +1 -0
  19. package/dist/_virtual/utc.js +8 -0
  20. package/dist/_virtual/utc.js.map +1 -0
  21. package/dist/_virtual/utc2.js +5 -0
  22. package/dist/_virtual/utc2.js.map +1 -0
  23. package/dist/components/Cell.js +232 -0
  24. package/dist/components/Cell.js.map +1 -0
  25. package/dist/components/ContextMenu.js +297 -0
  26. package/dist/components/ContextMenu.js.map +1 -0
  27. package/dist/components/Editor.js +455 -0
  28. package/dist/components/Editor.js.map +1 -0
  29. package/dist/components/Emitter.js +26 -0
  30. package/dist/components/Emitter.js.map +1 -0
  31. package/dist/components/Fixed.js +17 -0
  32. package/dist/components/Fixed.js.map +1 -0
  33. package/dist/components/FormulaBar.js +149 -0
  34. package/dist/components/FormulaBar.js.map +1 -0
  35. package/dist/components/GridSheet.js +246 -0
  36. package/dist/components/GridSheet.js.map +1 -0
  37. package/dist/components/HeaderCellLeft.js +131 -0
  38. package/dist/components/HeaderCellLeft.js.map +1 -0
  39. package/dist/components/HeaderCellTop.js +132 -0
  40. package/dist/components/HeaderCellTop.js.map +1 -0
  41. package/dist/components/PluginBase.js +35 -0
  42. package/dist/components/PluginBase.js.map +1 -0
  43. package/dist/components/Resizer.js +98 -0
  44. package/dist/components/Resizer.js.map +1 -0
  45. package/dist/components/SearchBar.js +108 -0
  46. package/dist/components/SearchBar.js.map +1 -0
  47. package/dist/components/SheetProvider.js +56 -0
  48. package/dist/components/SheetProvider.js.map +1 -0
  49. package/dist/components/StoreInitializer.js +84 -0
  50. package/dist/components/StoreInitializer.js.map +1 -0
  51. package/dist/components/Tabular.js +308 -0
  52. package/dist/components/Tabular.js.map +1 -0
  53. package/dist/components/hooks.js +15 -0
  54. package/dist/components/hooks.js.map +1 -0
  55. package/dist/components/svg/Base.js +24 -0
  56. package/dist/components/svg/Base.js.map +1 -0
  57. package/dist/components/svg/CloseIcon.js +13 -0
  58. package/dist/components/svg/CloseIcon.js.map +1 -0
  59. package/dist/components/svg/SearchIcon.js +13 -0
  60. package/dist/components/svg/SearchIcon.js.map +1 -0
  61. package/dist/constants.js +43 -0
  62. package/dist/constants.js.map +1 -0
  63. package/dist/formula/evaluator.js +674 -0
  64. package/dist/formula/evaluator.js.map +1 -0
  65. package/dist/formula/functions/__base.js +19 -0
  66. package/dist/formula/functions/__base.js.map +1 -0
  67. package/dist/formula/functions/__utils.js +145 -0
  68. package/dist/formula/functions/__utils.js.map +1 -0
  69. package/dist/formula/functions/abs.js +24 -0
  70. package/dist/formula/functions/abs.js.map +1 -0
  71. package/dist/formula/functions/acos.js +32 -0
  72. package/dist/formula/functions/acos.js.map +1 -0
  73. package/dist/formula/functions/add.js +57 -0
  74. package/dist/formula/functions/add.js.map +1 -0
  75. package/dist/formula/functions/and.js +28 -0
  76. package/dist/formula/functions/and.js.map +1 -0
  77. package/dist/formula/functions/asin.js +32 -0
  78. package/dist/formula/functions/asin.js.map +1 -0
  79. package/dist/formula/functions/atan.js +29 -0
  80. package/dist/formula/functions/atan.js.map +1 -0
  81. package/dist/formula/functions/atan2.js +35 -0
  82. package/dist/formula/functions/atan2.js.map +1 -0
  83. package/dist/formula/functions/average.js +44 -0
  84. package/dist/formula/functions/average.js.map +1 -0
  85. package/dist/formula/functions/col.js +31 -0
  86. package/dist/formula/functions/col.js.map +1 -0
  87. package/dist/formula/functions/concat.js +27 -0
  88. package/dist/formula/functions/concat.js.map +1 -0
  89. package/dist/formula/functions/concatenate.js +28 -0
  90. package/dist/formula/functions/concatenate.js.map +1 -0
  91. package/dist/formula/functions/cos.js +29 -0
  92. package/dist/formula/functions/cos.js.map +1 -0
  93. package/dist/formula/functions/count.js +38 -0
  94. package/dist/formula/functions/count.js.map +1 -0
  95. package/dist/formula/functions/counta.js +38 -0
  96. package/dist/formula/functions/counta.js.map +1 -0
  97. package/dist/formula/functions/countif.js +32 -0
  98. package/dist/formula/functions/countif.js.map +1 -0
  99. package/dist/formula/functions/divide.js +33 -0
  100. package/dist/formula/functions/divide.js.map +1 -0
  101. package/dist/formula/functions/eq.js +29 -0
  102. package/dist/formula/functions/eq.js.map +1 -0
  103. package/dist/formula/functions/exp.js +29 -0
  104. package/dist/formula/functions/exp.js.map +1 -0
  105. package/dist/formula/functions/gt.js +29 -0
  106. package/dist/formula/functions/gt.js.map +1 -0
  107. package/dist/formula/functions/gte.js +29 -0
  108. package/dist/formula/functions/gte.js.map +1 -0
  109. package/dist/formula/functions/hlookup.js +75 -0
  110. package/dist/formula/functions/hlookup.js.map +1 -0
  111. package/dist/formula/functions/if.js +39 -0
  112. package/dist/formula/functions/if.js.map +1 -0
  113. package/dist/formula/functions/iferror.js +45 -0
  114. package/dist/formula/functions/iferror.js.map +1 -0
  115. package/dist/formula/functions/len.js +29 -0
  116. package/dist/formula/functions/len.js.map +1 -0
  117. package/dist/formula/functions/lenb.js +29 -0
  118. package/dist/formula/functions/lenb.js.map +1 -0
  119. package/dist/formula/functions/ln.js +32 -0
  120. package/dist/formula/functions/ln.js.map +1 -0
  121. package/dist/formula/functions/log.js +36 -0
  122. package/dist/formula/functions/log.js.map +1 -0
  123. package/dist/formula/functions/log10.js +32 -0
  124. package/dist/formula/functions/log10.js.map +1 -0
  125. package/dist/formula/functions/lt.js +29 -0
  126. package/dist/formula/functions/lt.js.map +1 -0
  127. package/dist/formula/functions/lte.js +29 -0
  128. package/dist/formula/functions/lte.js.map +1 -0
  129. package/dist/formula/functions/max.js +47 -0
  130. package/dist/formula/functions/max.js.map +1 -0
  131. package/dist/formula/functions/min.js +47 -0
  132. package/dist/formula/functions/min.js.map +1 -0
  133. package/dist/formula/functions/minus.js +57 -0
  134. package/dist/formula/functions/minus.js.map +1 -0
  135. package/dist/formula/functions/mod.js +33 -0
  136. package/dist/formula/functions/mod.js.map +1 -0
  137. package/dist/formula/functions/multiply.js +27 -0
  138. package/dist/formula/functions/multiply.js.map +1 -0
  139. package/dist/formula/functions/ne.js +29 -0
  140. package/dist/formula/functions/ne.js.map +1 -0
  141. package/dist/formula/functions/not.js +30 -0
  142. package/dist/formula/functions/not.js.map +1 -0
  143. package/dist/formula/functions/now.js +22 -0
  144. package/dist/formula/functions/now.js.map +1 -0
  145. package/dist/formula/functions/or.js +28 -0
  146. package/dist/formula/functions/or.js.map +1 -0
  147. package/dist/formula/functions/pi.js +22 -0
  148. package/dist/formula/functions/pi.js.map +1 -0
  149. package/dist/formula/functions/power.js +27 -0
  150. package/dist/formula/functions/power.js.map +1 -0
  151. package/dist/formula/functions/product.js +40 -0
  152. package/dist/formula/functions/product.js.map +1 -0
  153. package/dist/formula/functions/radians.js +29 -0
  154. package/dist/formula/functions/radians.js.map +1 -0
  155. package/dist/formula/functions/rand.js +22 -0
  156. package/dist/formula/functions/rand.js.map +1 -0
  157. package/dist/formula/functions/round.js +35 -0
  158. package/dist/formula/functions/round.js.map +1 -0
  159. package/dist/formula/functions/rounddown.js +35 -0
  160. package/dist/formula/functions/rounddown.js.map +1 -0
  161. package/dist/formula/functions/roundup.js +35 -0
  162. package/dist/formula/functions/roundup.js.map +1 -0
  163. package/dist/formula/functions/row.js +31 -0
  164. package/dist/formula/functions/row.js.map +1 -0
  165. package/dist/formula/functions/sin.js +29 -0
  166. package/dist/formula/functions/sin.js.map +1 -0
  167. package/dist/formula/functions/sqrt.js +32 -0
  168. package/dist/formula/functions/sqrt.js.map +1 -0
  169. package/dist/formula/functions/sum.js +47 -0
  170. package/dist/formula/functions/sum.js.map +1 -0
  171. package/dist/formula/functions/sumif.js +65 -0
  172. package/dist/formula/functions/sumif.js.map +1 -0
  173. package/dist/formula/functions/tan.js +29 -0
  174. package/dist/formula/functions/tan.js.map +1 -0
  175. package/dist/formula/functions/uminus.js +24 -0
  176. package/dist/formula/functions/uminus.js.map +1 -0
  177. package/dist/formula/functions/vlookup.js +75 -0
  178. package/dist/formula/functions/vlookup.js.map +1 -0
  179. package/dist/formula/mapping.js +118 -0
  180. package/dist/formula/mapping.js.map +1 -0
  181. package/dist/formula/solver.js +70 -0
  182. package/dist/formula/solver.js.map +1 -0
  183. package/dist/index.js +16 -9113
  184. package/dist/index.js.map +1 -1
  185. package/dist/lib/autofill.js +391 -0
  186. package/dist/lib/autofill.js.map +1 -0
  187. package/dist/lib/clipboard.js +46 -0
  188. package/dist/lib/clipboard.js.map +1 -0
  189. package/dist/lib/converters.js +141 -0
  190. package/dist/lib/converters.js.map +1 -0
  191. package/dist/lib/input.js +52 -0
  192. package/dist/lib/input.js.map +1 -0
  193. package/dist/lib/palette.js +24 -0
  194. package/dist/lib/palette.js.map +1 -0
  195. package/dist/lib/prevention.js +82 -0
  196. package/dist/lib/prevention.js.map +1 -0
  197. package/dist/lib/structs.js +276 -0
  198. package/dist/lib/structs.js.map +1 -0
  199. package/dist/lib/table.js +1248 -0
  200. package/dist/lib/table.js.map +1 -0
  201. package/dist/lib/time.js +79 -0
  202. package/dist/lib/time.js.map +1 -0
  203. package/dist/lib/virtualization.js +129 -0
  204. package/dist/lib/virtualization.js.map +1 -0
  205. package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js +287 -0
  206. package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js.map +1 -0
  207. package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/timezone.js +72 -0
  208. package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/timezone.js.map +1 -0
  209. package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/utc.js +85 -0
  210. package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/utc.js.map +1 -0
  211. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.development.js +454 -0
  212. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -0
  213. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.production.js +42 -0
  214. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.production.js.map +1 -0
  215. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/jsx-runtime.js +18 -0
  216. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/jsx-runtime.js.map +1 -0
  217. package/dist/parsers/core.js +139 -0
  218. package/dist/parsers/core.js.map +1 -0
  219. package/dist/renderers/checkbox.js +20 -0
  220. package/dist/renderers/checkbox.js.map +1 -0
  221. package/dist/renderers/core.js +147 -0
  222. package/dist/renderers/core.js.map +1 -0
  223. package/dist/renderers/thousand_separator.js +17 -0
  224. package/dist/renderers/thousand_separator.js.map +1 -0
  225. package/dist/store/actions.js +762 -0
  226. package/dist/store/actions.js.map +1 -0
  227. package/dist/store/helpers.js +88 -0
  228. package/dist/store/helpers.js.map +1 -0
  229. package/dist/store/index.js +8 -0
  230. package/dist/store/index.js.map +1 -0
  231. package/dist/styles/embedder.js +19 -0
  232. package/dist/styles/embedder.js.map +1 -0
  233. package/dist/styles/minified.js +7 -0
  234. package/dist/styles/minified.js.map +1 -0
  235. package/package.json +1 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or.js","sources":["../../../formula/functions/or.ts"],"sourcesContent":["import { BaseFunction } from './__base';\nimport { ensureBoolean } from './__utils';\n\nexport class OrFunction extends BaseFunction {\n example = 'OR(A1=1, A2=2)';\n helpText = ['Returns TRUE if any argument is logically true.', 'Returns FALSE if all arguments are logically false.'];\n helpArgs = [\n { name: 'expression1', description: 'First logical expression.' },\n {\n name: 'expression2',\n description: 'Additional expressions',\n optional: true,\n iterable: true,\n },\n ];\n\n protected validate() {\n this.bareArgs = this.bareArgs.map((arg) => ensureBoolean(arg));\n }\n\n protected main(...values: boolean[]) {\n return values.reduce((a, b) => a || b);\n }\n}\n"],"names":[],"mappings":";;AAGO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,mDAAmD,qDAAqD;AACzG,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,eAAe,aAAa,4BAA4B;AAAA,MAChE;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACd,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,cAAc,GAAG,CAAC;AAAA,EAAA;AAAA,EAGrD,QAAQ,QAAmB;AACnC,WAAO,OAAO,OAAO,CAAC,GAAG,MAAM,KAAK,CAAC;AAAA,EAAA;AAEzC;"}
@@ -0,0 +1,22 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ class PiFunction extends BaseFunction {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.example = "PI()";
7
+ this.helpText = ["Returns the value of pi."];
8
+ this.helpArgs = [];
9
+ }
10
+ validate() {
11
+ if (this.bareArgs.length !== 0) {
12
+ throw new FormulaError("#N/A", "Number of arguments for PI is incorrect.");
13
+ }
14
+ }
15
+ main() {
16
+ return Math.PI;
17
+ }
18
+ }
19
+ export {
20
+ PiFunction
21
+ };
22
+ //# sourceMappingURL=pi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.js","sources":["../../../formula/functions/pi.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\n\nexport class PiFunction extends BaseFunction {\n example = 'PI()';\n helpText = ['Returns the value of pi.'];\n helpArgs = [];\n\n protected validate() {\n if (this.bareArgs.length !== 0) {\n throw new FormulaError('#N/A', 'Number of arguments for PI is incorrect.');\n }\n }\n\n protected main() {\n return Math.PI;\n }\n}\n"],"names":[],"mappings":";;AAGO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,0BAA0B;AACtC,SAAA,WAAW,CAAC;AAAA,EAAA;AAAA,EAEF,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,0CAA0C;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,OAAO;AACf,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
@@ -0,0 +1,27 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class PowerFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "POWER(4,0.5)";
8
+ this.helpText = ["Returns a number multiplied by an exponent."];
9
+ this.helpArgs = [
10
+ { name: "base", description: "A number to be multiplied by an exponent." },
11
+ { name: "exponent", description: "An exponent to power the base." }
12
+ ];
13
+ }
14
+ validate() {
15
+ if (this.bareArgs.length !== 2) {
16
+ throw new FormulaError("#N/A", "Number of arguments for POWER is incorrect.");
17
+ }
18
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
19
+ }
20
+ main(base, exponent) {
21
+ return Math.pow(base, exponent);
22
+ }
23
+ }
24
+ export {
25
+ PowerFunction
26
+ };
27
+ //# sourceMappingURL=power.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"power.js","sources":["../../../formula/functions/power.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class PowerFunction extends BaseFunction {\n example = 'POWER(4,0.5)';\n helpText = ['Returns a number multiplied by an exponent.'];\n helpArgs = [\n { name: 'base', description: 'A number to be multiplied by an exponent.' },\n { name: 'exponent', description: 'An exponent to power the base.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for POWER is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(base: number, exponent: number) {\n return Math.pow(base, exponent);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,6CAA6C;AAC9C,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,QAAQ,aAAa,4CAA4C;AAAA,MACzE,EAAE,MAAM,YAAY,aAAa,iCAAiC;AAAA,IACpE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAEzE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,MAAc,UAAkB;AACtC,WAAA,KAAK,IAAI,MAAM,QAAQ;AAAA,EAAA;AAElC;"}
@@ -0,0 +1,40 @@
1
+ import { solveTable } from "../solver.js";
2
+ import { Table } from "../../lib/table.js";
3
+ import { BaseFunction } from "./__base.js";
4
+ import { ensureNumber } from "./__utils.js";
5
+ class ProductFunction extends BaseFunction {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.example = "PRODUCT(A2:A100)";
9
+ this.helpText = ["Returns the product of a series of numbers or cells."];
10
+ this.helpArgs = [
11
+ { name: "value1", description: "First number or range." },
12
+ {
13
+ name: "value2",
14
+ description: "Additional numbers or ranges",
15
+ optional: true,
16
+ iterable: true
17
+ }
18
+ ];
19
+ }
20
+ validate() {
21
+ const spreaded = [];
22
+ this.bareArgs.forEach((arg) => {
23
+ if (arg instanceof Table) {
24
+ spreaded.push(
25
+ ...solveTable({ table: arg }).reduce((a, b) => a.concat(b)).filter((v) => typeof v === "number")
26
+ );
27
+ return;
28
+ }
29
+ spreaded.push(ensureNumber(arg));
30
+ });
31
+ this.bareArgs = spreaded;
32
+ }
33
+ main(...values) {
34
+ return values.reduce((a, b) => a * b);
35
+ }
36
+ }
37
+ export {
38
+ ProductFunction
39
+ };
40
+ //# sourceMappingURL=product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.js","sources":["../../../formula/functions/product.ts"],"sourcesContent":["import { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class ProductFunction extends BaseFunction {\n example = 'PRODUCT(A2:A100)';\n helpText = ['Returns the product of a series of numbers or cells.'];\n helpArgs = [\n { name: 'value1', description: 'First number or range.' },\n {\n name: 'value2',\n description: 'Additional numbers or ranges',\n optional: true,\n iterable: true,\n },\n ];\n\n protected validate() {\n const spreaded: number[] = [];\n this.bareArgs.forEach((arg) => {\n if (arg instanceof Table) {\n spreaded.push(\n ...solveTable({ table: arg })\n .reduce((a, b) => a.concat(b))\n .filter((v: any) => typeof v === 'number'),\n );\n return;\n }\n spreaded.push(ensureNumber(arg));\n });\n this.bareArgs = spreaded;\n }\n\n protected main(...values: number[]) {\n return values.reduce((a, b) => a * b);\n }\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,wBAAwB,aAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,sDAAsD;AACvD,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,yBAAyB;AAAA,MACxD;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACnB,UAAM,WAAqB,CAAC;AACvB,SAAA,SAAS,QAAQ,CAAC,QAAQ;AAC7B,UAAI,eAAe,OAAO;AACf,iBAAA;AAAA,UACP,GAAG,WAAW,EAAE,OAAO,IAAK,CAAA,EACzB,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5B,OAAO,CAAC,MAAW,OAAO,MAAM,QAAQ;AAAA,QAC7C;AACA;AAAA,MAAA;AAEO,eAAA,KAAK,aAAa,GAAG,CAAC;AAAA,IAAA,CAChC;AACD,SAAK,WAAW;AAAA,EAAA;AAAA,EAGR,QAAQ,QAAkB;AAClC,WAAO,OAAO,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,EAAA;AAExC;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class RadiansFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "RADIANS(180)";
8
+ this.helpText = ["Converts an angle from degrees to radians."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "angle",
12
+ description: "The angle to convert from degrees to radians."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for RADIANS is incorrect.");
19
+ }
20
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
+ }
22
+ main(angle) {
23
+ return angle / 180 * Math.PI;
24
+ }
25
+ }
26
+ export {
27
+ RadiansFunction
28
+ };
29
+ //# sourceMappingURL=radians.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radians.js","sources":["../../../formula/functions/radians.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class RadiansFunction extends BaseFunction {\n example = 'RADIANS(180)';\n helpText = ['Converts an angle from degrees to radians.'];\n helpArgs = [\n {\n name: 'angle',\n description: 'The angle to convert from degrees to radians.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for RADIANS is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(angle: number) {\n return (angle / 180) * Math.PI;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,wBAAwB,aAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,4CAA4C;AAC7C,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,+CAA+C;AAAA,IAAA;AAE3E,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,OAAe;AACpB,WAAA,QAAQ,MAAO,KAAK;AAAA,EAAA;AAEhC;"}
@@ -0,0 +1,22 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ class RandFunction extends BaseFunction {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.example = "RAND()";
7
+ this.helpText = ["Returns a random number between 0 and 1."];
8
+ this.helpArgs = [];
9
+ }
10
+ validate() {
11
+ if (this.bareArgs.length !== 0) {
12
+ throw new FormulaError("#N/A", "Number of arguments for RAND is incorrect.");
13
+ }
14
+ }
15
+ main() {
16
+ return Math.random();
17
+ }
18
+ }
19
+ export {
20
+ RandFunction
21
+ };
22
+ //# sourceMappingURL=rand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rand.js","sources":["../../../formula/functions/rand.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\n\nexport class RandFunction extends BaseFunction {\n example = 'RAND()';\n helpText = ['Returns a random number between 0 and 1.'];\n helpArgs = [];\n\n protected validate() {\n if (this.bareArgs.length !== 0) {\n throw new FormulaError('#N/A', 'Number of arguments for RAND is incorrect.');\n }\n }\n\n protected main() {\n return Math.random();\n }\n}\n"],"names":[],"mappings":";;AAGO,MAAM,qBAAqB,aAAa;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,0CAA0C;AACtD,SAAA,WAAW,CAAC;AAAA,EAAA;AAAA,EAEF,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,4CAA4C;AAAA,IAAA;AAAA,EAC7E;AAAA,EAGQ,OAAO;AACf,WAAO,KAAK,OAAO;AAAA,EAAA;AAEvB;"}
@@ -0,0 +1,35 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class RoundFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "ROUND(99.44,1)";
8
+ this.helpText = ["Round a number to the specified number of decimal places according to standard rules."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "A number to be rounded."
13
+ },
14
+ {
15
+ name: "digit",
16
+ description: "The number of decimal places after rounding.",
17
+ optional: true
18
+ }
19
+ ];
20
+ }
21
+ validate() {
22
+ if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
23
+ throw new FormulaError("#N/A", "Number of arguments for ROUND is incorrect.");
24
+ }
25
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
26
+ }
27
+ main(value, digit = 0) {
28
+ const multiplier = Math.pow(10, digit);
29
+ return Math.round(value * multiplier) / multiplier;
30
+ }
31
+ }
32
+ export {
33
+ RoundFunction
34
+ };
35
+ //# sourceMappingURL=round.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"round.js","sources":["../../../formula/functions/round.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class RoundFunction extends BaseFunction {\n example = 'ROUND(99.44,1)';\n helpText = ['Round a number to the specified number of decimal places according to standard rules.'];\n helpArgs = [\n {\n name: 'value',\n description: 'A number to be rounded.',\n },\n {\n name: 'digit',\n description: 'The number of decimal places after rounding.',\n optional: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for ROUND is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(value: number, digit = 0) {\n const multiplier = Math.pow(10, digit);\n return Math.round(value * multiplier) / multiplier;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,uFAAuF;AACxF,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,WAAW,GAAG;AACtD,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAEzE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,OAAe,QAAQ,GAAG;AACvC,UAAM,aAAa,KAAK,IAAI,IAAI,KAAK;AACrC,WAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAAA,EAAA;AAE5C;"}
@@ -0,0 +1,35 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class RounddownFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "ROUNDDOWN(99.44,1)";
8
+ this.helpText = ["Round down a number to the specified number of decimal places according to standard rules."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "A number to be rounded down."
13
+ },
14
+ {
15
+ name: "digit",
16
+ description: "The number of decimal places after rounding.",
17
+ optional: true
18
+ }
19
+ ];
20
+ }
21
+ validate() {
22
+ if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
23
+ throw new FormulaError("#N/A", "Number of arguments for ROUNDDOWN is incorrect.");
24
+ }
25
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
26
+ }
27
+ main(value, digit = 0) {
28
+ const multiplier = Math.pow(10, digit);
29
+ return Math.floor(value * multiplier) / multiplier;
30
+ }
31
+ }
32
+ export {
33
+ RounddownFunction
34
+ };
35
+ //# sourceMappingURL=rounddown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rounddown.js","sources":["../../../formula/functions/rounddown.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class RounddownFunction extends BaseFunction {\n example = 'ROUNDDOWN(99.44,1)';\n helpText = ['Round down a number to the specified number of decimal places according to standard rules.'];\n helpArgs = [\n {\n name: 'value',\n description: 'A number to be rounded down.',\n },\n {\n name: 'digit',\n description: 'The number of decimal places after rounding.',\n optional: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for ROUNDDOWN is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(value: number, digit = 0) {\n const multiplier = Math.pow(10, digit);\n return Math.floor(value * multiplier) / multiplier;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,0BAA0B,aAAa;AAAA,EAA7C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,4FAA4F;AAC7F,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,WAAW,GAAG;AACtD,YAAA,IAAI,aAAa,QAAQ,iDAAiD;AAAA,IAAA;AAE7E,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,OAAe,QAAQ,GAAG;AACvC,UAAM,aAAa,KAAK,IAAI,IAAI,KAAK;AACrC,WAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAAA,EAAA;AAE5C;"}
@@ -0,0 +1,35 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class RoundupFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "ROUNDUP(99.44,1)";
8
+ this.helpText = ["Round up a number to the specified number of decimal places according to standard rules."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "A number to be rounded up."
13
+ },
14
+ {
15
+ name: "digit",
16
+ description: "The number of decimal places after rounding.",
17
+ optional: true
18
+ }
19
+ ];
20
+ }
21
+ validate() {
22
+ if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
23
+ throw new FormulaError("#N/A", "Number of arguments for ROUNDUP is incorrect.");
24
+ }
25
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
26
+ }
27
+ main(value, digit = 0) {
28
+ const multiplier = Math.pow(10, digit);
29
+ return Math.ceil(value * multiplier) / multiplier;
30
+ }
31
+ }
32
+ export {
33
+ RoundupFunction
34
+ };
35
+ //# sourceMappingURL=roundup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundup.js","sources":["../../../formula/functions/roundup.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class RoundupFunction extends BaseFunction {\n example = 'ROUNDUP(99.44,1)';\n helpText = ['Round up a number to the specified number of decimal places according to standard rules.'];\n helpArgs = [\n {\n name: 'value',\n description: 'A number to be rounded up.',\n },\n {\n name: 'digit',\n description: 'The number of decimal places after rounding.',\n optional: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for ROUNDUP is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(value: number, digit = 0) {\n const multiplier = Math.pow(10, digit);\n return Math.ceil(value * multiplier) / multiplier;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,wBAAwB,aAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,0FAA0F;AAC3F,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,WAAW,GAAG;AACtD,YAAA,IAAI,aAAa,QAAQ,+CAA+C;AAAA,IAAA;AAE3E,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,OAAe,QAAQ,GAAG;AACvC,UAAM,aAAa,KAAK,IAAI,IAAI,KAAK;AACrC,WAAO,KAAK,KAAK,QAAQ,UAAU,IAAI;AAAA,EAAA;AAE3C;"}
@@ -0,0 +1,31 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ class RowFunction extends BaseFunction {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.example = "ROW(A9)";
7
+ this.helpText = ["Returns the row number of a specified cell."];
8
+ this.helpArgs = [
9
+ {
10
+ name: "cell_reference",
11
+ description: "The cell whose row number will be returned.",
12
+ option: true
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length === 0) {
18
+ this.bareArgs = [this.table];
19
+ } else if (this.bareArgs.length === 1) ;
20
+ else {
21
+ throw new FormulaError("#N/A", "Number of arguments for ROW is incorrect.");
22
+ }
23
+ }
24
+ main(trimmed) {
25
+ return trimmed.top;
26
+ }
27
+ }
28
+ export {
29
+ RowFunction
30
+ };
31
+ //# sourceMappingURL=row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row.js","sources":["../../../formula/functions/row.ts"],"sourcesContent":["import { Table } from '../../lib/table';\nimport { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\n\nexport class RowFunction extends BaseFunction {\n example = 'ROW(A9)';\n helpText = ['Returns the row number of a specified cell.'];\n helpArgs = [\n {\n name: 'cell_reference',\n description: 'The cell whose row number will be returned.',\n option: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 0) {\n this.bareArgs = [this.table];\n } else if (this.bareArgs.length === 1) {\n } else {\n throw new FormulaError('#N/A', 'Number of arguments for ROW is incorrect.');\n }\n }\n\n protected main(trimmed: Table) {\n return trimmed.top;\n }\n}\n"],"names":[],"mappings":";;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,6CAA6C;AAC9C,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,QAAQ;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACzB,WAAA,WAAW,CAAC,KAAK,KAAK;AAAA,IAClB,WAAA,KAAK,SAAS,WAAW,EAAG;AAAA,SAChC;AACC,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAAA,EAC5E;AAAA,EAGQ,KAAK,SAAgB;AAC7B,WAAO,QAAQ;AAAA,EAAA;AAEnB;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class SinFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "SIN(PI()/2)";
8
+ this.helpText = ["Returns the sin of the angle specified in radians."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "angle",
12
+ description: "An angle in radians, at which you want the sin."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for SIN is incorrect.");
19
+ }
20
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
+ }
22
+ main(angle) {
23
+ return Math.sin(angle);
24
+ }
25
+ }
26
+ export {
27
+ SinFunction
28
+ };
29
+ //# sourceMappingURL=sin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sin.js","sources":["../../../formula/functions/sin.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class SinFunction extends BaseFunction {\n example = 'SIN(PI()/2)';\n helpText = ['Returns the sin of the angle specified in radians.'];\n helpArgs = [\n {\n name: 'angle',\n description: 'An angle in radians, at which you want the sin.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for SIN is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(angle: number) {\n return Math.sin(angle);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,oDAAoD;AACrD,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAEvE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,OAAe;AACrB,WAAA,KAAK,IAAI,KAAK;AAAA,EAAA;AAEzB;"}
@@ -0,0 +1,32 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class SqrtFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "SQRT(9)";
8
+ this.helpText = ["Returns the positive square root of a positive number."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "A number for which the positive square root is to be found."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for SQRT is incorrect.");
19
+ }
20
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
+ if (this.bareArgs[0] < 0) {
22
+ throw new FormulaError("NUM!", "First argument must be positive.");
23
+ }
24
+ }
25
+ main(value) {
26
+ return Math.sqrt(value);
27
+ }
28
+ }
29
+ export {
30
+ SqrtFunction
31
+ };
32
+ //# sourceMappingURL=sqrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqrt.js","sources":["../../../formula/functions/sqrt.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class SqrtFunction extends BaseFunction {\n example = 'SQRT(9)';\n helpText = ['Returns the positive square root of a positive number.'];\n helpArgs = [\n {\n name: 'value',\n description: 'A number for which the positive square root is to be found.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for SQRT is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] < 0) {\n throw new FormulaError('NUM!', 'First argument must be positive.');\n }\n }\n\n protected main(value: number) {\n return Math.sqrt(value);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,qBAAqB,aAAa;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,wDAAwD;AACzD,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,4CAA4C;AAAA,IAAA;AAExE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,IAAI,GAAG;AAClB,YAAA,IAAI,aAAa,QAAQ,kCAAkC;AAAA,IAAA;AAAA,EACnE;AAAA,EAGQ,KAAK,OAAe;AACrB,WAAA,KAAK,KAAK,KAAK;AAAA,EAAA;AAE1B;"}
@@ -0,0 +1,47 @@
1
+ import { solveTable } from "../solver.js";
2
+ import { Table } from "../../lib/table.js";
3
+ import { BaseFunction } from "./__base.js";
4
+ import { ensureNumber } from "./__utils.js";
5
+ import { FormulaError } from "../evaluator.js";
6
+ class SumFunction extends BaseFunction {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.example = "SUM(A2:A100, 101)";
10
+ this.helpText = ["Returns the sum of a series of numbers or cells."];
11
+ this.helpArgs = [
12
+ { name: "value1", description: "First number or range." },
13
+ {
14
+ name: "value2",
15
+ description: "Additional numbers or ranges",
16
+ optional: true,
17
+ iterable: true
18
+ }
19
+ ];
20
+ }
21
+ validate() {
22
+ if (this.bareArgs.length === 0) {
23
+ throw new FormulaError("#N/A", "One or more arguments are required.");
24
+ }
25
+ const spreaded = [];
26
+ this.bareArgs.forEach((arg) => {
27
+ if (arg instanceof Table) {
28
+ spreaded.push(
29
+ ...solveTable({ table: arg }).reduce((a, b) => a.concat(b)).filter((v) => typeof v === "number")
30
+ );
31
+ return;
32
+ }
33
+ spreaded.push(ensureNumber(arg));
34
+ });
35
+ this.bareArgs = spreaded;
36
+ }
37
+ main(...values) {
38
+ if (values.length === 0) {
39
+ return 0;
40
+ }
41
+ return values.reduce((a, b) => a + b);
42
+ }
43
+ }
44
+ export {
45
+ SumFunction
46
+ };
47
+ //# sourceMappingURL=sum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sum.js","sources":["../../../formula/functions/sum.ts"],"sourcesContent":["import { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\nimport { FormulaError } from '../evaluator';\n\nexport class SumFunction extends BaseFunction {\n example = 'SUM(A2:A100, 101)';\n helpText = ['Returns the sum of a series of numbers or cells.'];\n helpArgs = [\n { name: 'value1', description: 'First number or range.' },\n {\n name: 'value2',\n description: 'Additional numbers or ranges',\n optional: true,\n iterable: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 0) {\n throw new FormulaError('#N/A', 'One or more arguments are required.');\n }\n const spreaded: number[] = [];\n this.bareArgs.forEach((arg) => {\n if (arg instanceof Table) {\n spreaded.push(\n ...solveTable({ table: arg })\n .reduce((a, b) => a.concat(b))\n .filter((v: any) => typeof v === 'number'),\n );\n return;\n }\n spreaded.push(ensureNumber(arg));\n });\n this.bareArgs = spreaded;\n }\n\n protected main(...values: number[]) {\n if (values.length === 0) {\n return 0;\n }\n return values.reduce((a, b) => a + b);\n }\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,kDAAkD;AACnD,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,yBAAyB;AAAA,MACxD;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,qCAAqC;AAAA,IAAA;AAEtE,UAAM,WAAqB,CAAC;AACvB,SAAA,SAAS,QAAQ,CAAC,QAAQ;AAC7B,UAAI,eAAe,OAAO;AACf,iBAAA;AAAA,UACP,GAAG,WAAW,EAAE,OAAO,IAAK,CAAA,EACzB,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5B,OAAO,CAAC,MAAW,OAAO,MAAM,QAAQ;AAAA,QAC7C;AACA;AAAA,MAAA;AAEO,eAAA,KAAK,aAAa,GAAG,CAAC;AAAA,IAAA,CAChC;AACD,SAAK,WAAW;AAAA,EAAA;AAAA,EAGR,QAAQ,QAAkB;AAC9B,QAAA,OAAO,WAAW,GAAG;AAChB,aAAA;AAAA,IAAA;AAET,WAAO,OAAO,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,EAAA;AAExC;"}
@@ -0,0 +1,65 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { solveTable } from "../solver.js";
3
+ import { Table } from "../../lib/table.js";
4
+ import { BaseFunction } from "./__base.js";
5
+ import { ensureString, check } from "./__utils.js";
6
+ class SumifFunction extends BaseFunction {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.example = 'SUMIF(A1:A10,">20")';
10
+ this.helpText = ["Returns the sum of a series of cells."];
11
+ this.helpArgs = [
12
+ { name: "range1", description: "A condition range." },
13
+ {
14
+ name: "condition",
15
+ description: "A condition for summarization."
16
+ },
17
+ {
18
+ name: "range2",
19
+ description: "A range to be summarized.",
20
+ optional: true
21
+ }
22
+ ];
23
+ }
24
+ validate() {
25
+ if (this.bareArgs.length !== 2 && this.bareArgs.length !== 3) {
26
+ throw new FormulaError("#N/A", "Number of arguments for SUMIF is incorrect.");
27
+ }
28
+ if (this.bareArgs[2] != void 0 && this.bareArgs[2] instanceof Table) {
29
+ throw new FormulaError("#N/A", "3rd argument must be range.");
30
+ }
31
+ this.bareArgs[1] = ensureString(this.bareArgs[1]);
32
+ }
33
+ main(range, condition, sumRange) {
34
+ if (!(range instanceof Table)) {
35
+ return check(range, condition) ? range : 0;
36
+ }
37
+ const conditionMatrix = solveTable({ table: range });
38
+ let sumMatrix = conditionMatrix;
39
+ if (sumRange) {
40
+ const [top, left] = [sumRange.top, sumRange.left];
41
+ const area = {
42
+ top,
43
+ left,
44
+ bottom: top + sumRange.getNumRows(),
45
+ right: left + sumRange.getNumCols()
46
+ };
47
+ sumMatrix = solveTable({ table: this.table.trim(area) });
48
+ }
49
+ let total = 0;
50
+ conditionMatrix.forEach(
51
+ (row, y) => row.forEach((c, x) => {
52
+ var _a;
53
+ const s = ((_a = sumMatrix[y]) == null ? void 0 : _a[x]) || 0;
54
+ if (typeof s === "number" && check(c, condition)) {
55
+ total += s;
56
+ }
57
+ })
58
+ );
59
+ return total;
60
+ }
61
+ }
62
+ export {
63
+ SumifFunction
64
+ };
65
+ //# sourceMappingURL=sumif.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sumif.js","sources":["../../../formula/functions/sumif.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { check, ensureString } from './__utils';\nimport { AreaType } from '../../types';\n\nexport class SumifFunction extends BaseFunction {\n example = 'SUMIF(A1:A10,\">20\")';\n helpText = ['Returns the sum of a series of cells.'];\n helpArgs = [\n { name: 'range1', description: 'A condition range.' },\n {\n name: 'condition',\n description: 'A condition for summarization.',\n },\n {\n name: 'range2',\n description: 'A range to be summarized.',\n optional: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2 && this.bareArgs.length !== 3) {\n throw new FormulaError('#N/A', 'Number of arguments for SUMIF is incorrect.');\n }\n if (this.bareArgs[2] != undefined && this.bareArgs[2] instanceof Table) {\n throw new FormulaError('#N/A', '3rd argument must be range.');\n }\n this.bareArgs[1] = ensureString(this.bareArgs[1]);\n }\n\n protected main(range: Table, condition: string, sumRange: Table) {\n if (!(range instanceof Table)) {\n return check(range, condition) ? range : 0;\n }\n const conditionMatrix = solveTable({ table: range });\n let sumMatrix = conditionMatrix;\n if (sumRange) {\n const [top, left] = [sumRange.top, sumRange.left];\n const area: AreaType = {\n top,\n left,\n bottom: top + sumRange.getNumRows(),\n right: left + sumRange.getNumCols(),\n };\n sumMatrix = solveTable({ table: this.table.trim(area) });\n }\n let total = 0;\n conditionMatrix.forEach((row, y) =>\n row.forEach((c, x) => {\n const s = sumMatrix[y]?.[x] || 0;\n if (typeof s === 'number' && check(c, condition)) {\n total += s;\n }\n }),\n );\n return total;\n }\n}\n"],"names":[],"mappings":";;;;;AAOO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,uCAAuC;AACxC,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,qBAAqB;AAAA,MACpD;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,WAAW,GAAG;AACtD,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAE1E,QAAA,KAAK,SAAS,CAAC,KAAK,UAAa,KAAK,SAAS,CAAC,aAAa,OAAO;AAChE,YAAA,IAAI,aAAa,QAAQ,6BAA6B;AAAA,IAAA;AAE9D,SAAK,SAAS,CAAC,IAAI,aAAa,KAAK,SAAS,CAAC,CAAC;AAAA,EAAA;AAAA,EAGxC,KAAK,OAAc,WAAmB,UAAiB;AAC3D,QAAA,EAAE,iBAAiB,QAAQ;AAC7B,aAAO,MAAM,OAAO,SAAS,IAAI,QAAQ;AAAA,IAAA;AAE3C,UAAM,kBAAkB,WAAW,EAAE,OAAO,OAAO;AACnD,QAAI,YAAY;AAChB,QAAI,UAAU;AACN,YAAA,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI;AAChD,YAAM,OAAiB;AAAA,QACrB;AAAA,QACA;AAAA,QACA,QAAQ,MAAM,SAAS,WAAW;AAAA,QAClC,OAAO,OAAO,SAAS,WAAW;AAAA,MACpC;AACY,kBAAA,WAAW,EAAE,OAAO,KAAK,MAAM,KAAK,IAAI,GAAG;AAAA,IAAA;AAEzD,QAAI,QAAQ;AACI,oBAAA;AAAA,MAAQ,CAAC,KAAK,MAC5B,IAAI,QAAQ,CAAC,GAAG,MAAM;;AACpB,cAAM,MAAI,eAAU,CAAC,MAAX,mBAAe,OAAM;AAC/B,YAAI,OAAO,MAAM,YAAY,MAAM,GAAG,SAAS,GAAG;AACvC,mBAAA;AAAA,QAAA;AAAA,MAEZ,CAAA;AAAA,IACH;AACO,WAAA;AAAA,EAAA;AAEX;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class TanFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "TAN(1)";
8
+ this.helpText = ["Returns the tan of the angle specified in radians."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "angle",
12
+ description: "An angle in radians, at which you want the tan."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for TAN is incorrect.");
19
+ }
20
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
+ }
22
+ main(angle) {
23
+ return Math.tan(angle);
24
+ }
25
+ }
26
+ export {
27
+ TanFunction
28
+ };
29
+ //# sourceMappingURL=tan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tan.js","sources":["../../../formula/functions/tan.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class TanFunction extends BaseFunction {\n example = 'TAN(1)';\n helpText = ['Returns the tan of the angle specified in radians.'];\n helpArgs = [\n {\n name: 'angle',\n description: 'An angle in radians, at which you want the tan.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for TAN is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(angle: number) {\n return Math.tan(angle);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,oDAAoD;AACrD,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAEvE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,OAAe;AACrB,WAAA,KAAK,IAAI,KAAK;AAAA,EAAA;AAEzB;"}
@@ -0,0 +1,24 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class UminusFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "UMINUS(4)";
8
+ this.helpText = ["Returns a number with positive and negative values reversed."];
9
+ this.helpArgs = [{ name: "value1", description: "A number that will be subtracted." }];
10
+ }
11
+ validate() {
12
+ if (this.bareArgs.length !== 1) {
13
+ throw new FormulaError("#N/A", "A single numerical value is only required.");
14
+ }
15
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
16
+ }
17
+ main(v1) {
18
+ return -v1;
19
+ }
20
+ }
21
+ export {
22
+ UminusFunction
23
+ };
24
+ //# sourceMappingURL=uminus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uminus.js","sources":["../../../formula/functions/uminus.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class UminusFunction extends BaseFunction {\n example = 'UMINUS(4)';\n helpText = ['Returns a number with positive and negative values reversed.'];\n helpArgs = [{ name: 'value1', description: 'A number that will be subtracted.' }];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'A single numerical value is only required.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(v1: number) {\n return -v1;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB,aAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,8DAA8D;AAC1E,SAAA,WAAW,CAAC,EAAE,MAAM,UAAU,aAAa,qCAAqC;AAAA,EAAA;AAAA,EAEtE,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,4CAA4C;AAAA,IAAA;AAExE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,IAAY;AACzB,WAAO,CAAC;AAAA,EAAA;AAEZ;"}