@fileverse-dev/fortune-react 1.2.78-cf-1 → 1.2.78-cf-3

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.
@@ -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];
@@ -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) {
@@ -471,7 +482,7 @@ var ConditionRules = function ConditionRules(_a) {
471
482
  }, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/React.createElement("div", {
472
483
  className: "w-full"
473
484
  }, /*#__PURE__*/React.createElement(TextField, {
474
- placeholder: "Value",
485
+ placeholder: "Value is required",
475
486
  onKeyDown: function onKeyDown(e) {
476
487
  e.stopPropagation();
477
488
  },
@@ -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;
@@ -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];
@@ -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) {
@@ -480,7 +491,7 @@ var ConditionRules = function ConditionRules(_a) {
480
491
  }, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/_react.default.createElement("div", {
481
492
  className: "w-full"
482
493
  }, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
483
- placeholder: "Value",
494
+ placeholder: "Value is required",
484
495
  onKeyDown: function onKeyDown(e) {
485
496
  e.stopPropagation();
486
497
  },
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.78-cf-1",
3
+ "version": "1.2.78-cf-3",
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-cf-1",
19
+ "@fileverse-dev/fortune-core": "1.2.78-cf-3",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",