@fileverse-dev/fortune-react 1.3.10 → 1.3.11-input-ref
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/FxEditor/index.js +12 -6
- package/es/components/SheetOverlay/InputBox.js +243 -130
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +25 -1
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +26 -2
- package/es/components/SheetOverlay/helper.d.ts +5 -0
- package/es/components/SheetOverlay/helper.js +52 -0
- package/es/components/Workbook/index.js +139 -9
- package/es/utils/convertCellsToCrypto.js +17 -0
- package/lib/components/FxEditor/index.js +10 -4
- package/lib/components/SheetOverlay/InputBox.js +241 -128
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +25 -1
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +26 -2
- package/lib/components/SheetOverlay/helper.d.ts +5 -0
- package/lib/components/SheetOverlay/helper.js +54 -0
- package/lib/components/Workbook/index.js +140 -10
- package/lib/utils/convertCellsToCrypto.js +17 -0
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.buildFormulaSuggestionText = buildFormulaSuggestionText;
|
|
6
7
|
exports.countCommasBeforeCursor = countCommasBeforeCursor;
|
|
7
8
|
exports.decrementColumn = decrementColumn;
|
|
8
9
|
exports.decrementRow = decrementRow;
|
|
@@ -13,6 +14,7 @@ exports.isLetterNumberPattern = isLetterNumberPattern;
|
|
|
13
14
|
exports.moveCursorToEnd = moveCursorToEnd;
|
|
14
15
|
exports.numberToColumn = numberToColumn;
|
|
15
16
|
exports.removeLastSpan = removeLastSpan;
|
|
17
|
+
exports.setCursorPosition = setCursorPosition;
|
|
16
18
|
function moveCursorToEnd(editableDiv) {
|
|
17
19
|
editableDiv.focus();
|
|
18
20
|
var range = document.createRange();
|
|
@@ -33,6 +35,58 @@ function getCursorPosition(editableDiv) {
|
|
|
33
35
|
preRange.setEnd(range.endContainer, range.endOffset);
|
|
34
36
|
return preRange.toString().length;
|
|
35
37
|
}
|
|
38
|
+
function setCursorPosition(editableDiv, targetOffset) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
editableDiv.focus();
|
|
41
|
+
var selection = window.getSelection();
|
|
42
|
+
if (!selection) return;
|
|
43
|
+
var range = document.createRange();
|
|
44
|
+
var walker = document.createTreeWalker(editableDiv, NodeFilter.SHOW_TEXT);
|
|
45
|
+
var remaining = Math.max(0, targetOffset);
|
|
46
|
+
var node = walker.nextNode();
|
|
47
|
+
while (node) {
|
|
48
|
+
var textLength = (_b = (_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
49
|
+
if (remaining <= textLength) {
|
|
50
|
+
range.setStart(node, remaining);
|
|
51
|
+
range.collapse(true);
|
|
52
|
+
selection.removeAllRanges();
|
|
53
|
+
selection.addRange(range);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
remaining -= textLength;
|
|
57
|
+
node = walker.nextNode();
|
|
58
|
+
}
|
|
59
|
+
range.selectNodeContents(editableDiv);
|
|
60
|
+
range.collapse(false);
|
|
61
|
+
selection.removeAllRanges();
|
|
62
|
+
selection.addRange(range);
|
|
63
|
+
}
|
|
64
|
+
function buildFormulaSuggestionText(editableDiv, formulaName) {
|
|
65
|
+
var fullText = editableDiv.innerText || "";
|
|
66
|
+
var selection = window.getSelection();
|
|
67
|
+
var selectionInEditor = !!(selection === null || selection === void 0 ? void 0 : selection.rangeCount) && editableDiv.contains(selection.getRangeAt(0).startContainer);
|
|
68
|
+
var caretOffset = selectionInEditor ? getCursorPosition(editableDiv) : fullText.length;
|
|
69
|
+
var safeCaretOffset = Math.max(0, Math.min(caretOffset, fullText.length));
|
|
70
|
+
var beforeCaret = fullText.slice(0, safeCaretOffset);
|
|
71
|
+
var afterCaret = fullText.slice(safeCaretOffset);
|
|
72
|
+
var replaceStart = safeCaretOffset;
|
|
73
|
+
var tokenMatch = beforeCaret.match(/[A-Za-z_][A-Za-z0-9_]*$/);
|
|
74
|
+
if (tokenMatch) {
|
|
75
|
+
var token = tokenMatch[0];
|
|
76
|
+
var tokenStart = safeCaretOffset - token.length;
|
|
77
|
+
var charBeforeToken = tokenStart > 0 ? beforeCaret[tokenStart - 1] : "";
|
|
78
|
+
if (tokenStart === 0 || /[\s=(,+\-*/&^<>]$/.test(charBeforeToken)) {
|
|
79
|
+
replaceStart = tokenStart;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
var shouldAddOpeningParen = !afterCaret.startsWith("(");
|
|
83
|
+
var insertedText = "".concat(formulaName).concat(shouldAddOpeningParen ? "(" : "");
|
|
84
|
+
var nextText = fullText.slice(0, replaceStart) + insertedText + afterCaret;
|
|
85
|
+
return {
|
|
86
|
+
text: nextText,
|
|
87
|
+
caretOffset: replaceStart + insertedText.length
|
|
88
|
+
};
|
|
89
|
+
}
|
|
36
90
|
function isLetterNumberPattern(str) {
|
|
37
91
|
var regex = /^[a-zA-Z]+\d+$/;
|
|
38
92
|
return regex.test(str);
|
|
@@ -25,7 +25,7 @@ var _FilterMenu = _interopRequireDefault(require("../ContextMenu/FilterMenu"));
|
|
|
25
25
|
var _SheetList = _interopRequireDefault(require("../SheetList"));
|
|
26
26
|
var _DunePreview = _interopRequireDefault(require("../DunePreview/DunePreview"));
|
|
27
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
28
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
29
29
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
30
30
|
__assign = Object.assign || function (t) {
|
|
31
31
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -151,6 +151,101 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
151
151
|
onOp((0, _fortuneCore.patchToOp)(ctx, patches, options, undo));
|
|
152
152
|
}
|
|
153
153
|
}, [onOp]);
|
|
154
|
+
var emitYjsFromPatches = (0, _react.useCallback)(function (ctxBefore, ctxAfter, patches) {
|
|
155
|
+
var _a;
|
|
156
|
+
var _b = (_a = ctxBefore.hooks) !== null && _a !== void 0 ? _a : {},
|
|
157
|
+
updateCellYdoc = _b.updateCellYdoc,
|
|
158
|
+
updateAllCell = _b.updateAllCell;
|
|
159
|
+
if (!updateCellYdoc) return;
|
|
160
|
+
var mapFields = new Set(["celldata", "calcChain", "dataBlockCalcFunction", "liveQueryList", "dataVerification", "hyperlink", "conditionRules"]);
|
|
161
|
+
var changeMap = new Map();
|
|
162
|
+
var upsert = function upsert(change) {
|
|
163
|
+
var _a, _b, _c;
|
|
164
|
+
var k = "".concat(change.sheetId, ":").concat((_b = (_a = change.path) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : "", ":").concat((_c = change.key) !== null && _c !== void 0 ? _c : "");
|
|
165
|
+
changeMap.set(k, change);
|
|
166
|
+
};
|
|
167
|
+
var upsertCell = function upsertCell(sheetId, r, c) {
|
|
168
|
+
var _a, _b, _c;
|
|
169
|
+
var cell = (_c = (_b = (_a = (0, _fortuneCore.getFlowdata)(ctxAfter, sheetId)) === null || _a === void 0 ? void 0 : _a[r]) === null || _b === void 0 ? void 0 : _b[c]) !== null && _c !== void 0 ? _c : null;
|
|
170
|
+
var key = "".concat(r, "_").concat(c);
|
|
171
|
+
upsert({
|
|
172
|
+
sheetId: sheetId,
|
|
173
|
+
path: ["celldata"],
|
|
174
|
+
key: key,
|
|
175
|
+
value: {
|
|
176
|
+
r: r,
|
|
177
|
+
c: c,
|
|
178
|
+
v: cell
|
|
179
|
+
},
|
|
180
|
+
type: cell == null ? "delete" : "update"
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
patches.forEach(function (p) {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
185
|
+
var path = p.path;
|
|
186
|
+
if ((path === null || path === void 0 ? void 0 : path[0]) !== "luckysheetfile") return;
|
|
187
|
+
var sheetIndex = path[1];
|
|
188
|
+
if (!_lodash.default.isNumber(sheetIndex)) return;
|
|
189
|
+
var sheetBefore = (_a = ctxBefore.luckysheetfile) === null || _a === void 0 ? void 0 : _a[sheetIndex];
|
|
190
|
+
var sheetAfter = (_b = ctxAfter.luckysheetfile) === null || _b === void 0 ? void 0 : _b[sheetIndex];
|
|
191
|
+
var sheetId = (sheetAfter === null || sheetAfter === void 0 ? void 0 : sheetAfter.id) || (sheetBefore === null || sheetBefore === void 0 ? void 0 : sheetBefore.id);
|
|
192
|
+
if (!sheetId) return;
|
|
193
|
+
var root = path[2];
|
|
194
|
+
if (root === "data") {
|
|
195
|
+
if (_lodash.default.isNumber(path[3]) && _lodash.default.isNumber(path[4])) {
|
|
196
|
+
upsertCell(sheetId, path[3], path[4]);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (_lodash.default.isNumber(path[3]) && path.length === 4) {
|
|
200
|
+
var r = path[3];
|
|
201
|
+
var beforeRow = (_d = (_c = sheetBefore === null || sheetBefore === void 0 ? void 0 : sheetBefore.data) === null || _c === void 0 ? void 0 : _c[r]) !== null && _d !== void 0 ? _d : [];
|
|
202
|
+
var afterRow = (_f = (_e = sheetAfter === null || sheetAfter === void 0 ? void 0 : sheetAfter.data) === null || _e === void 0 ? void 0 : _e[r]) !== null && _f !== void 0 ? _f : [];
|
|
203
|
+
var max = Math.max((_g = beforeRow.length) !== null && _g !== void 0 ? _g : 0, (_h = afterRow.length) !== null && _h !== void 0 ? _h : 0);
|
|
204
|
+
for (var c = 0; c < max; c += 1) {
|
|
205
|
+
if (!_lodash.default.isEqual((_j = beforeRow[c]) !== null && _j !== void 0 ? _j : null, (_k = afterRow[c]) !== null && _k !== void 0 ? _k : null)) {
|
|
206
|
+
upsertCell(sheetId, r, c);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (path.length === 3) {
|
|
212
|
+
var dataAfter = sheetAfter === null || sheetAfter === void 0 ? void 0 : sheetAfter.data;
|
|
213
|
+
var rows = (_l = dataAfter === null || dataAfter === void 0 ? void 0 : dataAfter.length) !== null && _l !== void 0 ? _l : 0;
|
|
214
|
+
var cols = rows > 0 ? (_o = (_m = dataAfter === null || dataAfter === void 0 ? void 0 : dataAfter[0]) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0 : 0;
|
|
215
|
+
var size = rows * cols;
|
|
216
|
+
if (size > 50000 && updateAllCell) {
|
|
217
|
+
updateAllCell(sheetId);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
for (var r = 0; r < rows; r += 1) {
|
|
221
|
+
var beforeRow = (_q = (_p = sheetBefore === null || sheetBefore === void 0 ? void 0 : sheetBefore.data) === null || _p === void 0 ? void 0 : _p[r]) !== null && _q !== void 0 ? _q : [];
|
|
222
|
+
var afterRow = (_s = (_r = sheetAfter === null || sheetAfter === void 0 ? void 0 : sheetAfter.data) === null || _r === void 0 ? void 0 : _r[r]) !== null && _s !== void 0 ? _s : [];
|
|
223
|
+
var max = Math.max((_t = beforeRow.length) !== null && _t !== void 0 ? _t : 0, (_u = afterRow.length) !== null && _u !== void 0 ? _u : 0);
|
|
224
|
+
for (var c = 0; c < max; c += 1) {
|
|
225
|
+
if (!_lodash.default.isEqual((_v = beforeRow[c]) !== null && _v !== void 0 ? _v : null, (_w = afterRow[c]) !== null && _w !== void 0 ? _w : null)) {
|
|
226
|
+
upsertCell(sheetId, r, c);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (typeof root === "string" && mapFields.has(root)) {
|
|
234
|
+
var key = path[3];
|
|
235
|
+
if (typeof key === "string") {
|
|
236
|
+
upsert({
|
|
237
|
+
sheetId: sheetId,
|
|
238
|
+
path: [root],
|
|
239
|
+
key: key,
|
|
240
|
+
value: p.value,
|
|
241
|
+
type: p.op === "remove" || p.value == null ? "delete" : "update"
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
var changes = Array.from(changeMap.values());
|
|
247
|
+
if (changes.length > 0) updateCellYdoc(changes);
|
|
248
|
+
}, []);
|
|
154
249
|
function reduceUndoList(ctx, ctxBefore) {
|
|
155
250
|
var sheetsId = ctx.luckysheetfile.map(function (sheet) {
|
|
156
251
|
return sheet.id;
|
|
@@ -308,6 +403,7 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
308
403
|
delete inversedOptions.addSheet.value.data;
|
|
309
404
|
}
|
|
310
405
|
emitOp(newContext, history.inversePatches, inversedOptions, true);
|
|
406
|
+
emitYjsFromPatches(ctx_, newContext, history.inversePatches);
|
|
311
407
|
var sheetIdxAfterUndo = (0, _fortuneCore.getSheetIndex)(newContext, newContext.currentSheetId);
|
|
312
408
|
var nw = __assign(__assign({}, newContext), sheetIdxAfterUndo != null && ((_f = newContext.luckysheetfile[sheetIdxAfterUndo]) === null || _f === void 0 ? void 0 : _f.config) != null ? {
|
|
313
409
|
config: newContext.luckysheetfile[sheetIdxAfterUndo].config
|
|
@@ -336,6 +432,7 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
336
432
|
});
|
|
337
433
|
globalCache.current.undoList.push(history);
|
|
338
434
|
emitOp(newContext, history.patches, history.options);
|
|
435
|
+
emitYjsFromPatches(ctx_, newContext, history.patches);
|
|
339
436
|
var sheetIdxAfterRedo = (0, _fortuneCore.getSheetIndex)(newContext, newContext.currentSheetId);
|
|
340
437
|
var nw = __assign(__assign({}, newContext), sheetIdxAfterRedo != null && ((_a = newContext.luckysheetfile[sheetIdxAfterRedo]) === null || _a === void 0 ? void 0 : _a.config) != null ? {
|
|
341
438
|
config: newContext.luckysheetfile[sheetIdxAfterRedo].config
|
|
@@ -362,18 +459,13 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
362
459
|
(0, _react.useEffect)(function () {
|
|
363
460
|
var _a, _b;
|
|
364
461
|
setContext(function (ctx) {
|
|
365
|
-
var _a, _b;
|
|
366
462
|
var gridData = (0, _fortuneCore.getFlowdata)(ctx);
|
|
367
463
|
var cellData = _fortuneCore.api.dataToCelldata(gridData);
|
|
368
|
-
var denominatedUsed =
|
|
369
|
-
|
|
370
|
-
var cell = cellData_1[_i];
|
|
464
|
+
var denominatedUsed = (cellData !== null && cellData !== void 0 ? cellData : []).some(function (cell) {
|
|
465
|
+
var _a, _b;
|
|
371
466
|
var value = (_b = (_a = cell === null || cell === void 0 ? void 0 : cell.v) === null || _a === void 0 ? void 0 : _a.m) === null || _b === void 0 ? void 0 : _b.toString();
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
break;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
467
|
+
return (value === null || value === void 0 ? void 0 : value.includes("BTC")) || (value === null || value === void 0 ? void 0 : value.includes("ETH")) || (value === null || value === void 0 ? void 0 : value.includes("SOL"));
|
|
468
|
+
});
|
|
377
469
|
var denoWarn = document.getElementById("denomination-warning");
|
|
378
470
|
var scrollBar = document.getElementsByClassName("luckysheet-scrollbar-x")[0];
|
|
379
471
|
if (denominatedUsed && denoWarn) {
|
|
@@ -447,6 +539,32 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
447
539
|
context.hooks.afterOrderChanges();
|
|
448
540
|
}
|
|
449
541
|
}, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.order]);
|
|
542
|
+
var sheetColorSig = (0, _react.useMemo)(function () {
|
|
543
|
+
var _a;
|
|
544
|
+
return ((_a = context === null || context === void 0 ? void 0 : context.luckysheetfile) !== null && _a !== void 0 ? _a : []).map(function (s) {
|
|
545
|
+
var _a;
|
|
546
|
+
return "".concat(s.id, ":").concat((_a = s.color) !== null && _a !== void 0 ? _a : "");
|
|
547
|
+
}).join("|");
|
|
548
|
+
}, [context === null || context === void 0 ? void 0 : context.luckysheetfile]);
|
|
549
|
+
(0, _react.useEffect)(function () {
|
|
550
|
+
var _a;
|
|
551
|
+
if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterColorChanges) {
|
|
552
|
+
context.hooks.afterColorChanges();
|
|
553
|
+
}
|
|
554
|
+
}, [sheetColorSig]);
|
|
555
|
+
var sheetHideSig = (0, _react.useMemo)(function () {
|
|
556
|
+
var _a;
|
|
557
|
+
return ((_a = context === null || context === void 0 ? void 0 : context.luckysheetfile) !== null && _a !== void 0 ? _a : []).map(function (s) {
|
|
558
|
+
var _a;
|
|
559
|
+
return "".concat(s.id, ":").concat((_a = s.hide) !== null && _a !== void 0 ? _a : 0);
|
|
560
|
+
}).join("|");
|
|
561
|
+
}, [context === null || context === void 0 ? void 0 : context.luckysheetfile]);
|
|
562
|
+
(0, _react.useEffect)(function () {
|
|
563
|
+
var _a;
|
|
564
|
+
if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterHideChanges) {
|
|
565
|
+
context.hooks.afterHideChanges();
|
|
566
|
+
}
|
|
567
|
+
}, [sheetHideSig]);
|
|
450
568
|
(0, _react.useEffect)(function () {
|
|
451
569
|
var _a;
|
|
452
570
|
if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterConfigChanges) {
|
|
@@ -513,6 +631,18 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
513
631
|
context.hooks.conditionFormatChange();
|
|
514
632
|
}
|
|
515
633
|
}, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.luckysheet_conditionformat_save]);
|
|
634
|
+
(0, _react.useEffect)(function () {
|
|
635
|
+
var _a;
|
|
636
|
+
if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.filterSelectChange) {
|
|
637
|
+
context.hooks.filterSelectChange();
|
|
638
|
+
}
|
|
639
|
+
}, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.filter_select]);
|
|
640
|
+
(0, _react.useEffect)(function () {
|
|
641
|
+
var _a;
|
|
642
|
+
if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.filterChange) {
|
|
643
|
+
context.hooks.filterChange();
|
|
644
|
+
}
|
|
645
|
+
}, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.filter]);
|
|
516
646
|
(0, _react.useEffect)(function () {
|
|
517
647
|
var _a;
|
|
518
648
|
if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.hyperlinkChange) {
|
|
@@ -281,9 +281,12 @@ function convertCellsToCrypto(_a) {
|
|
|
281
281
|
});
|
|
282
282
|
});
|
|
283
283
|
setContext(function (ctx) {
|
|
284
|
+
var _a;
|
|
284
285
|
var d = (0, _fortuneCore.getFlowdata)(ctx);
|
|
285
286
|
if (!d || !Array.isArray(d)) return;
|
|
287
|
+
var ydocChanges = [];
|
|
286
288
|
cellUpdates.forEach(function (_a) {
|
|
289
|
+
var _b, _c;
|
|
287
290
|
var row = _a.row,
|
|
288
291
|
col = _a.col,
|
|
289
292
|
baseValue = _a.baseValue,
|
|
@@ -303,7 +306,21 @@ function convertCellsToCrypto(_a) {
|
|
|
303
306
|
cellCp.baseCurrency = baseCurrency.toLowerCase();
|
|
304
307
|
cellCp.baseCurrencyPrice = baseCurrencyPrice;
|
|
305
308
|
d[row][col] = cellCp;
|
|
309
|
+
ydocChanges.push({
|
|
310
|
+
sheetId: ctx.currentSheetId,
|
|
311
|
+
path: ["celldata"],
|
|
312
|
+
value: {
|
|
313
|
+
r: row,
|
|
314
|
+
c: col,
|
|
315
|
+
v: (_c = (_b = d[row]) === null || _b === void 0 ? void 0 : _b[col]) !== null && _c !== void 0 ? _c : null
|
|
316
|
+
},
|
|
317
|
+
key: "".concat(row, "_").concat(col),
|
|
318
|
+
type: "update"
|
|
319
|
+
});
|
|
306
320
|
});
|
|
321
|
+
if (ydocChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
|
|
322
|
+
ctx.hooks.updateCellYdoc(ydocChanges);
|
|
323
|
+
}
|
|
307
324
|
});
|
|
308
325
|
setContext(function (ctx) {
|
|
309
326
|
_fortuneCore.api.calculateSheetFromula(ctx, ctx.currentSheetId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11-input-ref",
|
|
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.3.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.3.11-input-ref",
|
|
20
20
|
"@fileverse/ui": "5.0.0",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|