@fileverse-dev/fortune-react 1.3.5-hyper → 1.3.5-hyper-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/LinkEidtCard/index.js +32 -27
- package/es/components/SheetOverlay/InputBox.js +90 -36
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +23 -0
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +23 -0
- package/es/components/Toolbar/index.js +11 -3
- package/lib/components/LinkEidtCard/index.js +32 -27
- package/lib/components/SheetOverlay/InputBox.js +90 -36
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +23 -0
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +23 -0
- package/lib/components/Toolbar/index.js +11 -3
- package/package.json +2 -2
|
@@ -64,6 +64,20 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
64
64
|
draftCtx.linkCard = undefined;
|
|
65
65
|
});
|
|
66
66
|
}, [refs.globalCache, setContext]);
|
|
67
|
+
var handleInsertLink = useCallback(function () {
|
|
68
|
+
if (isButtonDisabled) return;
|
|
69
|
+
_.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
70
|
+
setContext(function (draftCtx) {
|
|
71
|
+
saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
72
|
+
applyToSelection: applyToSelection || undefined,
|
|
73
|
+
cellInput: refs.cellInput.current
|
|
74
|
+
});
|
|
75
|
+
if (!applyToSelection) {
|
|
76
|
+
draftCtx.luckysheetCellUpdate = [];
|
|
77
|
+
jfrefreshgrid(draftCtx, null, undefined);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}, [isButtonDisabled, refs.globalCache, refs.cellInput, setContext, r, c, linkText, linkType, linkAddress, applyToSelection]);
|
|
67
81
|
var containerEvent = useMemo(function () {
|
|
68
82
|
return {
|
|
69
83
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -83,26 +97,16 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
83
97
|
},
|
|
84
98
|
onKeyDown: function onKeyDown(e) {
|
|
85
99
|
e.stopPropagation();
|
|
86
|
-
if (isButtonDisabled) return;
|
|
87
100
|
if (e.key === "Enter") {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
91
|
-
applyToSelection: applyToSelection || undefined,
|
|
92
|
-
cellInput: refs.cellInput.current
|
|
93
|
-
});
|
|
94
|
-
if (!applyToSelection) {
|
|
95
|
-
draftCtx.luckysheetCellUpdate = [];
|
|
96
|
-
jfrefreshgrid(draftCtx, null, undefined);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
handleInsertLink();
|
|
99
103
|
}
|
|
100
104
|
},
|
|
101
105
|
onDoubleClick: function onDoubleClick(e) {
|
|
102
106
|
return e.stopPropagation();
|
|
103
107
|
}
|
|
104
108
|
};
|
|
105
|
-
}, [
|
|
109
|
+
}, [handleInsertLink]);
|
|
106
110
|
var renderToolbarButton = useCallback(function (iconId, onClick) {
|
|
107
111
|
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
108
112
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -247,6 +251,13 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
247
251
|
onChange: function onChange(e) {
|
|
248
252
|
return setLinkText(e.target.value);
|
|
249
253
|
},
|
|
254
|
+
onKeyDown: function onKeyDown(e) {
|
|
255
|
+
if (e.key === "Enter") {
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
handleInsertLink();
|
|
259
|
+
}
|
|
260
|
+
},
|
|
250
261
|
className: "fortune-link-input"
|
|
251
262
|
})), linkType === "webpage" && (/*#__PURE__*/React.createElement("div", {
|
|
252
263
|
className: "fortune-input-with-icon"
|
|
@@ -260,6 +271,13 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
260
271
|
ref: linkAddressRef,
|
|
261
272
|
placeholder: "Paste URL",
|
|
262
273
|
value: linkAddress,
|
|
274
|
+
onKeyDown: function onKeyDown(e) {
|
|
275
|
+
if (e.key === "Enter") {
|
|
276
|
+
e.preventDefault();
|
|
277
|
+
e.stopPropagation();
|
|
278
|
+
handleInsertLink();
|
|
279
|
+
}
|
|
280
|
+
},
|
|
263
281
|
onChange: function onChange(e) {
|
|
264
282
|
return setLinkAddress(e.target.value);
|
|
265
283
|
},
|
|
@@ -292,20 +310,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
292
310
|
}))))), /*#__PURE__*/React.createElement(Button, {
|
|
293
311
|
className: "fortune-link-card__cta fortune-insert-button",
|
|
294
312
|
disabled: isButtonDisabled,
|
|
295
|
-
onClick:
|
|
296
|
-
if (isButtonDisabled) return;
|
|
297
|
-
_.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
298
|
-
setContext(function (draftCtx) {
|
|
299
|
-
saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
300
|
-
applyToSelection: applyToSelection || undefined,
|
|
301
|
-
cellInput: refs.cellInput.current
|
|
302
|
-
});
|
|
303
|
-
if (!applyToSelection) {
|
|
304
|
-
draftCtx.luckysheetCellUpdate = [];
|
|
305
|
-
jfrefreshgrid(draftCtx, null, undefined);
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
},
|
|
313
|
+
onClick: handleInsertLink,
|
|
309
314
|
"data-testid": "link-card-cta-insert"
|
|
310
315
|
}, "Insert link"));
|
|
311
316
|
};
|
|
@@ -8,7 +8,7 @@ var __assign = this && this.__assign || function () {
|
|
|
8
8
|
};
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
|
-
import { cancelNormalSelected, getCellValue, getInlineStringHTML, getStyleByCell, isInlineStringCell, moveToEnd, getFlowdata, handleFormulaInput, moveHighlightCell, escapeScriptTag, valueShowEs, createRangeHightlight, isShowHidenCR, israngeseleciton, escapeHTMLTag, isAllowEdit, getrangeseleciton, indexToColumnChar, handleBold, handleItalic, handleUnderline, handleStrikeThrough } from "@fileverse-dev/fortune-core";
|
|
11
|
+
import { cancelNormalSelected, getCellValue, getInlineStringHTML, getStyleByCell, isInlineStringCell, moveToEnd, getFlowdata, handleFormulaInput, moveHighlightCell, escapeScriptTag, valueShowEs, createRangeHightlight, isShowHidenCR, israngeseleciton, escapeHTMLTag, isAllowEdit, getrangeseleciton, indexToColumnChar, handleBold, handleItalic, handleUnderline, handleStrikeThrough, getRangeRectsByCharacterOffset } from "@fileverse-dev/fortune-core";
|
|
12
12
|
import React, { useContext, useEffect, useMemo, useRef, useCallback, useLayoutEffect, useState } from "react";
|
|
13
13
|
import _ from "lodash";
|
|
14
14
|
import { Tooltip } from "@fileverse/ui";
|
|
@@ -20,53 +20,57 @@ import usePrevious from "../../hooks/usePrevious";
|
|
|
20
20
|
import { moveCursorToEnd, getCursorPosition, isLetterNumberPattern, removeLastSpan, incrementColumn, decrementColumn, incrementRow, decrementRow, countCommasBeforeCursor } from "./helper";
|
|
21
21
|
import { LucideIcon } from "./LucideIcon";
|
|
22
22
|
var InputBox = function InputBox() {
|
|
23
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
24
|
-
var
|
|
25
|
-
context =
|
|
26
|
-
setContext =
|
|
27
|
-
refs =
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
24
|
+
var _m = useContext(WorkbookContext),
|
|
25
|
+
context = _m.context,
|
|
26
|
+
setContext = _m.setContext,
|
|
27
|
+
refs = _m.refs;
|
|
28
28
|
var inputRef = useRef(null);
|
|
29
29
|
var lastKeyDownEventRef = useRef(null);
|
|
30
30
|
var prevCellUpdate = usePrevious(context.luckysheetCellUpdate);
|
|
31
31
|
var prevSheetId = usePrevious(context.currentSheetId);
|
|
32
|
-
var
|
|
33
|
-
isHidenRC =
|
|
34
|
-
setIsHidenRC =
|
|
35
|
-
var
|
|
36
|
-
isInputBoxActive =
|
|
37
|
-
setIsInputBoxActive =
|
|
38
|
-
var
|
|
39
|
-
activeCell =
|
|
40
|
-
setActiveCell =
|
|
41
|
-
var
|
|
42
|
-
activeRefCell =
|
|
43
|
-
setActiveRefCell =
|
|
44
|
-
var
|
|
32
|
+
var _o = useState(false),
|
|
33
|
+
isHidenRC = _o[0],
|
|
34
|
+
setIsHidenRC = _o[1];
|
|
35
|
+
var _p = useState(false),
|
|
36
|
+
isInputBoxActive = _p[0],
|
|
37
|
+
setIsInputBoxActive = _p[1];
|
|
38
|
+
var _q = useState(""),
|
|
39
|
+
activeCell = _q[0],
|
|
40
|
+
setActiveCell = _q[1];
|
|
41
|
+
var _r = useState(""),
|
|
42
|
+
activeRefCell = _r[0],
|
|
43
|
+
setActiveRefCell = _r[1];
|
|
44
|
+
var _s = useState({
|
|
45
45
|
left: 0,
|
|
46
46
|
top: 0
|
|
47
47
|
}),
|
|
48
|
-
frozenPosition =
|
|
49
|
-
setFrozenPosition =
|
|
48
|
+
frozenPosition = _s[0],
|
|
49
|
+
setFrozenPosition = _s[1];
|
|
50
50
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
51
|
-
var
|
|
52
|
-
firstSelectionActiveCell =
|
|
53
|
-
setFirstSelectionActiveCell =
|
|
54
|
-
var
|
|
55
|
-
commaCount =
|
|
56
|
-
setCommaCount =
|
|
51
|
+
var _t = useState({}),
|
|
52
|
+
firstSelectionActiveCell = _t[0],
|
|
53
|
+
setFirstSelectionActiveCell = _t[1];
|
|
54
|
+
var _u = useState(0),
|
|
55
|
+
commaCount = _u[0],
|
|
56
|
+
setCommaCount = _u[1];
|
|
57
57
|
var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
|
|
58
|
-
var
|
|
59
|
-
showFormulaHint =
|
|
60
|
-
setShowFormulaHint =
|
|
61
|
-
var
|
|
62
|
-
showSearchHint =
|
|
63
|
-
setShowSearchHint =
|
|
58
|
+
var _v = useState(!hideFormulaHintLocal),
|
|
59
|
+
showFormulaHint = _v[0],
|
|
60
|
+
setShowFormulaHint = _v[1];
|
|
61
|
+
var _w = useState(false),
|
|
62
|
+
showSearchHint = _w[0],
|
|
63
|
+
setShowSearchHint = _w[1];
|
|
64
64
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
65
65
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
66
66
|
var preText = useRef("");
|
|
67
67
|
var placeRef = useRef("");
|
|
68
68
|
var isComposingRef = useRef(false);
|
|
69
69
|
var ZWSP = "\u200B";
|
|
70
|
+
var inputBoxInnerRef = useRef(null);
|
|
71
|
+
var _x = useState([]),
|
|
72
|
+
linkSelectionHighlightRects = _x[0],
|
|
73
|
+
setLinkSelectionHighlightRects = _x[1];
|
|
70
74
|
var ensureNotEmpty = function ensureNotEmpty() {
|
|
71
75
|
var el = inputRef.current;
|
|
72
76
|
if (!el) return;
|
|
@@ -533,6 +537,29 @@ var InputBox = function InputBox() {
|
|
|
533
537
|
window.removeEventListener("keydown", handleKeyDown);
|
|
534
538
|
};
|
|
535
539
|
}, [showFormulaHint]);
|
|
540
|
+
useLayoutEffect(function () {
|
|
541
|
+
var _a;
|
|
542
|
+
var lc = context.linkCard;
|
|
543
|
+
var isSameCell = ((_a = context.luckysheetCellUpdate) === null || _a === void 0 ? void 0 : _a.length) === 2 && lc && context.luckysheetCellUpdate[0] === lc.r && context.luckysheetCellUpdate[1] === lc.c;
|
|
544
|
+
if (!(lc === null || lc === void 0 ? void 0 : lc.applyToSelection) || !(lc === null || lc === void 0 ? void 0 : lc.selectionOffsets) || !isSameCell || !inputRef.current || !inputBoxInnerRef.current) {
|
|
545
|
+
setLinkSelectionHighlightRects([]);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
var _b = lc.selectionOffsets,
|
|
549
|
+
start = _b.start,
|
|
550
|
+
end = _b.end;
|
|
551
|
+
var rects = getRangeRectsByCharacterOffset(inputRef.current, start, end);
|
|
552
|
+
var containerRect = inputBoxInnerRef.current.getBoundingClientRect();
|
|
553
|
+
var relative = rects.map(function (r) {
|
|
554
|
+
return {
|
|
555
|
+
left: r.left - containerRect.left,
|
|
556
|
+
top: r.top - containerRect.top,
|
|
557
|
+
width: r.width,
|
|
558
|
+
height: r.height
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
setLinkSelectionHighlightRects(relative);
|
|
562
|
+
}, [(_g = context.linkCard) === null || _g === void 0 ? void 0 : _g.applyToSelection, (_h = context.linkCard) === null || _h === void 0 ? void 0 : _h.selectionOffsets, (_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.r, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.c, context.luckysheetCellUpdate]);
|
|
536
563
|
var wraperGetCell = function wraperGetCell() {
|
|
537
564
|
var cell = getCellAddress();
|
|
538
565
|
placeRef.current = cell;
|
|
@@ -569,15 +596,19 @@ var InputBox = function InputBox() {
|
|
|
569
596
|
onMouseUp: function onMouseUp(e) {
|
|
570
597
|
return e.stopPropagation();
|
|
571
598
|
}
|
|
572
|
-
}, firstSelection && !((
|
|
599
|
+
}, firstSelection && !((_l = context.rangeDialog) === null || _l === void 0 ? void 0 : _l.show) && (/*#__PURE__*/React.createElement("div", {
|
|
573
600
|
className: "luckysheet-cell-address-indicator",
|
|
574
601
|
style: getAddressIndicatorPosition()
|
|
575
602
|
}, wraperGetCell())), /*#__PURE__*/React.createElement("div", {
|
|
603
|
+
ref: inputBoxInnerRef,
|
|
576
604
|
className: "luckysheet-input-box-inner",
|
|
577
605
|
style: firstSelection ? __assign({
|
|
606
|
+
position: "relative",
|
|
578
607
|
minWidth: firstSelection.width,
|
|
579
608
|
minHeight: firstSelection.height
|
|
580
|
-
}, inputBoxStyle) : {
|
|
609
|
+
}, inputBoxStyle) : {
|
|
610
|
+
position: "relative"
|
|
611
|
+
}
|
|
581
612
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
582
613
|
onCompositionStart: function onCompositionStart() {
|
|
583
614
|
isComposingRef.current = true;
|
|
@@ -618,7 +649,30 @@ var InputBox = function InputBox() {
|
|
|
618
649
|
onKeyDown: onKeyDown,
|
|
619
650
|
onPaste: onPaste,
|
|
620
651
|
allowEdit: edit ? !isHidenRC : edit
|
|
621
|
-
})
|
|
652
|
+
}), linkSelectionHighlightRects.length > 0 && (/*#__PURE__*/React.createElement("div", {
|
|
653
|
+
className: "luckysheet-input-box-link-selection-highlight",
|
|
654
|
+
"aria-hidden": true,
|
|
655
|
+
style: {
|
|
656
|
+
position: "absolute",
|
|
657
|
+
left: 0,
|
|
658
|
+
top: 0,
|
|
659
|
+
right: 0,
|
|
660
|
+
bottom: 0,
|
|
661
|
+
pointerEvents: "none"
|
|
662
|
+
}
|
|
663
|
+
}, linkSelectionHighlightRects.map(function (r, i) {
|
|
664
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
665
|
+
key: i,
|
|
666
|
+
style: {
|
|
667
|
+
position: "absolute",
|
|
668
|
+
left: r.left,
|
|
669
|
+
top: r.top,
|
|
670
|
+
width: r.width,
|
|
671
|
+
height: r.height,
|
|
672
|
+
backgroundColor: "rgba(0, 123, 255, 0.25)"
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
})))), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0 || fn) && (/*#__PURE__*/React.createElement(React.Fragment, null, showSearchHint && (/*#__PURE__*/React.createElement(FormulaSearch, {
|
|
622
676
|
onMouseMove: function onMouseMove(e) {
|
|
623
677
|
if (document.getElementById("luckysheet-formula-search-c")) {
|
|
624
678
|
var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
|
|
@@ -340,6 +340,29 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
|
|
|
340
340
|
});
|
|
341
341
|
_sheet.dataVerification = newDataVerification_1;
|
|
342
342
|
}
|
|
343
|
+
if (_sheet.hyperlink) {
|
|
344
|
+
var newHyperlink_1 = {};
|
|
345
|
+
Object.keys(_sheet.hyperlink).forEach(function (key) {
|
|
346
|
+
var _a;
|
|
347
|
+
var itemData = (_a = _sheet.hyperlink) === null || _a === void 0 ? void 0 : _a[key];
|
|
348
|
+
if (!itemData) return;
|
|
349
|
+
var parts = key.split("_");
|
|
350
|
+
if (parts.length !== 2) return;
|
|
351
|
+
var row = parts[0];
|
|
352
|
+
var presentCol = parseInt(parts[1], 10);
|
|
353
|
+
var updatedCol = presentCol;
|
|
354
|
+
if (selectedSourceCol.includes(presentCol)) {
|
|
355
|
+
var index = selectedSourceCol.indexOf(presentCol);
|
|
356
|
+
updatedCol = selectedTargetCol[index];
|
|
357
|
+
} else if (presentCol > sourceIndex_1 && presentCol < targetIndex) {
|
|
358
|
+
updatedCol -= selectedSourceCol.length;
|
|
359
|
+
} else if (presentCol < sourceIndex_1 && presentCol >= targetIndex) {
|
|
360
|
+
updatedCol += selectedSourceCol.length;
|
|
361
|
+
}
|
|
362
|
+
newHyperlink_1["".concat(row, "_").concat(updatedCol)] = itemData;
|
|
363
|
+
});
|
|
364
|
+
_sheet.hyperlink = newHyperlink_1;
|
|
365
|
+
}
|
|
343
366
|
(_f = _sheet.calcChain) === null || _f === void 0 ? void 0 : _f.forEach(function (item) {
|
|
344
367
|
if (selectedSourceCol.includes(item.c)) {
|
|
345
368
|
var index = selectedSourceCol.indexOf(item.c);
|
|
@@ -330,6 +330,29 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
330
330
|
});
|
|
331
331
|
_sheet.dataVerification = newDataVerification_1;
|
|
332
332
|
}
|
|
333
|
+
if (_sheet.hyperlink) {
|
|
334
|
+
var newHyperlink_1 = {};
|
|
335
|
+
Object.keys(_sheet.hyperlink).forEach(function (key) {
|
|
336
|
+
var _a;
|
|
337
|
+
var itemData = (_a = _sheet.hyperlink) === null || _a === void 0 ? void 0 : _a[key];
|
|
338
|
+
if (!itemData) return;
|
|
339
|
+
var parts = key.split("_");
|
|
340
|
+
if (parts.length !== 2) return;
|
|
341
|
+
var presentRow = parseInt(parts[0], 10);
|
|
342
|
+
var col = parts[1];
|
|
343
|
+
var updatedRow = presentRow;
|
|
344
|
+
if (selectedSourceRow.includes(presentRow)) {
|
|
345
|
+
var index = selectedSourceRow.indexOf(presentRow);
|
|
346
|
+
updatedRow = selectedTargetRow[index];
|
|
347
|
+
} else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
|
|
348
|
+
updatedRow -= selectedSourceRow.length;
|
|
349
|
+
} else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
|
|
350
|
+
updatedRow += selectedSourceRow.length;
|
|
351
|
+
}
|
|
352
|
+
newHyperlink_1["".concat(updatedRow, "_").concat(col)] = itemData;
|
|
353
|
+
});
|
|
354
|
+
_sheet.hyperlink = newHyperlink_1;
|
|
355
|
+
}
|
|
333
356
|
(_d = _sheet.calcChain) === null || _d === void 0 ? void 0 : _d.forEach(function (item) {
|
|
334
357
|
if (selectedSourceRow.includes(item.r)) {
|
|
335
358
|
var index = selectedSourceRow.indexOf(item.c);
|
|
@@ -643,6 +643,12 @@ var Toolbar = function Toolbar(_a) {
|
|
|
643
643
|
window.dataVerificationClick = dataVerificationClick;
|
|
644
644
|
window.conditionalFormatClick = conditionalFormatClick;
|
|
645
645
|
}, []);
|
|
646
|
+
useEffect(function () {
|
|
647
|
+
if (cell != null) {
|
|
648
|
+
refs.globalCache.recentTextColor = normalizedCellAttr(cell, "fc");
|
|
649
|
+
refs.globalCache.recentBackgroundColor = normalizedCellAttr(cell, "bg");
|
|
650
|
+
}
|
|
651
|
+
}, [cell, refs.globalCache]);
|
|
646
652
|
var getToolbarItem = useCallback(function (name, i) {
|
|
647
653
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
648
654
|
var tooltip = toolbar[name];
|
|
@@ -652,6 +658,8 @@ var Toolbar = function Toolbar(_a) {
|
|
|
652
658
|
});
|
|
653
659
|
}
|
|
654
660
|
if (["font-color", "background"].includes(name)) {
|
|
661
|
+
var displayTextColor_1 = cell != null ? normalizedCellAttr(cell, "fc") : "#000000";
|
|
662
|
+
var displayBackgroundColor_1 = cell != null ? normalizedCellAttr(cell, "bg") : undefined;
|
|
655
663
|
var pick_1 = function pick_1(color) {
|
|
656
664
|
setContext(function (draftCtx) {
|
|
657
665
|
return (name === "font-color" ? handleTextColor : handleTextBackground)(draftCtx, refs.cellInput.current, color);
|
|
@@ -671,7 +679,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
671
679
|
style: {
|
|
672
680
|
width: 24,
|
|
673
681
|
height: 4,
|
|
674
|
-
backgroundColor: name === "font-color" ?
|
|
682
|
+
backgroundColor: name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1,
|
|
675
683
|
position: "absolute",
|
|
676
684
|
bottom: 2,
|
|
677
685
|
left: 3,
|
|
@@ -681,9 +689,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
681
689
|
iconId: name,
|
|
682
690
|
tooltip: tooltip,
|
|
683
691
|
showArrow: false,
|
|
684
|
-
fillColor: name === "font-color" ?
|
|
692
|
+
fillColor: name === "font-color" ? displayTextColor_1 : undefined,
|
|
685
693
|
onClick: function onClick() {
|
|
686
|
-
var color = name === "font-color" ?
|
|
694
|
+
var color = name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1;
|
|
687
695
|
if (color) pick_1(color);
|
|
688
696
|
}
|
|
689
697
|
}, function (setOpen) {
|
|
@@ -73,6 +73,20 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
73
73
|
draftCtx.linkCard = undefined;
|
|
74
74
|
});
|
|
75
75
|
}, [refs.globalCache, setContext]);
|
|
76
|
+
var handleInsertLink = (0, _react.useCallback)(function () {
|
|
77
|
+
if (isButtonDisabled) return;
|
|
78
|
+
_lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
79
|
+
setContext(function (draftCtx) {
|
|
80
|
+
(0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
81
|
+
applyToSelection: applyToSelection || undefined,
|
|
82
|
+
cellInput: refs.cellInput.current
|
|
83
|
+
});
|
|
84
|
+
if (!applyToSelection) {
|
|
85
|
+
draftCtx.luckysheetCellUpdate = [];
|
|
86
|
+
(0, _fortuneCore.jfrefreshgrid)(draftCtx, null, undefined);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}, [isButtonDisabled, refs.globalCache, refs.cellInput, setContext, r, c, linkText, linkType, linkAddress, applyToSelection]);
|
|
76
90
|
var containerEvent = (0, _react.useMemo)(function () {
|
|
77
91
|
return {
|
|
78
92
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -92,26 +106,16 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
92
106
|
},
|
|
93
107
|
onKeyDown: function onKeyDown(e) {
|
|
94
108
|
e.stopPropagation();
|
|
95
|
-
if (isButtonDisabled) return;
|
|
96
109
|
if (e.key === "Enter") {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
(0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
100
|
-
applyToSelection: applyToSelection || undefined,
|
|
101
|
-
cellInput: refs.cellInput.current
|
|
102
|
-
});
|
|
103
|
-
if (!applyToSelection) {
|
|
104
|
-
draftCtx.luckysheetCellUpdate = [];
|
|
105
|
-
(0, _fortuneCore.jfrefreshgrid)(draftCtx, null, undefined);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
handleInsertLink();
|
|
108
112
|
}
|
|
109
113
|
},
|
|
110
114
|
onDoubleClick: function onDoubleClick(e) {
|
|
111
115
|
return e.stopPropagation();
|
|
112
116
|
}
|
|
113
117
|
};
|
|
114
|
-
}, [
|
|
118
|
+
}, [handleInsertLink]);
|
|
115
119
|
var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
|
|
116
120
|
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
117
121
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -256,6 +260,13 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
256
260
|
onChange: function onChange(e) {
|
|
257
261
|
return setLinkText(e.target.value);
|
|
258
262
|
},
|
|
263
|
+
onKeyDown: function onKeyDown(e) {
|
|
264
|
+
if (e.key === "Enter") {
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
e.stopPropagation();
|
|
267
|
+
handleInsertLink();
|
|
268
|
+
}
|
|
269
|
+
},
|
|
259
270
|
className: "fortune-link-input"
|
|
260
271
|
})), linkType === "webpage" && (/*#__PURE__*/_react.default.createElement("div", {
|
|
261
272
|
className: "fortune-input-with-icon"
|
|
@@ -269,6 +280,13 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
269
280
|
ref: linkAddressRef,
|
|
270
281
|
placeholder: "Paste URL",
|
|
271
282
|
value: linkAddress,
|
|
283
|
+
onKeyDown: function onKeyDown(e) {
|
|
284
|
+
if (e.key === "Enter") {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
e.stopPropagation();
|
|
287
|
+
handleInsertLink();
|
|
288
|
+
}
|
|
289
|
+
},
|
|
272
290
|
onChange: function onChange(e) {
|
|
273
291
|
return setLinkAddress(e.target.value);
|
|
274
292
|
},
|
|
@@ -301,20 +319,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
301
319
|
}))))), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
302
320
|
className: "fortune-link-card__cta fortune-insert-button",
|
|
303
321
|
disabled: isButtonDisabled,
|
|
304
|
-
onClick:
|
|
305
|
-
if (isButtonDisabled) return;
|
|
306
|
-
_lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
307
|
-
setContext(function (draftCtx) {
|
|
308
|
-
(0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
309
|
-
applyToSelection: applyToSelection || undefined,
|
|
310
|
-
cellInput: refs.cellInput.current
|
|
311
|
-
});
|
|
312
|
-
if (!applyToSelection) {
|
|
313
|
-
draftCtx.luckysheetCellUpdate = [];
|
|
314
|
-
(0, _fortuneCore.jfrefreshgrid)(draftCtx, null, undefined);
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
},
|
|
322
|
+
onClick: handleInsertLink,
|
|
318
323
|
"data-testid": "link-card-cta-insert"
|
|
319
324
|
}, "Insert link"));
|
|
320
325
|
};
|
|
@@ -17,7 +17,7 @@ var _usePrevious = _interopRequireDefault(require("../../hooks/usePrevious"));
|
|
|
17
17
|
var _helper = require("./helper");
|
|
18
18
|
var _LucideIcon = require("./LucideIcon");
|
|
19
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
-
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
|
|
20
|
+
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
21
21
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
22
22
|
__assign = Object.assign || function (t) {
|
|
23
23
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -29,53 +29,57 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
29
29
|
return __assign.apply(this, arguments);
|
|
30
30
|
};
|
|
31
31
|
var InputBox = function InputBox() {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
33
|
-
var
|
|
34
|
-
context =
|
|
35
|
-
setContext =
|
|
36
|
-
refs =
|
|
32
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
33
|
+
var _m = (0, _react.useContext)(_context.default),
|
|
34
|
+
context = _m.context,
|
|
35
|
+
setContext = _m.setContext,
|
|
36
|
+
refs = _m.refs;
|
|
37
37
|
var inputRef = (0, _react.useRef)(null);
|
|
38
38
|
var lastKeyDownEventRef = (0, _react.useRef)(null);
|
|
39
39
|
var prevCellUpdate = (0, _usePrevious.default)(context.luckysheetCellUpdate);
|
|
40
40
|
var prevSheetId = (0, _usePrevious.default)(context.currentSheetId);
|
|
41
|
-
var
|
|
42
|
-
isHidenRC =
|
|
43
|
-
setIsHidenRC =
|
|
44
|
-
var
|
|
45
|
-
isInputBoxActive =
|
|
46
|
-
setIsInputBoxActive =
|
|
47
|
-
var
|
|
48
|
-
activeCell =
|
|
49
|
-
setActiveCell =
|
|
50
|
-
var
|
|
51
|
-
activeRefCell =
|
|
52
|
-
setActiveRefCell =
|
|
53
|
-
var
|
|
41
|
+
var _o = (0, _react.useState)(false),
|
|
42
|
+
isHidenRC = _o[0],
|
|
43
|
+
setIsHidenRC = _o[1];
|
|
44
|
+
var _p = (0, _react.useState)(false),
|
|
45
|
+
isInputBoxActive = _p[0],
|
|
46
|
+
setIsInputBoxActive = _p[1];
|
|
47
|
+
var _q = (0, _react.useState)(""),
|
|
48
|
+
activeCell = _q[0],
|
|
49
|
+
setActiveCell = _q[1];
|
|
50
|
+
var _r = (0, _react.useState)(""),
|
|
51
|
+
activeRefCell = _r[0],
|
|
52
|
+
setActiveRefCell = _r[1];
|
|
53
|
+
var _s = (0, _react.useState)({
|
|
54
54
|
left: 0,
|
|
55
55
|
top: 0
|
|
56
56
|
}),
|
|
57
|
-
frozenPosition =
|
|
58
|
-
setFrozenPosition =
|
|
57
|
+
frozenPosition = _s[0],
|
|
58
|
+
setFrozenPosition = _s[1];
|
|
59
59
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
60
|
-
var
|
|
61
|
-
firstSelectionActiveCell =
|
|
62
|
-
setFirstSelectionActiveCell =
|
|
63
|
-
var
|
|
64
|
-
commaCount =
|
|
65
|
-
setCommaCount =
|
|
60
|
+
var _t = (0, _react.useState)({}),
|
|
61
|
+
firstSelectionActiveCell = _t[0],
|
|
62
|
+
setFirstSelectionActiveCell = _t[1];
|
|
63
|
+
var _u = (0, _react.useState)(0),
|
|
64
|
+
commaCount = _u[0],
|
|
65
|
+
setCommaCount = _u[1];
|
|
66
66
|
var hideFormulaHintLocal = localStorage.getItem("formulaMore") === "true";
|
|
67
|
-
var
|
|
68
|
-
showFormulaHint =
|
|
69
|
-
setShowFormulaHint =
|
|
70
|
-
var
|
|
71
|
-
showSearchHint =
|
|
72
|
-
setShowSearchHint =
|
|
67
|
+
var _v = (0, _react.useState)(!hideFormulaHintLocal),
|
|
68
|
+
showFormulaHint = _v[0],
|
|
69
|
+
setShowFormulaHint = _v[1];
|
|
70
|
+
var _w = (0, _react.useState)(false),
|
|
71
|
+
showSearchHint = _w[0],
|
|
72
|
+
setShowSearchHint = _w[1];
|
|
73
73
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
74
74
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
75
75
|
var preText = (0, _react.useRef)("");
|
|
76
76
|
var placeRef = (0, _react.useRef)("");
|
|
77
77
|
var isComposingRef = (0, _react.useRef)(false);
|
|
78
78
|
var ZWSP = "\u200B";
|
|
79
|
+
var inputBoxInnerRef = (0, _react.useRef)(null);
|
|
80
|
+
var _x = (0, _react.useState)([]),
|
|
81
|
+
linkSelectionHighlightRects = _x[0],
|
|
82
|
+
setLinkSelectionHighlightRects = _x[1];
|
|
79
83
|
var ensureNotEmpty = function ensureNotEmpty() {
|
|
80
84
|
var el = inputRef.current;
|
|
81
85
|
if (!el) return;
|
|
@@ -542,6 +546,29 @@ var InputBox = function InputBox() {
|
|
|
542
546
|
window.removeEventListener("keydown", handleKeyDown);
|
|
543
547
|
};
|
|
544
548
|
}, [showFormulaHint]);
|
|
549
|
+
(0, _react.useLayoutEffect)(function () {
|
|
550
|
+
var _a;
|
|
551
|
+
var lc = context.linkCard;
|
|
552
|
+
var isSameCell = ((_a = context.luckysheetCellUpdate) === null || _a === void 0 ? void 0 : _a.length) === 2 && lc && context.luckysheetCellUpdate[0] === lc.r && context.luckysheetCellUpdate[1] === lc.c;
|
|
553
|
+
if (!(lc === null || lc === void 0 ? void 0 : lc.applyToSelection) || !(lc === null || lc === void 0 ? void 0 : lc.selectionOffsets) || !isSameCell || !inputRef.current || !inputBoxInnerRef.current) {
|
|
554
|
+
setLinkSelectionHighlightRects([]);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
var _b = lc.selectionOffsets,
|
|
558
|
+
start = _b.start,
|
|
559
|
+
end = _b.end;
|
|
560
|
+
var rects = (0, _fortuneCore.getRangeRectsByCharacterOffset)(inputRef.current, start, end);
|
|
561
|
+
var containerRect = inputBoxInnerRef.current.getBoundingClientRect();
|
|
562
|
+
var relative = rects.map(function (r) {
|
|
563
|
+
return {
|
|
564
|
+
left: r.left - containerRect.left,
|
|
565
|
+
top: r.top - containerRect.top,
|
|
566
|
+
width: r.width,
|
|
567
|
+
height: r.height
|
|
568
|
+
};
|
|
569
|
+
});
|
|
570
|
+
setLinkSelectionHighlightRects(relative);
|
|
571
|
+
}, [(_g = context.linkCard) === null || _g === void 0 ? void 0 : _g.applyToSelection, (_h = context.linkCard) === null || _h === void 0 ? void 0 : _h.selectionOffsets, (_j = context.linkCard) === null || _j === void 0 ? void 0 : _j.r, (_k = context.linkCard) === null || _k === void 0 ? void 0 : _k.c, context.luckysheetCellUpdate]);
|
|
545
572
|
var wraperGetCell = function wraperGetCell() {
|
|
546
573
|
var cell = getCellAddress();
|
|
547
574
|
placeRef.current = cell;
|
|
@@ -578,15 +605,19 @@ var InputBox = function InputBox() {
|
|
|
578
605
|
onMouseUp: function onMouseUp(e) {
|
|
579
606
|
return e.stopPropagation();
|
|
580
607
|
}
|
|
581
|
-
}, firstSelection && !((
|
|
608
|
+
}, firstSelection && !((_l = context.rangeDialog) === null || _l === void 0 ? void 0 : _l.show) && (/*#__PURE__*/_react.default.createElement("div", {
|
|
582
609
|
className: "luckysheet-cell-address-indicator",
|
|
583
610
|
style: getAddressIndicatorPosition()
|
|
584
611
|
}, wraperGetCell())), /*#__PURE__*/_react.default.createElement("div", {
|
|
612
|
+
ref: inputBoxInnerRef,
|
|
585
613
|
className: "luckysheet-input-box-inner",
|
|
586
614
|
style: firstSelection ? __assign({
|
|
615
|
+
position: "relative",
|
|
587
616
|
minWidth: firstSelection.width,
|
|
588
617
|
minHeight: firstSelection.height
|
|
589
|
-
}, inputBoxStyle) : {
|
|
618
|
+
}, inputBoxStyle) : {
|
|
619
|
+
position: "relative"
|
|
620
|
+
}
|
|
590
621
|
}, /*#__PURE__*/_react.default.createElement(_ContentEditable.default, {
|
|
591
622
|
onCompositionStart: function onCompositionStart() {
|
|
592
623
|
isComposingRef.current = true;
|
|
@@ -627,7 +658,30 @@ var InputBox = function InputBox() {
|
|
|
627
658
|
onKeyDown: onKeyDown,
|
|
628
659
|
onPaste: onPaste,
|
|
629
660
|
allowEdit: edit ? !isHidenRC : edit
|
|
630
|
-
})
|
|
661
|
+
}), linkSelectionHighlightRects.length > 0 && (/*#__PURE__*/_react.default.createElement("div", {
|
|
662
|
+
className: "luckysheet-input-box-link-selection-highlight",
|
|
663
|
+
"aria-hidden": true,
|
|
664
|
+
style: {
|
|
665
|
+
position: "absolute",
|
|
666
|
+
left: 0,
|
|
667
|
+
top: 0,
|
|
668
|
+
right: 0,
|
|
669
|
+
bottom: 0,
|
|
670
|
+
pointerEvents: "none"
|
|
671
|
+
}
|
|
672
|
+
}, linkSelectionHighlightRects.map(function (r, i) {
|
|
673
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
674
|
+
key: i,
|
|
675
|
+
style: {
|
|
676
|
+
position: "absolute",
|
|
677
|
+
left: r.left,
|
|
678
|
+
top: r.top,
|
|
679
|
+
width: r.width,
|
|
680
|
+
height: r.height,
|
|
681
|
+
backgroundColor: "rgba(0, 123, 255, 0.25)"
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
})))), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0 || fn) && (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showSearchHint && (/*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
|
|
631
685
|
onMouseMove: function onMouseMove(e) {
|
|
632
686
|
if (document.getElementById("luckysheet-formula-search-c")) {
|
|
633
687
|
var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
|
|
@@ -348,6 +348,29 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
|
|
|
348
348
|
});
|
|
349
349
|
_sheet.dataVerification = newDataVerification_1;
|
|
350
350
|
}
|
|
351
|
+
if (_sheet.hyperlink) {
|
|
352
|
+
var newHyperlink_1 = {};
|
|
353
|
+
Object.keys(_sheet.hyperlink).forEach(function (key) {
|
|
354
|
+
var _a;
|
|
355
|
+
var itemData = (_a = _sheet.hyperlink) === null || _a === void 0 ? void 0 : _a[key];
|
|
356
|
+
if (!itemData) return;
|
|
357
|
+
var parts = key.split("_");
|
|
358
|
+
if (parts.length !== 2) return;
|
|
359
|
+
var row = parts[0];
|
|
360
|
+
var presentCol = parseInt(parts[1], 10);
|
|
361
|
+
var updatedCol = presentCol;
|
|
362
|
+
if (selectedSourceCol.includes(presentCol)) {
|
|
363
|
+
var index = selectedSourceCol.indexOf(presentCol);
|
|
364
|
+
updatedCol = selectedTargetCol[index];
|
|
365
|
+
} else if (presentCol > sourceIndex_1 && presentCol < targetIndex) {
|
|
366
|
+
updatedCol -= selectedSourceCol.length;
|
|
367
|
+
} else if (presentCol < sourceIndex_1 && presentCol >= targetIndex) {
|
|
368
|
+
updatedCol += selectedSourceCol.length;
|
|
369
|
+
}
|
|
370
|
+
newHyperlink_1["".concat(row, "_").concat(updatedCol)] = itemData;
|
|
371
|
+
});
|
|
372
|
+
_sheet.hyperlink = newHyperlink_1;
|
|
373
|
+
}
|
|
351
374
|
(_f = _sheet.calcChain) === null || _f === void 0 ? void 0 : _f.forEach(function (item) {
|
|
352
375
|
if (selectedSourceCol.includes(item.c)) {
|
|
353
376
|
var index = selectedSourceCol.indexOf(item.c);
|
|
@@ -337,6 +337,29 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
|
|
|
337
337
|
});
|
|
338
338
|
_sheet.dataVerification = newDataVerification_1;
|
|
339
339
|
}
|
|
340
|
+
if (_sheet.hyperlink) {
|
|
341
|
+
var newHyperlink_1 = {};
|
|
342
|
+
Object.keys(_sheet.hyperlink).forEach(function (key) {
|
|
343
|
+
var _a;
|
|
344
|
+
var itemData = (_a = _sheet.hyperlink) === null || _a === void 0 ? void 0 : _a[key];
|
|
345
|
+
if (!itemData) return;
|
|
346
|
+
var parts = key.split("_");
|
|
347
|
+
if (parts.length !== 2) return;
|
|
348
|
+
var presentRow = parseInt(parts[0], 10);
|
|
349
|
+
var col = parts[1];
|
|
350
|
+
var updatedRow = presentRow;
|
|
351
|
+
if (selectedSourceRow.includes(presentRow)) {
|
|
352
|
+
var index = selectedSourceRow.indexOf(presentRow);
|
|
353
|
+
updatedRow = selectedTargetRow[index];
|
|
354
|
+
} else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
|
|
355
|
+
updatedRow -= selectedSourceRow.length;
|
|
356
|
+
} else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
|
|
357
|
+
updatedRow += selectedSourceRow.length;
|
|
358
|
+
}
|
|
359
|
+
newHyperlink_1["".concat(updatedRow, "_").concat(col)] = itemData;
|
|
360
|
+
});
|
|
361
|
+
_sheet.hyperlink = newHyperlink_1;
|
|
362
|
+
}
|
|
340
363
|
(_d = _sheet.calcChain) === null || _d === void 0 ? void 0 : _d.forEach(function (item) {
|
|
341
364
|
if (selectedSourceRow.includes(item.r)) {
|
|
342
365
|
var index = selectedSourceRow.indexOf(item.c);
|
|
@@ -652,6 +652,12 @@ var Toolbar = function Toolbar(_a) {
|
|
|
652
652
|
window.dataVerificationClick = dataVerificationClick;
|
|
653
653
|
window.conditionalFormatClick = conditionalFormatClick;
|
|
654
654
|
}, []);
|
|
655
|
+
(0, _react.useEffect)(function () {
|
|
656
|
+
if (cell != null) {
|
|
657
|
+
refs.globalCache.recentTextColor = (0, _fortuneCore.normalizedCellAttr)(cell, "fc");
|
|
658
|
+
refs.globalCache.recentBackgroundColor = (0, _fortuneCore.normalizedCellAttr)(cell, "bg");
|
|
659
|
+
}
|
|
660
|
+
}, [cell, refs.globalCache]);
|
|
655
661
|
var getToolbarItem = (0, _react.useCallback)(function (name, i) {
|
|
656
662
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
657
663
|
var tooltip = toolbar[name];
|
|
@@ -661,6 +667,8 @@ var Toolbar = function Toolbar(_a) {
|
|
|
661
667
|
});
|
|
662
668
|
}
|
|
663
669
|
if (["font-color", "background"].includes(name)) {
|
|
670
|
+
var displayTextColor_1 = cell != null ? (0, _fortuneCore.normalizedCellAttr)(cell, "fc") : "#000000";
|
|
671
|
+
var displayBackgroundColor_1 = cell != null ? (0, _fortuneCore.normalizedCellAttr)(cell, "bg") : undefined;
|
|
664
672
|
var pick_1 = function pick_1(color) {
|
|
665
673
|
setContext(function (draftCtx) {
|
|
666
674
|
return (name === "font-color" ? _fortuneCore.handleTextColor : _fortuneCore.handleTextBackground)(draftCtx, refs.cellInput.current, color);
|
|
@@ -680,7 +688,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
680
688
|
style: {
|
|
681
689
|
width: 24,
|
|
682
690
|
height: 4,
|
|
683
|
-
backgroundColor: name === "font-color" ?
|
|
691
|
+
backgroundColor: name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1,
|
|
684
692
|
position: "absolute",
|
|
685
693
|
bottom: 2,
|
|
686
694
|
left: 3,
|
|
@@ -690,9 +698,9 @@ var Toolbar = function Toolbar(_a) {
|
|
|
690
698
|
iconId: name,
|
|
691
699
|
tooltip: tooltip,
|
|
692
700
|
showArrow: false,
|
|
693
|
-
fillColor: name === "font-color" ?
|
|
701
|
+
fillColor: name === "font-color" ? displayTextColor_1 : undefined,
|
|
694
702
|
onClick: function onClick() {
|
|
695
|
-
var color = name === "font-color" ?
|
|
703
|
+
var color = name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1;
|
|
696
704
|
if (color) pick_1(color);
|
|
697
705
|
}
|
|
698
706
|
}, function (setOpen) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.3.5-hyper",
|
|
3
|
+
"version": "1.3.5-hyper-2",
|
|
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.3.5-hyper",
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.3.5-hyper-2",
|
|
20
20
|
"@fileverse/ui": "5.0.0",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|