@fileverse-dev/fortune-react 1.2.78 → 1.2.80

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, { useRef, useCallback, useContext, useEffect, useState } from "react";
2
2
  import "./index.css";
3
- import { cn, Button, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, TextField } from "@fileverse/ui";
3
+ import { cn, Button, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SelectGroup, SelectLabel, TextField } from "@fileverse/ui";
4
4
  import { locale, setConditionRules, getSheetIndex } from "@fileverse-dev/fortune-core";
5
5
  import produce from "immer";
6
6
  import { numberToColumn } from "../SheetOverlay/helper";
@@ -27,6 +27,7 @@ var ConditionRules = function ConditionRules(_a) {
27
27
  editConditionFormatKey = _d[0],
28
28
  setEditConditionFormatKey = _d[1];
29
29
  var editKeyRef = useRef(null);
30
+ var firstRenderRef = useRef(true);
30
31
  var _e = useState(""),
31
32
  editConditionRange = _e[0],
32
33
  setEditConditionRange = _e[1];
@@ -47,8 +48,8 @@ var ConditionRules = function ConditionRules(_a) {
47
48
  protection = _j.protection,
48
49
  generalDialog = _j.generalDialog;
49
50
  var _k = useState({
50
- textColor: "#FFFFFF",
51
- cellColor: "#D82E2A"
51
+ textColor: "#177E23",
52
+ cellColor: "#DDFBDF"
52
53
  }),
53
54
  colorRules = _k[0],
54
55
  setColorRules = _k[1];
@@ -66,6 +67,7 @@ var ConditionRules = function ConditionRules(_a) {
66
67
  setStrikethrough = _p[1];
67
68
  useEffect(function () {
68
69
  var _a, _b;
70
+ if (create) return;
69
71
  var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
70
72
  var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
71
73
  setAllConditionFormats(allCondition);
@@ -89,11 +91,13 @@ var ConditionRules = function ConditionRules(_a) {
89
91
  setMatchedConditionFormatKey(matchedCondition);
90
92
  }
91
93
  if (buttonClickCreateRef.current) return;
92
- if (matchedCondition.length === 0) {
93
- setCreate(true);
94
- } else if (matchedCondition.length > 0) {
94
+ if (matchedCondition.length >= 0) {
95
95
  setCreate(false);
96
96
  }
97
+ if (firstRenderRef.current && matchedCondition.length <= 0) {
98
+ setCreate(true);
99
+ firstRenderRef.current = false;
100
+ }
97
101
  }, [context]);
98
102
  var updateCacheRules = function updateCacheRules() {
99
103
  setContext(function (ctx) {
@@ -146,7 +150,6 @@ var ConditionRules = function ConditionRules(_a) {
146
150
  buttonClickCreateRef.current = false;
147
151
  setCreate(false);
148
152
  setContext(function (ctx) {
149
- console.log("whole rule", ctx.conditionRules);
150
153
  ctx.conditionRules.textColor.color = colorRules.textColor;
151
154
  ctx.conditionRules.cellColor.color = colorRules.cellColor;
152
155
  ctx.conditionRules.font = {
@@ -203,6 +206,14 @@ var ConditionRules = function ConditionRules(_a) {
203
206
  projectValue: "10"
204
207
  };
205
208
  });
209
+ setBold(false);
210
+ setItalic(false);
211
+ setUnderline(false);
212
+ setStrikethrough(false);
213
+ setColorRules({
214
+ textColor: "#177E23",
215
+ cellColor: "#DDFBDF"
216
+ });
206
217
  updateCacheRules();
207
218
  setEditConditionFormatKey(null);
208
219
  setContext(function (ctx) {
@@ -257,7 +268,7 @@ var ConditionRules = function ConditionRules(_a) {
257
268
  ctx.rangeDialog.rangeTxt = "";
258
269
  });
259
270
  }, [type]);
260
- var conditionList = [{
271
+ var cellHighlightConditionList = [{
261
272
  text: "greaterThan",
262
273
  value: ">",
263
274
  label: "Greater Than"
@@ -293,7 +304,8 @@ var ConditionRules = function ConditionRules(_a) {
293
304
  text: "duplicateValue",
294
305
  value: "##",
295
306
  label: "Duplicate Value"
296
- }, {
307
+ }];
308
+ var itemSelectionConditionList = [{
297
309
  text: "top10",
298
310
  value: conditionformat.top10
299
311
  }, {
@@ -459,19 +471,28 @@ var ConditionRules = function ConditionRules(_a) {
459
471
  sideOffset: 4,
460
472
  className: "z-[100]",
461
473
  "data-dropdown-content": "true"
462
- }, conditionList.map(function (option) {
474
+ }, /*#__PURE__*/React.createElement(SelectGroup, null, /*#__PURE__*/React.createElement(SelectLabel, null, "Cell highlight rules"), cellHighlightConditionList.map(function (option) {
463
475
  return /*#__PURE__*/React.createElement(SelectItem, {
464
476
  key: option.value,
465
477
  value: option.text
466
478
  }, /*#__PURE__*/React.createElement("div", {
467
479
  className: "flex items-center gap-2"
468
480
  }, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
469
- })))), !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
481
+ })), /*#__PURE__*/React.createElement(SelectGroup, null, /*#__PURE__*/React.createElement(SelectLabel, null, "Item selections rules"), itemSelectionConditionList.map(function (option) {
482
+ return /*#__PURE__*/React.createElement(SelectItem, {
483
+ key: option.value,
484
+ value: option.text
485
+ }, /*#__PURE__*/React.createElement("div", {
486
+ className: "flex items-center gap-2"
487
+ }, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
488
+ }))))), !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
470
489
  className: "flex flex-col"
471
490
  }, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/React.createElement("div", {
472
491
  className: "w-full"
473
492
  }, /*#__PURE__*/React.createElement(TextField, {
474
- placeholder: "Value",
493
+ label: "Value for condition",
494
+ required: true,
495
+ placeholder: "Value is required",
475
496
  onKeyDown: function onKeyDown(e) {
476
497
  e.stopPropagation();
477
498
  },
@@ -595,9 +616,19 @@ var ConditionRules = function ConditionRules(_a) {
595
616
  }, "Formatting styles"), /*#__PURE__*/React.createElement("div", {
596
617
  className: "toolbar-container"
597
618
  }, /*#__PURE__*/React.createElement("div", {
598
- className: "toolbar-header"
619
+ className: "toolbar-header",
620
+ style: {
621
+ backgroundColor: colorRules.cellColor,
622
+ color: colorRules.textColor,
623
+ textDecoration: underline ? "underline" : "",
624
+ textDecorationLine: strikethrough ? "line-through" : ""
625
+ }
599
626
  }, /*#__PURE__*/React.createElement("h2", {
600
- className: "toolbar-title"
627
+ className: "toolbar-title",
628
+ style: {
629
+ fontWeight: bold ? "bold" : "",
630
+ fontStyle: italic ? "italic" : ""
631
+ }
601
632
  }, "Formatting styles preview")), /*#__PURE__*/React.createElement("div", {
602
633
  className: "toolbar-content"
603
634
  }, /*#__PURE__*/React.createElement(Button, {
@@ -766,6 +797,7 @@ var ConditionRules = function ConditionRules(_a) {
766
797
  },
767
798
  tabIndex: 0
768
799
  }, button.cancel), editConditionFormatKey !== null ? (/*#__PURE__*/React.createElement(Button, {
800
+ disabled: context.conditionRules.rulesValue === "",
769
801
  variant: "default",
770
802
  style: {
771
803
  minWidth: "80px"
@@ -774,7 +806,8 @@ var ConditionRules = function ConditionRules(_a) {
774
806
  close("edit");
775
807
  },
776
808
  tabIndex: 0
777
- }, "Edit rule")) : (/*#__PURE__*/React.createElement(Button, {
809
+ }, "Update rule")) : (/*#__PURE__*/React.createElement(Button, {
810
+ disabled: context.conditionRules.rulesValue === "",
778
811
  variant: "default",
779
812
  style: {
780
813
  minWidth: "80px"
@@ -8,26 +8,25 @@
8
8
  }
9
9
 
10
10
  .toolbar-header {
11
- background-color: #dcfce7;
11
+ height: 36px;
12
12
  padding: 4px 16px;
13
13
  border-radius: var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) var(--border-radius-none, 0) var(--border-radius-none, 0);
14
- border-bottom: 1px solid hsl(var(--color-border-default, #E8EBEC));
15
- background: hsl(var(--color-bg-success-light, #DDFBDF));
14
+ border-bottom: 1px solid hsl(var(--color-border-default, #E8EBEC));
15
+ background: hsl(var(--color-bg-success-light, #DDFBDF));
16
16
  }
17
17
 
18
18
  .toolbar-title {
19
- color: hsl(var(--color-text-success, #177E23));
20
- font-family: "Helvetica Neue";
21
- font-size: 14px;
22
- font-style: normal;
23
- font-weight: 400;
24
- line-height: 20px;
19
+ font-family: "Helvetica Neue";
20
+ font-size: 14px;
21
+ font-style: normal;
22
+ font-weight: 400;
23
+ line-height: 20px;
25
24
  }
26
25
 
27
26
  .toolbar-content {
28
27
  padding: 4px;
29
28
  display: flex;
30
- gap: 16px;
29
+ gap: 12px;
31
30
  align-items: center;
32
31
  }
33
32
 
@@ -100,4 +99,4 @@ line-height: 20px;
100
99
  width: 24px;
101
100
  height: 24px;
102
101
  color: #1f2937;
103
- }
102
+ }
@@ -306,7 +306,7 @@ var FxEditor = function FxEditor() {
306
306
  }, /*#__PURE__*/React.createElement(NameBox, null), /*#__PURE__*/React.createElement("div", {
307
307
  className: "fortune-fx-icon",
308
308
  style: {
309
- cursor: 'pointer'
309
+ cursor: "pointer"
310
310
  },
311
311
  onClick: function onClick() {
312
312
  var _a;
@@ -185,13 +185,19 @@ var FormulaHint = function FormulaHint(props) {
185
185
  className: " flex-grow color-text-default"
186
186
  }, /*#__PURE__*/React.createElement("code", {
187
187
  style: {
188
- fontWeight: 500
188
+ fontWeight: "bold"
189
189
  },
190
190
  className: "luckysheet-arguments-help-function-name font-family-mono mb-1 mt-2 color-text-default font-family-mono"
191
191
  }, fn.n), /*#__PURE__*/React.createElement("code", {
192
- className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
192
+ className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default",
193
+ style: {
194
+ fontWeight: "bold"
195
+ }
193
196
  }, "("), /*#__PURE__*/React.createElement("code", {
194
- className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default"
197
+ className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default",
198
+ style: {
199
+ fontWeight: "bold"
200
+ }
195
201
  }, fn.p.map(function (param, i) {
196
202
  var name = param.name;
197
203
  if (param.repeat === "y") {
@@ -205,7 +211,8 @@ var FormulaHint = function FormulaHint(props) {
205
211
  dir: "auto",
206
212
  key: name,
207
213
  style: {
208
- backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
214
+ backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent",
215
+ fontWeight: "bold"
209
216
  }
210
217
  }, name), i !== fn.p.length - 1 && ", ");
211
218
  })), /*#__PURE__*/React.createElement("code", {
@@ -335,12 +342,13 @@ var FormulaHint = function FormulaHint(props) {
335
342
  className: "font-family-mono mb-1 color-text-secondary"
336
343
  }, formulaMore.helpExample), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
337
344
  style: {
338
- overflowWrap: "break-word"
345
+ overflowWrap: "break-word",
346
+ fontWeight: "bold"
339
347
  },
340
348
  className: "example-value-code"
341
349
  }, /*#__PURE__*/React.createElement("span", {
342
350
  className: "luckysheet-arguments-help-function-name"
343
- }, fn.n), /*#__PURE__*/React.createElement("span", {
351
+ }, "=", fn.n), /*#__PURE__*/React.createElement("span", {
344
352
  className: "luckysheet-arguments-paren"
345
353
  }, "("), /*#__PURE__*/React.createElement("span", {
346
354
  className: "luckysheet-arguments-parameter-holder"
@@ -348,8 +356,15 @@ var FormulaHint = function FormulaHint(props) {
348
356
  return /*#__PURE__*/React.createElement("span", {
349
357
  key: param.name,
350
358
  className: "luckysheet-arguments-help-parameter",
351
- dir: "auto"
352
- }, param.example, i !== fn.p.length - 1 && ", ");
359
+ dir: "auto",
360
+ style: {
361
+ color: param.type === "string" ? "#177E23" : "black"
362
+ }
363
+ }, param.example, /*#__PURE__*/React.createElement("span", {
364
+ style: {
365
+ color: "black"
366
+ }
367
+ }, i !== fn.p.length - 1 && ", "));
353
368
  })), /*#__PURE__*/React.createElement("span", {
354
369
  className: "luckysheet-arguments-paren"
355
370
  }, ")")))), /*#__PURE__*/React.createElement("div", {
@@ -381,6 +396,7 @@ var FormulaHint = function FormulaHint(props) {
381
396
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
382
397
  className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
383
398
  style: {
399
+ fontWeight: 600,
384
400
  backgroundColor: commaCount === index ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
385
401
  }
386
402
  }, param.name, param.repeat === "y" && (/*#__PURE__*/React.createElement("span", {
@@ -406,13 +422,42 @@ var FormulaHint = function FormulaHint(props) {
406
422
  borderBottomLeftRadius: "10px",
407
423
  borderBottomRightRadius: "10px"
408
424
  },
409
- className: "w-full"
425
+ className: "w-full flex items-center gap-4"
410
426
  }, /*#__PURE__*/React.createElement("div", {
411
427
  onClick: function onClick() {
412
428
  var _a;
413
429
  (_a = document.getElementById("function-button")) === null || _a === void 0 ? void 0 : _a.click();
414
430
  },
415
431
  className: "color-text-link cursor-pointer text-helper-text-sm"
416
- }, "Learn More")))))));
432
+ }, "Learn More"), (fn.n.includes("SMARTCONTRACT") || fn.n.includes("smartcontract")) && (/*#__PURE__*/React.createElement("div", {
433
+ className: "flex justify-center items-center gap-1 color-text-link cursor-pointer text-helper-text-sm ml-2",
434
+ onClick: function onClick() {
435
+ var _a;
436
+ (_a = document.getElementById("smartcontract-button")) === null || _a === void 0 ? void 0 : _a.click();
437
+ }
438
+ }, /*#__PURE__*/React.createElement("div", {
439
+ className: ""
440
+ }, /*#__PURE__*/React.createElement("svg", {
441
+ xmlns: "http://www.w3.org/2000/svg",
442
+ width: "17",
443
+ height: "17",
444
+ viewBox: "0 0 24 24",
445
+ fill: "none",
446
+ stroke: "currentColor",
447
+ strokeWidth: "2",
448
+ strokeLinecap: "round",
449
+ strokeLinejoin: "round",
450
+ className: "lucide lucide-circle-question-mark-icon lucide-circle-question-mark"
451
+ }, /*#__PURE__*/React.createElement("circle", {
452
+ cx: "12",
453
+ cy: "12",
454
+ r: "10"
455
+ }), /*#__PURE__*/React.createElement("path", {
456
+ d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
457
+ }), /*#__PURE__*/React.createElement("path", {
458
+ d: "M12 17h.01"
459
+ }))), /*#__PURE__*/React.createElement("span", {
460
+ className: "font-normal text-xs text-[#5c0aff]"
461
+ }, "How to use imported contract?")))))))));
417
462
  };
418
463
  export default FormulaHint;
@@ -36,6 +36,7 @@ var ConditionRules = function ConditionRules(_a) {
36
36
  editConditionFormatKey = _d[0],
37
37
  setEditConditionFormatKey = _d[1];
38
38
  var editKeyRef = (0, _react.useRef)(null);
39
+ var firstRenderRef = (0, _react.useRef)(true);
39
40
  var _e = (0, _react.useState)(""),
40
41
  editConditionRange = _e[0],
41
42
  setEditConditionRange = _e[1];
@@ -56,8 +57,8 @@ var ConditionRules = function ConditionRules(_a) {
56
57
  protection = _j.protection,
57
58
  generalDialog = _j.generalDialog;
58
59
  var _k = (0, _react.useState)({
59
- textColor: "#FFFFFF",
60
- cellColor: "#D82E2A"
60
+ textColor: "#177E23",
61
+ cellColor: "#DDFBDF"
61
62
  }),
62
63
  colorRules = _k[0],
63
64
  setColorRules = _k[1];
@@ -75,6 +76,7 @@ var ConditionRules = function ConditionRules(_a) {
75
76
  setStrikethrough = _p[1];
76
77
  (0, _react.useEffect)(function () {
77
78
  var _a, _b;
79
+ if (create) return;
78
80
  var index = (0, _fortuneCore.getSheetIndex)(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
79
81
  var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
80
82
  setAllConditionFormats(allCondition);
@@ -98,11 +100,13 @@ var ConditionRules = function ConditionRules(_a) {
98
100
  setMatchedConditionFormatKey(matchedCondition);
99
101
  }
100
102
  if (buttonClickCreateRef.current) return;
101
- if (matchedCondition.length === 0) {
102
- setCreate(true);
103
- } else if (matchedCondition.length > 0) {
103
+ if (matchedCondition.length >= 0) {
104
104
  setCreate(false);
105
105
  }
106
+ if (firstRenderRef.current && matchedCondition.length <= 0) {
107
+ setCreate(true);
108
+ firstRenderRef.current = false;
109
+ }
106
110
  }, [context]);
107
111
  var updateCacheRules = function updateCacheRules() {
108
112
  setContext(function (ctx) {
@@ -155,7 +159,6 @@ var ConditionRules = function ConditionRules(_a) {
155
159
  buttonClickCreateRef.current = false;
156
160
  setCreate(false);
157
161
  setContext(function (ctx) {
158
- console.log("whole rule", ctx.conditionRules);
159
162
  ctx.conditionRules.textColor.color = colorRules.textColor;
160
163
  ctx.conditionRules.cellColor.color = colorRules.cellColor;
161
164
  ctx.conditionRules.font = {
@@ -212,6 +215,14 @@ var ConditionRules = function ConditionRules(_a) {
212
215
  projectValue: "10"
213
216
  };
214
217
  });
218
+ setBold(false);
219
+ setItalic(false);
220
+ setUnderline(false);
221
+ setStrikethrough(false);
222
+ setColorRules({
223
+ textColor: "#177E23",
224
+ cellColor: "#DDFBDF"
225
+ });
215
226
  updateCacheRules();
216
227
  setEditConditionFormatKey(null);
217
228
  setContext(function (ctx) {
@@ -266,7 +277,7 @@ var ConditionRules = function ConditionRules(_a) {
266
277
  ctx.rangeDialog.rangeTxt = "";
267
278
  });
268
279
  }, [type]);
269
- var conditionList = [{
280
+ var cellHighlightConditionList = [{
270
281
  text: "greaterThan",
271
282
  value: ">",
272
283
  label: "Greater Than"
@@ -302,7 +313,8 @@ var ConditionRules = function ConditionRules(_a) {
302
313
  text: "duplicateValue",
303
314
  value: "##",
304
315
  label: "Duplicate Value"
305
- }, {
316
+ }];
317
+ var itemSelectionConditionList = [{
306
318
  text: "top10",
307
319
  value: conditionformat.top10
308
320
  }, {
@@ -468,19 +480,28 @@ var ConditionRules = function ConditionRules(_a) {
468
480
  sideOffset: 4,
469
481
  className: "z-[100]",
470
482
  "data-dropdown-content": "true"
471
- }, conditionList.map(function (option) {
483
+ }, /*#__PURE__*/_react.default.createElement(_ui.SelectGroup, null, /*#__PURE__*/_react.default.createElement(_ui.SelectLabel, null, "Cell highlight rules"), cellHighlightConditionList.map(function (option) {
472
484
  return /*#__PURE__*/_react.default.createElement(_ui.SelectItem, {
473
485
  key: option.value,
474
486
  value: option.text
475
487
  }, /*#__PURE__*/_react.default.createElement("div", {
476
488
  className: "flex items-center gap-2"
477
489
  }, /*#__PURE__*/_react.default.createElement("span", null, conditionformat[option.text])));
478
- })))), !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/_react.default.createElement("div", {
490
+ })), /*#__PURE__*/_react.default.createElement(_ui.SelectGroup, null, /*#__PURE__*/_react.default.createElement(_ui.SelectLabel, null, "Item selections rules"), itemSelectionConditionList.map(function (option) {
491
+ return /*#__PURE__*/_react.default.createElement(_ui.SelectItem, {
492
+ key: option.value,
493
+ value: option.text
494
+ }, /*#__PURE__*/_react.default.createElement("div", {
495
+ className: "flex items-center gap-2"
496
+ }, /*#__PURE__*/_react.default.createElement("span", null, conditionformat[option.text])));
497
+ }))))), !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/_react.default.createElement("div", {
479
498
  className: "flex flex-col"
480
499
  }, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/_react.default.createElement("div", {
481
500
  className: "w-full"
482
501
  }, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
483
- placeholder: "Value",
502
+ label: "Value for condition",
503
+ required: true,
504
+ placeholder: "Value is required",
484
505
  onKeyDown: function onKeyDown(e) {
485
506
  e.stopPropagation();
486
507
  },
@@ -604,9 +625,19 @@ var ConditionRules = function ConditionRules(_a) {
604
625
  }, "Formatting styles"), /*#__PURE__*/_react.default.createElement("div", {
605
626
  className: "toolbar-container"
606
627
  }, /*#__PURE__*/_react.default.createElement("div", {
607
- className: "toolbar-header"
628
+ className: "toolbar-header",
629
+ style: {
630
+ backgroundColor: colorRules.cellColor,
631
+ color: colorRules.textColor,
632
+ textDecoration: underline ? "underline" : "",
633
+ textDecorationLine: strikethrough ? "line-through" : ""
634
+ }
608
635
  }, /*#__PURE__*/_react.default.createElement("h2", {
609
- className: "toolbar-title"
636
+ className: "toolbar-title",
637
+ style: {
638
+ fontWeight: bold ? "bold" : "",
639
+ fontStyle: italic ? "italic" : ""
640
+ }
610
641
  }, "Formatting styles preview")), /*#__PURE__*/_react.default.createElement("div", {
611
642
  className: "toolbar-content"
612
643
  }, /*#__PURE__*/_react.default.createElement(_ui.Button, {
@@ -775,6 +806,7 @@ var ConditionRules = function ConditionRules(_a) {
775
806
  },
776
807
  tabIndex: 0
777
808
  }, button.cancel), editConditionFormatKey !== null ? (/*#__PURE__*/_react.default.createElement(_ui.Button, {
809
+ disabled: context.conditionRules.rulesValue === "",
778
810
  variant: "default",
779
811
  style: {
780
812
  minWidth: "80px"
@@ -783,7 +815,8 @@ var ConditionRules = function ConditionRules(_a) {
783
815
  close("edit");
784
816
  },
785
817
  tabIndex: 0
786
- }, "Edit rule")) : (/*#__PURE__*/_react.default.createElement(_ui.Button, {
818
+ }, "Update rule")) : (/*#__PURE__*/_react.default.createElement(_ui.Button, {
819
+ disabled: context.conditionRules.rulesValue === "",
787
820
  variant: "default",
788
821
  style: {
789
822
  minWidth: "80px"
@@ -8,26 +8,25 @@
8
8
  }
9
9
 
10
10
  .toolbar-header {
11
- background-color: #dcfce7;
11
+ height: 36px;
12
12
  padding: 4px 16px;
13
13
  border-radius: var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) var(--border-radius-none, 0) var(--border-radius-none, 0);
14
- border-bottom: 1px solid hsl(var(--color-border-default, #E8EBEC));
15
- background: hsl(var(--color-bg-success-light, #DDFBDF));
14
+ border-bottom: 1px solid hsl(var(--color-border-default, #E8EBEC));
15
+ background: hsl(var(--color-bg-success-light, #DDFBDF));
16
16
  }
17
17
 
18
18
  .toolbar-title {
19
- color: hsl(var(--color-text-success, #177E23));
20
- font-family: "Helvetica Neue";
21
- font-size: 14px;
22
- font-style: normal;
23
- font-weight: 400;
24
- line-height: 20px;
19
+ font-family: "Helvetica Neue";
20
+ font-size: 14px;
21
+ font-style: normal;
22
+ font-weight: 400;
23
+ line-height: 20px;
25
24
  }
26
25
 
27
26
  .toolbar-content {
28
27
  padding: 4px;
29
28
  display: flex;
30
- gap: 16px;
29
+ gap: 12px;
31
30
  align-items: center;
32
31
  }
33
32
 
@@ -100,4 +99,4 @@ line-height: 20px;
100
99
  width: 24px;
101
100
  height: 24px;
102
101
  color: #1f2937;
103
- }
102
+ }
@@ -315,7 +315,7 @@ var FxEditor = function FxEditor() {
315
315
  }, /*#__PURE__*/_react.default.createElement(_NameBox.default, null), /*#__PURE__*/_react.default.createElement("div", {
316
316
  className: "fortune-fx-icon",
317
317
  style: {
318
- cursor: 'pointer'
318
+ cursor: "pointer"
319
319
  },
320
320
  onClick: function onClick() {
321
321
  var _a;
@@ -194,13 +194,19 @@ var FormulaHint = function FormulaHint(props) {
194
194
  className: " flex-grow color-text-default"
195
195
  }, /*#__PURE__*/_react.default.createElement("code", {
196
196
  style: {
197
- fontWeight: 500
197
+ fontWeight: "bold"
198
198
  },
199
199
  className: "luckysheet-arguments-help-function-name font-family-mono mb-1 mt-2 color-text-default font-family-mono"
200
200
  }, fn.n), /*#__PURE__*/_react.default.createElement("code", {
201
- className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
201
+ className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default",
202
+ style: {
203
+ fontWeight: "bold"
204
+ }
202
205
  }, "("), /*#__PURE__*/_react.default.createElement("code", {
203
- className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default"
206
+ className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default",
207
+ style: {
208
+ fontWeight: "bold"
209
+ }
204
210
  }, fn.p.map(function (param, i) {
205
211
  var name = param.name;
206
212
  if (param.repeat === "y") {
@@ -214,7 +220,8 @@ var FormulaHint = function FormulaHint(props) {
214
220
  dir: "auto",
215
221
  key: name,
216
222
  style: {
217
- backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
223
+ backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent",
224
+ fontWeight: "bold"
218
225
  }
219
226
  }, name), i !== fn.p.length - 1 && ", ");
220
227
  })), /*#__PURE__*/_react.default.createElement("code", {
@@ -344,12 +351,13 @@ var FormulaHint = function FormulaHint(props) {
344
351
  className: "font-family-mono mb-1 color-text-secondary"
345
352
  }, formulaMore.helpExample), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
346
353
  style: {
347
- overflowWrap: "break-word"
354
+ overflowWrap: "break-word",
355
+ fontWeight: "bold"
348
356
  },
349
357
  className: "example-value-code"
350
358
  }, /*#__PURE__*/_react.default.createElement("span", {
351
359
  className: "luckysheet-arguments-help-function-name"
352
- }, fn.n), /*#__PURE__*/_react.default.createElement("span", {
360
+ }, "=", fn.n), /*#__PURE__*/_react.default.createElement("span", {
353
361
  className: "luckysheet-arguments-paren"
354
362
  }, "("), /*#__PURE__*/_react.default.createElement("span", {
355
363
  className: "luckysheet-arguments-parameter-holder"
@@ -357,8 +365,15 @@ var FormulaHint = function FormulaHint(props) {
357
365
  return /*#__PURE__*/_react.default.createElement("span", {
358
366
  key: param.name,
359
367
  className: "luckysheet-arguments-help-parameter",
360
- dir: "auto"
361
- }, param.example, i !== fn.p.length - 1 && ", ");
368
+ dir: "auto",
369
+ style: {
370
+ color: param.type === "string" ? "#177E23" : "black"
371
+ }
372
+ }, param.example, /*#__PURE__*/_react.default.createElement("span", {
373
+ style: {
374
+ color: "black"
375
+ }
376
+ }, i !== fn.p.length - 1 && ", "));
362
377
  })), /*#__PURE__*/_react.default.createElement("span", {
363
378
  className: "luckysheet-arguments-paren"
364
379
  }, ")")))), /*#__PURE__*/_react.default.createElement("div", {
@@ -390,6 +405,7 @@ var FormulaHint = function FormulaHint(props) {
390
405
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
391
406
  className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
392
407
  style: {
408
+ fontWeight: 600,
393
409
  backgroundColor: commaCount === index ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
394
410
  }
395
411
  }, param.name, param.repeat === "y" && (/*#__PURE__*/_react.default.createElement("span", {
@@ -415,13 +431,42 @@ var FormulaHint = function FormulaHint(props) {
415
431
  borderBottomLeftRadius: "10px",
416
432
  borderBottomRightRadius: "10px"
417
433
  },
418
- className: "w-full"
434
+ className: "w-full flex items-center gap-4"
419
435
  }, /*#__PURE__*/_react.default.createElement("div", {
420
436
  onClick: function onClick() {
421
437
  var _a;
422
438
  (_a = document.getElementById("function-button")) === null || _a === void 0 ? void 0 : _a.click();
423
439
  },
424
440
  className: "color-text-link cursor-pointer text-helper-text-sm"
425
- }, "Learn More")))))));
441
+ }, "Learn More"), (fn.n.includes("SMARTCONTRACT") || fn.n.includes("smartcontract")) && (/*#__PURE__*/_react.default.createElement("div", {
442
+ className: "flex justify-center items-center gap-1 color-text-link cursor-pointer text-helper-text-sm ml-2",
443
+ onClick: function onClick() {
444
+ var _a;
445
+ (_a = document.getElementById("smartcontract-button")) === null || _a === void 0 ? void 0 : _a.click();
446
+ }
447
+ }, /*#__PURE__*/_react.default.createElement("div", {
448
+ className: ""
449
+ }, /*#__PURE__*/_react.default.createElement("svg", {
450
+ xmlns: "http://www.w3.org/2000/svg",
451
+ width: "17",
452
+ height: "17",
453
+ viewBox: "0 0 24 24",
454
+ fill: "none",
455
+ stroke: "currentColor",
456
+ strokeWidth: "2",
457
+ strokeLinecap: "round",
458
+ strokeLinejoin: "round",
459
+ className: "lucide lucide-circle-question-mark-icon lucide-circle-question-mark"
460
+ }, /*#__PURE__*/_react.default.createElement("circle", {
461
+ cx: "12",
462
+ cy: "12",
463
+ r: "10"
464
+ }), /*#__PURE__*/_react.default.createElement("path", {
465
+ d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
466
+ }), /*#__PURE__*/_react.default.createElement("path", {
467
+ d: "M12 17h.01"
468
+ }))), /*#__PURE__*/_react.default.createElement("span", {
469
+ className: "font-normal text-xs text-[#5c0aff]"
470
+ }, "How to use imported contract?")))))))));
426
471
  };
427
472
  var _default = exports.default = FormulaHint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.78",
3
+ "version": "1.2.80",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.2.78",
19
+ "@fileverse-dev/fortune-core": "1.2.80",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",