@fileverse-dev/fortune-react 1.0.2-mod-10-test-2 → 1.0.2-mod-14

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.
@@ -5,7 +5,8 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
5
5
  getCellValue: (row: number, column: number, options?: api.CommonOptions & {
6
6
  type?: keyof Cell;
7
7
  }) => any;
8
- testApi: () => void;
8
+ onboardingActiveCell: (functionName: string) => void;
9
+ initializeComment: (row: number, column: number) => void;
9
10
  setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
10
11
  type?: keyof Cell;
11
12
  }) => void;
@@ -12,7 +12,8 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
12
12
  getCellValue: (row: number, column: number, options?: import("@fileverse-dev/fortune-core/dist/api").CommonOptions & {
13
13
  type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
14
14
  }) => any;
15
- testApi: () => void;
15
+ onboardingActiveCell: (functionName: string) => void;
16
+ initializeComment: (row: number, column: number) => void;
16
17
  setCellValue: (row: number, column: number, value: any, options?: import("@fileverse-dev/fortune-core/dist/api").CommonOptions & {
17
18
  type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
18
19
  }) => void;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, onCommentBoxResizeStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, handlePasteByClick, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
1
+ import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, handlePasteByClick, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
2
2
  import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
3
3
  import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
4
4
  import _ from 'lodash';
@@ -2362,7 +2362,8 @@ var NotationBoxes = function NotationBoxes() {
2362
2362
  var _useContext = useContext(WorkbookContext),
2363
2363
  context = _useContext.context,
2364
2364
  setContext = _useContext.setContext,
2365
- refs = _useContext.refs;
2365
+ refs = _useContext.refs,
2366
+ settings = _useContext.settings;
2366
2367
  var flowdata = getFlowdata(context);
2367
2368
  useEffect(function () {
2368
2369
  if (flowdata) {
@@ -2390,8 +2391,8 @@ var NotationBoxes = function NotationBoxes() {
2390
2391
  }, _.concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
2391
2392
  var _context$editingComme;
2392
2393
  return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
2393
- }), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox) {
2394
- var _context$editingComme2;
2394
+ }), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox, index) {
2395
+ var _context$editingComme2, _settings$getCommentC;
2395
2396
  if (!commentBox) return null;
2396
2397
  var r = commentBox.r,
2397
2398
  c = commentBox.c,
@@ -2406,7 +2407,7 @@ var NotationBoxes = function NotationBoxes() {
2406
2407
  var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
2407
2408
  var commentId = "comment-box-".concat(rc);
2408
2409
  return /*#__PURE__*/React.createElement("div", {
2409
- key: rc
2410
+ key: rc + index
2410
2411
  }, /*#__PURE__*/React.createElement("canvas", {
2411
2412
  id: "arrowCanvas-".concat(rc),
2412
2413
  className: "arrowCanvas",
@@ -2450,72 +2451,12 @@ var NotationBoxes = function NotationBoxes() {
2450
2451
  e.stopPropagation();
2451
2452
  }
2452
2453
  }, /*#__PURE__*/React.createElement("div", {
2453
- className: "luckysheet-postil-dialog-move"
2454
- }, ["t", "r", "b", "l"].map(function (v) {
2455
- return /*#__PURE__*/React.createElement("div", {
2456
- key: v,
2457
- className: "luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-".concat(v),
2458
- "data-type": v
2459
- });
2460
- })), isEditing && (/*#__PURE__*/React.createElement("div", {
2461
- className: "luckysheet-postil-dialog-resize"
2462
- }, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (v) {
2463
- return /*#__PURE__*/React.createElement("div", {
2464
- key: v,
2465
- className: "luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-".concat(v),
2466
- "data-type": v,
2467
- onMouseDown: function onMouseDown(e) {
2468
- var nativeEvent = e.nativeEvent;
2469
- onCommentBoxResizeStart(context, refs.globalCache, nativeEvent, {
2470
- r: r,
2471
- c: c,
2472
- rc: rc
2473
- }, commentId, v);
2474
- e.stopPropagation();
2475
- }
2476
- });
2477
- }))), /*#__PURE__*/React.createElement("div", {
2478
2454
  style: {
2479
2455
  width: "100%",
2480
2456
  height: "100%",
2481
2457
  overflow: "hidden"
2482
2458
  }
2483
- }, /*#__PURE__*/React.createElement(ContentEditable, {
2484
- id: "comment-editor-".concat(rc),
2485
- autoFocus: autoFocus,
2486
- style: {
2487
- width: "100%",
2488
- height: "100%",
2489
- lineHeight: "20px",
2490
- boxSizing: "border-box",
2491
- textAlign: "center",
2492
- wordBreak: "break-all",
2493
- outline: "none"
2494
- },
2495
- allowEdit: context.allowEdit,
2496
- spellCheck: false,
2497
- "data-r": r,
2498
- "data-c": c,
2499
- onKeyDown: function onKeyDown(e) {
2500
- return e.stopPropagation();
2501
- },
2502
- onFocus: function onFocus(e) {
2503
- if (context.allowEdit === false) return;
2504
- refs.globalCache.editingCommentBoxEle = e.target;
2505
- },
2506
- onMouseDown: function onMouseDown(e) {
2507
- setContext(function (draftContext) {
2508
- if (flowdata) {
2509
- setEditingComment(draftContext, flowdata, r, c);
2510
- }
2511
- });
2512
- e.stopPropagation();
2513
- },
2514
- onDoubleClick: function onDoubleClick(e) {
2515
- e.stopPropagation();
2516
- },
2517
- initialContent: value
2518
- }))));
2459
+ }, (_settings$getCommentC = settings.getCommentCellUI) === null || _settings$getCommentC === void 0 ? void 0 : _settings$getCommentC.call(settings, r, c))));
2519
2460
  }));
2520
2461
  };
2521
2462
 
@@ -7607,6 +7548,17 @@ var ContextMenu = function ContextMenu() {
7607
7548
  key: "divider-".concat(i)
7608
7549
  });
7609
7550
  }
7551
+ if (name === "comment") {
7552
+ return /*#__PURE__*/React.createElement(Menu, {
7553
+ key: name,
7554
+ onClick: function onClick() {
7555
+ setContext(function (draftCtx) {
7556
+ newComment(draftCtx, refs.globalCache, selection === null || selection === void 0 ? void 0 : selection.row_focus, selection === null || selection === void 0 ? void 0 : selection.column_focus);
7557
+ draftCtx.contextMenu = {};
7558
+ });
7559
+ }
7560
+ }, "Comment");
7561
+ }
7610
7562
  if (name === "copy") {
7611
7563
  return /*#__PURE__*/React.createElement(Menu, {
7612
7564
  key: name,
@@ -9999,8 +9951,49 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
9999
9951
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10000
9952
  return api.getCellValue(context, row, column, options);
10001
9953
  },
10002
- testApi: function testApi() {
10003
- console.log("Test API");
9954
+ onboardingActiveCell: function onboardingActiveCell(functionName) {
9955
+ var _context$luckysheet_s;
9956
+ var _locale = locale(context),
9957
+ functionlist = _locale.functionlist;
9958
+ var last = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[context.luckysheet_select_save.length - 1];
9959
+ var row_index = last === null || last === void 0 ? void 0 : last.row_focus;
9960
+ var col_index = last === null || last === void 0 ? void 0 : last.column_focus;
9961
+ if (!last) {
9962
+ row_index = 0;
9963
+ col_index = 0;
9964
+ } else {
9965
+ if (row_index == null) {
9966
+ var _last$row = _slicedToArray(last.row, 1);
9967
+ row_index = _last$row[0];
9968
+ }
9969
+ if (col_index == null) {
9970
+ var _last$column = _slicedToArray(last.column, 1);
9971
+ col_index = _last$column[0];
9972
+ }
9973
+ }
9974
+ var formulaTxt = "<span>=</span><span>".concat(functionName, "</span><span>(</span>");
9975
+ setContext(function (ctx) {
9976
+ if (cellInput != null) {
9977
+ ctx.luckysheetCellUpdate = [row_index, col_index];
9978
+ cellInput.innerHTML = formulaTxt;
9979
+ var spans = cellInput.childNodes;
9980
+ if (!_.isEmpty(spans)) {
9981
+ setCaretPosition(ctx, spans[spans.length - 1], 0, 1);
9982
+ }
9983
+ ctx.functionHint = functionName;
9984
+ ctx.functionCandidates = [];
9985
+ if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
9986
+ for (var i = 0; i < functionlist.length; i += 1) {
9987
+ ctx.formulaCache.functionlistMap[functionlist[i].n] = functionlist[i];
9988
+ }
9989
+ }
9990
+ }
9991
+ });
9992
+ },
9993
+ initializeComment: function initializeComment(row, column) {
9994
+ setContext(function (ctx) {
9995
+ newComment(ctx, undefined, row, column);
9996
+ });
10004
9997
  },
10005
9998
  setCellValue: function setCellValue(row, column, value) {
10006
9999
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
package/dist/index.js CHANGED
@@ -2373,7 +2373,8 @@ var NotationBoxes = function NotationBoxes() {
2373
2373
  var _useContext = React.useContext(WorkbookContext),
2374
2374
  context = _useContext.context,
2375
2375
  setContext = _useContext.setContext,
2376
- refs = _useContext.refs;
2376
+ refs = _useContext.refs,
2377
+ settings = _useContext.settings;
2377
2378
  var flowdata = fortuneCore.getFlowdata(context);
2378
2379
  React.useEffect(function () {
2379
2380
  if (flowdata) {
@@ -2401,8 +2402,8 @@ var NotationBoxes = function NotationBoxes() {
2401
2402
  }, ___default['default'].concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
2402
2403
  var _context$editingComme;
2403
2404
  return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
2404
- }), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox) {
2405
- var _context$editingComme2;
2405
+ }), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox, index) {
2406
+ var _context$editingComme2, _settings$getCommentC;
2406
2407
  if (!commentBox) return null;
2407
2408
  var r = commentBox.r,
2408
2409
  c = commentBox.c,
@@ -2417,7 +2418,7 @@ var NotationBoxes = function NotationBoxes() {
2417
2418
  var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
2418
2419
  var commentId = "comment-box-".concat(rc);
2419
2420
  return /*#__PURE__*/React__default['default'].createElement("div", {
2420
- key: rc
2421
+ key: rc + index
2421
2422
  }, /*#__PURE__*/React__default['default'].createElement("canvas", {
2422
2423
  id: "arrowCanvas-".concat(rc),
2423
2424
  className: "arrowCanvas",
@@ -2461,72 +2462,12 @@ var NotationBoxes = function NotationBoxes() {
2461
2462
  e.stopPropagation();
2462
2463
  }
2463
2464
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2464
- className: "luckysheet-postil-dialog-move"
2465
- }, ["t", "r", "b", "l"].map(function (v) {
2466
- return /*#__PURE__*/React__default['default'].createElement("div", {
2467
- key: v,
2468
- className: "luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-".concat(v),
2469
- "data-type": v
2470
- });
2471
- })), isEditing && (/*#__PURE__*/React__default['default'].createElement("div", {
2472
- className: "luckysheet-postil-dialog-resize"
2473
- }, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (v) {
2474
- return /*#__PURE__*/React__default['default'].createElement("div", {
2475
- key: v,
2476
- className: "luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-".concat(v),
2477
- "data-type": v,
2478
- onMouseDown: function onMouseDown(e) {
2479
- var nativeEvent = e.nativeEvent;
2480
- fortuneCore.onCommentBoxResizeStart(context, refs.globalCache, nativeEvent, {
2481
- r: r,
2482
- c: c,
2483
- rc: rc
2484
- }, commentId, v);
2485
- e.stopPropagation();
2486
- }
2487
- });
2488
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
2489
2465
  style: {
2490
2466
  width: "100%",
2491
2467
  height: "100%",
2492
2468
  overflow: "hidden"
2493
2469
  }
2494
- }, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
2495
- id: "comment-editor-".concat(rc),
2496
- autoFocus: autoFocus,
2497
- style: {
2498
- width: "100%",
2499
- height: "100%",
2500
- lineHeight: "20px",
2501
- boxSizing: "border-box",
2502
- textAlign: "center",
2503
- wordBreak: "break-all",
2504
- outline: "none"
2505
- },
2506
- allowEdit: context.allowEdit,
2507
- spellCheck: false,
2508
- "data-r": r,
2509
- "data-c": c,
2510
- onKeyDown: function onKeyDown(e) {
2511
- return e.stopPropagation();
2512
- },
2513
- onFocus: function onFocus(e) {
2514
- if (context.allowEdit === false) return;
2515
- refs.globalCache.editingCommentBoxEle = e.target;
2516
- },
2517
- onMouseDown: function onMouseDown(e) {
2518
- setContext(function (draftContext) {
2519
- if (flowdata) {
2520
- fortuneCore.setEditingComment(draftContext, flowdata, r, c);
2521
- }
2522
- });
2523
- e.stopPropagation();
2524
- },
2525
- onDoubleClick: function onDoubleClick(e) {
2526
- e.stopPropagation();
2527
- },
2528
- initialContent: value
2529
- }))));
2470
+ }, (_settings$getCommentC = settings.getCommentCellUI) === null || _settings$getCommentC === void 0 ? void 0 : _settings$getCommentC.call(settings, r, c))));
2530
2471
  }));
2531
2472
  };
2532
2473
 
@@ -7618,6 +7559,17 @@ var ContextMenu = function ContextMenu() {
7618
7559
  key: "divider-".concat(i)
7619
7560
  });
7620
7561
  }
7562
+ if (name === "comment") {
7563
+ return /*#__PURE__*/React__default['default'].createElement(Menu, {
7564
+ key: name,
7565
+ onClick: function onClick() {
7566
+ setContext(function (draftCtx) {
7567
+ fortuneCore.newComment(draftCtx, refs.globalCache, selection === null || selection === void 0 ? void 0 : selection.row_focus, selection === null || selection === void 0 ? void 0 : selection.column_focus);
7568
+ draftCtx.contextMenu = {};
7569
+ });
7570
+ }
7571
+ }, "Comment");
7572
+ }
7621
7573
  if (name === "copy") {
7622
7574
  return /*#__PURE__*/React__default['default'].createElement(Menu, {
7623
7575
  key: name,
@@ -10010,8 +9962,49 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
10010
9962
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10011
9963
  return fortuneCore.api.getCellValue(context, row, column, options);
10012
9964
  },
10013
- testApi: function testApi() {
10014
- console.log("Test API");
9965
+ onboardingActiveCell: function onboardingActiveCell(functionName) {
9966
+ var _context$luckysheet_s;
9967
+ var _locale = fortuneCore.locale(context),
9968
+ functionlist = _locale.functionlist;
9969
+ var last = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[context.luckysheet_select_save.length - 1];
9970
+ var row_index = last === null || last === void 0 ? void 0 : last.row_focus;
9971
+ var col_index = last === null || last === void 0 ? void 0 : last.column_focus;
9972
+ if (!last) {
9973
+ row_index = 0;
9974
+ col_index = 0;
9975
+ } else {
9976
+ if (row_index == null) {
9977
+ var _last$row = _slicedToArray(last.row, 1);
9978
+ row_index = _last$row[0];
9979
+ }
9980
+ if (col_index == null) {
9981
+ var _last$column = _slicedToArray(last.column, 1);
9982
+ col_index = _last$column[0];
9983
+ }
9984
+ }
9985
+ var formulaTxt = "<span>=</span><span>".concat(functionName, "</span><span>(</span>");
9986
+ setContext(function (ctx) {
9987
+ if (cellInput != null) {
9988
+ ctx.luckysheetCellUpdate = [row_index, col_index];
9989
+ cellInput.innerHTML = formulaTxt;
9990
+ var spans = cellInput.childNodes;
9991
+ if (!___default['default'].isEmpty(spans)) {
9992
+ fortuneCore.setCaretPosition(ctx, spans[spans.length - 1], 0, 1);
9993
+ }
9994
+ ctx.functionHint = functionName;
9995
+ ctx.functionCandidates = [];
9996
+ if (___default['default'].isEmpty(ctx.formulaCache.functionlistMap)) {
9997
+ for (var i = 0; i < functionlist.length; i += 1) {
9998
+ ctx.formulaCache.functionlistMap[functionlist[i].n] = functionlist[i];
9999
+ }
10000
+ }
10001
+ }
10002
+ });
10003
+ },
10004
+ initializeComment: function initializeComment(row, column) {
10005
+ setContext(function (ctx) {
10006
+ fortuneCore.newComment(ctx, undefined, row, column);
10007
+ });
10015
10008
  },
10016
10009
  setCellValue: function setCellValue(row, column, value) {
10017
10010
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};