@fileverse-dev/fortune-core 1.2.90-ydoc → 1.2.90-ydoc-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.
package/es/api/cell.d.ts CHANGED
@@ -4,7 +4,7 @@ import { CommonOptions } from "./common";
4
4
  export declare function getCellValue(ctx: Context, row: number, column: number, options?: CommonOptions & {
5
5
  type?: keyof Cell;
6
6
  }): any;
7
- export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
7
+ export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions, callAfterUpdate?: boolean): void;
8
8
  export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
9
9
  export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
10
10
  export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
package/es/api/cell.js CHANGED
@@ -50,8 +50,8 @@ export function getCellValue(ctx, row, column, options) {
50
50
  }
51
51
  return ret;
52
52
  }
53
- export function setCellValue(ctx, row, column, value, cellInput, options) {
54
- var _a;
53
+ export function setCellValue(ctx, row, column, value, cellInput, options, callAfterUpdate) {
54
+ var _a, _b, _c;
55
55
  if (options === void 0) {
56
56
  options = {};
57
57
  }
@@ -128,6 +128,9 @@ export function setCellValue(ctx, row, column, value, cellInput, options) {
128
128
  setCellValueInternal(ctx, row, column, data, value);
129
129
  }
130
130
  }
131
+ if (callAfterUpdate && ctx.hooks.afterUpdateCell) {
132
+ (_c = (_b = ctx.hooks).afterUpdateCell) === null || _c === void 0 ? void 0 : _c.call(_b, row, column, null, value);
133
+ }
131
134
  }
132
135
  export function clearCell(ctx, row, column, options) {
133
136
  var _a, _b;
package/es/api/range.d.ts CHANGED
@@ -18,5 +18,5 @@ export declare function getSelectionCoordinates(ctx: Context): string[];
18
18
  export declare function getCellsByRange(ctx: Context, range: Selection, options?: CommonOptions): (Cell | null)[][];
19
19
  export declare function getHtmlByRange(ctx: Context, range: Range, options?: CommonOptions): string | null;
20
20
  export declare function setSelection(ctx: Context, range: Range, options: CommonOptions): void;
21
- export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
21
+ export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions, callAfterUpdate?: boolean): void;
22
22
  export declare function setCellFormatByRange(ctx: Context, attr: keyof Cell, value: any, range: Range | SingleRange, options?: CommonOptions): void;
package/es/api/range.js CHANGED
@@ -77,7 +77,7 @@ export function setSelection(ctx, range, options) {
77
77
  ctx.luckysheet_select_save = sheet.luckysheet_select_save;
78
78
  }
79
79
  }
80
- export function setCellValuesByRange(ctx, data, range, cellInput, options) {
80
+ export function setCellValuesByRange(ctx, data, range, cellInput, options, callAfterUpdate) {
81
81
  if (options === void 0) {
82
82
  options = {};
83
83
  }
@@ -99,7 +99,7 @@ export function setCellValuesByRange(ctx, data, range, cellInput, options) {
99
99
  for (var j = 0; j < columnCount; j += 1) {
100
100
  var row = range.row[0] + i;
101
101
  var column = range.column[0] + j;
102
- setCellValue(ctx, row, column, data[i][j], cellInput, options);
102
+ setCellValue(ctx, row, column, data[i][j], cellInput, options, callAfterUpdate);
103
103
  }
104
104
  }
105
105
  }
@@ -110,7 +110,7 @@ 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, _m, _o;
113
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
114
114
  console.log("setCellValue", r, c, v);
115
115
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
116
116
  if (_.isNil(d)) {
@@ -351,9 +351,6 @@ export function setCellValue(ctx, r, c, d, v) {
351
351
  if (ctx.luckysheet_selection_range) {
352
352
  ctx.luckysheet_selection_range = [];
353
353
  }
354
- if (ctx.hooks.afterUpdateCell) {
355
- (_o = (_m = ctx.hooks).afterUpdateCell) === null || _o === void 0 ? void 0 : _o.call(_m, r, c, null, cell);
356
- }
357
354
  }
358
355
  export function getRealCellValue(r, c, data, attr) {
359
356
  var value = getCellValue(r, c, data, "m");
@@ -803,6 +800,13 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
803
800
  if (isValueArray) {
804
801
  if (spillSortResult(ctx, r, c, value, d)) {
805
802
  cancelNormalSelected(ctx);
803
+ if (ctx.hooks.afterUpdateCell) {
804
+ var newValue_1 = _.cloneDeep(d[r][c]);
805
+ setTimeout(function () {
806
+ var _a, _b;
807
+ return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
808
+ });
809
+ }
806
810
  ctx.formulaCache.execFunctionGlobalData = null;
807
811
  return;
808
812
  }
@@ -850,6 +854,13 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
850
854
  }
851
855
  }
852
856
  }
857
+ if (ctx.hooks.afterUpdateCell) {
858
+ var newValue_2 = _.cloneDeep(flowdata[r][c]);
859
+ var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
860
+ setTimeout(function () {
861
+ afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_2);
862
+ });
863
+ }
853
864
  ctx.formulaCache.execFunctionGlobalData = null;
854
865
  }
855
866
  export function getOrigincell(ctx, r, c, i) {
package/lib/api/cell.d.ts CHANGED
@@ -4,7 +4,7 @@ import { CommonOptions } from "./common";
4
4
  export declare function getCellValue(ctx: Context, row: number, column: number, options?: CommonOptions & {
5
5
  type?: keyof Cell;
6
6
  }): any;
7
- export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
7
+ export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions, callAfterUpdate?: boolean): void;
8
8
  export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
9
9
  export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
10
10
  export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
package/lib/api/cell.js CHANGED
@@ -61,8 +61,8 @@ function getCellValue(ctx, row, column, options) {
61
61
  }
62
62
  return ret;
63
63
  }
64
- function setCellValue(ctx, row, column, value, cellInput, options) {
65
- var _a;
64
+ function setCellValue(ctx, row, column, value, cellInput, options, callAfterUpdate) {
65
+ var _a, _b, _c;
66
66
  if (options === void 0) {
67
67
  options = {};
68
68
  }
@@ -139,6 +139,9 @@ function setCellValue(ctx, row, column, value, cellInput, options) {
139
139
  (0, _modules.setCellValue)(ctx, row, column, data, value);
140
140
  }
141
141
  }
142
+ if (callAfterUpdate && ctx.hooks.afterUpdateCell) {
143
+ (_c = (_b = ctx.hooks).afterUpdateCell) === null || _c === void 0 ? void 0 : _c.call(_b, row, column, null, value);
144
+ }
142
145
  }
143
146
  function clearCell(ctx, row, column, options) {
144
147
  var _a, _b;
@@ -18,5 +18,5 @@ export declare function getSelectionCoordinates(ctx: Context): string[];
18
18
  export declare function getCellsByRange(ctx: Context, range: Selection, options?: CommonOptions): (Cell | null)[][];
19
19
  export declare function getHtmlByRange(ctx: Context, range: Range, options?: CommonOptions): string | null;
20
20
  export declare function setSelection(ctx: Context, range: Range, options: CommonOptions): void;
21
- export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
21
+ export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions, callAfterUpdate?: boolean): void;
22
22
  export declare function setCellFormatByRange(ctx: Context, attr: keyof Cell, value: any, range: Range | SingleRange, options?: CommonOptions): void;
package/lib/api/range.js CHANGED
@@ -92,7 +92,7 @@ function setSelection(ctx, range, options) {
92
92
  ctx.luckysheet_select_save = sheet.luckysheet_select_save;
93
93
  }
94
94
  }
95
- function setCellValuesByRange(ctx, data, range, cellInput, options) {
95
+ function setCellValuesByRange(ctx, data, range, cellInput, options, callAfterUpdate) {
96
96
  if (options === void 0) {
97
97
  options = {};
98
98
  }
@@ -114,7 +114,7 @@ function setCellValuesByRange(ctx, data, range, cellInput, options) {
114
114
  for (var j = 0; j < columnCount; j += 1) {
115
115
  var row = range.row[0] + i;
116
116
  var column = range.column[0] + j;
117
- (0, _cell.setCellValue)(ctx, row, column, data[i][j], cellInput, options);
117
+ (0, _cell.setCellValue)(ctx, row, column, data[i][j], cellInput, options, callAfterUpdate);
118
118
  }
119
119
  }
120
120
  }
@@ -143,7 +143,7 @@ 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, _m, _o;
146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
147
147
  console.log("setCellValue", r, c, v);
148
148
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
149
149
  if (_lodash.default.isNil(d)) {
@@ -384,9 +384,6 @@ function setCellValue(ctx, r, c, d, v) {
384
384
  if (ctx.luckysheet_selection_range) {
385
385
  ctx.luckysheet_selection_range = [];
386
386
  }
387
- if (ctx.hooks.afterUpdateCell) {
388
- (_o = (_m = ctx.hooks).afterUpdateCell) === null || _o === void 0 ? void 0 : _o.call(_m, r, c, null, cell);
389
- }
390
387
  }
391
388
  function getRealCellValue(r, c, data, attr) {
392
389
  var value = getCellValue(r, c, data, "m");
@@ -836,6 +833,13 @@ function updateCell(ctx, r, c, $input, value, canvas) {
836
833
  if (isValueArray) {
837
834
  if ((0, _sort.spillSortResult)(ctx, r, c, value, d)) {
838
835
  cancelNormalSelected(ctx);
836
+ if (ctx.hooks.afterUpdateCell) {
837
+ var newValue_1 = _lodash.default.cloneDeep(d[r][c]);
838
+ setTimeout(function () {
839
+ var _a, _b;
840
+ return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
841
+ });
842
+ }
839
843
  ctx.formulaCache.execFunctionGlobalData = null;
840
844
  return;
841
845
  }
@@ -883,6 +887,13 @@ function updateCell(ctx, r, c, $input, value, canvas) {
883
887
  }
884
888
  }
885
889
  }
890
+ if (ctx.hooks.afterUpdateCell) {
891
+ var newValue_2 = _lodash.default.cloneDeep(flowdata[r][c]);
892
+ var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
893
+ setTimeout(function () {
894
+ afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_2);
895
+ });
896
+ }
886
897
  ctx.formulaCache.execFunctionGlobalData = null;
887
898
  }
888
899
  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.90-ydoc",
3
+ "version": "1.2.90-ydoc-2",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",