@fileverse-dev/fortune-react 1.2.27 → 1.2.28
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 +26 -27
- package/es/components/Toolbar/Button.d.ts +1 -0
- package/es/components/Toolbar/Button.js +3 -1
- package/es/components/Toolbar/index.js +2 -0
- package/lib/components/FxEditor/index.js +26 -27
- package/lib/components/Toolbar/Button.d.ts +1 -0
- package/lib/components/Toolbar/Button.js +3 -1
- package/lib/components/Toolbar/index.js +2 -0
- package/package.json +2 -2
|
@@ -98,9 +98,34 @@ var FxEditor = function FxEditor() {
|
|
|
98
98
|
draftCtx.defaultCandidates = [];
|
|
99
99
|
draftCtx.functionHint = formulaName;
|
|
100
100
|
});
|
|
101
|
-
return;
|
|
102
101
|
}
|
|
103
102
|
}, [setContext]);
|
|
103
|
+
var clearSearchItemActiveClass = useCallback(function () {
|
|
104
|
+
var activeFormula = getActiveFormula();
|
|
105
|
+
if (activeFormula) {
|
|
106
|
+
activeFormula.classList.remove("luckysheet-formula-search-item-active");
|
|
107
|
+
}
|
|
108
|
+
}, [getActiveFormula]);
|
|
109
|
+
var getLastInputSpanText = function getLastInputSpanText() {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
var parser = new DOMParser();
|
|
112
|
+
var doc = parser.parseFromString("<div>".concat((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerHTML, "</div>"), "text/html");
|
|
113
|
+
var spans = doc.querySelectorAll("span");
|
|
114
|
+
var lastSpan = spans[spans.length - 1];
|
|
115
|
+
return lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText;
|
|
116
|
+
};
|
|
117
|
+
var selectActiveFormulaOnClick = useCallback(function (e) {
|
|
118
|
+
var _a, _b, _c;
|
|
119
|
+
if (e.target.className.includes("sign-fortune")) return;
|
|
120
|
+
recentText.current = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current.innerText;
|
|
121
|
+
var formulaName = (_c = (_b = getActiveFormula()) === null || _b === void 0 ? void 0 : _b.querySelector(".luckysheet-formula-search-func")) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
122
|
+
var lastSpanText = getLastInputSpanText();
|
|
123
|
+
if (formulaName && !isLetterNumberPattern(lastSpanText)) {
|
|
124
|
+
insertSelectedFormula(formulaName);
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
}
|
|
128
|
+
}, [getActiveFormula, insertSelectedFormula]);
|
|
104
129
|
var onKeyDown = useCallback(function (e) {
|
|
105
130
|
var _a;
|
|
106
131
|
if (context.allowEdit === false) {
|
|
@@ -204,14 +229,6 @@ var FxEditor = function FxEditor() {
|
|
|
204
229
|
}
|
|
205
230
|
});
|
|
206
231
|
}, [context.allowEdit, context.luckysheetCellUpdate.length, refs.fxInput, setContext]);
|
|
207
|
-
var getLastInputSpanText = function getLastInputSpanText() {
|
|
208
|
-
var _a, _b;
|
|
209
|
-
var parser = new DOMParser();
|
|
210
|
-
var doc = parser.parseFromString("<div>".concat((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerHTML, "</div>"), "text/html");
|
|
211
|
-
var spans = doc.querySelectorAll("span");
|
|
212
|
-
var lastSpan = spans[spans.length - 1];
|
|
213
|
-
return lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText;
|
|
214
|
-
};
|
|
215
232
|
var handleHideShowHint = function handleHideShowHint() {
|
|
216
233
|
var _a, _b, _c, _d;
|
|
217
234
|
var el = (_a = document.getElementsByClassName("cell-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -264,24 +281,6 @@ var FxEditor = function FxEditor() {
|
|
|
264
281
|
}
|
|
265
282
|
return true;
|
|
266
283
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
267
|
-
var selectActiveFormulaOnClick = useCallback(function (e) {
|
|
268
|
-
var _a, _b, _c;
|
|
269
|
-
if (e.target.className.includes("sign-fortune")) return;
|
|
270
|
-
recentText.current = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current.innerText;
|
|
271
|
-
var formulaName = (_c = (_b = getActiveFormula()) === null || _b === void 0 ? void 0 : _b.querySelector(".luckysheet-formula-search-func")) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
272
|
-
var lastSpanText = getLastInputSpanText();
|
|
273
|
-
if (formulaName && !isLetterNumberPattern(lastSpanText)) {
|
|
274
|
-
insertSelectedFormula(formulaName);
|
|
275
|
-
e.preventDefault();
|
|
276
|
-
e.stopPropagation();
|
|
277
|
-
}
|
|
278
|
-
}, [getActiveFormula, insertSelectedFormula]);
|
|
279
|
-
var clearSearchItemActiveClass = useCallback(function () {
|
|
280
|
-
var activeFormula = getActiveFormula();
|
|
281
|
-
if (activeFormula) {
|
|
282
|
-
activeFormula.classList.remove("luckysheet-formula-search-item-active");
|
|
283
|
-
}
|
|
284
|
-
}, [getActiveFormula]);
|
|
285
284
|
return /*#__PURE__*/React.createElement("div", {
|
|
286
285
|
className: "fortune-fx-editor"
|
|
287
286
|
}, /*#__PURE__*/React.createElement(NameBox, null), /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,11 +8,13 @@ var Button = function Button(_a) {
|
|
|
8
8
|
disabled = _a.disabled,
|
|
9
9
|
selected = _a.selected,
|
|
10
10
|
children = _a.children,
|
|
11
|
-
style = _a.style
|
|
11
|
+
style = _a.style,
|
|
12
|
+
id = _a.id;
|
|
12
13
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
13
14
|
text: tooltip,
|
|
14
15
|
placement: "bottom"
|
|
15
16
|
}, /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
id: id,
|
|
16
18
|
className: "fortune-toolbar-button fortune-toolbar-item",
|
|
17
19
|
onClick: onClick,
|
|
18
20
|
tabIndex: 0,
|
|
@@ -973,6 +973,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
973
973
|
}
|
|
974
974
|
if (name === "splitColumn") {
|
|
975
975
|
return /*#__PURE__*/React.createElement(Button, {
|
|
976
|
+
id: "splitColumn",
|
|
976
977
|
iconId: name,
|
|
977
978
|
tooltip: tooltip,
|
|
978
979
|
key: name,
|
|
@@ -997,6 +998,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
997
998
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataVerificationPortal, {
|
|
998
999
|
visible: showDataValidation
|
|
999
1000
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
1001
|
+
id: "dataVerification",
|
|
1000
1002
|
iconId: name,
|
|
1001
1003
|
tooltip: tooltip,
|
|
1002
1004
|
key: name,
|
|
@@ -107,9 +107,34 @@ var FxEditor = function FxEditor() {
|
|
|
107
107
|
draftCtx.defaultCandidates = [];
|
|
108
108
|
draftCtx.functionHint = formulaName;
|
|
109
109
|
});
|
|
110
|
-
return;
|
|
111
110
|
}
|
|
112
111
|
}, [setContext]);
|
|
112
|
+
var clearSearchItemActiveClass = (0, _react.useCallback)(function () {
|
|
113
|
+
var activeFormula = getActiveFormula();
|
|
114
|
+
if (activeFormula) {
|
|
115
|
+
activeFormula.classList.remove("luckysheet-formula-search-item-active");
|
|
116
|
+
}
|
|
117
|
+
}, [getActiveFormula]);
|
|
118
|
+
var getLastInputSpanText = function getLastInputSpanText() {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
var parser = new DOMParser();
|
|
121
|
+
var doc = parser.parseFromString("<div>".concat((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerHTML, "</div>"), "text/html");
|
|
122
|
+
var spans = doc.querySelectorAll("span");
|
|
123
|
+
var lastSpan = spans[spans.length - 1];
|
|
124
|
+
return lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText;
|
|
125
|
+
};
|
|
126
|
+
var selectActiveFormulaOnClick = (0, _react.useCallback)(function (e) {
|
|
127
|
+
var _a, _b, _c;
|
|
128
|
+
if (e.target.className.includes("sign-fortune")) return;
|
|
129
|
+
recentText.current = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current.innerText;
|
|
130
|
+
var formulaName = (_c = (_b = getActiveFormula()) === null || _b === void 0 ? void 0 : _b.querySelector(".luckysheet-formula-search-func")) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
131
|
+
var lastSpanText = getLastInputSpanText();
|
|
132
|
+
if (formulaName && !(0, _helper.isLetterNumberPattern)(lastSpanText)) {
|
|
133
|
+
insertSelectedFormula(formulaName);
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
}
|
|
137
|
+
}, [getActiveFormula, insertSelectedFormula]);
|
|
113
138
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
114
139
|
var _a;
|
|
115
140
|
if (context.allowEdit === false) {
|
|
@@ -213,14 +238,6 @@ var FxEditor = function FxEditor() {
|
|
|
213
238
|
}
|
|
214
239
|
});
|
|
215
240
|
}, [context.allowEdit, context.luckysheetCellUpdate.length, refs.fxInput, setContext]);
|
|
216
|
-
var getLastInputSpanText = function getLastInputSpanText() {
|
|
217
|
-
var _a, _b;
|
|
218
|
-
var parser = new DOMParser();
|
|
219
|
-
var doc = parser.parseFromString("<div>".concat((_b = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerHTML, "</div>"), "text/html");
|
|
220
|
-
var spans = doc.querySelectorAll("span");
|
|
221
|
-
var lastSpan = spans[spans.length - 1];
|
|
222
|
-
return lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText;
|
|
223
|
-
};
|
|
224
241
|
var handleHideShowHint = function handleHideShowHint() {
|
|
225
242
|
var _a, _b, _c, _d;
|
|
226
243
|
var el = (_a = document.getElementsByClassName("cell-hint")) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -273,24 +290,6 @@ var FxEditor = function FxEditor() {
|
|
|
273
290
|
}
|
|
274
291
|
return true;
|
|
275
292
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
276
|
-
var selectActiveFormulaOnClick = (0, _react.useCallback)(function (e) {
|
|
277
|
-
var _a, _b, _c;
|
|
278
|
-
if (e.target.className.includes("sign-fortune")) return;
|
|
279
|
-
recentText.current = (_a = refs.fxInput) === null || _a === void 0 ? void 0 : _a.current.innerText;
|
|
280
|
-
var formulaName = (_c = (_b = getActiveFormula()) === null || _b === void 0 ? void 0 : _b.querySelector(".luckysheet-formula-search-func")) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
281
|
-
var lastSpanText = getLastInputSpanText();
|
|
282
|
-
if (formulaName && !(0, _helper.isLetterNumberPattern)(lastSpanText)) {
|
|
283
|
-
insertSelectedFormula(formulaName);
|
|
284
|
-
e.preventDefault();
|
|
285
|
-
e.stopPropagation();
|
|
286
|
-
}
|
|
287
|
-
}, [getActiveFormula, insertSelectedFormula]);
|
|
288
|
-
var clearSearchItemActiveClass = (0, _react.useCallback)(function () {
|
|
289
|
-
var activeFormula = getActiveFormula();
|
|
290
|
-
if (activeFormula) {
|
|
291
|
-
activeFormula.classList.remove("luckysheet-formula-search-item-active");
|
|
292
|
-
}
|
|
293
|
-
}, [getActiveFormula]);
|
|
294
293
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
295
294
|
className: "fortune-fx-editor"
|
|
296
295
|
}, /*#__PURE__*/_react.default.createElement(_NameBox.default, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -15,11 +15,13 @@ var Button = function Button(_a) {
|
|
|
15
15
|
disabled = _a.disabled,
|
|
16
16
|
selected = _a.selected,
|
|
17
17
|
children = _a.children,
|
|
18
|
-
style = _a.style
|
|
18
|
+
style = _a.style,
|
|
19
|
+
id = _a.id;
|
|
19
20
|
return /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
|
|
20
21
|
text: tooltip,
|
|
21
22
|
placement: "bottom"
|
|
22
23
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
+
id: id,
|
|
23
25
|
className: "fortune-toolbar-button fortune-toolbar-item",
|
|
24
26
|
onClick: onClick,
|
|
25
27
|
tabIndex: 0,
|
|
@@ -982,6 +982,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
982
982
|
}
|
|
983
983
|
if (name === "splitColumn") {
|
|
984
984
|
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
985
|
+
id: "splitColumn",
|
|
985
986
|
iconId: name,
|
|
986
987
|
tooltip: tooltip,
|
|
987
988
|
key: name,
|
|
@@ -1006,6 +1007,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1006
1007
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_dataVerificationPortal.default, {
|
|
1007
1008
|
visible: showDataValidation
|
|
1008
1009
|
}), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
1010
|
+
id: "dataVerification",
|
|
1009
1011
|
iconId: name,
|
|
1010
1012
|
tooltip: tooltip,
|
|
1011
1013
|
key: name,
|
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.28",
|
|
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.28",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|