@fileverse-dev/fortune-react 1.3.10-yjs-1 → 1.3.10-yjs-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.
@@ -470,6 +470,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
470
470
  }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.status]);
471
471
  useEffect(function () {
472
472
  var _a;
473
+ console.log("dataVerificationChange", currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.dataVerification);
473
474
  if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.dataVerificationChange) {
474
475
  context.hooks.dataVerificationChange();
475
476
  }
@@ -274,9 +274,12 @@ export function convertCellsToCrypto(_a) {
274
274
  });
275
275
  });
276
276
  setContext(function (ctx) {
277
+ var _a;
277
278
  var d = getFlowdata(ctx);
278
279
  if (!d || !Array.isArray(d)) return;
280
+ var ydocChanges = [];
279
281
  cellUpdates.forEach(function (_a) {
282
+ var _b, _c;
280
283
  var row = _a.row,
281
284
  col = _a.col,
282
285
  baseValue = _a.baseValue,
@@ -296,7 +299,21 @@ export function convertCellsToCrypto(_a) {
296
299
  cellCp.baseCurrency = baseCurrency.toLowerCase();
297
300
  cellCp.baseCurrencyPrice = baseCurrencyPrice;
298
301
  d[row][col] = cellCp;
302
+ ydocChanges.push({
303
+ sheetId: ctx.currentSheetId,
304
+ path: ["celldata"],
305
+ value: {
306
+ r: row,
307
+ c: col,
308
+ v: (_c = (_b = d[row]) === null || _b === void 0 ? void 0 : _b[col]) !== null && _c !== void 0 ? _c : null
309
+ },
310
+ key: "".concat(row, "_").concat(col),
311
+ type: "update"
312
+ });
299
313
  });
314
+ if (ydocChanges.length > 0 && ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.updateCellYdoc)) {
315
+ ctx.hooks.updateCellYdoc(ydocChanges);
316
+ }
300
317
  });
301
318
  setContext(function (ctx) {
302
319
  api.calculateSheetFromula(ctx, ctx.currentSheetId);
@@ -479,6 +479,7 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
479
479
  }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.status]);
480
480
  (0, _react.useEffect)(function () {
481
481
  var _a;
482
+ console.log("dataVerificationChange", currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.dataVerification);
482
483
  if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.dataVerificationChange) {
483
484
  context.hooks.dataVerificationChange();
484
485
  }
@@ -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.10-yjs-1",
3
+ "version": "1.3.10-yjs-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.3.10-yjs-1",
19
+ "@fileverse-dev/fortune-core": "1.3.10-yjs-2",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",