@leankylin-sheet/react 3.1.43 → 3.1.45
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 +318 -21
- package/dist/index.js +318 -21
- package/dist/index.umd.css +3 -1
- package/dist/index.umd.js +318 -21
- 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: {
|
|
@@ -640,6 +691,8 @@ var RowHeader = function RowHeader() {
|
|
|
640
691
|
var ContentEditable = function ContentEditable(_ref) {
|
|
641
692
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
642
693
|
var lastHtml = React.useRef("");
|
|
694
|
+
var _useContext = React.useContext(WorkbookContext),
|
|
695
|
+
settings = _useContext.settings;
|
|
643
696
|
var root = React.useRef(null);
|
|
644
697
|
var autoFocus = props.autoFocus,
|
|
645
698
|
initialContent = props.initialContent,
|
|
@@ -677,7 +730,9 @@ var ContentEditable = function ContentEditable(_ref) {
|
|
|
677
730
|
return e.stopPropagation();
|
|
678
731
|
},
|
|
679
732
|
onClick: function onClick(e) {
|
|
680
|
-
|
|
733
|
+
var _settings$onClickCont;
|
|
734
|
+
e.stopPropagation();
|
|
735
|
+
(_settings$onClickCont = settings.onClickContentEditable) === null || _settings$onClickCont === void 0 ? void 0 : _settings$onClickCont.call(settings, e);
|
|
681
736
|
}
|
|
682
737
|
}, ___default['default'].omit(props, "innerRef", "onChange", "html", "onBlur", "autoFocus", "allowEdit", "initialContent")), {}, {
|
|
683
738
|
ref: function ref(e) {
|
|
@@ -694,39 +749,277 @@ var ContentEditable = function ContentEditable(_ref) {
|
|
|
694
749
|
}));
|
|
695
750
|
};
|
|
696
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
|
+
|
|
697
924
|
var FormulaSearch = function FormulaSearch(props) {
|
|
698
925
|
var _useContext = React.useContext(WorkbookContext),
|
|
699
926
|
context = _useContext.context,
|
|
700
927
|
refs = _useContext.refs,
|
|
701
928
|
settings = _useContext.settings;
|
|
929
|
+
var _useState = React.useState(""),
|
|
930
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
931
|
+
n = _useState2[0],
|
|
932
|
+
setN = _useState2[1];
|
|
933
|
+
var nRef = React.useRef(n);
|
|
934
|
+
nRef.current = n;
|
|
935
|
+
React.useEffect(function () {
|
|
936
|
+
if (context.functionCandidates.length) {
|
|
937
|
+
setN(context.functionCandidates[0].n);
|
|
938
|
+
}
|
|
939
|
+
}, [context.functionCandidates]);
|
|
940
|
+
var fListRef = React.useRef([]);
|
|
941
|
+
fListRef.current = context.functionCandidates;
|
|
942
|
+
var inputN = function inputN(fnName) {
|
|
943
|
+
var _refs$cellInput$curre, _editor$textContent;
|
|
944
|
+
var offsetIndex = getPlainTextCursorOffset(refs.cellInput.current);
|
|
945
|
+
var text = ((_refs$cellInput$curre = refs.cellInput.current) === null || _refs$cellInput$curre === void 0 ? void 0 : _refs$cellInput$curre.innerText) || "";
|
|
946
|
+
var editor = getrangeseleciton();
|
|
947
|
+
var replaceText = (_editor$textContent = editor.textContent) === null || _editor$textContent === void 0 ? void 0 : _editor$textContent.trim();
|
|
948
|
+
var replaceTextLength = (replaceText === null || replaceText === void 0 ? void 0 : replaceText.length) || 0;
|
|
949
|
+
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));
|
|
950
|
+
refs.cellInput.current.innerHTML = core.functionHTMLGenerate(newText);
|
|
951
|
+
moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
|
|
952
|
+
};
|
|
953
|
+
React.useEffect(function () {
|
|
954
|
+
var _refs$cellInput$curre2;
|
|
955
|
+
var onChange = function onChange(e) {
|
|
956
|
+
var _fListRef$current;
|
|
957
|
+
if (((_fListRef$current = fListRef.current) === null || _fListRef$current === void 0 ? void 0 : _fListRef$current.length) <= 0) {
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
if (e.key === "ArrowDown") {
|
|
961
|
+
e.preventDefault();
|
|
962
|
+
setN(function (_n) {
|
|
963
|
+
var _fListRef$current2, _fListRef$current3;
|
|
964
|
+
var currentIndex = Math.max((_fListRef$current2 = fListRef.current) === null || _fListRef$current2 === void 0 ? void 0 : _fListRef$current2.findIndex(function (item) {
|
|
965
|
+
return item.n === _n;
|
|
966
|
+
}), 0);
|
|
967
|
+
return (_fListRef$current3 = fListRef.current[(currentIndex + 1) % fListRef.current.length]) === null || _fListRef$current3 === void 0 ? void 0 : _fListRef$current3.n;
|
|
968
|
+
});
|
|
969
|
+
} else if (e.key === "ArrowUp") {
|
|
970
|
+
e.preventDefault();
|
|
971
|
+
setN(function (_n) {
|
|
972
|
+
var _fListRef$current4, _fListRef$current5;
|
|
973
|
+
var currentIndex = Math.max((_fListRef$current4 = fListRef.current) === null || _fListRef$current4 === void 0 ? void 0 : _fListRef$current4.findIndex(function (item) {
|
|
974
|
+
return item.n === _n;
|
|
975
|
+
}), 0);
|
|
976
|
+
return (_fListRef$current5 = fListRef.current[(currentIndex - 1) % fListRef.current.length]) === null || _fListRef$current5 === void 0 ? void 0 : _fListRef$current5.n;
|
|
977
|
+
});
|
|
978
|
+
} else if (e.key === "Enter") {
|
|
979
|
+
e.preventDefault();
|
|
980
|
+
e.stopPropagation();
|
|
981
|
+
if (nRef.current) {
|
|
982
|
+
inputN("".concat(nRef.current, "("));
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
(_refs$cellInput$curre2 = refs.cellInput.current) === null || _refs$cellInput$curre2 === void 0 ? void 0 : _refs$cellInput$curre2.addEventListener("keydown", onChange);
|
|
987
|
+
return function () {
|
|
988
|
+
var _refs$cellInput$curre3;
|
|
989
|
+
(_refs$cellInput$curre3 = refs.cellInput.current) === null || _refs$cellInput$curre3 === void 0 ? void 0 : _refs$cellInput$curre3.removeEventListener("keydown", onChange);
|
|
990
|
+
};
|
|
991
|
+
}, [refs.cellInput.current]);
|
|
702
992
|
if (___default['default'].isEmpty(context.functionCandidates)) return null;
|
|
703
|
-
function moveCursorToEnd(editor) {
|
|
704
|
-
var leftParen = editor.querySelector(".luckysheet-formula-text-lpar");
|
|
705
|
-
var rightParen = editor.querySelector(".luckysheet-formula-text-rpar");
|
|
706
|
-
var range = document.createRange();
|
|
707
|
-
var selection = window.getSelection();
|
|
708
|
-
range.setStartAfter(leftParen);
|
|
709
|
-
range.setEndBefore(rightParen);
|
|
710
|
-
selection.removeAllRanges();
|
|
711
|
-
selection.addRange(range);
|
|
712
|
-
}
|
|
713
993
|
if (settings.renderFormulaSearch) {
|
|
714
994
|
return settings.renderFormulaSearch(context.functionCandidates, core.functionHTMLGenerate, refs.cellInput.current);
|
|
715
995
|
}
|
|
716
996
|
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
717
997
|
id: "luckysheet-formula-search-c",
|
|
718
|
-
className: "luckysheet-formula-search-c"
|
|
998
|
+
className: "luckysheet-formula-search-c",
|
|
999
|
+
onWheel: function onWheel(e) {
|
|
1000
|
+
e.preventDefault();
|
|
1001
|
+
e.stopPropagation();
|
|
1002
|
+
},
|
|
1003
|
+
onWheelCapture: function onWheelCapture(e) {
|
|
1004
|
+
e.preventDefault();
|
|
1005
|
+
e.stopPropagation();
|
|
1006
|
+
}
|
|
719
1007
|
}), context.functionCandidates.map(function (v) {
|
|
720
1008
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
721
|
-
onClick: function onClick() {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
(
|
|
725
|
-
|
|
1009
|
+
onClick: function onClick(e) {
|
|
1010
|
+
e.preventDefault();
|
|
1011
|
+
e.stopPropagation();
|
|
1012
|
+
inputN("".concat(v.n, "("));
|
|
1013
|
+
},
|
|
1014
|
+
onMouseEnter: function onMouseEnter() {
|
|
1015
|
+
setN(v.n);
|
|
1016
|
+
},
|
|
1017
|
+
onMouseDown: function onMouseDown(e) {
|
|
1018
|
+
return e.preventDefault();
|
|
726
1019
|
},
|
|
727
1020
|
key: v.n,
|
|
728
1021
|
"data-func": v.n,
|
|
729
|
-
className: "luckysheet-formula-search-item"
|
|
1022
|
+
className: "luckysheet-formula-search-item ".concat(n === v.n && "luckysheet-formula-search-item-active")
|
|
730
1023
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
731
1024
|
className: "luckysheet-formula-search-func"
|
|
732
1025
|
}, v.n), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -1020,7 +1313,7 @@ var InputBox = function InputBox() {
|
|
|
1020
1313
|
onKeyDown: onKeyDown,
|
|
1021
1314
|
onPaste: onPaste,
|
|
1022
1315
|
allowEdit: edit ? !isHidenRC : edit
|
|
1023
|
-
})), 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, {
|
|
1316
|
+
})), 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, {
|
|
1024
1317
|
style: {
|
|
1025
1318
|
top: ((firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0) + 4
|
|
1026
1319
|
}
|
|
@@ -5538,8 +5831,10 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
5538
5831
|
if (!container) return;
|
|
5539
5832
|
var moreButtonWidth = 50;
|
|
5540
5833
|
for (var i = itemLocations.length - 1; i >= 0; i -= 1) {
|
|
5834
|
+
var _container$querySelec;
|
|
5541
5835
|
var loc = itemLocations[i];
|
|
5542
|
-
|
|
5836
|
+
var wrapperWidth = container.clientWidth - (((_container$querySelec = container.querySelector(".leankylin-toolbar-right")) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.clientWidth) || 0);
|
|
5837
|
+
if (loc + moreButtonWidth < wrapperWidth) {
|
|
5543
5838
|
setToolbarWrapIndex(i - itemLocations.length + settings.toolbarItems.length);
|
|
5544
5839
|
if (i === itemLocations.length - 1) {
|
|
5545
5840
|
setMoreItems(null);
|
|
@@ -6557,7 +6852,9 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6557
6852
|
}));
|
|
6558
6853
|
}
|
|
6559
6854
|
}
|
|
6560
|
-
})) : null,
|
|
6855
|
+
})) : null, settings.toolbarRightRender ? ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6856
|
+
className: "leankylin-toolbar-right"
|
|
6857
|
+
}, (_settings$toolbarRigh = settings.toolbarRightRender) === null || _settings$toolbarRigh === void 0 ? void 0 : _settings$toolbarRigh.call(settings))) : null);
|
|
6561
6858
|
};
|
|
6562
6859
|
|
|
6563
6860
|
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
|