@fileverse-dev/fortune-react 1.2.25 → 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 +21 -15
- package/es/components/SheetOverlay/FormulaSearch/index.js +1 -1
- package/es/components/SheetOverlay/InputBox.js +19 -14
- package/lib/components/FxEditor/index.js +21 -15
- package/lib/components/SheetOverlay/FormulaSearch/index.js +1 -1
- package/lib/components/SheetOverlay/InputBox.js +19 -14
- 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) {
|
|
@@ -226,6 +231,7 @@ var FxEditor = function FxEditor() {
|
|
|
226
231
|
tabIndex: 0,
|
|
227
232
|
allowEdit: allowEdit && !context.isFlvReadOnly
|
|
228
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");
|
|
@@ -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
|
},
|
|
@@ -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) {
|
|
@@ -235,6 +240,7 @@ var FxEditor = function FxEditor() {
|
|
|
235
240
|
tabIndex: 0,
|
|
236
241
|
allowEdit: allowEdit && !context.isFlvReadOnly
|
|
237
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");
|
|
@@ -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
|
},
|
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",
|