@gridsheet/react-core 1.4.0 → 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/Cell.d.ts +3 -3
- package/dist/components/Cell.d.ts.map +1 -1
- package/dist/components/ContextMenu.d.ts +19 -2
- package/dist/components/ContextMenu.d.ts.map +1 -1
- package/dist/components/Editor.d.ts +4 -4
- package/dist/components/Editor.d.ts.map +1 -1
- package/dist/components/Emitter.d.ts +2 -2
- package/dist/components/Emitter.d.ts.map +1 -1
- package/dist/components/Fixed.d.ts +3 -3
- package/dist/components/Fixed.d.ts.map +1 -1
- package/dist/components/FormulaBar.d.ts +1 -2
- package/dist/components/FormulaBar.d.ts.map +1 -1
- package/dist/components/GridSheet.d.ts +1 -2
- package/dist/components/GridSheet.d.ts.map +1 -1
- package/dist/components/HeaderCellLeft.d.ts +2 -2
- package/dist/components/HeaderCellLeft.d.ts.map +1 -1
- package/dist/components/HeaderCellTop.d.ts +2 -2
- package/dist/components/HeaderCellTop.d.ts.map +1 -1
- package/dist/components/PluginBase.d.ts +4 -4
- package/dist/components/PluginBase.d.ts.map +1 -1
- package/dist/components/Resizer.d.ts +1 -2
- package/dist/components/Resizer.d.ts.map +1 -1
- package/dist/components/ScrollHandle.d.ts +9 -0
- package/dist/components/ScrollHandle.d.ts.map +1 -0
- package/dist/components/SearchBar.d.ts +1 -2
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/StoreObserver.d.ts +8 -0
- package/dist/components/StoreObserver.d.ts.map +1 -0
- package/dist/components/Tabular.d.ts +2 -3
- package/dist/components/Tabular.d.ts.map +1 -1
- package/dist/components/hooks.d.ts +2 -0
- package/dist/components/hooks.d.ts.map +1 -1
- package/dist/components/svg/AddIcon.d.ts +1 -2
- package/dist/components/svg/AddIcon.d.ts.map +1 -1
- package/dist/components/svg/Base.d.ts +4 -4
- package/dist/components/svg/Base.d.ts.map +1 -1
- package/dist/components/svg/CloseIcon.d.ts +1 -2
- package/dist/components/svg/CloseIcon.d.ts.map +1 -1
- package/dist/components/svg/SearchIcon.d.ts +1 -2
- package/dist/components/svg/SearchIcon.d.ts.map +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/formula/evaluator.d.ts +21 -10
- package/dist/formula/evaluator.d.ts.map +1 -1
- package/dist/formula/functions/__base.d.ts.map +1 -1
- package/dist/formula/functions/__utils.d.ts.map +1 -1
- package/dist/formula/functions/abs.d.ts.map +1 -1
- package/dist/formula/functions/acos.d.ts.map +1 -1
- package/dist/formula/functions/add.d.ts.map +1 -1
- package/dist/formula/functions/and.d.ts.map +1 -1
- package/dist/formula/functions/asin.d.ts.map +1 -1
- package/dist/formula/functions/atan.d.ts.map +1 -1
- package/dist/formula/functions/atan2.d.ts.map +1 -1
- package/dist/formula/functions/average.d.ts.map +1 -1
- package/dist/formula/functions/col.d.ts.map +1 -1
- package/dist/formula/functions/concat.d.ts.map +1 -1
- package/dist/formula/functions/concatenate.d.ts.map +1 -1
- package/dist/formula/functions/cos.d.ts.map +1 -1
- package/dist/formula/functions/count.d.ts.map +1 -1
- package/dist/formula/functions/counta.d.ts.map +1 -1
- package/dist/formula/functions/countif.d.ts.map +1 -1
- package/dist/formula/functions/divide.d.ts.map +1 -1
- package/dist/formula/functions/eq.d.ts.map +1 -1
- package/dist/formula/functions/exp.d.ts.map +1 -1
- package/dist/formula/functions/gt.d.ts.map +1 -1
- package/dist/formula/functions/gte.d.ts.map +1 -1
- package/dist/formula/functions/hlookup.d.ts.map +1 -1
- package/dist/formula/functions/if.d.ts.map +1 -1
- package/dist/formula/functions/iferror.d.ts.map +1 -1
- package/dist/formula/functions/len.d.ts.map +1 -1
- package/dist/formula/functions/lenb.d.ts.map +1 -1
- package/dist/formula/functions/ln.d.ts.map +1 -1
- package/dist/formula/functions/log.d.ts.map +1 -1
- package/dist/formula/functions/log10.d.ts.map +1 -1
- package/dist/formula/functions/lt.d.ts.map +1 -1
- package/dist/formula/functions/lte.d.ts.map +1 -1
- package/dist/formula/functions/max.d.ts.map +1 -1
- package/dist/formula/functions/min.d.ts.map +1 -1
- package/dist/formula/functions/minus.d.ts.map +1 -1
- package/dist/formula/functions/mod.d.ts.map +1 -1
- package/dist/formula/functions/multiply.d.ts.map +1 -1
- package/dist/formula/functions/ne.d.ts.map +1 -1
- package/dist/formula/functions/not.d.ts.map +1 -1
- package/dist/formula/functions/now.d.ts.map +1 -1
- package/dist/formula/functions/or.d.ts.map +1 -1
- package/dist/formula/functions/pi.d.ts.map +1 -1
- package/dist/formula/functions/power.d.ts.map +1 -1
- package/dist/formula/functions/product.d.ts.map +1 -1
- package/dist/formula/functions/radians.d.ts.map +1 -1
- package/dist/formula/functions/rand.d.ts.map +1 -1
- package/dist/formula/functions/round.d.ts.map +1 -1
- package/dist/formula/functions/rounddown.d.ts.map +1 -1
- package/dist/formula/functions/roundup.d.ts.map +1 -1
- package/dist/formula/functions/row.d.ts.map +1 -1
- package/dist/formula/functions/sin.d.ts.map +1 -1
- package/dist/formula/functions/sqrt.d.ts.map +1 -1
- package/dist/formula/functions/sum.d.ts.map +1 -1
- package/dist/formula/functions/sumif.d.ts.map +1 -1
- package/dist/formula/functions/tan.d.ts.map +1 -1
- package/dist/formula/functions/uminus.d.ts.map +1 -1
- package/dist/formula/functions/vlookup.d.ts.map +1 -1
- package/dist/formula/mapping.d.ts.map +1 -1
- package/dist/formula/solver.d.ts.map +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9914 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/autofill.d.ts +2 -2
- package/dist/lib/autofill.d.ts.map +1 -1
- package/dist/lib/clipboard.d.ts.map +1 -1
- package/dist/lib/converters.d.ts +3 -4
- package/dist/lib/converters.d.ts.map +1 -1
- package/dist/lib/events.d.ts +6 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/hub.d.ts +39 -0
- package/dist/lib/hub.d.ts.map +1 -0
- package/dist/lib/input.d.ts +12 -2
- package/dist/lib/input.d.ts.map +1 -1
- package/dist/lib/operation.d.ts +27 -0
- package/dist/lib/operation.d.ts.map +1 -0
- package/dist/lib/palette.d.ts +1 -1
- package/dist/lib/palette.d.ts.map +1 -1
- package/dist/lib/paste.d.ts +4 -0
- package/dist/lib/paste.d.ts.map +1 -0
- package/dist/lib/sheet.d.ts +3 -0
- package/dist/lib/sheet.d.ts.map +1 -0
- package/dist/lib/structs.d.ts +7 -3
- package/dist/lib/structs.d.ts.map +1 -1
- package/dist/lib/table.d.ts +137 -76
- package/dist/lib/table.d.ts.map +1 -1
- package/dist/lib/time.d.ts +1 -0
- package/dist/lib/time.d.ts.map +1 -1
- package/dist/lib/virtualization.d.ts +3 -2
- package/dist/lib/virtualization.d.ts.map +1 -1
- package/dist/parsers/core.d.ts.map +1 -1
- package/dist/policy/core.d.ts +47 -0
- package/dist/policy/core.d.ts.map +1 -0
- package/dist/renderers/checkbox.d.ts +2 -2
- package/dist/renderers/checkbox.d.ts.map +1 -1
- package/dist/renderers/core.d.ts +36 -25
- package/dist/renderers/core.d.ts.map +1 -1
- package/dist/renderers/thousand_separator.d.ts.map +1 -1
- package/dist/store/actions.d.ts +25 -49
- package/dist/store/actions.d.ts.map +1 -1
- package/dist/store/dispatchers.d.ts +13 -0
- package/dist/store/dispatchers.d.ts.map +1 -0
- package/dist/store/helpers.d.ts +1 -0
- package/dist/store/helpers.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -2
- package/dist/store/index.d.ts.map +1 -1
- package/dist/styles/embedder.d.ts.map +1 -1
- package/dist/styles/minified.d.ts +2 -2
- package/dist/styles/minified.d.ts.map +1 -1
- package/dist/types.d.ts +108 -50
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +7 -10
- package/dist/_virtual/_commonjsHelpers.js +0 -7
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/dayjs.min.js +0 -8
- package/dist/_virtual/dayjs.min.js.map +0 -1
- package/dist/_virtual/dayjs.min2.js +0 -5
- package/dist/_virtual/dayjs.min2.js.map +0 -1
- package/dist/_virtual/timezone.js +0 -8
- package/dist/_virtual/timezone.js.map +0 -1
- package/dist/_virtual/timezone2.js +0 -5
- package/dist/_virtual/timezone2.js.map +0 -1
- package/dist/_virtual/utc.js +0 -8
- package/dist/_virtual/utc.js.map +0 -1
- package/dist/_virtual/utc2.js +0 -5
- package/dist/_virtual/utc2.js.map +0 -1
- package/dist/components/Cell.js +0 -234
- package/dist/components/Cell.js.map +0 -1
- package/dist/components/ContextMenu.js +0 -297
- package/dist/components/ContextMenu.js.map +0 -1
- package/dist/components/Editor.js +0 -464
- package/dist/components/Editor.js.map +0 -1
- package/dist/components/Emitter.js +0 -26
- package/dist/components/Emitter.js.map +0 -1
- package/dist/components/Fixed.js +0 -17
- package/dist/components/Fixed.js.map +0 -1
- package/dist/components/FormulaBar.js +0 -150
- package/dist/components/FormulaBar.js.map +0 -1
- package/dist/components/GridSheet.js +0 -247
- package/dist/components/GridSheet.js.map +0 -1
- package/dist/components/HeaderCellLeft.js +0 -131
- package/dist/components/HeaderCellLeft.js.map +0 -1
- package/dist/components/HeaderCellTop.js +0 -132
- package/dist/components/HeaderCellTop.js.map +0 -1
- package/dist/components/PluginBase.js +0 -35
- package/dist/components/PluginBase.js.map +0 -1
- package/dist/components/Resizer.js +0 -98
- package/dist/components/Resizer.js.map +0 -1
- package/dist/components/SearchBar.js +0 -108
- package/dist/components/SearchBar.js.map +0 -1
- package/dist/components/SheetProvider.d.ts +0 -30
- package/dist/components/SheetProvider.d.ts.map +0 -1
- package/dist/components/SheetProvider.js +0 -59
- package/dist/components/SheetProvider.js.map +0 -1
- package/dist/components/StoreInitializer.d.ts +0 -4
- package/dist/components/StoreInitializer.d.ts.map +0 -1
- package/dist/components/StoreInitializer.js +0 -84
- package/dist/components/StoreInitializer.js.map +0 -1
- package/dist/components/Tabular.js +0 -317
- package/dist/components/Tabular.js.map +0 -1
- package/dist/components/Toggle.d.ts +0 -12
- package/dist/components/Toggle.d.ts.map +0 -1
- package/dist/components/hooks.js +0 -15
- package/dist/components/hooks.js.map +0 -1
- package/dist/components/svg/Base.js +0 -24
- package/dist/components/svg/Base.js.map +0 -1
- package/dist/components/svg/CloseIcon.js +0 -13
- package/dist/components/svg/CloseIcon.js.map +0 -1
- package/dist/components/svg/SearchIcon.js +0 -13
- package/dist/components/svg/SearchIcon.js.map +0 -1
- package/dist/constants.js +0 -43
- package/dist/constants.js.map +0 -1
- package/dist/formula/evaluator.js +0 -679
- package/dist/formula/evaluator.js.map +0 -1
- package/dist/formula/functions/__base.js +0 -20
- package/dist/formula/functions/__base.js.map +0 -1
- package/dist/formula/functions/__utils.js +0 -145
- package/dist/formula/functions/__utils.js.map +0 -1
- package/dist/formula/functions/abs.js +0 -24
- package/dist/formula/functions/abs.js.map +0 -1
- package/dist/formula/functions/abs.spec.d.ts +0 -2
- package/dist/formula/functions/abs.spec.d.ts.map +0 -1
- package/dist/formula/functions/acos.js +0 -32
- package/dist/formula/functions/acos.js.map +0 -1
- package/dist/formula/functions/add.js +0 -57
- package/dist/formula/functions/add.js.map +0 -1
- package/dist/formula/functions/and.js +0 -28
- package/dist/formula/functions/and.js.map +0 -1
- package/dist/formula/functions/asin.js +0 -32
- package/dist/formula/functions/asin.js.map +0 -1
- package/dist/formula/functions/atan.js +0 -29
- package/dist/formula/functions/atan.js.map +0 -1
- package/dist/formula/functions/atan2.js +0 -35
- package/dist/formula/functions/atan2.js.map +0 -1
- package/dist/formula/functions/average.js +0 -44
- package/dist/formula/functions/average.js.map +0 -1
- package/dist/formula/functions/col.js +0 -34
- package/dist/formula/functions/col.js.map +0 -1
- package/dist/formula/functions/col.spec.d.ts +0 -2
- package/dist/formula/functions/col.spec.d.ts.map +0 -1
- package/dist/formula/functions/concat.js +0 -27
- package/dist/formula/functions/concat.js.map +0 -1
- package/dist/formula/functions/concatenate.js +0 -28
- package/dist/formula/functions/concatenate.js.map +0 -1
- package/dist/formula/functions/cos.js +0 -29
- package/dist/formula/functions/cos.js.map +0 -1
- package/dist/formula/functions/count.js +0 -38
- package/dist/formula/functions/count.js.map +0 -1
- package/dist/formula/functions/counta.js +0 -38
- package/dist/formula/functions/counta.js.map +0 -1
- package/dist/formula/functions/countif.js +0 -32
- package/dist/formula/functions/countif.js.map +0 -1
- package/dist/formula/functions/countif.spec.d.ts +0 -2
- package/dist/formula/functions/countif.spec.d.ts.map +0 -1
- package/dist/formula/functions/divide.js +0 -33
- package/dist/formula/functions/divide.js.map +0 -1
- package/dist/formula/functions/eq.js +0 -29
- package/dist/formula/functions/eq.js.map +0 -1
- package/dist/formula/functions/eq.spec.d.ts +0 -2
- package/dist/formula/functions/eq.spec.d.ts.map +0 -1
- package/dist/formula/functions/exp.js +0 -29
- package/dist/formula/functions/exp.js.map +0 -1
- package/dist/formula/functions/gt.js +0 -29
- package/dist/formula/functions/gt.js.map +0 -1
- package/dist/formula/functions/gte.js +0 -29
- package/dist/formula/functions/gte.js.map +0 -1
- package/dist/formula/functions/hlookup.js +0 -75
- package/dist/formula/functions/hlookup.js.map +0 -1
- package/dist/formula/functions/if.js +0 -39
- package/dist/formula/functions/if.js.map +0 -1
- package/dist/formula/functions/iferror.js +0 -45
- package/dist/formula/functions/iferror.js.map +0 -1
- package/dist/formula/functions/iferror.spec.d.ts +0 -2
- package/dist/formula/functions/iferror.spec.d.ts.map +0 -1
- package/dist/formula/functions/len.js +0 -29
- package/dist/formula/functions/len.js.map +0 -1
- package/dist/formula/functions/lenb.js +0 -29
- package/dist/formula/functions/lenb.js.map +0 -1
- package/dist/formula/functions/ln.js +0 -32
- package/dist/formula/functions/ln.js.map +0 -1
- package/dist/formula/functions/log.js +0 -36
- package/dist/formula/functions/log.js.map +0 -1
- package/dist/formula/functions/log10.js +0 -32
- package/dist/formula/functions/log10.js.map +0 -1
- package/dist/formula/functions/lt.js +0 -29
- package/dist/formula/functions/lt.js.map +0 -1
- package/dist/formula/functions/lte.js +0 -29
- package/dist/formula/functions/lte.js.map +0 -1
- package/dist/formula/functions/max.js +0 -47
- package/dist/formula/functions/max.js.map +0 -1
- package/dist/formula/functions/min.js +0 -47
- package/dist/formula/functions/min.js.map +0 -1
- package/dist/formula/functions/minus.js +0 -57
- package/dist/formula/functions/minus.js.map +0 -1
- package/dist/formula/functions/mod.js +0 -33
- package/dist/formula/functions/mod.js.map +0 -1
- package/dist/formula/functions/mod.spec.d.ts +0 -2
- package/dist/formula/functions/mod.spec.d.ts.map +0 -1
- package/dist/formula/functions/multiply.js +0 -27
- package/dist/formula/functions/multiply.js.map +0 -1
- package/dist/formula/functions/ne.js +0 -29
- package/dist/formula/functions/ne.js.map +0 -1
- package/dist/formula/functions/not.js +0 -30
- package/dist/formula/functions/not.js.map +0 -1
- package/dist/formula/functions/now.js +0 -22
- package/dist/formula/functions/now.js.map +0 -1
- package/dist/formula/functions/or.js +0 -28
- package/dist/formula/functions/or.js.map +0 -1
- package/dist/formula/functions/pi.js +0 -22
- package/dist/formula/functions/pi.js.map +0 -1
- package/dist/formula/functions/power.js +0 -27
- package/dist/formula/functions/power.js.map +0 -1
- package/dist/formula/functions/product.js +0 -40
- package/dist/formula/functions/product.js.map +0 -1
- package/dist/formula/functions/radians.js +0 -29
- package/dist/formula/functions/radians.js.map +0 -1
- package/dist/formula/functions/rand.js +0 -22
- package/dist/formula/functions/rand.js.map +0 -1
- package/dist/formula/functions/round.js +0 -35
- package/dist/formula/functions/round.js.map +0 -1
- package/dist/formula/functions/rounddown.js +0 -35
- package/dist/formula/functions/rounddown.js.map +0 -1
- package/dist/formula/functions/roundup.js +0 -35
- package/dist/formula/functions/roundup.js.map +0 -1
- package/dist/formula/functions/row.js +0 -34
- package/dist/formula/functions/row.js.map +0 -1
- package/dist/formula/functions/row.spec.d.ts +0 -2
- package/dist/formula/functions/row.spec.d.ts.map +0 -1
- package/dist/formula/functions/sin.js +0 -29
- package/dist/formula/functions/sin.js.map +0 -1
- package/dist/formula/functions/sqrt.js +0 -32
- package/dist/formula/functions/sqrt.js.map +0 -1
- package/dist/formula/functions/sum.js +0 -47
- package/dist/formula/functions/sum.js.map +0 -1
- package/dist/formula/functions/sum.spec.d.ts +0 -2
- package/dist/formula/functions/sum.spec.d.ts.map +0 -1
- package/dist/formula/functions/sumif.js +0 -65
- package/dist/formula/functions/sumif.js.map +0 -1
- package/dist/formula/functions/tan.js +0 -29
- package/dist/formula/functions/tan.js.map +0 -1
- package/dist/formula/functions/uminus.js +0 -24
- package/dist/formula/functions/uminus.js.map +0 -1
- package/dist/formula/functions/vlookup.js +0 -75
- package/dist/formula/functions/vlookup.js.map +0 -1
- package/dist/formula/mapping.js +0 -119
- package/dist/formula/mapping.js.map +0 -1
- package/dist/formula/solver.js +0 -70
- package/dist/formula/solver.js.map +0 -1
- package/dist/lib/autofill.js +0 -391
- package/dist/lib/autofill.js.map +0 -1
- package/dist/lib/clipboard.js +0 -72
- package/dist/lib/clipboard.js.map +0 -1
- package/dist/lib/converters.js +0 -141
- package/dist/lib/converters.js.map +0 -1
- package/dist/lib/input.js +0 -52
- package/dist/lib/input.js.map +0 -1
- package/dist/lib/palette.js +0 -24
- package/dist/lib/palette.js.map +0 -1
- package/dist/lib/prevention.d.ts +0 -24
- package/dist/lib/prevention.d.ts.map +0 -1
- package/dist/lib/prevention.js +0 -82
- package/dist/lib/prevention.js.map +0 -1
- package/dist/lib/structs.js +0 -276
- package/dist/lib/structs.js.map +0 -1
- package/dist/lib/table.js +0 -1259
- package/dist/lib/table.js.map +0 -1
- package/dist/lib/time.js +0 -170
- package/dist/lib/time.js.map +0 -1
- package/dist/lib/virtualization.js +0 -129
- package/dist/lib/virtualization.js.map +0 -1
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js +0 -287
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js.map +0 -1
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/timezone.js +0 -72
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/timezone.js.map +0 -1
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/utc.js +0 -85
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/utc.js.map +0 -1
- package/dist/parsers/core.js +0 -111
- package/dist/parsers/core.js.map +0 -1
- package/dist/renderers/checkbox.js +0 -20
- package/dist/renderers/checkbox.js.map +0 -1
- package/dist/renderers/core.js +0 -135
- package/dist/renderers/core.js.map +0 -1
- package/dist/renderers/thousand_separator.js +0 -17
- package/dist/renderers/thousand_separator.js.map +0 -1
- package/dist/store/actions.js +0 -762
- package/dist/store/actions.js.map +0 -1
- package/dist/store/helpers.js +0 -88
- package/dist/store/helpers.js.map +0 -1
- package/dist/store/index.js +0 -8
- package/dist/store/index.js.map +0 -1
- package/dist/styles/embedder.js +0 -19
- package/dist/styles/embedder.js.map +0 -1
- package/dist/styles/minified.js +0 -7
- package/dist/styles/minified.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
var _a;
|
|
18
|
-
if (this.bareArgs.length === 0) {
|
|
19
|
-
this.bareArgs = [((_a = this.origin) == null ? void 0 : _a.y) ?? 1];
|
|
20
|
-
} else if (this.bareArgs.length === 1) {
|
|
21
|
-
const table = this.bareArgs[0];
|
|
22
|
-
this.bareArgs = [table.top];
|
|
23
|
-
} else {
|
|
24
|
-
throw new FormulaError("#N/A", "Number of arguments for ROW is incorrect.");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
main(top) {
|
|
28
|
-
return top;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
RowFunction
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=row.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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.origin?.y ?? 1];\n } else if (this.bareArgs.length === 1) {\n const table = this.bareArgs[0] as Table;\n this.bareArgs = [table.top];\n } else {\n throw new FormulaError('#N/A', 'Number of arguments for ROW is incorrect.');\n }\n }\n\n protected main(top: number) {\n return 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;AAC9B,WAAK,WAAW,GAAC,UAAK,WAAL,mBAAa,MAAK,CAAC;AAAA,IAC3B,WAAA,KAAK,SAAS,WAAW,GAAG;AAC/B,YAAA,QAAQ,KAAK,SAAS,CAAC;AACxB,WAAA,WAAW,CAAC,MAAM,GAAG;AAAA,IAAA,OACrB;AACC,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAAA,EAC5E;AAAA,EAGQ,KAAK,KAAa;AACnB,WAAA;AAAA,EAAA;AAEX;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"row.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/row.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sum.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/sum.spec.ts"],"names":[],"mappings":""}
|