@fileverse-dev/fortune-react 1.1.10 → 1.1.11-patch-2
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/es/components/Sheet/index.js +93 -87
- package/es/components/SheetTab/index.js +0 -3
- package/es/components/Workbook/api.d.ts +4 -1
- package/es/components/Workbook/api.js +28 -0
- package/es/components/Workbook/index.d.ts +3 -0
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/lib/components/Sheet/index.js +92 -86
- package/lib/components/SheetTab/index.js +0 -3
- package/lib/components/Workbook/api.d.ts +4 -1
- package/lib/components/Workbook/api.js +28 -0
- package/lib/components/Workbook/index.d.ts +3 -0
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +7 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext, useCallback } from "react";
|
|
2
|
-
import { Canvas, updateContextWithCanvas, updateContextWithSheetData, handleGlobalWheel, initFreeze } from "@fileverse-dev/fortune-core";
|
|
2
|
+
import { Canvas, updateContextWithCanvas, updateContextWithSheetData, handleGlobalWheel, initFreeze, cellFadeAnimator } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
import WorkbookContext from "../../context";
|
|
5
5
|
import SheetOverlay from "../SheetOverlay";
|
|
@@ -45,103 +45,109 @@ var Sheet = function Sheet(_a) {
|
|
|
45
45
|
initFreeze(context, refs.globalCache, context.currentSheetId);
|
|
46
46
|
}, [refs.globalCache, sheet.frozen, context.currentSheetId, context.visibledatacolumn, context.visibledatarow]);
|
|
47
47
|
useEffect(function () {
|
|
48
|
-
var _a, _b, _c, _d, _e;
|
|
49
48
|
if (context.groupValuesRefreshData.length > 0) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
51
|
var tableCanvas = new Canvas(refs.canvas.current, context);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
52
|
+
var repaint = function repaint() {
|
|
53
|
+
var _a, _b, _c, _d, _e;
|
|
54
|
+
var freeze = (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[sheet.id];
|
|
55
|
+
if (((_b = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _b === void 0 ? void 0 : _b.freezenhorizontaldata) || ((_c = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _c === void 0 ? void 0 : _c.freezenverticaldata)) {
|
|
56
|
+
var horizontalData = (_d = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _d === void 0 ? void 0 : _d.freezenhorizontaldata;
|
|
57
|
+
var verticallData = (_e = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _e === void 0 ? void 0 : _e.freezenverticaldata;
|
|
58
|
+
if (horizontalData && verticallData) {
|
|
59
|
+
var horizontalPx = horizontalData[0],
|
|
60
|
+
horizontalScrollTop = horizontalData[2];
|
|
61
|
+
var verticalPx = verticallData[0],
|
|
62
|
+
verticalScrollWidth = verticallData[2];
|
|
63
|
+
tableCanvas.drawMain({
|
|
64
|
+
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
65
|
+
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
66
|
+
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth,
|
|
67
|
+
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
68
|
+
clear: true
|
|
69
|
+
});
|
|
70
|
+
tableCanvas.drawMain({
|
|
71
|
+
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
72
|
+
scrollHeight: horizontalScrollTop,
|
|
73
|
+
drawHeight: horizontalPx,
|
|
74
|
+
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
75
|
+
});
|
|
76
|
+
tableCanvas.drawMain({
|
|
77
|
+
scrollWidth: verticalScrollWidth,
|
|
78
|
+
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
79
|
+
drawWidth: verticalPx,
|
|
80
|
+
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight
|
|
81
|
+
});
|
|
82
|
+
tableCanvas.drawMain({
|
|
83
|
+
scrollWidth: verticalScrollWidth,
|
|
84
|
+
scrollHeight: horizontalScrollTop,
|
|
85
|
+
drawWidth: verticalPx,
|
|
86
|
+
drawHeight: horizontalPx
|
|
87
|
+
});
|
|
88
|
+
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
89
|
+
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
90
|
+
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
91
|
+
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
92
|
+
tableCanvas.drawFreezeLine({
|
|
93
|
+
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2,
|
|
94
|
+
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
95
|
+
});
|
|
96
|
+
} else if (horizontalData) {
|
|
97
|
+
var horizontalPx = horizontalData[0],
|
|
98
|
+
horizontalScrollTop = horizontalData[2];
|
|
99
|
+
tableCanvas.drawMain({
|
|
100
|
+
scrollWidth: context.scrollLeft,
|
|
101
|
+
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
102
|
+
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
103
|
+
clear: true
|
|
104
|
+
});
|
|
105
|
+
tableCanvas.drawMain({
|
|
106
|
+
scrollWidth: context.scrollLeft,
|
|
107
|
+
scrollHeight: horizontalScrollTop,
|
|
108
|
+
drawHeight: horizontalPx
|
|
109
|
+
});
|
|
110
|
+
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
111
|
+
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
112
|
+
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
113
|
+
tableCanvas.drawFreezeLine({
|
|
114
|
+
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2
|
|
115
|
+
});
|
|
116
|
+
} else if (verticallData) {
|
|
117
|
+
var verticalPx = verticallData[0],
|
|
118
|
+
verticalScrollWidth = verticallData[2];
|
|
119
|
+
tableCanvas.drawMain({
|
|
120
|
+
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
121
|
+
scrollHeight: context.scrollTop,
|
|
122
|
+
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
123
|
+
});
|
|
124
|
+
tableCanvas.drawMain({
|
|
125
|
+
scrollWidth: verticalScrollWidth,
|
|
126
|
+
scrollHeight: context.scrollTop,
|
|
127
|
+
drawWidth: verticalPx
|
|
128
|
+
});
|
|
129
|
+
tableCanvas.drawRowHeader(context.scrollTop);
|
|
130
|
+
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
131
|
+
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
132
|
+
tableCanvas.drawFreezeLine({
|
|
133
|
+
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
99
137
|
tableCanvas.drawMain({
|
|
100
138
|
scrollWidth: context.scrollLeft,
|
|
101
|
-
scrollHeight: context.scrollTop
|
|
102
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
139
|
+
scrollHeight: context.scrollTop,
|
|
103
140
|
clear: true
|
|
104
141
|
});
|
|
105
|
-
tableCanvas.drawMain({
|
|
106
|
-
scrollWidth: context.scrollLeft,
|
|
107
|
-
scrollHeight: horizontalScrollTop,
|
|
108
|
-
drawHeight: horizontalPx
|
|
109
|
-
});
|
|
110
142
|
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
111
|
-
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
112
|
-
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
113
|
-
tableCanvas.drawFreezeLine({
|
|
114
|
-
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2
|
|
115
|
-
});
|
|
116
|
-
} else if (verticallData) {
|
|
117
|
-
var verticalPx = verticallData[0],
|
|
118
|
-
verticalScrollWidth = verticallData[2];
|
|
119
|
-
tableCanvas.drawMain({
|
|
120
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
121
|
-
scrollHeight: context.scrollTop,
|
|
122
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
123
|
-
});
|
|
124
|
-
tableCanvas.drawMain({
|
|
125
|
-
scrollWidth: verticalScrollWidth,
|
|
126
|
-
scrollHeight: context.scrollTop,
|
|
127
|
-
drawWidth: verticalPx
|
|
128
|
-
});
|
|
129
143
|
tableCanvas.drawRowHeader(context.scrollTop);
|
|
130
|
-
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
131
|
-
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
132
|
-
tableCanvas.drawFreezeLine({
|
|
133
|
-
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
134
|
-
});
|
|
135
144
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
143
|
-
tableCanvas.drawRowHeader(context.scrollTop);
|
|
144
|
-
}
|
|
145
|
+
};
|
|
146
|
+
repaint();
|
|
147
|
+
cellFadeAnimator.setOnTick(repaint);
|
|
148
|
+
return function () {
|
|
149
|
+
return cellFadeAnimator.setOnTick(null);
|
|
150
|
+
};
|
|
145
151
|
}, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
|
|
146
152
|
var onWheel = useCallback(function (e) {
|
|
147
153
|
var _a, _b;
|
|
@@ -86,9 +86,6 @@ var SheetTab = function SheetTab() {
|
|
|
86
86
|
setCalInfo(re);
|
|
87
87
|
}
|
|
88
88
|
}, [context.luckysheet_select_save]);
|
|
89
|
-
useEffect(function () {
|
|
90
|
-
console.log(calInfo, "calInfo");
|
|
91
|
-
}, [calInfo]);
|
|
92
89
|
useEffect(function () {
|
|
93
90
|
var tabCurrent = tabContainerRef.current;
|
|
94
91
|
if (!tabCurrent) return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache } from "@fileverse-dev/fortune-core";
|
|
1
|
+
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache, LiveQueryData } from "@fileverse-dev/fortune-core";
|
|
2
2
|
import { getCryptoPrice } from "../../utils/cryptoApi";
|
|
3
3
|
import { SetContextOptions } from "../../context";
|
|
4
4
|
export declare function generateAPIs(context: Context, setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void, handleUndo: () => void, handleRedo: () => void, settings: Required<Settings>, cellInput: HTMLDivElement | null, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null, globalCache: GlobalCache | null): {
|
|
@@ -9,6 +9,8 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
9
9
|
}) => any;
|
|
10
10
|
onboardingActiveCell: (functionName: string) => void;
|
|
11
11
|
initializeComment: (row: number, column: number) => void;
|
|
12
|
+
updateSheetLiveQueryList: (subsheetIndex: number, _data: LiveQueryData) => void;
|
|
13
|
+
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
12
14
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
13
15
|
type?: keyof Cell;
|
|
14
16
|
}) => void;
|
|
@@ -109,6 +111,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
109
111
|
column_focus: number;
|
|
110
112
|
} | undefined;
|
|
111
113
|
} | undefined;
|
|
114
|
+
liveQueryList?: Record<string, LiveQueryData> | undefined;
|
|
112
115
|
};
|
|
113
116
|
addSheet: () => void;
|
|
114
117
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
1
11
|
import { addSheet, api, deleteRowCol, deleteSheet, insertRowCol, opToPatch, createFilterOptions, getSheetIndex, locale, setCaretPosition, newComment } from "@fileverse-dev/fortune-core";
|
|
2
12
|
import { applyPatches } from "immer";
|
|
3
13
|
import _ from "lodash";
|
|
@@ -103,6 +113,24 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
|
|
|
103
113
|
newComment(ctx, undefined, row, column);
|
|
104
114
|
});
|
|
105
115
|
},
|
|
116
|
+
updateSheetLiveQueryList: function updateSheetLiveQueryList(subsheetIndex, _data) {
|
|
117
|
+
setContext(function (ctx) {
|
|
118
|
+
var _a;
|
|
119
|
+
var previousLiveQuery = ctx.luckysheetfile[subsheetIndex].liveQueryList;
|
|
120
|
+
ctx.luckysheetfile[subsheetIndex] = __assign(__assign({}, ctx.luckysheetfile[subsheetIndex]), {
|
|
121
|
+
liveQueryList: __assign(__assign({}, previousLiveQuery), (_a = {}, _a["".concat(_data.data.id)] = _data, _a))
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
removeFromLiveQueryList: function removeFromLiveQueryList(subSheetIndex, id) {
|
|
126
|
+
setContext(function (ctx) {
|
|
127
|
+
var previousLiveQuery = __assign({}, ctx.luckysheetfile[subSheetIndex].liveQueryList);
|
|
128
|
+
previousLiveQuery === null || previousLiveQuery === void 0 ? true : delete previousLiveQuery[id];
|
|
129
|
+
ctx.luckysheetfile[subSheetIndex] = __assign(__assign({}, ctx.luckysheetfile[subSheetIndex]), {
|
|
130
|
+
liveQueryList: previousLiveQuery
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
},
|
|
106
134
|
setCellValue: function setCellValue(row, column, value, options) {
|
|
107
135
|
if (options === void 0) {
|
|
108
136
|
options = {};
|
|
@@ -16,6 +16,8 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
16
16
|
}) => any;
|
|
17
17
|
onboardingActiveCell: (functionName: string) => void;
|
|
18
18
|
initializeComment: (row: number, column: number) => void;
|
|
19
|
+
updateSheetLiveQueryList: (subsheetIndex: number, _data: import("@fileverse-dev/fortune-core").LiveQueryData) => void;
|
|
20
|
+
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
19
21
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
20
22
|
type?: "rt" | "m" | "v" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
21
23
|
}) => void;
|
|
@@ -116,6 +118,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
116
118
|
column_focus: number;
|
|
117
119
|
} | undefined;
|
|
118
120
|
} | undefined;
|
|
121
|
+
liveQueryList?: Record<string, import("@fileverse-dev/fortune-core").LiveQueryData> | undefined;
|
|
119
122
|
};
|
|
120
123
|
addSheet: () => void;
|
|
121
124
|
deleteSheet: (options?: api.CommonOptions) => void;
|
package/es/components/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import Workbook from "./Workbook";
|
|
|
2
2
|
export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from "@fileverse-dev/formulajs/crypto-constants";
|
|
3
3
|
export { Workbook };
|
|
4
4
|
export type { WorkbookInstance } from "./Workbook";
|
|
5
|
-
export type { Cell, Sheet } from "@fileverse-dev/fortune-core";
|
|
5
|
+
export type { Cell, Sheet, LiveQueryData } from "@fileverse-dev/fortune-core";
|
|
6
|
+
export { markCellChanged as animateChangedCell } from "@fileverse-dev/fortune-core";
|
package/es/components/index.js
CHANGED
|
@@ -54,103 +54,109 @@ var Sheet = function Sheet(_a) {
|
|
|
54
54
|
(0, _fortuneCore.initFreeze)(context, refs.globalCache, context.currentSheetId);
|
|
55
55
|
}, [refs.globalCache, sheet.frozen, context.currentSheetId, context.visibledatacolumn, context.visibledatarow]);
|
|
56
56
|
(0, _react.useEffect)(function () {
|
|
57
|
-
var _a, _b, _c, _d, _e;
|
|
58
57
|
if (context.groupValuesRefreshData.length > 0) {
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
60
|
var tableCanvas = new _fortuneCore.Canvas(refs.canvas.current, context);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
61
|
+
var repaint = function repaint() {
|
|
62
|
+
var _a, _b, _c, _d, _e;
|
|
63
|
+
var freeze = (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[sheet.id];
|
|
64
|
+
if (((_b = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _b === void 0 ? void 0 : _b.freezenhorizontaldata) || ((_c = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _c === void 0 ? void 0 : _c.freezenverticaldata)) {
|
|
65
|
+
var horizontalData = (_d = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _d === void 0 ? void 0 : _d.freezenhorizontaldata;
|
|
66
|
+
var verticallData = (_e = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _e === void 0 ? void 0 : _e.freezenverticaldata;
|
|
67
|
+
if (horizontalData && verticallData) {
|
|
68
|
+
var horizontalPx = horizontalData[0],
|
|
69
|
+
horizontalScrollTop = horizontalData[2];
|
|
70
|
+
var verticalPx = verticallData[0],
|
|
71
|
+
verticalScrollWidth = verticallData[2];
|
|
72
|
+
tableCanvas.drawMain({
|
|
73
|
+
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
74
|
+
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
75
|
+
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth,
|
|
76
|
+
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
77
|
+
clear: true
|
|
78
|
+
});
|
|
79
|
+
tableCanvas.drawMain({
|
|
80
|
+
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
81
|
+
scrollHeight: horizontalScrollTop,
|
|
82
|
+
drawHeight: horizontalPx,
|
|
83
|
+
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
84
|
+
});
|
|
85
|
+
tableCanvas.drawMain({
|
|
86
|
+
scrollWidth: verticalScrollWidth,
|
|
87
|
+
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
88
|
+
drawWidth: verticalPx,
|
|
89
|
+
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight
|
|
90
|
+
});
|
|
91
|
+
tableCanvas.drawMain({
|
|
92
|
+
scrollWidth: verticalScrollWidth,
|
|
93
|
+
scrollHeight: horizontalScrollTop,
|
|
94
|
+
drawWidth: verticalPx,
|
|
95
|
+
drawHeight: horizontalPx
|
|
96
|
+
});
|
|
97
|
+
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
98
|
+
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
99
|
+
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
100
|
+
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
101
|
+
tableCanvas.drawFreezeLine({
|
|
102
|
+
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2,
|
|
103
|
+
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
104
|
+
});
|
|
105
|
+
} else if (horizontalData) {
|
|
106
|
+
var horizontalPx = horizontalData[0],
|
|
107
|
+
horizontalScrollTop = horizontalData[2];
|
|
108
|
+
tableCanvas.drawMain({
|
|
109
|
+
scrollWidth: context.scrollLeft,
|
|
110
|
+
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
111
|
+
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
112
|
+
clear: true
|
|
113
|
+
});
|
|
114
|
+
tableCanvas.drawMain({
|
|
115
|
+
scrollWidth: context.scrollLeft,
|
|
116
|
+
scrollHeight: horizontalScrollTop,
|
|
117
|
+
drawHeight: horizontalPx
|
|
118
|
+
});
|
|
119
|
+
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
120
|
+
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
121
|
+
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
122
|
+
tableCanvas.drawFreezeLine({
|
|
123
|
+
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2
|
|
124
|
+
});
|
|
125
|
+
} else if (verticallData) {
|
|
126
|
+
var verticalPx = verticallData[0],
|
|
127
|
+
verticalScrollWidth = verticallData[2];
|
|
128
|
+
tableCanvas.drawMain({
|
|
129
|
+
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
130
|
+
scrollHeight: context.scrollTop,
|
|
131
|
+
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
132
|
+
});
|
|
133
|
+
tableCanvas.drawMain({
|
|
134
|
+
scrollWidth: verticalScrollWidth,
|
|
135
|
+
scrollHeight: context.scrollTop,
|
|
136
|
+
drawWidth: verticalPx
|
|
137
|
+
});
|
|
138
|
+
tableCanvas.drawRowHeader(context.scrollTop);
|
|
139
|
+
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
140
|
+
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
141
|
+
tableCanvas.drawFreezeLine({
|
|
142
|
+
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
108
146
|
tableCanvas.drawMain({
|
|
109
147
|
scrollWidth: context.scrollLeft,
|
|
110
|
-
scrollHeight: context.scrollTop
|
|
111
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
148
|
+
scrollHeight: context.scrollTop,
|
|
112
149
|
clear: true
|
|
113
150
|
});
|
|
114
|
-
tableCanvas.drawMain({
|
|
115
|
-
scrollWidth: context.scrollLeft,
|
|
116
|
-
scrollHeight: horizontalScrollTop,
|
|
117
|
-
drawHeight: horizontalPx
|
|
118
|
-
});
|
|
119
151
|
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
120
|
-
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
121
|
-
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
122
|
-
tableCanvas.drawFreezeLine({
|
|
123
|
-
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2
|
|
124
|
-
});
|
|
125
|
-
} else if (verticallData) {
|
|
126
|
-
var verticalPx = verticallData[0],
|
|
127
|
-
verticalScrollWidth = verticallData[2];
|
|
128
|
-
tableCanvas.drawMain({
|
|
129
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
130
|
-
scrollHeight: context.scrollTop,
|
|
131
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
132
|
-
});
|
|
133
|
-
tableCanvas.drawMain({
|
|
134
|
-
scrollWidth: verticalScrollWidth,
|
|
135
|
-
scrollHeight: context.scrollTop,
|
|
136
|
-
drawWidth: verticalPx
|
|
137
|
-
});
|
|
138
152
|
tableCanvas.drawRowHeader(context.scrollTop);
|
|
139
|
-
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
140
|
-
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
141
|
-
tableCanvas.drawFreezeLine({
|
|
142
|
-
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
143
|
-
});
|
|
144
153
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
152
|
-
tableCanvas.drawRowHeader(context.scrollTop);
|
|
153
|
-
}
|
|
154
|
+
};
|
|
155
|
+
repaint();
|
|
156
|
+
_fortuneCore.cellFadeAnimator.setOnTick(repaint);
|
|
157
|
+
return function () {
|
|
158
|
+
return _fortuneCore.cellFadeAnimator.setOnTick(null);
|
|
159
|
+
};
|
|
154
160
|
}, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
|
|
155
161
|
var onWheel = (0, _react.useCallback)(function (e) {
|
|
156
162
|
var _a, _b;
|
|
@@ -95,9 +95,6 @@ var SheetTab = function SheetTab() {
|
|
|
95
95
|
setCalInfo(re);
|
|
96
96
|
}
|
|
97
97
|
}, [context.luckysheet_select_save]);
|
|
98
|
-
(0, _react.useEffect)(function () {
|
|
99
|
-
console.log(calInfo, "calInfo");
|
|
100
|
-
}, [calInfo]);
|
|
101
98
|
(0, _react.useEffect)(function () {
|
|
102
99
|
var tabCurrent = tabContainerRef.current;
|
|
103
100
|
if (!tabCurrent) return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache } from "@fileverse-dev/fortune-core";
|
|
1
|
+
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache, LiveQueryData } from "@fileverse-dev/fortune-core";
|
|
2
2
|
import { getCryptoPrice } from "../../utils/cryptoApi";
|
|
3
3
|
import { SetContextOptions } from "../../context";
|
|
4
4
|
export declare function generateAPIs(context: Context, setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void, handleUndo: () => void, handleRedo: () => void, settings: Required<Settings>, cellInput: HTMLDivElement | null, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null, globalCache: GlobalCache | null): {
|
|
@@ -9,6 +9,8 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
9
9
|
}) => any;
|
|
10
10
|
onboardingActiveCell: (functionName: string) => void;
|
|
11
11
|
initializeComment: (row: number, column: number) => void;
|
|
12
|
+
updateSheetLiveQueryList: (subsheetIndex: number, _data: LiveQueryData) => void;
|
|
13
|
+
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
12
14
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
13
15
|
type?: keyof Cell;
|
|
14
16
|
}) => void;
|
|
@@ -109,6 +111,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
109
111
|
column_focus: number;
|
|
110
112
|
} | undefined;
|
|
111
113
|
} | undefined;
|
|
114
|
+
liveQueryList?: Record<string, LiveQueryData> | undefined;
|
|
112
115
|
};
|
|
113
116
|
addSheet: () => void;
|
|
114
117
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -9,6 +9,16 @@ var _immer = require("immer");
|
|
|
9
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
10
|
var _cryptoApi = require("../../utils/cryptoApi");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
13
|
+
__assign = Object.assign || function (t) {
|
|
14
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
+
s = arguments[i];
|
|
16
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
return __assign.apply(this, arguments);
|
|
21
|
+
};
|
|
12
22
|
function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache) {
|
|
13
23
|
return {
|
|
14
24
|
applyOp: function applyOp(ops) {
|
|
@@ -110,6 +120,24 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
110
120
|
(0, _fortuneCore.newComment)(ctx, undefined, row, column);
|
|
111
121
|
});
|
|
112
122
|
},
|
|
123
|
+
updateSheetLiveQueryList: function updateSheetLiveQueryList(subsheetIndex, _data) {
|
|
124
|
+
setContext(function (ctx) {
|
|
125
|
+
var _a;
|
|
126
|
+
var previousLiveQuery = ctx.luckysheetfile[subsheetIndex].liveQueryList;
|
|
127
|
+
ctx.luckysheetfile[subsheetIndex] = __assign(__assign({}, ctx.luckysheetfile[subsheetIndex]), {
|
|
128
|
+
liveQueryList: __assign(__assign({}, previousLiveQuery), (_a = {}, _a["".concat(_data.data.id)] = _data, _a))
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
removeFromLiveQueryList: function removeFromLiveQueryList(subSheetIndex, id) {
|
|
133
|
+
setContext(function (ctx) {
|
|
134
|
+
var previousLiveQuery = __assign({}, ctx.luckysheetfile[subSheetIndex].liveQueryList);
|
|
135
|
+
previousLiveQuery === null || previousLiveQuery === void 0 ? true : delete previousLiveQuery[id];
|
|
136
|
+
ctx.luckysheetfile[subSheetIndex] = __assign(__assign({}, ctx.luckysheetfile[subSheetIndex]), {
|
|
137
|
+
liveQueryList: previousLiveQuery
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
},
|
|
113
141
|
setCellValue: function setCellValue(row, column, value, options) {
|
|
114
142
|
if (options === void 0) {
|
|
115
143
|
options = {};
|
|
@@ -16,6 +16,8 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
16
16
|
}) => any;
|
|
17
17
|
onboardingActiveCell: (functionName: string) => void;
|
|
18
18
|
initializeComment: (row: number, column: number) => void;
|
|
19
|
+
updateSheetLiveQueryList: (subsheetIndex: number, _data: import("@fileverse-dev/fortune-core").LiveQueryData) => void;
|
|
20
|
+
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
19
21
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
20
22
|
type?: "rt" | "m" | "v" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
21
23
|
}) => void;
|
|
@@ -116,6 +118,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
116
118
|
column_focus: number;
|
|
117
119
|
} | undefined;
|
|
118
120
|
} | undefined;
|
|
121
|
+
liveQueryList?: Record<string, import("@fileverse-dev/fortune-core").LiveQueryData> | undefined;
|
|
119
122
|
};
|
|
120
123
|
addSheet: () => void;
|
|
121
124
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -2,4 +2,5 @@ import Workbook from "./Workbook";
|
|
|
2
2
|
export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from "@fileverse-dev/formulajs/crypto-constants";
|
|
3
3
|
export { Workbook };
|
|
4
4
|
export type { WorkbookInstance } from "./Workbook";
|
|
5
|
-
export type { Cell, Sheet } from "@fileverse-dev/fortune-core";
|
|
5
|
+
export type { Cell, Sheet, LiveQueryData } from "@fileverse-dev/fortune-core";
|
|
6
|
+
export { markCellChanged as animateChangedCell } from "@fileverse-dev/fortune-core";
|
package/lib/components/index.js
CHANGED
|
@@ -21,6 +21,13 @@ Object.defineProperty(exports, "Workbook", {
|
|
|
21
21
|
return _Workbook.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "animateChangedCell", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _fortuneCore.markCellChanged;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
var _Workbook = _interopRequireDefault(require("./Workbook"));
|
|
25
31
|
var _cryptoConstants = require("@fileverse-dev/formulajs/crypto-constants");
|
|
32
|
+
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
26
33
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11-patch-2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.1.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.1.11-patch-2",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|