@fileverse-dev/fortune-react 1.2.64-patch-6 → 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 -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/lib/components/ConditionFormat/ConditionRules.d.ts +1 -0
- package/lib/components/ConditionFormat/ConditionRules.js +252 -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/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,123 @@ 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 last:border-b-0 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
|
+
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, {
|
|
259
310
|
size: "md",
|
|
260
311
|
variant: "secondary",
|
|
261
312
|
onClick: function onClick() {
|
|
262
313
|
setCreate(true);
|
|
314
|
+
buttonClickCreateRef.current = true;
|
|
263
315
|
}
|
|
264
|
-
}, "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", {
|
|
265
317
|
className: "flex flex-col"
|
|
266
318
|
}, /*#__PURE__*/React.createElement("div", {
|
|
267
319
|
className: "condition-rules-value text-heading-xsm"
|
|
268
|
-
}, 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", {
|
|
269
361
|
className: "w-full"
|
|
270
362
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
363
|
+
placeholder: "Value",
|
|
364
|
+
onKeyDown: function onKeyDown(e) {
|
|
365
|
+
e.stopPropagation();
|
|
366
|
+
},
|
|
271
367
|
value: context.conditionRules.rulesValue,
|
|
272
368
|
onChange: function onChange(e) {
|
|
273
369
|
var value = e.target.value;
|
|
@@ -280,6 +376,9 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
280
376
|
}, /*#__PURE__*/React.createElement("div", {
|
|
281
377
|
className: "w-full"
|
|
282
378
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
379
|
+
onKeyDown: function onKeyDown(e) {
|
|
380
|
+
e.stopPropagation();
|
|
381
|
+
},
|
|
283
382
|
placeholder: "From",
|
|
284
383
|
value: context.conditionRules.betweenValue.value1,
|
|
285
384
|
onChange: function onChange(e) {
|
|
@@ -291,6 +390,9 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
291
390
|
})), /*#__PURE__*/React.createElement("div", {
|
|
292
391
|
className: "w-full"
|
|
293
392
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
393
|
+
onKeyDown: function onKeyDown(e) {
|
|
394
|
+
e.stopPropagation();
|
|
395
|
+
},
|
|
294
396
|
placeholder: "To",
|
|
295
397
|
value: context.conditionRules.betweenValue.value2,
|
|
296
398
|
onChange: function onChange(e) {
|
|
@@ -342,6 +444,10 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
342
444
|
});
|
|
343
445
|
}
|
|
344
446
|
}), /*#__PURE__*/React.createElement(TextField, {
|
|
447
|
+
placeholder: "Value",
|
|
448
|
+
onKeyDown: function onKeyDown(e) {
|
|
449
|
+
e.stopPropagation();
|
|
450
|
+
},
|
|
345
451
|
className: "condition-rules-project-input pr-0",
|
|
346
452
|
type: "number",
|
|
347
453
|
min: 1,
|
|
@@ -369,74 +475,99 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
369
475
|
ctx.conditionRules.projectValue = String(current + 1);
|
|
370
476
|
});
|
|
371
477
|
}
|
|
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", {
|
|
478
|
+
})))))), /*#__PURE__*/React.createElement("div", {
|
|
416
479
|
className: "flex flex-col"
|
|
417
480
|
}, /*#__PURE__*/React.createElement("div", {
|
|
418
481
|
className: "condition-rules-set-title text-heading-xsm"
|
|
419
|
-
}, "
|
|
420
|
-
className: "
|
|
482
|
+
}, "Formatting styles"), /*#__PURE__*/React.createElement("div", {
|
|
483
|
+
className: "toolbar-container"
|
|
421
484
|
}, /*#__PURE__*/React.createElement("div", {
|
|
422
|
-
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
|
+
}
|
|
423
546
|
}, /*#__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
|
-
});
|
|
547
|
+
style: {
|
|
548
|
+
display: 'flex',
|
|
549
|
+
flexDirection: 'column',
|
|
550
|
+
alignItems: 'center'
|
|
435
551
|
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
+
},
|
|
440
571
|
type: "color",
|
|
441
572
|
className: "condition-rules-select-color",
|
|
442
573
|
value: colorRules.textColor,
|
|
@@ -446,25 +577,21 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
446
577
|
draft.textColor = value;
|
|
447
578
|
}));
|
|
448
579
|
}
|
|
449
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
450
|
-
|
|
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
|
+
}
|
|
451
587
|
}, /*#__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
|
-
});
|
|
588
|
+
style: {
|
|
589
|
+
display: 'flex',
|
|
590
|
+
flexDirection: 'column'
|
|
463
591
|
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}, conditionformat.cellColor), /*#__PURE__*/React.createElement("input", {
|
|
592
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
593
|
+
name: "PaintBucket"
|
|
594
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
468
595
|
type: "color",
|
|
469
596
|
className: "condition-rules-select-color",
|
|
470
597
|
value: colorRules.cellColor,
|
|
@@ -474,10 +601,11 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
474
601
|
draft.cellColor = value;
|
|
475
602
|
}));
|
|
476
603
|
}
|
|
477
|
-
}))))), /*#__PURE__*/React.createElement(
|
|
478
|
-
className: "
|
|
479
|
-
|
|
480
|
-
|
|
604
|
+
}))))))), /*#__PURE__*/React.createElement("div", {
|
|
605
|
+
className: "flex gap-2 justify-end",
|
|
606
|
+
style: {
|
|
607
|
+
marginTop: "8px"
|
|
608
|
+
}
|
|
481
609
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
482
610
|
variant: "secondary",
|
|
483
611
|
style: {
|
|
@@ -496,6 +624,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
496
624
|
close("confirm");
|
|
497
625
|
},
|
|
498
626
|
tabIndex: 0
|
|
499
|
-
},
|
|
627
|
+
}, "Create rule")))));
|
|
500
628
|
};
|
|
501
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
|
+
}
|