@fileverse-dev/fortune-react 1.2.24 → 1.2.26
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/FxEditor/index.js +23 -17
- package/es/components/NotationBoxes/index.js +17 -12
- package/es/components/SheetOverlay/FormulaHint/index.js +2 -2
- package/es/components/SheetOverlay/FormulaSearch/index.js +3 -3
- package/es/components/SheetOverlay/InputBox.js +19 -14
- package/es/components/Toolbar/index.js +1 -1
- package/lib/components/FxEditor/index.js +23 -17
- package/lib/components/NotationBoxes/index.js +17 -12
- package/lib/components/SheetOverlay/FormulaHint/index.js +2 -2
- package/lib/components/SheetOverlay/FormulaSearch/index.js +3 -3
- package/lib/components/SheetOverlay/InputBox.js +19 -14
- package/lib/components/Toolbar/index.js +1 -1
- package/package.json +2 -2
|
@@ -144,23 +144,35 @@ var FxEditor = function FxEditor() {
|
|
|
144
144
|
var lastSpan = spans[spans.length - 1];
|
|
145
145
|
return lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText;
|
|
146
146
|
};
|
|
147
|
-
var
|
|
148
|
-
var _a, _b, _c, _d
|
|
149
|
-
if (context.isFlvReadOnly) return;
|
|
147
|
+
var handleHideShowHint = function handleHideShowHint() {
|
|
148
|
+
var _a, _b, _c, _d;
|
|
150
149
|
var el = (_a = document.getElementsByClassName("cell-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
151
150
|
var fxHint = (_b = document.getElementsByClassName("fx-hint")) === null || _b === void 0 ? void 0 : _b[0];
|
|
151
|
+
var searchElFx = (_c = document.getElementsByClassName("fx-search")) === null || _c === void 0 ? void 0 : _c[0];
|
|
152
|
+
var searchElCell = (_d = document.getElementsByClassName("cell-search")) === null || _d === void 0 ? void 0 : _d[0];
|
|
153
|
+
if (searchElFx) {
|
|
154
|
+
searchElFx.style.display = "block";
|
|
155
|
+
}
|
|
156
|
+
if (searchElCell) {
|
|
157
|
+
searchElCell.style.display = "none";
|
|
158
|
+
}
|
|
152
159
|
if (el) {
|
|
153
160
|
el.style.display = "none";
|
|
154
161
|
}
|
|
155
162
|
if (fxHint) {
|
|
156
163
|
fxHint.style.display = "block";
|
|
157
164
|
}
|
|
158
|
-
|
|
165
|
+
};
|
|
166
|
+
var onChange = useCallback(function () {
|
|
167
|
+
var _a, _b, _c;
|
|
168
|
+
if (context.isFlvReadOnly) return;
|
|
169
|
+
handleHideShowHint();
|
|
170
|
+
if (((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerText.includes("=")) && /^=?[A-Za-z]*$/.test(getLastInputSpanText())) {
|
|
159
171
|
setShowSearchHint(true);
|
|
160
172
|
} else {
|
|
161
173
|
setShowSearchHint(false);
|
|
162
174
|
}
|
|
163
|
-
var currentCommaCount = countCommasBeforeCursor((
|
|
175
|
+
var currentCommaCount = countCommasBeforeCursor((_c = refs.fxInput) === null || _c === void 0 ? void 0 : _c.current);
|
|
164
176
|
setCommaCount(currentCommaCount);
|
|
165
177
|
var e = lastKeyDownEventRef.current;
|
|
166
178
|
if (!e) return;
|
|
@@ -202,16 +214,9 @@ var FxEditor = function FxEditor() {
|
|
|
202
214
|
className: "fortune-fx-input-container"
|
|
203
215
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
204
216
|
onMouseUp: function onMouseUp() {
|
|
205
|
-
var _a
|
|
206
|
-
|
|
207
|
-
var
|
|
208
|
-
if (el) {
|
|
209
|
-
el.style.display = "none";
|
|
210
|
-
}
|
|
211
|
-
if (fxHint) {
|
|
212
|
-
fxHint.style.display = "block";
|
|
213
|
-
}
|
|
214
|
-
var currentCommaCount = countCommasBeforeCursor((_c = refs.fxInput) === null || _c === void 0 ? void 0 : _c.current);
|
|
217
|
+
var _a;
|
|
218
|
+
handleHideShowHint();
|
|
219
|
+
var currentCommaCount = countCommasBeforeCursor((_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current);
|
|
215
220
|
setCommaCount(currentCommaCount);
|
|
216
221
|
},
|
|
217
222
|
innerRef: function innerRef(e) {
|
|
@@ -225,7 +230,8 @@ var FxEditor = function FxEditor() {
|
|
|
225
230
|
onChange: onChange,
|
|
226
231
|
tabIndex: 0,
|
|
227
232
|
allowEdit: allowEdit && !context.isFlvReadOnly
|
|
228
|
-
}), showSearchHint && /*#__PURE__*/React.createElement(FormulaSearch, {
|
|
233
|
+
}), showSearchHint && (/*#__PURE__*/React.createElement(FormulaSearch, {
|
|
234
|
+
from: "fx",
|
|
229
235
|
onMouseMove: function onMouseMove(e) {
|
|
230
236
|
if (document.getElementById("luckysheet-formula-search-c")) {
|
|
231
237
|
var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
|
|
@@ -234,7 +240,7 @@ var FxEditor = function FxEditor() {
|
|
|
234
240
|
}
|
|
235
241
|
e.preventDefault();
|
|
236
242
|
}
|
|
237
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
238
244
|
className: "fx-hint"
|
|
239
245
|
}, context.functionHint && ((_c = (_b = refs.fxInput) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.innerText.includes("(")) && (/*#__PURE__*/React.createElement(FormulaHint, {
|
|
240
246
|
handleShowFormulaHint: handleShowFormulaHint,
|
|
@@ -31,6 +31,22 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}, [flowdata, setContext]);
|
|
34
|
+
var handleMouseDownEvent = function handleMouseDownEvent(r, c, rc, commentId) {
|
|
35
|
+
return function (e) {
|
|
36
|
+
var nativeEvent = e.nativeEvent;
|
|
37
|
+
setContext(function (draftContext) {
|
|
38
|
+
if (flowdata) {
|
|
39
|
+
setEditingComment(draftContext, flowdata, r, c);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
onCommentBoxMoveStart(context, refs.globalCache, nativeEvent, {
|
|
43
|
+
r: r,
|
|
44
|
+
c: c,
|
|
45
|
+
rc: rc
|
|
46
|
+
}, commentId);
|
|
47
|
+
e.stopPropagation();
|
|
48
|
+
};
|
|
49
|
+
};
|
|
34
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
51
|
id: "luckysheet-postil-showBoxs"
|
|
36
52
|
}, _.concat((_a = context.commentBoxes) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
|
|
@@ -71,17 +87,6 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
71
87
|
boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
|
|
72
88
|
},
|
|
73
89
|
onMouseDown: function onMouseDown(e) {
|
|
74
|
-
var nativeEvent = e.nativeEvent;
|
|
75
|
-
setContext(function (draftContext) {
|
|
76
|
-
if (flowdata) {
|
|
77
|
-
setEditingComment(draftContext, flowdata, r, c);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
onCommentBoxMoveStart(context, refs.globalCache, nativeEvent, {
|
|
81
|
-
r: r,
|
|
82
|
-
c: c,
|
|
83
|
-
rc: rc
|
|
84
|
-
}, commentId);
|
|
85
90
|
e.stopPropagation();
|
|
86
91
|
}
|
|
87
92
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -90,7 +95,7 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
90
95
|
height: "100%",
|
|
91
96
|
overflow: "hidden"
|
|
92
97
|
}
|
|
93
|
-
}, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c))));
|
|
98
|
+
}, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c, handleMouseDownEvent(r, c, rc, commentId)))));
|
|
94
99
|
}));
|
|
95
100
|
};
|
|
96
101
|
export default NotationBoxes;
|
|
@@ -65,8 +65,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
65
65
|
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
66
66
|
var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
67
67
|
var topV = hintAbove ? selectionHeight - (divOffset + 30) : selectionHeight + 4;
|
|
68
|
-
var el = (_e = document.getElementsByClassName(
|
|
69
|
-
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !==
|
|
68
|
+
var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
|
|
69
|
+
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
|
|
70
70
|
topV = 25;
|
|
71
71
|
}
|
|
72
72
|
setTop(topV);
|
|
@@ -46,8 +46,8 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
46
46
|
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
47
47
|
var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
48
48
|
var topV = hintAbove ? selectionHeight - (divOffset + 80) : selectionHeight + 4;
|
|
49
|
-
var el = (_e = document.getElementsByClassName(
|
|
50
|
-
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !==
|
|
49
|
+
var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
|
|
50
|
+
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
|
|
51
51
|
topV = 25;
|
|
52
52
|
}
|
|
53
53
|
setTop(topV);
|
|
@@ -57,7 +57,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
57
57
|
});
|
|
58
58
|
if (_.isEmpty(context.functionCandidates) && _.isEmpty(context.defaultCandidates)) return null;
|
|
59
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: "flex color-border-default border flex-col luckysheet-formula-search-c-p custom-scroll",
|
|
60
|
+
className: "flex color-border-default border flex-col luckysheet-formula-search-c-p custom-scroll ".concat((props === null || props === void 0 ? void 0 : props.from) === "fx" ? "fx-search" : "cell-search"),
|
|
61
61
|
id: "luckysheet-formula-search-c-p",
|
|
62
62
|
style: {
|
|
63
63
|
top: top
|
|
@@ -342,17 +342,30 @@ var InputBox = function InputBox() {
|
|
|
342
342
|
e.preventDefault();
|
|
343
343
|
}
|
|
344
344
|
}, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
|
|
345
|
-
var
|
|
346
|
-
var _a, _b, _c;
|
|
347
|
-
var
|
|
348
|
-
var
|
|
345
|
+
var handleHideShowHint = function handleHideShowHint() {
|
|
346
|
+
var _a, _b, _c, _d;
|
|
347
|
+
var searchElFx = (_a = document.getElementsByClassName("fx-search")) === null || _a === void 0 ? void 0 : _a[0];
|
|
348
|
+
var searchElCell = (_b = document.getElementsByClassName("cell-search")) === null || _b === void 0 ? void 0 : _b[0];
|
|
349
|
+
if (searchElFx) {
|
|
350
|
+
searchElFx.style.display = "none";
|
|
351
|
+
}
|
|
352
|
+
if (searchElCell) {
|
|
353
|
+
searchElCell.style.display = "block";
|
|
354
|
+
}
|
|
355
|
+
var el = (_c = document.getElementsByClassName("fx-hint")) === null || _c === void 0 ? void 0 : _c[0];
|
|
356
|
+
var elCell = (_d = document.getElementsByClassName("cell-hint")) === null || _d === void 0 ? void 0 : _d[0];
|
|
349
357
|
if (el) {
|
|
350
358
|
el.style.display = "none";
|
|
351
359
|
}
|
|
352
360
|
if (elCell) {
|
|
353
361
|
elCell.style.display = "block";
|
|
354
362
|
}
|
|
355
|
-
|
|
363
|
+
};
|
|
364
|
+
var onChange = useCallback(function (__, isBlur) {
|
|
365
|
+
var _a;
|
|
366
|
+
if (context.isFlvReadOnly) return;
|
|
367
|
+
handleHideShowHint();
|
|
368
|
+
if (((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText.includes("=")) && /^=?[A-Za-z]*$/.test(getLastInputSpanText())) {
|
|
356
369
|
setShowSearchHint(true);
|
|
357
370
|
} else {
|
|
358
371
|
setShowSearchHint(false);
|
|
@@ -503,15 +516,7 @@ var InputBox = function InputBox() {
|
|
|
503
516
|
}, inputBoxStyle) : {}
|
|
504
517
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
505
518
|
onMouseUp: function onMouseUp() {
|
|
506
|
-
|
|
507
|
-
var el = (_a = document.getElementsByClassName("fx-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
508
|
-
var elCell = (_b = document.getElementsByClassName("cell-hint")) === null || _b === void 0 ? void 0 : _b[0];
|
|
509
|
-
if (el) {
|
|
510
|
-
el.style.display = "none";
|
|
511
|
-
}
|
|
512
|
-
if (elCell) {
|
|
513
|
-
elCell.style.display = "block";
|
|
514
|
-
}
|
|
519
|
+
handleHideShowHint();
|
|
515
520
|
var currentCommaCount = countCommasBeforeCursor(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
516
521
|
setCommaCount(currentCommaCount);
|
|
517
522
|
},
|
|
@@ -1508,7 +1508,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1508
1508
|
setContext(function (ctx) {
|
|
1509
1509
|
var d = getFlowdata(ctx);
|
|
1510
1510
|
if (d == null) return;
|
|
1511
|
-
updateFormat(ctx, refs.cellInput.current, d, "tb", value);
|
|
1511
|
+
updateFormat(ctx, refs.cellInput.current, d, "tb", value, refs.canvas.current.getContext("2d"));
|
|
1512
1512
|
});
|
|
1513
1513
|
setOpen(false);
|
|
1514
1514
|
},
|
|
@@ -153,23 +153,35 @@ var FxEditor = function FxEditor() {
|
|
|
153
153
|
var lastSpan = spans[spans.length - 1];
|
|
154
154
|
return lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText;
|
|
155
155
|
};
|
|
156
|
-
var
|
|
157
|
-
var _a, _b, _c, _d
|
|
158
|
-
if (context.isFlvReadOnly) return;
|
|
156
|
+
var handleHideShowHint = function handleHideShowHint() {
|
|
157
|
+
var _a, _b, _c, _d;
|
|
159
158
|
var el = (_a = document.getElementsByClassName("cell-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
160
159
|
var fxHint = (_b = document.getElementsByClassName("fx-hint")) === null || _b === void 0 ? void 0 : _b[0];
|
|
160
|
+
var searchElFx = (_c = document.getElementsByClassName("fx-search")) === null || _c === void 0 ? void 0 : _c[0];
|
|
161
|
+
var searchElCell = (_d = document.getElementsByClassName("cell-search")) === null || _d === void 0 ? void 0 : _d[0];
|
|
162
|
+
if (searchElFx) {
|
|
163
|
+
searchElFx.style.display = "block";
|
|
164
|
+
}
|
|
165
|
+
if (searchElCell) {
|
|
166
|
+
searchElCell.style.display = "none";
|
|
167
|
+
}
|
|
161
168
|
if (el) {
|
|
162
169
|
el.style.display = "none";
|
|
163
170
|
}
|
|
164
171
|
if (fxHint) {
|
|
165
172
|
fxHint.style.display = "block";
|
|
166
173
|
}
|
|
167
|
-
|
|
174
|
+
};
|
|
175
|
+
var onChange = (0, _react.useCallback)(function () {
|
|
176
|
+
var _a, _b, _c;
|
|
177
|
+
if (context.isFlvReadOnly) return;
|
|
178
|
+
handleHideShowHint();
|
|
179
|
+
if (((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerText.includes("=")) && /^=?[A-Za-z]*$/.test(getLastInputSpanText())) {
|
|
168
180
|
setShowSearchHint(true);
|
|
169
181
|
} else {
|
|
170
182
|
setShowSearchHint(false);
|
|
171
183
|
}
|
|
172
|
-
var currentCommaCount = (0, _helper.countCommasBeforeCursor)((
|
|
184
|
+
var currentCommaCount = (0, _helper.countCommasBeforeCursor)((_c = refs.fxInput) === null || _c === void 0 ? void 0 : _c.current);
|
|
173
185
|
setCommaCount(currentCommaCount);
|
|
174
186
|
var e = lastKeyDownEventRef.current;
|
|
175
187
|
if (!e) return;
|
|
@@ -211,16 +223,9 @@ var FxEditor = function FxEditor() {
|
|
|
211
223
|
className: "fortune-fx-input-container"
|
|
212
224
|
}, /*#__PURE__*/_react.default.createElement(_ContentEditable.default, {
|
|
213
225
|
onMouseUp: function onMouseUp() {
|
|
214
|
-
var _a
|
|
215
|
-
|
|
216
|
-
var
|
|
217
|
-
if (el) {
|
|
218
|
-
el.style.display = "none";
|
|
219
|
-
}
|
|
220
|
-
if (fxHint) {
|
|
221
|
-
fxHint.style.display = "block";
|
|
222
|
-
}
|
|
223
|
-
var currentCommaCount = (0, _helper.countCommasBeforeCursor)((_c = refs.fxInput) === null || _c === void 0 ? void 0 : _c.current);
|
|
226
|
+
var _a;
|
|
227
|
+
handleHideShowHint();
|
|
228
|
+
var currentCommaCount = (0, _helper.countCommasBeforeCursor)((_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current);
|
|
224
229
|
setCommaCount(currentCommaCount);
|
|
225
230
|
},
|
|
226
231
|
innerRef: function innerRef(e) {
|
|
@@ -234,7 +239,8 @@ var FxEditor = function FxEditor() {
|
|
|
234
239
|
onChange: onChange,
|
|
235
240
|
tabIndex: 0,
|
|
236
241
|
allowEdit: allowEdit && !context.isFlvReadOnly
|
|
237
|
-
}), showSearchHint && /*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
|
|
242
|
+
}), showSearchHint && (/*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
|
|
243
|
+
from: "fx",
|
|
238
244
|
onMouseMove: function onMouseMove(e) {
|
|
239
245
|
if (document.getElementById("luckysheet-formula-search-c")) {
|
|
240
246
|
var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
|
|
@@ -243,7 +249,7 @@ var FxEditor = function FxEditor() {
|
|
|
243
249
|
}
|
|
244
250
|
e.preventDefault();
|
|
245
251
|
}
|
|
246
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
252
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
247
253
|
className: "fx-hint"
|
|
248
254
|
}, context.functionHint && ((_c = (_b = refs.fxInput) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.innerText.includes("(")) && (/*#__PURE__*/_react.default.createElement(_FormulaHint.default, {
|
|
249
255
|
handleShowFormulaHint: handleShowFormulaHint,
|
|
@@ -40,6 +40,22 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}, [flowdata, setContext]);
|
|
43
|
+
var handleMouseDownEvent = function handleMouseDownEvent(r, c, rc, commentId) {
|
|
44
|
+
return function (e) {
|
|
45
|
+
var nativeEvent = e.nativeEvent;
|
|
46
|
+
setContext(function (draftContext) {
|
|
47
|
+
if (flowdata) {
|
|
48
|
+
(0, _fortuneCore.setEditingComment)(draftContext, flowdata, r, c);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
(0, _fortuneCore.onCommentBoxMoveStart)(context, refs.globalCache, nativeEvent, {
|
|
52
|
+
r: r,
|
|
53
|
+
c: c,
|
|
54
|
+
rc: rc
|
|
55
|
+
}, commentId);
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
};
|
|
58
|
+
};
|
|
43
59
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
60
|
id: "luckysheet-postil-showBoxs"
|
|
45
61
|
}, _lodash.default.concat((_a = context.commentBoxes) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
|
|
@@ -80,17 +96,6 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
80
96
|
boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
|
|
81
97
|
},
|
|
82
98
|
onMouseDown: function onMouseDown(e) {
|
|
83
|
-
var nativeEvent = e.nativeEvent;
|
|
84
|
-
setContext(function (draftContext) {
|
|
85
|
-
if (flowdata) {
|
|
86
|
-
(0, _fortuneCore.setEditingComment)(draftContext, flowdata, r, c);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
(0, _fortuneCore.onCommentBoxMoveStart)(context, refs.globalCache, nativeEvent, {
|
|
90
|
-
r: r,
|
|
91
|
-
c: c,
|
|
92
|
-
rc: rc
|
|
93
|
-
}, commentId);
|
|
94
99
|
e.stopPropagation();
|
|
95
100
|
}
|
|
96
101
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -99,7 +104,7 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
99
104
|
height: "100%",
|
|
100
105
|
overflow: "hidden"
|
|
101
106
|
}
|
|
102
|
-
}, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c))));
|
|
107
|
+
}, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c, handleMouseDownEvent(r, c, rc, commentId)))));
|
|
103
108
|
}));
|
|
104
109
|
};
|
|
105
110
|
var _default = exports.default = NotationBoxes;
|
|
@@ -74,8 +74,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
74
74
|
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
75
75
|
var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
76
76
|
var topV = hintAbove ? selectionHeight - (divOffset + 30) : selectionHeight + 4;
|
|
77
|
-
var el = (_e = document.getElementsByClassName(
|
|
78
|
-
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !==
|
|
77
|
+
var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
|
|
78
|
+
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
|
|
79
79
|
topV = 25;
|
|
80
80
|
}
|
|
81
81
|
setTop(topV);
|
|
@@ -55,8 +55,8 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
55
55
|
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
56
56
|
var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
57
57
|
var topV = hintAbove ? selectionHeight - (divOffset + 80) : selectionHeight + 4;
|
|
58
|
-
var el = (_e = document.getElementsByClassName(
|
|
59
|
-
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !==
|
|
58
|
+
var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
|
|
59
|
+
if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
|
|
60
60
|
topV = 25;
|
|
61
61
|
}
|
|
62
62
|
setTop(topV);
|
|
@@ -66,7 +66,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
66
66
|
});
|
|
67
67
|
if (_lodash.default.isEmpty(context.functionCandidates) && _lodash.default.isEmpty(context.defaultCandidates)) return null;
|
|
68
68
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
-
className: "flex color-border-default border flex-col luckysheet-formula-search-c-p custom-scroll",
|
|
69
|
+
className: "flex color-border-default border flex-col luckysheet-formula-search-c-p custom-scroll ".concat((props === null || props === void 0 ? void 0 : props.from) === "fx" ? "fx-search" : "cell-search"),
|
|
70
70
|
id: "luckysheet-formula-search-c-p",
|
|
71
71
|
style: {
|
|
72
72
|
top: top
|
|
@@ -351,17 +351,30 @@ var InputBox = function InputBox() {
|
|
|
351
351
|
e.preventDefault();
|
|
352
352
|
}
|
|
353
353
|
}, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
|
|
354
|
-
var
|
|
355
|
-
var _a, _b, _c;
|
|
356
|
-
var
|
|
357
|
-
var
|
|
354
|
+
var handleHideShowHint = function handleHideShowHint() {
|
|
355
|
+
var _a, _b, _c, _d;
|
|
356
|
+
var searchElFx = (_a = document.getElementsByClassName("fx-search")) === null || _a === void 0 ? void 0 : _a[0];
|
|
357
|
+
var searchElCell = (_b = document.getElementsByClassName("cell-search")) === null || _b === void 0 ? void 0 : _b[0];
|
|
358
|
+
if (searchElFx) {
|
|
359
|
+
searchElFx.style.display = "none";
|
|
360
|
+
}
|
|
361
|
+
if (searchElCell) {
|
|
362
|
+
searchElCell.style.display = "block";
|
|
363
|
+
}
|
|
364
|
+
var el = (_c = document.getElementsByClassName("fx-hint")) === null || _c === void 0 ? void 0 : _c[0];
|
|
365
|
+
var elCell = (_d = document.getElementsByClassName("cell-hint")) === null || _d === void 0 ? void 0 : _d[0];
|
|
358
366
|
if (el) {
|
|
359
367
|
el.style.display = "none";
|
|
360
368
|
}
|
|
361
369
|
if (elCell) {
|
|
362
370
|
elCell.style.display = "block";
|
|
363
371
|
}
|
|
364
|
-
|
|
372
|
+
};
|
|
373
|
+
var onChange = (0, _react.useCallback)(function (__, isBlur) {
|
|
374
|
+
var _a;
|
|
375
|
+
if (context.isFlvReadOnly) return;
|
|
376
|
+
handleHideShowHint();
|
|
377
|
+
if (((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerText.includes("=")) && /^=?[A-Za-z]*$/.test(getLastInputSpanText())) {
|
|
365
378
|
setShowSearchHint(true);
|
|
366
379
|
} else {
|
|
367
380
|
setShowSearchHint(false);
|
|
@@ -512,15 +525,7 @@ var InputBox = function InputBox() {
|
|
|
512
525
|
}, inputBoxStyle) : {}
|
|
513
526
|
}, /*#__PURE__*/_react.default.createElement(_ContentEditable.default, {
|
|
514
527
|
onMouseUp: function onMouseUp() {
|
|
515
|
-
|
|
516
|
-
var el = (_a = document.getElementsByClassName("fx-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
517
|
-
var elCell = (_b = document.getElementsByClassName("cell-hint")) === null || _b === void 0 ? void 0 : _b[0];
|
|
518
|
-
if (el) {
|
|
519
|
-
el.style.display = "none";
|
|
520
|
-
}
|
|
521
|
-
if (elCell) {
|
|
522
|
-
elCell.style.display = "block";
|
|
523
|
-
}
|
|
528
|
+
handleHideShowHint();
|
|
524
529
|
var currentCommaCount = (0, _helper.countCommasBeforeCursor)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
525
530
|
setCommaCount(currentCommaCount);
|
|
526
531
|
},
|
|
@@ -1517,7 +1517,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1517
1517
|
setContext(function (ctx) {
|
|
1518
1518
|
var d = (0, _fortuneCore.getFlowdata)(ctx);
|
|
1519
1519
|
if (d == null) return;
|
|
1520
|
-
(0, _fortuneCore.updateFormat)(ctx, refs.cellInput.current, d, "tb", value);
|
|
1520
|
+
(0, _fortuneCore.updateFormat)(ctx, refs.cellInput.current, d, "tb", value, refs.canvas.current.getContext("2d"));
|
|
1521
1521
|
});
|
|
1522
1522
|
setOpen(false);
|
|
1523
1523
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.26",
|
|
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.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.26",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|