@fileverse-dev/fortune-react 1.2.78-cf-3 → 1.2.78-example-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,7 +27,6 @@ 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);
|
|
31
30
|
var _e = useState(""),
|
|
32
31
|
editConditionRange = _e[0],
|
|
33
32
|
setEditConditionRange = _e[1];
|
|
@@ -48,8 +47,8 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
48
47
|
protection = _j.protection,
|
|
49
48
|
generalDialog = _j.generalDialog;
|
|
50
49
|
var _k = useState({
|
|
51
|
-
textColor: "#
|
|
52
|
-
cellColor: "#
|
|
50
|
+
textColor: "#FFFFFF",
|
|
51
|
+
cellColor: "#D82E2A"
|
|
53
52
|
}),
|
|
54
53
|
colorRules = _k[0],
|
|
55
54
|
setColorRules = _k[1];
|
|
@@ -67,7 +66,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
67
66
|
setStrikethrough = _p[1];
|
|
68
67
|
useEffect(function () {
|
|
69
68
|
var _a, _b;
|
|
70
|
-
if (create) return;
|
|
71
69
|
var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
|
|
72
70
|
var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
73
71
|
setAllConditionFormats(allCondition);
|
|
@@ -91,12 +89,10 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
91
89
|
setMatchedConditionFormatKey(matchedCondition);
|
|
92
90
|
}
|
|
93
91
|
if (buttonClickCreateRef.current) return;
|
|
94
|
-
if (matchedCondition.length
|
|
95
|
-
setCreate(false);
|
|
96
|
-
}
|
|
97
|
-
if (firstRenderRef.current && matchedCondition.length <= 0) {
|
|
92
|
+
if (matchedCondition.length === 0) {
|
|
98
93
|
setCreate(true);
|
|
99
|
-
|
|
94
|
+
} else if (matchedCondition.length > 0) {
|
|
95
|
+
setCreate(false);
|
|
100
96
|
}
|
|
101
97
|
}, [context]);
|
|
102
98
|
var updateCacheRules = function updateCacheRules() {
|
|
@@ -150,6 +146,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
150
146
|
buttonClickCreateRef.current = false;
|
|
151
147
|
setCreate(false);
|
|
152
148
|
setContext(function (ctx) {
|
|
149
|
+
console.log("whole rule", ctx.conditionRules);
|
|
153
150
|
ctx.conditionRules.textColor.color = colorRules.textColor;
|
|
154
151
|
ctx.conditionRules.cellColor.color = colorRules.cellColor;
|
|
155
152
|
ctx.conditionRules.font = {
|
|
@@ -206,14 +203,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
206
203
|
projectValue: "10"
|
|
207
204
|
};
|
|
208
205
|
});
|
|
209
|
-
setBold(false);
|
|
210
|
-
setItalic(false);
|
|
211
|
-
setUnderline(false);
|
|
212
|
-
setStrikethrough(false);
|
|
213
|
-
setColorRules({
|
|
214
|
-
textColor: "#177E23",
|
|
215
|
-
cellColor: "#DDFBDF"
|
|
216
|
-
});
|
|
217
206
|
updateCacheRules();
|
|
218
207
|
setEditConditionFormatKey(null);
|
|
219
208
|
setContext(function (ctx) {
|
|
@@ -482,7 +471,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
482
471
|
}, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/React.createElement("div", {
|
|
483
472
|
className: "w-full"
|
|
484
473
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
485
|
-
placeholder: "Value
|
|
474
|
+
placeholder: "Value",
|
|
486
475
|
onKeyDown: function onKeyDown(e) {
|
|
487
476
|
e.stopPropagation();
|
|
488
477
|
},
|
|
@@ -606,19 +595,9 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
606
595
|
}, "Formatting styles"), /*#__PURE__*/React.createElement("div", {
|
|
607
596
|
className: "toolbar-container"
|
|
608
597
|
}, /*#__PURE__*/React.createElement("div", {
|
|
609
|
-
className: "toolbar-header"
|
|
610
|
-
style: {
|
|
611
|
-
backgroundColor: colorRules.cellColor,
|
|
612
|
-
color: colorRules.textColor,
|
|
613
|
-
textDecoration: underline ? "underline" : "",
|
|
614
|
-
textDecorationLine: strikethrough ? "line-through" : ""
|
|
615
|
-
}
|
|
598
|
+
className: "toolbar-header"
|
|
616
599
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
617
|
-
className: "toolbar-title"
|
|
618
|
-
style: {
|
|
619
|
-
fontWeight: bold ? "bold" : "",
|
|
620
|
-
fontStyle: italic ? "italic" : ""
|
|
621
|
-
}
|
|
600
|
+
className: "toolbar-title"
|
|
622
601
|
}, "Formatting styles preview")), /*#__PURE__*/React.createElement("div", {
|
|
623
602
|
className: "toolbar-content"
|
|
624
603
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -795,7 +774,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
795
774
|
close("edit");
|
|
796
775
|
},
|
|
797
776
|
tabIndex: 0
|
|
798
|
-
}, "
|
|
777
|
+
}, "Edit rule")) : (/*#__PURE__*/React.createElement(Button, {
|
|
799
778
|
variant: "default",
|
|
800
779
|
style: {
|
|
801
780
|
minWidth: "80px"
|
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.toolbar-header {
|
|
11
|
+
background-color: #dcfce7;
|
|
11
12
|
padding: 4px 16px;
|
|
12
13
|
border-radius: var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) var(--border-radius-none, 0) var(--border-radius-none, 0);
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
border-bottom: 1px solid hsl(var(--color-border-default, #E8EBEC));
|
|
15
|
+
background: hsl(var(--color-bg-success-light, #DDFBDF));
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.toolbar-title {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
.toolbar-content {
|
|
@@ -98,4 +100,4 @@
|
|
|
98
100
|
width: 24px;
|
|
99
101
|
height: 24px;
|
|
100
102
|
color: #1f2937;
|
|
101
|
-
}
|
|
103
|
+
}
|
|
@@ -36,7 +36,6 @@ 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);
|
|
40
39
|
var _e = (0, _react.useState)(""),
|
|
41
40
|
editConditionRange = _e[0],
|
|
42
41
|
setEditConditionRange = _e[1];
|
|
@@ -57,8 +56,8 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
57
56
|
protection = _j.protection,
|
|
58
57
|
generalDialog = _j.generalDialog;
|
|
59
58
|
var _k = (0, _react.useState)({
|
|
60
|
-
textColor: "#
|
|
61
|
-
cellColor: "#
|
|
59
|
+
textColor: "#FFFFFF",
|
|
60
|
+
cellColor: "#D82E2A"
|
|
62
61
|
}),
|
|
63
62
|
colorRules = _k[0],
|
|
64
63
|
setColorRules = _k[1];
|
|
@@ -76,7 +75,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
76
75
|
setStrikethrough = _p[1];
|
|
77
76
|
(0, _react.useEffect)(function () {
|
|
78
77
|
var _a, _b;
|
|
79
|
-
if (create) return;
|
|
80
78
|
var index = (0, _fortuneCore.getSheetIndex)(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
|
|
81
79
|
var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
82
80
|
setAllConditionFormats(allCondition);
|
|
@@ -100,12 +98,10 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
100
98
|
setMatchedConditionFormatKey(matchedCondition);
|
|
101
99
|
}
|
|
102
100
|
if (buttonClickCreateRef.current) return;
|
|
103
|
-
if (matchedCondition.length
|
|
104
|
-
setCreate(false);
|
|
105
|
-
}
|
|
106
|
-
if (firstRenderRef.current && matchedCondition.length <= 0) {
|
|
101
|
+
if (matchedCondition.length === 0) {
|
|
107
102
|
setCreate(true);
|
|
108
|
-
|
|
103
|
+
} else if (matchedCondition.length > 0) {
|
|
104
|
+
setCreate(false);
|
|
109
105
|
}
|
|
110
106
|
}, [context]);
|
|
111
107
|
var updateCacheRules = function updateCacheRules() {
|
|
@@ -159,6 +155,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
159
155
|
buttonClickCreateRef.current = false;
|
|
160
156
|
setCreate(false);
|
|
161
157
|
setContext(function (ctx) {
|
|
158
|
+
console.log("whole rule", ctx.conditionRules);
|
|
162
159
|
ctx.conditionRules.textColor.color = colorRules.textColor;
|
|
163
160
|
ctx.conditionRules.cellColor.color = colorRules.cellColor;
|
|
164
161
|
ctx.conditionRules.font = {
|
|
@@ -215,14 +212,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
215
212
|
projectValue: "10"
|
|
216
213
|
};
|
|
217
214
|
});
|
|
218
|
-
setBold(false);
|
|
219
|
-
setItalic(false);
|
|
220
|
-
setUnderline(false);
|
|
221
|
-
setStrikethrough(false);
|
|
222
|
-
setColorRules({
|
|
223
|
-
textColor: "#177E23",
|
|
224
|
-
cellColor: "#DDFBDF"
|
|
225
|
-
});
|
|
226
215
|
updateCacheRules();
|
|
227
216
|
setEditConditionFormatKey(null);
|
|
228
217
|
setContext(function (ctx) {
|
|
@@ -491,7 +480,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
491
480
|
}, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/_react.default.createElement("div", {
|
|
492
481
|
className: "w-full"
|
|
493
482
|
}, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
|
|
494
|
-
placeholder: "Value
|
|
483
|
+
placeholder: "Value",
|
|
495
484
|
onKeyDown: function onKeyDown(e) {
|
|
496
485
|
e.stopPropagation();
|
|
497
486
|
},
|
|
@@ -615,19 +604,9 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
615
604
|
}, "Formatting styles"), /*#__PURE__*/_react.default.createElement("div", {
|
|
616
605
|
className: "toolbar-container"
|
|
617
606
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
618
|
-
className: "toolbar-header"
|
|
619
|
-
style: {
|
|
620
|
-
backgroundColor: colorRules.cellColor,
|
|
621
|
-
color: colorRules.textColor,
|
|
622
|
-
textDecoration: underline ? "underline" : "",
|
|
623
|
-
textDecorationLine: strikethrough ? "line-through" : ""
|
|
624
|
-
}
|
|
607
|
+
className: "toolbar-header"
|
|
625
608
|
}, /*#__PURE__*/_react.default.createElement("h2", {
|
|
626
|
-
className: "toolbar-title"
|
|
627
|
-
style: {
|
|
628
|
-
fontWeight: bold ? "bold" : "",
|
|
629
|
-
fontStyle: italic ? "italic" : ""
|
|
630
|
-
}
|
|
609
|
+
className: "toolbar-title"
|
|
631
610
|
}, "Formatting styles preview")), /*#__PURE__*/_react.default.createElement("div", {
|
|
632
611
|
className: "toolbar-content"
|
|
633
612
|
}, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
@@ -804,7 +783,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
804
783
|
close("edit");
|
|
805
784
|
},
|
|
806
785
|
tabIndex: 0
|
|
807
|
-
}, "
|
|
786
|
+
}, "Edit rule")) : (/*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
808
787
|
variant: "default",
|
|
809
788
|
style: {
|
|
810
789
|
minWidth: "80px"
|
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.toolbar-header {
|
|
11
|
+
background-color: #dcfce7;
|
|
11
12
|
padding: 4px 16px;
|
|
12
13
|
border-radius: var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) var(--border-radius-none, 0) var(--border-radius-none, 0);
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
border-bottom: 1px solid hsl(var(--color-border-default, #E8EBEC));
|
|
15
|
+
background: hsl(var(--color-bg-success-light, #DDFBDF));
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.toolbar-title {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
.toolbar-content {
|
|
@@ -98,4 +100,4 @@
|
|
|
98
100
|
width: 24px;
|
|
99
101
|
height: 24px;
|
|
100
102
|
color: #1f2937;
|
|
101
|
-
}
|
|
103
|
+
}
|
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.78-example-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-
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.78-example-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",
|