@gridsheet/react-core 1.4.0-alpha.2 → 1.4.0-alpha.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 (201) hide show
  1. package/dist/components/Cell.js +232 -0
  2. package/dist/components/Cell.js.map +1 -0
  3. package/dist/components/ContextMenu.js +297 -0
  4. package/dist/components/ContextMenu.js.map +1 -0
  5. package/dist/components/Editor.js +455 -0
  6. package/dist/components/Editor.js.map +1 -0
  7. package/dist/components/Emitter.js +26 -0
  8. package/dist/components/Emitter.js.map +1 -0
  9. package/dist/components/Fixed.js +17 -0
  10. package/dist/components/Fixed.js.map +1 -0
  11. package/dist/components/FormulaBar.js +149 -0
  12. package/dist/components/FormulaBar.js.map +1 -0
  13. package/dist/components/GridSheet.js +246 -0
  14. package/dist/components/GridSheet.js.map +1 -0
  15. package/dist/components/HeaderCellLeft.js +131 -0
  16. package/dist/components/HeaderCellLeft.js.map +1 -0
  17. package/dist/components/HeaderCellTop.js +132 -0
  18. package/dist/components/HeaderCellTop.js.map +1 -0
  19. package/dist/components/PluginBase.js +35 -0
  20. package/dist/components/PluginBase.js.map +1 -0
  21. package/dist/components/Resizer.js +98 -0
  22. package/dist/components/Resizer.js.map +1 -0
  23. package/dist/components/SearchBar.js +108 -0
  24. package/dist/components/SearchBar.js.map +1 -0
  25. package/dist/components/SheetProvider.js +56 -0
  26. package/dist/components/SheetProvider.js.map +1 -0
  27. package/dist/components/StoreInitializer.js +84 -0
  28. package/dist/components/StoreInitializer.js.map +1 -0
  29. package/dist/components/Tabular.js +308 -0
  30. package/dist/components/Tabular.js.map +1 -0
  31. package/dist/components/hooks.js +15 -0
  32. package/dist/components/hooks.js.map +1 -0
  33. package/dist/components/svg/Base.js +24 -0
  34. package/dist/components/svg/Base.js.map +1 -0
  35. package/dist/components/svg/CloseIcon.js +13 -0
  36. package/dist/components/svg/CloseIcon.js.map +1 -0
  37. package/dist/components/svg/SearchIcon.js +13 -0
  38. package/dist/components/svg/SearchIcon.js.map +1 -0
  39. package/dist/constants.js +43 -0
  40. package/dist/constants.js.map +1 -0
  41. package/dist/formula/evaluator.js +674 -0
  42. package/dist/formula/evaluator.js.map +1 -0
  43. package/dist/formula/functions/__base.js +19 -0
  44. package/dist/formula/functions/__base.js.map +1 -0
  45. package/dist/formula/functions/__utils.js +145 -0
  46. package/dist/formula/functions/__utils.js.map +1 -0
  47. package/dist/formula/functions/abs.js +24 -0
  48. package/dist/formula/functions/abs.js.map +1 -0
  49. package/dist/formula/functions/acos.js +32 -0
  50. package/dist/formula/functions/acos.js.map +1 -0
  51. package/dist/formula/functions/add.js +57 -0
  52. package/dist/formula/functions/add.js.map +1 -0
  53. package/dist/formula/functions/and.js +28 -0
  54. package/dist/formula/functions/and.js.map +1 -0
  55. package/dist/formula/functions/asin.js +32 -0
  56. package/dist/formula/functions/asin.js.map +1 -0
  57. package/dist/formula/functions/atan.js +29 -0
  58. package/dist/formula/functions/atan.js.map +1 -0
  59. package/dist/formula/functions/atan2.js +35 -0
  60. package/dist/formula/functions/atan2.js.map +1 -0
  61. package/dist/formula/functions/average.js +44 -0
  62. package/dist/formula/functions/average.js.map +1 -0
  63. package/dist/formula/functions/col.js +31 -0
  64. package/dist/formula/functions/col.js.map +1 -0
  65. package/dist/formula/functions/concat.js +27 -0
  66. package/dist/formula/functions/concat.js.map +1 -0
  67. package/dist/formula/functions/concatenate.js +28 -0
  68. package/dist/formula/functions/concatenate.js.map +1 -0
  69. package/dist/formula/functions/cos.js +29 -0
  70. package/dist/formula/functions/cos.js.map +1 -0
  71. package/dist/formula/functions/count.js +38 -0
  72. package/dist/formula/functions/count.js.map +1 -0
  73. package/dist/formula/functions/counta.js +38 -0
  74. package/dist/formula/functions/counta.js.map +1 -0
  75. package/dist/formula/functions/countif.js +32 -0
  76. package/dist/formula/functions/countif.js.map +1 -0
  77. package/dist/formula/functions/divide.js +33 -0
  78. package/dist/formula/functions/divide.js.map +1 -0
  79. package/dist/formula/functions/eq.js +29 -0
  80. package/dist/formula/functions/eq.js.map +1 -0
  81. package/dist/formula/functions/exp.js +29 -0
  82. package/dist/formula/functions/exp.js.map +1 -0
  83. package/dist/formula/functions/gt.js +29 -0
  84. package/dist/formula/functions/gt.js.map +1 -0
  85. package/dist/formula/functions/gte.js +29 -0
  86. package/dist/formula/functions/gte.js.map +1 -0
  87. package/dist/formula/functions/hlookup.js +75 -0
  88. package/dist/formula/functions/hlookup.js.map +1 -0
  89. package/dist/formula/functions/if.js +39 -0
  90. package/dist/formula/functions/if.js.map +1 -0
  91. package/dist/formula/functions/iferror.js +45 -0
  92. package/dist/formula/functions/iferror.js.map +1 -0
  93. package/dist/formula/functions/len.js +29 -0
  94. package/dist/formula/functions/len.js.map +1 -0
  95. package/dist/formula/functions/lenb.js +29 -0
  96. package/dist/formula/functions/lenb.js.map +1 -0
  97. package/dist/formula/functions/ln.js +32 -0
  98. package/dist/formula/functions/ln.js.map +1 -0
  99. package/dist/formula/functions/log.js +36 -0
  100. package/dist/formula/functions/log.js.map +1 -0
  101. package/dist/formula/functions/log10.js +32 -0
  102. package/dist/formula/functions/log10.js.map +1 -0
  103. package/dist/formula/functions/lt.js +29 -0
  104. package/dist/formula/functions/lt.js.map +1 -0
  105. package/dist/formula/functions/lte.js +29 -0
  106. package/dist/formula/functions/lte.js.map +1 -0
  107. package/dist/formula/functions/max.js +47 -0
  108. package/dist/formula/functions/max.js.map +1 -0
  109. package/dist/formula/functions/min.js +47 -0
  110. package/dist/formula/functions/min.js.map +1 -0
  111. package/dist/formula/functions/minus.js +57 -0
  112. package/dist/formula/functions/minus.js.map +1 -0
  113. package/dist/formula/functions/mod.js +33 -0
  114. package/dist/formula/functions/mod.js.map +1 -0
  115. package/dist/formula/functions/multiply.js +27 -0
  116. package/dist/formula/functions/multiply.js.map +1 -0
  117. package/dist/formula/functions/ne.js +29 -0
  118. package/dist/formula/functions/ne.js.map +1 -0
  119. package/dist/formula/functions/not.js +30 -0
  120. package/dist/formula/functions/not.js.map +1 -0
  121. package/dist/formula/functions/now.js +22 -0
  122. package/dist/formula/functions/now.js.map +1 -0
  123. package/dist/formula/functions/or.js +28 -0
  124. package/dist/formula/functions/or.js.map +1 -0
  125. package/dist/formula/functions/pi.js +22 -0
  126. package/dist/formula/functions/pi.js.map +1 -0
  127. package/dist/formula/functions/power.js +27 -0
  128. package/dist/formula/functions/power.js.map +1 -0
  129. package/dist/formula/functions/product.js +40 -0
  130. package/dist/formula/functions/product.js.map +1 -0
  131. package/dist/formula/functions/radians.js +29 -0
  132. package/dist/formula/functions/radians.js.map +1 -0
  133. package/dist/formula/functions/rand.js +22 -0
  134. package/dist/formula/functions/rand.js.map +1 -0
  135. package/dist/formula/functions/round.js +35 -0
  136. package/dist/formula/functions/round.js.map +1 -0
  137. package/dist/formula/functions/rounddown.js +35 -0
  138. package/dist/formula/functions/rounddown.js.map +1 -0
  139. package/dist/formula/functions/roundup.js +35 -0
  140. package/dist/formula/functions/roundup.js.map +1 -0
  141. package/dist/formula/functions/row.js +31 -0
  142. package/dist/formula/functions/row.js.map +1 -0
  143. package/dist/formula/functions/sin.js +29 -0
  144. package/dist/formula/functions/sin.js.map +1 -0
  145. package/dist/formula/functions/sqrt.js +32 -0
  146. package/dist/formula/functions/sqrt.js.map +1 -0
  147. package/dist/formula/functions/sum.js +47 -0
  148. package/dist/formula/functions/sum.js.map +1 -0
  149. package/dist/formula/functions/sumif.js +65 -0
  150. package/dist/formula/functions/sumif.js.map +1 -0
  151. package/dist/formula/functions/tan.js +29 -0
  152. package/dist/formula/functions/tan.js.map +1 -0
  153. package/dist/formula/functions/uminus.js +24 -0
  154. package/dist/formula/functions/uminus.js.map +1 -0
  155. package/dist/formula/functions/vlookup.js +75 -0
  156. package/dist/formula/functions/vlookup.js.map +1 -0
  157. package/dist/formula/mapping.js +118 -0
  158. package/dist/formula/mapping.js.map +1 -0
  159. package/dist/formula/solver.js +70 -0
  160. package/dist/formula/solver.js.map +1 -0
  161. package/dist/index.js +16 -9113
  162. package/dist/index.js.map +1 -1
  163. package/dist/lib/autofill.js +391 -0
  164. package/dist/lib/autofill.js.map +1 -0
  165. package/dist/lib/clipboard.js +46 -0
  166. package/dist/lib/clipboard.js.map +1 -0
  167. package/dist/lib/converters.js +141 -0
  168. package/dist/lib/converters.js.map +1 -0
  169. package/dist/lib/input.js +52 -0
  170. package/dist/lib/input.js.map +1 -0
  171. package/dist/lib/palette.js +24 -0
  172. package/dist/lib/palette.js.map +1 -0
  173. package/dist/lib/prevention.js +82 -0
  174. package/dist/lib/prevention.js.map +1 -0
  175. package/dist/lib/structs.js +276 -0
  176. package/dist/lib/structs.js.map +1 -0
  177. package/dist/lib/table.js +1248 -0
  178. package/dist/lib/table.js.map +1 -0
  179. package/dist/lib/time.js +79 -0
  180. package/dist/lib/time.js.map +1 -0
  181. package/dist/lib/virtualization.js +129 -0
  182. package/dist/lib/virtualization.js.map +1 -0
  183. package/dist/parsers/core.js +139 -0
  184. package/dist/parsers/core.js.map +1 -0
  185. package/dist/renderers/checkbox.js +20 -0
  186. package/dist/renderers/checkbox.js.map +1 -0
  187. package/dist/renderers/core.js +147 -0
  188. package/dist/renderers/core.js.map +1 -0
  189. package/dist/renderers/thousand_separator.js +17 -0
  190. package/dist/renderers/thousand_separator.js.map +1 -0
  191. package/dist/store/actions.js +762 -0
  192. package/dist/store/actions.js.map +1 -0
  193. package/dist/store/helpers.js +88 -0
  194. package/dist/store/helpers.js.map +1 -0
  195. package/dist/store/index.js +8 -0
  196. package/dist/store/index.js.map +1 -0
  197. package/dist/styles/embedder.js +19 -0
  198. package/dist/styles/embedder.js.map +1 -0
  199. package/dist/styles/minified.js +7 -0
  200. package/dist/styles/minified.js.map +1 -0
  201. package/package.json +1 -7
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureString } from "./__utils.js";
4
+ class LenFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LEN(A2)";
8
+ this.helpText = ["Returns the length of a string."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "text",
12
+ description: "A text to be returned the length."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for LEN is incorrect.");
19
+ }
20
+ this.bareArgs = [ensureString(this.bareArgs[0])];
21
+ }
22
+ main(text) {
23
+ return text.length;
24
+ }
25
+ }
26
+ export {
27
+ LenFunction
28
+ };
29
+ //# sourceMappingURL=len.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"len.js","sources":["../../../formula/functions/len.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureString } from './__utils';\n\nexport class LenFunction extends BaseFunction {\n example = 'LEN(A2)';\n helpText = ['Returns the length of a string.'];\n helpArgs = [\n {\n name: 'text',\n description: 'A text to be returned the length.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LEN is incorrect.');\n }\n this.bareArgs = [ensureString(this.bareArgs[0])];\n }\n\n protected main(text: string) {\n return text.length;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,iCAAiC;AAClC,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;AAE5E,SAAK,WAAW,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC;AAAA,EAAA;AAAA,EAGvC,KAAK,MAAc;AAC3B,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureString } from "./__utils.js";
4
+ class LenbFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LENB(A2)";
8
+ this.helpText = ["Returns the number of bytes in the length of the string."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "text",
12
+ description: "A text to be returned the length of the bytes."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for LENB is incorrect.");
19
+ }
20
+ this.bareArgs = [ensureString(this.bareArgs[0])];
21
+ }
22
+ main(text) {
23
+ return encodeURIComponent(text).replace(/%../g, "x").length;
24
+ }
25
+ }
26
+ export {
27
+ LenbFunction
28
+ };
29
+ //# sourceMappingURL=lenb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lenb.js","sources":["../../../formula/functions/lenb.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureString } from './__utils';\n\nexport class LenbFunction extends BaseFunction {\n example = 'LENB(A2)';\n helpText = ['Returns the number of bytes in the length of the string.'];\n helpArgs = [\n {\n name: 'text',\n description: 'A text to be returned the length of the bytes.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LENB is incorrect.');\n }\n this.bareArgs = [ensureString(this.bareArgs[0])];\n }\n\n protected main(text: string) {\n return encodeURIComponent(text).replace(/%../g, 'x').length;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,qBAAqB,aAAa;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,0DAA0D;AAC3D,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;AAE7E,SAAK,WAAW,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC;AAAA,EAAA;AAAA,EAGvC,KAAK,MAAc;AAC3B,WAAO,mBAAmB,IAAI,EAAE,QAAQ,QAAQ,GAAG,EAAE;AAAA,EAAA;AAEzD;"}
@@ -0,0 +1,32 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class LnFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LN(100)";
8
+ this.helpText = ["Returns the logarithm of e"];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "The value for the logarithm of e"
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for LN is incorrect.");
19
+ }
20
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
+ if (this.bareArgs[0] <= 0) {
22
+ throw new FormulaError("NUM!", "value must be greater than 0");
23
+ }
24
+ }
25
+ main(value) {
26
+ return Math.log(value);
27
+ }
28
+ }
29
+ export {
30
+ LnFunction
31
+ };
32
+ //# sourceMappingURL=ln.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ln.js","sources":["../../../formula/functions/ln.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class LnFunction extends BaseFunction {\n example = 'LN(100)';\n helpText = ['Returns the logarithm of e'];\n helpArgs = [\n {\n name: 'value',\n description: 'The value for the logarithm of e',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LN is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] <= 0) {\n throw new FormulaError('NUM!', 'value must be greater than 0');\n }\n }\n\n protected main(value: number) {\n return Math.log(value);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,4BAA4B;AAC7B,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,0CAA0C;AAAA,IAAA;AAEtE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,8BAA8B;AAAA,IAAA;AAAA,EAC/D;AAAA,EAGQ,KAAK,OAAe;AACrB,WAAA,KAAK,IAAI,KAAK;AAAA,EAAA;AAEzB;"}
@@ -0,0 +1,36 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class LogFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LOG(128, 2)";
8
+ this.helpText = ["Returns the logarithm of a number whose base is the specified number."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "The value for the logarithm of the specified number as base."
13
+ },
14
+ { name: "base", description: "An exponent to power the base." }
15
+ ];
16
+ }
17
+ validate() {
18
+ if (this.bareArgs.length !== 2) {
19
+ throw new FormulaError("#N/A", "Number of arguments for LOG is incorrect.");
20
+ }
21
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
22
+ if (this.bareArgs[0] <= 0) {
23
+ throw new FormulaError("NUM!", "value must be greater than 0");
24
+ }
25
+ if (this.bareArgs[1] <= 1) {
26
+ throw new FormulaError("NUM!", "base must be greater than 1");
27
+ }
28
+ }
29
+ main(value, base) {
30
+ return Math.log2(value) / Math.log2(base);
31
+ }
32
+ }
33
+ export {
34
+ LogFunction
35
+ };
36
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sources":["../../../formula/functions/log.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class LogFunction extends BaseFunction {\n example = 'LOG(128, 2)';\n helpText = ['Returns the logarithm of a number whose base is the specified number.'];\n helpArgs = [\n {\n name: 'value',\n description: 'The value for the logarithm of the specified number as base.',\n },\n { name: 'base', 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 LOG is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] <= 0) {\n throw new FormulaError('NUM!', 'value must be greater than 0');\n }\n if (this.bareArgs[1] <= 1) {\n throw new FormulaError('NUM!', 'base must be greater than 1');\n }\n }\n\n protected main(value: number, base: number) {\n return Math.log2(value) / Math.log2(base);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,uEAAuE;AACxE,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,EAAE,MAAM,QAAQ,aAAa,iCAAiC;AAAA,IAChE;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;AAC5D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,8BAA8B;AAAA,IAAA;AAE/D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,6BAA6B;AAAA,IAAA;AAAA,EAC9D;AAAA,EAGQ,KAAK,OAAe,MAAc;AAC1C,WAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,IAAI;AAAA,EAAA;AAE5C;"}
@@ -0,0 +1,32 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class Log10Function extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LOG10(100)";
8
+ this.helpText = ["Returns the logarithm of 10"];
9
+ this.helpArgs = [
10
+ {
11
+ name: "value",
12
+ description: "The value for the logarithm of 10"
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length !== 1) {
18
+ throw new FormulaError("#N/A", "Number of arguments for LOG10 is incorrect.");
19
+ }
20
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
+ if (this.bareArgs[0] <= 0) {
22
+ throw new FormulaError("NUM!", "value must be greater than 0");
23
+ }
24
+ }
25
+ main(value) {
26
+ return Math.log10(value);
27
+ }
28
+ }
29
+ export {
30
+ Log10Function
31
+ };
32
+ //# sourceMappingURL=log10.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log10.js","sources":["../../../formula/functions/log10.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class Log10Function extends BaseFunction {\n example = 'LOG10(100)';\n helpText = ['Returns the logarithm of 10'];\n helpArgs = [\n {\n name: 'value',\n description: 'The value for the logarithm of 10',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LOG10 is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] <= 0) {\n throw new FormulaError('NUM!', 'value must be greater than 0');\n }\n }\n\n protected main(value: number) {\n return Math.log10(value);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,6BAA6B;AAC9B,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,6CAA6C;AAAA,IAAA;AAEzE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,8BAA8B;AAAA,IAAA;AAAA,EAC/D;AAAA,EAGQ,KAAK,OAAe;AACrB,WAAA,KAAK,MAAM,KAAK;AAAA,EAAA;AAE3B;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { lt } from "./__utils.js";
4
+ class LtFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LT(3, 6)";
8
+ this.helpText = [
9
+ "Returns TRUE if the first argument is truely less than the second argument, FALSE otherwise.",
10
+ "This is the same as the '<' operator."
11
+ ];
12
+ this.helpArgs = [
13
+ { name: "value1", description: "First value." },
14
+ { name: "value2", description: "A value to be compared with value1." }
15
+ ];
16
+ }
17
+ validate() {
18
+ if (this.bareArgs.length !== 2) {
19
+ throw new FormulaError("#N/A", "Number of arguments for LT is incorrect.");
20
+ }
21
+ }
22
+ main(v1, v2) {
23
+ return lt(v1, v2);
24
+ }
25
+ }
26
+ export {
27
+ LtFunction
28
+ };
29
+ //# sourceMappingURL=lt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lt.js","sources":["../../../formula/functions/lt.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { lt } from './__utils';\n\nexport class LtFunction extends BaseFunction {\n example = 'LT(3, 6)';\n helpText = [\n 'Returns TRUE if the first argument is truely less than the second argument, FALSE otherwise.',\n \"This is the same as the '<' operator.\",\n ];\n helpArgs = [\n { name: 'value1', description: 'First value.' },\n { name: 'value2', description: 'A value to be compared with value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for LT is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return lt(v1, v2);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,eAAe;AAAA,MAC9C,EAAE,MAAM,UAAU,aAAa,sCAAsC;AAAA,IACvE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,0CAA0C;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAC9B,WAAA,GAAG,IAAI,EAAE;AAAA,EAAA;AAEpB;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { lte } from "./__utils.js";
4
+ class LteFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "LTE(3, 6)";
8
+ this.helpText = [
9
+ "Returns TRUE if the first argument is less than the second argument, FALSE otherwise.",
10
+ "This is the same as the '<=' operator."
11
+ ];
12
+ this.helpArgs = [
13
+ { name: "value1", description: "First value." },
14
+ { name: "value2", description: "A value to be compared with value1." }
15
+ ];
16
+ }
17
+ validate() {
18
+ if (this.bareArgs.length !== 2) {
19
+ throw new FormulaError("#N/A", "Number of arguments for LTE is incorrect.");
20
+ }
21
+ }
22
+ main(v1, v2) {
23
+ return lte(v1, v2);
24
+ }
25
+ }
26
+ export {
27
+ LteFunction
28
+ };
29
+ //# sourceMappingURL=lte.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lte.js","sources":["../../../formula/functions/lte.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { lte } from './__utils';\n\nexport class LteFunction extends BaseFunction {\n example = 'LTE(3, 6)';\n helpText = [\n 'Returns TRUE if the first argument is less than the second argument, FALSE otherwise.',\n \"This is the same as the '<=' operator.\",\n ];\n helpArgs = [\n { name: 'value1', description: 'First value.' },\n { name: 'value2', description: 'A value to be compared with value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for LTE is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return lte(v1, v2);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,eAAe;AAAA,MAC9C,EAAE,MAAM,UAAU,aAAa,sCAAsC;AAAA,IACvE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAAA,EAC5E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAC9B,WAAA,IAAI,IAAI,EAAE;AAAA,EAAA;AAErB;"}
@@ -0,0 +1,47 @@
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 { ensureNumber } from "./__utils.js";
6
+ class MaxFunction extends BaseFunction {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.example = "MAX(A2:A100, 101)";
10
+ this.helpText = ["Returns the max in 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", "Number of arguments must be greater than 0.");
24
+ }
25
+ const spreaded = [];
26
+ this.bareArgs.map((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 Math.max(...values);
42
+ }
43
+ }
44
+ export {
45
+ MaxFunction
46
+ };
47
+ //# sourceMappingURL=max.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max.js","sources":["../../../formula/functions/max.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class MaxFunction extends BaseFunction {\n example = 'MAX(A2:A100, 101)';\n helpText = ['Returns the max in 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', 'Number of arguments must be greater than 0.');\n }\n const spreaded: number[] = [];\n this.bareArgs.map((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 Math.max(...values);\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,6CAA6C;AAAA,IAAA;AAE9E,UAAM,WAAqB,CAAC;AACvB,SAAA,SAAS,IAAI,CAAC,QAAQ;AACzB,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;AAEF,WAAA,KAAK,IAAI,GAAG,MAAM;AAAA,EAAA;AAE7B;"}
@@ -0,0 +1,47 @@
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 { ensureNumber } from "./__utils.js";
6
+ class MinFunction extends BaseFunction {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.example = "MIN(A2:A100, 101)";
10
+ this.helpText = ["Returns the min in 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", "Number of arguments must be greater than 0.");
24
+ }
25
+ const spreaded = [];
26
+ this.bareArgs.map((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 Math.min(...values);
42
+ }
43
+ }
44
+ export {
45
+ MinFunction
46
+ };
47
+ //# sourceMappingURL=min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"min.js","sources":["../../../formula/functions/min.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class MinFunction extends BaseFunction {\n example = 'MIN(A2:A100, 101)';\n helpText = ['Returns the min in 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', 'Number of arguments must be greater than 0.');\n }\n const spreaded: number[] = [];\n this.bareArgs.map((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 Math.min(...values);\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,6CAA6C;AAAA,IAAA;AAE9E,UAAM,WAAqB,CAAC;AACvB,SAAA,SAAS,IAAI,CAAC,QAAQ;AACzB,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;AAEF,WAAA,KAAK,IAAI,GAAG,MAAM;AAAA,EAAA;AAE7B;"}
@@ -0,0 +1,57 @@
1
+ import dayjs from "dayjs";
2
+ import { FormulaError } from "../evaluator.js";
3
+ import { TimeDelta } from "../../lib/time.js";
4
+ import { BaseFunction } from "./__base.js";
5
+ import { stripTable, ensureNumber } from "./__utils.js";
6
+ import { Table } from "../../lib/table.js";
7
+ import { SECONDS_IN_DAY } from "../../constants.js";
8
+ class MinusFunction extends BaseFunction {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.example = "MINUS(8, 3)";
12
+ this.helpText = ["Returns the difference of two numbers.", "This is the same as the '-' operator."];
13
+ this.helpArgs = [
14
+ { name: "value1", description: "A number that will be subtracted." },
15
+ { name: "value2", description: "A number that will subtract from value1." }
16
+ ];
17
+ }
18
+ validate() {
19
+ if (this.bareArgs.length !== 2) {
20
+ throw new FormulaError("#N/A", "Number of arguments for MINUS is incorrect.");
21
+ }
22
+ this.bareArgs = this.bareArgs.map((arg) => {
23
+ if (arg instanceof Table) {
24
+ arg = stripTable(arg, 0, 0);
25
+ }
26
+ return typeof arg === "object" ? arg : ensureNumber(arg);
27
+ });
28
+ }
29
+ main(v1, v2) {
30
+ if (typeof v1 === "number" && typeof v2 === "number") {
31
+ return v1 - v2;
32
+ }
33
+ if (v1 instanceof Date && v2 instanceof Date) {
34
+ return new TimeDelta(v1, v2);
35
+ }
36
+ if (v1 instanceof Date && v2 instanceof TimeDelta) {
37
+ return v2.sub(v1);
38
+ }
39
+ if (v1 instanceof TimeDelta && v2 instanceof Date) {
40
+ return v1.sub(v2);
41
+ }
42
+ if (v1 instanceof Date && typeof v2 === "number") {
43
+ return dayjs(v1).subtract(v2 * SECONDS_IN_DAY, "second").toDate();
44
+ }
45
+ if (!v1) {
46
+ return -v2;
47
+ }
48
+ if (!v2) {
49
+ return v1;
50
+ }
51
+ throw new FormulaError("#VALUE!", "Mismatched types for minuend and subtrahend.");
52
+ }
53
+ }
54
+ export {
55
+ MinusFunction
56
+ };
57
+ //# sourceMappingURL=minus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minus.js","sources":["../../../formula/functions/minus.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { FormulaError } from '../evaluator';\nimport { TimeDelta } from '../../lib/time';\nimport { BaseFunction } from './__base';\nimport { ensureNumber, stripTable } from './__utils';\nimport { Table } from '../../lib/table';\nimport { SECONDS_IN_DAY } from '../../constants';\n\nexport class MinusFunction extends BaseFunction {\n example = 'MINUS(8, 3)';\n helpText = ['Returns the difference of two numbers.', \"This is the same as the '-' operator.\"];\n helpArgs = [\n { name: 'value1', description: 'A number that will be subtracted.' },\n { name: 'value2', description: 'A number that will subtract from value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for MINUS is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => {\n if (arg instanceof Table) {\n arg = stripTable(arg, 0, 0);\n }\n return typeof arg === 'object' ? arg : ensureNumber(arg);\n });\n }\n\n protected main(v1: number | Date | TimeDelta, v2: number | Date | TimeDelta) {\n if (typeof v1 === 'number' && typeof v2 === 'number') {\n return v1 - v2;\n }\n if (v1 instanceof Date && v2 instanceof Date) {\n return new TimeDelta(v1, v2);\n }\n if (v1 instanceof Date && v2 instanceof TimeDelta) {\n return v2.sub(v1);\n }\n if (v1 instanceof TimeDelta && v2 instanceof Date) {\n return v1.sub(v2);\n }\n if (v1 instanceof Date && typeof v2 === 'number') {\n return dayjs(v1)\n .subtract(v2 * SECONDS_IN_DAY, 'second')\n .toDate();\n }\n if (!v1) {\n return -v2;\n }\n if (!v2) {\n return v1;\n }\n throw new FormulaError('#VALUE!', 'Mismatched types for minuend and subtrahend.');\n }\n}\n"],"names":[],"mappings":";;;;;;;AASO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,0CAA0C,uCAAuC;AAClF,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,oCAAoC;AAAA,MACnE,EAAE,MAAM,UAAU,aAAa,2CAA2C;AAAA,IAC5E;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAE9E,SAAK,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ;AACzC,UAAI,eAAe,OAAO;AAClB,cAAA,WAAW,KAAK,GAAG,CAAC;AAAA,MAAA;AAE5B,aAAO,OAAO,QAAQ,WAAW,MAAM,aAAa,GAAG;AAAA,IAAA,CACxD;AAAA,EAAA;AAAA,EAGO,KAAK,IAA+B,IAA+B;AAC3E,QAAI,OAAO,OAAO,YAAY,OAAO,OAAO,UAAU;AACpD,aAAO,KAAK;AAAA,IAAA;AAEV,QAAA,cAAc,QAAQ,cAAc,MAAM;AACrC,aAAA,IAAI,UAAU,IAAI,EAAE;AAAA,IAAA;AAEzB,QAAA,cAAc,QAAQ,cAAc,WAAW;AAC1C,aAAA,GAAG,IAAI,EAAE;AAAA,IAAA;AAEd,QAAA,cAAc,aAAa,cAAc,MAAM;AAC1C,aAAA,GAAG,IAAI,EAAE;AAAA,IAAA;AAElB,QAAI,cAAc,QAAQ,OAAO,OAAO,UAAU;AACzC,aAAA,MAAM,EAAE,EACZ,SAAS,KAAK,gBAAgB,QAAQ,EACtC,OAAO;AAAA,IAAA;AAEZ,QAAI,CAAC,IAAI;AACP,aAAO,CAAC;AAAA,IAAA;AAEV,QAAI,CAAC,IAAI;AACA,aAAA;AAAA,IAAA;AAEH,UAAA,IAAI,aAAa,WAAW,8CAA8C;AAAA,EAAA;AAEpF;"}
@@ -0,0 +1,33 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class ModFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "MOD(10, 4)";
8
+ this.helpText = ["Returns the result of the modulo operation."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "dividend",
12
+ description: "A number that will be divided by divisor."
13
+ },
14
+ { name: "divisor", description: "A number that will divide a dividend." }
15
+ ];
16
+ }
17
+ validate() {
18
+ if (this.bareArgs.length !== 2) {
19
+ throw new FormulaError("#N/A", "Number of arguments for MOD is incorrect.");
20
+ }
21
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
22
+ if (this.bareArgs[1] === 0) {
23
+ throw new FormulaError("#DIV/0!", "The second argument must be non-zero.");
24
+ }
25
+ }
26
+ main(v1, v2) {
27
+ return (v1 % v2 + v2) % v2;
28
+ }
29
+ }
30
+ export {
31
+ ModFunction
32
+ };
33
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sources":["../../../formula/functions/mod.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class ModFunction extends BaseFunction {\n example = 'MOD(10, 4)';\n helpText = ['Returns the result of the modulo operation.'];\n helpArgs = [\n {\n name: 'dividend',\n description: 'A number that will be divided by divisor.',\n },\n { name: 'divisor', description: 'A number that will divide a dividend.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for MOD is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[1] === 0) {\n throw new FormulaError('#DIV/0!', 'The second argument must be non-zero.');\n }\n }\n\n protected main(v1: number, v2: number) {\n // https://stackoverflow.com/questions/4467539/javascript-modulo-gives-a-negative-result-for-negative-numbers\n return ((v1 % v2) + v2) % v2;\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,MACf;AAAA,MACA,EAAE,MAAM,WAAW,aAAa,wCAAwC;AAAA,IAC1E;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;AAC5D,QAAI,KAAK,SAAS,CAAC,MAAM,GAAG;AACpB,YAAA,IAAI,aAAa,WAAW,uCAAuC;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAE5B,YAAA,KAAK,KAAM,MAAM;AAAA,EAAA;AAE9B;"}
@@ -0,0 +1,27 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureNumber } from "./__utils.js";
4
+ class MultiplyFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "MULTIPLY(6, 7)";
8
+ this.helpText = ["Returns the product of two numbers.", "This is the same as the '*' operator."];
9
+ this.helpArgs = [
10
+ { name: "factor1", description: "First factor." },
11
+ { name: "factor2", description: "Second factor." }
12
+ ];
13
+ }
14
+ validate() {
15
+ if (this.bareArgs.length !== 2) {
16
+ throw new FormulaError("#N/A", "Number of arguments for MULTIPLY is incorrect.");
17
+ }
18
+ this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
19
+ }
20
+ main(v1, v2) {
21
+ return v1 * v2;
22
+ }
23
+ }
24
+ export {
25
+ MultiplyFunction
26
+ };
27
+ //# sourceMappingURL=multiply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiply.js","sources":["../../../formula/functions/multiply.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class MultiplyFunction extends BaseFunction {\n example = 'MULTIPLY(6, 7)';\n helpText = ['Returns the product of two numbers.', \"This is the same as the '*' operator.\"];\n helpArgs = [\n { name: 'factor1', description: 'First factor.' },\n { name: 'factor2', description: 'Second factor.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for MULTIPLY is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(v1: number, v2: number) {\n return v1 * v2;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,yBAAyB,aAAa;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,uCAAuC,uCAAuC;AAC/E,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,WAAW,aAAa,gBAAgB;AAAA,MAChD,EAAE,MAAM,WAAW,aAAa,iBAAiB;AAAA,IACnD;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,gDAAgD;AAAA,IAAA;AAE5E,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,IAAY,IAAY;AACrC,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
@@ -0,0 +1,29 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ne } from "./__utils.js";
4
+ class NeFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "NE(6, 7)";
8
+ this.helpText = [
9
+ "Returns TRUE if the two specified values are not equal, FALSE if they are.",
10
+ "This is the same as the '<>' operator."
11
+ ];
12
+ this.helpArgs = [
13
+ { name: "value1", description: "First value." },
14
+ { name: "value2", description: "A value to be compared with value1." }
15
+ ];
16
+ }
17
+ validate() {
18
+ if (this.bareArgs.length !== 2) {
19
+ throw new FormulaError("#N/A", "Number of arguments for NE is incorrect.");
20
+ }
21
+ }
22
+ main(v1, v2) {
23
+ return ne(v1, v2);
24
+ }
25
+ }
26
+ export {
27
+ NeFunction
28
+ };
29
+ //# sourceMappingURL=ne.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ne.js","sources":["../../../formula/functions/ne.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ne } from './__utils';\n\nexport class NeFunction extends BaseFunction {\n example = 'NE(6, 7)';\n helpText = [\n 'Returns TRUE if the two specified values are not equal, FALSE if they are.',\n \"This is the same as the '<>' operator.\",\n ];\n helpArgs = [\n { name: 'value1', description: 'First value.' },\n { name: 'value2', description: 'A value to be compared with value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for NE is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return ne(v1, v2);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,eAAe;AAAA,MAC9C,EAAE,MAAM,UAAU,aAAa,sCAAsC;AAAA,IACvE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,0CAA0C;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAC9B,WAAA,GAAG,IAAI,EAAE;AAAA,EAAA;AAEpB;"}
@@ -0,0 +1,30 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ import { ensureBoolean } from "./__utils.js";
4
+ class NotFunction extends BaseFunction {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.example = "NOT(TRUE)";
8
+ this.helpText = ["Returns the inverse of the Boolean; if TRUE, NOT returns FALSE.", "If FALSE, NOT returns TRUE."];
9
+ this.helpArgs = [
10
+ {
11
+ name: "logical expression",
12
+ description: "A logical expression as a boolean."
13
+ }
14
+ ];
15
+ }
16
+ validate() {
17
+ if (this.bareArgs.length === 1) {
18
+ this.bareArgs[0] = ensureBoolean(this.bareArgs[0]);
19
+ return;
20
+ }
21
+ throw new FormulaError("#N/A", "Number of arguments for NOT is incorrect. 1 argument must be specified.");
22
+ }
23
+ main(v1) {
24
+ return !v1;
25
+ }
26
+ }
27
+ export {
28
+ NotFunction
29
+ };
30
+ //# sourceMappingURL=not.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not.js","sources":["../../../formula/functions/not.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureBoolean } from './__utils';\n\nexport class NotFunction extends BaseFunction {\n example = 'NOT(TRUE)';\n helpText = ['Returns the inverse of the Boolean; if TRUE, NOT returns FALSE.', 'If FALSE, NOT returns TRUE.'];\n helpArgs = [\n {\n name: 'logical expression',\n description: 'A logical expression as a boolean.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 1) {\n this.bareArgs[0] = ensureBoolean(this.bareArgs[0]);\n return;\n }\n throw new FormulaError('#N/A', 'Number of arguments for NOT is incorrect. 1 argument must be specified.');\n }\n\n protected main(v1: boolean) {\n return !v1;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,mEAAmE,6BAA6B;AACjG,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;AAC9B,WAAK,SAAS,CAAC,IAAI,cAAc,KAAK,SAAS,CAAC,CAAC;AACjD;AAAA,IAAA;AAEI,UAAA,IAAI,aAAa,QAAQ,yEAAyE;AAAA,EAAA;AAAA,EAGhG,KAAK,IAAa;AAC1B,WAAO,CAAC;AAAA,EAAA;AAEZ;"}
@@ -0,0 +1,22 @@
1
+ import { FormulaError } from "../evaluator.js";
2
+ import { BaseFunction } from "./__base.js";
3
+ class NowFunction extends BaseFunction {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.example = "NOW()";
7
+ this.helpText = ["Returns a serial value corresponding to the current date and time."];
8
+ this.helpArgs = [];
9
+ }
10
+ validate() {
11
+ if (this.bareArgs.length !== 0) {
12
+ throw new FormulaError("#N/A", "Number of arguments for NOW is incorrect.");
13
+ }
14
+ }
15
+ main() {
16
+ return /* @__PURE__ */ new Date();
17
+ }
18
+ }
19
+ export {
20
+ NowFunction
21
+ };
22
+ //# sourceMappingURL=now.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"now.js","sources":["../../../formula/functions/now.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\n\nexport class NowFunction extends BaseFunction {\n example = 'NOW()';\n helpText = ['Returns a serial value corresponding to the current date and time.'];\n helpArgs = [];\n\n protected validate() {\n if (this.bareArgs.length !== 0) {\n throw new FormulaError('#N/A', 'Number of arguments for NOW is incorrect.');\n }\n }\n\n protected main() {\n return new Date();\n }\n}\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,oEAAoE;AAChF,SAAA,WAAW,CAAC;AAAA,EAAA;AAAA,EAEF,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAAA,EAC5E;AAAA,EAGQ,OAAO;AACf,+BAAW,KAAK;AAAA,EAAA;AAEpB;"}
@@ -0,0 +1,28 @@
1
+ import { BaseFunction } from "./__base.js";
2
+ import { ensureBoolean } from "./__utils.js";
3
+ class OrFunction extends BaseFunction {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.example = "OR(A1=1, A2=2)";
7
+ this.helpText = ["Returns TRUE if any argument is logically true.", "Returns FALSE if all arguments are logically false."];
8
+ this.helpArgs = [
9
+ { name: "expression1", description: "First logical expression." },
10
+ {
11
+ name: "expression2",
12
+ description: "Additional expressions",
13
+ optional: true,
14
+ iterable: true
15
+ }
16
+ ];
17
+ }
18
+ validate() {
19
+ this.bareArgs = this.bareArgs.map((arg) => ensureBoolean(arg));
20
+ }
21
+ main(...values) {
22
+ return values.reduce((a, b) => a || b);
23
+ }
24
+ }
25
+ export {
26
+ OrFunction
27
+ };
28
+ //# sourceMappingURL=or.js.map