-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More formulas and easier formula editing #363
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #363 +/- ##
=============================
=============================
Continue to review full report at Codecov.
|
f164400
to
8206342
Compare
Merge conflict introduced by recent update to master has been resolved |
@myliang and team: ready for your consideration |
I see that my PR currently fails the code coverage check. I'm wondering whether this was mostly caused by removing the formula tests (since, in this PR, formula parsing/calculation is now handled by library code rather than x-spreadsheet). I'll see if I can increase the number of tests in general, but I only feel comfortable writing tests for code I touched (and I'm not sure that will bring the test percentage up enough to pass the check). |
8206342
to
c3e0dd2
Compare
c25618d
to
b70c5f9
Compare
@myliang : I have improved the test coverage since my last comment. alphabet.js now has all functions covered, and I added tests for locale.js (which previously didn't have them). Please review at your earliest convenience. |
@myliang : is there anything I can do to facilitate a review by you or another project maintainer? I don't want to continue with additional changes until this PR has been reviewed, approved, and merged. |
too big changes will not be accepted. |
@myliang : I am happy to split this into several smaller PRs:
Would that be acceptable? |
@myliang : I've separated out some of the functionality into smaller PRs:
Once those are reviewed, approved, and merged, I'll create small PRs for the other functionality included in this large PR. |
@myliang : thanks for the review on 380 and 381. Another smaller PR is now ready for your review:
Once that is reviewed, approved, and merged, I'll move on to creating a PR for formula.js integration. |
On this branch: https://github.com/jkirschner/x-spreadsheet/tree/formulajs-range-selection @myliang and @jkirschner this is a great feature update! This makes it more like how Excel works. Thanks. |
Thanks @mm738. Trying to work with the maintainers to get this integrated upstream in parts (since this PR was too large). So far we are 2/5 of the way there! |
jkirschner this is a great improvement wrt formula calculations within the worksheet. With the old implementation, simple calculations resulted in erroneous values. However, your formulajs branch in its current state breaks document printing. The references to "this" formulaParser within the renderCell function call are invalid in src/component/table.js |
I report a possible bug for @jkirschner here (hope this is the place) If I use the formula selector, any formula will write "=undefined()" in the cell instead of the correct formula. Note that it's still possible to select formulas from the cell completion suggestions. |
This is a very powerful feature and I'm sad to see is not progressing - what can be done to help? |
I believe the project owner is not interested in incorporating this functionality unfortunately.
In my opinion, it is a huge improvement. It does break some things like printing that needs to be addressed.
Best regards,
Harlan
…________________________________
From: Pawel Badenski <[email protected]>
Sent: Monday, February 15, 2021 1:03 PM
To: myliang/x-spreadsheet <[email protected]>
Cc: harlan3 <[email protected]>; Comment <[email protected]>
Subject: Re: [myliang/x-spreadsheet] More formulas and easier formula editing (#363)
This is a very powerful feature and I'm sad to see is not progressing - what can be done to help?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#363 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AF3GHP7ZPFPTIFPQOWZXIW3S7FOXTANCNFSM4RF43UUA>.
|
@pbadenski, @harlan3 : I started breaking this large PR up into smaller PRs upon request by the project owner. One of these smaller PRs is still awaiting review/approval/merge: #382. Perhaps the next step is getting that PR through. Unfortunately, I have a lot less time now than I did when I originally created this PR. I can't push it forward right now (e.g., fix the printing bug), but I do want to come back to it eventually. |
@pbadenski, @harlan3, @ThibautSF, @myliang : I have some time over the next week to push this PR forward and hopefully get it through the review process. My understanding from the maintainer is that it needs to be broken up into smaller PRs which can then be individually reviewed and merged. I'm partway through that process: the latest PRs to review are #382, #464, #465, and #466. |
b70c5f9
to
8a2f8ff
Compare
I have been using the @jkirschner branch for several months now (along with some additional improvements for loading and saving files) and I would say it is vastly superior in comparison to the x-spreadsheet that doesn't have smart formula parsing. I have used it with spreadsheets spanning several hundred cells and it does slow down some but for a "normal" sized spreadsheet it is fine. If you have something better then you should submit it back to git master and the code should fall under the MIT license as the original project uses the MIT. It isn't right that you leverage all the code to x-spreadsheet and then not contribute your work back to the project. That is completely unethical. I am perfectly happy using the @jkirschner branch. It is just unfortunate that it has not been promoted into the git master yet. |
And just at a UX level, this PR is way better. Formula edition alongside absolute cell reference gives a better end-user experience, near enough of what you can expect on a desktop sheet and simple enough for a integrated web use (didn't find anything better for now in other open source sheet libraries). X-spreadsheet is really good, this PR made it just better. It sure has drawbacks in case of big sheets, but those can be solved with code review, suggestions and improvements. |
I can’t. The solution uses a paid package which is not MIT to do the
calculations. Hot formula parser is not maintained anymore
Also, it’s a complete rewrite so it’s never going to be approved by the
maintainer
…On Fri, 28 May 2021 at 22:55, harlan3 ***@***.***> wrote:
@jkirschner <https://github.com/jkirschner> Thanks for the effort but
I've tested this PR a lot and there fundamental issues with it that cannot
be solved easily. Just saying cause don't want you to waste your time.
1. x-datasheet doesn't handle smart formula parsing. I.e it loops
through all cells in a linear order, it does not build any graphs. This
means when changing cell dependents it wont update cells in the correct
order. I'm not sure if hot-formula parser does build the graph correctly
but when I tested this PR it was very laggy.
2. The parsing of the formulas in this PR is done on every render of
the cell. This isn't efficient. It should be done once and cached and not
on every render.
Due to the above issues the spreadsheets lags with any reasonable amount
of formulas or circle references.
I have been using the @jkirschner <https://github.com/jkirschner> branch
for several months now (along with some additional improvements for loading
and saving files) and I would say it is vastly superior in comparison to
the x-spreadsheet that doesn't have smart formula parsing. I have used it
with spreadsheets spanning several hundred cells and it does slow down some
but for a "normal" sized spreadsheet it is fine. If you have something
better then you should submit it back to git master and the code should
fall under the MIT license as the original project uses the MIT. It isn't
right that you leverage all the code to x-spreadsheet and then not
contribute your work back to the project. That is completely unethical. I
am perfectly happy using the @jkirschner <https://github.com/jkirschner>
branch. It is just unfortunate that it has not been promoted into the git
master yet.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#363 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADSVRWZCXP6IJTFVXYX3GFTTQAGNPANCNFSM4RF43UUA>
.
|
Replace existing formula parsing and execution with an external parser library built on top of formula.js: https://github.com/handsontable/formula-parser This dramatically increases the number of supported formulas; see list here: https://formulajs.info/functions/
With the inclusion of many formulas from formula.js, the number of formula options is now too great to display without a scrollable container.
Formula keys within locale files should match the name of the formulajs function that a translation string is being provided for. If a formula name has a '.' in it, it should be escaped as follows: { "FORMULA\\.NAME": "TRANSLATION" }
Absolute cell references are evaluated correctly. When dragging the bottom-right corner of a formula cell to copy its contents to other cells, absolute cell references will be incremented or decremented appropriately (only relative axes will be modified, not absolute). When adding or removing rows or columns, absolute cell references will be adjusted appropriately.
The initial click sets the cell reference range start position. If the click is held, the cell reference range end position is updated on mouse move. The cell reference range can then be modified in the same ways as a single cell reference (e.g., arrow keys).
If the user is editing a cell reference range within a formula and is holding the shift key while using the direction arrows to move the range, the start of the range will be fixed. This mirrors the behavior of Excel when editing a cell reference range.
8a2f8ff
to
597b095
Compare
@MartinDawson : Can you help me understand how either of those concerns is related to this PR? If I understand correctly, (1) looping through all cells in a linear order and (2) parsing formulas on every render of the cell were both behaviors of x-spreadsheet before this PR. This PR changes the parsing engine for formulas, but not when parsing is performed. Yes, improvements to efficiency can be made, but those should be done in a separate PR. |
@harlan3, @ThibautSF: because of @MartinDawson 's comments, I put together a proof-of-concept that builds on this PR to (1) perform efficient recalculations and (2) detect circular references: https://github.com/jkirschner/x-spreadsheet/tree/efficient-recalculation Let me know if you try that branch out and see a significant enough performance improvement that it's worth me finishing the branch. I still need to make some small fixes (such as to print mode) and significantly cleanup the commit history via rebasing, so I wouldn't use the |
I tried it with some minimal testing, and it seemed to work ok. To really test it I would need to merge in my spreadsheet file loading and saving capability which would allow the loading of large x-spreadsheet files. If you are interested in putting the file loading and saving functionality in your main baseline let me know and I will create a branch for a PR. |
@harlan3 : I probably won't merge any PRs, including my own, into my fork's main branch because I'm trying to keep that consistent with upstream - which relies on getting things merged upstream. If you submit a PR against the main branch, I'll probably take those commits and place them on top of It's worth doing that so we can test the performance improvements and see if it's worth pursuing further. Thanks! |
I created a fork of your x-spreadsheet repo and merged in the changes for file loading and saving in my efficient-recalculation branch. You can clone it from here: https://github.com/harlan3/x-spreadsheet/tree/efficient-recalculation |
@jkirschner @harlan3 : is there any way to get parsed value programmatic ? like |
I made this function (based on x-spreadsheet code and using the xspreadsheet function getCellValue(xspreadsheet, rowIndex, colIndex, sheetIndex) {
if (xspreadsheet) {
if ((cell = xspreadsheet.cell(rowIndex, colIndex, sheetIndex))) {
var cellText = cell.text;
if (cellText && cellText[0] == "=") {
cellText = xspreadsheet.sheet.table.formulaParser.parse(
cellText.slice(1)
);
cellText = cellText.result;
}
return Number(cellText) || cellText;
}
}
} Note: |
This should've been merged a long time ago, such splendid work! |
I agree totally! It is unfortunate that there are so many hoops to jump through.
…-Harlan
________________________________
From: Ali Zafar ***@***.***>
Sent: Tuesday, October 5, 2021 11:22 AM
To: myliang/x-spreadsheet ***@***.***>
Cc: harlan3 ***@***.***>; Mention ***@***.***>
Subject: Re: [myliang/x-spreadsheet] More formulas and easier formula editing (#363)
This should've been merged a long time ago, such splendid work!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#363 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AF3GHP2PJNLUFUKJ2T3ETILUFMJZ5ANCNFSM4RF43UUA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
This works fine... can you rebase and resolve the conflicts? We can supersed if not :) |
Hi @Tardo, The maintainer previously said they would not accept this PR as is because it was too large. That's very understandable, so I started the process of breaking it into many smaller PRs. The first few sub-PRs were merged. But the next few sub-PRs have not been reviewed. And there's a lot of work in this branch that hasn't made it into a sub-PR yet, because I was waiting for the existing sub-PRs to be merged. A lot of time has since passed. I cannot justify spending more time on this unless the maintainer expresses interest in this PR. And if that happens, I'm not sure I even have the bandwidth to pick this back up right now. I really appreciate the feedback and collaboration I've had with the community members in this thread. I wish you the best of luck with your spreadsheets :) |
That is a real shame that this functionality has not been allowed to be merged back into the master baseline. It makes x-spreadsheet MUCH more useable as a real-world spreadsheet capable of evaluating equations like Excel. I don't really buy the excuse that the PR is too large...who cares! It just takes a little longer to review the code. One large PR in my opinion is actually much easier to deal with than having to mess around with a bunch of smaller PRs and their dependencies on each other. As long the effort in the PR is all coherent with respect to an implemented feature it should have been accepted, in my opinion.
…-Harlan
________________________________
From: Jared Kirschner ***@***.***>
Sent: Sunday, May 22, 2022 6:53 PM
To: myliang/x-spreadsheet ***@***.***>
Cc: harlan3 ***@***.***>; Mention ***@***.***>
Subject: Re: [myliang/x-spreadsheet] More formulas and easier formula editing (#363)
Hi @Tardo<https://github.com/Tardo>,
The maintainer previously said<#363 (comment)> they would not accept this PR as is because it was too large. That's very understandable, so I started the process of breaking it into many smaller PRs. The first few sub-PRs were merged. But the next few sub-PRs have not been reviewed. And there's a lot of work in this branch that hasn't made it into a sub-PR yet, because I was waiting for the existing sub-PRs to be merged.
A lot of time has since passed.
I cannot justify spending more time on this unless the maintainer expresses interest in this PR. And if that happens, I'm not sure I even have the bandwidth to pick this back up right now.
I really appreciate the feedback and collaboration I've had with the community members in this thread. I wish you the best of luck with your spreadsheets :)
—
Reply to this email directly, view it on GitHub<#363 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AF3GHP4DQM4CECQQASTPOKLVLK3GJANCNFSM4RF43UUA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@jkirschner Thank you for your response and the work made here. Too bad the creator doesn't want to review/merge the PR... what matters are the commits :/ It's good to know how eager the maintainer is to include improvements in his repo... |
Guys, just use this canvas spreadsheet: https://github.com/glideapps/glide-data-grid It's far better and not got 10,000 bugs in it. And just use hyperformula as your cell engine parser |
@smazydev how can I use xspreadsheet.js file from this pull request? Please help. |
Important Changes
Known Limitations
I recommend accepting this PR while acknowledging there is room for improvement. These improvements are all limitations of formula.js rather than of its integration into x-spreadsheet:
Merge Notes
This PR includes commits from a different fork for which a PR was also submitted: #309
If this PR is accepted and merged, PR 309 should be closed without merging.
Known Resolved Issues
#362 - more formulas
#320 - more formulas
#280 - only difference being that it's just click, not shift click
Note: I can only understand the issues written in my native language (English), so there may be others I am missing.