@fileverse-dev/fortune-react 1.2.98 → 1.2.99-data-validation-fix-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.
Files changed (39) hide show
  1. package/es/components/ConditionFormat/ConditionRules.d.ts +0 -1
  2. package/es/components/ConditionFormat/ConditionRules.js +21 -12
  3. package/es/components/ConditionFormat/index.js +2 -2
  4. package/es/components/DataVerification/RangeDialog.js +19 -8
  5. package/es/components/DataVerification/helpers.d.ts +9 -0
  6. package/es/components/DataVerification/helpers.js +69 -0
  7. package/es/components/DataVerification/index.js +80 -43
  8. package/es/components/Dialog/index.js +24 -10
  9. package/es/components/ErrorState/index.js +6 -3
  10. package/es/components/LinkEidtCard/index.js +21 -12
  11. package/es/components/SheetOverlay/FormulaHint/index.js +48 -33
  12. package/es/components/SheetTab/SheetItem.js +29 -16
  13. package/es/components/SheetTab/index.js +35 -20
  14. package/es/components/Toolbar/Button.js +10 -3
  15. package/es/components/Toolbar/Combo.js +10 -2
  16. package/es/components/Toolbar/CustomButton.js +12 -3
  17. package/es/components/Toolbar/Select.js +7 -1
  18. package/es/components/Workbook/api.d.ts +0 -1
  19. package/es/components/Workbook/index.d.ts +0 -1
  20. package/lib/components/ConditionFormat/ConditionRules.d.ts +0 -1
  21. package/lib/components/ConditionFormat/ConditionRules.js +21 -12
  22. package/lib/components/ConditionFormat/index.js +2 -2
  23. package/lib/components/DataVerification/RangeDialog.js +19 -8
  24. package/lib/components/DataVerification/helpers.d.ts +9 -0
  25. package/lib/components/DataVerification/helpers.js +76 -0
  26. package/lib/components/DataVerification/index.js +80 -43
  27. package/lib/components/Dialog/index.js +24 -10
  28. package/lib/components/ErrorState/index.js +6 -3
  29. package/lib/components/LinkEidtCard/index.js +21 -12
  30. package/lib/components/SheetOverlay/FormulaHint/index.js +48 -33
  31. package/lib/components/SheetTab/SheetItem.js +29 -16
  32. package/lib/components/SheetTab/index.js +35 -20
  33. package/lib/components/Toolbar/Button.js +10 -3
  34. package/lib/components/Toolbar/Combo.js +10 -2
  35. package/lib/components/Toolbar/CustomButton.js +12 -3
  36. package/lib/components/Toolbar/Select.js +7 -1
  37. package/lib/components/Workbook/api.d.ts +0 -1
  38. package/lib/components/Workbook/index.d.ts +0 -1
  39. package/package.json +2 -2
@@ -20,9 +20,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
20
20
  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); }
21
21
  (0, _datepickerStyles.injectDatepickerStyles)();
22
22
  var ConditionRules = function ConditionRules(_a) {
23
- var rulesType = _a.type,
24
- context = _a.context;
25
- console.log("rulesType", rulesType);
23
+ var context = _a.context;
26
24
  var _b = (0, _react.useState)("greaterThan"),
27
25
  type = _b[0],
28
26
  setType = _b[1];
@@ -369,8 +367,10 @@ var ConditionRules = function ConditionRules(_a) {
369
367
  setEditConditionRange(rangeEdit);
370
368
  setEditConditionFormatValue(allConditionFormats[key].conditionValue);
371
369
  },
372
- className: "group flex items-center border-b border-gray-200 condition-list-parent",
373
- key: key
370
+ className: "group flex items-center border-b border-gray-200 condition-list-parent fortune-condition-rules__item fortune-condition-rules__item--".concat(String(key).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-")),
371
+ "data-condition-key": key,
372
+ key: key,
373
+ "data-testid": "condition-rules-item-".concat(key)
374
374
  }, /*#__PURE__*/_react.default.createElement("div", {
375
375
  className: "condition-list-pill",
376
376
  style: {
@@ -392,9 +392,11 @@ var ConditionRules = function ConditionRules(_a) {
392
392
  buttonClickCreateRef.current = true;
393
393
  }
394
394
  }, /*#__PURE__*/_react.default.createElement("h3", {
395
- className: "condition-list-type"
395
+ className: "fortune-condition-rules__heading condition-list-type",
396
+ "data-testid": "condition-rules-heading-".concat(key)
396
397
  }, conditionformat[allConditionFormats[key].conditionName], " ", (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/_react.default.createElement("p", {
397
- className: "condition-list-range"
398
+ className: "fortune-condition-rules__para condition-list-range",
399
+ "data-testid": "condition-rules-para-".concat(key)
398
400
  }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
399
401
  var startCol = (0, _helper.numberToColumn)(range.column[0] + 1);
400
402
  var endCol = (0, _helper.numberToColumn)(range.column[1] + 1);
@@ -402,12 +404,15 @@ var ConditionRules = function ConditionRules(_a) {
402
404
  var endRow = range.row[1] + 1;
403
405
  return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
404
406
  }).join(", "))), /*#__PURE__*/_react.default.createElement("div", {
405
- className: "opacity-0 group-hover:opacity-100 transition-opacity"
407
+ className: "fortune-condition-rules__icon fortune-condition-rules__action opacity-0 group-hover:opacity-100 transition-opacity",
408
+ "data-condition-key": key,
409
+ "data-testid": "condition-rules-action-delete-".concat(key)
406
410
  }, /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
407
411
  elevation: 1,
408
412
  icon: "Trash2",
409
413
  size: "md",
410
414
  variant: "secondary",
415
+ className: "fortune-condition-rules__icon--trash",
411
416
  style: {
412
417
  border: "0px",
413
418
  boxShadow: "none",
@@ -428,6 +433,7 @@ var ConditionRules = function ConditionRules(_a) {
428
433
  leftIcon: "Plus",
429
434
  size: "md",
430
435
  variant: "secondary",
436
+ className: "fortune-condition-rules__cta fortune-condition-rules__cta--add",
431
437
  onClick: function onClick() {
432
438
  setType("greaterThan");
433
439
  setCreate(true);
@@ -441,11 +447,13 @@ var ConditionRules = function ConditionRules(_a) {
441
447
  });
442
448
  editKeyRef.current = null;
443
449
  buttonClickCreateRef.current = true;
444
- }
450
+ },
451
+ "data-testid": "condition-rules-cta-add"
445
452
  }, "Add another rule"))) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
446
- className: "flex flex-col"
453
+ className: "flex flex-col fortune-condition-rules__form"
447
454
  }, /*#__PURE__*/_react.default.createElement("div", {
448
- className: "condition-rules-value text-heading-xsm"
455
+ className: "fortune-condition-rules__info condition-rules-value text-heading-xsm",
456
+ "data-testid": "condition-rules-info-range"
449
457
  }, conditionformat.applyRange, " range"), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
450
458
  rightIcon: /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
451
459
  name: "Grid2x2",
@@ -463,7 +471,8 @@ var ConditionRules = function ConditionRules(_a) {
463
471
  dataSelectRange("conditionRules".concat(type));
464
472
  }
465
473
  })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
466
- className: "condition-rules-value text-heading-xsm"
474
+ className: "fortune-condition-rules__heading-sm condition-rules-value text-heading-xsm",
475
+ "data-testid": "condition-rules-heading-format"
467
476
  }, "Format cells if"), /*#__PURE__*/_react.default.createElement(_ui.Select, {
468
477
  value: type,
469
478
  onValueChange: function onValueChange(value) {
@@ -129,7 +129,7 @@ var ConditionalFormat = function ConditionalFormat(_a) {
129
129
  onClick: function onClick() {
130
130
  setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
131
131
  showDialog(/*#__PURE__*/_react.default.createElement(_ConditionRules.default, {
132
- type: v.text
132
+ context: context
133
133
  }), undefined, conditionformat["conditionformat_".concat(v.text)]);
134
134
  },
135
135
  tabIndex: 0
@@ -176,7 +176,7 @@ var ConditionalFormat = function ConditionalFormat(_a) {
176
176
  onClick: function onClick() {
177
177
  setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
178
178
  showDialog(/*#__PURE__*/_react.default.createElement(_ConditionRules.default, {
179
- type: v.text
179
+ context: context
180
180
  }), undefined, conditionformat["conditionformat_".concat(v.text)]);
181
181
  },
182
182
  tabIndex: 0
@@ -47,7 +47,8 @@ var RangeDialog = function RangeDialog() {
47
47
  }, [context, context.luckysheet_select_save]);
48
48
  return /*#__PURE__*/_react.default.createElement("div", {
49
49
  id: "range-dialog",
50
- className: "fortune-dialog",
50
+ className: "fortune-dialog fortune-range-dialog",
51
+ "data-testid": "range-dialog",
51
52
  onClick: function onClick(e) {
52
53
  return e.stopPropagation();
53
54
  },
@@ -65,32 +66,41 @@ var RangeDialog = function RangeDialog() {
65
66
  },
66
67
  tabIndex: 0
67
68
  }, /*#__PURE__*/_react.default.createElement("div", {
68
- className: (0, _ui.cn)("flex items-center justify-between border-b color-border-default py-3 px-6")
69
+ className: (0, _ui.cn)("fortune-range-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
70
+ "data-testid": "range-dialog-header"
69
71
  }, /*#__PURE__*/_react.default.createElement("div", {
70
- className: "text-heading-sm"
72
+ className: "fortune-range-dialog__heading text-heading-sm",
73
+ "data-testid": "range-dialog-heading"
71
74
  }, dataVerification.selectCellRange), /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
72
75
  icon: "X",
73
76
  variant: "ghost",
74
77
  onClick: close,
75
- tabIndex: 0
78
+ tabIndex: 0,
79
+ className: "fortune-range-dialog__icon fortune-range-dialog__icon--close",
80
+ "data-testid": "range-dialog-icon-close"
76
81
  })), /*#__PURE__*/_react.default.createElement("div", {
77
- className: "px-6 pb-6 pt-4 text-body-sm"
82
+ className: "fortune-range-dialog__para px-6 pb-6 pt-4 text-body-sm",
83
+ "data-testid": "range-dialog-para"
78
84
  }, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
79
85
  className: "w-full",
80
86
  readOnly: true,
81
87
  placeholder: dataVerification.selectCellRange2,
82
88
  value: rangeTxt2
83
89
  })), /*#__PURE__*/_react.default.createElement("div", {
84
- className: "px-6 pb-6 flex flex-row gap-2 justify-end"
90
+ className: "fortune-range-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
91
+ "data-testid": "range-dialog-actions"
85
92
  }, /*#__PURE__*/_react.default.createElement(_ui.Button, {
86
93
  variant: "secondary",
94
+ className: "fortune-range-dialog__cta fortune-range-dialog__cta--close",
87
95
  style: {
88
96
  minWidth: "80px"
89
97
  },
90
98
  onClick: close,
91
- tabIndex: 0
99
+ tabIndex: 0,
100
+ "data-testid": "range-dialog-cta-close"
92
101
  }, button.close), /*#__PURE__*/_react.default.createElement(_ui.Button, {
93
102
  variant: "default",
103
+ className: "fortune-range-dialog__cta fortune-range-dialog__cta--confirm",
94
104
  style: {
95
105
  minWidth: "80px"
96
106
  },
@@ -100,7 +110,8 @@ var RangeDialog = function RangeDialog() {
100
110
  });
101
111
  close();
102
112
  },
103
- tabIndex: 0
113
+ tabIndex: 0,
114
+ "data-testid": "range-dialog-cta-confirm"
104
115
  }, button.confirm)));
105
116
  };
106
117
  var _default = exports.default = RangeDialog;
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1,76 @@
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
+ }
@@ -12,6 +12,7 @@ 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");
15
16
  require("./index.css");
16
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
18
  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); }
@@ -42,7 +43,7 @@ var DataVerification = function DataVerification() {
42
43
  button = _r.button,
43
44
  generalDialog = _r.generalDialog;
44
45
  var dateCondition = (0, _react.useState)(["between", "notBetween", "equal", "notEqualTo", "earlierThan", "noEarlierThan", "laterThan", "noLaterThan"])[0];
45
- function getSheetIndex() {
46
+ var getSheetIndex = (0, _react.useCallback)(function () {
46
47
  var _a;
47
48
  for (var i = 0; i < context.luckysheetfile.length; i += 1) {
48
49
  if (((_a = context.luckysheetfile[i]) === null || _a === void 0 ? void 0 : _a.id) === context.currentSheetId) {
@@ -50,7 +51,7 @@ var DataVerification = function DataVerification() {
50
51
  }
51
52
  }
52
53
  return null;
53
- }
54
+ }, [context.luckysheetfile, context.currentSheetId]);
54
55
  var _s = (0, _react.useState)([]),
55
56
  optionItems = _s[0],
56
57
  setOptionItems = _s[1];
@@ -101,45 +102,68 @@ var DataVerification = function DataVerification() {
101
102
  ctx.rangeDialog.rangeTxt = value;
102
103
  });
103
104
  }, [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]);
104
145
  var btn = (0, _react.useCallback)(function (type) {
146
+ var _a, _b, _c;
105
147
  if (type === "confirm") {
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
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();
119
162
  });
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;
163
+ return;
141
164
  }
142
- });
165
+ }
166
+ applyValidation(modalRangeString_1);
143
167
  } else if (type === "delete") {
144
168
  setContext(function (ctx) {
145
169
  var _a, _b, _c;
@@ -158,17 +182,26 @@ var DataVerification = function DataVerification() {
158
182
  delete currentDataVerification["".concat(r, "_").concat(c)];
159
183
  }
160
184
  }
185
+ ctx.dataVerification.updateScope = undefined;
161
186
  });
162
187
  }
163
188
  hideDialog();
164
- }, [dataVerification, generalDialog, hideDialog, setContext, showDialog]);
189
+ }, [applyValidation, context, dataVerification, generalDialog, getSheetIndex, hideDialog, setContext, showDialog]);
165
190
  (0, _react.useEffect)(function () {
166
191
  setContext(function (ctx) {
167
- var _a, _b, _c;
192
+ var _a, _b, _c, _d;
168
193
  var rangeT = "";
194
+ var updateScope = ((_a = ctx.dataVerification) === null || _a === void 0 ? void 0 : _a.updateScope) || "current";
169
195
  if (ctx.luckysheet_select_save) {
170
196
  var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
171
- rangeT = (0, _fortuneCore.getRangetxt)(context, context.currentSheetId, range, context.currentSheetId);
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
+ }
172
205
  }
173
206
  var index = getSheetIndex();
174
207
  var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
@@ -178,13 +211,17 @@ var DataVerification = function DataVerification() {
178
211
  var rowIndex = last.row_focus;
179
212
  var colIndex = last.column_focus;
180
213
  if (rowIndex == null || colIndex == null) return;
214
+ ctx.dataVerification.sourceCell = {
215
+ row: rowIndex,
216
+ col: colIndex
217
+ };
181
218
  var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
182
219
  var defaultItem = item !== null && item !== void 0 ? item : {};
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) {
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) {
185
222
  rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
186
223
  rangValue = ctx.rangeDialog.rangeTxt;
187
- } else if (((_c = ctx.rangeDialog) === null || _c === void 0 ? void 0 : _c.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
224
+ } else if (((_d = ctx.rangeDialog) === null || _d === void 0 ? void 0 : _d.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
188
225
  rangValue = ctx.dataVerification.dataRegulation.value1;
189
226
  rangeT = ctx.rangeDialog.rangeTxt;
190
227
  }
@@ -36,46 +36,60 @@ var Dialog = function Dialog(_a) {
36
36
  var button = (0, _fortuneCore.locale)(context).button;
37
37
  return /*#__PURE__*/_react.default.createElement("div", {
38
38
  className: "fortune-dialog",
39
+ "data-testid": "dialog",
39
40
  style: __assign(__assign({}, containerStyle), ["Data validation", "Split text to columns", "Resize column"].includes(title) ? {
40
41
  maxWidth: "unset"
41
42
  } : {})
42
43
  }, /*#__PURE__*/_react.default.createElement("div", {
43
- className: (0, _ui.cn)("flex items-center justify-between border-b color-border-default py-3 px-6")
44
+ className: (0, _ui.cn)("fortune-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
45
+ "data-testid": "dialog-header"
44
46
  }, title ? (/*#__PURE__*/_react.default.createElement("div", {
45
- className: "text-heading-sm"
47
+ className: "fortune-dialog__heading text-heading-sm",
48
+ "data-testid": "dialog-heading"
46
49
  }, title)) : (/*#__PURE__*/_react.default.createElement("div", {
47
- className: "text-heading-sm"
50
+ className: "fortune-dialog__heading text-heading-sm",
51
+ "data-testid": "dialog-heading"
48
52
  }, "Oops! Something went wrong")), /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
49
53
  icon: "X",
50
54
  variant: "ghost",
51
55
  onClick: onCancel,
52
- tabIndex: 0
56
+ tabIndex: 0,
57
+ className: "fortune-dialog__icon fortune-dialog__icon--close",
58
+ "data-testid": "dialog-icon-close"
53
59
  })), /*#__PURE__*/_react.default.createElement("div", {
54
- className: "px-6 pb-6 pt-4 text-body-sm",
55
- style: contentStyle
60
+ className: "fortune-dialog__para px-6 pb-6 pt-4 text-body-sm",
61
+ style: contentStyle,
62
+ "data-testid": "dialog-para"
56
63
  }, children), type != null && (/*#__PURE__*/_react.default.createElement("div", {
57
- className: "px-6 pb-6 flex flex-row gap-2 justify-end"
64
+ className: "fortune-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
65
+ "data-testid": "dialog-actions"
58
66
  }, type === "ok" ? (/*#__PURE__*/_react.default.createElement(_ui.Button, {
59
67
  variant: "default",
68
+ className: "fortune-dialog__cta fortune-dialog__cta--confirm",
60
69
  style: {
61
70
  minWidth: "80px"
62
71
  },
63
72
  onClick: onOk,
64
- tabIndex: 0
73
+ tabIndex: 0,
74
+ "data-testid": "dialog-cta-confirm"
65
75
  }, okLabel || button.confirm)) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
66
76
  variant: "secondary",
77
+ className: "fortune-dialog__cta fortune-dialog__cta--cancel",
67
78
  style: {
68
79
  minWidth: "80px"
69
80
  },
70
81
  onClick: onCancel,
71
- tabIndex: 0
82
+ tabIndex: 0,
83
+ "data-testid": "dialog-cta-cancel"
72
84
  }, cancelLabel || button.cancel), /*#__PURE__*/_react.default.createElement(_ui.Button, {
73
85
  variant: "default",
86
+ className: "fortune-dialog__cta fortune-dialog__cta--confirm",
74
87
  style: {
75
88
  minWidth: "80px"
76
89
  },
77
90
  onClick: onOk,
78
- tabIndex: 0
91
+ tabIndex: 0,
92
+ "data-testid": "dialog-cta-confirm"
79
93
  }, okLabel || button.confirm))))));
80
94
  };
81
95
  var _default = exports.default = Dialog;
@@ -31,11 +31,14 @@ var ErrorBoxes = function ErrorBoxes() {
31
31
  zIndex: 100,
32
32
  borderRadius: "4px"
33
33
  },
34
- className: "shadow-lg flex flex-col gap-2 break-all"
34
+ className: "fortune-error-state shadow-lg flex flex-col gap-2 break-all",
35
+ "data-testid": "error-state"
35
36
  }, /*#__PURE__*/_react.default.createElement("h3", {
36
- className: "text-heading-xsm color-text-danger"
37
+ className: "fortune-error-state__heading text-heading-xsm color-text-danger",
38
+ "data-testid": "error-state-heading"
37
39
  }, title), /*#__PURE__*/_react.default.createElement("div", {
38
- className: "color-text-default text-body-sm"
40
+ className: "fortune-error-state__para color-text-default text-body-sm",
41
+ "data-testid": "error-state-para"
39
42
  }, message));
40
43
  };
41
44
  var _default = exports.default = ErrorBoxes;
@@ -105,10 +105,13 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
105
105
  };
106
106
  }, [refs.globalCache, isButtonDisabled]);
107
107
  var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
108
+ var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
108
109
  return /*#__PURE__*/_react.default.createElement("div", {
109
- className: "fortune-toolbar-button",
110
+ className: "fortune-link-card__icon fortune-link-card__action fortune-link-card__action--".concat(iconIdClass, " fortune-toolbar-button"),
111
+ "data-icon-id": iconId,
110
112
  onClick: onClick,
111
- tabIndex: 0
113
+ tabIndex: 0,
114
+ "data-testid": "link-card-action-".concat(iconId)
112
115
  }, /*#__PURE__*/_react.default.createElement(_SVGIcon.default, {
113
116
  name: iconId,
114
117
  style: {
@@ -161,19 +164,21 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
161
164
  onKeyDown: function onKeyDown(e) {
162
165
  e.stopPropagation();
163
166
  },
164
- className: "fortune-link-modify-modal link-toolbar",
167
+ className: "fortune-link-card fortune-link-modify-modal link-toolbar",
165
168
  style: {
166
169
  left: position.cellLeft + 20,
167
170
  top: position.cellBottom - 5
168
- }
171
+ },
172
+ "data-testid": "link-card"
169
173
  }), /*#__PURE__*/_react.default.createElement("div", {
170
- className: "link-content",
174
+ className: "fortune-link-card__info link-content",
171
175
  onClick: function onClick() {
172
176
  setContext(function (draftCtx) {
173
177
  return (0, _fortuneCore.goToLink)(draftCtx, r, c, linkType, linkAddress, refs.scrollbarX.current, refs.scrollbarY.current);
174
178
  });
175
179
  },
176
- tabIndex: 0
180
+ tabIndex: 0,
181
+ "data-testid": "link-card-info-open"
177
182
  }, linkType === "webpage" ? insertLink.openLink : (0, _fortuneCore.replaceHtml)(insertLink.goTo, {
178
183
  linkAddress: linkAddress
179
184
  })), context.allowEdit === true && /*#__PURE__*/_react.default.createElement("div", {
@@ -197,13 +202,15 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
197
202
  }));
198
203
  }
199
204
  return /*#__PURE__*/_react.default.createElement("div", __assign({
200
- className: "fortune-link-card",
205
+ className: "fortune-link-card fortune-link-card--editing",
201
206
  ref: cardRef,
202
207
  style: {
203
208
  left: position.cellLeft + 20,
204
209
  top: cardTop
205
210
  }
206
- }, containerEvent), /*#__PURE__*/_react.default.createElement(_ui.Select, {
211
+ }, containerEvent, {
212
+ "data-testid": "link-card-editing"
213
+ }), /*#__PURE__*/_react.default.createElement(_ui.Select, {
207
214
  value: linkType,
208
215
  onValueChange: function onValueChange(value) {
209
216
  if (value === "sheet") {
@@ -228,9 +235,10 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
228
235
  value: type.value
229
236
  }, type.text);
230
237
  }))), /*#__PURE__*/_react.default.createElement("div", {
231
- className: "fortune-input-with-icon"
238
+ className: "fortune-link-card__para fortune-input-with-icon",
239
+ "data-testid": "link-card-para-text"
232
240
  }, /*#__PURE__*/_react.default.createElement("div", {
233
- className: "input-icon"
241
+ className: "fortune-link-card__icon input-icon"
234
242
  }, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
235
243
  name: "ALargeSmall"
236
244
  })), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
@@ -283,7 +291,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
283
291
  value: sheet.name
284
292
  }, sheet.name);
285
293
  }))))), /*#__PURE__*/_react.default.createElement(_ui.Button, {
286
- className: "fortune-insert-button",
294
+ className: "fortune-link-card__cta fortune-insert-button",
287
295
  disabled: isButtonDisabled,
288
296
  onClick: function onClick() {
289
297
  if (isButtonDisabled) return;
@@ -291,7 +299,8 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
291
299
  setContext(function (draftCtx) {
292
300
  return (0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
293
301
  });
294
- }
302
+ },
303
+ "data-testid": "link-card-cta-insert"
295
304
  }, "Insert link"));
296
305
  };
297
306
  var _default = exports.default = LinkEditCard;