@fileverse-dev/fortune-react 1.2.64-mergeFix-patch-1 → 1.2.64-patch-2
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/conditionalFormatPortal.d.ts +5 -0
- package/es/components/Toolbar/conditionalFormatPortal.js +10 -0
- package/es/components/Toolbar/index.js +70 -70
- 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/conditionalFormatPortal.d.ts +5 -0
- package/lib/components/Toolbar/conditionalFormatPortal.js +17 -0
- package/lib/components/Toolbar/index.js +70 -70
- 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
|
@@ -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();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactDom = require("react-dom");
|
|
9
|
+
var _ConditionRules = _interopRequireDefault(require("../ConditionFormat/ConditionRules"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var ConditionalFormatPortal = function ConditionalFormatPortal(_a) {
|
|
12
|
+
var visible = _a.visible;
|
|
13
|
+
var container = document.getElementById("placeholder-conditional-format");
|
|
14
|
+
if (!visible || !container) return null;
|
|
15
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_ConditionRules.default, null), container);
|
|
16
|
+
};
|
|
17
|
+
var _default = exports.default = ConditionalFormatPortal;
|
|
@@ -10,6 +10,7 @@ var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
|
10
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
11
11
|
var _ui = require("@fileverse/ui");
|
|
12
12
|
var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
|
|
13
|
+
var _conditionalFormatPortal = _interopRequireDefault(require("./conditionalFormatPortal"));
|
|
13
14
|
var _context = _interopRequireDefault(require("../../context"));
|
|
14
15
|
require("./index.css");
|
|
15
16
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
@@ -18,10 +19,8 @@ var _Combo = _interopRequireDefault(require("./Combo"));
|
|
|
18
19
|
var _Select = _interopRequireWildcard(require("./Select"));
|
|
19
20
|
var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
|
|
20
21
|
var _useDialog = require("../../hooks/useDialog");
|
|
21
|
-
var _useAlert = require("../../hooks/useAlert");
|
|
22
22
|
var _SplitColumn = require("../SplitColumn");
|
|
23
23
|
var _LocationCondition = require("../LocationCondition");
|
|
24
|
-
var _ConditionFormat = _interopRequireDefault(require("../ConditionFormat"));
|
|
25
24
|
var _CustomButton = _interopRequireDefault(require("./CustomButton"));
|
|
26
25
|
var _CustomColor = require("./CustomColor");
|
|
27
26
|
var _FormatSearch = require("../FormatSearch");
|
|
@@ -491,33 +490,29 @@ var Toolbar = function Toolbar(_a) {
|
|
|
491
490
|
var _l = (0, _useDialog.useDialog)(),
|
|
492
491
|
showDialog = _l.showDialog,
|
|
493
492
|
hideDialog = _l.hideDialog;
|
|
494
|
-
var _m = (0, _useAlert.useAlert)(),
|
|
495
|
-
showAlert = _m.showAlert,
|
|
496
|
-
hideAlert = _m.hideAlert;
|
|
497
493
|
var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
|
|
498
494
|
var flowdata = (0, _fortuneCore.getFlowdata)(context);
|
|
499
495
|
contextRef.current = context;
|
|
500
496
|
var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
501
497
|
var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
502
498
|
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;
|
|
499
|
+
var _m = (0, _fortuneCore.locale)(context),
|
|
500
|
+
toolbar = _m.toolbar,
|
|
501
|
+
merge = _m.merge,
|
|
502
|
+
border = _m.border,
|
|
503
|
+
freezen = _m.freezen,
|
|
504
|
+
defaultFmt = _m.defaultFmt,
|
|
505
|
+
formula = _m.formula,
|
|
506
|
+
sort = _m.sort,
|
|
507
|
+
align = _m.align,
|
|
508
|
+
textWrap = _m.textWrap,
|
|
509
|
+
rotation = _m.rotation,
|
|
510
|
+
screenshot = _m.screenshot,
|
|
511
|
+
filter = _m.filter,
|
|
512
|
+
splitText = _m.splitText,
|
|
513
|
+
findAndReplace = _m.findAndReplace,
|
|
514
|
+
comment = _m.comment,
|
|
515
|
+
fontarray = _m.fontarray;
|
|
521
516
|
var toolbarFormat = (0, _fortuneCore.locale)(context).format;
|
|
522
517
|
var sheetWidth = context.luckysheetTableContentHW[0];
|
|
523
518
|
var currency = settings.currency;
|
|
@@ -607,9 +602,12 @@ var Toolbar = function Toolbar(_a) {
|
|
|
607
602
|
ctx.dataVerification.dataRegulation.value1 = "value1";
|
|
608
603
|
});
|
|
609
604
|
}, []);
|
|
605
|
+
var _o = (0, _react.useState)(false),
|
|
606
|
+
showDataValidation = _o[0],
|
|
607
|
+
setShowDataValidation = _o[1];
|
|
610
608
|
var _p = (0, _react.useState)(false),
|
|
611
|
-
|
|
612
|
-
|
|
609
|
+
showConditionalFormat = _p[0],
|
|
610
|
+
setShowConditionalFormat = _p[1];
|
|
613
611
|
var dataVerificationClick = function dataVerificationClick(selectedCells) {
|
|
614
612
|
var _a;
|
|
615
613
|
var selection = _fortuneCore.api.getSelection(context);
|
|
@@ -631,6 +629,25 @@ var Toolbar = function Toolbar(_a) {
|
|
|
631
629
|
(0, _react.useEffect)(function () {
|
|
632
630
|
window.dataVerificationClick = dataVerificationClick;
|
|
633
631
|
}, []);
|
|
632
|
+
var conditionalFormatClick = function conditionalFormatClick(selectedCells) {
|
|
633
|
+
var _a;
|
|
634
|
+
console.log("conditionalFormatClick called");
|
|
635
|
+
var selection = _fortuneCore.api.getSelection(context);
|
|
636
|
+
if (!selection && !selectedCells) {
|
|
637
|
+
setContext(function (ctx) {
|
|
638
|
+
_fortuneCore.api.setSelection(ctx, [{
|
|
639
|
+
row: [0, 0],
|
|
640
|
+
column: [0, 0]
|
|
641
|
+
}], {
|
|
642
|
+
id: context.currentSheetId
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
(_a = document.getElementById("conditional-format-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
647
|
+
setTimeout(function () {
|
|
648
|
+
setShowConditionalFormat(true);
|
|
649
|
+
}, 100);
|
|
650
|
+
};
|
|
634
651
|
var getToolbarItem = (0, _react.useCallback)(function (name, i) {
|
|
635
652
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
636
653
|
var tooltip = toolbar[name];
|
|
@@ -1126,17 +1143,13 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1126
1143
|
});
|
|
1127
1144
|
}
|
|
1128
1145
|
if (name === "conditionFormat") {
|
|
1129
|
-
var
|
|
1130
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
1131
|
-
|
|
1146
|
+
var items = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
|
|
1147
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
1148
|
+
id: "conditionFormat",
|
|
1149
|
+
iconId: name,
|
|
1150
|
+
tooltip: tooltip,
|
|
1132
1151
|
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
|
-
});
|
|
1152
|
+
onClick: conditionalFormatClick
|
|
1140
1153
|
});
|
|
1141
1154
|
}
|
|
1142
1155
|
if (name === "image") {
|
|
@@ -1297,12 +1310,8 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1297
1310
|
tooltip: tooltip,
|
|
1298
1311
|
text: "\u5408\u5E76\u5355\u5143\u683C",
|
|
1299
1312
|
onClick: function onClick() {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
setContext(function (ctx) {
|
|
1303
|
-
(0, _fortuneCore.handleMerge)(ctx, "merge-all");
|
|
1304
|
-
});
|
|
1305
|
-
hideAlert();
|
|
1313
|
+
return setContext(function (ctx) {
|
|
1314
|
+
(0, _fortuneCore.handleMerge)(ctx, "merge-all");
|
|
1306
1315
|
});
|
|
1307
1316
|
}
|
|
1308
1317
|
}, function (setOpen) {
|
|
@@ -1313,21 +1322,10 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1313
1322
|
return /*#__PURE__*/_react.default.createElement(_Select.Option, {
|
|
1314
1323
|
key: value,
|
|
1315
1324
|
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
|
-
}
|
|
1325
|
+
setContext(function (ctx) {
|
|
1326
|
+
(0, _fortuneCore.handleMerge)(ctx, value);
|
|
1327
|
+
});
|
|
1328
|
+
setOpen(false);
|
|
1331
1329
|
}
|
|
1332
1330
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1333
1331
|
style: {
|
|
@@ -1344,7 +1342,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1344
1342
|
});
|
|
1345
1343
|
}
|
|
1346
1344
|
if (name === "border") {
|
|
1347
|
-
var
|
|
1345
|
+
var items_4 = [{
|
|
1348
1346
|
text: border.borderTop,
|
|
1349
1347
|
value: "border-top",
|
|
1350
1348
|
icon: "BorderTop"
|
|
@@ -1399,7 +1397,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1399
1397
|
}, function (setOpen) {
|
|
1400
1398
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1401
1399
|
className: "fortune-toolbar-select fortune-border-grid"
|
|
1402
|
-
},
|
|
1400
|
+
}, items_4.map(function (_a) {
|
|
1403
1401
|
var value = _a.value,
|
|
1404
1402
|
icon = _a.icon;
|
|
1405
1403
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1420,7 +1418,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1420
1418
|
});
|
|
1421
1419
|
}
|
|
1422
1420
|
if (name === "freeze") {
|
|
1423
|
-
var
|
|
1421
|
+
var items_5 = [{
|
|
1424
1422
|
text: freezen.freezenRowRange,
|
|
1425
1423
|
value: "freeze-row"
|
|
1426
1424
|
}, {
|
|
@@ -1444,7 +1442,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1444
1442
|
});
|
|
1445
1443
|
}
|
|
1446
1444
|
}, function (setOpen) {
|
|
1447
|
-
return /*#__PURE__*/_react.default.createElement(_Select.default, null,
|
|
1445
|
+
return /*#__PURE__*/_react.default.createElement(_Select.default, null, items_5.map(function (_a) {
|
|
1448
1446
|
var text = _a.text,
|
|
1449
1447
|
value = _a.value;
|
|
1450
1448
|
return /*#__PURE__*/_react.default.createElement(_Select.Option, {
|
|
@@ -1466,7 +1464,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1466
1464
|
});
|
|
1467
1465
|
}
|
|
1468
1466
|
if (name === "text-wrap") {
|
|
1469
|
-
var
|
|
1467
|
+
var items_6 = [{
|
|
1470
1468
|
text: textWrap.clip,
|
|
1471
1469
|
iconId: "text-clip",
|
|
1472
1470
|
value: "clip"
|
|
@@ -1479,9 +1477,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1479
1477
|
iconId: "text-wrap",
|
|
1480
1478
|
value: "wrap"
|
|
1481
1479
|
}];
|
|
1482
|
-
var curr_3 =
|
|
1480
|
+
var curr_3 = items_6[0];
|
|
1483
1481
|
if ((cell === null || cell === void 0 ? void 0 : cell.tb) != null) {
|
|
1484
|
-
curr_3 = _lodash.default.get(
|
|
1482
|
+
curr_3 = _lodash.default.get(items_6, cell.tb);
|
|
1485
1483
|
}
|
|
1486
1484
|
return /*#__PURE__*/_react.default.createElement(_Combo.default, {
|
|
1487
1485
|
iconId: curr_3.iconId,
|
|
@@ -1498,7 +1496,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1498
1496
|
justifyContent: "center",
|
|
1499
1497
|
gap: 4
|
|
1500
1498
|
}
|
|
1501
|
-
},
|
|
1499
|
+
}, items_6.map(function (_a) {
|
|
1502
1500
|
var iconId = _a.iconId,
|
|
1503
1501
|
value = _a.value;
|
|
1504
1502
|
return /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
@@ -1529,7 +1527,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1529
1527
|
});
|
|
1530
1528
|
}
|
|
1531
1529
|
if (name === "text-rotation") {
|
|
1532
|
-
var
|
|
1530
|
+
var items_7 = [{
|
|
1533
1531
|
text: rotation.none,
|
|
1534
1532
|
iconId: "text-rotation-none",
|
|
1535
1533
|
value: "none"
|
|
@@ -1554,9 +1552,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1554
1552
|
iconId: "text-rotation-down",
|
|
1555
1553
|
value: "rotation-down"
|
|
1556
1554
|
}];
|
|
1557
|
-
var curr =
|
|
1555
|
+
var curr = items_7[0];
|
|
1558
1556
|
if ((cell === null || cell === void 0 ? void 0 : cell.tr) != null) {
|
|
1559
|
-
curr = _lodash.default.get(
|
|
1557
|
+
curr = _lodash.default.get(items_7, cell.tr);
|
|
1560
1558
|
}
|
|
1561
1559
|
return /*#__PURE__*/_react.default.createElement(_Combo.default, {
|
|
1562
1560
|
iconId: curr.iconId,
|
|
@@ -1564,7 +1562,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1564
1562
|
tooltip: toolbar.textRotate,
|
|
1565
1563
|
showArrow: false
|
|
1566
1564
|
}, function (setOpen) {
|
|
1567
|
-
return /*#__PURE__*/_react.default.createElement(_Select.default, null,
|
|
1565
|
+
return /*#__PURE__*/_react.default.createElement(_Select.default, null, items_7.map(function (_a) {
|
|
1568
1566
|
var text = _a.text,
|
|
1569
1567
|
iconId = _a.iconId,
|
|
1570
1568
|
value = _a.value;
|
|
@@ -1589,7 +1587,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1589
1587
|
});
|
|
1590
1588
|
}
|
|
1591
1589
|
if (name === "filter") {
|
|
1592
|
-
var
|
|
1590
|
+
var items_8 = [{
|
|
1593
1591
|
iconId: "sort-asc",
|
|
1594
1592
|
value: "sort-asc",
|
|
1595
1593
|
text: sort.asc,
|
|
@@ -1639,7 +1637,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1639
1637
|
style: {
|
|
1640
1638
|
minWidth: "11.25rem"
|
|
1641
1639
|
}
|
|
1642
|
-
},
|
|
1640
|
+
}, items_8.map(function (_a, index) {
|
|
1643
1641
|
var text = _a.text,
|
|
1644
1642
|
iconId = _a.iconId,
|
|
1645
1643
|
value = _a.value,
|
|
@@ -1694,6 +1692,8 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1694
1692
|
"aria-label": toolbar.toolbar
|
|
1695
1693
|
}, /*#__PURE__*/_react.default.createElement(_dataVerificationPortal.default, {
|
|
1696
1694
|
visible: showDataValidation
|
|
1695
|
+
}), /*#__PURE__*/_react.default.createElement(_conditionalFormatPortal.default, {
|
|
1696
|
+
visible: showConditionalFormat
|
|
1697
1697
|
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
1698
1698
|
id: "fortune-img-upload",
|
|
1699
1699
|
className: "test-fortune-img-upload",
|
|
@@ -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;
|