@fileverse-dev/fortune-core 1.2.89 → 1.2.90-ydoc-1

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/api/cell.js CHANGED
@@ -55,6 +55,7 @@ export function setCellValue(ctx, row, column, value, cellInput, options) {
55
55
  if (options === void 0) {
56
56
  options = {};
57
57
  }
58
+ var afterUpdateCellCalledInInternal = false;
58
59
  if (!_.isNumber(row) || !_.isNumber(column)) {
59
60
  throw new Error("row or column cannot be null or undefined");
60
61
  }
@@ -423,12 +423,12 @@ export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUnd
423
423
  isFxInput = (_b = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains("fortune-fx-input");
424
424
  ignoredKeys = new Set(isFxInput ? ["Enter", "Tab", "ArrowLeft", "ArrowRight"] : ["Enter", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
425
425
  restCod = !ignoredKeys.has(kstr);
426
- if (ctx.luckysheetCellUpdate.length > 0 && restCod && (window.CompositData === "" || window.CompositData === undefined)) {
426
+ if (ctx.luckysheetCellUpdate.length > 0 && restCod) {
427
427
  return [2];
428
428
  }
429
429
  if (kstr === "Enter") {
430
430
  if (!allowEdit) return [2];
431
- if (window.CompositData === "" || window.CompositData === undefined) handleGlobalEnter(ctx, cellInput, e, canvas);
431
+ handleGlobalEnter(ctx, cellInput, e, canvas);
432
432
  } else if (kstr === "Tab") {
433
433
  if (ctx.luckysheetCellUpdate.length > 0) {
434
434
  updateCell(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
@@ -110,7 +110,8 @@ export function getCellValue(r, c, data, attr) {
110
110
  return retv;
111
111
  }
112
112
  export function setCellValue(ctx, r, c, d, v) {
113
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
113
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
114
+ console.log("setCellValue", r, c, v);
114
115
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
115
116
  if (_.isNil(d)) {
116
117
  d = getFlowdata(ctx);
@@ -350,6 +351,11 @@ export function setCellValue(ctx, r, c, d, v) {
350
351
  if (ctx.luckysheet_selection_range) {
351
352
  ctx.luckysheet_selection_range = [];
352
353
  }
354
+ if (ctx.hooks.afterUpdateCell) {
355
+ var newCell = _.isPlainObject(cell) ? __assign({}, cell) : cell;
356
+ console.log("newCell ======== newCell", newCell, _.isPlainObject(cell));
357
+ (_o = (_m = ctx.hooks).afterUpdateCell) === null || _o === void 0 ? void 0 : _o.call(_m, r, c, null, newCell);
358
+ }
353
359
  }
354
360
  export function getRealCellValue(r, c, data, attr) {
355
361
  var value = getCellValue(r, c, data, "m");
@@ -799,13 +805,6 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
799
805
  if (isValueArray) {
800
806
  if (spillSortResult(ctx, r, c, value, d)) {
801
807
  cancelNormalSelected(ctx);
802
- if (ctx.hooks.afterUpdateCell) {
803
- var newValue_1 = _.cloneDeep(d[r][c]);
804
- setTimeout(function () {
805
- var _a, _b;
806
- return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
807
- });
808
- }
809
808
  ctx.formulaCache.execFunctionGlobalData = null;
810
809
  return;
811
810
  }
@@ -853,13 +852,6 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
853
852
  }
854
853
  }
855
854
  }
856
- if (ctx.hooks.afterUpdateCell) {
857
- var newValue_2 = _.cloneDeep(flowdata[r][c]);
858
- var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
859
- setTimeout(function () {
860
- afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_2);
861
- });
862
- }
863
855
  ctx.formulaCache.execFunctionGlobalData = null;
864
856
  }
865
857
  export function getOrigincell(ctx, r, c, i) {
package/lib/api/cell.js CHANGED
@@ -66,6 +66,7 @@ function setCellValue(ctx, row, column, value, cellInput, options) {
66
66
  if (options === void 0) {
67
67
  options = {};
68
68
  }
69
+ var afterUpdateCellCalledInInternal = false;
69
70
  if (!_lodash.default.isNumber(row) || !_lodash.default.isNumber(column)) {
70
71
  throw new Error("row or column cannot be null or undefined");
71
72
  }
@@ -433,12 +433,12 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
433
433
  isFxInput = (_b = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains("fortune-fx-input");
434
434
  ignoredKeys = new Set(isFxInput ? ["Enter", "Tab", "ArrowLeft", "ArrowRight"] : ["Enter", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
435
435
  restCod = !ignoredKeys.has(kstr);
436
- if (ctx.luckysheetCellUpdate.length > 0 && restCod && (window.CompositData === "" || window.CompositData === undefined)) {
436
+ if (ctx.luckysheetCellUpdate.length > 0 && restCod) {
437
437
  return [2];
438
438
  }
439
439
  if (kstr === "Enter") {
440
440
  if (!allowEdit) return [2];
441
- if (window.CompositData === "" || window.CompositData === undefined) handleGlobalEnter(ctx, cellInput, e, canvas);
441
+ handleGlobalEnter(ctx, cellInput, e, canvas);
442
442
  } else if (kstr === "Tab") {
443
443
  if (ctx.luckysheetCellUpdate.length > 0) {
444
444
  (0, _cell.updateCell)(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
@@ -143,7 +143,8 @@ function getCellValue(r, c, data, attr) {
143
143
  return retv;
144
144
  }
145
145
  function setCellValue(ctx, r, c, d, v) {
146
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
147
+ console.log("setCellValue", r, c, v);
147
148
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
148
149
  if (_lodash.default.isNil(d)) {
149
150
  d = (0, _context.getFlowdata)(ctx);
@@ -383,6 +384,11 @@ function setCellValue(ctx, r, c, d, v) {
383
384
  if (ctx.luckysheet_selection_range) {
384
385
  ctx.luckysheet_selection_range = [];
385
386
  }
387
+ if (ctx.hooks.afterUpdateCell) {
388
+ var newCell = _lodash.default.isPlainObject(cell) ? __assign({}, cell) : cell;
389
+ console.log("newCell ======== newCell", newCell, _lodash.default.isPlainObject(cell));
390
+ (_o = (_m = ctx.hooks).afterUpdateCell) === null || _o === void 0 ? void 0 : _o.call(_m, r, c, null, newCell);
391
+ }
386
392
  }
387
393
  function getRealCellValue(r, c, data, attr) {
388
394
  var value = getCellValue(r, c, data, "m");
@@ -832,13 +838,6 @@ function updateCell(ctx, r, c, $input, value, canvas) {
832
838
  if (isValueArray) {
833
839
  if ((0, _sort.spillSortResult)(ctx, r, c, value, d)) {
834
840
  cancelNormalSelected(ctx);
835
- if (ctx.hooks.afterUpdateCell) {
836
- var newValue_1 = _lodash.default.cloneDeep(d[r][c]);
837
- setTimeout(function () {
838
- var _a, _b;
839
- return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
840
- });
841
- }
842
841
  ctx.formulaCache.execFunctionGlobalData = null;
843
842
  return;
844
843
  }
@@ -886,13 +885,6 @@ function updateCell(ctx, r, c, $input, value, canvas) {
886
885
  }
887
886
  }
888
887
  }
889
- if (ctx.hooks.afterUpdateCell) {
890
- var newValue_2 = _lodash.default.cloneDeep(flowdata[r][c]);
891
- var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
892
- setTimeout(function () {
893
- afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_2);
894
- });
895
- }
896
888
  ctx.formulaCache.execFunctionGlobalData = null;
897
889
  }
898
890
  function getOrigincell(ctx, r, c, i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.89",
3
+ "version": "1.2.90-ydoc-1",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",