@leankylin-sheet/core 4.0.35 → 4.0.36

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/context.d.ts CHANGED
@@ -19,6 +19,7 @@ export type CellOptions = {
19
19
  render: any;
20
20
  }[];
21
21
  export type Context = {
22
+ active_f?: any;
22
23
  headerBgColor?: string;
23
24
  dragRangeSelect?: {
24
25
  top: number;
package/dist/index.esm.js CHANGED
@@ -35379,6 +35379,9 @@ function valueShowEs(r, c, d) {
35379
35379
  }
35380
35380
 
35381
35381
  var colors = ["#c1232b", "#27727b", "#fcce10", "#e87c25", "#b5c334", "#fe8463", "#9bca63", "#fad860", "#f3a43b", "#60c0dd", "#d7504b", "#c6e579", "#f4e001", "#f0805a", "#26c0c0", "#c12e34", "#e6b600", "#0098d9", "#2b821d", "#005eaa", "#339ca8", "#cda819", "#32a487", "#3fb1e3", "#6be6c1", "#626c91", "#a0a7e6", "#c4ebad", "#96dee8"];
35382
+ function getHLColor(index) {
35383
+ return colors[index % colors.length];
35384
+ }
35382
35385
 
35383
35386
  function mousePosition(x, y, ctx) {
35384
35387
  var newX = x - ctx.rowHeaderWidth;
@@ -36559,7 +36562,7 @@ function createRangeHightlight(ctx, inputInnerHtmlStr) {
36559
36562
  formulaRanges.push(_objectSpread2(_objectSpread2({
36560
36563
  rangeIndex: rangeIndex
36561
36564
  }, rect), {}, {
36562
- backgroundColor: colors[rangeIndex]
36565
+ backgroundColor: getHLColor(rangeIndex)
36563
36566
  }));
36564
36567
  }
36565
36568
  }
@@ -36823,7 +36826,7 @@ function functionHTML(txt) {
36823
36826
  if (i === funcstack.length - 1) {
36824
36827
  if (iscelldata(_.trim(str))) {
36825
36828
  var rangeIndex = rangeIndexes.length > functionHTMLIndex ? rangeIndexes[functionHTMLIndex] : functionHTMLIndex;
36826
- function_str += "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(rangeIndex, "\" dir=\"auto\" style=\"color:").concat(colors[rangeIndex], ";\">").concat(str, "</span>");
36829
+ function_str += "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(rangeIndex, "\" dir=\"auto\" style=\"color:").concat(getHLColor(rangeIndex), ";\">").concat(str, "</span>");
36827
36830
  functionHTMLIndex += 1;
36828
36831
  } else if (matchConfig.dquote > 0) {
36829
36832
  function_str += "".concat(str, "</span>");
@@ -37285,7 +37288,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step, sheetName, isCu
37285
37288
  return function_str;
37286
37289
  }
37287
37290
  function rangeSetValue(ctx, cellInput, selected, fxInput) {
37288
- var _document$activeEleme;
37291
+ var _document$activeEleme, _ctx$active_f;
37289
37292
  var $editor = cellInput;
37290
37293
  var $copyTo = fxInput;
37291
37294
  if (((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) === "luckysheet-functionbox-cell") {
@@ -37295,13 +37298,14 @@ function rangeSetValue(ctx, cellInput, selected, fxInput) {
37295
37298
  var range = "";
37296
37299
  var rf = selected.row[0];
37297
37300
  var cf = selected.column[0];
37301
+ var sheetId = ((_ctx$active_f = ctx.active_f) === null || _ctx$active_f === void 0 ? void 0 : _ctx$active_f.sheetId) || ctx.formulaCache.rangetosheet;
37298
37302
  if (ctx.config.merge != null && "".concat(rf, "_").concat(cf) in ctx.config.merge) {
37299
37303
  range = getRangetxt(ctx, ctx.currentSheetId, {
37300
37304
  column: [cf, cf],
37301
37305
  row: [rf, rf]
37302
- }, ctx.formulaCache.rangetosheet);
37306
+ }, sheetId);
37303
37307
  } else {
37304
- range = getRangetxt(ctx, ctx.currentSheetId, selected, ctx.formulaCache.rangetosheet);
37308
+ range = getRangetxt(ctx, ctx.currentSheetId, selected, sheetId);
37305
37309
  }
37306
37310
  if (!israngeseleciton(ctx) && (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start)) {
37307
37311
  var span = $editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex, "']"));
@@ -37309,8 +37313,8 @@ function rangeSetValue(ctx, cellInput, selected, fxInput) {
37309
37313
  span.innerHTML = range;
37310
37314
  setCaretPosition(ctx, span, 0, range.length);
37311
37315
  }
37312
- } else {
37313
- var function_str = "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex, "\" dir=\"auto\" style=\"color:").concat(colors[functionHTMLIndex], ";\">").concat(range, "</span>");
37316
+ } else if (ctx.active_f) {
37317
+ var function_str = "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex, "\" dir=\"auto\" style=\"color:").concat(getHLColor(functionHTMLIndex), ";\">").concat(range, "</span>");
37314
37318
  var newEle = parseElement(function_str);
37315
37319
  var refEle = ctx.formulaCache.rangeSetValueTo;
37316
37320
  if (refEle && refEle.parentNode) {
@@ -37322,6 +37326,19 @@ function rangeSetValue(ctx, cellInput, selected, fxInput) {
37322
37326
  var _span = $editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex, "']"));
37323
37327
  setCaretPosition(ctx, _span, 0, range.length);
37324
37328
  functionHTMLIndex += 1;
37329
+ } else {
37330
+ var _function_str = "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex, "\" dir=\"auto\" style=\"color:").concat(getHLColor(functionHTMLIndex), ";\">").concat(range, "</span>");
37331
+ var _newEle = parseElement(_function_str);
37332
+ var _refEle = ctx.formulaCache.rangeSetValueTo;
37333
+ if (_refEle && _refEle.parentNode) {
37334
+ _refEle.parentNode.insertBefore(_newEle, _refEle.nextSibling);
37335
+ } else {
37336
+ $editor.appendChild(_newEle);
37337
+ }
37338
+ ctx.formulaCache.rangechangeindex = functionHTMLIndex;
37339
+ var _span2 = $editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex, "']"));
37340
+ setCaretPosition(ctx, _span2, 0, range.length);
37341
+ functionHTMLIndex += 1;
37325
37342
  }
37326
37343
  if ($copyTo) $copyTo.innerHTML = $editor.innerHTML;
37327
37344
  }
@@ -40181,11 +40198,11 @@ function cancelNormalSelected(ctx) {
40181
40198
  ctx.formulaCache.rangedrag_column_start = false;
40182
40199
  ctx.formulaCache.rangedrag_row_start = false;
40183
40200
  }
40184
- function updateCell(ctx, r, c, $input, value, canvas) {
40201
+ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
40185
40202
  var _inputText, _curv, _ctx$hooks$beforeUpda, _ctx$hooks, _curv2;
40186
40203
  var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
40187
40204
  var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
40188
- var flowdata = getFlowdata(ctx);
40205
+ var flowdata = getFlowdata(ctx, sheetId);
40189
40206
  if (!flowdata) return;
40190
40207
  var index = getSheetIndex(ctx, ctx.currentSheetId);
40191
40208
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
@@ -56467,7 +56484,7 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
56467
56484
  ctx.luckysheet_selection_range = [];
56468
56485
  }
56469
56486
  var allowEdit = isAllowEdit(ctx);
56470
- if (ctx.luckysheetCellUpdate.length > 0 && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
56487
+ if ((ctx.luckysheetCellUpdate.length > 0 || ctx.active_f) && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
56471
56488
  return;
56472
56489
  }
56473
56490
  if (kstr === "Enter") {
@@ -56648,8 +56665,8 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
56648
56665
  if (isInSelection) return;
56649
56666
  }
56650
56667
  ctx.luckysheet_scroll_status = true;
56651
- if (ctx.luckysheetCellUpdate.length > 0) {
56652
- if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
56668
+ if (ctx.luckysheetCellUpdate.length > 0 || ctx.active_f) {
56669
+ if (ctx.active_f || ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
56653
56670
  var _$last;
56654
56671
  var rowseleted = [row_index, row_index_ed];
56655
56672
  var columnseleted = [col_index, col_index_ed];
@@ -56768,7 +56785,7 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
56768
56785
  row_focus: row_index,
56769
56786
  column_focus: col_index
56770
56787
  };
56771
- } else {
56788
+ } else if (ctx.active_f) ; else {
56772
56789
  ctx.formulaCache.func_selectedrange = {
56773
56790
  left: left,
56774
56791
  width: width,
@@ -60063,4 +60080,4 @@ function handlePasteByClick(ctx, triggerType) {
60063
60080
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
60064
60081
  }
60065
60082
 
60066
- export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, copy2, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaDragOver, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellDrop, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
60083
+ export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, copy2, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHLColor, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaDragOver, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellDrop, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
package/dist/index.js CHANGED
@@ -35389,6 +35389,9 @@ function valueShowEs(r, c, d) {
35389
35389
  }
35390
35390
 
35391
35391
  var colors = ["#c1232b", "#27727b", "#fcce10", "#e87c25", "#b5c334", "#fe8463", "#9bca63", "#fad860", "#f3a43b", "#60c0dd", "#d7504b", "#c6e579", "#f4e001", "#f0805a", "#26c0c0", "#c12e34", "#e6b600", "#0098d9", "#2b821d", "#005eaa", "#339ca8", "#cda819", "#32a487", "#3fb1e3", "#6be6c1", "#626c91", "#a0a7e6", "#c4ebad", "#96dee8"];
35392
+ function getHLColor(index) {
35393
+ return colors[index % colors.length];
35394
+ }
35392
35395
 
35393
35396
  function mousePosition(x, y, ctx) {
35394
35397
  var newX = x - ctx.rowHeaderWidth;
@@ -36569,7 +36572,7 @@ function createRangeHightlight(ctx, inputInnerHtmlStr) {
36569
36572
  formulaRanges.push(_objectSpread2(_objectSpread2({
36570
36573
  rangeIndex: rangeIndex
36571
36574
  }, rect), {}, {
36572
- backgroundColor: colors[rangeIndex]
36575
+ backgroundColor: getHLColor(rangeIndex)
36573
36576
  }));
36574
36577
  }
36575
36578
  }
@@ -36833,7 +36836,7 @@ function functionHTML(txt) {
36833
36836
  if (i === funcstack.length - 1) {
36834
36837
  if (iscelldata(___default['default'].trim(str))) {
36835
36838
  var rangeIndex = rangeIndexes.length > functionHTMLIndex ? rangeIndexes[functionHTMLIndex] : functionHTMLIndex;
36836
- function_str += "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(rangeIndex, "\" dir=\"auto\" style=\"color:").concat(colors[rangeIndex], ";\">").concat(str, "</span>");
36839
+ function_str += "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(rangeIndex, "\" dir=\"auto\" style=\"color:").concat(getHLColor(rangeIndex), ";\">").concat(str, "</span>");
36837
36840
  functionHTMLIndex += 1;
36838
36841
  } else if (matchConfig.dquote > 0) {
36839
36842
  function_str += "".concat(str, "</span>");
@@ -37295,7 +37298,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step, sheetName, isCu
37295
37298
  return function_str;
37296
37299
  }
37297
37300
  function rangeSetValue(ctx, cellInput, selected, fxInput) {
37298
- var _document$activeEleme;
37301
+ var _document$activeEleme, _ctx$active_f;
37299
37302
  var $editor = cellInput;
37300
37303
  var $copyTo = fxInput;
37301
37304
  if (((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) === "luckysheet-functionbox-cell") {
@@ -37305,13 +37308,14 @@ function rangeSetValue(ctx, cellInput, selected, fxInput) {
37305
37308
  var range = "";
37306
37309
  var rf = selected.row[0];
37307
37310
  var cf = selected.column[0];
37311
+ var sheetId = ((_ctx$active_f = ctx.active_f) === null || _ctx$active_f === void 0 ? void 0 : _ctx$active_f.sheetId) || ctx.formulaCache.rangetosheet;
37308
37312
  if (ctx.config.merge != null && "".concat(rf, "_").concat(cf) in ctx.config.merge) {
37309
37313
  range = getRangetxt(ctx, ctx.currentSheetId, {
37310
37314
  column: [cf, cf],
37311
37315
  row: [rf, rf]
37312
- }, ctx.formulaCache.rangetosheet);
37316
+ }, sheetId);
37313
37317
  } else {
37314
- range = getRangetxt(ctx, ctx.currentSheetId, selected, ctx.formulaCache.rangetosheet);
37318
+ range = getRangetxt(ctx, ctx.currentSheetId, selected, sheetId);
37315
37319
  }
37316
37320
  if (!israngeseleciton(ctx) && (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start)) {
37317
37321
  var span = $editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex, "']"));
@@ -37319,8 +37323,8 @@ function rangeSetValue(ctx, cellInput, selected, fxInput) {
37319
37323
  span.innerHTML = range;
37320
37324
  setCaretPosition(ctx, span, 0, range.length);
37321
37325
  }
37322
- } else {
37323
- var function_str = "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex, "\" dir=\"auto\" style=\"color:").concat(colors[functionHTMLIndex], ";\">").concat(range, "</span>");
37326
+ } else if (ctx.active_f) {
37327
+ var function_str = "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex, "\" dir=\"auto\" style=\"color:").concat(getHLColor(functionHTMLIndex), ";\">").concat(range, "</span>");
37324
37328
  var newEle = parseElement(function_str);
37325
37329
  var refEle = ctx.formulaCache.rangeSetValueTo;
37326
37330
  if (refEle && refEle.parentNode) {
@@ -37332,6 +37336,19 @@ function rangeSetValue(ctx, cellInput, selected, fxInput) {
37332
37336
  var _span = $editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex, "']"));
37333
37337
  setCaretPosition(ctx, _span, 0, range.length);
37334
37338
  functionHTMLIndex += 1;
37339
+ } else {
37340
+ var _function_str = "<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex, "\" dir=\"auto\" style=\"color:").concat(getHLColor(functionHTMLIndex), ";\">").concat(range, "</span>");
37341
+ var _newEle = parseElement(_function_str);
37342
+ var _refEle = ctx.formulaCache.rangeSetValueTo;
37343
+ if (_refEle && _refEle.parentNode) {
37344
+ _refEle.parentNode.insertBefore(_newEle, _refEle.nextSibling);
37345
+ } else {
37346
+ $editor.appendChild(_newEle);
37347
+ }
37348
+ ctx.formulaCache.rangechangeindex = functionHTMLIndex;
37349
+ var _span2 = $editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex, "']"));
37350
+ setCaretPosition(ctx, _span2, 0, range.length);
37351
+ functionHTMLIndex += 1;
37335
37352
  }
37336
37353
  if ($copyTo) $copyTo.innerHTML = $editor.innerHTML;
37337
37354
  }
@@ -40191,11 +40208,11 @@ function cancelNormalSelected(ctx) {
40191
40208
  ctx.formulaCache.rangedrag_column_start = false;
40192
40209
  ctx.formulaCache.rangedrag_row_start = false;
40193
40210
  }
40194
- function updateCell(ctx, r, c, $input, value, canvas) {
40211
+ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
40195
40212
  var _inputText, _curv, _ctx$hooks$beforeUpda, _ctx$hooks, _curv2;
40196
40213
  var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
40197
40214
  var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
40198
- var flowdata = getFlowdata(ctx);
40215
+ var flowdata = getFlowdata(ctx, sheetId);
40199
40216
  if (!flowdata) return;
40200
40217
  var index = getSheetIndex(ctx, ctx.currentSheetId);
40201
40218
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
@@ -56477,7 +56494,7 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
56477
56494
  ctx.luckysheet_selection_range = [];
56478
56495
  }
56479
56496
  var allowEdit = isAllowEdit(ctx);
56480
- if (ctx.luckysheetCellUpdate.length > 0 && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
56497
+ if ((ctx.luckysheetCellUpdate.length > 0 || ctx.active_f) && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
56481
56498
  return;
56482
56499
  }
56483
56500
  if (kstr === "Enter") {
@@ -56658,8 +56675,8 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
56658
56675
  if (isInSelection) return;
56659
56676
  }
56660
56677
  ctx.luckysheet_scroll_status = true;
56661
- if (ctx.luckysheetCellUpdate.length > 0) {
56662
- if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
56678
+ if (ctx.luckysheetCellUpdate.length > 0 || ctx.active_f) {
56679
+ if (ctx.active_f || ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
56663
56680
  var _$last;
56664
56681
  var rowseleted = [row_index, row_index_ed];
56665
56682
  var columnseleted = [col_index, col_index_ed];
@@ -56778,7 +56795,7 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
56778
56795
  row_focus: row_index,
56779
56796
  column_focus: col_index
56780
56797
  };
56781
- } else {
56798
+ } else if (ctx.active_f) ; else {
56782
56799
  ctx.formulaCache.func_selectedrange = {
56783
56800
  left: left,
56784
56801
  width: width,
@@ -60182,6 +60199,7 @@ exports.getFontSet = getFontSet;
60182
60199
  exports.getFontStyleByCell = getFontStyleByCell;
60183
60200
  exports.getFrozenHandleLeft = getFrozenHandleLeft;
60184
60201
  exports.getFrozenHandleTop = getFrozenHandleTop;
60202
+ exports.getHLColor = getHLColor;
60185
60203
  exports.getHintText = getHintText;
60186
60204
  exports.getHistoryRules = getHistoryRules;
60187
60205
  exports.getInlineStringHTML = getInlineStringHTML;
@@ -12,7 +12,7 @@ export declare function mergeBorder(ctx: Context, d: CellMatrix, row_index: numb
12
12
  export declare function mergeMoveMain(ctx: Context, columnseleted: number[], rowseleted: number[], s: Partial<Selection>, top: number, height: number, left: number, width: number): (number | number[])[] | null;
13
13
  export declare function cancelFunctionrangeSelected(ctx: Context): void;
14
14
  export declare function cancelNormalSelected(ctx: Context): void;
15
- export declare function updateCell(ctx: Context, r: number, c: number, $input?: HTMLDivElement | null, value?: any, canvas?: CanvasRenderingContext2D): void;
15
+ export declare function updateCell(ctx: Context, r: number, c: number, $input?: HTMLDivElement | null, value?: any, canvas?: CanvasRenderingContext2D, sheetId?: string): void;
16
16
  export declare function getOrigincell(ctx: Context, r: number, c: number, i: string): Cell | null;
17
17
  export declare function getcellFormula(ctx: Context, r: number, c: number, i: string, data?: any): any;
18
18
  export declare function getRange(ctx: Context): Range;
@@ -1 +1,2 @@
1
1
  export declare const colors: string[];
2
+ export declare function getHLColor(index: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "4.0.35",
3
+ "version": "4.0.36",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "father-build"
14
14
  },
15
15
  "dependencies": {
16
- "@leankylin-sheet/formula-parser": "4.0.35",
16
+ "@leankylin-sheet/formula-parser": "4.0.36",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",