@fileverse-dev/fortune-react 1.2.64-mergeFix-patch-1 → 1.2.64-patch-1
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 -1
- package/es/components/ConditionFormat/ConditionRules.js +182 -17
- package/es/components/SheetOverlay/helper.d.ts +1 -0
- package/es/components/SheetOverlay/helper.js +1 -1
- package/es/components/Toolbar/index.js +62 -71
- package/es/components/Workbook/api.d.ts +3 -1
- package/es/components/Workbook/api.js +4 -0
- package/es/components/Workbook/index.d.ts +3 -1
- package/es/components/Workbook/index.js +19 -1
- package/lib/components/ConditionFormat/ConditionRules.d.ts +1 -1
- package/lib/components/ConditionFormat/ConditionRules.js +181 -16
- package/lib/components/SheetOverlay/helper.d.ts +1 -0
- package/lib/components/SheetOverlay/helper.js +1 -0
- package/lib/components/Toolbar/index.js +62 -71
- package/lib/components/Workbook/api.d.ts +3 -1
- package/lib/components/Workbook/api.js +4 -0
- package/lib/components/Workbook/index.d.ts +3 -1
- package/lib/components/Workbook/index.js +19 -1
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useEffect, useState } from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
-
import { locale, setConditionRules } from "@fileverse-dev/fortune-core";
|
|
3
|
+
import { locale, setConditionRules, getSheetIndex } from "@fileverse-dev/fortune-core";
|
|
4
|
+
import { numberToColumn } from "../SheetOverlay/helper";
|
|
4
5
|
import produce from "immer";
|
|
5
6
|
import { Button, Checkbox, Divider, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, TextField } from "@fileverse/ui";
|
|
6
7
|
import WorkbookContext from "../../context";
|
|
@@ -9,22 +10,69 @@ import { getDisplayedRangeTxt } from "../DataVerification/getDisplayedRangeTxt";
|
|
|
9
10
|
import { injectDatepickerStyles } from "../../utils/datepickerStyles";
|
|
10
11
|
injectDatepickerStyles();
|
|
11
12
|
var ConditionRules = function ConditionRules(_a) {
|
|
12
|
-
var
|
|
13
|
-
var _b =
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
var rulesType = _a.type;
|
|
14
|
+
var _b = useState('greaterThan'),
|
|
15
|
+
type = _b[0],
|
|
16
|
+
setType = _b[1];
|
|
17
|
+
var _c = useState(false),
|
|
18
|
+
create = _c[0],
|
|
19
|
+
setCreate = _c[1];
|
|
20
|
+
var _d = useState([]),
|
|
21
|
+
matchedConditionFormatKey = _d[0],
|
|
22
|
+
setMatchedConditionFormatKey = _d[1];
|
|
23
|
+
var _e = useState(null),
|
|
24
|
+
allConditionFormats = _e[0],
|
|
25
|
+
setAllConditionFormats = _e[1];
|
|
26
|
+
var _f = useContext(WorkbookContext),
|
|
27
|
+
context = _f.context,
|
|
28
|
+
setContext = _f.setContext;
|
|
16
29
|
var hideDialog = useDialog().hideDialog;
|
|
17
|
-
var
|
|
18
|
-
conditionformat =
|
|
19
|
-
button =
|
|
20
|
-
protection =
|
|
21
|
-
generalDialog =
|
|
22
|
-
var
|
|
30
|
+
var _g = locale(context),
|
|
31
|
+
conditionformat = _g.conditionformat,
|
|
32
|
+
button = _g.button,
|
|
33
|
+
protection = _g.protection,
|
|
34
|
+
generalDialog = _g.generalDialog;
|
|
35
|
+
var _h = useState({
|
|
23
36
|
textColor: "#FFFFFF",
|
|
24
37
|
cellColor: "#D82E2A"
|
|
25
38
|
}),
|
|
26
|
-
colorRules =
|
|
27
|
-
setColorRules =
|
|
39
|
+
colorRules = _h[0],
|
|
40
|
+
setColorRules = _h[1];
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
var _a, _b, _c, _d;
|
|
43
|
+
var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
|
|
44
|
+
var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
45
|
+
if (allCondition && (allCondition === null || allCondition === void 0 ? void 0 : allCondition.length) === (allConditionFormats === null || allConditionFormats === void 0 ? void 0 : allConditionFormats.length)) return;
|
|
46
|
+
setAllConditionFormats(allCondition);
|
|
47
|
+
console.log("allConditionFormats", allCondition, (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0], context);
|
|
48
|
+
console.log("typed", context);
|
|
49
|
+
var selectionColumn = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].column;
|
|
50
|
+
var selectionRow = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[0].row;
|
|
51
|
+
var matchedCondition = [];
|
|
52
|
+
if (allCondition) {
|
|
53
|
+
for (var key in allCondition) {
|
|
54
|
+
var conditionFormat = allCondition[key];
|
|
55
|
+
var range = (_d = conditionFormat.cellrange) === null || _d === void 0 ? void 0 : _d[0];
|
|
56
|
+
console.log("rangeObj", conditionFormat, range);
|
|
57
|
+
if (!range || !selectionColumn || !selectionRow) continue;
|
|
58
|
+
var rangeColumns = range.column;
|
|
59
|
+
var rangeRows = range.row;
|
|
60
|
+
var isColumnOverlap = !(selectionColumn[1] < rangeColumns[0] || selectionColumn[0] > rangeColumns[1]);
|
|
61
|
+
var isRowOverlap = !(selectionRow[1] < rangeRows[0] || selectionRow[0] > rangeRows[1]);
|
|
62
|
+
if (isColumnOverlap && isRowOverlap) {
|
|
63
|
+
matchedCondition.push(key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
setMatchedConditionFormatKey(matchedCondition);
|
|
67
|
+
}
|
|
68
|
+
console.log("kkkkk", matchedConditionFormatKey, matchedCondition);
|
|
69
|
+
if (matchedCondition.length === 0) {
|
|
70
|
+
console.log('whyyyyyyy');
|
|
71
|
+
setCreate(true);
|
|
72
|
+
} else if (matchedCondition.length > 0) {
|
|
73
|
+
setCreate(false);
|
|
74
|
+
}
|
|
75
|
+
}, [context]);
|
|
28
76
|
var dataSelectRange = useCallback(function (selectType) {
|
|
29
77
|
hideDialog();
|
|
30
78
|
setContext(function (ctx) {
|
|
@@ -103,11 +151,104 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
103
151
|
ctx.rangeDialog.type = "";
|
|
104
152
|
ctx.rangeDialog.rangeTxt = "";
|
|
105
153
|
});
|
|
106
|
-
}, []);
|
|
154
|
+
}, [type]);
|
|
155
|
+
var conditionList = [{
|
|
156
|
+
text: "greaterThan",
|
|
157
|
+
value: ">",
|
|
158
|
+
label: "Greater Than"
|
|
159
|
+
}, {
|
|
160
|
+
text: "greaterThanOrEqual",
|
|
161
|
+
value: ">=",
|
|
162
|
+
label: "Greater Than or Equal"
|
|
163
|
+
}, {
|
|
164
|
+
text: "lessThan",
|
|
165
|
+
value: "<",
|
|
166
|
+
label: "Less Than"
|
|
167
|
+
}, {
|
|
168
|
+
text: "lessThanOrEqual",
|
|
169
|
+
value: "<=",
|
|
170
|
+
label: "Less Than or Equal"
|
|
171
|
+
}, {
|
|
172
|
+
text: "between",
|
|
173
|
+
value: "[]",
|
|
174
|
+
label: "Between"
|
|
175
|
+
}, {
|
|
176
|
+
text: "equal",
|
|
177
|
+
value: "=",
|
|
178
|
+
label: "Equal"
|
|
179
|
+
}, {
|
|
180
|
+
text: "textContains",
|
|
181
|
+
value: "()",
|
|
182
|
+
label: "Text Contains"
|
|
183
|
+
}, {
|
|
184
|
+
text: "occurrenceDate",
|
|
185
|
+
value: conditionformat.yesterday,
|
|
186
|
+
label: "Occurrence Date"
|
|
187
|
+
}, {
|
|
188
|
+
text: "duplicateValue",
|
|
189
|
+
value: "##",
|
|
190
|
+
label: "Duplicate Value"
|
|
191
|
+
}, {
|
|
192
|
+
text: "top10",
|
|
193
|
+
value: conditionformat.top10
|
|
194
|
+
}, {
|
|
195
|
+
text: "top10_percent",
|
|
196
|
+
value: conditionformat.top10_percent,
|
|
197
|
+
label: "Top 10 Percent"
|
|
198
|
+
}, {
|
|
199
|
+
text: "last10",
|
|
200
|
+
value: conditionformat.last10,
|
|
201
|
+
label: "Last 10"
|
|
202
|
+
}, {
|
|
203
|
+
text: "last10_percent",
|
|
204
|
+
value: conditionformat.last10_percent,
|
|
205
|
+
label: "Last 10 Percent"
|
|
206
|
+
}, {
|
|
207
|
+
text: "aboveAverage",
|
|
208
|
+
value: conditionformat.above,
|
|
209
|
+
label: "Above Average"
|
|
210
|
+
}, {
|
|
211
|
+
text: "belowAverage",
|
|
212
|
+
value: conditionformat.below,
|
|
213
|
+
label: "Below Average"
|
|
214
|
+
}];
|
|
107
215
|
var titleType = type === "top10_percent" ? "top10" : type === "last10_percent" ? "last10" : type;
|
|
108
216
|
return /*#__PURE__*/React.createElement("div", {
|
|
109
217
|
className: "condition-rules"
|
|
110
|
-
}, !
|
|
218
|
+
}, !create ? (/*#__PURE__*/React.createElement("div", null, matchedConditionFormatKey.map(function (key) {
|
|
219
|
+
var _a, _b;
|
|
220
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
221
|
+
className: "flex items-center gap-6 py-6 border-b border-gray-200 last:border-b-0",
|
|
222
|
+
key: key
|
|
223
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
224
|
+
className: "flex items-center justify-center !w-40 !h-40 rounded-3xl !bg-[".concat(allConditionFormats[key].format.cellColor || "", "]"),
|
|
225
|
+
style: {
|
|
226
|
+
backgroundColor: allConditionFormats[key].format.cellColor || "",
|
|
227
|
+
width: '44px',
|
|
228
|
+
height: '56px'
|
|
229
|
+
}
|
|
230
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
231
|
+
className: "text-6xl font-bold !text-[".concat(allConditionFormats[key].format.textColor || "", "] pb-1")
|
|
232
|
+
}, "123")), /*#__PURE__*/React.createElement("div", {
|
|
233
|
+
className: "flex flex-col"
|
|
234
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
235
|
+
className: "text-4xl font-normal text-gray-900 mb-2"
|
|
236
|
+
}, conditionformat[allConditionFormats[key].conditionName], ' ', (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/React.createElement("p", {
|
|
237
|
+
className: "text-3xl text-gray-400"
|
|
238
|
+
}, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
|
|
239
|
+
var startCol = numberToColumn(range.column[0] + 1);
|
|
240
|
+
var endCol = numberToColumn(range.column[1] + 1);
|
|
241
|
+
var startRow = range.row[0] + 1;
|
|
242
|
+
var endRow = range.row[1] + 1;
|
|
243
|
+
return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
|
|
244
|
+
}).join(", "))));
|
|
245
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
246
|
+
size: "md",
|
|
247
|
+
variant: "secondary",
|
|
248
|
+
onClick: function onClick() {
|
|
249
|
+
setCreate(true);
|
|
250
|
+
}
|
|
251
|
+
}, "Create New Condition Format"))) : (/*#__PURE__*/React.createElement(React.Fragment, null, !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
|
|
111
252
|
className: "flex flex-col"
|
|
112
253
|
}, /*#__PURE__*/React.createElement("div", {
|
|
113
254
|
className: "condition-rules-value text-heading-xsm"
|
|
@@ -215,7 +356,31 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
215
356
|
ctx.conditionRules.projectValue = String(current + 1);
|
|
216
357
|
});
|
|
217
358
|
}
|
|
218
|
-
})))))), /*#__PURE__*/React.createElement("div", {
|
|
359
|
+
})))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
360
|
+
className: "condition-rules-value text-heading-xsm"
|
|
361
|
+
}, "Cell(s) format if"), /*#__PURE__*/React.createElement(Select, {
|
|
362
|
+
value: type,
|
|
363
|
+
onValueChange: function onValueChange(value) {
|
|
364
|
+
console.log(value);
|
|
365
|
+
setType(value);
|
|
366
|
+
}
|
|
367
|
+
}, /*#__PURE__*/React.createElement(SelectTrigger, null, /*#__PURE__*/React.createElement(SelectValue, null, /*#__PURE__*/React.createElement("div", {
|
|
368
|
+
className: "flex items-center gap-2"
|
|
369
|
+
}, /*#__PURE__*/React.createElement("span", null, conditionformat[type])))), /*#__PURE__*/React.createElement(SelectContent, {
|
|
370
|
+
position: "popper",
|
|
371
|
+
side: "bottom",
|
|
372
|
+
align: "start",
|
|
373
|
+
sideOffset: 4,
|
|
374
|
+
className: "z-[100]",
|
|
375
|
+
"data-dropdown-content": "true"
|
|
376
|
+
}, conditionList.map(function (option) {
|
|
377
|
+
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
378
|
+
key: option.value,
|
|
379
|
+
value: option.text
|
|
380
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
381
|
+
className: "flex items-center gap-2"
|
|
382
|
+
}, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
|
|
383
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
219
384
|
className: "flex flex-col"
|
|
220
385
|
}, /*#__PURE__*/React.createElement("div", {
|
|
221
386
|
className: "condition-rules-value text-heading-xsm"
|
|
@@ -318,6 +483,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
318
483
|
close("confirm");
|
|
319
484
|
},
|
|
320
485
|
tabIndex: 0
|
|
321
|
-
}, button.apply)));
|
|
486
|
+
}, button.apply)))));
|
|
322
487
|
};
|
|
323
488
|
export default ConditionRules;
|
|
@@ -2,6 +2,7 @@ export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
|
|
|
2
2
|
export declare function getCursorPosition(editableDiv: HTMLDivElement): number;
|
|
3
3
|
export declare function isLetterNumberPattern(str: string): boolean;
|
|
4
4
|
export declare function removeLastSpan(htmlString: string): string;
|
|
5
|
+
export declare function numberToColumn(colNumber: number): string;
|
|
5
6
|
export declare function incrementColumn(cell: string): string;
|
|
6
7
|
export declare function decrementColumn(cell: string): string;
|
|
7
8
|
export declare function incrementRow(cell: string): string;
|
|
@@ -135,10 +135,8 @@ import Combo from "./Combo";
|
|
|
135
135
|
import Select, { Option } from "./Select";
|
|
136
136
|
import SVGIcon from "../SVGIcon";
|
|
137
137
|
import { useDialog } from "../../hooks/useDialog";
|
|
138
|
-
import { useAlert } from "../../hooks/useAlert";
|
|
139
138
|
import { SplitColumn } from "../SplitColumn";
|
|
140
139
|
import { LocationCondition } from "../LocationCondition";
|
|
141
|
-
import ConditionalFormat from "../ConditionFormat";
|
|
142
140
|
import CustomButton from "./CustomButton";
|
|
143
141
|
import { CustomColor } from "./CustomColor";
|
|
144
142
|
import { FormatSearch } from "../FormatSearch";
|
|
@@ -482,33 +480,29 @@ var Toolbar = function Toolbar(_a) {
|
|
|
482
480
|
var _l = useDialog(),
|
|
483
481
|
showDialog = _l.showDialog,
|
|
484
482
|
hideDialog = _l.hideDialog;
|
|
485
|
-
var _m = useAlert(),
|
|
486
|
-
showAlert = _m.showAlert,
|
|
487
|
-
hideAlert = _m.hideAlert;
|
|
488
483
|
var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
|
|
489
484
|
var flowdata = getFlowdata(context);
|
|
490
485
|
contextRef.current = context;
|
|
491
486
|
var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
492
487
|
var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
493
488
|
var cell = flowdata && row != null && col != null ? (_c = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _c === void 0 ? void 0 : _c[col] : undefined;
|
|
494
|
-
var
|
|
495
|
-
toolbar =
|
|
496
|
-
merge =
|
|
497
|
-
border =
|
|
498
|
-
freezen =
|
|
499
|
-
defaultFmt =
|
|
500
|
-
formula =
|
|
501
|
-
sort =
|
|
502
|
-
align =
|
|
503
|
-
textWrap =
|
|
504
|
-
rotation =
|
|
505
|
-
screenshot =
|
|
506
|
-
filter =
|
|
507
|
-
splitText =
|
|
508
|
-
findAndReplace =
|
|
509
|
-
comment =
|
|
510
|
-
fontarray =
|
|
511
|
-
sheetconfig = _o.sheetconfig;
|
|
489
|
+
var _m = locale(context),
|
|
490
|
+
toolbar = _m.toolbar,
|
|
491
|
+
merge = _m.merge,
|
|
492
|
+
border = _m.border,
|
|
493
|
+
freezen = _m.freezen,
|
|
494
|
+
defaultFmt = _m.defaultFmt,
|
|
495
|
+
formula = _m.formula,
|
|
496
|
+
sort = _m.sort,
|
|
497
|
+
align = _m.align,
|
|
498
|
+
textWrap = _m.textWrap,
|
|
499
|
+
rotation = _m.rotation,
|
|
500
|
+
screenshot = _m.screenshot,
|
|
501
|
+
filter = _m.filter,
|
|
502
|
+
splitText = _m.splitText,
|
|
503
|
+
findAndReplace = _m.findAndReplace,
|
|
504
|
+
comment = _m.comment,
|
|
505
|
+
fontarray = _m.fontarray;
|
|
512
506
|
var toolbarFormat = locale(context).format;
|
|
513
507
|
var sheetWidth = context.luckysheetTableContentHW[0];
|
|
514
508
|
var currency = settings.currency;
|
|
@@ -598,9 +592,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
598
592
|
ctx.dataVerification.dataRegulation.value1 = "value1";
|
|
599
593
|
});
|
|
600
594
|
}, []);
|
|
601
|
-
var
|
|
602
|
-
showDataValidation =
|
|
603
|
-
setShowDataValidation =
|
|
595
|
+
var _o = useState(false),
|
|
596
|
+
showDataValidation = _o[0],
|
|
597
|
+
setShowDataValidation = _o[1];
|
|
604
598
|
var dataVerificationClick = function dataVerificationClick(selectedCells) {
|
|
605
599
|
var _a;
|
|
606
600
|
var selection = api.getSelection(context);
|
|
@@ -622,6 +616,22 @@ var Toolbar = function Toolbar(_a) {
|
|
|
622
616
|
useEffect(function () {
|
|
623
617
|
window.dataVerificationClick = dataVerificationClick;
|
|
624
618
|
}, []);
|
|
619
|
+
var conditionalFormatClick = function conditionalFormatClick(selectedCells) {
|
|
620
|
+
var _a;
|
|
621
|
+
console.log("conditionalFormatClick called");
|
|
622
|
+
var selection = api.getSelection(context);
|
|
623
|
+
if (!selection && !selectedCells) {
|
|
624
|
+
setContext(function (ctx) {
|
|
625
|
+
api.setSelection(ctx, [{
|
|
626
|
+
row: [0, 0],
|
|
627
|
+
column: [0, 0]
|
|
628
|
+
}], {
|
|
629
|
+
id: context.currentSheetId
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
(_a = document.getElementById("conditional-format-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
634
|
+
};
|
|
625
635
|
var getToolbarItem = useCallback(function (name, i) {
|
|
626
636
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
627
637
|
var tooltip = toolbar[name];
|
|
@@ -1117,17 +1127,13 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1117
1127
|
});
|
|
1118
1128
|
}
|
|
1119
1129
|
if (name === "conditionFormat") {
|
|
1120
|
-
var
|
|
1121
|
-
return /*#__PURE__*/React.createElement(
|
|
1122
|
-
|
|
1130
|
+
var items = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
|
|
1131
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
1132
|
+
id: "conditionFormat",
|
|
1133
|
+
iconId: name,
|
|
1134
|
+
tooltip: tooltip,
|
|
1123
1135
|
key: name,
|
|
1124
|
-
|
|
1125
|
-
showArrow: false
|
|
1126
|
-
}, function (setOpen) {
|
|
1127
|
-
return /*#__PURE__*/React.createElement(ConditionalFormat, {
|
|
1128
|
-
items: items_4,
|
|
1129
|
-
setOpen: setOpen
|
|
1130
|
-
});
|
|
1136
|
+
onClick: conditionalFormatClick
|
|
1131
1137
|
});
|
|
1132
1138
|
}
|
|
1133
1139
|
if (name === "image") {
|
|
@@ -1288,12 +1294,8 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1288
1294
|
tooltip: tooltip,
|
|
1289
1295
|
text: "\u5408\u5E76\u5355\u5143\u683C",
|
|
1290
1296
|
onClick: function onClick() {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
setContext(function (ctx) {
|
|
1294
|
-
handleMerge(ctx, "merge-all");
|
|
1295
|
-
});
|
|
1296
|
-
hideAlert();
|
|
1297
|
+
return setContext(function (ctx) {
|
|
1298
|
+
handleMerge(ctx, "merge-all");
|
|
1297
1299
|
});
|
|
1298
1300
|
}
|
|
1299
1301
|
}, function (setOpen) {
|
|
@@ -1304,21 +1306,10 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1304
1306
|
return /*#__PURE__*/React.createElement(Option, {
|
|
1305
1307
|
key: value,
|
|
1306
1308
|
onClick: function onClick() {
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
setOpen(false);
|
|
1312
|
-
} else {
|
|
1313
|
-
setOpen(false);
|
|
1314
|
-
var confirmMessage = sheetconfig.confirmMerge;
|
|
1315
|
-
showAlert(confirmMessage, "yesno", function () {
|
|
1316
|
-
setContext(function (ctx) {
|
|
1317
|
-
handleMerge(ctx, value);
|
|
1318
|
-
});
|
|
1319
|
-
hideAlert();
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1309
|
+
setContext(function (ctx) {
|
|
1310
|
+
handleMerge(ctx, value);
|
|
1311
|
+
});
|
|
1312
|
+
setOpen(false);
|
|
1322
1313
|
}
|
|
1323
1314
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1324
1315
|
style: {
|
|
@@ -1335,7 +1326,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1335
1326
|
});
|
|
1336
1327
|
}
|
|
1337
1328
|
if (name === "border") {
|
|
1338
|
-
var
|
|
1329
|
+
var items_4 = [{
|
|
1339
1330
|
text: border.borderTop,
|
|
1340
1331
|
value: "border-top",
|
|
1341
1332
|
icon: "BorderTop"
|
|
@@ -1390,7 +1381,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1390
1381
|
}, function (setOpen) {
|
|
1391
1382
|
return /*#__PURE__*/React.createElement("div", {
|
|
1392
1383
|
className: "fortune-toolbar-select fortune-border-grid"
|
|
1393
|
-
},
|
|
1384
|
+
}, items_4.map(function (_a) {
|
|
1394
1385
|
var value = _a.value,
|
|
1395
1386
|
icon = _a.icon;
|
|
1396
1387
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1411,7 +1402,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1411
1402
|
});
|
|
1412
1403
|
}
|
|
1413
1404
|
if (name === "freeze") {
|
|
1414
|
-
var
|
|
1405
|
+
var items_5 = [{
|
|
1415
1406
|
text: freezen.freezenRowRange,
|
|
1416
1407
|
value: "freeze-row"
|
|
1417
1408
|
}, {
|
|
@@ -1435,7 +1426,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1435
1426
|
});
|
|
1436
1427
|
}
|
|
1437
1428
|
}, function (setOpen) {
|
|
1438
|
-
return /*#__PURE__*/React.createElement(Select, null,
|
|
1429
|
+
return /*#__PURE__*/React.createElement(Select, null, items_5.map(function (_a) {
|
|
1439
1430
|
var text = _a.text,
|
|
1440
1431
|
value = _a.value;
|
|
1441
1432
|
return /*#__PURE__*/React.createElement(Option, {
|
|
@@ -1457,7 +1448,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1457
1448
|
});
|
|
1458
1449
|
}
|
|
1459
1450
|
if (name === "text-wrap") {
|
|
1460
|
-
var
|
|
1451
|
+
var items_6 = [{
|
|
1461
1452
|
text: textWrap.clip,
|
|
1462
1453
|
iconId: "text-clip",
|
|
1463
1454
|
value: "clip"
|
|
@@ -1470,9 +1461,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1470
1461
|
iconId: "text-wrap",
|
|
1471
1462
|
value: "wrap"
|
|
1472
1463
|
}];
|
|
1473
|
-
var curr_3 =
|
|
1464
|
+
var curr_3 = items_6[0];
|
|
1474
1465
|
if ((cell === null || cell === void 0 ? void 0 : cell.tb) != null) {
|
|
1475
|
-
curr_3 = _.get(
|
|
1466
|
+
curr_3 = _.get(items_6, cell.tb);
|
|
1476
1467
|
}
|
|
1477
1468
|
return /*#__PURE__*/React.createElement(Combo, {
|
|
1478
1469
|
iconId: curr_3.iconId,
|
|
@@ -1489,7 +1480,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1489
1480
|
justifyContent: "center",
|
|
1490
1481
|
gap: 4
|
|
1491
1482
|
}
|
|
1492
|
-
},
|
|
1483
|
+
}, items_6.map(function (_a) {
|
|
1493
1484
|
var iconId = _a.iconId,
|
|
1494
1485
|
value = _a.value;
|
|
1495
1486
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
@@ -1520,7 +1511,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1520
1511
|
});
|
|
1521
1512
|
}
|
|
1522
1513
|
if (name === "text-rotation") {
|
|
1523
|
-
var
|
|
1514
|
+
var items_7 = [{
|
|
1524
1515
|
text: rotation.none,
|
|
1525
1516
|
iconId: "text-rotation-none",
|
|
1526
1517
|
value: "none"
|
|
@@ -1545,9 +1536,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1545
1536
|
iconId: "text-rotation-down",
|
|
1546
1537
|
value: "rotation-down"
|
|
1547
1538
|
}];
|
|
1548
|
-
var curr =
|
|
1539
|
+
var curr = items_7[0];
|
|
1549
1540
|
if ((cell === null || cell === void 0 ? void 0 : cell.tr) != null) {
|
|
1550
|
-
curr = _.get(
|
|
1541
|
+
curr = _.get(items_7, cell.tr);
|
|
1551
1542
|
}
|
|
1552
1543
|
return /*#__PURE__*/React.createElement(Combo, {
|
|
1553
1544
|
iconId: curr.iconId,
|
|
@@ -1555,7 +1546,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1555
1546
|
tooltip: toolbar.textRotate,
|
|
1556
1547
|
showArrow: false
|
|
1557
1548
|
}, function (setOpen) {
|
|
1558
|
-
return /*#__PURE__*/React.createElement(Select, null,
|
|
1549
|
+
return /*#__PURE__*/React.createElement(Select, null, items_7.map(function (_a) {
|
|
1559
1550
|
var text = _a.text,
|
|
1560
1551
|
iconId = _a.iconId,
|
|
1561
1552
|
value = _a.value;
|
|
@@ -1580,7 +1571,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1580
1571
|
});
|
|
1581
1572
|
}
|
|
1582
1573
|
if (name === "filter") {
|
|
1583
|
-
var
|
|
1574
|
+
var items_8 = [{
|
|
1584
1575
|
iconId: "sort-asc",
|
|
1585
1576
|
value: "sort-asc",
|
|
1586
1577
|
text: sort.asc,
|
|
@@ -1630,7 +1621,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1630
1621
|
style: {
|
|
1631
1622
|
minWidth: "11.25rem"
|
|
1632
1623
|
}
|
|
1633
|
-
},
|
|
1624
|
+
}, items_8.map(function (_a, index) {
|
|
1634
1625
|
var text = _a.text,
|
|
1635
1626
|
iconId = _a.iconId,
|
|
1636
1627
|
value = _a.value,
|
|
@@ -714,7 +714,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
714
714
|
chartEditNoOpt: string;
|
|
715
715
|
sheetNameSpecCharError: string;
|
|
716
716
|
sheetNamecannotIsEmptyError: string;
|
|
717
|
-
confirmMerge: string;
|
|
718
717
|
};
|
|
719
718
|
conditionformat: {
|
|
720
719
|
conditionformat_greaterThan: string;
|
|
@@ -1197,4 +1196,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
1197
1196
|
getRefs: () => any;
|
|
1198
1197
|
getShowDialog: () => typeof useDialog;
|
|
1199
1198
|
getSplitColComponent: () => import("react").FC<{}>;
|
|
1199
|
+
getConditionalFormatComponent: () => import("react").FC<{
|
|
1200
|
+
type?: string | undefined;
|
|
1201
|
+
}>;
|
|
1200
1202
|
};
|
|
@@ -14,6 +14,7 @@ import _ from "lodash";
|
|
|
14
14
|
import { getCryptoPrice } from "../../utils/cryptoApi";
|
|
15
15
|
import { useDialog } from "../../hooks/useDialog";
|
|
16
16
|
import { SplitColumn } from "../../components/SplitColumn";
|
|
17
|
+
import ConditionRules from "../ConditionFormat/ConditionRules";
|
|
17
18
|
export function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache, refs) {
|
|
18
19
|
return {
|
|
19
20
|
applyOp: function applyOp(ops) {
|
|
@@ -452,6 +453,9 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
|
|
|
452
453
|
},
|
|
453
454
|
getSplitColComponent: function getSplitColComponent() {
|
|
454
455
|
return SplitColumn;
|
|
456
|
+
},
|
|
457
|
+
getConditionalFormatComponent: function getConditionalFormatComponent() {
|
|
458
|
+
return ConditionRules;
|
|
455
459
|
}
|
|
456
460
|
};
|
|
457
461
|
}
|
|
@@ -721,7 +721,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
721
721
|
chartEditNoOpt: string;
|
|
722
722
|
sheetNameSpecCharError: string;
|
|
723
723
|
sheetNamecannotIsEmptyError: string;
|
|
724
|
-
confirmMerge: string;
|
|
725
724
|
};
|
|
726
725
|
conditionformat: {
|
|
727
726
|
conditionformat_greaterThan: string;
|
|
@@ -1204,5 +1203,8 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
1204
1203
|
getRefs: () => any;
|
|
1205
1204
|
getShowDialog: () => typeof import("../../hooks/useDialog").useDialog;
|
|
1206
1205
|
getSplitColComponent: () => React.FC<{}>;
|
|
1206
|
+
getConditionalFormatComponent: () => React.FC<{
|
|
1207
|
+
type?: string | undefined;
|
|
1208
|
+
}>;
|
|
1207
1209
|
}>>;
|
|
1208
1210
|
export default Workbook;
|
|
@@ -34,6 +34,7 @@ import { ModalProvider } from "../../context/modal";
|
|
|
34
34
|
import FilterMenu from "../ContextMenu/FilterMenu";
|
|
35
35
|
import SheetList from "../SheetList";
|
|
36
36
|
import DunePreview from "../DunePreview/DunePreview";
|
|
37
|
+
import ConditionRules from "../ConditionFormat/ConditionRules";
|
|
37
38
|
enablePatches();
|
|
38
39
|
var triggerGroupValuesRefresh = function triggerGroupValuesRefresh(ctx) {
|
|
39
40
|
if (ctx.groupValuesRefreshData.length > 0) {
|
|
@@ -353,6 +354,10 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
353
354
|
refs: refs
|
|
354
355
|
};
|
|
355
356
|
}, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce]);
|
|
357
|
+
var _e = useState(false),
|
|
358
|
+
show = _e[0],
|
|
359
|
+
setShow = _e[1];
|
|
360
|
+
var getCond = function getCond() {};
|
|
356
361
|
useEffect(function () {
|
|
357
362
|
if (!_.isEmpty(context.luckysheetfile)) {
|
|
358
363
|
onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
|
|
@@ -680,7 +685,20 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
680
685
|
}
|
|
681
686
|
return /*#__PURE__*/React.createElement(WorkbookContext.Provider, {
|
|
682
687
|
value: providerValue
|
|
683
|
-
}, /*#__PURE__*/React.createElement(
|
|
688
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
689
|
+
onClick: function onClick() {
|
|
690
|
+
setShow(!show);
|
|
691
|
+
}
|
|
692
|
+
}, "Click"), show && /*#__PURE__*/React.createElement("div", {
|
|
693
|
+
id: "placeholder-conditional-formatting",
|
|
694
|
+
style: {
|
|
695
|
+
width: "500px",
|
|
696
|
+
height: "500px",
|
|
697
|
+
position: "fixed",
|
|
698
|
+
zIndex: "1000",
|
|
699
|
+
backgroundColor: "white"
|
|
700
|
+
}
|
|
701
|
+
}, /*#__PURE__*/React.createElement(ConditionRules, null)), /*#__PURE__*/React.createElement(ModalProvider, null, /*#__PURE__*/React.createElement("div", {
|
|
684
702
|
className: "fortune-container",
|
|
685
703
|
ref: workbookContainer,
|
|
686
704
|
onKeyDown: onKeyDown
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
require("./index.css");
|
|
10
10
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
11
|
+
var _helper = require("../SheetOverlay/helper");
|
|
11
12
|
var _immer = _interopRequireDefault(require("immer"));
|
|
12
13
|
var _ui = require("@fileverse/ui");
|
|
13
14
|
var _context = _interopRequireDefault(require("../../context"));
|
|
@@ -18,22 +19,69 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
18
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
20
|
(0, _datepickerStyles.injectDatepickerStyles)();
|
|
20
21
|
var ConditionRules = function ConditionRules(_a) {
|
|
21
|
-
var
|
|
22
|
-
var _b = (0, _react.
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
var rulesType = _a.type;
|
|
23
|
+
var _b = (0, _react.useState)('greaterThan'),
|
|
24
|
+
type = _b[0],
|
|
25
|
+
setType = _b[1];
|
|
26
|
+
var _c = (0, _react.useState)(false),
|
|
27
|
+
create = _c[0],
|
|
28
|
+
setCreate = _c[1];
|
|
29
|
+
var _d = (0, _react.useState)([]),
|
|
30
|
+
matchedConditionFormatKey = _d[0],
|
|
31
|
+
setMatchedConditionFormatKey = _d[1];
|
|
32
|
+
var _e = (0, _react.useState)(null),
|
|
33
|
+
allConditionFormats = _e[0],
|
|
34
|
+
setAllConditionFormats = _e[1];
|
|
35
|
+
var _f = (0, _react.useContext)(_context.default),
|
|
36
|
+
context = _f.context,
|
|
37
|
+
setContext = _f.setContext;
|
|
25
38
|
var hideDialog = (0, _useDialog.useDialog)().hideDialog;
|
|
26
|
-
var
|
|
27
|
-
conditionformat =
|
|
28
|
-
button =
|
|
29
|
-
protection =
|
|
30
|
-
generalDialog =
|
|
31
|
-
var
|
|
39
|
+
var _g = (0, _fortuneCore.locale)(context),
|
|
40
|
+
conditionformat = _g.conditionformat,
|
|
41
|
+
button = _g.button,
|
|
42
|
+
protection = _g.protection,
|
|
43
|
+
generalDialog = _g.generalDialog;
|
|
44
|
+
var _h = (0, _react.useState)({
|
|
32
45
|
textColor: "#FFFFFF",
|
|
33
46
|
cellColor: "#D82E2A"
|
|
34
47
|
}),
|
|
35
|
-
colorRules =
|
|
36
|
-
setColorRules =
|
|
48
|
+
colorRules = _h[0],
|
|
49
|
+
setColorRules = _h[1];
|
|
50
|
+
(0, _react.useEffect)(function () {
|
|
51
|
+
var _a, _b, _c, _d;
|
|
52
|
+
var index = (0, _fortuneCore.getSheetIndex)(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
|
|
53
|
+
var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
54
|
+
if (allCondition && (allCondition === null || allCondition === void 0 ? void 0 : allCondition.length) === (allConditionFormats === null || allConditionFormats === void 0 ? void 0 : allConditionFormats.length)) return;
|
|
55
|
+
setAllConditionFormats(allCondition);
|
|
56
|
+
console.log("allConditionFormats", allCondition, (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0], context);
|
|
57
|
+
console.log("typed", context);
|
|
58
|
+
var selectionColumn = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].column;
|
|
59
|
+
var selectionRow = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[0].row;
|
|
60
|
+
var matchedCondition = [];
|
|
61
|
+
if (allCondition) {
|
|
62
|
+
for (var key in allCondition) {
|
|
63
|
+
var conditionFormat = allCondition[key];
|
|
64
|
+
var range = (_d = conditionFormat.cellrange) === null || _d === void 0 ? void 0 : _d[0];
|
|
65
|
+
console.log("rangeObj", conditionFormat, range);
|
|
66
|
+
if (!range || !selectionColumn || !selectionRow) continue;
|
|
67
|
+
var rangeColumns = range.column;
|
|
68
|
+
var rangeRows = range.row;
|
|
69
|
+
var isColumnOverlap = !(selectionColumn[1] < rangeColumns[0] || selectionColumn[0] > rangeColumns[1]);
|
|
70
|
+
var isRowOverlap = !(selectionRow[1] < rangeRows[0] || selectionRow[0] > rangeRows[1]);
|
|
71
|
+
if (isColumnOverlap && isRowOverlap) {
|
|
72
|
+
matchedCondition.push(key);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
setMatchedConditionFormatKey(matchedCondition);
|
|
76
|
+
}
|
|
77
|
+
console.log("kkkkk", matchedConditionFormatKey, matchedCondition);
|
|
78
|
+
if (matchedCondition.length === 0) {
|
|
79
|
+
console.log('whyyyyyyy');
|
|
80
|
+
setCreate(true);
|
|
81
|
+
} else if (matchedCondition.length > 0) {
|
|
82
|
+
setCreate(false);
|
|
83
|
+
}
|
|
84
|
+
}, [context]);
|
|
37
85
|
var dataSelectRange = (0, _react.useCallback)(function (selectType) {
|
|
38
86
|
hideDialog();
|
|
39
87
|
setContext(function (ctx) {
|
|
@@ -112,11 +160,104 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
112
160
|
ctx.rangeDialog.type = "";
|
|
113
161
|
ctx.rangeDialog.rangeTxt = "";
|
|
114
162
|
});
|
|
115
|
-
}, []);
|
|
163
|
+
}, [type]);
|
|
164
|
+
var conditionList = [{
|
|
165
|
+
text: "greaterThan",
|
|
166
|
+
value: ">",
|
|
167
|
+
label: "Greater Than"
|
|
168
|
+
}, {
|
|
169
|
+
text: "greaterThanOrEqual",
|
|
170
|
+
value: ">=",
|
|
171
|
+
label: "Greater Than or Equal"
|
|
172
|
+
}, {
|
|
173
|
+
text: "lessThan",
|
|
174
|
+
value: "<",
|
|
175
|
+
label: "Less Than"
|
|
176
|
+
}, {
|
|
177
|
+
text: "lessThanOrEqual",
|
|
178
|
+
value: "<=",
|
|
179
|
+
label: "Less Than or Equal"
|
|
180
|
+
}, {
|
|
181
|
+
text: "between",
|
|
182
|
+
value: "[]",
|
|
183
|
+
label: "Between"
|
|
184
|
+
}, {
|
|
185
|
+
text: "equal",
|
|
186
|
+
value: "=",
|
|
187
|
+
label: "Equal"
|
|
188
|
+
}, {
|
|
189
|
+
text: "textContains",
|
|
190
|
+
value: "()",
|
|
191
|
+
label: "Text Contains"
|
|
192
|
+
}, {
|
|
193
|
+
text: "occurrenceDate",
|
|
194
|
+
value: conditionformat.yesterday,
|
|
195
|
+
label: "Occurrence Date"
|
|
196
|
+
}, {
|
|
197
|
+
text: "duplicateValue",
|
|
198
|
+
value: "##",
|
|
199
|
+
label: "Duplicate Value"
|
|
200
|
+
}, {
|
|
201
|
+
text: "top10",
|
|
202
|
+
value: conditionformat.top10
|
|
203
|
+
}, {
|
|
204
|
+
text: "top10_percent",
|
|
205
|
+
value: conditionformat.top10_percent,
|
|
206
|
+
label: "Top 10 Percent"
|
|
207
|
+
}, {
|
|
208
|
+
text: "last10",
|
|
209
|
+
value: conditionformat.last10,
|
|
210
|
+
label: "Last 10"
|
|
211
|
+
}, {
|
|
212
|
+
text: "last10_percent",
|
|
213
|
+
value: conditionformat.last10_percent,
|
|
214
|
+
label: "Last 10 Percent"
|
|
215
|
+
}, {
|
|
216
|
+
text: "aboveAverage",
|
|
217
|
+
value: conditionformat.above,
|
|
218
|
+
label: "Above Average"
|
|
219
|
+
}, {
|
|
220
|
+
text: "belowAverage",
|
|
221
|
+
value: conditionformat.below,
|
|
222
|
+
label: "Below Average"
|
|
223
|
+
}];
|
|
116
224
|
var titleType = type === "top10_percent" ? "top10" : type === "last10_percent" ? "last10" : type;
|
|
117
225
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
118
226
|
className: "condition-rules"
|
|
119
|
-
}, !
|
|
227
|
+
}, !create ? (/*#__PURE__*/_react.default.createElement("div", null, matchedConditionFormatKey.map(function (key) {
|
|
228
|
+
var _a, _b;
|
|
229
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
230
|
+
className: "flex items-center gap-6 py-6 border-b border-gray-200 last:border-b-0",
|
|
231
|
+
key: key
|
|
232
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
233
|
+
className: "flex items-center justify-center !w-40 !h-40 rounded-3xl !bg-[".concat(allConditionFormats[key].format.cellColor || "", "]"),
|
|
234
|
+
style: {
|
|
235
|
+
backgroundColor: allConditionFormats[key].format.cellColor || "",
|
|
236
|
+
width: '44px',
|
|
237
|
+
height: '56px'
|
|
238
|
+
}
|
|
239
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
240
|
+
className: "text-6xl font-bold !text-[".concat(allConditionFormats[key].format.textColor || "", "] pb-1")
|
|
241
|
+
}, "123")), /*#__PURE__*/_react.default.createElement("div", {
|
|
242
|
+
className: "flex flex-col"
|
|
243
|
+
}, /*#__PURE__*/_react.default.createElement("h3", {
|
|
244
|
+
className: "text-4xl font-normal text-gray-900 mb-2"
|
|
245
|
+
}, conditionformat[allConditionFormats[key].conditionName], ' ', (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/_react.default.createElement("p", {
|
|
246
|
+
className: "text-3xl text-gray-400"
|
|
247
|
+
}, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
|
|
248
|
+
var startCol = (0, _helper.numberToColumn)(range.column[0] + 1);
|
|
249
|
+
var endCol = (0, _helper.numberToColumn)(range.column[1] + 1);
|
|
250
|
+
var startRow = range.row[0] + 1;
|
|
251
|
+
var endRow = range.row[1] + 1;
|
|
252
|
+
return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
|
|
253
|
+
}).join(", "))));
|
|
254
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
255
|
+
size: "md",
|
|
256
|
+
variant: "secondary",
|
|
257
|
+
onClick: function onClick() {
|
|
258
|
+
setCreate(true);
|
|
259
|
+
}
|
|
260
|
+
}, "Create New Condition Format"))) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/_react.default.createElement("div", {
|
|
120
261
|
className: "flex flex-col"
|
|
121
262
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
122
263
|
className: "condition-rules-value text-heading-xsm"
|
|
@@ -224,7 +365,31 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
224
365
|
ctx.conditionRules.projectValue = String(current + 1);
|
|
225
366
|
});
|
|
226
367
|
}
|
|
227
|
-
})))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
368
|
+
})))))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
369
|
+
className: "condition-rules-value text-heading-xsm"
|
|
370
|
+
}, "Cell(s) format if"), /*#__PURE__*/_react.default.createElement(_ui.Select, {
|
|
371
|
+
value: type,
|
|
372
|
+
onValueChange: function onValueChange(value) {
|
|
373
|
+
console.log(value);
|
|
374
|
+
setType(value);
|
|
375
|
+
}
|
|
376
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.SelectTrigger, null, /*#__PURE__*/_react.default.createElement(_ui.SelectValue, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
377
|
+
className: "flex items-center gap-2"
|
|
378
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, conditionformat[type])))), /*#__PURE__*/_react.default.createElement(_ui.SelectContent, {
|
|
379
|
+
position: "popper",
|
|
380
|
+
side: "bottom",
|
|
381
|
+
align: "start",
|
|
382
|
+
sideOffset: 4,
|
|
383
|
+
className: "z-[100]",
|
|
384
|
+
"data-dropdown-content": "true"
|
|
385
|
+
}, conditionList.map(function (option) {
|
|
386
|
+
return /*#__PURE__*/_react.default.createElement(_ui.SelectItem, {
|
|
387
|
+
key: option.value,
|
|
388
|
+
value: option.text
|
|
389
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
390
|
+
className: "flex items-center gap-2"
|
|
391
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, conditionformat[option.text])));
|
|
392
|
+
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
228
393
|
className: "flex flex-col"
|
|
229
394
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
230
395
|
className: "condition-rules-value text-heading-xsm"
|
|
@@ -327,6 +492,6 @@ var ConditionRules = function ConditionRules(_a) {
|
|
|
327
492
|
close("confirm");
|
|
328
493
|
},
|
|
329
494
|
tabIndex: 0
|
|
330
|
-
}, button.apply)));
|
|
495
|
+
}, button.apply)))));
|
|
331
496
|
};
|
|
332
497
|
var _default = exports.default = ConditionRules;
|
|
@@ -2,6 +2,7 @@ export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
|
|
|
2
2
|
export declare function getCursorPosition(editableDiv: HTMLDivElement): number;
|
|
3
3
|
export declare function isLetterNumberPattern(str: string): boolean;
|
|
4
4
|
export declare function removeLastSpan(htmlString: string): string;
|
|
5
|
+
export declare function numberToColumn(colNumber: number): string;
|
|
5
6
|
export declare function incrementColumn(cell: string): string;
|
|
6
7
|
export declare function decrementColumn(cell: string): string;
|
|
7
8
|
export declare function incrementRow(cell: string): string;
|
|
@@ -11,6 +11,7 @@ exports.incrementColumn = incrementColumn;
|
|
|
11
11
|
exports.incrementRow = incrementRow;
|
|
12
12
|
exports.isLetterNumberPattern = isLetterNumberPattern;
|
|
13
13
|
exports.moveCursorToEnd = moveCursorToEnd;
|
|
14
|
+
exports.numberToColumn = numberToColumn;
|
|
14
15
|
exports.removeLastSpan = removeLastSpan;
|
|
15
16
|
function moveCursorToEnd(editableDiv) {
|
|
16
17
|
editableDiv.focus();
|
|
@@ -18,10 +18,8 @@ var _Combo = _interopRequireDefault(require("./Combo"));
|
|
|
18
18
|
var _Select = _interopRequireWildcard(require("./Select"));
|
|
19
19
|
var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
|
|
20
20
|
var _useDialog = require("../../hooks/useDialog");
|
|
21
|
-
var _useAlert = require("../../hooks/useAlert");
|
|
22
21
|
var _SplitColumn = require("../SplitColumn");
|
|
23
22
|
var _LocationCondition = require("../LocationCondition");
|
|
24
|
-
var _ConditionFormat = _interopRequireDefault(require("../ConditionFormat"));
|
|
25
23
|
var _CustomButton = _interopRequireDefault(require("./CustomButton"));
|
|
26
24
|
var _CustomColor = require("./CustomColor");
|
|
27
25
|
var _FormatSearch = require("../FormatSearch");
|
|
@@ -491,33 +489,29 @@ var Toolbar = function Toolbar(_a) {
|
|
|
491
489
|
var _l = (0, _useDialog.useDialog)(),
|
|
492
490
|
showDialog = _l.showDialog,
|
|
493
491
|
hideDialog = _l.hideDialog;
|
|
494
|
-
var _m = (0, _useAlert.useAlert)(),
|
|
495
|
-
showAlert = _m.showAlert,
|
|
496
|
-
hideAlert = _m.hideAlert;
|
|
497
492
|
var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
|
|
498
493
|
var flowdata = (0, _fortuneCore.getFlowdata)(context);
|
|
499
494
|
contextRef.current = context;
|
|
500
495
|
var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
501
496
|
var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
502
497
|
var cell = flowdata && row != null && col != null ? (_c = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _c === void 0 ? void 0 : _c[col] : undefined;
|
|
503
|
-
var
|
|
504
|
-
toolbar =
|
|
505
|
-
merge =
|
|
506
|
-
border =
|
|
507
|
-
freezen =
|
|
508
|
-
defaultFmt =
|
|
509
|
-
formula =
|
|
510
|
-
sort =
|
|
511
|
-
align =
|
|
512
|
-
textWrap =
|
|
513
|
-
rotation =
|
|
514
|
-
screenshot =
|
|
515
|
-
filter =
|
|
516
|
-
splitText =
|
|
517
|
-
findAndReplace =
|
|
518
|
-
comment =
|
|
519
|
-
fontarray =
|
|
520
|
-
sheetconfig = _o.sheetconfig;
|
|
498
|
+
var _m = (0, _fortuneCore.locale)(context),
|
|
499
|
+
toolbar = _m.toolbar,
|
|
500
|
+
merge = _m.merge,
|
|
501
|
+
border = _m.border,
|
|
502
|
+
freezen = _m.freezen,
|
|
503
|
+
defaultFmt = _m.defaultFmt,
|
|
504
|
+
formula = _m.formula,
|
|
505
|
+
sort = _m.sort,
|
|
506
|
+
align = _m.align,
|
|
507
|
+
textWrap = _m.textWrap,
|
|
508
|
+
rotation = _m.rotation,
|
|
509
|
+
screenshot = _m.screenshot,
|
|
510
|
+
filter = _m.filter,
|
|
511
|
+
splitText = _m.splitText,
|
|
512
|
+
findAndReplace = _m.findAndReplace,
|
|
513
|
+
comment = _m.comment,
|
|
514
|
+
fontarray = _m.fontarray;
|
|
521
515
|
var toolbarFormat = (0, _fortuneCore.locale)(context).format;
|
|
522
516
|
var sheetWidth = context.luckysheetTableContentHW[0];
|
|
523
517
|
var currency = settings.currency;
|
|
@@ -607,9 +601,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
607
601
|
ctx.dataVerification.dataRegulation.value1 = "value1";
|
|
608
602
|
});
|
|
609
603
|
}, []);
|
|
610
|
-
var
|
|
611
|
-
showDataValidation =
|
|
612
|
-
setShowDataValidation =
|
|
604
|
+
var _o = (0, _react.useState)(false),
|
|
605
|
+
showDataValidation = _o[0],
|
|
606
|
+
setShowDataValidation = _o[1];
|
|
613
607
|
var dataVerificationClick = function dataVerificationClick(selectedCells) {
|
|
614
608
|
var _a;
|
|
615
609
|
var selection = _fortuneCore.api.getSelection(context);
|
|
@@ -631,6 +625,22 @@ var Toolbar = function Toolbar(_a) {
|
|
|
631
625
|
(0, _react.useEffect)(function () {
|
|
632
626
|
window.dataVerificationClick = dataVerificationClick;
|
|
633
627
|
}, []);
|
|
628
|
+
var conditionalFormatClick = function conditionalFormatClick(selectedCells) {
|
|
629
|
+
var _a;
|
|
630
|
+
console.log("conditionalFormatClick called");
|
|
631
|
+
var selection = _fortuneCore.api.getSelection(context);
|
|
632
|
+
if (!selection && !selectedCells) {
|
|
633
|
+
setContext(function (ctx) {
|
|
634
|
+
_fortuneCore.api.setSelection(ctx, [{
|
|
635
|
+
row: [0, 0],
|
|
636
|
+
column: [0, 0]
|
|
637
|
+
}], {
|
|
638
|
+
id: context.currentSheetId
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
(_a = document.getElementById("conditional-format-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
643
|
+
};
|
|
634
644
|
var getToolbarItem = (0, _react.useCallback)(function (name, i) {
|
|
635
645
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
636
646
|
var tooltip = toolbar[name];
|
|
@@ -1126,17 +1136,13 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1126
1136
|
});
|
|
1127
1137
|
}
|
|
1128
1138
|
if (name === "conditionFormat") {
|
|
1129
|
-
var
|
|
1130
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
1131
|
-
|
|
1139
|
+
var items = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
|
|
1140
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
1141
|
+
id: "conditionFormat",
|
|
1142
|
+
iconId: name,
|
|
1143
|
+
tooltip: tooltip,
|
|
1132
1144
|
key: name,
|
|
1133
|
-
|
|
1134
|
-
showArrow: false
|
|
1135
|
-
}, function (setOpen) {
|
|
1136
|
-
return /*#__PURE__*/_react.default.createElement(_ConditionFormat.default, {
|
|
1137
|
-
items: items_4,
|
|
1138
|
-
setOpen: setOpen
|
|
1139
|
-
});
|
|
1145
|
+
onClick: conditionalFormatClick
|
|
1140
1146
|
});
|
|
1141
1147
|
}
|
|
1142
1148
|
if (name === "image") {
|
|
@@ -1297,12 +1303,8 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1297
1303
|
tooltip: tooltip,
|
|
1298
1304
|
text: "\u5408\u5E76\u5355\u5143\u683C",
|
|
1299
1305
|
onClick: function onClick() {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
setContext(function (ctx) {
|
|
1303
|
-
(0, _fortuneCore.handleMerge)(ctx, "merge-all");
|
|
1304
|
-
});
|
|
1305
|
-
hideAlert();
|
|
1306
|
+
return setContext(function (ctx) {
|
|
1307
|
+
(0, _fortuneCore.handleMerge)(ctx, "merge-all");
|
|
1306
1308
|
});
|
|
1307
1309
|
}
|
|
1308
1310
|
}, function (setOpen) {
|
|
@@ -1313,21 +1315,10 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1313
1315
|
return /*#__PURE__*/_react.default.createElement(_Select.Option, {
|
|
1314
1316
|
key: value,
|
|
1315
1317
|
onClick: function onClick() {
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
setOpen(false);
|
|
1321
|
-
} else {
|
|
1322
|
-
setOpen(false);
|
|
1323
|
-
var confirmMessage = sheetconfig.confirmMerge;
|
|
1324
|
-
showAlert(confirmMessage, "yesno", function () {
|
|
1325
|
-
setContext(function (ctx) {
|
|
1326
|
-
(0, _fortuneCore.handleMerge)(ctx, value);
|
|
1327
|
-
});
|
|
1328
|
-
hideAlert();
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1318
|
+
setContext(function (ctx) {
|
|
1319
|
+
(0, _fortuneCore.handleMerge)(ctx, value);
|
|
1320
|
+
});
|
|
1321
|
+
setOpen(false);
|
|
1331
1322
|
}
|
|
1332
1323
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1333
1324
|
style: {
|
|
@@ -1344,7 +1335,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1344
1335
|
});
|
|
1345
1336
|
}
|
|
1346
1337
|
if (name === "border") {
|
|
1347
|
-
var
|
|
1338
|
+
var items_4 = [{
|
|
1348
1339
|
text: border.borderTop,
|
|
1349
1340
|
value: "border-top",
|
|
1350
1341
|
icon: "BorderTop"
|
|
@@ -1399,7 +1390,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1399
1390
|
}, function (setOpen) {
|
|
1400
1391
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1401
1392
|
className: "fortune-toolbar-select fortune-border-grid"
|
|
1402
|
-
},
|
|
1393
|
+
}, items_4.map(function (_a) {
|
|
1403
1394
|
var value = _a.value,
|
|
1404
1395
|
icon = _a.icon;
|
|
1405
1396
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1420,7 +1411,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1420
1411
|
});
|
|
1421
1412
|
}
|
|
1422
1413
|
if (name === "freeze") {
|
|
1423
|
-
var
|
|
1414
|
+
var items_5 = [{
|
|
1424
1415
|
text: freezen.freezenRowRange,
|
|
1425
1416
|
value: "freeze-row"
|
|
1426
1417
|
}, {
|
|
@@ -1444,7 +1435,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1444
1435
|
});
|
|
1445
1436
|
}
|
|
1446
1437
|
}, function (setOpen) {
|
|
1447
|
-
return /*#__PURE__*/_react.default.createElement(_Select.default, null,
|
|
1438
|
+
return /*#__PURE__*/_react.default.createElement(_Select.default, null, items_5.map(function (_a) {
|
|
1448
1439
|
var text = _a.text,
|
|
1449
1440
|
value = _a.value;
|
|
1450
1441
|
return /*#__PURE__*/_react.default.createElement(_Select.Option, {
|
|
@@ -1466,7 +1457,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1466
1457
|
});
|
|
1467
1458
|
}
|
|
1468
1459
|
if (name === "text-wrap") {
|
|
1469
|
-
var
|
|
1460
|
+
var items_6 = [{
|
|
1470
1461
|
text: textWrap.clip,
|
|
1471
1462
|
iconId: "text-clip",
|
|
1472
1463
|
value: "clip"
|
|
@@ -1479,9 +1470,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1479
1470
|
iconId: "text-wrap",
|
|
1480
1471
|
value: "wrap"
|
|
1481
1472
|
}];
|
|
1482
|
-
var curr_3 =
|
|
1473
|
+
var curr_3 = items_6[0];
|
|
1483
1474
|
if ((cell === null || cell === void 0 ? void 0 : cell.tb) != null) {
|
|
1484
|
-
curr_3 = _lodash.default.get(
|
|
1475
|
+
curr_3 = _lodash.default.get(items_6, cell.tb);
|
|
1485
1476
|
}
|
|
1486
1477
|
return /*#__PURE__*/_react.default.createElement(_Combo.default, {
|
|
1487
1478
|
iconId: curr_3.iconId,
|
|
@@ -1498,7 +1489,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1498
1489
|
justifyContent: "center",
|
|
1499
1490
|
gap: 4
|
|
1500
1491
|
}
|
|
1501
|
-
},
|
|
1492
|
+
}, items_6.map(function (_a) {
|
|
1502
1493
|
var iconId = _a.iconId,
|
|
1503
1494
|
value = _a.value;
|
|
1504
1495
|
return /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
@@ -1529,7 +1520,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1529
1520
|
});
|
|
1530
1521
|
}
|
|
1531
1522
|
if (name === "text-rotation") {
|
|
1532
|
-
var
|
|
1523
|
+
var items_7 = [{
|
|
1533
1524
|
text: rotation.none,
|
|
1534
1525
|
iconId: "text-rotation-none",
|
|
1535
1526
|
value: "none"
|
|
@@ -1554,9 +1545,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1554
1545
|
iconId: "text-rotation-down",
|
|
1555
1546
|
value: "rotation-down"
|
|
1556
1547
|
}];
|
|
1557
|
-
var curr =
|
|
1548
|
+
var curr = items_7[0];
|
|
1558
1549
|
if ((cell === null || cell === void 0 ? void 0 : cell.tr) != null) {
|
|
1559
|
-
curr = _lodash.default.get(
|
|
1550
|
+
curr = _lodash.default.get(items_7, cell.tr);
|
|
1560
1551
|
}
|
|
1561
1552
|
return /*#__PURE__*/_react.default.createElement(_Combo.default, {
|
|
1562
1553
|
iconId: curr.iconId,
|
|
@@ -1564,7 +1555,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1564
1555
|
tooltip: toolbar.textRotate,
|
|
1565
1556
|
showArrow: false
|
|
1566
1557
|
}, function (setOpen) {
|
|
1567
|
-
return /*#__PURE__*/_react.default.createElement(_Select.default, null,
|
|
1558
|
+
return /*#__PURE__*/_react.default.createElement(_Select.default, null, items_7.map(function (_a) {
|
|
1568
1559
|
var text = _a.text,
|
|
1569
1560
|
iconId = _a.iconId,
|
|
1570
1561
|
value = _a.value;
|
|
@@ -1589,7 +1580,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1589
1580
|
});
|
|
1590
1581
|
}
|
|
1591
1582
|
if (name === "filter") {
|
|
1592
|
-
var
|
|
1583
|
+
var items_8 = [{
|
|
1593
1584
|
iconId: "sort-asc",
|
|
1594
1585
|
value: "sort-asc",
|
|
1595
1586
|
text: sort.asc,
|
|
@@ -1639,7 +1630,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1639
1630
|
style: {
|
|
1640
1631
|
minWidth: "11.25rem"
|
|
1641
1632
|
}
|
|
1642
|
-
},
|
|
1633
|
+
}, items_8.map(function (_a, index) {
|
|
1643
1634
|
var text = _a.text,
|
|
1644
1635
|
iconId = _a.iconId,
|
|
1645
1636
|
value = _a.value,
|
|
@@ -714,7 +714,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
714
714
|
chartEditNoOpt: string;
|
|
715
715
|
sheetNameSpecCharError: string;
|
|
716
716
|
sheetNamecannotIsEmptyError: string;
|
|
717
|
-
confirmMerge: string;
|
|
718
717
|
};
|
|
719
718
|
conditionformat: {
|
|
720
719
|
conditionformat_greaterThan: string;
|
|
@@ -1197,4 +1196,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
1197
1196
|
getRefs: () => any;
|
|
1198
1197
|
getShowDialog: () => typeof useDialog;
|
|
1199
1198
|
getSplitColComponent: () => import("react").FC<{}>;
|
|
1199
|
+
getConditionalFormatComponent: () => import("react").FC<{
|
|
1200
|
+
type?: string | undefined;
|
|
1201
|
+
}>;
|
|
1200
1202
|
};
|
|
@@ -10,6 +10,7 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
10
10
|
var _cryptoApi = require("../../utils/cryptoApi");
|
|
11
11
|
var _useDialog = require("../../hooks/useDialog");
|
|
12
12
|
var _SplitColumn = require("../../components/SplitColumn");
|
|
13
|
+
var _ConditionRules = _interopRequireDefault(require("../ConditionFormat/ConditionRules"));
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
15
16
|
__assign = Object.assign || function (t) {
|
|
@@ -459,6 +460,9 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
459
460
|
},
|
|
460
461
|
getSplitColComponent: function getSplitColComponent() {
|
|
461
462
|
return _SplitColumn.SplitColumn;
|
|
463
|
+
},
|
|
464
|
+
getConditionalFormatComponent: function getConditionalFormatComponent() {
|
|
465
|
+
return _ConditionRules.default;
|
|
462
466
|
}
|
|
463
467
|
};
|
|
464
468
|
}
|
|
@@ -721,7 +721,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
721
721
|
chartEditNoOpt: string;
|
|
722
722
|
sheetNameSpecCharError: string;
|
|
723
723
|
sheetNamecannotIsEmptyError: string;
|
|
724
|
-
confirmMerge: string;
|
|
725
724
|
};
|
|
726
725
|
conditionformat: {
|
|
727
726
|
conditionformat_greaterThan: string;
|
|
@@ -1204,5 +1203,8 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
1204
1203
|
getRefs: () => any;
|
|
1205
1204
|
getShowDialog: () => typeof import("../../hooks/useDialog").useDialog;
|
|
1206
1205
|
getSplitColComponent: () => React.FC<{}>;
|
|
1206
|
+
getConditionalFormatComponent: () => React.FC<{
|
|
1207
|
+
type?: string | undefined;
|
|
1208
|
+
}>;
|
|
1207
1209
|
}>>;
|
|
1208
1210
|
export default Workbook;
|
|
@@ -24,6 +24,7 @@ var _modal = require("../../context/modal");
|
|
|
24
24
|
var _FilterMenu = _interopRequireDefault(require("../ContextMenu/FilterMenu"));
|
|
25
25
|
var _SheetList = _interopRequireDefault(require("../SheetList"));
|
|
26
26
|
var _DunePreview = _interopRequireDefault(require("../DunePreview/DunePreview"));
|
|
27
|
+
var _ConditionRules = _interopRequireDefault(require("../ConditionFormat/ConditionRules"));
|
|
27
28
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
29
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
29
30
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
@@ -362,6 +363,10 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
362
363
|
refs: refs
|
|
363
364
|
};
|
|
364
365
|
}, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce]);
|
|
366
|
+
var _e = (0, _react.useState)(false),
|
|
367
|
+
show = _e[0],
|
|
368
|
+
setShow = _e[1];
|
|
369
|
+
var getCond = function getCond() {};
|
|
365
370
|
(0, _react.useEffect)(function () {
|
|
366
371
|
if (!_lodash.default.isEmpty(context.luckysheetfile)) {
|
|
367
372
|
onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
|
|
@@ -689,7 +694,20 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
689
694
|
}
|
|
690
695
|
return /*#__PURE__*/_react.default.createElement(_context.default.Provider, {
|
|
691
696
|
value: providerValue
|
|
692
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
697
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
698
|
+
onClick: function onClick() {
|
|
699
|
+
setShow(!show);
|
|
700
|
+
}
|
|
701
|
+
}, "Click"), show && /*#__PURE__*/_react.default.createElement("div", {
|
|
702
|
+
id: "placeholder-conditional-formatting",
|
|
703
|
+
style: {
|
|
704
|
+
width: "500px",
|
|
705
|
+
height: "500px",
|
|
706
|
+
position: "fixed",
|
|
707
|
+
zIndex: "1000",
|
|
708
|
+
backgroundColor: "white"
|
|
709
|
+
}
|
|
710
|
+
}, /*#__PURE__*/_react.default.createElement(_ConditionRules.default, null)), /*#__PURE__*/_react.default.createElement(_modal.ModalProvider, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
693
711
|
className: "fortune-container",
|
|
694
712
|
ref: workbookContainer,
|
|
695
713
|
onKeyDown: onKeyDown
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.64-
|
|
3
|
+
"version": "1.2.64-patch-1",
|
|
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.64-
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.64-patch-1",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|