Skip to content

Commit 1cca991

Browse files
authored
Merge pull request #662 from Corbe30/revert-655-feature/hyperformula
Revert "Feature: Hyperformula"
2 parents 0560f4e + 81a7762 commit 1cca991

File tree

103 files changed

+26583
-508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+26583
-508
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@ jobs:
2121
- run: yarn build
2222
- run: cd packages/core && npm pack
2323
- run: cd packages/react && npm pack
24+
- run: cd packages/formula-parser && npm pack
2425
- uses: actions/upload-artifact@v4
2526
with:
2627
name: packages
2728
path: |
2829
packages/core/fortune-sheet-core-*.tgz
2930
packages/react/fortune-sheet-react-*.tgz
31+
packages/formula-parser/fortune-sheet-formula-parser-*.tgz
3032
- run: cd packages/core && npm publish
3133
env:
3234
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3335
- run: cd packages/react && npm publish
3436
env:
3537
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
- run: cd packages/formula-parser && npm publish || true
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Before stable release of 1.0, input data structure and APIs may change during de
5050
```
5151
- Multiple instance on the same page is supported.
5252
- Dropped `jQuery` dependency, uses native `React` / `Vue` + `immer` to manage the dom and state.
53-
- Formulas are now being parsed by [handsontable/hyperformula](https://github.com/handsontable/hyperformula)
53+
- Changed to a forked [handsontable/formula-parser](https://github.com/handsontable/formula-parser) to handle formula calculations.
5454
- Optimized the dom structure.
5555
- Replaced icons from `iconfont` with SVGs, as `iconfont` icons are inconvenient to update for other maintainers.
5656
- No visible elements is created outside container.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"build-storybook": "storybook build",
1515
"tsc": "tsc --noEmit",
1616
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx,.json ./packages",
17+
"postinstall": "lerna run build --scope=@fortune-sheet/formula-parser",
1718
"publish": "npm publish packages/core --registry 'https://registry.npmjs.org' && npm publish packages/react --registry 'https://registry.npmjs.org'",
1819
"test": "jest",
1920
"coverage": "jest --coverage"

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"repository": "https://github.com/ruilisi/fortune-sheet",
1111
"license": "MIT",
1212
"dependencies": {
13-
"hyperformula": "^2.7.1",
13+
"@fortune-sheet/formula-parser": "^0.2.13",
1414
"dayjs": "^1.11.0",
1515
"immer": "^9.0.12",
1616
"lodash": "^4.17.21",

packages/core/src/events/paste.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,8 @@ function postPasteCut(
3131
const execF_rc: any = {};
3232
ctx.formulaCache.execFunctionExist = [];
3333
// clearTimeout(refreshCanvasTimeOut);
34-
35-
let prevSheetId = null;
36-
let data = null;
3734
for (let r = source.range.row[0]; r <= source.range.row[1]; r += 1) {
3835
for (let c = source.range.column[0]; c <= source.range.column[1]; c += 1) {
39-
if (source.sheetId !== prevSheetId) {
40-
prevSheetId = source.sheetId;
41-
data = getFlowdata(ctx, prevSheetId);
42-
}
43-
ctx.formulaCache.updateVirtualCellRaw(
44-
ctx,
45-
{ r, c, id: source.sheetId },
46-
data?.[r][c]?.v
47-
);
4836
setFormulaCellInfo(ctx, { r, c, id: source.sheetId });
4937
if (`${r}_${c}_${source.sheetId}` in execF_rc) {
5038
continue;
@@ -57,15 +45,6 @@ function postPasteCut(
5745

5846
for (let r = target.range.row[0]; r <= target.range.row[1]; r += 1) {
5947
for (let c = target.range.column[0]; c <= target.range.column[1]; c += 1) {
60-
if (source.sheetId !== prevSheetId) {
61-
prevSheetId = source.sheetId;
62-
data = getFlowdata(ctx, prevSheetId);
63-
}
64-
ctx.formulaCache.updateVirtualCellRaw(
65-
ctx,
66-
{ r, c, id: source.sheetId },
67-
data?.[r][c]?.v
68-
);
6948
setFormulaCellInfo(ctx, { r, c, id: source.sheetId });
7049
if (`${r}_${c}_${target.sheetId}` in execF_rc) {
7150
continue;

packages/core/src/modules/cell.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -902,11 +902,6 @@ export function updateCell(
902902
});
903903
}
904904
} else {
905-
ctx.formulaCache.updateVirtualCellRaw(
906-
ctx,
907-
{ r, c, id: ctx.currentSheetId },
908-
value
909-
);
910905
delFunctionGroup(ctx, r, c);
911906
execFunctionGroup(ctx, r, c, value);
912907
isRunExecFunction = false;
@@ -993,11 +988,6 @@ export function updateCell(
993988
}
994989
}
995990
} else {
996-
ctx.formulaCache.updateVirtualCellRaw(
997-
ctx,
998-
{ r, c, id: ctx.currentSheetId },
999-
value
1000-
);
1001991
delFunctionGroup(ctx, r, c);
1002992
execFunctionGroup(ctx, r, c, value);
1003993
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1096,12 +1086,6 @@ export function updateCell(
10961086
});
10971087
}
10981088

1099-
ctx.formulaCache.updateVirtualCellRaw(
1100-
ctx,
1101-
{ r, c, id: ctx.currentSheetId },
1102-
flowdata?.[r][c]?.v
1103-
);
1104-
11051089
setFormulaCellInfo(ctx, { r, c, id: ctx.currentSheetId });
11061090
ctx.formulaCache.execFunctionGlobalData = null;
11071091
}

0 commit comments

Comments
 (0)