handsontable / handsontable/hyperformula
[Bug]: Consistent Range Handling and Formula Text Access in Custom Function Arguments
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Description
I'm implementing a custom function(eg. AGGREGATE) in a HyperFormula plugin that needs both the data and the formula text of each argument range to determine if certain functions should be ignored. However, I’m encountering two issues:
-
Range Undefined for Single Cells: When a single cell is passed as an argument, the
rangeproperty isundefined. For multi-cell ranges,rangeprovides the expected values. For consistency, it would be helpful ifrangewas defined for single cells as well. -
Request for Formula Text: In addition to the data, I need access to the formula text used in each range. Currently, I have no straightforward way to access the formula text directly in the custom function. This would allow me to handle certain behaviors based on the specific formula used.
Here is the code I’m using:
export class MyCustomPlugin extends FunctionPlugin {
aggregate(ast, state) {
return this.runFunction(
ast.args,
state,
this.metadata('AGGREGATE'),
(args) => {
console.log(args);
}
);
}
}
Expected Behavior
- The
rangeproperty should not beundefinedfor single-cell arguments. - Ideally, HyperFormula could provide formula text alongside the data for each argument range, allowing custom functions to process ranges based on the formula used.
Video or screenshots
Demo
https://codesandbox.io/p/devbox/exciting-cloud-cd9j7s
HyperFormula version
2.7.1
Your framework
Vue 3
Your environment
Chrome 90 Macos 15.0.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with MyCustomPlugin.aggregate and the FunctionPlugin.runFunction call shown in the issue, using the AGGREGATE metadata path as the entry point. Trace how single-cell and multi-cell arguments are represented and whether formula text is exposed. Done means the requested argument information is consistently available to custom functions and the behavior is covered by the relevant project checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100