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