@fileverse-dev/fortune-react 1.3.0 → 1.3.1-paint

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.
@@ -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,71 @@
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 += 1) {
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 = row;
60
+ endRow = row;
61
+ startCol = col;
62
+ endCol = col;
63
+ }
64
+ }
65
+ var range = getRangetxt(ctx, ctx.currentSheetId, {
66
+ row: [startRow, endRow],
67
+ column: [startCol, endCol]
68
+ });
69
+ ranges.push(range);
70
+ return ranges.join(",");
71
+ }
@@ -15,6 +15,7 @@ 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";
18
19
  import "./index.css";
19
20
  function createId() {
20
21
  return "".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2));
@@ -33,7 +34,7 @@ var DataVerification = function DataVerification() {
33
34
  button = _r.button,
34
35
  generalDialog = _r.generalDialog;
35
36
  var dateCondition = useState(["between", "notBetween", "equal", "notEqualTo", "earlierThan", "noEarlierThan", "laterThan", "noLaterThan"])[0];
36
- function getSheetIndex() {
37
+ var getSheetIndex = useCallback(function () {
37
38
  var _a;
38
39
  for (var i = 0; i < context.luckysheetfile.length; i += 1) {
39
40
  if (((_a = context.luckysheetfile[i]) === null || _a === void 0 ? void 0 : _a.id) === context.currentSheetId) {
@@ -41,7 +42,7 @@ var DataVerification = function DataVerification() {
41
42
  }
42
43
  }
43
44
  return null;
44
- }
45
+ }, [context.luckysheetfile, context.currentSheetId]);
45
46
  var _s = useState([]),
46
47
  optionItems = _s[0],
47
48
  setOptionItems = _s[1];
@@ -92,45 +93,68 @@ var DataVerification = function DataVerification() {
92
93
  ctx.rangeDialog.rangeTxt = value;
93
94
  });
94
95
  }, [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]);
95
136
  var btn = useCallback(function (type) {
137
+ var _a, _b, _c;
96
138
  if (type === "confirm") {
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
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();
110
153
  });
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;
154
+ return;
132
155
  }
133
- });
156
+ }
157
+ applyValidation(modalRangeString_1);
134
158
  } else if (type === "delete") {
135
159
  setContext(function (ctx) {
136
160
  var _a, _b, _c;
@@ -149,17 +173,26 @@ var DataVerification = function DataVerification() {
149
173
  delete currentDataVerification["".concat(r, "_").concat(c)];
150
174
  }
151
175
  }
176
+ ctx.dataVerification.updateScope = undefined;
152
177
  });
153
178
  }
154
179
  hideDialog();
155
- }, [dataVerification, generalDialog, hideDialog, setContext, showDialog]);
180
+ }, [applyValidation, context, dataVerification, generalDialog, getSheetIndex, hideDialog, setContext, showDialog]);
156
181
  useEffect(function () {
157
182
  setContext(function (ctx) {
158
- var _a, _b, _c;
183
+ var _a, _b, _c, _d;
159
184
  var rangeT = "";
185
+ var updateScope = ((_a = ctx.dataVerification) === null || _a === void 0 ? void 0 : _a.updateScope) || "current";
160
186
  if (ctx.luckysheet_select_save) {
161
187
  var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
162
- rangeT = getRangetxt(context, context.currentSheetId, range, context.currentSheetId);
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
+ }
163
196
  }
164
197
  var index = getSheetIndex();
165
198
  var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
@@ -169,13 +202,17 @@ var DataVerification = function DataVerification() {
169
202
  var rowIndex = last.row_focus;
170
203
  var colIndex = last.column_focus;
171
204
  if (rowIndex == null || colIndex == null) return;
205
+ ctx.dataVerification.sourceCell = {
206
+ row: rowIndex,
207
+ col: colIndex
208
+ };
172
209
  var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
173
210
  var defaultItem = item !== null && item !== void 0 ? item : {};
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) {
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) {
176
213
  rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
177
214
  rangValue = ctx.rangeDialog.rangeTxt;
178
- } else if (((_c = ctx.rangeDialog) === null || _c === void 0 ? void 0 : _c.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
215
+ } else if (((_d = ctx.rangeDialog) === null || _d === void 0 ? void 0 : _d.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
179
216
  rangValue = ctx.dataVerification.dataRegulation.value1;
180
217
  rangeT = ctx.rangeDialog.rangeTxt;
181
218
  }
@@ -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,78 @@
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 += 1) {
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 = row;
67
+ endRow = row;
68
+ startCol = col;
69
+ endCol = col;
70
+ }
71
+ }
72
+ var range = (0, _fortuneCore.getRangetxt)(ctx, ctx.currentSheetId, {
73
+ row: [startRow, endRow],
74
+ column: [startCol, endCol]
75
+ });
76
+ ranges.push(range);
77
+ return ranges.join(",");
78
+ }
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-paint",
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.3.0",
19
+ "@fileverse-dev/fortune-core": "1.3.1-paint",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",