@leankylin-sheet/core 5.2.49 → 5.2.51

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
@@ -50389,6 +50389,28 @@ function hideDropCellSelection(container) {
50389
50389
  selectedExtend.style.display = "none";
50390
50390
  }
50391
50391
  }
50392
+ function rowLocationWithThreshold(y, visibleRow) {
50393
+ var _rowLocation = rowLocation(y, visibleRow),
50394
+ _rowLocation2 = _slicedToArray(_rowLocation, 3),
50395
+ row_pre = _rowLocation2[0],
50396
+ row = _rowLocation2[1],
50397
+ row_index = _rowLocation2[2];
50398
+ if (row_index > 0 && y < (row_pre + row) / 2) {
50399
+ return rowLocationByIndex(row_index - 1, visibleRow);
50400
+ }
50401
+ return [row_pre, row, row_index];
50402
+ }
50403
+ function colLocationWithThreshold(x, visibleCol) {
50404
+ var _colLocation = colLocation(x, visibleCol),
50405
+ _colLocation2 = _slicedToArray(_colLocation, 3),
50406
+ col_pre = _colLocation2[0],
50407
+ col = _colLocation2[1],
50408
+ col_index = _colLocation2[2];
50409
+ if (col_index > 0 && x < (col_pre + col) / 2) {
50410
+ return colLocationByIndex(col_index - 1, visibleCol);
50411
+ }
50412
+ return [col_pre, col, col_index];
50413
+ }
50392
50414
  function createDropCellRange(ctx, e, container) {
50393
50415
  ctx.luckysheet_cell_selected_extend = true;
50394
50416
  ctx.luckysheet_scroll_status = true;
@@ -50397,11 +50419,11 @@ function createDropCellRange(ctx, e, container) {
50397
50419
  var rect = container.getBoundingClientRect();
50398
50420
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft;
50399
50421
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop;
50400
- var row_location = rowLocation(y, ctx.visibledatarow);
50422
+ var row_location = rowLocationWithThreshold(y, ctx.visibledatarow);
50401
50423
  var row_pre = row_location[0];
50402
50424
  var row = row_location[1];
50403
50425
  var row_index = row_location[2];
50404
- var col_location = colLocation(x, ctx.visibledatacolumn);
50426
+ var col_location = colLocationWithThreshold(x, ctx.visibledatacolumn);
50405
50427
  var col_pre = col_location[0];
50406
50428
  var col = col_location[1];
50407
50429
  var col_index = col_location[2];
@@ -50419,11 +50441,11 @@ function onDropCellSelect(ctx, e, scrollX, scrollY, container) {
50419
50441
  var rect = container.getBoundingClientRect();
50420
50442
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft;
50421
50443
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop;
50422
- var row_location = rowLocation(y, ctx.visibledatarow);
50444
+ var row_location = rowLocationWithThreshold(y, ctx.visibledatarow);
50423
50445
  var row = row_location[1];
50424
50446
  var row_pre = row_location[0];
50425
50447
  var row_index = row_location[2];
50426
- var col_location = colLocation(x, ctx.visibledatacolumn);
50448
+ var col_location = colLocationWithThreshold(x, ctx.visibledatacolumn);
50427
50449
  var col = col_location[1];
50428
50450
  var col_pre = col_location[0];
50429
50451
  var col_index = col_location[2];
@@ -52245,10 +52267,10 @@ function onDropCellSelectEnd(ctx, e, container) {
52245
52267
  var rect = container.getBoundingClientRect();
52246
52268
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft;
52247
52269
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop;
52248
- var row_location = rowLocation(y, ctx.visibledatarow);
52270
+ var row_location = rowLocationWithThreshold(y, ctx.visibledatarow);
52249
52271
  var row_pre = row_location[0];
52250
52272
  var row_index = row_location[2];
52251
- var col_location = colLocation(x, ctx.visibledatacolumn);
52273
+ var col_location = colLocationWithThreshold(x, ctx.visibledatacolumn);
52252
52274
  var col_pre = col_location[0];
52253
52275
  var col_index = col_location[2];
52254
52276
  var row_index_original = ctx.luckysheet_cell_selected_extend_index[0];
@@ -52369,6 +52391,111 @@ function onDropCellSelectEnd(ctx, e, container) {
52369
52391
  }
52370
52392
  }
52371
52393
  }
52394
+ function getFirstNonEmptyRowBelow(flowdata, col, startRow) {
52395
+ for (var r = startRow; r < flowdata.length; r += 1) {
52396
+ var _flowdata$r2;
52397
+ var cell = (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : _flowdata$r2[col];
52398
+ if (cell != null && cell.v != null && cell.v !== "") {
52399
+ return r;
52400
+ }
52401
+ }
52402
+ return -1;
52403
+ }
52404
+ function getLastConsecutiveNonEmptyRow(flowdata, col, startRow) {
52405
+ var endRow = -1;
52406
+ for (var r = startRow; r < flowdata.length; r += 1) {
52407
+ var _flowdata$r3;
52408
+ var cell = (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : _flowdata$r3[col];
52409
+ if (cell != null && cell.v != null && cell.v !== "") {
52410
+ endRow = r;
52411
+ } else {
52412
+ break;
52413
+ }
52414
+ }
52415
+ return endRow;
52416
+ }
52417
+ function handleDropCellDoubleClick(ctx, container) {
52418
+ var _ctx$luckysheet_selec5;
52419
+ ctx.luckysheet_cell_selected_extend = false;
52420
+ hideDropCellSelection(container);
52421
+ var last = (_ctx$luckysheet_selec5 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec5 === void 0 ? void 0 : _ctx$luckysheet_selec5[ctx.luckysheet_select_save.length - 1];
52422
+ if (!last || last.top == null || last.left == null || last.height == null || last.width == null || last.row_focus == null || last.column_focus == null) {
52423
+ return;
52424
+ }
52425
+ var flowdata = getFlowdata(ctx);
52426
+ if (flowdata == null) return;
52427
+ var _last$row2 = _slicedToArray(last.row, 2),
52428
+ row_s = _last$row2[0],
52429
+ row_e = _last$row2[1];
52430
+ var _last$column2 = _slicedToArray(last.column, 2),
52431
+ col_s = _last$column2[0],
52432
+ col_e = _last$column2[1];
52433
+ dropCellCache.copyRange = _.cloneDeep(_.pick(last, ["row", "column"]));
52434
+ var typeItemHide = getTypeItemHide(ctx);
52435
+ if (!typeItemHide[0] && !typeItemHide[1] && !typeItemHide[2] && !typeItemHide[3] && !typeItemHide[4] && !typeItemHide[5] && !typeItemHide[6]) {
52436
+ dropCellCache.applyType = "0";
52437
+ } else {
52438
+ dropCellCache.applyType = "1";
52439
+ }
52440
+ var refCol = col_s - 1;
52441
+ if (refCol < 0 || getFirstNonEmptyRowBelow(flowdata, refCol, row_e + 1) === -1) {
52442
+ refCol = col_e + 1;
52443
+ if (refCol >= ctx.visibledatacolumn.length || getFirstNonEmptyRowBelow(flowdata, refCol, row_e + 1) === -1) {
52444
+ return;
52445
+ }
52446
+ }
52447
+ var endRow = getLastConsecutiveNonEmptyRow(flowdata, refCol, row_e + 1);
52448
+ if (endRow === -1) {
52449
+ return;
52450
+ }
52451
+ if (ctx.config.merge != null) {
52452
+ var HasMC = false;
52453
+ for (var r = last.row[0]; r <= last.row[1]; r += 1) {
52454
+ for (var c = last.column[0]; c <= last.column[1]; c += 1) {
52455
+ var _flowdata$r4;
52456
+ var cell = (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c];
52457
+ if (cell != null && cell.mc != null) {
52458
+ HasMC = true;
52459
+ break;
52460
+ }
52461
+ }
52462
+ }
52463
+ if (HasMC) {
52464
+ return;
52465
+ }
52466
+ for (var _r2 = last.row[1] + 1; _r2 <= endRow; _r2 += 1) {
52467
+ for (var _c2 = col_s; _c2 <= col_e; _c2 += 1) {
52468
+ var _flowdata$_r2;
52469
+ var _cell5 = (_flowdata$_r2 = flowdata[_r2]) === null || _flowdata$_r2 === void 0 ? void 0 : _flowdata$_r2[_c2];
52470
+ if (_cell5 != null && _cell5.mc != null) {
52471
+ HasMC = true;
52472
+ break;
52473
+ }
52474
+ }
52475
+ }
52476
+ if (HasMC) {
52477
+ return;
52478
+ }
52479
+ }
52480
+ dropCellCache.applyRange = {
52481
+ row: [row_e + 1, endRow],
52482
+ column: [col_s, col_e]
52483
+ };
52484
+ dropCellCache.direction = "down";
52485
+ ctx.luckysheet_select_save = normalizeSelection(ctx, [{
52486
+ row: [row_s, endRow],
52487
+ column: [col_s, col_e]
52488
+ }]);
52489
+ try {
52490
+ updateDropCell(ctx);
52491
+ } catch (err) {
52492
+ console.error(err);
52493
+ }
52494
+ var selectedMoveEle = container.querySelector(".leankylin-cell-selected-move");
52495
+ if (selectedMoveEle) {
52496
+ selectedMoveEle.style.display = "none";
52497
+ }
52498
+ }
52372
52499
 
52373
52500
  var defaultStyle = {
52374
52501
  fillStyle: "#000000",
@@ -60952,4 +61079,4 @@ function handlePasteByClick(ctx, triggerType) {
60952
61079
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
60953
61080
  }
60954
61081
 
60955
- 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, escapeRegExpStr, 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, setNextSheet, 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 };
61082
+ 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, escapeRegExpStr, 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, handleDropCellDoubleClick, 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, setNextSheet, 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
@@ -50399,6 +50399,28 @@ function hideDropCellSelection(container) {
50399
50399
  selectedExtend.style.display = "none";
50400
50400
  }
50401
50401
  }
50402
+ function rowLocationWithThreshold(y, visibleRow) {
50403
+ var _rowLocation = rowLocation(y, visibleRow),
50404
+ _rowLocation2 = _slicedToArray(_rowLocation, 3),
50405
+ row_pre = _rowLocation2[0],
50406
+ row = _rowLocation2[1],
50407
+ row_index = _rowLocation2[2];
50408
+ if (row_index > 0 && y < (row_pre + row) / 2) {
50409
+ return rowLocationByIndex(row_index - 1, visibleRow);
50410
+ }
50411
+ return [row_pre, row, row_index];
50412
+ }
50413
+ function colLocationWithThreshold(x, visibleCol) {
50414
+ var _colLocation = colLocation(x, visibleCol),
50415
+ _colLocation2 = _slicedToArray(_colLocation, 3),
50416
+ col_pre = _colLocation2[0],
50417
+ col = _colLocation2[1],
50418
+ col_index = _colLocation2[2];
50419
+ if (col_index > 0 && x < (col_pre + col) / 2) {
50420
+ return colLocationByIndex(col_index - 1, visibleCol);
50421
+ }
50422
+ return [col_pre, col, col_index];
50423
+ }
50402
50424
  function createDropCellRange(ctx, e, container) {
50403
50425
  ctx.luckysheet_cell_selected_extend = true;
50404
50426
  ctx.luckysheet_scroll_status = true;
@@ -50407,11 +50429,11 @@ function createDropCellRange(ctx, e, container) {
50407
50429
  var rect = container.getBoundingClientRect();
50408
50430
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft;
50409
50431
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop;
50410
- var row_location = rowLocation(y, ctx.visibledatarow);
50432
+ var row_location = rowLocationWithThreshold(y, ctx.visibledatarow);
50411
50433
  var row_pre = row_location[0];
50412
50434
  var row = row_location[1];
50413
50435
  var row_index = row_location[2];
50414
- var col_location = colLocation(x, ctx.visibledatacolumn);
50436
+ var col_location = colLocationWithThreshold(x, ctx.visibledatacolumn);
50415
50437
  var col_pre = col_location[0];
50416
50438
  var col = col_location[1];
50417
50439
  var col_index = col_location[2];
@@ -50429,11 +50451,11 @@ function onDropCellSelect(ctx, e, scrollX, scrollY, container) {
50429
50451
  var rect = container.getBoundingClientRect();
50430
50452
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft;
50431
50453
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop;
50432
- var row_location = rowLocation(y, ctx.visibledatarow);
50454
+ var row_location = rowLocationWithThreshold(y, ctx.visibledatarow);
50433
50455
  var row = row_location[1];
50434
50456
  var row_pre = row_location[0];
50435
50457
  var row_index = row_location[2];
50436
- var col_location = colLocation(x, ctx.visibledatacolumn);
50458
+ var col_location = colLocationWithThreshold(x, ctx.visibledatacolumn);
50437
50459
  var col = col_location[1];
50438
50460
  var col_pre = col_location[0];
50439
50461
  var col_index = col_location[2];
@@ -52255,10 +52277,10 @@ function onDropCellSelectEnd(ctx, e, container) {
52255
52277
  var rect = container.getBoundingClientRect();
52256
52278
  var x = e.pageX - rect.left - ctx.rowHeaderWidth + scrollLeft;
52257
52279
  var y = e.pageY - rect.top - ctx.columnHeaderHeight + scrollTop;
52258
- var row_location = rowLocation(y, ctx.visibledatarow);
52280
+ var row_location = rowLocationWithThreshold(y, ctx.visibledatarow);
52259
52281
  var row_pre = row_location[0];
52260
52282
  var row_index = row_location[2];
52261
- var col_location = colLocation(x, ctx.visibledatacolumn);
52283
+ var col_location = colLocationWithThreshold(x, ctx.visibledatacolumn);
52262
52284
  var col_pre = col_location[0];
52263
52285
  var col_index = col_location[2];
52264
52286
  var row_index_original = ctx.luckysheet_cell_selected_extend_index[0];
@@ -52379,6 +52401,111 @@ function onDropCellSelectEnd(ctx, e, container) {
52379
52401
  }
52380
52402
  }
52381
52403
  }
52404
+ function getFirstNonEmptyRowBelow(flowdata, col, startRow) {
52405
+ for (var r = startRow; r < flowdata.length; r += 1) {
52406
+ var _flowdata$r2;
52407
+ var cell = (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : _flowdata$r2[col];
52408
+ if (cell != null && cell.v != null && cell.v !== "") {
52409
+ return r;
52410
+ }
52411
+ }
52412
+ return -1;
52413
+ }
52414
+ function getLastConsecutiveNonEmptyRow(flowdata, col, startRow) {
52415
+ var endRow = -1;
52416
+ for (var r = startRow; r < flowdata.length; r += 1) {
52417
+ var _flowdata$r3;
52418
+ var cell = (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : _flowdata$r3[col];
52419
+ if (cell != null && cell.v != null && cell.v !== "") {
52420
+ endRow = r;
52421
+ } else {
52422
+ break;
52423
+ }
52424
+ }
52425
+ return endRow;
52426
+ }
52427
+ function handleDropCellDoubleClick(ctx, container) {
52428
+ var _ctx$luckysheet_selec5;
52429
+ ctx.luckysheet_cell_selected_extend = false;
52430
+ hideDropCellSelection(container);
52431
+ var last = (_ctx$luckysheet_selec5 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec5 === void 0 ? void 0 : _ctx$luckysheet_selec5[ctx.luckysheet_select_save.length - 1];
52432
+ if (!last || last.top == null || last.left == null || last.height == null || last.width == null || last.row_focus == null || last.column_focus == null) {
52433
+ return;
52434
+ }
52435
+ var flowdata = getFlowdata(ctx);
52436
+ if (flowdata == null) return;
52437
+ var _last$row2 = _slicedToArray(last.row, 2),
52438
+ row_s = _last$row2[0],
52439
+ row_e = _last$row2[1];
52440
+ var _last$column2 = _slicedToArray(last.column, 2),
52441
+ col_s = _last$column2[0],
52442
+ col_e = _last$column2[1];
52443
+ dropCellCache.copyRange = ___default['default'].cloneDeep(___default['default'].pick(last, ["row", "column"]));
52444
+ var typeItemHide = getTypeItemHide(ctx);
52445
+ if (!typeItemHide[0] && !typeItemHide[1] && !typeItemHide[2] && !typeItemHide[3] && !typeItemHide[4] && !typeItemHide[5] && !typeItemHide[6]) {
52446
+ dropCellCache.applyType = "0";
52447
+ } else {
52448
+ dropCellCache.applyType = "1";
52449
+ }
52450
+ var refCol = col_s - 1;
52451
+ if (refCol < 0 || getFirstNonEmptyRowBelow(flowdata, refCol, row_e + 1) === -1) {
52452
+ refCol = col_e + 1;
52453
+ if (refCol >= ctx.visibledatacolumn.length || getFirstNonEmptyRowBelow(flowdata, refCol, row_e + 1) === -1) {
52454
+ return;
52455
+ }
52456
+ }
52457
+ var endRow = getLastConsecutiveNonEmptyRow(flowdata, refCol, row_e + 1);
52458
+ if (endRow === -1) {
52459
+ return;
52460
+ }
52461
+ if (ctx.config.merge != null) {
52462
+ var HasMC = false;
52463
+ for (var r = last.row[0]; r <= last.row[1]; r += 1) {
52464
+ for (var c = last.column[0]; c <= last.column[1]; c += 1) {
52465
+ var _flowdata$r4;
52466
+ var cell = (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c];
52467
+ if (cell != null && cell.mc != null) {
52468
+ HasMC = true;
52469
+ break;
52470
+ }
52471
+ }
52472
+ }
52473
+ if (HasMC) {
52474
+ return;
52475
+ }
52476
+ for (var _r2 = last.row[1] + 1; _r2 <= endRow; _r2 += 1) {
52477
+ for (var _c2 = col_s; _c2 <= col_e; _c2 += 1) {
52478
+ var _flowdata$_r2;
52479
+ var _cell5 = (_flowdata$_r2 = flowdata[_r2]) === null || _flowdata$_r2 === void 0 ? void 0 : _flowdata$_r2[_c2];
52480
+ if (_cell5 != null && _cell5.mc != null) {
52481
+ HasMC = true;
52482
+ break;
52483
+ }
52484
+ }
52485
+ }
52486
+ if (HasMC) {
52487
+ return;
52488
+ }
52489
+ }
52490
+ dropCellCache.applyRange = {
52491
+ row: [row_e + 1, endRow],
52492
+ column: [col_s, col_e]
52493
+ };
52494
+ dropCellCache.direction = "down";
52495
+ ctx.luckysheet_select_save = normalizeSelection(ctx, [{
52496
+ row: [row_s, endRow],
52497
+ column: [col_s, col_e]
52498
+ }]);
52499
+ try {
52500
+ updateDropCell(ctx);
52501
+ } catch (err) {
52502
+ console.error(err);
52503
+ }
52504
+ var selectedMoveEle = container.querySelector(".leankylin-cell-selected-move");
52505
+ if (selectedMoveEle) {
52506
+ selectedMoveEle.style.display = "none";
52507
+ }
52508
+ }
52382
52509
 
52383
52510
  var defaultStyle = {
52384
52511
  fillStyle: "#000000",
@@ -61119,6 +61246,7 @@ exports.handleColumnHeaderMouseDown = handleColumnHeaderMouseDown;
61119
61246
  exports.handleContextMenu = handleContextMenu;
61120
61247
  exports.handleCopy = handleCopy;
61121
61248
  exports.handleCurrencyFormat = handleCurrencyFormat;
61249
+ exports.handleDropCellDoubleClick = handleDropCellDoubleClick;
61122
61250
  exports.handleFormatPainter = handleFormatPainter;
61123
61251
  exports.handleFormulaInput = handleFormulaInput;
61124
61252
  exports.handleFreeze = handleFreeze;
@@ -8,3 +8,4 @@ export declare function onDropCellSelect(ctx: Context, e: MouseEvent, scrollX: H
8
8
  export declare function getTypeItemHide(ctx: Context): boolean[];
9
9
  export declare function updateDropCell(ctx: Context): void;
10
10
  export declare function onDropCellSelectEnd(ctx: Context, e: MouseEvent, container: HTMLDivElement): void;
11
+ export declare function handleDropCellDoubleClick(ctx: Context, container: HTMLDivElement): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.49",
3
+ "version": "5.2.51",
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": "5.2.49",
16
+ "@leankylin-sheet/formula-parser": "5.2.51",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",