@leankylin-sheet/react 3.1.45 → 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/index.esm.js CHANGED
@@ -920,6 +920,7 @@ var FormulaSearch = function FormulaSearch(props) {
920
920
  _useState2 = _slicedToArray(_useState, 2),
921
921
  n = _useState2[0],
922
922
  setN = _useState2[1];
923
+ var wrapperRf = useRef(null);
923
924
  var nRef = useRef(n);
924
925
  nRef.current = n;
925
926
  useEffect(function () {
@@ -940,6 +941,16 @@ var FormulaSearch = function FormulaSearch(props) {
940
941
  refs.cellInput.current.innerHTML = functionHTMLGenerate(newText);
941
942
  moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
942
943
  };
944
+ var viewActive = function viewActive() {
945
+ var _wrapperRf$current;
946
+ var aItem = (_wrapperRf$current = wrapperRf.current) === null || _wrapperRf$current === void 0 ? void 0 : _wrapperRf$current.querySelector(".luckysheet-formula-search-item-active");
947
+ if (aItem) {
948
+ aItem === null || aItem === void 0 ? void 0 : aItem.scrollIntoView({
949
+ block: "nearest",
950
+ behavior: "smooth"
951
+ });
952
+ }
953
+ };
943
954
  useEffect(function () {
944
955
  var _refs$cellInput$curre2;
945
956
  var onChange = function onChange(e) {
@@ -956,6 +967,9 @@ var FormulaSearch = function FormulaSearch(props) {
956
967
  }), 0);
957
968
  return (_fListRef$current3 = fListRef.current[(currentIndex + 1) % fListRef.current.length]) === null || _fListRef$current3 === void 0 ? void 0 : _fListRef$current3.n;
958
969
  });
970
+ setTimeout(function () {
971
+ viewActive();
972
+ }, 200);
959
973
  } else if (e.key === "ArrowUp") {
960
974
  e.preventDefault();
961
975
  setN(function (_n) {
@@ -965,6 +979,9 @@ var FormulaSearch = function FormulaSearch(props) {
965
979
  }), 0);
966
980
  return (_fListRef$current5 = fListRef.current[(currentIndex - 1) % fListRef.current.length]) === null || _fListRef$current5 === void 0 ? void 0 : _fListRef$current5.n;
967
981
  });
982
+ setTimeout(function () {
983
+ viewActive();
984
+ }, 200);
968
985
  } else if (e.key === "Enter") {
969
986
  e.preventDefault();
970
987
  e.stopPropagation();
@@ -986,6 +1003,7 @@ var FormulaSearch = function FormulaSearch(props) {
986
1003
  return /*#__PURE__*/React.createElement("div", _objectSpread2(_objectSpread2({}, props), {}, {
987
1004
  id: "luckysheet-formula-search-c",
988
1005
  className: "luckysheet-formula-search-c",
1006
+ ref: wrapperRf,
989
1007
  onWheel: function onWheel(e) {
990
1008
  e.preventDefault();
991
1009
  e.stopPropagation();
package/dist/index.js CHANGED
@@ -930,6 +930,7 @@ var FormulaSearch = function FormulaSearch(props) {
930
930
  _useState2 = _slicedToArray(_useState, 2),
931
931
  n = _useState2[0],
932
932
  setN = _useState2[1];
933
+ var wrapperRf = React.useRef(null);
933
934
  var nRef = React.useRef(n);
934
935
  nRef.current = n;
935
936
  React.useEffect(function () {
@@ -950,6 +951,16 @@ var FormulaSearch = function FormulaSearch(props) {
950
951
  refs.cellInput.current.innerHTML = core.functionHTMLGenerate(newText);
951
952
  moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
952
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
+ };
953
964
  React.useEffect(function () {
954
965
  var _refs$cellInput$curre2;
955
966
  var onChange = function onChange(e) {
@@ -966,6 +977,9 @@ var FormulaSearch = function FormulaSearch(props) {
966
977
  }), 0);
967
978
  return (_fListRef$current3 = fListRef.current[(currentIndex + 1) % fListRef.current.length]) === null || _fListRef$current3 === void 0 ? void 0 : _fListRef$current3.n;
968
979
  });
980
+ setTimeout(function () {
981
+ viewActive();
982
+ }, 200);
969
983
  } else if (e.key === "ArrowUp") {
970
984
  e.preventDefault();
971
985
  setN(function (_n) {
@@ -975,6 +989,9 @@ var FormulaSearch = function FormulaSearch(props) {
975
989
  }), 0);
976
990
  return (_fListRef$current5 = fListRef.current[(currentIndex - 1) % fListRef.current.length]) === null || _fListRef$current5 === void 0 ? void 0 : _fListRef$current5.n;
977
991
  });
992
+ setTimeout(function () {
993
+ viewActive();
994
+ }, 200);
978
995
  } else if (e.key === "Enter") {
979
996
  e.preventDefault();
980
997
  e.stopPropagation();
@@ -996,6 +1013,7 @@ var FormulaSearch = function FormulaSearch(props) {
996
1013
  return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2(_objectSpread2({}, props), {}, {
997
1014
  id: "luckysheet-formula-search-c",
998
1015
  className: "luckysheet-formula-search-c",
1016
+ ref: wrapperRf,
999
1017
  onWheel: function onWheel(e) {
1000
1018
  e.preventDefault();
1001
1019
  e.stopPropagation();
package/dist/index.umd.js CHANGED
@@ -94242,6 +94242,7 @@
94242
94242
  _useState2 = _slicedToArray(_useState, 2),
94243
94243
  n = _useState2[0],
94244
94244
  setN = _useState2[1];
94245
+ var wrapperRf = React.useRef(null);
94245
94246
  var nRef = React.useRef(n);
94246
94247
  nRef.current = n;
94247
94248
  React.useEffect(function () {
@@ -94262,6 +94263,16 @@
94262
94263
  refs.cellInput.current.innerHTML = functionHTMLGenerate(newText);
94263
94264
  moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
94264
94265
  };
94266
+ var viewActive = function viewActive() {
94267
+ var _wrapperRf$current;
94268
+ var aItem = (_wrapperRf$current = wrapperRf.current) === null || _wrapperRf$current === void 0 ? void 0 : _wrapperRf$current.querySelector(".luckysheet-formula-search-item-active");
94269
+ if (aItem) {
94270
+ aItem === null || aItem === void 0 ? void 0 : aItem.scrollIntoView({
94271
+ block: "nearest",
94272
+ behavior: "smooth"
94273
+ });
94274
+ }
94275
+ };
94265
94276
  React.useEffect(function () {
94266
94277
  var _refs$cellInput$curre2;
94267
94278
  var onChange = function onChange(e) {
@@ -94278,6 +94289,9 @@
94278
94289
  }), 0);
94279
94290
  return (_fListRef$current3 = fListRef.current[(currentIndex + 1) % fListRef.current.length]) === null || _fListRef$current3 === void 0 ? void 0 : _fListRef$current3.n;
94280
94291
  });
94292
+ setTimeout(function () {
94293
+ viewActive();
94294
+ }, 200);
94281
94295
  } else if (e.key === "ArrowUp") {
94282
94296
  e.preventDefault();
94283
94297
  setN(function (_n) {
@@ -94287,6 +94301,9 @@
94287
94301
  }), 0);
94288
94302
  return (_fListRef$current5 = fListRef.current[(currentIndex - 1) % fListRef.current.length]) === null || _fListRef$current5 === void 0 ? void 0 : _fListRef$current5.n;
94289
94303
  });
94304
+ setTimeout(function () {
94305
+ viewActive();
94306
+ }, 200);
94290
94307
  } else if (e.key === "Enter") {
94291
94308
  e.preventDefault();
94292
94309
  e.stopPropagation();
@@ -94308,6 +94325,7 @@
94308
94325
  return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2(_objectSpread2({}, props), {}, {
94309
94326
  id: "luckysheet-formula-search-c",
94310
94327
  className: "luckysheet-formula-search-c",
94328
+ ref: wrapperRf,
94311
94329
  onWheel: function onWheel(e) {
94312
94330
  e.preventDefault();
94313
94331
  e.stopPropagation();