@fileverse-dev/fortune-react 1.2.64-patch-6 → 1.2.64-patch-8
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.
- package/es/components/ConditionFormat/ConditionRules.d.ts +1 -0
- package/es/components/ConditionFormat/ConditionRules.js +253 -126
- package/es/components/ConditionFormat/formating.css +103 -0
- package/es/components/ConditionFormat/index.css +62 -5
- package/es/components/ConditionFormat/index.js +2 -4
- package/es/components/Toolbar/index.d.ts +1 -1
- package/es/components/Workbook/index.js +12 -1
- package/lib/components/ConditionFormat/ConditionRules.d.ts +1 -0
- package/lib/components/ConditionFormat/ConditionRules.js +251 -125
- package/lib/components/ConditionFormat/formating.css +103 -0
- package/lib/components/ConditionFormat/index.css +62 -5
- package/lib/components/ConditionFormat/index.js +1 -3
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/components/Workbook/index.js +12 -1
- package/package.json +2 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useEffect, useState } from "react";
|
|
1
|
+
import React, { useRef, useCallback, useContext, useEffect, useState } from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
+
import { cn } from "@fileverse/ui";
|
|
3
4
|
import { locale, setConditionRules, getSheetIndex } from "@fileverse-dev/fortune-core";
|
|
4
5
|
import { numberToColumn } from "../SheetOverlay/helper";
|
|
6
|
+
import "./formating.css";
|
|
5
7
|
import produce from "immer";
|
|
6
|
-
import { Button,
|
|
8
|
+
import { Button, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, TextField } from "@fileverse/ui";
|
|
7
9
|
import WorkbookContext from "../../context";
|
|
8
10
|
import { useDialog } from "../../hooks/useDialog";
|
|
9
11
|
import { getDisplayedRangeTxt } from "../DataVerification/getDisplayedRangeTxt";
|
|
@@ -18,6 +20,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
18
20
|
var _c = useState(false),
|
|
19
21
|
create = _c[0],
|
|
20
22
|
setCreate = _c[1];
|
|
23
|
+
var buttonClickCreateRef = useRef(false);
|
|
21
24
|
var _d = useState([]),
|
|
22
25
|
matchedConditionFormatKey = _d[0],
|
|
23
26
|
setMatchedConditionFormatKey = _d[1];
|
|
@@ -37,27 +40,30 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
37
40
|
}),
|
|
38
41
|
colorRules = _g[0],
|
|
39
42
|
setColorRules = _g[1];
|
|
43
|
+
var _h = useState(false),
|
|
44
|
+
bold = _h[0],
|
|
45
|
+
setBold = _h[1];
|
|
46
|
+
var _j = useState(false),
|
|
47
|
+
italic = _j[0],
|
|
48
|
+
setItalic = _j[1];
|
|
49
|
+
var _k = useState(false),
|
|
50
|
+
underline = _k[0],
|
|
51
|
+
setUnderline = _k[1];
|
|
52
|
+
var _l = useState(false),
|
|
53
|
+
strikethrough = _l[0],
|
|
54
|
+
setStrikethrough = _l[1];
|
|
40
55
|
useEffect(function () {
|
|
41
|
-
|
|
42
|
-
var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
|
|
43
|
-
var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
44
|
-
console.log("====whyallCondition", allCondition);
|
|
45
|
-
}, [context]);
|
|
46
|
-
useEffect(function () {
|
|
47
|
-
var _a, _b, _c, _d;
|
|
56
|
+
var _a, _b, _c;
|
|
48
57
|
var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
|
|
49
58
|
var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
50
59
|
setAllConditionFormats(allCondition);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var selectionColumn = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].column;
|
|
54
|
-
var selectionRow = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[0].row;
|
|
60
|
+
var selectionColumn = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0].column;
|
|
61
|
+
var selectionRow = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].row;
|
|
55
62
|
var matchedCondition = [];
|
|
56
63
|
if (allCondition) {
|
|
57
64
|
for (var key in allCondition) {
|
|
58
65
|
var conditionFormat = allCondition[key];
|
|
59
|
-
var range = (
|
|
60
|
-
console.log("rangeObj", conditionFormat, range);
|
|
66
|
+
var range = (_c = conditionFormat.cellrange) === null || _c === void 0 ? void 0 : _c[0];
|
|
61
67
|
if (!range || !selectionColumn || !selectionRow) continue;
|
|
62
68
|
var rangeColumns = range.column;
|
|
63
69
|
var rangeRows = range.row;
|
|
@@ -69,9 +75,8 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
69
75
|
}
|
|
70
76
|
setMatchedConditionFormatKey(matchedCondition);
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
if (buttonClickCreateRef.current) return;
|
|
73
79
|
if (matchedCondition.length === 0) {
|
|
74
|
-
console.log('whyyyyyyy');
|
|
75
80
|
setCreate(true);
|
|
76
81
|
} else if (matchedCondition.length > 0) {
|
|
77
82
|
setCreate(false);
|
|
@@ -90,15 +95,26 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
90
95
|
}, [colorRules.cellColor, colorRules.textColor, hideDialog, setContext]);
|
|
91
96
|
var close = useCallback(function (closeType) {
|
|
92
97
|
if (closeType === "confirm") {
|
|
98
|
+
buttonClickCreateRef.current = false;
|
|
99
|
+
setCreate(false);
|
|
93
100
|
setContext(function (ctx) {
|
|
94
101
|
ctx.conditionRules.textColor.color = colorRules.textColor;
|
|
95
102
|
ctx.conditionRules.cellColor.color = colorRules.cellColor;
|
|
103
|
+
ctx.conditionRules.font = {
|
|
104
|
+
bold: bold,
|
|
105
|
+
italic: italic,
|
|
106
|
+
underline: underline,
|
|
107
|
+
strikethrough: strikethrough
|
|
108
|
+
};
|
|
96
109
|
setConditionRules(ctx, protection, generalDialog, conditionformat, ctx.conditionRules);
|
|
97
110
|
});
|
|
111
|
+
} else {
|
|
112
|
+
buttonClickCreateRef.current = true;
|
|
113
|
+
setCreate(false);
|
|
98
114
|
}
|
|
99
115
|
setContext(function (ctx) {
|
|
100
116
|
ctx.conditionRules = {
|
|
101
|
-
rulesType: "",
|
|
117
|
+
rulesType: "greaterThan",
|
|
102
118
|
rulesValue: "",
|
|
103
119
|
textColor: {
|
|
104
120
|
check: true,
|
|
@@ -108,6 +124,12 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
108
124
|
check: true,
|
|
109
125
|
color: "#000000"
|
|
110
126
|
},
|
|
127
|
+
font: {
|
|
128
|
+
bold: false,
|
|
129
|
+
italic: false,
|
|
130
|
+
underline: false,
|
|
131
|
+
strikethrough: false
|
|
132
|
+
},
|
|
111
133
|
betweenValue: {
|
|
112
134
|
value1: "",
|
|
113
135
|
value2: ""
|
|
@@ -118,16 +140,7 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
118
140
|
};
|
|
119
141
|
});
|
|
120
142
|
hideDialog();
|
|
121
|
-
}, [colorRules, conditionformat, generalDialog, hideDialog, protection, setContext]);
|
|
122
|
-
useEffect(function () {
|
|
123
|
-
console.log("add mouseDown listener", window);
|
|
124
|
-
window.addEventListener("mouseDown", function (e) {
|
|
125
|
-
var _a, _b;
|
|
126
|
-
var selectionColumn = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0].column;
|
|
127
|
-
var selectionRow = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].row;
|
|
128
|
-
console.log("mouseDown", selectionColumn, selectionRow, context);
|
|
129
|
-
});
|
|
130
|
-
}, [type]);
|
|
143
|
+
}, [colorRules, conditionformat, generalDialog, hideDialog, protection, setContext, bold, italic, underline, strikethrough]);
|
|
131
144
|
useEffect(function () {
|
|
132
145
|
setContext(function (ctx) {
|
|
133
146
|
ctx.conditionRules.rulesType = type;
|
|
@@ -152,6 +165,12 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
152
165
|
check: true,
|
|
153
166
|
color: "#000000"
|
|
154
167
|
},
|
|
168
|
+
font: {
|
|
169
|
+
bold: false,
|
|
170
|
+
italic: false,
|
|
171
|
+
underline: false,
|
|
172
|
+
strikethrough: false
|
|
173
|
+
},
|
|
155
174
|
betweenValue: {
|
|
156
175
|
value1: "",
|
|
157
176
|
value2: ""
|
|
@@ -228,46 +247,122 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
228
247
|
var titleType = type === "top10_percent" ? "top10" : type === "last10_percent" ? "last10" : type;
|
|
229
248
|
return /*#__PURE__*/React.createElement("div", {
|
|
230
249
|
className: "condition-rules"
|
|
231
|
-
}, !create ? (/*#__PURE__*/React.createElement("div", null,
|
|
250
|
+
}, !create ? (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
251
|
+
style: {
|
|
252
|
+
marginBottom: "16px"
|
|
253
|
+
}
|
|
254
|
+
}, matchedConditionFormatKey.map(function (key) {
|
|
232
255
|
var _a, _b;
|
|
233
256
|
return /*#__PURE__*/React.createElement("div", {
|
|
234
|
-
className: "flex items-center
|
|
257
|
+
className: "group flex items-center border-b border-gray-200 condition-list-parent",
|
|
235
258
|
key: key
|
|
236
259
|
}, /*#__PURE__*/React.createElement("div", {
|
|
237
|
-
className: "
|
|
260
|
+
className: "condition-list-pill",
|
|
238
261
|
style: {
|
|
239
|
-
backgroundColor: allConditionFormats[key].format.cellColor || ""
|
|
240
|
-
width: '44px',
|
|
241
|
-
height: '56px'
|
|
262
|
+
backgroundColor: allConditionFormats[key].format.cellColor || ""
|
|
242
263
|
}
|
|
243
264
|
}, /*#__PURE__*/React.createElement("span", {
|
|
244
|
-
className: "
|
|
265
|
+
className: "condition-list-text",
|
|
266
|
+
style: {
|
|
267
|
+
color: allConditionFormats[key].format.textColor || ""
|
|
268
|
+
}
|
|
245
269
|
}, "123")), /*#__PURE__*/React.createElement("div", {
|
|
246
|
-
className: "flex flex-col"
|
|
270
|
+
className: "flex flex-col",
|
|
271
|
+
style: {
|
|
272
|
+
width: '200px',
|
|
273
|
+
padding: '8px 0px'
|
|
274
|
+
}
|
|
247
275
|
}, /*#__PURE__*/React.createElement("h3", {
|
|
248
|
-
className: "
|
|
276
|
+
className: "condition-list-type"
|
|
249
277
|
}, conditionformat[allConditionFormats[key].conditionName], ' ', (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/React.createElement("p", {
|
|
250
|
-
className: "
|
|
278
|
+
className: "condition-list-range"
|
|
251
279
|
}, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
|
|
252
280
|
var startCol = numberToColumn(range.column[0] + 1);
|
|
253
281
|
var endCol = numberToColumn(range.column[1] + 1);
|
|
254
282
|
var startRow = range.row[0] + 1;
|
|
255
283
|
var endRow = range.row[1] + 1;
|
|
256
284
|
return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
|
|
257
|
-
}).join(", ")))
|
|
258
|
-
|
|
285
|
+
}).join(", "))), /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
className: "opacity-0 group-hover:opacity-100 transition-opacity"
|
|
287
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
288
|
+
elevation: 1,
|
|
289
|
+
icon: "Trash2",
|
|
290
|
+
size: "md",
|
|
291
|
+
variant: "secondary",
|
|
292
|
+
style: {
|
|
293
|
+
border: '0px',
|
|
294
|
+
boxShadow: 'none',
|
|
295
|
+
color: 'hsl(var(--color-icon-secondary))'
|
|
296
|
+
},
|
|
297
|
+
onClick: function onClick() {
|
|
298
|
+
setContext(function (ctx) {
|
|
299
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
300
|
+
var ruleArr = ctx.luckysheetfile[index].luckysheet_conditionformat_save || [];
|
|
301
|
+
console.log(matchedConditionFormatKey, ruleArr, allConditionFormats);
|
|
302
|
+
ruleArr.splice(Number(key), 1);
|
|
303
|
+
ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
|
|
304
|
+
return ctx;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
})));
|
|
308
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
259
309
|
size: "md",
|
|
260
310
|
variant: "secondary",
|
|
261
311
|
onClick: function onClick() {
|
|
262
312
|
setCreate(true);
|
|
313
|
+
buttonClickCreateRef.current = true;
|
|
263
314
|
}
|
|
264
|
-
}, "Create New Condition Format"))) : (/*#__PURE__*/React.createElement(React.Fragment, null,
|
|
315
|
+
}, "Create New Condition Format"))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
265
316
|
className: "flex flex-col"
|
|
266
317
|
}, /*#__PURE__*/React.createElement("div", {
|
|
267
318
|
className: "condition-rules-value text-heading-xsm"
|
|
268
|
-
}, conditionformat
|
|
319
|
+
}, conditionformat.applyRange, " range"), /*#__PURE__*/React.createElement(TextField, {
|
|
320
|
+
rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
|
|
321
|
+
name: "Grid2x2",
|
|
322
|
+
size: "sm",
|
|
323
|
+
onClick: function onClick() {
|
|
324
|
+
dataSelectRange("conditionRules".concat(type));
|
|
325
|
+
}
|
|
326
|
+
}),
|
|
327
|
+
"aria-hidden": "true",
|
|
328
|
+
readOnly: true,
|
|
329
|
+
placeholder: conditionformat.selectRange,
|
|
330
|
+
value: getDisplayedRangeTxt(context),
|
|
331
|
+
onClick: function onClick() {
|
|
332
|
+
dataSelectRange("conditionRules".concat(type));
|
|
333
|
+
}
|
|
334
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
335
|
+
className: "condition-rules-value text-heading-xsm"
|
|
336
|
+
}, "Format cells if"), /*#__PURE__*/React.createElement(Select, {
|
|
337
|
+
value: type,
|
|
338
|
+
onValueChange: function onValueChange(value) {
|
|
339
|
+
setType(value);
|
|
340
|
+
}
|
|
341
|
+
}, /*#__PURE__*/React.createElement(SelectTrigger, null, /*#__PURE__*/React.createElement(SelectValue, null, /*#__PURE__*/React.createElement("div", {
|
|
342
|
+
className: "flex items-center gap-2"
|
|
343
|
+
}, /*#__PURE__*/React.createElement("span", null, conditionformat[type])))), /*#__PURE__*/React.createElement(SelectContent, {
|
|
344
|
+
position: "popper",
|
|
345
|
+
side: "bottom",
|
|
346
|
+
align: "start",
|
|
347
|
+
sideOffset: 4,
|
|
348
|
+
className: "z-[100]",
|
|
349
|
+
"data-dropdown-content": "true"
|
|
350
|
+
}, conditionList.map(function (option) {
|
|
351
|
+
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
352
|
+
key: option.value,
|
|
353
|
+
value: option.text
|
|
354
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
355
|
+
className: "flex items-center gap-2"
|
|
356
|
+
}, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
|
|
357
|
+
})))), !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
|
|
358
|
+
className: "flex flex-col"
|
|
359
|
+
}, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/React.createElement("div", {
|
|
269
360
|
className: "w-full"
|
|
270
361
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
362
|
+
placeholder: "Value",
|
|
363
|
+
onKeyDown: function onKeyDown(e) {
|
|
364
|
+
e.stopPropagation();
|
|
365
|
+
},
|
|
271
366
|
value: context.conditionRules.rulesValue,
|
|
272
367
|
onChange: function onChange(e) {
|
|
273
368
|
var value = e.target.value;
|
|
@@ -280,6 +375,9 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
280
375
|
}, /*#__PURE__*/React.createElement("div", {
|
|
281
376
|
className: "w-full"
|
|
282
377
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
378
|
+
onKeyDown: function onKeyDown(e) {
|
|
379
|
+
e.stopPropagation();
|
|
380
|
+
},
|
|
283
381
|
placeholder: "From",
|
|
284
382
|
value: context.conditionRules.betweenValue.value1,
|
|
285
383
|
onChange: function onChange(e) {
|
|
@@ -291,6 +389,9 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
291
389
|
})), /*#__PURE__*/React.createElement("div", {
|
|
292
390
|
className: "w-full"
|
|
293
391
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
392
|
+
onKeyDown: function onKeyDown(e) {
|
|
393
|
+
e.stopPropagation();
|
|
394
|
+
},
|
|
294
395
|
placeholder: "To",
|
|
295
396
|
value: context.conditionRules.betweenValue.value2,
|
|
296
397
|
onChange: function onChange(e) {
|
|
@@ -342,6 +443,10 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
342
443
|
});
|
|
343
444
|
}
|
|
344
445
|
}), /*#__PURE__*/React.createElement(TextField, {
|
|
446
|
+
placeholder: "Value",
|
|
447
|
+
onKeyDown: function onKeyDown(e) {
|
|
448
|
+
e.stopPropagation();
|
|
449
|
+
},
|
|
345
450
|
className: "condition-rules-project-input pr-0",
|
|
346
451
|
type: "number",
|
|
347
452
|
min: 1,
|
|
@@ -369,74 +474,99 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
369
474
|
ctx.conditionRules.projectValue = String(current + 1);
|
|
370
475
|
});
|
|
371
476
|
}
|
|
372
|
-
})))))), /*#__PURE__*/React.createElement("div",
|
|
373
|
-
className: "condition-rules-value text-heading-xsm"
|
|
374
|
-
}, "Cell(s) format if"), /*#__PURE__*/React.createElement(Select, {
|
|
375
|
-
value: type,
|
|
376
|
-
onValueChange: function onValueChange(value) {
|
|
377
|
-
console.log(value);
|
|
378
|
-
setType(value);
|
|
379
|
-
}
|
|
380
|
-
}, /*#__PURE__*/React.createElement(SelectTrigger, null, /*#__PURE__*/React.createElement(SelectValue, null, /*#__PURE__*/React.createElement("div", {
|
|
381
|
-
className: "flex items-center gap-2"
|
|
382
|
-
}, /*#__PURE__*/React.createElement("span", null, conditionformat[type])))), /*#__PURE__*/React.createElement(SelectContent, {
|
|
383
|
-
position: "popper",
|
|
384
|
-
side: "bottom",
|
|
385
|
-
align: "start",
|
|
386
|
-
sideOffset: 4,
|
|
387
|
-
className: "z-[100]",
|
|
388
|
-
"data-dropdown-content": "true"
|
|
389
|
-
}, conditionList.map(function (option) {
|
|
390
|
-
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
391
|
-
key: option.value,
|
|
392
|
-
value: option.text
|
|
393
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
394
|
-
className: "flex items-center gap-2"
|
|
395
|
-
}, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
|
|
396
|
-
})))), /*#__PURE__*/React.createElement("div", {
|
|
397
|
-
className: "flex flex-col"
|
|
398
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
399
|
-
className: "condition-rules-value text-heading-xsm"
|
|
400
|
-
}, conditionformat.applyRange), /*#__PURE__*/React.createElement(TextField, {
|
|
401
|
-
rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
|
|
402
|
-
name: "Grid2x2",
|
|
403
|
-
size: "sm",
|
|
404
|
-
onClick: function onClick() {
|
|
405
|
-
dataSelectRange("conditionRules".concat(type));
|
|
406
|
-
}
|
|
407
|
-
}),
|
|
408
|
-
"aria-hidden": "true",
|
|
409
|
-
readOnly: true,
|
|
410
|
-
placeholder: conditionformat.selectRange,
|
|
411
|
-
value: getDisplayedRangeTxt(context),
|
|
412
|
-
onClick: function onClick() {
|
|
413
|
-
dataSelectRange("conditionRules".concat(type));
|
|
414
|
-
}
|
|
415
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
477
|
+
})))))), /*#__PURE__*/React.createElement("div", {
|
|
416
478
|
className: "flex flex-col"
|
|
417
479
|
}, /*#__PURE__*/React.createElement("div", {
|
|
418
480
|
className: "condition-rules-set-title text-heading-xsm"
|
|
419
|
-
}, "
|
|
420
|
-
className: "
|
|
481
|
+
}, "Formatting styles"), /*#__PURE__*/React.createElement("div", {
|
|
482
|
+
className: "toolbar-container"
|
|
421
483
|
}, /*#__PURE__*/React.createElement("div", {
|
|
422
|
-
className: "
|
|
484
|
+
className: "toolbar-header"
|
|
485
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
486
|
+
className: "toolbar-title"
|
|
487
|
+
}, "Formatting styles preview")), /*#__PURE__*/React.createElement("div", {
|
|
488
|
+
className: "toolbar-content"
|
|
489
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
490
|
+
variant: "ghost",
|
|
491
|
+
onClick: function onClick() {
|
|
492
|
+
return setBold(!bold);
|
|
493
|
+
},
|
|
494
|
+
className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
|
|
495
|
+
style: {
|
|
496
|
+
width: 30,
|
|
497
|
+
height: 30,
|
|
498
|
+
backgroundColor: bold ? "hsl(var(--color-bg-default-selected))" : ""
|
|
499
|
+
}
|
|
500
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
501
|
+
name: "Bold"
|
|
502
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
503
|
+
variant: "ghost",
|
|
504
|
+
onClick: function onClick() {
|
|
505
|
+
return setItalic(!italic);
|
|
506
|
+
},
|
|
507
|
+
className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
|
|
508
|
+
style: {
|
|
509
|
+
width: 30,
|
|
510
|
+
height: 30
|
|
511
|
+
}
|
|
512
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
513
|
+
name: "Italic"
|
|
514
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
515
|
+
variant: "ghost",
|
|
516
|
+
onClick: function onClick() {
|
|
517
|
+
return setUnderline(!underline);
|
|
518
|
+
},
|
|
519
|
+
className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
|
|
520
|
+
style: {
|
|
521
|
+
width: 30,
|
|
522
|
+
height: 30
|
|
523
|
+
}
|
|
524
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
525
|
+
name: "Underline"
|
|
526
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
527
|
+
variant: "ghost",
|
|
528
|
+
onClick: function onClick() {
|
|
529
|
+
return setStrikethrough(!strikethrough);
|
|
530
|
+
},
|
|
531
|
+
className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
|
|
532
|
+
style: {
|
|
533
|
+
width: 30,
|
|
534
|
+
height: 30
|
|
535
|
+
}
|
|
536
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
537
|
+
name: "Strikethrough"
|
|
538
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
539
|
+
variant: "ghost",
|
|
540
|
+
className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
|
|
541
|
+
style: {
|
|
542
|
+
width: 30,
|
|
543
|
+
height: 30
|
|
544
|
+
}
|
|
423
545
|
}, /*#__PURE__*/React.createElement("div", {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
className: "border-2",
|
|
429
|
-
checked: context.conditionRules.textColor.check,
|
|
430
|
-
onCheckedChange: function onCheckedChange(e) {
|
|
431
|
-
var checked = e.target.checked;
|
|
432
|
-
setContext(function (ctx) {
|
|
433
|
-
ctx.conditionRules.textColor.check = checked;
|
|
434
|
-
});
|
|
546
|
+
style: {
|
|
547
|
+
display: 'flex',
|
|
548
|
+
flexDirection: 'column',
|
|
549
|
+
alignItems: 'center'
|
|
435
550
|
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
551
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
552
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
553
|
+
width: "24",
|
|
554
|
+
height: "24",
|
|
555
|
+
viewBox: "0 0 24 24",
|
|
556
|
+
fill: "none",
|
|
557
|
+
stroke: "currentColor",
|
|
558
|
+
"stroke-width": "2",
|
|
559
|
+
"stroke-linecap": "round",
|
|
560
|
+
"stroke-linejoin": "round",
|
|
561
|
+
className: "lucide lucide-spell-check2-icon lucide-spell-check-2"
|
|
562
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
563
|
+
d: "m5 18 6-12 6 12"
|
|
564
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
565
|
+
d: "M7 14h8"
|
|
566
|
+
})), /*#__PURE__*/React.createElement("input", {
|
|
567
|
+
style: {
|
|
568
|
+
marginBottom: "4px"
|
|
569
|
+
},
|
|
440
570
|
type: "color",
|
|
441
571
|
className: "condition-rules-select-color",
|
|
442
572
|
value: colorRules.textColor,
|
|
@@ -446,25 +576,21 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
446
576
|
draft.textColor = value;
|
|
447
577
|
}));
|
|
448
578
|
}
|
|
449
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
450
|
-
|
|
579
|
+
})))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
580
|
+
variant: "ghost",
|
|
581
|
+
className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
|
|
582
|
+
style: {
|
|
583
|
+
width: 30,
|
|
584
|
+
height: 30
|
|
585
|
+
}
|
|
451
586
|
}, /*#__PURE__*/React.createElement("div", {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
456
|
-
className: "border-2",
|
|
457
|
-
checked: context.conditionRules.cellColor.check,
|
|
458
|
-
onCheckedChange: function onCheckedChange(e) {
|
|
459
|
-
var checked = e.target.checked;
|
|
460
|
-
setContext(function (ctx) {
|
|
461
|
-
ctx.conditionRules.cellColor.check = checked;
|
|
462
|
-
});
|
|
587
|
+
style: {
|
|
588
|
+
display: 'flex',
|
|
589
|
+
flexDirection: 'column'
|
|
463
590
|
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}, conditionformat.cellColor), /*#__PURE__*/React.createElement("input", {
|
|
591
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
592
|
+
name: "PaintBucket"
|
|
593
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
468
594
|
type: "color",
|
|
469
595
|
className: "condition-rules-select-color",
|
|
470
596
|
value: colorRules.cellColor,
|
|
@@ -474,10 +600,11 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
474
600
|
draft.cellColor = value;
|
|
475
601
|
}));
|
|
476
602
|
}
|
|
477
|
-
}))))), /*#__PURE__*/React.createElement(
|
|
478
|
-
className: "
|
|
479
|
-
|
|
480
|
-
|
|
603
|
+
}))))))), /*#__PURE__*/React.createElement("div", {
|
|
604
|
+
className: "flex gap-2 justify-end",
|
|
605
|
+
style: {
|
|
606
|
+
marginTop: "8px"
|
|
607
|
+
}
|
|
481
608
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
482
609
|
variant: "secondary",
|
|
483
610
|
style: {
|
|
@@ -496,6 +623,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
496
623
|
close("confirm");
|
|
497
624
|
},
|
|
498
625
|
tabIndex: 0
|
|
499
|
-
},
|
|
626
|
+
}, "Create rule")))));
|
|
500
627
|
};
|
|
501
628
|
export default ConditionRules;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
.toolbar-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 896px;
|
|
4
|
+
background-color: white;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
border: 1px solid hsl(var(--color-border-default, #E8EBEC));
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.toolbar-header {
|
|
11
|
+
background-color: #dcfce7;
|
|
12
|
+
padding: 4px 16px;
|
|
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));
|
|
16
|
+
}
|
|
17
|
+
|
|
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;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.toolbar-content {
|
|
28
|
+
padding: 4px;
|
|
29
|
+
display: flex;
|
|
30
|
+
gap: 16px;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.toolbar-button {
|
|
35
|
+
width: 48px;
|
|
36
|
+
height: 48px;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
background-color: white;
|
|
41
|
+
border: 1px solid #e5e7eb;
|
|
42
|
+
border-radius: 6px;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
transition: all 0.2s ease;
|
|
45
|
+
padding: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.toolbar-button:hover {
|
|
49
|
+
background-color: #f9fafb;
|
|
50
|
+
border-color: #d1d5db;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.toolbar-button:active {
|
|
54
|
+
transform: scale(0.95);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.button-text {
|
|
58
|
+
font-size: 24px;
|
|
59
|
+
color: #1f2937;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.button-text.bold {
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.button-text.italic {
|
|
68
|
+
font-style: italic;
|
|
69
|
+
font-family: Georgia, serif;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.button-text.underline {
|
|
73
|
+
text-decoration: underline;
|
|
74
|
+
text-decoration-thickness: 2px;
|
|
75
|
+
text-underline-offset: 2px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.button-text.strikethrough {
|
|
79
|
+
text-decoration: line-through;
|
|
80
|
+
text-decoration-thickness: 2px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.button-text.color-button {
|
|
84
|
+
position: relative;
|
|
85
|
+
color: #16a34a;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.button-text.color-button::after {
|
|
89
|
+
content: "";
|
|
90
|
+
position: absolute;
|
|
91
|
+
bottom: -4px;
|
|
92
|
+
left: 0;
|
|
93
|
+
right: 0;
|
|
94
|
+
height: 3px;
|
|
95
|
+
background-color: #16a34a;
|
|
96
|
+
border-radius: 2px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.button-icon {
|
|
100
|
+
width: 24px;
|
|
101
|
+
height: 24px;
|
|
102
|
+
color: #1f2937;
|
|
103
|
+
}
|