@fileverse-dev/fortune-react 1.2.64-mergeFix-patch-1 → 1.2.64-patch-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./index.css";
3
3
  declare const ConditionRules: React.FC<{
4
- type: string;
4
+ type?: string;
5
5
  }>;
6
6
  export default ConditionRules;
@@ -1,6 +1,7 @@
1
1
  import React, { useCallback, useContext, useEffect, useState } from "react";
2
2
  import "./index.css";
3
- import { locale, setConditionRules } from "@fileverse-dev/fortune-core";
3
+ import { locale, setConditionRules, getSheetIndex } from "@fileverse-dev/fortune-core";
4
+ import { numberToColumn } from "../SheetOverlay/helper";
4
5
  import produce from "immer";
5
6
  import { Button, Checkbox, Divider, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, TextField } from "@fileverse/ui";
6
7
  import WorkbookContext from "../../context";
@@ -9,22 +10,69 @@ import { getDisplayedRangeTxt } from "../DataVerification/getDisplayedRangeTxt";
9
10
  import { injectDatepickerStyles } from "../../utils/datepickerStyles";
10
11
  injectDatepickerStyles();
11
12
  var ConditionRules = function ConditionRules(_a) {
12
- var type = _a.type;
13
- var _b = useContext(WorkbookContext),
14
- context = _b.context,
15
- setContext = _b.setContext;
13
+ var rulesType = _a.type;
14
+ var _b = useState('greaterThan'),
15
+ type = _b[0],
16
+ setType = _b[1];
17
+ var _c = useState(false),
18
+ create = _c[0],
19
+ setCreate = _c[1];
20
+ var _d = useState([]),
21
+ matchedConditionFormatKey = _d[0],
22
+ setMatchedConditionFormatKey = _d[1];
23
+ var _e = useState(null),
24
+ allConditionFormats = _e[0],
25
+ setAllConditionFormats = _e[1];
26
+ var _f = useContext(WorkbookContext),
27
+ context = _f.context,
28
+ setContext = _f.setContext;
16
29
  var hideDialog = useDialog().hideDialog;
17
- var _c = locale(context),
18
- conditionformat = _c.conditionformat,
19
- button = _c.button,
20
- protection = _c.protection,
21
- generalDialog = _c.generalDialog;
22
- var _d = useState({
30
+ var _g = locale(context),
31
+ conditionformat = _g.conditionformat,
32
+ button = _g.button,
33
+ protection = _g.protection,
34
+ generalDialog = _g.generalDialog;
35
+ var _h = useState({
23
36
  textColor: "#FFFFFF",
24
37
  cellColor: "#D82E2A"
25
38
  }),
26
- colorRules = _d[0],
27
- setColorRules = _d[1];
39
+ colorRules = _h[0],
40
+ setColorRules = _h[1];
41
+ useEffect(function () {
42
+ var _a, _b, _c, _d;
43
+ var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
44
+ var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
45
+ if (allCondition && (allCondition === null || allCondition === void 0 ? void 0 : allCondition.length) === (allConditionFormats === null || allConditionFormats === void 0 ? void 0 : allConditionFormats.length)) return;
46
+ setAllConditionFormats(allCondition);
47
+ console.log("allConditionFormats", allCondition, (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0], context);
48
+ console.log("typed", context);
49
+ var selectionColumn = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].column;
50
+ var selectionRow = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[0].row;
51
+ var matchedCondition = [];
52
+ if (allCondition) {
53
+ for (var key in allCondition) {
54
+ var conditionFormat = allCondition[key];
55
+ var range = (_d = conditionFormat.cellrange) === null || _d === void 0 ? void 0 : _d[0];
56
+ console.log("rangeObj", conditionFormat, range);
57
+ if (!range || !selectionColumn || !selectionRow) continue;
58
+ var rangeColumns = range.column;
59
+ var rangeRows = range.row;
60
+ var isColumnOverlap = !(selectionColumn[1] < rangeColumns[0] || selectionColumn[0] > rangeColumns[1]);
61
+ var isRowOverlap = !(selectionRow[1] < rangeRows[0] || selectionRow[0] > rangeRows[1]);
62
+ if (isColumnOverlap && isRowOverlap) {
63
+ matchedCondition.push(key);
64
+ }
65
+ }
66
+ setMatchedConditionFormatKey(matchedCondition);
67
+ }
68
+ console.log("kkkkk", matchedConditionFormatKey, matchedCondition);
69
+ if (matchedCondition.length === 0) {
70
+ console.log('whyyyyyyy');
71
+ setCreate(true);
72
+ } else if (matchedCondition.length > 0) {
73
+ setCreate(false);
74
+ }
75
+ }, [context]);
28
76
  var dataSelectRange = useCallback(function (selectType) {
29
77
  hideDialog();
30
78
  setContext(function (ctx) {
@@ -103,11 +151,104 @@ var ConditionRules = function ConditionRules(_a) {
103
151
  ctx.rangeDialog.type = "";
104
152
  ctx.rangeDialog.rangeTxt = "";
105
153
  });
106
- }, []);
154
+ }, [type]);
155
+ var conditionList = [{
156
+ text: "greaterThan",
157
+ value: ">",
158
+ label: "Greater Than"
159
+ }, {
160
+ text: "greaterThanOrEqual",
161
+ value: ">=",
162
+ label: "Greater Than or Equal"
163
+ }, {
164
+ text: "lessThan",
165
+ value: "<",
166
+ label: "Less Than"
167
+ }, {
168
+ text: "lessThanOrEqual",
169
+ value: "<=",
170
+ label: "Less Than or Equal"
171
+ }, {
172
+ text: "between",
173
+ value: "[]",
174
+ label: "Between"
175
+ }, {
176
+ text: "equal",
177
+ value: "=",
178
+ label: "Equal"
179
+ }, {
180
+ text: "textContains",
181
+ value: "()",
182
+ label: "Text Contains"
183
+ }, {
184
+ text: "occurrenceDate",
185
+ value: conditionformat.yesterday,
186
+ label: "Occurrence Date"
187
+ }, {
188
+ text: "duplicateValue",
189
+ value: "##",
190
+ label: "Duplicate Value"
191
+ }, {
192
+ text: "top10",
193
+ value: conditionformat.top10
194
+ }, {
195
+ text: "top10_percent",
196
+ value: conditionformat.top10_percent,
197
+ label: "Top 10 Percent"
198
+ }, {
199
+ text: "last10",
200
+ value: conditionformat.last10,
201
+ label: "Last 10"
202
+ }, {
203
+ text: "last10_percent",
204
+ value: conditionformat.last10_percent,
205
+ label: "Last 10 Percent"
206
+ }, {
207
+ text: "aboveAverage",
208
+ value: conditionformat.above,
209
+ label: "Above Average"
210
+ }, {
211
+ text: "belowAverage",
212
+ value: conditionformat.below,
213
+ label: "Below Average"
214
+ }];
107
215
  var titleType = type === "top10_percent" ? "top10" : type === "last10_percent" ? "last10" : type;
108
216
  return /*#__PURE__*/React.createElement("div", {
109
217
  className: "condition-rules"
110
- }, !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
218
+ }, !create ? (/*#__PURE__*/React.createElement("div", null, matchedConditionFormatKey.map(function (key) {
219
+ var _a, _b;
220
+ return /*#__PURE__*/React.createElement("div", {
221
+ className: "flex items-center gap-6 py-6 border-b border-gray-200 last:border-b-0",
222
+ key: key
223
+ }, /*#__PURE__*/React.createElement("div", {
224
+ className: "flex items-center justify-center !w-40 !h-40 rounded-3xl !bg-[".concat(allConditionFormats[key].format.cellColor || "", "]"),
225
+ style: {
226
+ backgroundColor: allConditionFormats[key].format.cellColor || "",
227
+ width: '44px',
228
+ height: '56px'
229
+ }
230
+ }, /*#__PURE__*/React.createElement("span", {
231
+ className: "text-6xl font-bold !text-[".concat(allConditionFormats[key].format.textColor || "", "] pb-1")
232
+ }, "123")), /*#__PURE__*/React.createElement("div", {
233
+ className: "flex flex-col"
234
+ }, /*#__PURE__*/React.createElement("h3", {
235
+ className: "text-4xl font-normal text-gray-900 mb-2"
236
+ }, conditionformat[allConditionFormats[key].conditionName], ' ', (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/React.createElement("p", {
237
+ className: "text-3xl text-gray-400"
238
+ }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
239
+ var startCol = numberToColumn(range.column[0] + 1);
240
+ var endCol = numberToColumn(range.column[1] + 1);
241
+ var startRow = range.row[0] + 1;
242
+ var endRow = range.row[1] + 1;
243
+ return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
244
+ }).join(", "))));
245
+ }), /*#__PURE__*/React.createElement(Button, {
246
+ size: "md",
247
+ variant: "secondary",
248
+ onClick: function onClick() {
249
+ setCreate(true);
250
+ }
251
+ }, "Create New Condition Format"))) : (/*#__PURE__*/React.createElement(React.Fragment, null, !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
111
252
  className: "flex flex-col"
112
253
  }, /*#__PURE__*/React.createElement("div", {
113
254
  className: "condition-rules-value text-heading-xsm"
@@ -215,7 +356,31 @@ var ConditionRules = function ConditionRules(_a) {
215
356
  ctx.conditionRules.projectValue = String(current + 1);
216
357
  });
217
358
  }
218
- })))))), /*#__PURE__*/React.createElement("div", {
359
+ })))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
360
+ className: "condition-rules-value text-heading-xsm"
361
+ }, "Cell(s) format if"), /*#__PURE__*/React.createElement(Select, {
362
+ value: type,
363
+ onValueChange: function onValueChange(value) {
364
+ console.log(value);
365
+ setType(value);
366
+ }
367
+ }, /*#__PURE__*/React.createElement(SelectTrigger, null, /*#__PURE__*/React.createElement(SelectValue, null, /*#__PURE__*/React.createElement("div", {
368
+ className: "flex items-center gap-2"
369
+ }, /*#__PURE__*/React.createElement("span", null, conditionformat[type])))), /*#__PURE__*/React.createElement(SelectContent, {
370
+ position: "popper",
371
+ side: "bottom",
372
+ align: "start",
373
+ sideOffset: 4,
374
+ className: "z-[100]",
375
+ "data-dropdown-content": "true"
376
+ }, conditionList.map(function (option) {
377
+ return /*#__PURE__*/React.createElement(SelectItem, {
378
+ key: option.value,
379
+ value: option.text
380
+ }, /*#__PURE__*/React.createElement("div", {
381
+ className: "flex items-center gap-2"
382
+ }, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
383
+ })))), /*#__PURE__*/React.createElement("div", {
219
384
  className: "flex flex-col"
220
385
  }, /*#__PURE__*/React.createElement("div", {
221
386
  className: "condition-rules-value text-heading-xsm"
@@ -318,6 +483,6 @@ var ConditionRules = function ConditionRules(_a) {
318
483
  close("confirm");
319
484
  },
320
485
  tabIndex: 0
321
- }, button.apply)));
486
+ }, button.apply)))));
322
487
  };
323
488
  export default ConditionRules;
@@ -2,6 +2,7 @@ export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
2
2
  export declare function getCursorPosition(editableDiv: HTMLDivElement): number;
3
3
  export declare function isLetterNumberPattern(str: string): boolean;
4
4
  export declare function removeLastSpan(htmlString: string): string;
5
+ export declare function numberToColumn(colNumber: number): string;
5
6
  export declare function incrementColumn(cell: string): string;
6
7
  export declare function decrementColumn(cell: string): string;
7
8
  export declare function incrementRow(cell: string): string;
@@ -47,7 +47,7 @@ function columnToNumber(colPart) {
47
47
  }
48
48
  return colNumber;
49
49
  }
50
- function numberToColumn(colNumber) {
50
+ export function numberToColumn(colNumber) {
51
51
  var colPart = "";
52
52
  while (colNumber > 0) {
53
53
  colNumber -= 1;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ declare const ConditionalFormatPortal: ({ visible }: {
3
+ visible: boolean;
4
+ }) => React.ReactPortal | null;
5
+ export default ConditionalFormatPortal;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { createPortal } from "react-dom";
3
+ import ConditionRules from "../ConditionFormat/ConditionRules";
4
+ var ConditionalFormatPortal = function ConditionalFormatPortal(_a) {
5
+ var visible = _a.visible;
6
+ var container = document.getElementById("placeholder-conditional-format");
7
+ if (!visible || !container) return null;
8
+ return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(ConditionRules, null), container);
9
+ };
10
+ export default ConditionalFormatPortal;
@@ -127,6 +127,7 @@ import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleT
127
127
  import _ from "lodash";
128
128
  import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
129
129
  import DataVerificationPortal from "./dataVerificationPortal";
130
+ import ConditionalFormatPortal from "./conditionalFormatPortal";
130
131
  import WorkbookContext from "../../context";
131
132
  import "./index.css";
132
133
  import Button from "./Button";
@@ -135,10 +136,8 @@ import Combo from "./Combo";
135
136
  import Select, { Option } from "./Select";
136
137
  import SVGIcon from "../SVGIcon";
137
138
  import { useDialog } from "../../hooks/useDialog";
138
- import { useAlert } from "../../hooks/useAlert";
139
139
  import { SplitColumn } from "../SplitColumn";
140
140
  import { LocationCondition } from "../LocationCondition";
141
- import ConditionalFormat from "../ConditionFormat";
142
141
  import CustomButton from "./CustomButton";
143
142
  import { CustomColor } from "./CustomColor";
144
143
  import { FormatSearch } from "../FormatSearch";
@@ -482,33 +481,29 @@ var Toolbar = function Toolbar(_a) {
482
481
  var _l = useDialog(),
483
482
  showDialog = _l.showDialog,
484
483
  hideDialog = _l.hideDialog;
485
- var _m = useAlert(),
486
- showAlert = _m.showAlert,
487
- hideAlert = _m.hideAlert;
488
484
  var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
489
485
  var flowdata = getFlowdata(context);
490
486
  contextRef.current = context;
491
487
  var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
492
488
  var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
493
489
  var cell = flowdata && row != null && col != null ? (_c = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _c === void 0 ? void 0 : _c[col] : undefined;
494
- var _o = locale(context),
495
- toolbar = _o.toolbar,
496
- merge = _o.merge,
497
- border = _o.border,
498
- freezen = _o.freezen,
499
- defaultFmt = _o.defaultFmt,
500
- formula = _o.formula,
501
- sort = _o.sort,
502
- align = _o.align,
503
- textWrap = _o.textWrap,
504
- rotation = _o.rotation,
505
- screenshot = _o.screenshot,
506
- filter = _o.filter,
507
- splitText = _o.splitText,
508
- findAndReplace = _o.findAndReplace,
509
- comment = _o.comment,
510
- fontarray = _o.fontarray,
511
- sheetconfig = _o.sheetconfig;
490
+ var _m = locale(context),
491
+ toolbar = _m.toolbar,
492
+ merge = _m.merge,
493
+ border = _m.border,
494
+ freezen = _m.freezen,
495
+ defaultFmt = _m.defaultFmt,
496
+ formula = _m.formula,
497
+ sort = _m.sort,
498
+ align = _m.align,
499
+ textWrap = _m.textWrap,
500
+ rotation = _m.rotation,
501
+ screenshot = _m.screenshot,
502
+ filter = _m.filter,
503
+ splitText = _m.splitText,
504
+ findAndReplace = _m.findAndReplace,
505
+ comment = _m.comment,
506
+ fontarray = _m.fontarray;
512
507
  var toolbarFormat = locale(context).format;
513
508
  var sheetWidth = context.luckysheetTableContentHW[0];
514
509
  var currency = settings.currency;
@@ -598,9 +593,12 @@ var Toolbar = function Toolbar(_a) {
598
593
  ctx.dataVerification.dataRegulation.value1 = "value1";
599
594
  });
600
595
  }, []);
596
+ var _o = useState(false),
597
+ showDataValidation = _o[0],
598
+ setShowDataValidation = _o[1];
601
599
  var _p = useState(false),
602
- showDataValidation = _p[0],
603
- setShowDataValidation = _p[1];
600
+ showConditionalFormat = _p[0],
601
+ setShowConditionalFormat = _p[1];
604
602
  var dataVerificationClick = function dataVerificationClick(selectedCells) {
605
603
  var _a;
606
604
  var selection = api.getSelection(context);
@@ -622,6 +620,25 @@ var Toolbar = function Toolbar(_a) {
622
620
  useEffect(function () {
623
621
  window.dataVerificationClick = dataVerificationClick;
624
622
  }, []);
623
+ var conditionalFormatClick = function conditionalFormatClick(selectedCells) {
624
+ var _a;
625
+ console.log("conditionalFormatClick called");
626
+ var selection = api.getSelection(context);
627
+ if (!selection && !selectedCells) {
628
+ setContext(function (ctx) {
629
+ api.setSelection(ctx, [{
630
+ row: [0, 0],
631
+ column: [0, 0]
632
+ }], {
633
+ id: context.currentSheetId
634
+ });
635
+ });
636
+ }
637
+ (_a = document.getElementById("conditional-format-button")) === null || _a === void 0 ? void 0 : _a.click();
638
+ setTimeout(function () {
639
+ setShowConditionalFormat(true);
640
+ }, 100);
641
+ };
625
642
  var getToolbarItem = useCallback(function (name, i) {
626
643
  var _a, _b, _c, _d, _e, _f, _g;
627
644
  var tooltip = toolbar[name];
@@ -1117,17 +1134,13 @@ var Toolbar = function Toolbar(_a) {
1117
1134
  });
1118
1135
  }
1119
1136
  if (name === "conditionFormat") {
1120
- var items_4 = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
1121
- return /*#__PURE__*/React.createElement(Combo, {
1122
- iconId: "conditionFormat",
1137
+ var items = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
1138
+ return /*#__PURE__*/React.createElement(Button, {
1139
+ id: "conditionFormat",
1140
+ iconId: name,
1141
+ tooltip: tooltip,
1123
1142
  key: name,
1124
- tooltip: toolbar.conditionalFormat,
1125
- showArrow: false
1126
- }, function (setOpen) {
1127
- return /*#__PURE__*/React.createElement(ConditionalFormat, {
1128
- items: items_4,
1129
- setOpen: setOpen
1130
- });
1143
+ onClick: conditionalFormatClick
1131
1144
  });
1132
1145
  }
1133
1146
  if (name === "image") {
@@ -1288,12 +1301,8 @@ var Toolbar = function Toolbar(_a) {
1288
1301
  tooltip: tooltip,
1289
1302
  text: "\u5408\u5E76\u5355\u5143\u683C",
1290
1303
  onClick: function onClick() {
1291
- var confirmMessage = sheetconfig.confirmMerge;
1292
- showAlert(confirmMessage, "yesno", function () {
1293
- setContext(function (ctx) {
1294
- handleMerge(ctx, "merge-all");
1295
- });
1296
- hideAlert();
1304
+ return setContext(function (ctx) {
1305
+ handleMerge(ctx, "merge-all");
1297
1306
  });
1298
1307
  }
1299
1308
  }, function (setOpen) {
@@ -1304,21 +1313,10 @@ var Toolbar = function Toolbar(_a) {
1304
1313
  return /*#__PURE__*/React.createElement(Option, {
1305
1314
  key: value,
1306
1315
  onClick: function onClick() {
1307
- if (value === "merge-cancel") {
1308
- setContext(function (ctx) {
1309
- handleMerge(ctx, value);
1310
- });
1311
- setOpen(false);
1312
- } else {
1313
- setOpen(false);
1314
- var confirmMessage = sheetconfig.confirmMerge;
1315
- showAlert(confirmMessage, "yesno", function () {
1316
- setContext(function (ctx) {
1317
- handleMerge(ctx, value);
1318
- });
1319
- hideAlert();
1320
- });
1321
- }
1316
+ setContext(function (ctx) {
1317
+ handleMerge(ctx, value);
1318
+ });
1319
+ setOpen(false);
1322
1320
  }
1323
1321
  }, /*#__PURE__*/React.createElement("div", {
1324
1322
  style: {
@@ -1335,7 +1333,7 @@ var Toolbar = function Toolbar(_a) {
1335
1333
  });
1336
1334
  }
1337
1335
  if (name === "border") {
1338
- var items_5 = [{
1336
+ var items_4 = [{
1339
1337
  text: border.borderTop,
1340
1338
  value: "border-top",
1341
1339
  icon: "BorderTop"
@@ -1390,7 +1388,7 @@ var Toolbar = function Toolbar(_a) {
1390
1388
  }, function (setOpen) {
1391
1389
  return /*#__PURE__*/React.createElement("div", {
1392
1390
  className: "fortune-toolbar-select fortune-border-grid"
1393
- }, items_5.map(function (_a) {
1391
+ }, items_4.map(function (_a) {
1394
1392
  var value = _a.value,
1395
1393
  icon = _a.icon;
1396
1394
  return /*#__PURE__*/React.createElement("div", {
@@ -1411,7 +1409,7 @@ var Toolbar = function Toolbar(_a) {
1411
1409
  });
1412
1410
  }
1413
1411
  if (name === "freeze") {
1414
- var items_6 = [{
1412
+ var items_5 = [{
1415
1413
  text: freezen.freezenRowRange,
1416
1414
  value: "freeze-row"
1417
1415
  }, {
@@ -1435,7 +1433,7 @@ var Toolbar = function Toolbar(_a) {
1435
1433
  });
1436
1434
  }
1437
1435
  }, function (setOpen) {
1438
- return /*#__PURE__*/React.createElement(Select, null, items_6.map(function (_a) {
1436
+ return /*#__PURE__*/React.createElement(Select, null, items_5.map(function (_a) {
1439
1437
  var text = _a.text,
1440
1438
  value = _a.value;
1441
1439
  return /*#__PURE__*/React.createElement(Option, {
@@ -1457,7 +1455,7 @@ var Toolbar = function Toolbar(_a) {
1457
1455
  });
1458
1456
  }
1459
1457
  if (name === "text-wrap") {
1460
- var items_7 = [{
1458
+ var items_6 = [{
1461
1459
  text: textWrap.clip,
1462
1460
  iconId: "text-clip",
1463
1461
  value: "clip"
@@ -1470,9 +1468,9 @@ var Toolbar = function Toolbar(_a) {
1470
1468
  iconId: "text-wrap",
1471
1469
  value: "wrap"
1472
1470
  }];
1473
- var curr_3 = items_7[0];
1471
+ var curr_3 = items_6[0];
1474
1472
  if ((cell === null || cell === void 0 ? void 0 : cell.tb) != null) {
1475
- curr_3 = _.get(items_7, cell.tb);
1473
+ curr_3 = _.get(items_6, cell.tb);
1476
1474
  }
1477
1475
  return /*#__PURE__*/React.createElement(Combo, {
1478
1476
  iconId: curr_3.iconId,
@@ -1489,7 +1487,7 @@ var Toolbar = function Toolbar(_a) {
1489
1487
  justifyContent: "center",
1490
1488
  gap: 4
1491
1489
  }
1492
- }, items_7.map(function (_a) {
1490
+ }, items_6.map(function (_a) {
1493
1491
  var iconId = _a.iconId,
1494
1492
  value = _a.value;
1495
1493
  return /*#__PURE__*/React.createElement(IconButton, {
@@ -1520,7 +1518,7 @@ var Toolbar = function Toolbar(_a) {
1520
1518
  });
1521
1519
  }
1522
1520
  if (name === "text-rotation") {
1523
- var items_8 = [{
1521
+ var items_7 = [{
1524
1522
  text: rotation.none,
1525
1523
  iconId: "text-rotation-none",
1526
1524
  value: "none"
@@ -1545,9 +1543,9 @@ var Toolbar = function Toolbar(_a) {
1545
1543
  iconId: "text-rotation-down",
1546
1544
  value: "rotation-down"
1547
1545
  }];
1548
- var curr = items_8[0];
1546
+ var curr = items_7[0];
1549
1547
  if ((cell === null || cell === void 0 ? void 0 : cell.tr) != null) {
1550
- curr = _.get(items_8, cell.tr);
1548
+ curr = _.get(items_7, cell.tr);
1551
1549
  }
1552
1550
  return /*#__PURE__*/React.createElement(Combo, {
1553
1551
  iconId: curr.iconId,
@@ -1555,7 +1553,7 @@ var Toolbar = function Toolbar(_a) {
1555
1553
  tooltip: toolbar.textRotate,
1556
1554
  showArrow: false
1557
1555
  }, function (setOpen) {
1558
- return /*#__PURE__*/React.createElement(Select, null, items_8.map(function (_a) {
1556
+ return /*#__PURE__*/React.createElement(Select, null, items_7.map(function (_a) {
1559
1557
  var text = _a.text,
1560
1558
  iconId = _a.iconId,
1561
1559
  value = _a.value;
@@ -1580,7 +1578,7 @@ var Toolbar = function Toolbar(_a) {
1580
1578
  });
1581
1579
  }
1582
1580
  if (name === "filter") {
1583
- var items_9 = [{
1581
+ var items_8 = [{
1584
1582
  iconId: "sort-asc",
1585
1583
  value: "sort-asc",
1586
1584
  text: sort.asc,
@@ -1630,7 +1628,7 @@ var Toolbar = function Toolbar(_a) {
1630
1628
  style: {
1631
1629
  minWidth: "11.25rem"
1632
1630
  }
1633
- }, items_9.map(function (_a, index) {
1631
+ }, items_8.map(function (_a, index) {
1634
1632
  var text = _a.text,
1635
1633
  iconId = _a.iconId,
1636
1634
  value = _a.value,
@@ -1685,6 +1683,8 @@ var Toolbar = function Toolbar(_a) {
1685
1683
  "aria-label": toolbar.toolbar
1686
1684
  }, /*#__PURE__*/React.createElement(DataVerificationPortal, {
1687
1685
  visible: showDataValidation
1686
+ }), /*#__PURE__*/React.createElement(ConditionalFormatPortal, {
1687
+ visible: showConditionalFormat
1688
1688
  }), /*#__PURE__*/React.createElement("input", {
1689
1689
  id: "fortune-img-upload",
1690
1690
  className: "test-fortune-img-upload",
@@ -714,7 +714,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
714
714
  chartEditNoOpt: string;
715
715
  sheetNameSpecCharError: string;
716
716
  sheetNamecannotIsEmptyError: string;
717
- confirmMerge: string;
718
717
  };
719
718
  conditionformat: {
720
719
  conditionformat_greaterThan: string;
@@ -1197,4 +1196,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
1197
1196
  getRefs: () => any;
1198
1197
  getShowDialog: () => typeof useDialog;
1199
1198
  getSplitColComponent: () => import("react").FC<{}>;
1199
+ getConditionalFormatComponent: () => import("react").FC<{
1200
+ type?: string | undefined;
1201
+ }>;
1200
1202
  };
@@ -14,6 +14,7 @@ import _ from "lodash";
14
14
  import { getCryptoPrice } from "../../utils/cryptoApi";
15
15
  import { useDialog } from "../../hooks/useDialog";
16
16
  import { SplitColumn } from "../../components/SplitColumn";
17
+ import ConditionRules from "../ConditionFormat/ConditionRules";
17
18
  export function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache, refs) {
18
19
  return {
19
20
  applyOp: function applyOp(ops) {
@@ -452,6 +453,9 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
452
453
  },
453
454
  getSplitColComponent: function getSplitColComponent() {
454
455
  return SplitColumn;
456
+ },
457
+ getConditionalFormatComponent: function getConditionalFormatComponent() {
458
+ return ConditionRules;
455
459
  }
456
460
  };
457
461
  }
@@ -721,7 +721,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
721
721
  chartEditNoOpt: string;
722
722
  sheetNameSpecCharError: string;
723
723
  sheetNamecannotIsEmptyError: string;
724
- confirmMerge: string;
725
724
  };
726
725
  conditionformat: {
727
726
  conditionformat_greaterThan: string;
@@ -1204,5 +1203,8 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
1204
1203
  getRefs: () => any;
1205
1204
  getShowDialog: () => typeof import("../../hooks/useDialog").useDialog;
1206
1205
  getSplitColComponent: () => React.FC<{}>;
1206
+ getConditionalFormatComponent: () => React.FC<{
1207
+ type?: string | undefined;
1208
+ }>;
1207
1209
  }>>;
1208
1210
  export default Workbook;
@@ -34,6 +34,7 @@ import { ModalProvider } from "../../context/modal";
34
34
  import FilterMenu from "../ContextMenu/FilterMenu";
35
35
  import SheetList from "../SheetList";
36
36
  import DunePreview from "../DunePreview/DunePreview";
37
+ import ConditionRules from "../ConditionFormat/ConditionRules";
37
38
  enablePatches();
38
39
  var triggerGroupValuesRefresh = function triggerGroupValuesRefresh(ctx) {
39
40
  if (ctx.groupValuesRefreshData.length > 0) {
@@ -353,6 +354,10 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
353
354
  refs: refs
354
355
  };
355
356
  }, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce]);
357
+ var _e = useState(false),
358
+ show = _e[0],
359
+ setShow = _e[1];
360
+ var getCond = function getCond() {};
356
361
  useEffect(function () {
357
362
  if (!_.isEmpty(context.luckysheetfile)) {
358
363
  onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
@@ -680,7 +685,20 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
680
685
  }
681
686
  return /*#__PURE__*/React.createElement(WorkbookContext.Provider, {
682
687
  value: providerValue
683
- }, /*#__PURE__*/React.createElement(ModalProvider, null, /*#__PURE__*/React.createElement("div", {
688
+ }, /*#__PURE__*/React.createElement("button", {
689
+ onClick: function onClick() {
690
+ setShow(!show);
691
+ }
692
+ }, "Click"), show && /*#__PURE__*/React.createElement("div", {
693
+ id: "placeholder-conditional-formatting",
694
+ style: {
695
+ width: "500px",
696
+ height: "500px",
697
+ position: "fixed",
698
+ zIndex: "1000",
699
+ backgroundColor: "white"
700
+ }
701
+ }, /*#__PURE__*/React.createElement(ConditionRules, null)), /*#__PURE__*/React.createElement(ModalProvider, null, /*#__PURE__*/React.createElement("div", {
684
702
  className: "fortune-container",
685
703
  ref: workbookContainer,
686
704
  onKeyDown: onKeyDown