@leankylin-sheet/react 3.1.44 → 3.1.46
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/dist/components/SheetOverlay/FormulaSearch/utils.d.ts +3 -0
- package/dist/index.css +3 -1
- package/dist/index.esm.css +3 -1
- package/dist/index.esm.js +331 -20
- package/dist/index.js +331 -20
- package/dist/index.umd.css +3 -1
- package/dist/index.umd.js +331 -20
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -169,6 +169,57 @@ function _nonIterableSpread() {
|
|
|
169
169
|
function _nonIterableRest() {
|
|
170
170
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
171
171
|
}
|
|
172
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
173
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
174
|
+
if (!it) {
|
|
175
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
176
|
+
if (it) o = it;
|
|
177
|
+
var i = 0;
|
|
178
|
+
var F = function () {};
|
|
179
|
+
return {
|
|
180
|
+
s: F,
|
|
181
|
+
n: function () {
|
|
182
|
+
if (i >= o.length) return {
|
|
183
|
+
done: true
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
done: false,
|
|
187
|
+
value: o[i++]
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
e: function (e) {
|
|
191
|
+
throw e;
|
|
192
|
+
},
|
|
193
|
+
f: F
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
197
|
+
}
|
|
198
|
+
var normalCompletion = true,
|
|
199
|
+
didErr = false,
|
|
200
|
+
err;
|
|
201
|
+
return {
|
|
202
|
+
s: function () {
|
|
203
|
+
it = it.call(o);
|
|
204
|
+
},
|
|
205
|
+
n: function () {
|
|
206
|
+
var step = it.next();
|
|
207
|
+
normalCompletion = step.done;
|
|
208
|
+
return step;
|
|
209
|
+
},
|
|
210
|
+
e: function (e) {
|
|
211
|
+
didErr = true;
|
|
212
|
+
err = e;
|
|
213
|
+
},
|
|
214
|
+
f: function () {
|
|
215
|
+
try {
|
|
216
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
217
|
+
} finally {
|
|
218
|
+
if (didErr) throw err;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
172
223
|
|
|
173
224
|
var defaultRefs = {
|
|
174
225
|
globalCache: {
|
|
@@ -698,39 +749,295 @@ var ContentEditable = function ContentEditable(_ref) {
|
|
|
698
749
|
}));
|
|
699
750
|
};
|
|
700
751
|
|
|
752
|
+
function getLastTextNode(element) {
|
|
753
|
+
var lastText = null;
|
|
754
|
+
function traverse(node) {
|
|
755
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
756
|
+
lastText = node;
|
|
757
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
758
|
+
for (var i = node.childNodes.length - 1; i >= 0; i -= 1) {
|
|
759
|
+
traverse(node.childNodes[i]);
|
|
760
|
+
if (lastText) break;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
traverse(element);
|
|
765
|
+
return lastText;
|
|
766
|
+
}
|
|
767
|
+
function getPlainTextCursorOffset(editableDiv) {
|
|
768
|
+
var selection = window.getSelection();
|
|
769
|
+
if (!selection || selection.rangeCount === 0) return -1;
|
|
770
|
+
var range = selection.getRangeAt(0);
|
|
771
|
+
if (!editableDiv.contains(range.commonAncestorContainer)) {
|
|
772
|
+
return -1;
|
|
773
|
+
}
|
|
774
|
+
var textNodes = [];
|
|
775
|
+
function collectTextNodes(node) {
|
|
776
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
777
|
+
textNodes.push(node);
|
|
778
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
779
|
+
for (var i = 0; i < node.childNodes.length; i += 1) {
|
|
780
|
+
collectTextNodes(node.childNodes[i]);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
collectTextNodes(editableDiv);
|
|
785
|
+
var cursorTextNode = null;
|
|
786
|
+
var offsetInNode = 0;
|
|
787
|
+
var startContainer = range.startContainer;
|
|
788
|
+
var startOffset = range.startOffset;
|
|
789
|
+
if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
790
|
+
cursorTextNode = startContainer;
|
|
791
|
+
offsetInNode = startOffset;
|
|
792
|
+
} else if (startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
793
|
+
var childNodes = startContainer.childNodes;
|
|
794
|
+
var prevTextNode = null;
|
|
795
|
+
for (var i = 0; i < startOffset; i += 1) {
|
|
796
|
+
var child = childNodes[i];
|
|
797
|
+
if (child.nodeType === Node.TEXT_NODE) {
|
|
798
|
+
prevTextNode = child;
|
|
799
|
+
} else if (child.nodeType === Node.ELEMENT_NODE) {
|
|
800
|
+
var lastText = getLastTextNode(child);
|
|
801
|
+
if (lastText) prevTextNode = lastText;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if (prevTextNode) {
|
|
805
|
+
var _prevTextNode$textCon;
|
|
806
|
+
cursorTextNode = prevTextNode;
|
|
807
|
+
offsetInNode = ((_prevTextNode$textCon = prevTextNode.textContent) === null || _prevTextNode$textCon === void 0 ? void 0 : _prevTextNode$textCon.length) || 0;
|
|
808
|
+
} else {
|
|
809
|
+
return 0;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
var totalOffset = 0;
|
|
813
|
+
for (var _i = 0, _textNodes = textNodes; _i < _textNodes.length; _i++) {
|
|
814
|
+
var node = _textNodes[_i];
|
|
815
|
+
if (node === cursorTextNode) {
|
|
816
|
+
totalOffset += offsetInNode;
|
|
817
|
+
break;
|
|
818
|
+
} else {
|
|
819
|
+
var _node$textContent;
|
|
820
|
+
totalOffset += ((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.length) || 0;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return totalOffset;
|
|
824
|
+
}
|
|
825
|
+
function getrangeseleciton() {
|
|
826
|
+
var _anchorNode$parentNod, _anchorNode$parentNod2, _anchorNode$parentEle, _anchorNode$parentEle2;
|
|
827
|
+
var currSelection = window.getSelection();
|
|
828
|
+
if (!currSelection) return null;
|
|
829
|
+
var anchorNode = currSelection.anchorNode,
|
|
830
|
+
anchorOffset = currSelection.anchorOffset;
|
|
831
|
+
if (!anchorNode) return null;
|
|
832
|
+
if (((_anchorNode$parentNod = anchorNode.parentNode) === null || _anchorNode$parentNod === void 0 ? void 0 : (_anchorNode$parentNod2 = _anchorNode$parentNod.nodeName) === null || _anchorNode$parentNod2 === void 0 ? void 0 : _anchorNode$parentNod2.toLowerCase()) === "span" && anchorOffset !== 0) {
|
|
833
|
+
var txt = ___default['default'].trim(anchorNode.textContent || "");
|
|
834
|
+
if (txt.length === 0 && anchorNode.parentNode.previousSibling) {
|
|
835
|
+
var ahr = anchorNode.parentNode.previousSibling;
|
|
836
|
+
txt = ___default['default'].trim(ahr.textContent || "");
|
|
837
|
+
return ahr;
|
|
838
|
+
}
|
|
839
|
+
return anchorNode.parentNode;
|
|
840
|
+
}
|
|
841
|
+
var anchorElement = anchorNode;
|
|
842
|
+
if (anchorElement.id === "luckysheet-rich-text-editor" || anchorElement.id === "luckysheet-functionbox-cell") {
|
|
843
|
+
var _$last;
|
|
844
|
+
var _txt = ___default['default'].trim((_$last = ___default['default'].last(anchorElement.querySelectorAll("span"))) === null || _$last === void 0 ? void 0 : _$last.innerText);
|
|
845
|
+
if (_txt.length === 0 && anchorElement.querySelectorAll("span").length > 1) {
|
|
846
|
+
var _ahr = anchorElement.querySelectorAll("span");
|
|
847
|
+
_txt = ___default['default'].trim(_ahr[_ahr.length - 2].innerText);
|
|
848
|
+
return _ahr === null || _ahr === void 0 ? void 0 : _ahr[0];
|
|
849
|
+
}
|
|
850
|
+
return ___default['default'].last(anchorElement.querySelectorAll("span"));
|
|
851
|
+
}
|
|
852
|
+
if ((anchorNode === null || anchorNode === void 0 ? void 0 : (_anchorNode$parentEle = anchorNode.parentElement) === null || _anchorNode$parentEle === void 0 ? void 0 : _anchorNode$parentEle.id) === "luckysheet-rich-text-editor" || (anchorNode === null || anchorNode === void 0 ? void 0 : (_anchorNode$parentEle2 = anchorNode.parentElement) === null || _anchorNode$parentEle2 === void 0 ? void 0 : _anchorNode$parentEle2.id) === "luckysheet-functionbox-cell" || anchorOffset === 0) {
|
|
853
|
+
var newAnchorNode = anchorOffset === 0 ? anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.parentNode : anchorNode;
|
|
854
|
+
if (newAnchorNode === null || newAnchorNode === void 0 ? void 0 : newAnchorNode.previousSibling) {
|
|
855
|
+
return newAnchorNode === null || newAnchorNode === void 0 ? void 0 : newAnchorNode.previousSibling;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
function moveCursorToPosition(editableDiv, targetPosition) {
|
|
861
|
+
if (!editableDiv || editableDiv.contentEditable !== "true") {
|
|
862
|
+
console.warn('目标元素必须是可编辑的div(contenteditable="true")');
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
if (targetPosition < 0) {
|
|
866
|
+
targetPosition = 0;
|
|
867
|
+
}
|
|
868
|
+
var textNodesInfo = [];
|
|
869
|
+
var totalLength = 0;
|
|
870
|
+
function traverseNodes(node) {
|
|
871
|
+
if (!node) return;
|
|
872
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
873
|
+
var textLength = node.textContent.length;
|
|
874
|
+
totalLength += textLength;
|
|
875
|
+
textNodesInfo.push({
|
|
876
|
+
node: node,
|
|
877
|
+
cumulativeLength: totalLength
|
|
878
|
+
});
|
|
879
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
880
|
+
Array.from(node.childNodes).forEach(function (child) {
|
|
881
|
+
return traverseNodes(child);
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
traverseNodes(editableDiv);
|
|
886
|
+
var targetNode = null;
|
|
887
|
+
var offsetInNode = 0;
|
|
888
|
+
if (totalLength <= targetPosition) {
|
|
889
|
+
if (textNodesInfo.length > 0) {
|
|
890
|
+
var lastNodeInfo = textNodesInfo[textNodesInfo.length - 1];
|
|
891
|
+
targetNode = lastNodeInfo.node;
|
|
892
|
+
offsetInNode = lastNodeInfo.node.textContent.length;
|
|
893
|
+
}
|
|
894
|
+
} else {
|
|
895
|
+
var prevCumulativeLength = 0;
|
|
896
|
+
var _iterator = _createForOfIteratorHelper(textNodesInfo),
|
|
897
|
+
_step;
|
|
898
|
+
try {
|
|
899
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
900
|
+
var info = _step.value;
|
|
901
|
+
if (info.cumulativeLength > targetPosition) {
|
|
902
|
+
targetNode = info.node;
|
|
903
|
+
offsetInNode = targetPosition - prevCumulativeLength;
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
prevCumulativeLength = info.cumulativeLength;
|
|
907
|
+
}
|
|
908
|
+
} catch (err) {
|
|
909
|
+
_iterator.e(err);
|
|
910
|
+
} finally {
|
|
911
|
+
_iterator.f();
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (targetNode) {
|
|
915
|
+
var selection = window.getSelection();
|
|
916
|
+
selection.removeAllRanges();
|
|
917
|
+
var range = document.createRange();
|
|
918
|
+
range.setStart(targetNode, offsetInNode);
|
|
919
|
+
range.setEnd(targetNode, offsetInNode);
|
|
920
|
+
selection.addRange(range);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
701
924
|
var FormulaSearch = function FormulaSearch(props) {
|
|
702
925
|
var _useContext = React.useContext(WorkbookContext),
|
|
703
926
|
context = _useContext.context,
|
|
704
927
|
refs = _useContext.refs,
|
|
705
928
|
settings = _useContext.settings;
|
|
929
|
+
var _useState = React.useState(""),
|
|
930
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
931
|
+
n = _useState2[0],
|
|
932
|
+
setN = _useState2[1];
|
|
933
|
+
var wrapperRf = React.useRef(null);
|
|
934
|
+
var nRef = React.useRef(n);
|
|
935
|
+
nRef.current = n;
|
|
936
|
+
React.useEffect(function () {
|
|
937
|
+
if (context.functionCandidates.length) {
|
|
938
|
+
setN(context.functionCandidates[0].n);
|
|
939
|
+
}
|
|
940
|
+
}, [context.functionCandidates]);
|
|
941
|
+
var fListRef = React.useRef([]);
|
|
942
|
+
fListRef.current = context.functionCandidates;
|
|
943
|
+
var inputN = function inputN(fnName) {
|
|
944
|
+
var _refs$cellInput$curre, _editor$textContent;
|
|
945
|
+
var offsetIndex = getPlainTextCursorOffset(refs.cellInput.current);
|
|
946
|
+
var text = ((_refs$cellInput$curre = refs.cellInput.current) === null || _refs$cellInput$curre === void 0 ? void 0 : _refs$cellInput$curre.innerText) || "";
|
|
947
|
+
var editor = getrangeseleciton();
|
|
948
|
+
var replaceText = (_editor$textContent = editor.textContent) === null || _editor$textContent === void 0 ? void 0 : _editor$textContent.trim();
|
|
949
|
+
var replaceTextLength = (replaceText === null || replaceText === void 0 ? void 0 : replaceText.length) || 0;
|
|
950
|
+
var newText = (text === null || text === void 0 ? void 0 : text.slice(0, offsetIndex - replaceTextLength)) + fnName + (text === null || text === void 0 ? void 0 : text.slice(offsetIndex));
|
|
951
|
+
refs.cellInput.current.innerHTML = core.functionHTMLGenerate(newText);
|
|
952
|
+
moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
|
|
953
|
+
};
|
|
954
|
+
var viewActive = function viewActive() {
|
|
955
|
+
var _wrapperRf$current;
|
|
956
|
+
var aItem = (_wrapperRf$current = wrapperRf.current) === null || _wrapperRf$current === void 0 ? void 0 : _wrapperRf$current.querySelector(".luckysheet-formula-search-item-active");
|
|
957
|
+
if (aItem) {
|
|
958
|
+
aItem === null || aItem === void 0 ? void 0 : aItem.scrollIntoView({
|
|
959
|
+
block: "nearest",
|
|
960
|
+
behavior: "smooth"
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
React.useEffect(function () {
|
|
965
|
+
var _refs$cellInput$curre2;
|
|
966
|
+
var onChange = function onChange(e) {
|
|
967
|
+
var _fListRef$current;
|
|
968
|
+
if (((_fListRef$current = fListRef.current) === null || _fListRef$current === void 0 ? void 0 : _fListRef$current.length) <= 0) {
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
if (e.key === "ArrowDown") {
|
|
972
|
+
e.preventDefault();
|
|
973
|
+
setN(function (_n) {
|
|
974
|
+
var _fListRef$current2, _fListRef$current3;
|
|
975
|
+
var currentIndex = Math.max((_fListRef$current2 = fListRef.current) === null || _fListRef$current2 === void 0 ? void 0 : _fListRef$current2.findIndex(function (item) {
|
|
976
|
+
return item.n === _n;
|
|
977
|
+
}), 0);
|
|
978
|
+
return (_fListRef$current3 = fListRef.current[(currentIndex + 1) % fListRef.current.length]) === null || _fListRef$current3 === void 0 ? void 0 : _fListRef$current3.n;
|
|
979
|
+
});
|
|
980
|
+
setTimeout(function () {
|
|
981
|
+
viewActive();
|
|
982
|
+
}, 200);
|
|
983
|
+
} else if (e.key === "ArrowUp") {
|
|
984
|
+
e.preventDefault();
|
|
985
|
+
setN(function (_n) {
|
|
986
|
+
var _fListRef$current4, _fListRef$current5;
|
|
987
|
+
var currentIndex = Math.max((_fListRef$current4 = fListRef.current) === null || _fListRef$current4 === void 0 ? void 0 : _fListRef$current4.findIndex(function (item) {
|
|
988
|
+
return item.n === _n;
|
|
989
|
+
}), 0);
|
|
990
|
+
return (_fListRef$current5 = fListRef.current[(currentIndex - 1) % fListRef.current.length]) === null || _fListRef$current5 === void 0 ? void 0 : _fListRef$current5.n;
|
|
991
|
+
});
|
|
992
|
+
setTimeout(function () {
|
|
993
|
+
viewActive();
|
|
994
|
+
}, 200);
|
|
995
|
+
} else if (e.key === "Enter") {
|
|
996
|
+
e.preventDefault();
|
|
997
|
+
e.stopPropagation();
|
|
998
|
+
if (nRef.current) {
|
|
999
|
+
inputN("".concat(nRef.current, "("));
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
(_refs$cellInput$curre2 = refs.cellInput.current) === null || _refs$cellInput$curre2 === void 0 ? void 0 : _refs$cellInput$curre2.addEventListener("keydown", onChange);
|
|
1004
|
+
return function () {
|
|
1005
|
+
var _refs$cellInput$curre3;
|
|
1006
|
+
(_refs$cellInput$curre3 = refs.cellInput.current) === null || _refs$cellInput$curre3 === void 0 ? void 0 : _refs$cellInput$curre3.removeEventListener("keydown", onChange);
|
|
1007
|
+
};
|
|
1008
|
+
}, [refs.cellInput.current]);
|
|
706
1009
|
if (___default['default'].isEmpty(context.functionCandidates)) return null;
|
|
707
|
-
function moveCursorToEnd(editor) {
|
|
708
|
-
var leftParen = editor.querySelector(".luckysheet-formula-text-lpar");
|
|
709
|
-
var rightParen = editor.querySelector(".luckysheet-formula-text-rpar");
|
|
710
|
-
var range = document.createRange();
|
|
711
|
-
var selection = window.getSelection();
|
|
712
|
-
range.setStartAfter(leftParen);
|
|
713
|
-
range.setEndBefore(rightParen);
|
|
714
|
-
selection.removeAllRanges();
|
|
715
|
-
selection.addRange(range);
|
|
716
|
-
}
|
|
717
1010
|
if (settings.renderFormulaSearch) {
|
|
718
1011
|
return settings.renderFormulaSearch(context.functionCandidates, core.functionHTMLGenerate, refs.cellInput.current);
|
|
719
1012
|
}
|
|
720
1013
|
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
721
1014
|
id: "luckysheet-formula-search-c",
|
|
722
|
-
className: "luckysheet-formula-search-c"
|
|
1015
|
+
className: "luckysheet-formula-search-c",
|
|
1016
|
+
ref: wrapperRf,
|
|
1017
|
+
onWheel: function onWheel(e) {
|
|
1018
|
+
e.preventDefault();
|
|
1019
|
+
e.stopPropagation();
|
|
1020
|
+
},
|
|
1021
|
+
onWheelCapture: function onWheelCapture(e) {
|
|
1022
|
+
e.preventDefault();
|
|
1023
|
+
e.stopPropagation();
|
|
1024
|
+
}
|
|
723
1025
|
}), context.functionCandidates.map(function (v) {
|
|
724
1026
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
725
|
-
onClick: function onClick() {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
(
|
|
729
|
-
|
|
1027
|
+
onClick: function onClick(e) {
|
|
1028
|
+
e.preventDefault();
|
|
1029
|
+
e.stopPropagation();
|
|
1030
|
+
inputN("".concat(v.n, "("));
|
|
1031
|
+
},
|
|
1032
|
+
onMouseEnter: function onMouseEnter() {
|
|
1033
|
+
setN(v.n);
|
|
1034
|
+
},
|
|
1035
|
+
onMouseDown: function onMouseDown(e) {
|
|
1036
|
+
return e.preventDefault();
|
|
730
1037
|
},
|
|
731
1038
|
key: v.n,
|
|
732
1039
|
"data-func": v.n,
|
|
733
|
-
className: "luckysheet-formula-search-item"
|
|
1040
|
+
className: "luckysheet-formula-search-item ".concat(n === v.n && "luckysheet-formula-search-item-active")
|
|
734
1041
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
735
1042
|
className: "luckysheet-formula-search-func"
|
|
736
1043
|
}, v.n), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -1024,7 +1331,7 @@ var InputBox = function InputBox() {
|
|
|
1024
1331
|
onKeyDown: onKeyDown,
|
|
1025
1332
|
onPaste: onPaste,
|
|
1026
1333
|
allowEdit: edit ? !isHidenRC : edit
|
|
1027
|
-
})), document.activeElement === inputRef.current && ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, (_settings$renderEdito = settings.renderEditorSelector) === null || _settings$renderEdito === void 0 ? void 0 : _settings$renderEdito.call(settings, inputRef.current), /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
|
|
1334
|
+
})), document.activeElement === inputRef.current && ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, (_settings$renderEdito = settings.renderEditorSelector) === null || _settings$renderEdito === void 0 ? void 0 : _settings$renderEdito.call(settings, inputRef.current, context.functionCandidates, context.functionHint, context.formulaCache.functionlistMap), /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
|
|
1028
1335
|
style: {
|
|
1029
1336
|
top: ((firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0) + 4
|
|
1030
1337
|
}
|
|
@@ -5542,8 +5849,10 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
5542
5849
|
if (!container) return;
|
|
5543
5850
|
var moreButtonWidth = 50;
|
|
5544
5851
|
for (var i = itemLocations.length - 1; i >= 0; i -= 1) {
|
|
5852
|
+
var _container$querySelec;
|
|
5545
5853
|
var loc = itemLocations[i];
|
|
5546
|
-
|
|
5854
|
+
var wrapperWidth = container.clientWidth - (((_container$querySelec = container.querySelector(".leankylin-toolbar-right")) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.clientWidth) || 0);
|
|
5855
|
+
if (loc + moreButtonWidth < wrapperWidth) {
|
|
5547
5856
|
setToolbarWrapIndex(i - itemLocations.length + settings.toolbarItems.length);
|
|
5548
5857
|
if (i === itemLocations.length - 1) {
|
|
5549
5858
|
setMoreItems(null);
|
|
@@ -6561,7 +6870,9 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6561
6870
|
}));
|
|
6562
6871
|
}
|
|
6563
6872
|
}
|
|
6564
|
-
})) : null,
|
|
6873
|
+
})) : null, settings.toolbarRightRender ? ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6874
|
+
className: "leankylin-toolbar-right"
|
|
6875
|
+
}, (_settings$toolbarRigh = settings.toolbarRightRender) === null || _settings$toolbarRigh === void 0 ? void 0 : _settings$toolbarRigh.call(settings))) : null);
|
|
6565
6876
|
};
|
|
6566
6877
|
|
|
6567
6878
|
var LocationBox = function LocationBox() {
|
package/dist/index.umd.css
CHANGED
|
@@ -1036,6 +1036,8 @@ html::-webkit-scrollbar-button {
|
|
|
1036
1036
|
background: #fff;
|
|
1037
1037
|
z-index: 1003;
|
|
1038
1038
|
width: 300px;
|
|
1039
|
+
max-height: 300px;
|
|
1040
|
+
overflow: auto;
|
|
1039
1041
|
}
|
|
1040
1042
|
|
|
1041
1043
|
.luckysheet-formula-search-c .luckysheet-formula-search-item {
|
|
@@ -1044,7 +1046,7 @@ html::-webkit-scrollbar-button {
|
|
|
1044
1046
|
cursor: pointer;
|
|
1045
1047
|
}
|
|
1046
1048
|
.luckysheet-formula-search-item:hover {
|
|
1047
|
-
background-color: #f1f1f1 !important;
|
|
1049
|
+
/* background-color: #f1f1f1 !important; */
|
|
1048
1050
|
}
|
|
1049
1051
|
|
|
1050
1052
|
.luckysheet-formula-search-c
|