@leankylin-sheet/react 4.0.44 → 4.0.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/index.esm.js CHANGED
@@ -915,7 +915,8 @@ var FormulaSearch = function FormulaSearch(props) {
915
915
  var _useContext = useContext(WorkbookContext),
916
916
  context = _useContext.context,
917
917
  refs = _useContext.refs,
918
- settings = _useContext.settings;
918
+ settings = _useContext.settings,
919
+ setContext = _useContext.setContext;
919
920
  var _useState = useState(""),
920
921
  _useState2 = _slicedToArray(_useState, 2),
921
922
  n = _useState2[0],
@@ -939,6 +940,10 @@ var FormulaSearch = function FormulaSearch(props) {
939
940
  var replaceTextLength = (replaceText === null || replaceText === void 0 ? void 0 : replaceText.length) || 0;
940
941
  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));
941
942
  refs.cellInput.current.innerHTML = functionHTMLGenerate(newText);
943
+ refs.fxInput.current.innerHTML = refs.cellInput.current.innerHTML;
944
+ setContext(function (draftCtx) {
945
+ draftCtx.functionHint = fnName === null || fnName === void 0 ? void 0 : fnName.slice(0, -1);
946
+ });
942
947
  moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
943
948
  };
944
949
  var viewActive = function viewActive() {
@@ -982,13 +987,7 @@ var FormulaSearch = function FormulaSearch(props) {
982
987
  setTimeout(function () {
983
988
  viewActive();
984
989
  }, 200);
985
- } else if (e.key === "Enter") {
986
- e.preventDefault();
987
- e.stopPropagation();
988
- if (nRef.current) {
989
- inputN("".concat(nRef.current, "("));
990
- }
991
- }
990
+ } else if (e.key === "Enter") ;
992
991
  };
993
992
  (_refs$cellInput$curre2 = refs.cellInput.current) === null || _refs$cellInput$curre2 === void 0 ? void 0 : _refs$cellInput$curre2.addEventListener("keydown", onChange);
994
993
  return function () {
@@ -7261,18 +7260,19 @@ var SheetItem = function SheetItem(_ref) {
7261
7260
  var _refs$fxInput$current2;
7262
7261
  luckysheetCellUpdate = [draftCtx.active_f.r, draftCtx.active_f.c];
7263
7262
  isBack = true;
7264
- refs.cellInput.current.innerHTML = ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) || "";
7263
+ if ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) {
7264
+ var _refs$fxInput$current3;
7265
+ refs.cellInput.current.innerHTML = ((_refs$fxInput$current3 = refs.fxInput.current) === null || _refs$fxInput$current3 === void 0 ? void 0 : _refs$fxInput$current3.innerHTML) || "";
7266
+ }
7265
7267
  moveToEnd(refs.cellInput.current);
7266
7268
  }
7267
7269
  if (draftCtx.active_f) {
7268
7270
  sheetId = draftCtx.active_f.sheetId;
7269
7271
  }
7270
7272
  var _update = ((_luckysheetCellUpdate = luckysheetCellUpdate) === null || _luckysheetCellUpdate === void 0 ? void 0 : _luckysheetCellUpdate.length) > 0 ? luckysheetCellUpdate : draftCtx.luckysheetCellUpdate;
7271
- if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) {
7272
- updateCell(draftCtx, _update[0], _update[1], refs.cellInput.current, undefined, refs.canvas.current.getContext("2d"), sheetId);
7273
- }
7274
- draftCtx.dataVerificationDropDownList = false;
7275
7273
  draftCtx.currentSheetId = sheet.id;
7274
+ if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) ;
7275
+ draftCtx.dataVerificationDropDownList = false;
7276
7276
  draftCtx.zoomRatio = sheet.zoomRatio || 1;
7277
7277
  cancelActiveImgItem(draftCtx, refs.globalCache);
7278
7278
  cancelNormalSelected(draftCtx);
package/dist/index.js CHANGED
@@ -925,7 +925,8 @@ var FormulaSearch = function FormulaSearch(props) {
925
925
  var _useContext = React.useContext(WorkbookContext),
926
926
  context = _useContext.context,
927
927
  refs = _useContext.refs,
928
- settings = _useContext.settings;
928
+ settings = _useContext.settings,
929
+ setContext = _useContext.setContext;
929
930
  var _useState = React.useState(""),
930
931
  _useState2 = _slicedToArray(_useState, 2),
931
932
  n = _useState2[0],
@@ -949,6 +950,10 @@ var FormulaSearch = function FormulaSearch(props) {
949
950
  var replaceTextLength = (replaceText === null || replaceText === void 0 ? void 0 : replaceText.length) || 0;
950
951
  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
952
  refs.cellInput.current.innerHTML = core.functionHTMLGenerate(newText);
953
+ refs.fxInput.current.innerHTML = refs.cellInput.current.innerHTML;
954
+ setContext(function (draftCtx) {
955
+ draftCtx.functionHint = fnName === null || fnName === void 0 ? void 0 : fnName.slice(0, -1);
956
+ });
952
957
  moveCursorToPosition(refs.cellInput.current, offsetIndex - replaceTextLength + fnName.length);
953
958
  };
954
959
  var viewActive = function viewActive() {
@@ -992,13 +997,7 @@ var FormulaSearch = function FormulaSearch(props) {
992
997
  setTimeout(function () {
993
998
  viewActive();
994
999
  }, 200);
995
- } else if (e.key === "Enter") {
996
- e.preventDefault();
997
- e.stopPropagation();
998
- if (nRef.current) {
999
- inputN("".concat(nRef.current, "("));
1000
- }
1001
- }
1000
+ } else if (e.key === "Enter") ;
1002
1001
  };
1003
1002
  (_refs$cellInput$curre2 = refs.cellInput.current) === null || _refs$cellInput$curre2 === void 0 ? void 0 : _refs$cellInput$curre2.addEventListener("keydown", onChange);
1004
1003
  return function () {
@@ -7271,18 +7270,19 @@ var SheetItem = function SheetItem(_ref) {
7271
7270
  var _refs$fxInput$current2;
7272
7271
  luckysheetCellUpdate = [draftCtx.active_f.r, draftCtx.active_f.c];
7273
7272
  isBack = true;
7274
- refs.cellInput.current.innerHTML = ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) || "";
7273
+ if ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) {
7274
+ var _refs$fxInput$current3;
7275
+ refs.cellInput.current.innerHTML = ((_refs$fxInput$current3 = refs.fxInput.current) === null || _refs$fxInput$current3 === void 0 ? void 0 : _refs$fxInput$current3.innerHTML) || "";
7276
+ }
7275
7277
  core.moveToEnd(refs.cellInput.current);
7276
7278
  }
7277
7279
  if (draftCtx.active_f) {
7278
7280
  sheetId = draftCtx.active_f.sheetId;
7279
7281
  }
7280
7282
  var _update = ((_luckysheetCellUpdate = luckysheetCellUpdate) === null || _luckysheetCellUpdate === void 0 ? void 0 : _luckysheetCellUpdate.length) > 0 ? luckysheetCellUpdate : draftCtx.luckysheetCellUpdate;
7281
- if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) {
7282
- core.updateCell(draftCtx, _update[0], _update[1], refs.cellInput.current, undefined, refs.canvas.current.getContext("2d"), sheetId);
7283
- }
7284
- draftCtx.dataVerificationDropDownList = false;
7285
7283
  draftCtx.currentSheetId = sheet.id;
7284
+ if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) ;
7285
+ draftCtx.dataVerificationDropDownList = false;
7286
7286
  draftCtx.zoomRatio = sheet.zoomRatio || 1;
7287
7287
  core.cancelActiveImgItem(draftCtx, refs.globalCache);
7288
7288
  core.cancelNormalSelected(draftCtx);