@fileverse-dev/fortune-react 1.2.99-data-validation-fix-1 → 1.2.99-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.
@@ -15,7 +15,6 @@ import DynamicInputList from "./DropdownOption";
15
15
  import WorkbookContext from "../../context";
16
16
  import { useDialog } from "../../hooks/useDialog";
17
17
  import { injectDatepickerStyles } from "../../utils/datepickerStyles";
18
- import { findMatchingCells, cellsToRangeString } from "./helpers";
19
18
  import "./index.css";
20
19
  function createId() {
21
20
  return "".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2));
@@ -34,7 +33,7 @@ var DataVerification = function DataVerification() {
34
33
  button = _r.button,
35
34
  generalDialog = _r.generalDialog;
36
35
  var dateCondition = useState(["between", "notBetween", "equal", "notEqualTo", "earlierThan", "noEarlierThan", "laterThan", "noLaterThan"])[0];
37
- var getSheetIndex = useCallback(function () {
36
+ function getSheetIndex() {
38
37
  var _a;
39
38
  for (var i = 0; i < context.luckysheetfile.length; i += 1) {
40
39
  if (((_a = context.luckysheetfile[i]) === null || _a === void 0 ? void 0 : _a.id) === context.currentSheetId) {
@@ -42,7 +41,7 @@ var DataVerification = function DataVerification() {
42
41
  }
43
42
  }
44
43
  return null;
45
- }, [context.luckysheetfile, context.currentSheetId]);
44
+ }
46
45
  var _s = useState([]),
47
46
  optionItems = _s[0],
48
47
  setOptionItems = _s[1];
@@ -93,68 +92,45 @@ var DataVerification = function DataVerification() {
93
92
  ctx.rangeDialog.rangeTxt = value;
94
93
  });
95
94
  }, [hideDialog, setContext]);
96
- var applyValidation = useCallback(function (rangeString) {
97
- setContext(function (ctx) {
98
- var _a;
99
- var range = getRangeByTxt(ctx, rangeString);
100
- if (range.length === 0) {
101
- return;
102
- }
103
- var regulation = ctx.dataVerification.dataRegulation;
104
- var verifacationT = regulation === null || regulation === void 0 ? void 0 : regulation.type;
105
- var value1 = regulation.value1;
106
- var item = __assign(__assign({}, regulation), {
107
- checked: false
108
- });
109
- if (verifacationT === "dropdown") {
110
- var list = getDropdownList(ctx, value1);
111
- item.value1 = list.join(",");
112
- }
113
- var currentDataVerification = (_a = ctx.luckysheetfile[getSheetIndex()].dataVerification) !== null && _a !== void 0 ? _a : {};
114
- var d = getFlowdata(ctx);
115
- if (!d) return;
116
- for (var ri = 0; ri < range.length; ri += 1) {
117
- var str = range[ri].row[0];
118
- var edr = range[ri].row[1];
119
- var stc = range[ri].column[0];
120
- var edc = range[ri].column[1];
121
- for (var r = str; r <= edr; r += 1) {
122
- for (var c = stc; c <= edc; c += 1) {
123
- var key = "".concat(r, "_").concat(c);
124
- currentDataVerification[key] = item;
125
- if (regulation.type === "checkbox") {
126
- setCellValue(ctx, r, c, d, item.value2);
127
- }
128
- }
129
- }
130
- }
131
- ctx.luckysheetfile[getSheetIndex()].dataVerification = currentDataVerification;
132
- ctx.dataVerification.updateScope = undefined;
133
- ctx.dataVerification.sourceCell = undefined;
134
- });
135
- }, [getSheetIndex, setContext]);
136
95
  var btn = useCallback(function (type) {
137
- var _a, _b, _c;
138
96
  if (type === "confirm") {
139
- var isValid = confirmMessage(context, generalDialog, dataVerification);
140
- if (!isValid) return;
141
- var sourceCell = (_a = context.dataVerification) === null || _a === void 0 ? void 0 : _a.sourceCell;
142
- var modalRangeString_1 = (_c = (_b = context.dataVerification) === null || _b === void 0 ? void 0 : _b.dataRegulation) === null || _c === void 0 ? void 0 : _c.rangeTxt;
143
- if (sourceCell) {
144
- var matchingCells = findMatchingCells(context, sourceCell.row, sourceCell.col);
145
- if (matchingCells.length > 1) {
146
- var allMatchingRange_1 = cellsToRangeString(context, matchingCells);
147
- showDialog("Found ".concat(matchingCells.length, " cells with matching validation. Apply changes to:"), "yesno", "Apply Changes", "All Matching Cells", "Just Selected Range", function () {
148
- applyValidation(allMatchingRange_1);
149
- hideDialog();
150
- }, function () {
151
- applyValidation(modalRangeString_1);
152
- hideDialog();
97
+ setContext(function (ctx) {
98
+ var _a, _b, _c;
99
+ var isPass = confirmMessage(ctx, generalDialog, dataVerification);
100
+ if (isPass) {
101
+ var range = getRangeByTxt(ctx, (_b = (_a = ctx.dataVerification) === null || _a === void 0 ? void 0 : _a.dataRegulation) === null || _b === void 0 ? void 0 : _b.rangeTxt);
102
+ if (range.length === 0) {
103
+ return;
104
+ }
105
+ var regulation = ctx.dataVerification.dataRegulation;
106
+ var verifacationT = regulation === null || regulation === void 0 ? void 0 : regulation.type;
107
+ var value1 = regulation.value1;
108
+ var item = __assign(__assign({}, regulation), {
109
+ checked: false
153
110
  });
154
- return;
111
+ if (verifacationT === "dropdown") {
112
+ var list = getDropdownList(ctx, value1);
113
+ item.value1 = list.join(",");
114
+ }
115
+ var currentDataVerification = (_c = ctx.luckysheetfile[getSheetIndex()].dataVerification) !== null && _c !== void 0 ? _c : {};
116
+ var str = range[range.length - 1].row[0];
117
+ var edr = range[range.length - 1].row[1];
118
+ var stc = range[range.length - 1].column[0];
119
+ var edc = range[range.length - 1].column[1];
120
+ var d = getFlowdata(ctx);
121
+ if (!d) return;
122
+ for (var r = str; r <= edr; r += 1) {
123
+ for (var c = stc; c <= edc; c += 1) {
124
+ var key = "".concat(r, "_").concat(c);
125
+ currentDataVerification[key] = item;
126
+ if (regulation.type === "checkbox") {
127
+ setCellValue(ctx, r, c, d, item.value2);
128
+ }
129
+ }
130
+ }
131
+ ctx.luckysheetfile[getSheetIndex()].dataVerification = currentDataVerification;
155
132
  }
156
- }
157
- applyValidation(modalRangeString_1);
133
+ });
158
134
  } else if (type === "delete") {
159
135
  setContext(function (ctx) {
160
136
  var _a, _b, _c;
@@ -173,26 +149,17 @@ var DataVerification = function DataVerification() {
173
149
  delete currentDataVerification["".concat(r, "_").concat(c)];
174
150
  }
175
151
  }
176
- ctx.dataVerification.updateScope = undefined;
177
152
  });
178
153
  }
179
154
  hideDialog();
180
- }, [applyValidation, context, dataVerification, generalDialog, getSheetIndex, hideDialog, setContext, showDialog]);
155
+ }, [dataVerification, generalDialog, hideDialog, setContext, showDialog]);
181
156
  useEffect(function () {
182
157
  setContext(function (ctx) {
183
- var _a, _b, _c, _d;
158
+ var _a, _b, _c;
184
159
  var rangeT = "";
185
- var updateScope = ((_a = ctx.dataVerification) === null || _a === void 0 ? void 0 : _a.updateScope) || "current";
186
160
  if (ctx.luckysheet_select_save) {
187
161
  var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
188
- var rowIndex = range.row_focus;
189
- var colIndex = range.column_focus;
190
- if (updateScope === "all" && rowIndex != null && colIndex != null) {
191
- var matchingCells = findMatchingCells(ctx, rowIndex, colIndex);
192
- rangeT = cellsToRangeString(ctx, matchingCells);
193
- } else {
194
- rangeT = getRangetxt(context, context.currentSheetId, range, context.currentSheetId);
195
- }
162
+ rangeT = getRangetxt(context, context.currentSheetId, range, context.currentSheetId);
196
163
  }
197
164
  var index = getSheetIndex();
198
165
  var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
@@ -202,17 +169,13 @@ var DataVerification = function DataVerification() {
202
169
  var rowIndex = last.row_focus;
203
170
  var colIndex = last.column_focus;
204
171
  if (rowIndex == null || colIndex == null) return;
205
- ctx.dataVerification.sourceCell = {
206
- row: rowIndex,
207
- col: colIndex
208
- };
209
172
  var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
210
173
  var defaultItem = item !== null && item !== void 0 ? item : {};
211
- var rangValue = (_b = defaultItem.value1) !== null && _b !== void 0 ? _b : "";
212
- if (((_c = ctx.rangeDialog) === null || _c === void 0 ? void 0 : _c.type) === "dropDown" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.rangeTxt) {
174
+ var rangValue = (_a = defaultItem.value1) !== null && _a !== void 0 ? _a : "";
175
+ if (((_b = ctx.rangeDialog) === null || _b === void 0 ? void 0 : _b.type) === "dropDown" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.rangeTxt) {
213
176
  rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
214
177
  rangValue = ctx.rangeDialog.rangeTxt;
215
- } else if (((_d = ctx.rangeDialog) === null || _d === void 0 ? void 0 : _d.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
178
+ } else if (((_c = ctx.rangeDialog) === null || _c === void 0 ? void 0 : _c.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
216
179
  rangValue = ctx.dataVerification.dataRegulation.value1;
217
180
  rangeT = ctx.rangeDialog.rangeTxt;
218
181
  }
@@ -288,7 +288,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
288
288
  if (isButtonDisabled) return;
289
289
  _.set(refs.globalCache, "linkCard.mouseEnter", false);
290
290
  setContext(function (draftCtx) {
291
- return saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress);
291
+ saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress);
292
292
  });
293
293
  },
294
294
  "data-testid": "link-card-cta-insert"
@@ -149,7 +149,7 @@ var Sheet = function Sheet(_a) {
149
149
  return function () {
150
150
  return cellFadeAnimator.setOnTick(null);
151
151
  };
152
- }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
152
+ }, [context.scrollLeft, context.scrollTop, context.rowHeaderWidth, context.columnHeaderHeight, context.visibledatarow, context.visibledatacolumn, context.config, context.currentSheetId, context.luckysheetfile, context.zoomRatio, context.devicePixelRatio, context.showGridLines, context.luckysheetTableContentHW, context.defaultFontSize, context.defaultcollen, context.ch_width, context.luckysheetcurrentisPivotTable, context.hooks, refs.canvas, sheet.id]);
153
153
  useSmoothScroll(containerRef);
154
154
  return /*#__PURE__*/React.createElement("div", {
155
155
  ref: containerRef,
@@ -12,7 +12,6 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
12
12
  return window.devicePixelRatio || 1;
13
13
  };
14
14
  }
15
- console.log("handleScroll called 6.2");
16
15
  var queuedXPixels = 0;
17
16
  var queuedYPixels = 0;
18
17
  var animationFrameId = 0;
@@ -345,7 +345,6 @@ export var CurrencySelector = function CurrencySelector(_a) {
345
345
  value: searchTerm,
346
346
  onValueChange: function onValueChange(value) {
347
347
  setSearchTerm(value);
348
- console.log(value, "djksfgnkjsedfngskjn");
349
348
  }
350
349
  })), /*#__PURE__*/React.createElement("div", {
351
350
  className: "px-4 py-2 border-b color-border-default flex items-center justify-between gap-2 text-body-sm color-text-default",
@@ -14,7 +14,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
14
14
  removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
15
15
  setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
16
16
  type?: keyof Cell;
17
- }) => void;
17
+ }, callAfterUpdate?: boolean) => void;
18
18
  setCellError: (row: number, column: number, errorMessage: {
19
19
  title: string;
20
20
  message: string;
@@ -51,7 +51,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
51
51
  getCellsByRange: (range: Selection, options?: api.CommonOptions) => (Cell | null)[][];
52
52
  getHtmlByRange: (range: Range, options?: api.CommonOptions) => string | null;
53
53
  setSelection: (range: Range, options?: api.CommonOptions) => void;
54
- setCellValuesByRange: (data: any[][], range: SingleRange, options?: api.CommonOptions) => void;
54
+ setCellValuesByRange: (data: any[][], range: SingleRange, options?: api.CommonOptions, cellAfter?: boolean) => void;
55
55
  setCellFormatByRange: (attr: keyof Cell, value: any, range: Range | SingleRange, options?: api.CommonOptions) => void;
56
56
  mergeCells: (ranges: Range, type: string, options?: api.CommonOptions) => void;
57
57
  cancelMerge: (ranges: Range, options?: api.CommonOptions) => void;
@@ -134,12 +134,12 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
134
134
  });
135
135
  });
136
136
  },
137
- setCellValue: function setCellValue(row, column, value, options) {
137
+ setCellValue: function setCellValue(row, column, value, options, callAfterUpdate) {
138
138
  if (options === void 0) {
139
139
  options = {};
140
140
  }
141
141
  return setContext(function (draftCtx) {
142
- return api.setCellValue(draftCtx, row, column, value, cellInput, options);
142
+ return api.setCellValue(draftCtx, row, column, value, cellInput, options, callAfterUpdate);
143
143
  });
144
144
  },
145
145
  setCellError: function setCellError(row, column, errorMessage) {
@@ -276,12 +276,12 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
276
276
  return api.setSelection(draftCtx, range, options);
277
277
  });
278
278
  },
279
- setCellValuesByRange: function setCellValuesByRange(data, range, options) {
279
+ setCellValuesByRange: function setCellValuesByRange(data, range, options, cellAfter) {
280
280
  if (options === void 0) {
281
281
  options = {};
282
282
  }
283
283
  return setContext(function (draftCtx) {
284
- return api.setCellValuesByRange(draftCtx, data, range, cellInput, options);
284
+ return api.setCellValuesByRange(draftCtx, data, range, cellInput, options, cellAfter);
285
285
  });
286
286
  },
287
287
  setCellFormatByRange: function setCellFormatByRange(attr, value, range, options) {
@@ -390,7 +390,6 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
390
390
  });
391
391
  },
392
392
  calculateCellReferencedSubSheetFormula: function calculateCellReferencedSubSheetFormula(id, refCell) {
393
- console.log("calculateCellReferencedSubSheetFormula", id, refCell);
394
393
  setContext(function (draftCtx) {
395
394
  api.calculateReferencedCellSheetFromula(draftCtx, id, refCell);
396
395
  });
@@ -21,7 +21,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
21
21
  removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
22
22
  setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
23
23
  type?: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
24
- }) => void;
24
+ }, callAfterUpdate?: boolean | undefined) => void;
25
25
  setCellError: (row: number, column: number, errorMessage: {
26
26
  title: string;
27
27
  message: string;
@@ -58,7 +58,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
58
58
  getCellsByRange: (range: import("@fileverse-dev/fortune-core").Selection, options?: api.CommonOptions) => (import("@fileverse-dev/fortune-core").Cell | null)[][];
59
59
  getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
60
60
  setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
61
- setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
61
+ setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions, cellAfter?: boolean | undefined) => void;
62
62
  setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").Range | import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
63
63
  mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
64
64
  cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
@@ -390,6 +390,120 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
390
390
  refs: refs
391
391
  };
392
392
  }, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce]);
393
+ useEffect(function () {
394
+ var _a;
395
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.sheetLengthChange) {
396
+ context.hooks.sheetLengthChange();
397
+ }
398
+ }, [context.luckysheetfile.length]);
399
+ var currentSheet = useMemo(function () {
400
+ var _a;
401
+ return (_a = context === null || context === void 0 ? void 0 : context.luckysheetfile) === null || _a === void 0 ? void 0 : _a.find(function (sheet) {
402
+ return sheet.id === (context === null || context === void 0 ? void 0 : context.currentSheetId);
403
+ });
404
+ }, [context === null || context === void 0 ? void 0 : context.luckysheetfile, context === null || context === void 0 ? void 0 : context.currentSheetId]);
405
+ useEffect(function () {
406
+ var _a;
407
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.calcChainChange) {
408
+ context.hooks.calcChainChange();
409
+ }
410
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.calcChain]);
411
+ useEffect(function () {
412
+ var _a;
413
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterImagesChange) {
414
+ context.hooks.afterImagesChange();
415
+ }
416
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.images]);
417
+ useEffect(function () {
418
+ var _a;
419
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterIframesChange) {
420
+ context.hooks.afterIframesChange();
421
+ }
422
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.iframes]);
423
+ useEffect(function () {
424
+ var _a;
425
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterFrozenChange) {
426
+ context.hooks.afterFrozenChange();
427
+ }
428
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.frozen]);
429
+ useEffect(function () {
430
+ var _a;
431
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterOrderChanges) {
432
+ context.hooks.afterOrderChanges();
433
+ }
434
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.order]);
435
+ useEffect(function () {
436
+ var _a;
437
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterConfigChanges) {
438
+ context.hooks.afterConfigChanges();
439
+ }
440
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.config]);
441
+ useEffect(function () {
442
+ var _a;
443
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterColRowChanges) {
444
+ context.hooks.afterColRowChanges();
445
+ }
446
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.row, currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.column]);
447
+ useEffect(function () {
448
+ var _a;
449
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterShowGridLinesChange) {
450
+ context.hooks.afterShowGridLinesChange();
451
+ }
452
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.showGridLines]);
453
+ useEffect(function () {
454
+ var _a;
455
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterNameChanges) {
456
+ context.hooks.afterNameChanges();
457
+ }
458
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.name]);
459
+ useEffect(function () {
460
+ var _a;
461
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterStatusChanges) {
462
+ context.hooks.afterStatusChanges();
463
+ }
464
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.status]);
465
+ useEffect(function () {
466
+ var _a;
467
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.dataVerificationChange) {
468
+ context.hooks.dataVerificationChange();
469
+ }
470
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.dataVerification]);
471
+ useEffect(function () {
472
+ var _a;
473
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.liveQueryChange) {
474
+ context.hooks.liveQueryChange();
475
+ }
476
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.liveQueryList]);
477
+ useEffect(function () {
478
+ var _a;
479
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.imageListChange) {
480
+ context.hooks.imageListChange();
481
+ }
482
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.images]);
483
+ useEffect(function () {
484
+ var _a;
485
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.iframeListChange) {
486
+ context.hooks.iframeListChange();
487
+ }
488
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.iframes]);
489
+ useEffect(function () {
490
+ var _a;
491
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.conditionRulesChange) {
492
+ context.hooks.conditionRulesChange();
493
+ }
494
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.conditionRules]);
495
+ useEffect(function () {
496
+ var _a;
497
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.conditionFormatChange) {
498
+ context.hooks.conditionFormatChange();
499
+ }
500
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.luckysheet_conditionformat_save]);
501
+ useEffect(function () {
502
+ var _a;
503
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.hyperlinkChange) {
504
+ context.hooks.hyperlinkChange();
505
+ }
506
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.hyperlink]);
393
507
  useEffect(function () {
394
508
  if (!_.isEmpty(context.luckysheetfile)) {
395
509
  onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
@@ -12,7 +12,6 @@ var _DropdownOption = _interopRequireDefault(require("./DropdownOption"));
12
12
  var _context = _interopRequireDefault(require("../../context"));
13
13
  var _useDialog = require("../../hooks/useDialog");
14
14
  var _datepickerStyles = require("../../utils/datepickerStyles");
15
- var _helpers = require("./helpers");
16
15
  require("./index.css");
17
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
17
  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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -43,7 +42,7 @@ var DataVerification = function DataVerification() {
43
42
  button = _r.button,
44
43
  generalDialog = _r.generalDialog;
45
44
  var dateCondition = (0, _react.useState)(["between", "notBetween", "equal", "notEqualTo", "earlierThan", "noEarlierThan", "laterThan", "noLaterThan"])[0];
46
- var getSheetIndex = (0, _react.useCallback)(function () {
45
+ function getSheetIndex() {
47
46
  var _a;
48
47
  for (var i = 0; i < context.luckysheetfile.length; i += 1) {
49
48
  if (((_a = context.luckysheetfile[i]) === null || _a === void 0 ? void 0 : _a.id) === context.currentSheetId) {
@@ -51,7 +50,7 @@ var DataVerification = function DataVerification() {
51
50
  }
52
51
  }
53
52
  return null;
54
- }, [context.luckysheetfile, context.currentSheetId]);
53
+ }
55
54
  var _s = (0, _react.useState)([]),
56
55
  optionItems = _s[0],
57
56
  setOptionItems = _s[1];
@@ -102,68 +101,45 @@ var DataVerification = function DataVerification() {
102
101
  ctx.rangeDialog.rangeTxt = value;
103
102
  });
104
103
  }, [hideDialog, setContext]);
105
- var applyValidation = (0, _react.useCallback)(function (rangeString) {
106
- setContext(function (ctx) {
107
- var _a;
108
- var range = (0, _fortuneCore.getRangeByTxt)(ctx, rangeString);
109
- if (range.length === 0) {
110
- return;
111
- }
112
- var regulation = ctx.dataVerification.dataRegulation;
113
- var verifacationT = regulation === null || regulation === void 0 ? void 0 : regulation.type;
114
- var value1 = regulation.value1;
115
- var item = __assign(__assign({}, regulation), {
116
- checked: false
117
- });
118
- if (verifacationT === "dropdown") {
119
- var list = (0, _fortuneCore.getDropdownList)(ctx, value1);
120
- item.value1 = list.join(",");
121
- }
122
- var currentDataVerification = (_a = ctx.luckysheetfile[getSheetIndex()].dataVerification) !== null && _a !== void 0 ? _a : {};
123
- var d = (0, _fortuneCore.getFlowdata)(ctx);
124
- if (!d) return;
125
- for (var ri = 0; ri < range.length; ri += 1) {
126
- var str = range[ri].row[0];
127
- var edr = range[ri].row[1];
128
- var stc = range[ri].column[0];
129
- var edc = range[ri].column[1];
130
- for (var r = str; r <= edr; r += 1) {
131
- for (var c = stc; c <= edc; c += 1) {
132
- var key = "".concat(r, "_").concat(c);
133
- currentDataVerification[key] = item;
134
- if (regulation.type === "checkbox") {
135
- (0, _fortuneCore.setCellValue)(ctx, r, c, d, item.value2);
136
- }
137
- }
138
- }
139
- }
140
- ctx.luckysheetfile[getSheetIndex()].dataVerification = currentDataVerification;
141
- ctx.dataVerification.updateScope = undefined;
142
- ctx.dataVerification.sourceCell = undefined;
143
- });
144
- }, [getSheetIndex, setContext]);
145
104
  var btn = (0, _react.useCallback)(function (type) {
146
- var _a, _b, _c;
147
105
  if (type === "confirm") {
148
- var isValid = (0, _fortuneCore.confirmMessage)(context, generalDialog, dataVerification);
149
- if (!isValid) return;
150
- var sourceCell = (_a = context.dataVerification) === null || _a === void 0 ? void 0 : _a.sourceCell;
151
- var modalRangeString_1 = (_c = (_b = context.dataVerification) === null || _b === void 0 ? void 0 : _b.dataRegulation) === null || _c === void 0 ? void 0 : _c.rangeTxt;
152
- if (sourceCell) {
153
- var matchingCells = (0, _helpers.findMatchingCells)(context, sourceCell.row, sourceCell.col);
154
- if (matchingCells.length > 1) {
155
- var allMatchingRange_1 = (0, _helpers.cellsToRangeString)(context, matchingCells);
156
- showDialog("Found ".concat(matchingCells.length, " cells with matching validation. Apply changes to:"), "yesno", "Apply Changes", "All Matching Cells", "Just Selected Range", function () {
157
- applyValidation(allMatchingRange_1);
158
- hideDialog();
159
- }, function () {
160
- applyValidation(modalRangeString_1);
161
- hideDialog();
106
+ setContext(function (ctx) {
107
+ var _a, _b, _c;
108
+ var isPass = (0, _fortuneCore.confirmMessage)(ctx, generalDialog, dataVerification);
109
+ if (isPass) {
110
+ var range = (0, _fortuneCore.getRangeByTxt)(ctx, (_b = (_a = ctx.dataVerification) === null || _a === void 0 ? void 0 : _a.dataRegulation) === null || _b === void 0 ? void 0 : _b.rangeTxt);
111
+ if (range.length === 0) {
112
+ return;
113
+ }
114
+ var regulation = ctx.dataVerification.dataRegulation;
115
+ var verifacationT = regulation === null || regulation === void 0 ? void 0 : regulation.type;
116
+ var value1 = regulation.value1;
117
+ var item = __assign(__assign({}, regulation), {
118
+ checked: false
162
119
  });
163
- return;
120
+ if (verifacationT === "dropdown") {
121
+ var list = (0, _fortuneCore.getDropdownList)(ctx, value1);
122
+ item.value1 = list.join(",");
123
+ }
124
+ var currentDataVerification = (_c = ctx.luckysheetfile[getSheetIndex()].dataVerification) !== null && _c !== void 0 ? _c : {};
125
+ var str = range[range.length - 1].row[0];
126
+ var edr = range[range.length - 1].row[1];
127
+ var stc = range[range.length - 1].column[0];
128
+ var edc = range[range.length - 1].column[1];
129
+ var d = (0, _fortuneCore.getFlowdata)(ctx);
130
+ if (!d) return;
131
+ for (var r = str; r <= edr; r += 1) {
132
+ for (var c = stc; c <= edc; c += 1) {
133
+ var key = "".concat(r, "_").concat(c);
134
+ currentDataVerification[key] = item;
135
+ if (regulation.type === "checkbox") {
136
+ (0, _fortuneCore.setCellValue)(ctx, r, c, d, item.value2);
137
+ }
138
+ }
139
+ }
140
+ ctx.luckysheetfile[getSheetIndex()].dataVerification = currentDataVerification;
164
141
  }
165
- }
166
- applyValidation(modalRangeString_1);
142
+ });
167
143
  } else if (type === "delete") {
168
144
  setContext(function (ctx) {
169
145
  var _a, _b, _c;
@@ -182,26 +158,17 @@ var DataVerification = function DataVerification() {
182
158
  delete currentDataVerification["".concat(r, "_").concat(c)];
183
159
  }
184
160
  }
185
- ctx.dataVerification.updateScope = undefined;
186
161
  });
187
162
  }
188
163
  hideDialog();
189
- }, [applyValidation, context, dataVerification, generalDialog, getSheetIndex, hideDialog, setContext, showDialog]);
164
+ }, [dataVerification, generalDialog, hideDialog, setContext, showDialog]);
190
165
  (0, _react.useEffect)(function () {
191
166
  setContext(function (ctx) {
192
- var _a, _b, _c, _d;
167
+ var _a, _b, _c;
193
168
  var rangeT = "";
194
- var updateScope = ((_a = ctx.dataVerification) === null || _a === void 0 ? void 0 : _a.updateScope) || "current";
195
169
  if (ctx.luckysheet_select_save) {
196
170
  var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
197
- var rowIndex = range.row_focus;
198
- var colIndex = range.column_focus;
199
- if (updateScope === "all" && rowIndex != null && colIndex != null) {
200
- var matchingCells = (0, _helpers.findMatchingCells)(ctx, rowIndex, colIndex);
201
- rangeT = (0, _helpers.cellsToRangeString)(ctx, matchingCells);
202
- } else {
203
- rangeT = (0, _fortuneCore.getRangetxt)(context, context.currentSheetId, range, context.currentSheetId);
204
- }
171
+ rangeT = (0, _fortuneCore.getRangetxt)(context, context.currentSheetId, range, context.currentSheetId);
205
172
  }
206
173
  var index = getSheetIndex();
207
174
  var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
@@ -211,17 +178,13 @@ var DataVerification = function DataVerification() {
211
178
  var rowIndex = last.row_focus;
212
179
  var colIndex = last.column_focus;
213
180
  if (rowIndex == null || colIndex == null) return;
214
- ctx.dataVerification.sourceCell = {
215
- row: rowIndex,
216
- col: colIndex
217
- };
218
181
  var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
219
182
  var defaultItem = item !== null && item !== void 0 ? item : {};
220
- var rangValue = (_b = defaultItem.value1) !== null && _b !== void 0 ? _b : "";
221
- if (((_c = ctx.rangeDialog) === null || _c === void 0 ? void 0 : _c.type) === "dropDown" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.rangeTxt) {
183
+ var rangValue = (_a = defaultItem.value1) !== null && _a !== void 0 ? _a : "";
184
+ if (((_b = ctx.rangeDialog) === null || _b === void 0 ? void 0 : _b.type) === "dropDown" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.rangeTxt) {
222
185
  rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
223
186
  rangValue = ctx.rangeDialog.rangeTxt;
224
- } else if (((_d = ctx.rangeDialog) === null || _d === void 0 ? void 0 : _d.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
187
+ } else if (((_c = ctx.rangeDialog) === null || _c === void 0 ? void 0 : _c.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
225
188
  rangValue = ctx.dataVerification.dataRegulation.value1;
226
189
  rangeT = ctx.rangeDialog.rangeTxt;
227
190
  }
@@ -297,7 +297,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
297
297
  if (isButtonDisabled) return;
298
298
  _lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
299
299
  setContext(function (draftCtx) {
300
- return (0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
300
+ (0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
301
301
  });
302
302
  },
303
303
  "data-testid": "link-card-cta-insert"
@@ -158,7 +158,7 @@ var Sheet = function Sheet(_a) {
158
158
  return function () {
159
159
  return _fortuneCore.cellFadeAnimator.setOnTick(null);
160
160
  };
161
- }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
161
+ }, [context.scrollLeft, context.scrollTop, context.rowHeaderWidth, context.columnHeaderHeight, context.visibledatarow, context.visibledatacolumn, context.config, context.currentSheetId, context.luckysheetfile, context.zoomRatio, context.devicePixelRatio, context.showGridLines, context.luckysheetTableContentHW, context.defaultFontSize, context.defaultcollen, context.ch_width, context.luckysheetcurrentisPivotTable, context.hooks, refs.canvas, sheet.id]);
162
162
  (0, _useSmoothScroll.useSmoothScroll)(containerRef);
163
163
  return /*#__PURE__*/_react.default.createElement("div", {
164
164
  ref: containerRef,
@@ -19,7 +19,6 @@ var useSmoothScroll = exports.useSmoothScroll = function useSmoothScroll(scrollC
19
19
  return window.devicePixelRatio || 1;
20
20
  };
21
21
  }
22
- console.log("handleScroll called 6.2");
23
22
  var queuedXPixels = 0;
24
23
  var queuedYPixels = 0;
25
24
  var animationFrameId = 0;
@@ -354,7 +354,6 @@ var CurrencySelector = exports.CurrencySelector = function CurrencySelector(_a)
354
354
  value: searchTerm,
355
355
  onValueChange: function onValueChange(value) {
356
356
  setSearchTerm(value);
357
- console.log(value, "djksfgnkjsedfngskjn");
358
357
  }
359
358
  })), /*#__PURE__*/_react.default.createElement("div", {
360
359
  className: "px-4 py-2 border-b color-border-default flex items-center justify-between gap-2 text-body-sm color-text-default",
@@ -14,7 +14,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
14
14
  removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
15
15
  setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
16
16
  type?: keyof Cell;
17
- }) => void;
17
+ }, callAfterUpdate?: boolean) => void;
18
18
  setCellError: (row: number, column: number, errorMessage: {
19
19
  title: string;
20
20
  message: string;
@@ -51,7 +51,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
51
51
  getCellsByRange: (range: Selection, options?: api.CommonOptions) => (Cell | null)[][];
52
52
  getHtmlByRange: (range: Range, options?: api.CommonOptions) => string | null;
53
53
  setSelection: (range: Range, options?: api.CommonOptions) => void;
54
- setCellValuesByRange: (data: any[][], range: SingleRange, options?: api.CommonOptions) => void;
54
+ setCellValuesByRange: (data: any[][], range: SingleRange, options?: api.CommonOptions, cellAfter?: boolean) => void;
55
55
  setCellFormatByRange: (attr: keyof Cell, value: any, range: Range | SingleRange, options?: api.CommonOptions) => void;
56
56
  mergeCells: (ranges: Range, type: string, options?: api.CommonOptions) => void;
57
57
  cancelMerge: (ranges: Range, options?: api.CommonOptions) => void;
@@ -141,12 +141,12 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
141
141
  });
142
142
  });
143
143
  },
144
- setCellValue: function setCellValue(row, column, value, options) {
144
+ setCellValue: function setCellValue(row, column, value, options, callAfterUpdate) {
145
145
  if (options === void 0) {
146
146
  options = {};
147
147
  }
148
148
  return setContext(function (draftCtx) {
149
- return _fortuneCore.api.setCellValue(draftCtx, row, column, value, cellInput, options);
149
+ return _fortuneCore.api.setCellValue(draftCtx, row, column, value, cellInput, options, callAfterUpdate);
150
150
  });
151
151
  },
152
152
  setCellError: function setCellError(row, column, errorMessage) {
@@ -283,12 +283,12 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
283
283
  return _fortuneCore.api.setSelection(draftCtx, range, options);
284
284
  });
285
285
  },
286
- setCellValuesByRange: function setCellValuesByRange(data, range, options) {
286
+ setCellValuesByRange: function setCellValuesByRange(data, range, options, cellAfter) {
287
287
  if (options === void 0) {
288
288
  options = {};
289
289
  }
290
290
  return setContext(function (draftCtx) {
291
- return _fortuneCore.api.setCellValuesByRange(draftCtx, data, range, cellInput, options);
291
+ return _fortuneCore.api.setCellValuesByRange(draftCtx, data, range, cellInput, options, cellAfter);
292
292
  });
293
293
  },
294
294
  setCellFormatByRange: function setCellFormatByRange(attr, value, range, options) {
@@ -397,7 +397,6 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
397
397
  });
398
398
  },
399
399
  calculateCellReferencedSubSheetFormula: function calculateCellReferencedSubSheetFormula(id, refCell) {
400
- console.log("calculateCellReferencedSubSheetFormula", id, refCell);
401
400
  setContext(function (draftCtx) {
402
401
  _fortuneCore.api.calculateReferencedCellSheetFromula(draftCtx, id, refCell);
403
402
  });
@@ -21,7 +21,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
21
21
  removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
22
22
  setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
23
23
  type?: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
24
- }) => void;
24
+ }, callAfterUpdate?: boolean | undefined) => void;
25
25
  setCellError: (row: number, column: number, errorMessage: {
26
26
  title: string;
27
27
  message: string;
@@ -58,7 +58,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
58
58
  getCellsByRange: (range: import("@fileverse-dev/fortune-core").Selection, options?: api.CommonOptions) => (import("@fileverse-dev/fortune-core").Cell | null)[][];
59
59
  getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
60
60
  setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
61
- setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
61
+ setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions, cellAfter?: boolean | undefined) => void;
62
62
  setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").Range | import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
63
63
  mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
64
64
  cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
@@ -399,6 +399,120 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
399
399
  refs: refs
400
400
  };
401
401
  }, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce]);
402
+ (0, _react.useEffect)(function () {
403
+ var _a;
404
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.sheetLengthChange) {
405
+ context.hooks.sheetLengthChange();
406
+ }
407
+ }, [context.luckysheetfile.length]);
408
+ var currentSheet = (0, _react.useMemo)(function () {
409
+ var _a;
410
+ return (_a = context === null || context === void 0 ? void 0 : context.luckysheetfile) === null || _a === void 0 ? void 0 : _a.find(function (sheet) {
411
+ return sheet.id === (context === null || context === void 0 ? void 0 : context.currentSheetId);
412
+ });
413
+ }, [context === null || context === void 0 ? void 0 : context.luckysheetfile, context === null || context === void 0 ? void 0 : context.currentSheetId]);
414
+ (0, _react.useEffect)(function () {
415
+ var _a;
416
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.calcChainChange) {
417
+ context.hooks.calcChainChange();
418
+ }
419
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.calcChain]);
420
+ (0, _react.useEffect)(function () {
421
+ var _a;
422
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterImagesChange) {
423
+ context.hooks.afterImagesChange();
424
+ }
425
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.images]);
426
+ (0, _react.useEffect)(function () {
427
+ var _a;
428
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterIframesChange) {
429
+ context.hooks.afterIframesChange();
430
+ }
431
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.iframes]);
432
+ (0, _react.useEffect)(function () {
433
+ var _a;
434
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterFrozenChange) {
435
+ context.hooks.afterFrozenChange();
436
+ }
437
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.frozen]);
438
+ (0, _react.useEffect)(function () {
439
+ var _a;
440
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterOrderChanges) {
441
+ context.hooks.afterOrderChanges();
442
+ }
443
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.order]);
444
+ (0, _react.useEffect)(function () {
445
+ var _a;
446
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterConfigChanges) {
447
+ context.hooks.afterConfigChanges();
448
+ }
449
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.config]);
450
+ (0, _react.useEffect)(function () {
451
+ var _a;
452
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterColRowChanges) {
453
+ context.hooks.afterColRowChanges();
454
+ }
455
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.row, currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.column]);
456
+ (0, _react.useEffect)(function () {
457
+ var _a;
458
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterShowGridLinesChange) {
459
+ context.hooks.afterShowGridLinesChange();
460
+ }
461
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.showGridLines]);
462
+ (0, _react.useEffect)(function () {
463
+ var _a;
464
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterNameChanges) {
465
+ context.hooks.afterNameChanges();
466
+ }
467
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.name]);
468
+ (0, _react.useEffect)(function () {
469
+ var _a;
470
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.afterStatusChanges) {
471
+ context.hooks.afterStatusChanges();
472
+ }
473
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.status]);
474
+ (0, _react.useEffect)(function () {
475
+ var _a;
476
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.dataVerificationChange) {
477
+ context.hooks.dataVerificationChange();
478
+ }
479
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.dataVerification]);
480
+ (0, _react.useEffect)(function () {
481
+ var _a;
482
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.liveQueryChange) {
483
+ context.hooks.liveQueryChange();
484
+ }
485
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.liveQueryList]);
486
+ (0, _react.useEffect)(function () {
487
+ var _a;
488
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.imageListChange) {
489
+ context.hooks.imageListChange();
490
+ }
491
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.images]);
492
+ (0, _react.useEffect)(function () {
493
+ var _a;
494
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.iframeListChange) {
495
+ context.hooks.iframeListChange();
496
+ }
497
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.iframes]);
498
+ (0, _react.useEffect)(function () {
499
+ var _a;
500
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.conditionRulesChange) {
501
+ context.hooks.conditionRulesChange();
502
+ }
503
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.conditionRules]);
504
+ (0, _react.useEffect)(function () {
505
+ var _a;
506
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.conditionFormatChange) {
507
+ context.hooks.conditionFormatChange();
508
+ }
509
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.luckysheet_conditionformat_save]);
510
+ (0, _react.useEffect)(function () {
511
+ var _a;
512
+ if ((_a = context === null || context === void 0 ? void 0 : context.hooks) === null || _a === void 0 ? void 0 : _a.hyperlinkChange) {
513
+ context.hooks.hyperlinkChange();
514
+ }
515
+ }, [currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.hyperlink]);
402
516
  (0, _react.useEffect)(function () {
403
517
  if (!_lodash.default.isEmpty(context.luckysheetfile)) {
404
518
  onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.99-data-validation-fix-1",
3
+ "version": "1.2.99-ydoc-1",
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.2.99-data-validation-fix-1",
19
+ "@fileverse-dev/fortune-core": "1.2.99-ydoc-1",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",
@@ -1,9 +0,0 @@
1
- import { Context } from "@fileverse-dev/fortune-core";
2
- export declare function findMatchingCells(ctx: Context, currentRow: number, currentCol: number): {
3
- row: number;
4
- col: number;
5
- }[];
6
- export declare function cellsToRangeString(ctx: Context, cells: {
7
- row: number;
8
- col: number;
9
- }[]): string;
@@ -1,69 +0,0 @@
1
- var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
2
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
- if (ar || !(i in from)) {
4
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
- ar[i] = from[i];
6
- }
7
- }
8
- return to.concat(ar || Array.prototype.slice.call(from));
9
- };
10
- import { getSheetIndex, getRangetxt, indexToColumnChar } from "@fileverse-dev/fortune-core";
11
- export function findMatchingCells(ctx, currentRow, currentCol) {
12
- var _a;
13
- var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
14
- var dataVerification = (_a = ctx.luckysheetfile[sheetIndex].dataVerification) !== null && _a !== void 0 ? _a : {};
15
- var currentValidation = dataVerification["".concat(currentRow, "_").concat(currentCol)];
16
- if (!currentValidation) return [];
17
- var matchingCells = [];
18
- Object.keys(dataVerification).forEach(function (key) {
19
- var _a = key.split("_").map(Number),
20
- r = _a[0],
21
- c = _a[1];
22
- var validation = dataVerification[key];
23
- if (validation.type === currentValidation.type && validation.type2 === currentValidation.type2 && validation.value1 === currentValidation.value1 && validation.value2 === currentValidation.value2 && validation.color === currentValidation.color && validation.validity === currentValidation.validity && validation.remote === currentValidation.remote && validation.prohibitInput === currentValidation.prohibitInput && validation.hintShow === currentValidation.hintShow && validation.hintValue === currentValidation.hintValue) {
24
- matchingCells.push({
25
- row: r,
26
- col: c
27
- });
28
- }
29
- });
30
- return matchingCells;
31
- }
32
- export function cellsToRangeString(ctx, cells) {
33
- if (cells.length === 0) return "";
34
- if (cells.length === 1) {
35
- return indexToColumnChar(cells[0].col) + (cells[0].row + 1);
36
- }
37
- var sorted = __spreadArray([], cells, true).sort(function (a, b) {
38
- return a.row === b.row ? a.col - b.col : a.row - b.row;
39
- });
40
- var ranges = [];
41
- var startRow = sorted[0].row;
42
- var endRow = sorted[0].row;
43
- var startCol = sorted[0].col;
44
- var endCol = sorted[0].col;
45
- for (var i = 1; i < sorted.length; i++) {
46
- var _a = sorted[i],
47
- row = _a.row,
48
- col = _a.col;
49
- if (col === startCol && col === endCol && row === endRow + 1) {
50
- endRow = row;
51
- } else if (row === startRow && row === endRow && col === endCol + 1) {
52
- endCol = col;
53
- } else {
54
- var range_1 = getRangetxt(ctx, ctx.currentSheetId, {
55
- row: [startRow, endRow],
56
- column: [startCol, endCol]
57
- });
58
- ranges.push(range_1);
59
- startRow = endRow = row;
60
- startCol = endCol = col;
61
- }
62
- }
63
- var range = getRangetxt(ctx, ctx.currentSheetId, {
64
- row: [startRow, endRow],
65
- column: [startCol, endCol]
66
- });
67
- ranges.push(range);
68
- return ranges.join(",");
69
- }
@@ -1,9 +0,0 @@
1
- import { Context } from "@fileverse-dev/fortune-core";
2
- export declare function findMatchingCells(ctx: Context, currentRow: number, currentCol: number): {
3
- row: number;
4
- col: number;
5
- }[];
6
- export declare function cellsToRangeString(ctx: Context, cells: {
7
- row: number;
8
- col: number;
9
- }[]): string;
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.cellsToRangeString = cellsToRangeString;
7
- exports.findMatchingCells = findMatchingCells;
8
- var _fortuneCore = require("@fileverse-dev/fortune-core");
9
- var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
10
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
11
- if (ar || !(i in from)) {
12
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
13
- ar[i] = from[i];
14
- }
15
- }
16
- return to.concat(ar || Array.prototype.slice.call(from));
17
- };
18
- function findMatchingCells(ctx, currentRow, currentCol) {
19
- var _a;
20
- var sheetIndex = (0, _fortuneCore.getSheetIndex)(ctx, ctx.currentSheetId);
21
- var dataVerification = (_a = ctx.luckysheetfile[sheetIndex].dataVerification) !== null && _a !== void 0 ? _a : {};
22
- var currentValidation = dataVerification["".concat(currentRow, "_").concat(currentCol)];
23
- if (!currentValidation) return [];
24
- var matchingCells = [];
25
- Object.keys(dataVerification).forEach(function (key) {
26
- var _a = key.split("_").map(Number),
27
- r = _a[0],
28
- c = _a[1];
29
- var validation = dataVerification[key];
30
- if (validation.type === currentValidation.type && validation.type2 === currentValidation.type2 && validation.value1 === currentValidation.value1 && validation.value2 === currentValidation.value2 && validation.color === currentValidation.color && validation.validity === currentValidation.validity && validation.remote === currentValidation.remote && validation.prohibitInput === currentValidation.prohibitInput && validation.hintShow === currentValidation.hintShow && validation.hintValue === currentValidation.hintValue) {
31
- matchingCells.push({
32
- row: r,
33
- col: c
34
- });
35
- }
36
- });
37
- return matchingCells;
38
- }
39
- function cellsToRangeString(ctx, cells) {
40
- if (cells.length === 0) return "";
41
- if (cells.length === 1) {
42
- return (0, _fortuneCore.indexToColumnChar)(cells[0].col) + (cells[0].row + 1);
43
- }
44
- var sorted = __spreadArray([], cells, true).sort(function (a, b) {
45
- return a.row === b.row ? a.col - b.col : a.row - b.row;
46
- });
47
- var ranges = [];
48
- var startRow = sorted[0].row;
49
- var endRow = sorted[0].row;
50
- var startCol = sorted[0].col;
51
- var endCol = sorted[0].col;
52
- for (var i = 1; i < sorted.length; i++) {
53
- var _a = sorted[i],
54
- row = _a.row,
55
- col = _a.col;
56
- if (col === startCol && col === endCol && row === endRow + 1) {
57
- endRow = row;
58
- } else if (row === startRow && row === endRow && col === endCol + 1) {
59
- endCol = col;
60
- } else {
61
- var range_1 = (0, _fortuneCore.getRangetxt)(ctx, ctx.currentSheetId, {
62
- row: [startRow, endRow],
63
- column: [startCol, endCol]
64
- });
65
- ranges.push(range_1);
66
- startRow = endRow = row;
67
- startCol = endCol = col;
68
- }
69
- }
70
- var range = (0, _fortuneCore.getRangetxt)(ctx, ctx.currentSheetId, {
71
- row: [startRow, endRow],
72
- column: [startCol, endCol]
73
- });
74
- ranges.push(range);
75
- return ranges.join(",");
76
- }