@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,34 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
class ColFunction extends BaseFunction {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.example = "COL(A9)";
|
|
7
|
-
this.helpText = ["Returns the col number of a specified cell."];
|
|
8
|
-
this.helpArgs = [
|
|
9
|
-
{
|
|
10
|
-
name: "cell_reference",
|
|
11
|
-
description: "The cell whose col 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.x) ?? 1];
|
|
20
|
-
} else if (this.bareArgs.length === 1) {
|
|
21
|
-
const table = this.bareArgs[0];
|
|
22
|
-
this.bareArgs = [table.left];
|
|
23
|
-
} else {
|
|
24
|
-
throw new FormulaError("#N/A", "Number of arguments for COL is incorrect.");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
main(left) {
|
|
28
|
-
return left;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
ColFunction
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=col.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"col.js","sources":["../../../formula/functions/col.ts"],"sourcesContent":["import { Table } from '../../lib/table';\nimport { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\n\nexport class ColFunction extends BaseFunction {\n example = 'COL(A9)';\n helpText = ['Returns the col number of a specified cell.'];\n helpArgs = [\n {\n name: 'cell_reference',\n description: 'The cell whose col number will be returned.',\n option: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 0) {\n this.bareArgs = [this.origin?.x ?? 1];\n } else if (this.bareArgs.length === 1) {\n const table = this.bareArgs[0] as Table;\n this.bareArgs = [table.left];\n } else {\n throw new FormulaError('#N/A', 'Number of arguments for COL is incorrect.');\n }\n }\n\n protected main(left: number) {\n return left;\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,IAAI;AAAA,IAAA,OACtB;AACC,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAAA,EAC5E;AAAA,EAGQ,KAAK,MAAc;AACpB,WAAA;AAAA,EAAA;AAEX;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"col.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/col.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureString } from "./__utils.js";
|
|
4
|
-
class ConcatFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = 'CONCAT("Hello", "World")';
|
|
8
|
-
this.helpText = ["Returns the concatenation of two values.", "This is the same as the '&' operator."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{ name: "value1", description: "A value to be concatenated with value2." },
|
|
11
|
-
{ name: "value2", description: "A value to be concatenated with value1" }
|
|
12
|
-
];
|
|
13
|
-
}
|
|
14
|
-
validate() {
|
|
15
|
-
if (this.bareArgs.length !== 2) {
|
|
16
|
-
throw new FormulaError("#N/A", "Number of arguments for CONCAT is incorrect.");
|
|
17
|
-
}
|
|
18
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureString(arg));
|
|
19
|
-
}
|
|
20
|
-
main(v1, v2) {
|
|
21
|
-
return v1 + v2;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
ConcatFunction
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=concat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concat.js","sources":["../../../formula/functions/concat.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureString } from './__utils';\n\nexport class ConcatFunction extends BaseFunction {\n example = 'CONCAT(\"Hello\", \"World\")';\n helpText = ['Returns the concatenation of two values.', \"This is the same as the '&' operator.\"];\n helpArgs = [\n { name: 'value1', description: 'A value to be concatenated with value2.' },\n { name: 'value2', description: 'A value to be concatenated with value1' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for CONCAT is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureString(arg));\n }\n\n protected main(v1: string, v2: string) {\n return v1 + v2;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB,aAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,4CAA4C,uCAAuC;AACpF,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,0CAA0C;AAAA,MACzE,EAAE,MAAM,UAAU,aAAa,yCAAyC;AAAA,IAC1E;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,8CAA8C;AAAA,IAAA;AAE1E,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,IAAY,IAAY;AACrC,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BaseFunction } from "./__base.js";
|
|
2
|
-
import { ensureString } from "./__utils.js";
|
|
3
|
-
class ConcatenateFunction extends BaseFunction {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.example = 'CONCATENATE("Hello", "World")';
|
|
7
|
-
this.helpText = ["Returns the concatenation of the values."];
|
|
8
|
-
this.helpArgs = [
|
|
9
|
-
{ name: "value1", description: "First string value." },
|
|
10
|
-
{
|
|
11
|
-
name: "value2",
|
|
12
|
-
description: "Additional string values to be concatenated with the value1",
|
|
13
|
-
optional: true,
|
|
14
|
-
iterable: true
|
|
15
|
-
}
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
validate() {
|
|
19
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureString(arg));
|
|
20
|
-
}
|
|
21
|
-
main(...values) {
|
|
22
|
-
return values.reduce((a, b) => a + b);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
ConcatenateFunction
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=concatenate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concatenate.js","sources":["../../../formula/functions/concatenate.ts"],"sourcesContent":["import { BaseFunction } from './__base';\nimport { ensureString } from './__utils';\n\nexport class ConcatenateFunction extends BaseFunction {\n example = 'CONCATENATE(\"Hello\", \"World\")';\n helpText = ['Returns the concatenation of the values.'];\n helpArgs = [\n { name: 'value1', description: 'First string value.' },\n {\n name: 'value2',\n description: 'Additional string values to be concatenated with the value1',\n optional: true,\n iterable: true,\n },\n ];\n\n protected validate() {\n this.bareArgs = this.bareArgs.map((arg) => ensureString(arg));\n }\n\n protected main(...values: string[]) {\n return values.reduce((a, b) => a + b);\n }\n}\n"],"names":[],"mappings":";;AAGO,MAAM,4BAA4B,aAAa;AAAA,EAA/C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,0CAA0C;AAC3C,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,sBAAsB;AAAA,MACrD;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,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,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 CosFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "COS(PI()/2)";
|
|
8
|
-
this.helpText = ["Returns the cos of the angle specified in radians."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "angle",
|
|
12
|
-
description: "An angle in radians, at which you want the cos."
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
validate() {
|
|
17
|
-
if (this.bareArgs.length !== 1) {
|
|
18
|
-
throw new FormulaError("#N/A", "Number of arguments for COS is incorrect.");
|
|
19
|
-
}
|
|
20
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
-
}
|
|
22
|
-
main(angle) {
|
|
23
|
-
return Math.cos(angle);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
CosFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=cos.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cos.js","sources":["../../../formula/functions/cos.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class CosFunction extends BaseFunction {\n example = 'COS(PI()/2)';\n helpText = ['Returns the cos of the angle specified in radians.'];\n helpArgs = [\n {\n name: 'angle',\n description: 'An angle in radians, at which you want the cos.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for COS is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(angle: number) {\n return Math.cos(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,38 +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 CountFunction extends BaseFunction {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.example = "COUNT(A2:A100,B2:B100,4,26)";
|
|
9
|
-
this.helpText = ["Returns the count 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.map((arg) => {
|
|
23
|
-
if (arg instanceof Table) {
|
|
24
|
-
spreaded.push(...solveTable({ table: arg }).reduce((a, b) => a.concat(b)));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
spreaded.push(ensureNumber(arg));
|
|
28
|
-
});
|
|
29
|
-
this.bareArgs = spreaded;
|
|
30
|
-
}
|
|
31
|
-
main(...values) {
|
|
32
|
-
return values.filter((v) => typeof v === "number").length;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
CountFunction
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=count.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"count.js","sources":["../../../formula/functions/count.ts"],"sourcesContent":["import { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class CountFunction extends BaseFunction {\n example = 'COUNT(A2:A100,B2:B100,4,26)';\n helpText = ['Returns the count 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: any[] = [];\n this.bareArgs.map((arg) => {\n if (arg instanceof Table) {\n spreaded.push(...solveTable({ table: arg }).reduce((a, b) => a.concat(b)));\n return;\n }\n spreaded.push(ensureNumber(arg));\n });\n this.bareArgs = spreaded;\n }\n\n protected main(...values: any[]) {\n return values.filter((v) => typeof v === 'number').length;\n }\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,oDAAoD;AACrD,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,WAAkB,CAAC;AACpB,SAAA,SAAS,IAAI,CAAC,QAAQ;AACzB,UAAI,eAAe,OAAO;AACxB,iBAAS,KAAK,GAAG,WAAW,EAAE,OAAO,KAAK,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACzE;AAAA,MAAA;AAEO,eAAA,KAAK,aAAa,GAAG,CAAC;AAAA,IAAA,CAChC;AACD,SAAK,WAAW;AAAA,EAAA;AAAA,EAGR,QAAQ,QAAe;AAC/B,WAAO,OAAO,OAAO,CAAC,MAAM,OAAO,MAAM,QAAQ,EAAE;AAAA,EAAA;AAEvD;"}
|
|
@@ -1,38 +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 CountaFunction extends BaseFunction {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.example = "COUNTA(A2:A100,B2:B100,4,26)";
|
|
9
|
-
this.helpText = ["Returns the number of values in the data set."];
|
|
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.map((arg) => {
|
|
23
|
-
if (arg instanceof Table) {
|
|
24
|
-
spreaded.push(...solveTable({ table: arg }).reduce((a, b) => a.concat(b)));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
spreaded.push(ensureNumber(arg));
|
|
28
|
-
});
|
|
29
|
-
this.bareArgs = spreaded;
|
|
30
|
-
}
|
|
31
|
-
main(...values) {
|
|
32
|
-
return values.filter((v) => v != null && v !== "").length;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
CountaFunction
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=counta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"counta.js","sources":["../../../formula/functions/counta.ts"],"sourcesContent":["import { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class CountaFunction extends BaseFunction {\n example = 'COUNTA(A2:A100,B2:B100,4,26)';\n helpText = ['Returns the number of values in the data set.'];\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: any[] = [];\n this.bareArgs.map((arg) => {\n if (arg instanceof Table) {\n spreaded.push(...solveTable({ table: arg }).reduce((a, b) => a.concat(b)));\n return;\n }\n spreaded.push(ensureNumber(arg));\n });\n this.bareArgs = spreaded;\n }\n\n protected main(...values: any[]) {\n return values.filter((v) => v != null && v !== '').length;\n }\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,uBAAuB,aAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,+CAA+C;AAChD,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,WAAkB,CAAC;AACpB,SAAA,SAAS,IAAI,CAAC,QAAQ;AACzB,UAAI,eAAe,OAAO;AACxB,iBAAS,KAAK,GAAG,WAAW,EAAE,OAAO,KAAK,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACzE;AAAA,MAAA;AAEO,eAAA,KAAK,aAAa,GAAG,CAAC;AAAA,IAAA,CAChC;AACD,SAAK,WAAW;AAAA,EAAA;AAAA,EAGR,QAAQ,QAAe;AACxB,WAAA,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,MAAM,EAAE,EAAE;AAAA,EAAA;AAEvD;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { solveTable } from "../solver.js";
|
|
3
|
-
import { BaseFunction } from "./__base.js";
|
|
4
|
-
import { ensureString, check } from "./__utils.js";
|
|
5
|
-
class CountifFunction extends BaseFunction {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.example = 'COUNTIF(A1:A10,">20")';
|
|
9
|
-
this.helpText = ["Returns the count of a series of cells."];
|
|
10
|
-
this.helpArgs = [
|
|
11
|
-
{ name: "range", description: "Target range." },
|
|
12
|
-
{
|
|
13
|
-
name: "condition",
|
|
14
|
-
description: "A condition for count."
|
|
15
|
-
}
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
validate() {
|
|
19
|
-
if (this.bareArgs.length !== 2) {
|
|
20
|
-
throw new FormulaError("#N/A", "Number of arguments for COUNTIF is incorrect.");
|
|
21
|
-
}
|
|
22
|
-
this.bareArgs[1] = ensureString(this.bareArgs[1]);
|
|
23
|
-
}
|
|
24
|
-
main(table, condition) {
|
|
25
|
-
const matrix = solveTable({ table });
|
|
26
|
-
return matrix.reduce((a, b) => a.concat(b)).filter((v) => check(v, condition)).length;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
CountifFunction
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=countif.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countif.js","sources":["../../../formula/functions/countif.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { check, ensureString } from './__utils';\n\nexport class CountifFunction extends BaseFunction {\n example = 'COUNTIF(A1:A10,\">20\")';\n helpText = ['Returns the count of a series of cells.'];\n helpArgs = [\n { name: 'range', description: 'Target range.' },\n {\n name: 'condition',\n description: 'A condition for count.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for COUNTIF is incorrect.');\n }\n this.bareArgs[1] = ensureString(this.bareArgs[1]);\n }\n\n protected main(table: Table, condition: string) {\n const matrix = solveTable({ table });\n return matrix.reduce((a, b) => a.concat(b)).filter((v: any) => check(v, condition)).length;\n }\n}\n"],"names":[],"mappings":";;;;AAMO,MAAM,wBAAwB,aAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,yCAAyC;AAC1C,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,SAAS,aAAa,gBAAgB;AAAA,MAC9C;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;AAEhF,SAAK,SAAS,CAAC,IAAI,aAAa,KAAK,SAAS,CAAC,CAAC;AAAA,EAAA;AAAA,EAGxC,KAAK,OAAc,WAAmB;AAC9C,UAAM,SAAS,WAAW,EAAE,OAAO;AACnC,WAAO,OAAO,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,MAAW,MAAM,GAAG,SAAS,CAAC,EAAE;AAAA,EAAA;AAExF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countif.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/countif.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureNumber } from "./__utils.js";
|
|
4
|
-
class DivideFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "DIVIDE(4, 2)";
|
|
8
|
-
this.helpText = ["Returns the result of dividing one number by another.", "This is the same as the '/' operator."];
|
|
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 DIVIDE 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(divided, divisor) {
|
|
27
|
-
return divided / divisor;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
DivideFunction
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=divide.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"divide.js","sources":["../../../formula/functions/divide.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class DivideFunction extends BaseFunction {\n example = 'DIVIDE(4, 2)';\n helpText = ['Returns the result of dividing one number by another.', \"This is the same as the '/' operator.\"];\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 DIVIDE 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(divided: number, divisor: number) {\n return divided / divisor;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB,aAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,yDAAyD,uCAAuC;AACjG,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,8CAA8C;AAAA,IAAA;AAE1E,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,SAAiB,SAAiB;AAC/C,WAAO,UAAU;AAAA,EAAA;AAErB;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { eq } from "./__utils.js";
|
|
4
|
-
class EqFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "EQ(6, 7)";
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"Returns TRUE if the two specified values are equal, FALSE if they are not.",
|
|
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 EQ is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
main(v1, v2) {
|
|
23
|
-
return eq(v1, v2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
EqFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=eq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eq.js","sources":["../../../formula/functions/eq.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { eq } from './__utils';\n\nexport class EqFunction extends BaseFunction {\n example = 'EQ(6, 7)';\n helpText = [\n 'Returns TRUE if the two specified values are equal, FALSE if they are not.',\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 EQ is incorrect.');\n }\n }\n\n protected main(v1: any, v2: any) {\n return eq(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,IAAS,IAAS;AACxB,WAAA,GAAG,IAAI,EAAE;AAAA,EAAA;AAEpB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eq.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/eq.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 ExpFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "EXP(2)";
|
|
8
|
-
this.helpText = ["Returns the power of a number whose base is the Euler number e."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "exponent",
|
|
12
|
-
description: "It is an exponent of power with e as the base."
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
validate() {
|
|
17
|
-
if (this.bareArgs.length !== 1) {
|
|
18
|
-
throw new FormulaError("#N/A", "Number of arguments for EXP is incorrect.");
|
|
19
|
-
}
|
|
20
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
-
}
|
|
22
|
-
main(exponent) {
|
|
23
|
-
return Math.exp(exponent);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
ExpFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=exp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exp.js","sources":["../../../formula/functions/exp.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class ExpFunction extends BaseFunction {\n example = 'EXP(2)';\n helpText = ['Returns the power of a number whose base is the Euler number e.'];\n helpArgs = [\n {\n name: 'exponent',\n description: 'It is an exponent of power with e as the base.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for EXP is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(exponent: number) {\n return Math.exp(exponent);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,iEAAiE;AAClE,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,UAAkB;AACxB,WAAA,KAAK,IAAI,QAAQ;AAAA,EAAA;AAE5B;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { gt } from "./__utils.js";
|
|
4
|
-
class GtFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "GT(5, 3)";
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"Returns TRUE if the first argument is truly greater than the second, 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 GT is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
main(v1, v2) {
|
|
23
|
-
return gt(v1, v2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
GtFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=gt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gt.js","sources":["../../../formula/functions/gt.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { gt } from './__utils';\n\nexport class GtFunction extends BaseFunction {\n example = 'GT(5, 3)';\n helpText = [\n 'Returns TRUE if the first argument is truly greater than the second, 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 GT is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return gt(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;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { gte } from "./__utils.js";
|
|
4
|
-
class GteFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "GTE(5, 3)";
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"Returns TRUE if the first argument is greater than the second, 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 GTE is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
main(v1, v2) {
|
|
23
|
-
return gte(v1, v2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
GteFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=gte.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gte.js","sources":["../../../formula/functions/gte.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { gte } from './__utils';\n\nexport class GteFunction extends BaseFunction {\n example = 'GTE(5, 3)';\n helpText = [\n 'Returns TRUE if the first argument is greater than the second, 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 GTE is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return gte(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;"}
|
|
@@ -1,75 +0,0 @@
|
|
|
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 { stripTable, ensureNumber, ensureBoolean } from "./__utils.js";
|
|
6
|
-
class HlookupFunction extends BaseFunction {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.example = "HLOOKUP(10003, A2:Z6, 2, FALSE)";
|
|
10
|
-
this.helpText = [
|
|
11
|
-
"Searches horizontally for the specified key in the first row of the range and returns the value of the specified cell in the same column."
|
|
12
|
-
];
|
|
13
|
-
this.helpArgs = [
|
|
14
|
-
{ name: "key", description: "Search key." },
|
|
15
|
-
{
|
|
16
|
-
name: "range",
|
|
17
|
-
description: "A range for search"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "index",
|
|
21
|
-
description: "The index of the row in the range."
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "is_sorted",
|
|
25
|
-
description: "FALSE: Exact match. This is recommended. TRUE: Approximate match. Before you use an approximate match, sort your search key in ascending order. Otherwise, you may likely get a wrong return value.",
|
|
26
|
-
option: true
|
|
27
|
-
}
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
validate() {
|
|
31
|
-
if (this.bareArgs.length !== 3 && this.bareArgs.length !== 4) {
|
|
32
|
-
throw new FormulaError("#N/A", "Number of arguments for HLOOKUP is incorrect.");
|
|
33
|
-
}
|
|
34
|
-
if (this.bareArgs[0] instanceof Table) {
|
|
35
|
-
this.bareArgs[0] = stripTable(this.bareArgs[0]);
|
|
36
|
-
}
|
|
37
|
-
if (!(this.bareArgs[1] instanceof Table)) {
|
|
38
|
-
throw new FormulaError("#REF!", "2nd argument must be range");
|
|
39
|
-
}
|
|
40
|
-
this.bareArgs[2] = ensureNumber(this.bareArgs[2]);
|
|
41
|
-
this.bareArgs[3] = ensureBoolean(this.bareArgs[3], true);
|
|
42
|
-
}
|
|
43
|
-
main(key, range, index, isSorted) {
|
|
44
|
-
var _a, _b, _c, _d;
|
|
45
|
-
const matrix = solveTable({ table: range });
|
|
46
|
-
if (isSorted) {
|
|
47
|
-
let last = -1;
|
|
48
|
-
for (let x = 0; x <= range.getNumCols(); x++) {
|
|
49
|
-
const v = (_a = matrix[0]) == null ? void 0 : _a[x];
|
|
50
|
-
if (v == null) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (v <= key) {
|
|
54
|
-
last = x;
|
|
55
|
-
} else {
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (last !== -1) {
|
|
60
|
-
return (_b = matrix[index - 1]) == null ? void 0 : _b[last];
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
for (let x = 0; x <= range.getNumCols(); x++) {
|
|
64
|
-
if (((_c = matrix[0]) == null ? void 0 : _c[x]) === key) {
|
|
65
|
-
return (_d = matrix[index - 1]) == null ? void 0 : _d[x];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
throw new FormulaError("#N/A", `No values found for '${key}'.`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export {
|
|
73
|
-
HlookupFunction
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=hlookup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hlookup.js","sources":["../../../formula/functions/hlookup.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureBoolean, ensureNumber, stripTable } from './__utils';\n\nexport class HlookupFunction extends BaseFunction {\n example = 'HLOOKUP(10003, A2:Z6, 2, FALSE)';\n helpText = [\n 'Searches horizontally for the specified key in the first row of the range and returns the value of the specified cell in the same column.',\n ];\n helpArgs = [\n { name: 'key', description: 'Search key.' },\n {\n name: 'range',\n description: 'A range for search',\n },\n {\n name: 'index',\n description: 'The index of the row in the range.',\n },\n {\n name: 'is_sorted',\n description:\n 'FALSE: Exact match. This is recommended. TRUE: Approximate match. Before you use an approximate match, sort your search key in ascending order. Otherwise, you may likely get a wrong return value.',\n option: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 3 && this.bareArgs.length !== 4) {\n throw new FormulaError('#N/A', 'Number of arguments for HLOOKUP is incorrect.');\n }\n if (this.bareArgs[0] instanceof Table) {\n this.bareArgs[0] = stripTable(this.bareArgs[0]);\n }\n if (!(this.bareArgs[1] instanceof Table)) {\n throw new FormulaError('#REF!', '2nd argument must be range');\n }\n this.bareArgs[2] = ensureNumber(this.bareArgs[2]);\n this.bareArgs[3] = ensureBoolean(this.bareArgs[3], true);\n }\n\n protected main(key: any, range: Table, index: number, isSorted: boolean) {\n const matrix = solveTable({ table: range });\n if (isSorted) {\n let last = -1;\n for (let x = 0; x <= range.getNumCols(); x++) {\n const v = matrix[0]?.[x];\n if (v == null) {\n continue;\n }\n if (v <= key) {\n last = x;\n } else {\n break;\n }\n }\n if (last !== -1) {\n return matrix[index - 1]?.[last];\n }\n } else {\n for (let x = 0; x <= range.getNumCols(); x++) {\n if (matrix[0]?.[x] === key) {\n return matrix[index - 1]?.[x];\n }\n }\n }\n throw new FormulaError('#N/A', `No values found for '${key}'.`);\n }\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,wBAAwB,aAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,OAAO,aAAa,cAAc;AAAA,MAC1C;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aACE;AAAA,QACF,QAAQ;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAEU,WAAW;AACnB,QAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,WAAW,GAAG;AACtD,YAAA,IAAI,aAAa,QAAQ,+CAA+C;AAAA,IAAA;AAEhF,QAAI,KAAK,SAAS,CAAC,aAAa,OAAO;AACrC,WAAK,SAAS,CAAC,IAAI,WAAW,KAAK,SAAS,CAAC,CAAC;AAAA,IAAA;AAEhD,QAAI,EAAE,KAAK,SAAS,CAAC,aAAa,QAAQ;AAClC,YAAA,IAAI,aAAa,SAAS,4BAA4B;AAAA,IAAA;AAE9D,SAAK,SAAS,CAAC,IAAI,aAAa,KAAK,SAAS,CAAC,CAAC;AAC3C,SAAA,SAAS,CAAC,IAAI,cAAc,KAAK,SAAS,CAAC,GAAG,IAAI;AAAA,EAAA;AAAA,EAG/C,KAAK,KAAU,OAAc,OAAe,UAAmB;;AACvE,UAAM,SAAS,WAAW,EAAE,OAAO,OAAO;AAC1C,QAAI,UAAU;AACZ,UAAI,OAAO;AACX,eAAS,IAAI,GAAG,KAAK,MAAM,WAAA,GAAc,KAAK;AAC5C,cAAM,KAAI,YAAO,CAAC,MAAR,mBAAY;AACtB,YAAI,KAAK,MAAM;AACb;AAAA,QAAA;AAEF,YAAI,KAAK,KAAK;AACL,iBAAA;AAAA,QAAA,OACF;AACL;AAAA,QAAA;AAAA,MACF;AAEF,UAAI,SAAS,IAAI;AACf,gBAAO,YAAO,QAAQ,CAAC,MAAhB,mBAAoB;AAAA,MAAI;AAAA,IACjC,OACK;AACL,eAAS,IAAI,GAAG,KAAK,MAAM,WAAA,GAAc,KAAK;AAC5C,cAAI,YAAO,CAAC,MAAR,mBAAY,QAAO,KAAK;AAC1B,kBAAO,YAAO,QAAQ,CAAC,MAAhB,mBAAoB;AAAA,QAAC;AAAA,MAC9B;AAAA,IACF;AAEF,UAAM,IAAI,aAAa,QAAQ,wBAAwB,GAAG,IAAI;AAAA,EAAA;AAElE;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureBoolean } from "./__utils.js";
|
|
4
|
-
class IfFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = 'IF(A2 = "Human", "Hello", "World")';
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"If the logical expression is TRUE, the second argument is returned.",
|
|
10
|
-
"If FALSE, the third argument is returned."
|
|
11
|
-
];
|
|
12
|
-
this.helpArgs = [
|
|
13
|
-
{ name: "condition", description: "An expression as a condition" },
|
|
14
|
-
{
|
|
15
|
-
name: "value1",
|
|
16
|
-
description: "value to be returned if the condition is true."
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "value2",
|
|
20
|
-
description: "value to be returned if the condition is false.",
|
|
21
|
-
optional: true
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
validate() {
|
|
26
|
-
if (this.bareArgs.length === 2 || this.bareArgs.length === 3) {
|
|
27
|
-
this.bareArgs[0] = ensureBoolean(this.bareArgs[0]);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
throw new FormulaError("#N/A", "Number of arguments for IF is incorrect. 2 or 3 arguments must be specified.");
|
|
31
|
-
}
|
|
32
|
-
main(condition, v1, v2 = false) {
|
|
33
|
-
return condition ? v1 : v2;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
IfFunction
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=if.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"if.js","sources":["../../../formula/functions/if.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureBoolean } from './__utils';\n\nexport class IfFunction extends BaseFunction {\n example = 'IF(A2 = \"Human\", \"Hello\", \"World\")';\n helpText = [\n 'If the logical expression is TRUE, the second argument is returned.',\n 'If FALSE, the third argument is returned.',\n ];\n helpArgs = [\n { name: 'condition', description: 'An expression as a condition' },\n {\n name: 'value1',\n description: 'value to be returned if the condition is true.',\n },\n {\n name: 'value2',\n description: 'value to be returned if the condition is false.',\n optional: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 2 || this.bareArgs.length === 3) {\n this.bareArgs[0] = ensureBoolean(this.bareArgs[0]);\n return;\n }\n throw new FormulaError('#N/A', 'Number of arguments for IF is incorrect. 2 or 3 arguments must be specified.');\n }\n\n protected main(condition: boolean, v1: any, v2: any = false) {\n return condition ? 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,aAAa,aAAa,+BAA+B;AAAA,MACjE;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;AAC5D,WAAK,SAAS,CAAC,IAAI,cAAc,KAAK,SAAS,CAAC,CAAC;AACjD;AAAA,IAAA;AAEI,UAAA,IAAI,aAAa,QAAQ,8EAA8E;AAAA,EAAA;AAAA,EAGrG,KAAK,WAAoB,IAAS,KAAU,OAAO;AAC3D,WAAO,YAAY,KAAK;AAAA,EAAA;AAE5B;"}
|