@fileverse-dev/fortune-react 1.1.5-patch.6 → 1.1.5
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/Workbook/api.d.ts +1 -4
- package/es/components/Workbook/api.js +0 -32
- package/es/components/Workbook/index.d.ts +0 -3
- package/es/components/ZoomControl/index.js +16 -1
- package/es/components/index.d.ts +1 -1
- package/lib/components/Workbook/api.d.ts +1 -4
- package/lib/components/Workbook/api.js +0 -32
- package/lib/components/Workbook/index.d.ts +0 -3
- package/lib/components/ZoomControl/index.js +15 -0
- package/lib/components/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache
|
|
1
|
+
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache } 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,8 +9,6 @@ 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;
|
|
14
12
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
15
13
|
type?: keyof Cell;
|
|
16
14
|
}) => void;
|
|
@@ -111,7 +109,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
111
109
|
column_focus: number;
|
|
112
110
|
} | undefined;
|
|
113
111
|
} | undefined;
|
|
114
|
-
liveQueryList?: Record<string, LiveQueryData> | undefined;
|
|
115
112
|
};
|
|
116
113
|
addSheet: () => void;
|
|
117
114
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -1,13 +1,3 @@
|
|
|
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
|
-
};
|
|
11
1
|
import { addSheet, api, deleteRowCol, deleteSheet, insertRowCol, opToPatch, createFilterOptions, getSheetIndex, locale, setCaretPosition, newComment } from "@fileverse-dev/fortune-core";
|
|
12
2
|
import { applyPatches } from "immer";
|
|
13
3
|
import _ from "lodash";
|
|
@@ -113,28 +103,6 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
|
|
|
113
103
|
newComment(ctx, undefined, row, column);
|
|
114
104
|
});
|
|
115
105
|
},
|
|
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
|
-
console.log({
|
|
133
|
-
id: id,
|
|
134
|
-
previousLiveQuery: previousLiveQuery
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
106
|
setCellValue: function setCellValue(row, column, value, options) {
|
|
139
107
|
if (options === void 0) {
|
|
140
108
|
options = {};
|
|
@@ -16,8 +16,6 @@ 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;
|
|
21
19
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
22
20
|
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;
|
|
23
21
|
}) => void;
|
|
@@ -118,7 +116,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
118
116
|
column_focus: number;
|
|
119
117
|
} | undefined;
|
|
120
118
|
} | undefined;
|
|
121
|
-
liveQueryList?: Record<string, import("@fileverse-dev/fortune-core").LiveQueryData> | undefined;
|
|
122
119
|
};
|
|
123
120
|
addSheet: () => void;
|
|
124
121
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useRef, useState } from "react";
|
|
1
|
+
import React, { useCallback, useContext, useRef, useState, useEffect } from "react";
|
|
2
2
|
import { MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, getSheetIndex } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import WorkbookContext from "../../context";
|
|
4
4
|
import SVGIcon from "../SVGIcon";
|
|
@@ -59,6 +59,21 @@ var ZoomControl = function ZoomControl() {
|
|
|
59
59
|
noHistory: true
|
|
60
60
|
});
|
|
61
61
|
}, [setContext]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
64
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "Equal") {
|
|
65
|
+
zoomTo(context.zoomRatio + 0.1);
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
} else if ((e.metaKey || e.ctrlKey) && e.code === "Minus") {
|
|
68
|
+
zoomTo(context.zoomRatio - 0.1);
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
73
|
+
return function () {
|
|
74
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
75
|
+
};
|
|
76
|
+
}, [context.zoomRatio]);
|
|
62
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
63
78
|
className: "fortune-zoom-container"
|
|
64
79
|
}, /*#__PURE__*/React.createElement("div", {
|
package/es/components/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ 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
|
|
5
|
+
export type { Cell, Sheet } from "@fileverse-dev/fortune-core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache
|
|
1
|
+
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache } 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,8 +9,6 @@ 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;
|
|
14
12
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
15
13
|
type?: keyof Cell;
|
|
16
14
|
}) => void;
|
|
@@ -111,7 +109,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
111
109
|
column_focus: number;
|
|
112
110
|
} | undefined;
|
|
113
111
|
} | undefined;
|
|
114
|
-
liveQueryList?: Record<string, LiveQueryData> | undefined;
|
|
115
112
|
};
|
|
116
113
|
addSheet: () => void;
|
|
117
114
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -9,16 +9,6 @@ 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
|
-
};
|
|
22
12
|
function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache) {
|
|
23
13
|
return {
|
|
24
14
|
applyOp: function applyOp(ops) {
|
|
@@ -120,28 +110,6 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
120
110
|
(0, _fortuneCore.newComment)(ctx, undefined, row, column);
|
|
121
111
|
});
|
|
122
112
|
},
|
|
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
|
-
console.log({
|
|
140
|
-
id: id,
|
|
141
|
-
previousLiveQuery: previousLiveQuery
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
113
|
setCellValue: function setCellValue(row, column, value, options) {
|
|
146
114
|
if (options === void 0) {
|
|
147
115
|
options = {};
|
|
@@ -16,8 +16,6 @@ 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;
|
|
21
19
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
22
20
|
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;
|
|
23
21
|
}) => void;
|
|
@@ -118,7 +116,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
118
116
|
column_focus: number;
|
|
119
117
|
} | undefined;
|
|
120
118
|
} | undefined;
|
|
121
|
-
liveQueryList?: Record<string, import("@fileverse-dev/fortune-core").LiveQueryData> | undefined;
|
|
122
119
|
};
|
|
123
120
|
addSheet: () => void;
|
|
124
121
|
deleteSheet: (options?: api.CommonOptions) => void;
|
|
@@ -68,6 +68,21 @@ var ZoomControl = function ZoomControl() {
|
|
|
68
68
|
noHistory: true
|
|
69
69
|
});
|
|
70
70
|
}, [setContext]);
|
|
71
|
+
(0, _react.useEffect)(function () {
|
|
72
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
73
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "Equal") {
|
|
74
|
+
zoomTo(context.zoomRatio + 0.1);
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
} else if ((e.metaKey || e.ctrlKey) && e.code === "Minus") {
|
|
77
|
+
zoomTo(context.zoomRatio - 0.1);
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
82
|
+
return function () {
|
|
83
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
84
|
+
};
|
|
85
|
+
}, [context.zoomRatio]);
|
|
71
86
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
72
87
|
className: "fortune-zoom-container"
|
|
73
88
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -2,4 +2,4 @@ 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
|
|
5
|
+
export type { Cell, Sheet } from "@fileverse-dev/fortune-core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.1.5
|
|
3
|
+
"version": "1.1.5",
|
|
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.5
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.1.5",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|