@fileverse-dev/fortune-react 1.0.38 → 1.0.40
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/assets/paint-roller.png +0 -0
- package/es/components/SheetOverlay/index.css +0 -2
- package/es/components/SheetOverlay/index.js +2 -2
- package/es/components/SheetTab/index.css +0 -2
- package/es/components/SheetTab/index.js +3 -2
- package/es/components/Toolbar/index.d.ts +1 -1
- package/es/components/Toolbar/index.js +2 -0
- package/es/components/Workbook/api.d.ts +2 -0
- package/es/components/Workbook/api.js +2 -0
- package/es/components/Workbook/index.css +4 -0
- package/es/components/Workbook/index.d.ts +1 -0
- package/es/components/Workbook/index.js +13 -2
- package/es/hooks/useCryptoCells.d.ts +1 -11
- package/es/hooks/useCryptoCells.js +1 -210
- package/lib/assets/paint-roller.png +0 -0
- package/lib/components/SheetOverlay/index.css +0 -2
- package/lib/components/SheetOverlay/index.js +2 -2
- package/lib/components/SheetTab/index.css +0 -2
- package/lib/components/SheetTab/index.js +3 -2
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/components/Toolbar/index.js +2 -0
- package/lib/components/Workbook/api.d.ts +2 -0
- package/lib/components/Workbook/api.js +2 -0
- package/lib/components/Workbook/index.css +4 -0
- package/lib/components/Workbook/index.d.ts +1 -0
- package/lib/components/Workbook/index.js +13 -2
- package/lib/hooks/useCryptoCells.d.ts +1 -11
- package/lib/hooks/useCryptoCells.js +1 -216
- package/package.json +2 -2
|
Binary file
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
position: relative;
|
|
11
11
|
overflow: hidden;
|
|
12
12
|
outline-style: none;
|
|
13
|
-
cursor: default;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.fortune-row-body {
|
|
@@ -377,7 +376,6 @@
|
|
|
377
376
|
|
|
378
377
|
.luckysheet-cell-flow-clip {
|
|
379
378
|
border-collapse: collapse;
|
|
380
|
-
cursor: default;
|
|
381
379
|
width: 5000000px;
|
|
382
380
|
touch-action: manipulation;
|
|
383
381
|
overflow: hidden;
|
|
@@ -243,14 +243,14 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
243
243
|
axis: "y"
|
|
244
244
|
}), /*#__PURE__*/React.createElement("div", {
|
|
245
245
|
ref: refs.cellArea,
|
|
246
|
-
className: "fortune-cell-area",
|
|
246
|
+
className: "fortune-cell-area ".concat(context.luckysheetPaintModelOn ? "cursor-paint" : ""),
|
|
247
247
|
onMouseDown: cellAreaMouseDown,
|
|
248
248
|
onDoubleClick: cellAreaDoubleClick,
|
|
249
249
|
onContextMenu: cellAreaContextMenu,
|
|
250
250
|
style: {
|
|
251
251
|
width: context.cellmainWidth,
|
|
252
252
|
height: context.cellmainHeight,
|
|
253
|
-
cursor: context.luckysheet_cell_selected_extend ? "crosshair" : "
|
|
253
|
+
cursor: context.luckysheet_cell_selected_extend ? "crosshair" : ""
|
|
254
254
|
}
|
|
255
255
|
}, /*#__PURE__*/React.createElement("div", {
|
|
256
256
|
id: "fortune-formula-functionrange"
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
padding: 0 30px 0 44px;
|
|
8
8
|
margin: 0;
|
|
9
9
|
-webkit-touch-callout: none;
|
|
10
|
-
cursor: default;
|
|
11
10
|
transition: 0.3s ease all;
|
|
12
11
|
display: flex;
|
|
13
12
|
align-items: center;
|
|
@@ -188,7 +187,6 @@
|
|
|
188
187
|
border-top-color: #fff;
|
|
189
188
|
color: #222;
|
|
190
189
|
/* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); */
|
|
191
|
-
cursor: default;
|
|
192
190
|
/* top: -2px; */
|
|
193
191
|
/* border-bottom: none; */
|
|
194
192
|
/* padding-right: 20px; */
|
|
@@ -61,7 +61,7 @@ var SheetTab = function SheetTab() {
|
|
|
61
61
|
className: "w-full",
|
|
62
62
|
id: "denomination-warning",
|
|
63
63
|
style: {
|
|
64
|
-
position: "
|
|
64
|
+
position: "fixed",
|
|
65
65
|
display: "none",
|
|
66
66
|
backgroundColor: "#F8F9FA",
|
|
67
67
|
borderBottom: "1px solid #E8EBEC",
|
|
@@ -69,7 +69,8 @@ var SheetTab = function SheetTab() {
|
|
|
69
69
|
fontFamily: "Helvetica Neue",
|
|
70
70
|
fontSize: "var(--font-size-2xsm, 12px)",
|
|
71
71
|
fontStyle: "normal",
|
|
72
|
-
fontWeight: "400"
|
|
72
|
+
fontWeight: "400",
|
|
73
|
+
bottom: "31px"
|
|
73
74
|
}
|
|
74
75
|
}, /*#__PURE__*/React.createElement("div", {
|
|
75
76
|
className: "max-w-7xl mx-auto px-4 py-1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
-
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "DuneChart" | "Ellipsis";
|
|
3
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "DuneChart" | "Ellipsis";
|
|
4
4
|
declare const Toolbar: React.FC<{
|
|
5
5
|
setMoreItems: React.Dispatch<React.SetStateAction<React.ReactNode>>;
|
|
6
6
|
moreItemsOpen: boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache } from "@fileverse-dev/fortune-core";
|
|
2
|
+
import { getCryptoPrice } from "../../utils/cryptoApi";
|
|
2
3
|
import { SetContextOptions } from "../../context";
|
|
3
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): {
|
|
4
5
|
applyOp: (ops: Op[]) => void;
|
|
6
|
+
getCryptoPrice: typeof getCryptoPrice;
|
|
5
7
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
6
8
|
type?: keyof Cell;
|
|
7
9
|
}) => any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { addSheet, api, deleteRowCol, deleteSheet, insertRowCol, opToPatch, createFilterOptions, getSheetIndex, locale, setCaretPosition, newComment } from "@fileverse-dev/fortune-core";
|
|
2
2
|
import { applyPatches } from "immer";
|
|
3
3
|
import _ from "lodash";
|
|
4
|
+
import { getCryptoPrice } from "../../utils/cryptoApi";
|
|
4
5
|
export function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache) {
|
|
5
6
|
return {
|
|
6
7
|
applyOp: function applyOp(ops) {
|
|
@@ -54,6 +55,7 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
|
|
|
54
55
|
noHistory: true
|
|
55
56
|
});
|
|
56
57
|
},
|
|
58
|
+
getCryptoPrice: getCryptoPrice,
|
|
57
59
|
getCellValue: function getCellValue(row, column, options) {
|
|
58
60
|
if (options === void 0) {
|
|
59
61
|
options = {};
|
|
@@ -9,6 +9,7 @@ type AdditionalProps = {
|
|
|
9
9
|
};
|
|
10
10
|
declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
|
|
11
11
|
applyOp: (ops: Op[]) => void;
|
|
12
|
+
getCryptoPrice: typeof import("../../utils/cryptoApi").getCryptoPrice;
|
|
12
13
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
13
14
|
type?: "rt" | "m" | "v" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
14
15
|
}) => any;
|
|
@@ -318,6 +318,10 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
320
|
}, [emitOp]);
|
|
321
|
+
useEffect(function () {
|
|
322
|
+
var _a, _b;
|
|
323
|
+
(_b = (_a = mergedSettings.hooks) === null || _a === void 0 ? void 0 : _a.afterActivateSheet) === null || _b === void 0 ? void 0 : _b.call(_a, context.currentSheetId);
|
|
324
|
+
}, [context.currentSheetId]);
|
|
321
325
|
useEffect(function () {
|
|
322
326
|
var _a, _b;
|
|
323
327
|
setContext(function (ctx) {
|
|
@@ -337,10 +341,17 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
337
341
|
var scrollBar = document.getElementsByClassName("luckysheet-scrollbar-x")[0];
|
|
338
342
|
if (denominatedUsed && denoWarn) {
|
|
339
343
|
denoWarn.style.display = "block";
|
|
340
|
-
|
|
344
|
+
denoWarn.style.left = "0px";
|
|
345
|
+
if (scrollBar) {
|
|
346
|
+
scrollBar.style.bottom = "40px !important";
|
|
347
|
+
scrollBar.style.backgroundColor = "red !important";
|
|
348
|
+
}
|
|
341
349
|
} else if (!denominatedUsed && denoWarn) {
|
|
342
350
|
denoWarn.style.display = "none";
|
|
343
|
-
|
|
351
|
+
denoWarn.style.left = "-9999px";
|
|
352
|
+
if (scrollBar) {
|
|
353
|
+
scrollBar.style.bottom = "12px !important";
|
|
354
|
+
}
|
|
344
355
|
}
|
|
345
356
|
return ctx;
|
|
346
357
|
});
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
cellId: string;
|
|
3
|
-
baseValue: number;
|
|
4
|
-
cryptoType: string;
|
|
5
|
-
fiat: string;
|
|
6
|
-
value: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function useCryptoCells(): {
|
|
9
|
-
cryptoCells: CryptoCell[];
|
|
10
|
-
upsertCryptoCell: (cellId: string, baseValue: number, cryptoType: string, fiat: string) => Promise<void>;
|
|
11
|
-
};
|
|
1
|
+
|
|
@@ -1,210 +1 @@
|
|
|
1
|
-
|
|
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
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) {
|
|
13
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
14
|
-
resolve(value);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) {
|
|
19
|
-
try {
|
|
20
|
-
step(generator.next(value));
|
|
21
|
-
} catch (e) {
|
|
22
|
-
reject(e);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function rejected(value) {
|
|
26
|
-
try {
|
|
27
|
-
step(generator["throw"](value));
|
|
28
|
-
} catch (e) {
|
|
29
|
-
reject(e);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function step(result) {
|
|
33
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
34
|
-
}
|
|
35
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
39
|
-
var _ = {
|
|
40
|
-
label: 0,
|
|
41
|
-
sent: function sent() {
|
|
42
|
-
if (t[0] & 1) throw t[1];
|
|
43
|
-
return t[1];
|
|
44
|
-
},
|
|
45
|
-
trys: [],
|
|
46
|
-
ops: []
|
|
47
|
-
},
|
|
48
|
-
f,
|
|
49
|
-
y,
|
|
50
|
-
t,
|
|
51
|
-
g;
|
|
52
|
-
return g = {
|
|
53
|
-
next: verb(0),
|
|
54
|
-
"throw": verb(1),
|
|
55
|
-
"return": verb(2)
|
|
56
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
57
|
-
return this;
|
|
58
|
-
}), g;
|
|
59
|
-
function verb(n) {
|
|
60
|
-
return function (v) {
|
|
61
|
-
return step([n, v]);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function step(op) {
|
|
65
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
66
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
67
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
68
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
69
|
-
switch (op[0]) {
|
|
70
|
-
case 0:
|
|
71
|
-
case 1:
|
|
72
|
-
t = op;
|
|
73
|
-
break;
|
|
74
|
-
case 4:
|
|
75
|
-
_.label++;
|
|
76
|
-
return {
|
|
77
|
-
value: op[1],
|
|
78
|
-
done: false
|
|
79
|
-
};
|
|
80
|
-
case 5:
|
|
81
|
-
_.label++;
|
|
82
|
-
y = op[1];
|
|
83
|
-
op = [0];
|
|
84
|
-
continue;
|
|
85
|
-
case 7:
|
|
86
|
-
op = _.ops.pop();
|
|
87
|
-
_.trys.pop();
|
|
88
|
-
continue;
|
|
89
|
-
default:
|
|
90
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
91
|
-
_ = 0;
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
95
|
-
_.label = op[1];
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
99
|
-
_.label = t[1];
|
|
100
|
-
t = op;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
if (t && _.label < t[2]) {
|
|
104
|
-
_.label = t[2];
|
|
105
|
-
_.ops.push(op);
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
if (t[2]) _.ops.pop();
|
|
109
|
-
_.trys.pop();
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
op = body.call(thisArg, _);
|
|
113
|
-
} catch (e) {
|
|
114
|
-
op = [6, e];
|
|
115
|
-
y = 0;
|
|
116
|
-
} finally {
|
|
117
|
-
f = t = 0;
|
|
118
|
-
}
|
|
119
|
-
if (op[0] & 5) throw op[1];
|
|
120
|
-
return {
|
|
121
|
-
value: op[0] ? op[1] : void 0,
|
|
122
|
-
done: true
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
127
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
128
|
-
if (ar || !(i in from)) {
|
|
129
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
130
|
-
ar[i] = from[i];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
134
|
-
};
|
|
135
|
-
import { useEffect, useRef, useState } from "react";
|
|
136
|
-
import { getCryptoPrice } from "../utils/cryptoApi";
|
|
137
|
-
export function useCryptoCells() {
|
|
138
|
-
var _this = this;
|
|
139
|
-
var _a = useState([]),
|
|
140
|
-
cryptoCells = _a[0],
|
|
141
|
-
setCryptoCells = _a[1];
|
|
142
|
-
var timerRef = useRef(null);
|
|
143
|
-
var upsertCryptoCell = function upsertCryptoCell(cellId, baseValue, cryptoType, fiat) {
|
|
144
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
145
|
-
var price;
|
|
146
|
-
return __generator(this, function (_a) {
|
|
147
|
-
switch (_a.label) {
|
|
148
|
-
case 0:
|
|
149
|
-
return [4, getCryptoPrice(cryptoType, fiat)];
|
|
150
|
-
case 1:
|
|
151
|
-
price = _a.sent();
|
|
152
|
-
setCryptoCells(function (prev) {
|
|
153
|
-
var idx = prev.findIndex(function (c) {
|
|
154
|
-
return c.cellId === cellId;
|
|
155
|
-
});
|
|
156
|
-
var newCell = {
|
|
157
|
-
cellId: cellId,
|
|
158
|
-
baseValue: baseValue,
|
|
159
|
-
cryptoType: cryptoType,
|
|
160
|
-
fiat: fiat,
|
|
161
|
-
value: baseValue / price
|
|
162
|
-
};
|
|
163
|
-
if (idx === -1) return __spreadArray(__spreadArray([], prev, true), [newCell], false);
|
|
164
|
-
var updated = __spreadArray([], prev, true);
|
|
165
|
-
updated[idx] = newCell;
|
|
166
|
-
return updated;
|
|
167
|
-
});
|
|
168
|
-
return [2];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
useEffect(function () {
|
|
174
|
-
function refreshAll() {
|
|
175
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
-
var _this = this;
|
|
177
|
-
return __generator(this, function (_a) {
|
|
178
|
-
setCryptoCells(function (prev) {
|
|
179
|
-
var updatePromises = prev.map(function (cell) {
|
|
180
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
181
|
-
var price;
|
|
182
|
-
return __generator(this, function (_a) {
|
|
183
|
-
switch (_a.label) {
|
|
184
|
-
case 0:
|
|
185
|
-
return [4, getCryptoPrice(cell.cryptoType, cell.fiat)];
|
|
186
|
-
case 1:
|
|
187
|
-
price = _a.sent();
|
|
188
|
-
return [2, __assign(__assign({}, cell), {
|
|
189
|
-
value: cell.baseValue / price
|
|
190
|
-
})];
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
return Promise.all(updatePromises);
|
|
196
|
-
});
|
|
197
|
-
return [2];
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
timerRef.current = setInterval(refreshAll, 20 * 60 * 1000);
|
|
202
|
-
return function () {
|
|
203
|
-
if (timerRef.current) clearInterval(timerRef.current);
|
|
204
|
-
};
|
|
205
|
-
}, []);
|
|
206
|
-
return {
|
|
207
|
-
cryptoCells: cryptoCells,
|
|
208
|
-
upsertCryptoCell: upsertCryptoCell
|
|
209
|
-
};
|
|
210
|
-
}
|
|
1
|
+
"use strict";
|
|
Binary file
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
position: relative;
|
|
11
11
|
overflow: hidden;
|
|
12
12
|
outline-style: none;
|
|
13
|
-
cursor: default;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.fortune-row-body {
|
|
@@ -377,7 +376,6 @@
|
|
|
377
376
|
|
|
378
377
|
.luckysheet-cell-flow-clip {
|
|
379
378
|
border-collapse: collapse;
|
|
380
|
-
cursor: default;
|
|
381
379
|
width: 5000000px;
|
|
382
380
|
touch-action: manipulation;
|
|
383
381
|
overflow: hidden;
|
|
@@ -252,14 +252,14 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
252
252
|
axis: "y"
|
|
253
253
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
254
254
|
ref: refs.cellArea,
|
|
255
|
-
className: "fortune-cell-area",
|
|
255
|
+
className: "fortune-cell-area ".concat(context.luckysheetPaintModelOn ? "cursor-paint" : ""),
|
|
256
256
|
onMouseDown: cellAreaMouseDown,
|
|
257
257
|
onDoubleClick: cellAreaDoubleClick,
|
|
258
258
|
onContextMenu: cellAreaContextMenu,
|
|
259
259
|
style: {
|
|
260
260
|
width: context.cellmainWidth,
|
|
261
261
|
height: context.cellmainHeight,
|
|
262
|
-
cursor: context.luckysheet_cell_selected_extend ? "crosshair" : "
|
|
262
|
+
cursor: context.luckysheet_cell_selected_extend ? "crosshair" : ""
|
|
263
263
|
}
|
|
264
264
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
265
265
|
id: "fortune-formula-functionrange"
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
padding: 0 30px 0 44px;
|
|
8
8
|
margin: 0;
|
|
9
9
|
-webkit-touch-callout: none;
|
|
10
|
-
cursor: default;
|
|
11
10
|
transition: 0.3s ease all;
|
|
12
11
|
display: flex;
|
|
13
12
|
align-items: center;
|
|
@@ -188,7 +187,6 @@
|
|
|
188
187
|
border-top-color: #fff;
|
|
189
188
|
color: #222;
|
|
190
189
|
/* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); */
|
|
191
|
-
cursor: default;
|
|
192
190
|
/* top: -2px; */
|
|
193
191
|
/* border-bottom: none; */
|
|
194
192
|
/* padding-right: 20px; */
|
|
@@ -70,7 +70,7 @@ var SheetTab = function SheetTab() {
|
|
|
70
70
|
className: "w-full",
|
|
71
71
|
id: "denomination-warning",
|
|
72
72
|
style: {
|
|
73
|
-
position: "
|
|
73
|
+
position: "fixed",
|
|
74
74
|
display: "none",
|
|
75
75
|
backgroundColor: "#F8F9FA",
|
|
76
76
|
borderBottom: "1px solid #E8EBEC",
|
|
@@ -78,7 +78,8 @@ var SheetTab = function SheetTab() {
|
|
|
78
78
|
fontFamily: "Helvetica Neue",
|
|
79
79
|
fontSize: "var(--font-size-2xsm, 12px)",
|
|
80
80
|
fontStyle: "normal",
|
|
81
|
-
fontWeight: "400"
|
|
81
|
+
fontWeight: "400",
|
|
82
|
+
bottom: "31px"
|
|
82
83
|
}
|
|
83
84
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
84
85
|
className: "max-w-7xl mx-auto px-4 py-1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
-
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "DuneChart" | "Ellipsis";
|
|
3
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "DuneChart" | "Ellipsis";
|
|
4
4
|
declare const Toolbar: React.FC<{
|
|
5
5
|
setMoreItems: React.Dispatch<React.SetStateAction<React.ReactNode>>;
|
|
6
6
|
moreItemsOpen: boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache } from "@fileverse-dev/fortune-core";
|
|
2
|
+
import { getCryptoPrice } from "../../utils/cryptoApi";
|
|
2
3
|
import { SetContextOptions } from "../../context";
|
|
3
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): {
|
|
4
5
|
applyOp: (ops: Op[]) => void;
|
|
6
|
+
getCryptoPrice: typeof getCryptoPrice;
|
|
5
7
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
6
8
|
type?: keyof Cell;
|
|
7
9
|
}) => any;
|
|
@@ -7,6 +7,7 @@ exports.generateAPIs = generateAPIs;
|
|
|
7
7
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
8
8
|
var _immer = require("immer");
|
|
9
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
+
var _cryptoApi = require("../../utils/cryptoApi");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache) {
|
|
12
13
|
return {
|
|
@@ -61,6 +62,7 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
61
62
|
noHistory: true
|
|
62
63
|
});
|
|
63
64
|
},
|
|
65
|
+
getCryptoPrice: _cryptoApi.getCryptoPrice,
|
|
64
66
|
getCellValue: function getCellValue(row, column, options) {
|
|
65
67
|
if (options === void 0) {
|
|
66
68
|
options = {};
|
|
@@ -9,6 +9,7 @@ type AdditionalProps = {
|
|
|
9
9
|
};
|
|
10
10
|
declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
|
|
11
11
|
applyOp: (ops: Op[]) => void;
|
|
12
|
+
getCryptoPrice: typeof import("../../utils/cryptoApi").getCryptoPrice;
|
|
12
13
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
13
14
|
type?: "rt" | "m" | "v" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
14
15
|
}) => any;
|
|
@@ -327,6 +327,10 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
329
|
}, [emitOp]);
|
|
330
|
+
(0, _react.useEffect)(function () {
|
|
331
|
+
var _a, _b;
|
|
332
|
+
(_b = (_a = mergedSettings.hooks) === null || _a === void 0 ? void 0 : _a.afterActivateSheet) === null || _b === void 0 ? void 0 : _b.call(_a, context.currentSheetId);
|
|
333
|
+
}, [context.currentSheetId]);
|
|
330
334
|
(0, _react.useEffect)(function () {
|
|
331
335
|
var _a, _b;
|
|
332
336
|
setContext(function (ctx) {
|
|
@@ -346,10 +350,17 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
346
350
|
var scrollBar = document.getElementsByClassName("luckysheet-scrollbar-x")[0];
|
|
347
351
|
if (denominatedUsed && denoWarn) {
|
|
348
352
|
denoWarn.style.display = "block";
|
|
349
|
-
|
|
353
|
+
denoWarn.style.left = "0px";
|
|
354
|
+
if (scrollBar) {
|
|
355
|
+
scrollBar.style.bottom = "40px !important";
|
|
356
|
+
scrollBar.style.backgroundColor = "red !important";
|
|
357
|
+
}
|
|
350
358
|
} else if (!denominatedUsed && denoWarn) {
|
|
351
359
|
denoWarn.style.display = "none";
|
|
352
|
-
|
|
360
|
+
denoWarn.style.left = "-9999px";
|
|
361
|
+
if (scrollBar) {
|
|
362
|
+
scrollBar.style.bottom = "12px !important";
|
|
363
|
+
}
|
|
353
364
|
}
|
|
354
365
|
return ctx;
|
|
355
366
|
});
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
cellId: string;
|
|
3
|
-
baseValue: number;
|
|
4
|
-
cryptoType: string;
|
|
5
|
-
fiat: string;
|
|
6
|
-
value: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function useCryptoCells(): {
|
|
9
|
-
cryptoCells: CryptoCell[];
|
|
10
|
-
upsertCryptoCell: (cellId: string, baseValue: number, cryptoType: string, fiat: string) => Promise<void>;
|
|
11
|
-
};
|
|
1
|
+
|
|
@@ -1,216 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCryptoCells = useCryptoCells;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _cryptoApi = require("../utils/cryptoApi");
|
|
9
|
-
var __assign = void 0 && (void 0).__assign || function () {
|
|
10
|
-
__assign = Object.assign || function (t) {
|
|
11
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12
|
-
s = arguments[i];
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
14
|
-
}
|
|
15
|
-
return t;
|
|
16
|
-
};
|
|
17
|
-
return __assign.apply(this, arguments);
|
|
18
|
-
};
|
|
19
|
-
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
20
|
-
function adopt(value) {
|
|
21
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
22
|
-
resolve(value);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
-
function fulfilled(value) {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function rejected(value) {
|
|
34
|
-
try {
|
|
35
|
-
step(generator["throw"](value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function step(result) {
|
|
41
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
42
|
-
}
|
|
43
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
47
|
-
var _ = {
|
|
48
|
-
label: 0,
|
|
49
|
-
sent: function sent() {
|
|
50
|
-
if (t[0] & 1) throw t[1];
|
|
51
|
-
return t[1];
|
|
52
|
-
},
|
|
53
|
-
trys: [],
|
|
54
|
-
ops: []
|
|
55
|
-
},
|
|
56
|
-
f,
|
|
57
|
-
y,
|
|
58
|
-
t,
|
|
59
|
-
g;
|
|
60
|
-
return g = {
|
|
61
|
-
next: verb(0),
|
|
62
|
-
"throw": verb(1),
|
|
63
|
-
"return": verb(2)
|
|
64
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
65
|
-
return this;
|
|
66
|
-
}), g;
|
|
67
|
-
function verb(n) {
|
|
68
|
-
return function (v) {
|
|
69
|
-
return step([n, v]);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function step(op) {
|
|
73
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
74
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
75
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
76
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
77
|
-
switch (op[0]) {
|
|
78
|
-
case 0:
|
|
79
|
-
case 1:
|
|
80
|
-
t = op;
|
|
81
|
-
break;
|
|
82
|
-
case 4:
|
|
83
|
-
_.label++;
|
|
84
|
-
return {
|
|
85
|
-
value: op[1],
|
|
86
|
-
done: false
|
|
87
|
-
};
|
|
88
|
-
case 5:
|
|
89
|
-
_.label++;
|
|
90
|
-
y = op[1];
|
|
91
|
-
op = [0];
|
|
92
|
-
continue;
|
|
93
|
-
case 7:
|
|
94
|
-
op = _.ops.pop();
|
|
95
|
-
_.trys.pop();
|
|
96
|
-
continue;
|
|
97
|
-
default:
|
|
98
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
99
|
-
_ = 0;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
103
|
-
_.label = op[1];
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
107
|
-
_.label = t[1];
|
|
108
|
-
t = op;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
if (t && _.label < t[2]) {
|
|
112
|
-
_.label = t[2];
|
|
113
|
-
_.ops.push(op);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
if (t[2]) _.ops.pop();
|
|
117
|
-
_.trys.pop();
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
op = body.call(thisArg, _);
|
|
121
|
-
} catch (e) {
|
|
122
|
-
op = [6, e];
|
|
123
|
-
y = 0;
|
|
124
|
-
} finally {
|
|
125
|
-
f = t = 0;
|
|
126
|
-
}
|
|
127
|
-
if (op[0] & 5) throw op[1];
|
|
128
|
-
return {
|
|
129
|
-
value: op[0] ? op[1] : void 0,
|
|
130
|
-
done: true
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
|
|
135
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
136
|
-
if (ar || !(i in from)) {
|
|
137
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
138
|
-
ar[i] = from[i];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
142
|
-
};
|
|
143
|
-
function useCryptoCells() {
|
|
144
|
-
var _this = this;
|
|
145
|
-
var _a = (0, _react.useState)([]),
|
|
146
|
-
cryptoCells = _a[0],
|
|
147
|
-
setCryptoCells = _a[1];
|
|
148
|
-
var timerRef = (0, _react.useRef)(null);
|
|
149
|
-
var upsertCryptoCell = function upsertCryptoCell(cellId, baseValue, cryptoType, fiat) {
|
|
150
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
151
|
-
var price;
|
|
152
|
-
return __generator(this, function (_a) {
|
|
153
|
-
switch (_a.label) {
|
|
154
|
-
case 0:
|
|
155
|
-
return [4, (0, _cryptoApi.getCryptoPrice)(cryptoType, fiat)];
|
|
156
|
-
case 1:
|
|
157
|
-
price = _a.sent();
|
|
158
|
-
setCryptoCells(function (prev) {
|
|
159
|
-
var idx = prev.findIndex(function (c) {
|
|
160
|
-
return c.cellId === cellId;
|
|
161
|
-
});
|
|
162
|
-
var newCell = {
|
|
163
|
-
cellId: cellId,
|
|
164
|
-
baseValue: baseValue,
|
|
165
|
-
cryptoType: cryptoType,
|
|
166
|
-
fiat: fiat,
|
|
167
|
-
value: baseValue / price
|
|
168
|
-
};
|
|
169
|
-
if (idx === -1) return __spreadArray(__spreadArray([], prev, true), [newCell], false);
|
|
170
|
-
var updated = __spreadArray([], prev, true);
|
|
171
|
-
updated[idx] = newCell;
|
|
172
|
-
return updated;
|
|
173
|
-
});
|
|
174
|
-
return [2];
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
(0, _react.useEffect)(function () {
|
|
180
|
-
function refreshAll() {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
182
|
-
var _this = this;
|
|
183
|
-
return __generator(this, function (_a) {
|
|
184
|
-
setCryptoCells(function (prev) {
|
|
185
|
-
var updatePromises = prev.map(function (cell) {
|
|
186
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
187
|
-
var price;
|
|
188
|
-
return __generator(this, function (_a) {
|
|
189
|
-
switch (_a.label) {
|
|
190
|
-
case 0:
|
|
191
|
-
return [4, (0, _cryptoApi.getCryptoPrice)(cell.cryptoType, cell.fiat)];
|
|
192
|
-
case 1:
|
|
193
|
-
price = _a.sent();
|
|
194
|
-
return [2, __assign(__assign({}, cell), {
|
|
195
|
-
value: cell.baseValue / price
|
|
196
|
-
})];
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
return Promise.all(updatePromises);
|
|
202
|
-
});
|
|
203
|
-
return [2];
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
timerRef.current = setInterval(refreshAll, 20 * 60 * 1000);
|
|
208
|
-
return function () {
|
|
209
|
-
if (timerRef.current) clearInterval(timerRef.current);
|
|
210
|
-
};
|
|
211
|
-
}, []);
|
|
212
|
-
return {
|
|
213
|
-
cryptoCells: cryptoCells,
|
|
214
|
-
upsertCryptoCell: upsertCryptoCell
|
|
215
|
-
};
|
|
216
|
-
}
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
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.0.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.0.40",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-16",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|