@fileverse-dev/fortune-react 1.2.98 → 1.2.99-ydoc

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 (37) 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/Dialog/index.js +24 -10
  6. package/es/components/ErrorState/index.js +6 -3
  7. package/es/components/LinkEidtCard/index.js +22 -13
  8. package/es/components/SheetOverlay/FormulaHint/index.js +48 -33
  9. package/es/components/SheetTab/SheetItem.js +29 -16
  10. package/es/components/SheetTab/index.js +35 -20
  11. package/es/components/Toolbar/Button.js +10 -3
  12. package/es/components/Toolbar/Combo.js +10 -2
  13. package/es/components/Toolbar/CustomButton.js +12 -3
  14. package/es/components/Toolbar/Select.js +7 -1
  15. package/es/components/Workbook/api.d.ts +2 -3
  16. package/es/components/Workbook/api.js +4 -4
  17. package/es/components/Workbook/index.d.ts +2 -3
  18. package/es/components/Workbook/index.js +114 -0
  19. package/lib/components/ConditionFormat/ConditionRules.d.ts +0 -1
  20. package/lib/components/ConditionFormat/ConditionRules.js +21 -12
  21. package/lib/components/ConditionFormat/index.js +2 -2
  22. package/lib/components/DataVerification/RangeDialog.js +19 -8
  23. package/lib/components/Dialog/index.js +24 -10
  24. package/lib/components/ErrorState/index.js +6 -3
  25. package/lib/components/LinkEidtCard/index.js +22 -13
  26. package/lib/components/SheetOverlay/FormulaHint/index.js +48 -33
  27. package/lib/components/SheetTab/SheetItem.js +29 -16
  28. package/lib/components/SheetTab/index.js +35 -20
  29. package/lib/components/Toolbar/Button.js +10 -3
  30. package/lib/components/Toolbar/Combo.js +10 -2
  31. package/lib/components/Toolbar/CustomButton.js +12 -3
  32. package/lib/components/Toolbar/Select.js +7 -1
  33. package/lib/components/Workbook/api.d.ts +2 -3
  34. package/lib/components/Workbook/api.js +4 -4
  35. package/lib/components/Workbook/index.d.ts +2 -3
  36. package/lib/components/Workbook/index.js +114 -0
  37. package/package.json +2 -2
@@ -130,8 +130,9 @@ var SheetTab = function SheetTab() {
130
130
  });
131
131
  var finalStats = statsFilter.length !== 6 ? [] : statsFilter;
132
132
  return /*#__PURE__*/React.createElement("div", null, showDisclaimer && (/*#__PURE__*/React.createElement("div", {
133
- className: "w-full",
133
+ className: "fortune-sheettab__info fortune-sheettab__disclaimer w-full",
134
134
  id: "denomination-warning",
135
+ "data-testid": "sheettab-info-disclaimer",
135
136
  style: {
136
137
  zIndex: 1003,
137
138
  position: "absolute",
@@ -148,36 +149,43 @@ var SheetTab = function SheetTab() {
148
149
  }, /*#__PURE__*/React.createElement("div", {
149
150
  className: "max-w-7xl mx-auto px-4 py-1 ".concat(isMobile && "w-full flex justify-between")
150
151
  }, /*#__PURE__*/React.createElement("p", {
151
- className: "".concat(isMobile ? "text-left" : "text-center", " text-xsm")
152
+ className: "fortune-sheettab__para ".concat(isMobile ? "text-left" : "text-center", " text-xsm"),
153
+ "data-testid": "sheettab-para-disclaimer"
152
154
  }, /*#__PURE__*/React.createElement("span", {
153
155
  className: "font-medium"
154
156
  }, "Disclaimer:"), " Prices are not updated in real time and may differ slightly. Updates may be delayed by up to 20 minutes."), isMobile && (/*#__PURE__*/React.createElement("p", {
155
- className: "ml-4 content-center cursor-pointer",
157
+ className: "fortune-sheettab__action fortune-sheettab__action--close-disclaimer ml-4 content-center cursor-pointer",
156
158
  style: {
157
159
  alignContent: "center"
158
160
  },
159
- onClick: handleCloseDisclaimer
161
+ onClick: handleCloseDisclaimer,
162
+ "data-testid": "sheettab-action-close-disclaimer"
160
163
  }, "Close"))))), /*#__PURE__*/React.createElement("div", {
161
- className: "luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
164
+ className: "fortune-sheettab luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
162
165
  onContextMenu: function onContextMenu(e) {
163
166
  return e.preventDefault();
164
167
  },
165
- id: "luckysheet-sheet-area"
168
+ id: "luckysheet-sheet-area",
169
+ "data-testid": "sheettab"
166
170
  }, /*#__PURE__*/React.createElement("div", {
167
- id: "luckysheet-sheet-content"
171
+ id: "luckysheet-sheet-content",
172
+ className: "fortune-sheettab__content",
173
+ "data-testid": "sheettab-content"
168
174
  }, context.allowEdit && (/*#__PURE__*/React.createElement(IconButton, {
169
- className: "fortune-sheettab-button border-none shadow-none",
175
+ className: "fortune-sheettab__cta fortune-sheettab-button border-none shadow-none",
170
176
  onClick: onAddSheetClick,
171
177
  elevation: 1,
172
178
  icon: "Plus",
173
179
  size: "sm",
174
- variant: "secondary"
180
+ variant: "secondary",
181
+ "data-testid": "sheettab-cta-add-sheet"
175
182
  })), context.allowEdit && (/*#__PURE__*/React.createElement("div", {
176
183
  className: "sheet-list-container"
177
184
  }, /*#__PURE__*/React.createElement("div", {
178
185
  id: "all-sheets",
179
- className: "fortune-sheettab-button",
186
+ className: "fortune-sheettab__icon fortune-sheettab-button",
180
187
  ref: tabContainerRef,
188
+ "data-testid": "sheettab-icon-all-sheets",
181
189
  onMouseDown: function onMouseDown(e) {
182
190
  e.stopPropagation();
183
191
  setContext(function (ctx) {
@@ -186,14 +194,16 @@ var SheetTab = function SheetTab() {
186
194
  });
187
195
  }
188
196
  }, /*#__PURE__*/React.createElement(IconButton, {
189
- className: "fortune-sheettab-button border-none shadow-none",
197
+ className: "fortune-sheettab__icon fortune-sheettab-button border-none shadow-none",
190
198
  elevation: 1,
191
199
  icon: "Menu",
192
200
  size: "sm",
193
- variant: "secondary"
201
+ variant: "secondary",
202
+ "data-testid": "sheettab-icon-menu"
194
203
  })))), /*#__PURE__*/React.createElement("div", {
195
- className: "fortune-sheettab-container",
196
- id: "fortune-sheettab-container"
204
+ className: "fortune-sheettab__tabs fortune-sheettab-container",
205
+ id: "fortune-sheettab-container",
206
+ "data-testid": "sheettab-tabs"
197
207
  }, !isShowBoundary && /*#__PURE__*/React.createElement("div", {
198
208
  className: "boundary boundary-left"
199
209
  }), /*#__PURE__*/React.createElement("div", {
@@ -246,21 +256,24 @@ var SheetTab = function SheetTab() {
246
256
  })))), /*#__PURE__*/React.createElement("div", {
247
257
  className: "fortune-sheet-area-right"
248
258
  }, statsFilter.length === 6 && calInfo.count > 1 && (/*#__PURE__*/React.createElement(Popover, null, /*#__PURE__*/React.createElement(PopoverTrigger, {
249
- className: "p-0 m-0 mr-2"
259
+ className: "fortune-sheettab__info-trigger p-0 m-0 mr-2",
260
+ "data-testid": "sheettab-info-stats-trigger"
250
261
  }, /*#__PURE__*/React.createElement(Button, {
251
262
  variant: "ghost",
252
- className: "w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
263
+ className: "fortune-sheettab__info fortune-sheettab__info--stats w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
253
264
  style: {
254
265
  height: "24px !important"
255
- }
266
+ },
267
+ "data-testid": "sheettab-info-stats"
256
268
  }, /*#__PURE__*/React.createElement("div", {
257
269
  className: "flex items-center"
258
270
  }, /*#__PURE__*/React.createElement("p", {
259
- className: "text-body-sm",
271
+ className: "fortune-sheettab__para fortune-sheettab__para--stats text-body-sm",
260
272
  style: {
261
273
  fontWeight: "500",
262
274
  marginRight: "8px"
263
- }
275
+ },
276
+ "data-testid": "sheettab-para-stats"
264
277
  }, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat]), /*#__PURE__*/React.createElement("svg", {
265
278
  xmlns: "http://www.w3.org/2000/svg",
266
279
  width: "18",
@@ -293,7 +306,9 @@ var SheetTab = function SheetTab() {
293
306
  return /*#__PURE__*/React.createElement(Button, {
294
307
  variant: "ghost",
295
308
  key: option.value,
296
- className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition mr-2 min-w-[50px] ".concat(selectedStat === option.value && "bg-[#F8F9FA]"),
309
+ className: "fortune-sheettab__stats-option fortune-sheettab__stats-option--".concat(option.value, " w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition mr-2 min-w-[50px] ").concat(selectedStat === option.value && "bg-[#F8F9FA]"),
310
+ "data-stat-value": option.value,
311
+ "data-testid": "sheettab-stats-option-".concat(option.value),
297
312
  onClick: function onClick() {
298
313
  return setSelectedStat(option.value);
299
314
  }
@@ -10,18 +10,25 @@ var Button = function Button(_a) {
10
10
  children = _a.children,
11
11
  style = _a.style,
12
12
  id = _a.id;
13
+ var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
13
14
  return /*#__PURE__*/React.createElement(Tooltip, {
14
15
  text: tooltip,
15
16
  placement: "bottom"
16
17
  }, /*#__PURE__*/React.createElement("div", {
17
18
  id: id,
18
- className: "fortune-toolbar-button fortune-toolbar-item",
19
+ className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button__cta fortune-toolbar-button--".concat(iconIdClass),
20
+ "data-icon-id": iconId,
19
21
  onClick: onClick,
20
22
  tabIndex: 0,
21
23
  role: "button",
22
24
  style: selected ? {
23
25
  backgroundColor: "#FFDF0A"
24
- } : style
26
+ } : style,
27
+ "data-testid": "toolbar-cta-".concat(id !== null && id !== void 0 ? id : iconId)
28
+ }, /*#__PURE__*/React.createElement("span", {
29
+ className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconIdClass),
30
+ "data-icon-id": iconId,
31
+ "data-testid": "toolbar-icon-".concat(iconId)
25
32
  }, /*#__PURE__*/React.createElement(LucideIcon, {
26
33
  name: getLucideIcon(iconId),
27
34
  width: 16,
@@ -29,6 +36,6 @@ var Button = function Button(_a) {
29
36
  style: disabled ? {
30
37
  opacity: 0.3
31
38
  } : {}
32
- }), children));
39
+ })), children));
33
40
  };
34
41
  export default Button;
@@ -2,6 +2,9 @@ import React, { useMemo, useRef, useState } from "react";
2
2
  import { IconButton, Tooltip, Popover, PopoverContent, PopoverTrigger, cn, Button, LucideIcon } from "@fileverse/ui";
3
3
  import SVGIcon from "../SVGIcon";
4
4
  import { getLucideIcon } from ".";
5
+ var toCssId = function toCssId(s) {
6
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
7
+ };
5
8
  var Combo = function Combo(_a) {
6
9
  var tooltip = _a.tooltip,
7
10
  _onClick = _a.onClick,
@@ -20,6 +23,7 @@ var Combo = function Combo(_a) {
20
23
  setOpen = _c[1];
21
24
  var buttonRef = useRef(null);
22
25
  var ref = useRef(null);
26
+ var iconIdClass = iconId ? toCssId(iconId) : "combo";
23
27
  if (!triggerRef) {
24
28
  triggerRef = ref;
25
29
  }
@@ -33,7 +37,9 @@ var Combo = function Combo(_a) {
33
37
  text: tooltip,
34
38
  placement: "bottom"
35
39
  }, /*#__PURE__*/React.createElement("div", {
36
- className: "fortune-toolbar-combo-button",
40
+ className: "fortune-toolbar-combo-button fortune-toolbar-combo-button--".concat(iconIdClass),
41
+ "data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
42
+ "data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
37
43
  onClick: function onClick(e) {
38
44
  if (_onClick) {
39
45
  _onClick(e);
@@ -93,7 +99,9 @@ var Combo = function Combo(_a) {
93
99
  })))));
94
100
  return /*#__PURE__*/React.createElement("div", {
95
101
  ref: buttonRef,
96
- className: "fortune-toolbar-item",
102
+ className: "fortune-toolbar-item fortune-toolbar-combo fortune-toolbar-combo--".concat(iconIdClass),
103
+ "data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
104
+ "data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
97
105
  onKeyDown: function onKeyDown(e) {
98
106
  e.stopPropagation();
99
107
  }
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  import { Tooltip } from "@fileverse/ui";
3
3
  import CustomIcon from "./CustomIcon";
4
+ var toCssId = function toCssId(s) {
5
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
6
+ };
4
7
  var CustomButton = function CustomButton(_a) {
5
8
  var tooltip = _a.tooltip,
6
9
  onClick = _a.onClick,
@@ -8,22 +11,28 @@ var CustomButton = function CustomButton(_a) {
8
11
  children = _a.children,
9
12
  iconName = _a.iconName,
10
13
  icon = _a.icon;
14
+ var iconNameClass = iconName ? toCssId(iconName) : "custom";
11
15
  return /*#__PURE__*/React.createElement(Tooltip, {
12
16
  text: tooltip,
13
17
  placement: "bottom"
14
18
  }, /*#__PURE__*/React.createElement("div", {
15
- className: "fortune-toolbar-button fortune-toolbar-item",
19
+ className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button--".concat(iconNameClass),
20
+ "data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined,
16
21
  onClick: onClick,
17
22
  tabIndex: 0,
18
23
  role: "button",
19
24
  style: selected ? {
20
25
  backgroundColor: "#FFDF0A"
21
- } : {}
26
+ } : {},
27
+ "data-testid": "toolbar-cta-".concat(iconName !== null && iconName !== void 0 ? iconName : "custom")
28
+ }, /*#__PURE__*/React.createElement("span", {
29
+ className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconNameClass),
30
+ "data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined
22
31
  }, /*#__PURE__*/React.createElement(CustomIcon, {
23
32
  width: 16,
24
33
  height: 16,
25
34
  iconName: iconName,
26
35
  content: icon
27
- }), children));
36
+ })), children));
28
37
  };
29
38
  export default CustomButton;
@@ -8,16 +8,22 @@ var Select = function Select(_a) {
8
8
  style: style
9
9
  }, children);
10
10
  };
11
+ var toCssId = function toCssId(s) {
12
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
13
+ };
11
14
  var Option = function Option(_a) {
12
15
  var iconId = _a.iconId,
13
16
  onClick = _a.onClick,
14
17
  children = _a.children,
15
18
  _onMouseLeave = _a.onMouseLeave,
16
19
  _onMouseEnter = _a.onMouseEnter;
20
+ var iconIdClass = iconId ? toCssId(iconId) : "option";
17
21
  return /*#__PURE__*/React.createElement("div", {
18
22
  onClick: onClick,
19
23
  tabIndex: 0,
20
- className: "fortune-toolbar-select-option",
24
+ className: "fortune-toolbar-select-option fortune-toolbar-select-option--".concat(iconIdClass),
25
+ "data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
26
+ "data-testid": "toolbar-select-option-".concat(iconId !== null && iconId !== void 0 ? iconId : "option"),
21
27
  onMouseLeave: function onMouseLeave(e) {
22
28
  return _onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(e);
23
29
  },
@@ -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;
@@ -1199,7 +1199,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
1199
1199
  getShowDialog: () => typeof useDialog;
1200
1200
  getSplitColComponent: () => import("react").FC<{}>;
1201
1201
  getConditionalFormatComponent: () => import("react").FC<{
1202
- type?: string | undefined;
1203
1202
  context?: any;
1204
1203
  }>;
1205
1204
  };
@@ -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) {
@@ -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;
@@ -1206,7 +1206,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
1206
1206
  getShowDialog: () => typeof import("../../hooks/useDialog").useDialog;
1207
1207
  getSplitColComponent: () => React.FC<{}>;
1208
1208
  getConditionalFormatComponent: () => React.FC<{
1209
- type?: string | undefined;
1210
1209
  context?: any;
1211
1210
  }>;
1212
1211
  }>>;
@@ -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);
@@ -2,7 +2,6 @@ import React from "react";
2
2
  import "./index.css";
3
3
  import "./formating.css";
4
4
  declare const ConditionRules: React.FC<{
5
- type?: string;
6
5
  context?: any;
7
6
  }>;
8
7
  export default ConditionRules;
@@ -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