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

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,11 +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
- 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
- }
359
354
  }
360
355
  export function getRealCellValue(r, c, data, attr) {
361
356
  var value = getCellValue(r, c, data, "m");
@@ -805,6 +800,13 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
805
800
  if (isValueArray) {
806
801
  if (spillSortResult(ctx, r, c, value, d)) {
807
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
+ }
808
810
  ctx.formulaCache.execFunctionGlobalData = null;
809
811
  return;
810
812
  }
@@ -852,6 +854,13 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
852
854
  }
853
855
  }
854
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
+ }
855
864
  ctx.formulaCache.execFunctionGlobalData = null;
856
865
  }
857
866
  export function getOrigincell(ctx, r, c, i) {
@@ -42,7 +42,7 @@ export function changeSheet(ctx, id, isPivotInitial, isNewSheet, isCopySheet) {
42
42
  }
43
43
  }
44
44
  export function addSheet(ctx, settings, newSheetID, isPivotTable, sheetName, sheetData) {
45
- var _a, _b;
45
+ var _a, _b, _c, _d;
46
46
  if (newSheetID === void 0) {
47
47
  newSheetID = undefined;
48
48
  }
@@ -90,14 +90,11 @@ export function addSheet(ctx, settings, newSheetID, isPivotTable, sheetName, she
90
90
  changeSheet(ctx, id, isPivotTable, true);
91
91
  }
92
92
  if (ctx.hooks.afterAddSheet) {
93
- setTimeout(function () {
94
- var _a, _b;
95
- (_b = (_a = ctx.hooks).afterAddSheet) === null || _b === void 0 ? void 0 : _b.call(_a, sheetconfig);
96
- });
93
+ (_d = (_c = ctx.hooks).afterAddSheet) === null || _d === void 0 ? void 0 : _d.call(_c, sheetconfig);
97
94
  }
98
95
  }
99
96
  export function deleteSheet(ctx, id) {
100
- var _a, _b, _c;
97
+ var _a, _b, _c, _d, _e;
101
98
  if (ctx.allowEdit === false) {
102
99
  return;
103
100
  }
@@ -123,10 +120,7 @@ export function deleteSheet(ctx, id) {
123
120
  ctx.currentSheetId = (_c = orderSheets === null || orderSheets === void 0 ? void 0 : orderSheets[0]) === null || _c === void 0 ? void 0 : _c.id;
124
121
  }
125
122
  if (ctx.hooks.afterDeleteSheet) {
126
- setTimeout(function () {
127
- var _a, _b;
128
- (_b = (_a = ctx.hooks).afterDeleteSheet) === null || _b === void 0 ? void 0 : _b.call(_a, id);
129
- });
123
+ (_e = (_d = ctx.hooks).afterDeleteSheet) === null || _e === void 0 ? void 0 : _e.call(_d, id);
130
124
  }
131
125
  }
132
126
  export function updateSheet(ctx, newData) {
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,11 +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
- 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
- }
392
387
  }
393
388
  function getRealCellValue(r, c, data, attr) {
394
389
  var value = getCellValue(r, c, data, "m");
@@ -838,6 +833,13 @@ function updateCell(ctx, r, c, $input, value, canvas) {
838
833
  if (isValueArray) {
839
834
  if ((0, _sort.spillSortResult)(ctx, r, c, value, d)) {
840
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
+ }
841
843
  ctx.formulaCache.execFunctionGlobalData = null;
842
844
  return;
843
845
  }
@@ -885,6 +887,13 @@ function updateCell(ctx, r, c, $input, value, canvas) {
885
887
  }
886
888
  }
887
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
+ }
888
897
  ctx.formulaCache.execFunctionGlobalData = null;
889
898
  }
890
899
  function getOrigincell(ctx, r, c, i) {
@@ -55,7 +55,7 @@ function changeSheet(ctx, id, isPivotInitial, isNewSheet, isCopySheet) {
55
55
  }
56
56
  }
57
57
  function addSheet(ctx, settings, newSheetID, isPivotTable, sheetName, sheetData) {
58
- var _a, _b;
58
+ var _a, _b, _c, _d;
59
59
  if (newSheetID === void 0) {
60
60
  newSheetID = undefined;
61
61
  }
@@ -103,14 +103,11 @@ function addSheet(ctx, settings, newSheetID, isPivotTable, sheetName, sheetData)
103
103
  changeSheet(ctx, id, isPivotTable, true);
104
104
  }
105
105
  if (ctx.hooks.afterAddSheet) {
106
- setTimeout(function () {
107
- var _a, _b;
108
- (_b = (_a = ctx.hooks).afterAddSheet) === null || _b === void 0 ? void 0 : _b.call(_a, sheetconfig);
109
- });
106
+ (_d = (_c = ctx.hooks).afterAddSheet) === null || _d === void 0 ? void 0 : _d.call(_c, sheetconfig);
110
107
  }
111
108
  }
112
109
  function deleteSheet(ctx, id) {
113
- var _a, _b, _c;
110
+ var _a, _b, _c, _d, _e;
114
111
  if (ctx.allowEdit === false) {
115
112
  return;
116
113
  }
@@ -136,10 +133,7 @@ function deleteSheet(ctx, id) {
136
133
  ctx.currentSheetId = (_c = orderSheets === null || orderSheets === void 0 ? void 0 : orderSheets[0]) === null || _c === void 0 ? void 0 : _c.id;
137
134
  }
138
135
  if (ctx.hooks.afterDeleteSheet) {
139
- setTimeout(function () {
140
- var _a, _b;
141
- (_b = (_a = ctx.hooks).afterDeleteSheet) === null || _b === void 0 ? void 0 : _b.call(_a, id);
142
- });
136
+ (_e = (_d = ctx.hooks).afterDeleteSheet) === null || _e === void 0 ? void 0 : _e.call(_d, id);
143
137
  }
144
138
  }
145
139
  function updateSheet(ctx, newData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.90-ydoc-1",
3
+ "version": "1.2.90-ydoc-3",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",