@leankylin-sheet/core 5.2.77 → 6.0.1

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.
@@ -44,6 +44,7 @@ export declare function getSheetWithLatestCelldata(ctx: Context, options?: Commo
44
44
  hyperlink?: Record<string, {
45
45
  linkType: string;
46
46
  linkAddress: string;
47
+ payload?: Record<string, any> | undefined;
47
48
  }> | undefined;
48
49
  dynamicArray_compute?: any;
49
50
  dynamicArray?: any[] | undefined;
package/dist/index.esm.js CHANGED
@@ -48041,16 +48041,21 @@ function getCellHyperlink(ctx, r, c) {
48041
48041
  }
48042
48042
  return undefined;
48043
48043
  }
48044
- function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress) {
48044
+ function getCellHyperlinkWithPayload(ctx, r, c) {
48045
+ return getCellHyperlink(ctx, r, c);
48046
+ }
48047
+ function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, payload) {
48045
48048
  var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
48046
48049
  var flowdata = getFlowdata(ctx);
48047
48050
  if (sheetIndex != null && flowdata != null && linkType && linkAddress) {
48048
48051
  var cell = flowdata[r][c];
48049
48052
  if (cell == null) cell = {};
48050
- _.set(ctx.luckysheetfile[sheetIndex], ["hyperlink", "".concat(r, "_").concat(c)], {
48053
+ _.set(ctx.luckysheetfile[sheetIndex], ["hyperlink", "".concat(r, "_").concat(c)], _objectSpread2({
48051
48054
  linkType: linkType,
48052
48055
  linkAddress: linkAddress
48053
- });
48056
+ }, payload != null ? {
48057
+ payload: payload
48058
+ } : {}));
48054
48059
  cell.fc = "rgb(0, 0, 255)";
48055
48060
  cell.un = 1;
48056
48061
  cell.v = linkText || linkAddress;
@@ -48103,7 +48108,7 @@ function showLinkCard(ctx, r, c) {
48103
48108
  c: c,
48104
48109
  rc: "".concat(r, "_").concat(c),
48105
48110
  originText: (cell === null || cell === void 0 ? void 0 : cell.v) == null ? "" : "".concat(cell.v),
48106
- originType: (link === null || link === void 0 ? void 0 : link.linkType) || "webpage",
48111
+ originType: (link === null || link === void 0 ? void 0 : link.linkType) || "",
48107
48112
  originAddress: (link === null || link === void 0 ? void 0 : link.linkAddress) || "",
48108
48113
  position: {
48109
48114
  cellLeft: col_pre,
@@ -57129,17 +57134,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57129
57134
  cfg.merge = {};
57130
57135
  }
57131
57136
  var formulaCells = [];
57132
- var modifiedCells = [];
57137
+ var changedCells = [];
57133
57138
  for (var i = 0; i < rowCount; i += 1) {
57134
57139
  for (var j = 0; j < columnCount; j += 1) {
57135
57140
  var row = rowStart + i;
57136
57141
  var column = colStart + j;
57137
57142
  var value = data[i][j];
57138
- modifiedCells.push({
57139
- r: row,
57140
- c: column,
57141
- i: sheet.id
57142
- });
57143
+ if (!isCellValueUnchanged(sheet, row, column, value)) {
57144
+ changedCells.push({
57145
+ r: row,
57146
+ c: column,
57147
+ i: sheet.id
57148
+ });
57149
+ }
57143
57150
  setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
57144
57151
  if (setMerge) {
57145
57152
  var _value$mc, _value$mc2, _value$mc3, _value$mc4;
@@ -57161,22 +57168,23 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57161
57168
  if (setMerge) {
57162
57169
  sheet.config = cfg;
57163
57170
  }
57164
- if (modifiedCells.length > 0) {
57165
- registerExecFunctionExist(ctx, sheet, formulaCells, modifiedCells);
57166
- for (var k = 0; k < formulaCells.length; k += 1) {
57167
- var fc = formulaCells[k];
57168
- var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57169
- setCellValue(ctx, fc.r, fc.c, flowdata, {
57170
- v: v[1],
57171
- f: v[2]
57172
- });
57173
- }
57174
- ctx.formulaCache.execFunctionExist.reverse();
57175
- execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57176
- groupValuesRefresh(ctx);
57177
- updateFunctionGroup(ctx);
57178
- ctx.formulaCache.execFunctionGlobalData = null;
57171
+ if (formulaCells.length === 0 && changedCells.length === 0) {
57172
+ return;
57179
57173
  }
57174
+ registerExecFunctionExist(ctx, sheet, formulaCells, changedCells);
57175
+ for (var k = 0; k < formulaCells.length; k += 1) {
57176
+ var fc = formulaCells[k];
57177
+ var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57178
+ setCellValue(ctx, fc.r, fc.c, flowdata, {
57179
+ v: v[1],
57180
+ f: v[2]
57181
+ });
57182
+ }
57183
+ ctx.formulaCache.execFunctionExist.reverse();
57184
+ execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57185
+ groupValuesRefresh(ctx);
57186
+ updateFunctionGroup(ctx);
57187
+ ctx.formulaCache.execFunctionGlobalData = null;
57180
57188
  }
57181
57189
  function setCellValues(ctx, data, cellInput) {
57182
57190
  var _data$, _data$2;
@@ -57398,6 +57406,8 @@ var defaultSettings = {
57398
57406
  renderTopToolbar: undefined,
57399
57407
  renderBottomToolbar: undefined,
57400
57408
  headerBgColor: "#fff",
57409
+ detailLinkType: "",
57410
+ customLinkTypes: [],
57401
57411
  toolbarRightRender: undefined,
57402
57412
  onClickContentEditable: undefined,
57403
57413
  renderCustomColor: undefined,
@@ -61245,8 +61255,8 @@ function handlePasteByLeanklin(_x2, _x3, _x4) {
61245
61255
  }
61246
61256
  function _handlePasteByLeanklin() {
61247
61257
  _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, e, copyRich) {
61248
- var _ctx$luckysheet_selec8, _data$0$;
61249
- var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range;
61258
+ var _ctx$luckysheet_selec8, _data$0$, _prevSelectSave$, _prevSelectSave$$row, _prevSelectSave$2, _prevSelectSave$2$row, _prevSelectSave$3, _prevSelectSave$3$col, _prevSelectSave$4, _prevSelectSave$4$col;
61259
+ var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range, nextSelectSave, prevSelectSave, isSame;
61250
61260
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
61251
61261
  while (1) switch (_context2.prev = _context2.next) {
61252
61262
  case 0:
@@ -61309,9 +61319,14 @@ function _handlePasteByLeanklin() {
61309
61319
  console.time('setCellValuesByRange');
61310
61320
  setCellValuesByRange(ctx, pasteData, range, null);
61311
61321
  console.timeEnd('setCellValuesByRange');
61312
- ctx.luckysheet_select_save = [range];
61322
+ nextSelectSave = [range];
61323
+ prevSelectSave = ctx.luckysheet_select_save;
61324
+ isSame = Array.isArray(prevSelectSave) && prevSelectSave.length === 1 && ((_prevSelectSave$ = prevSelectSave[0]) === null || _prevSelectSave$ === void 0 ? void 0 : (_prevSelectSave$$row = _prevSelectSave$.row) === null || _prevSelectSave$$row === void 0 ? void 0 : _prevSelectSave$$row[0]) === range.row[0] && ((_prevSelectSave$2 = prevSelectSave[0]) === null || _prevSelectSave$2 === void 0 ? void 0 : (_prevSelectSave$2$row = _prevSelectSave$2.row) === null || _prevSelectSave$2$row === void 0 ? void 0 : _prevSelectSave$2$row[1]) === range.row[1] && ((_prevSelectSave$3 = prevSelectSave[0]) === null || _prevSelectSave$3 === void 0 ? void 0 : (_prevSelectSave$3$col = _prevSelectSave$3.column) === null || _prevSelectSave$3$col === void 0 ? void 0 : _prevSelectSave$3$col[0]) === range.column[0] && ((_prevSelectSave$4 = prevSelectSave[0]) === null || _prevSelectSave$4 === void 0 ? void 0 : (_prevSelectSave$4$col = _prevSelectSave$4.column) === null || _prevSelectSave$4$col === void 0 ? void 0 : _prevSelectSave$4$col[1]) === range.column[1];
61325
+ if (!isSame) {
61326
+ ctx.luckysheet_select_save = nextSelectSave;
61327
+ }
61313
61328
  console.timeEnd('handlePasteByLeanklin');
61314
- case 30:
61329
+ case 33:
61315
61330
  case "end":
61316
61331
  return _context2.stop();
61317
61332
  }
@@ -61336,4 +61351,4 @@ function handlePasteByClick(ctx, triggerType) {
61336
61351
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
61337
61352
  }
61338
61353
 
61339
- 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 };
61354
+ 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, getCellHyperlinkWithPayload, 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
@@ -48051,16 +48051,21 @@ function getCellHyperlink(ctx, r, c) {
48051
48051
  }
48052
48052
  return undefined;
48053
48053
  }
48054
- function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress) {
48054
+ function getCellHyperlinkWithPayload(ctx, r, c) {
48055
+ return getCellHyperlink(ctx, r, c);
48056
+ }
48057
+ function saveHyperlink(ctx, r, c, linkText, linkType, linkAddress, payload) {
48055
48058
  var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
48056
48059
  var flowdata = getFlowdata(ctx);
48057
48060
  if (sheetIndex != null && flowdata != null && linkType && linkAddress) {
48058
48061
  var cell = flowdata[r][c];
48059
48062
  if (cell == null) cell = {};
48060
- ___default['default'].set(ctx.luckysheetfile[sheetIndex], ["hyperlink", "".concat(r, "_").concat(c)], {
48063
+ ___default['default'].set(ctx.luckysheetfile[sheetIndex], ["hyperlink", "".concat(r, "_").concat(c)], _objectSpread2({
48061
48064
  linkType: linkType,
48062
48065
  linkAddress: linkAddress
48063
- });
48066
+ }, payload != null ? {
48067
+ payload: payload
48068
+ } : {}));
48064
48069
  cell.fc = "rgb(0, 0, 255)";
48065
48070
  cell.un = 1;
48066
48071
  cell.v = linkText || linkAddress;
@@ -48113,7 +48118,7 @@ function showLinkCard(ctx, r, c) {
48113
48118
  c: c,
48114
48119
  rc: "".concat(r, "_").concat(c),
48115
48120
  originText: (cell === null || cell === void 0 ? void 0 : cell.v) == null ? "" : "".concat(cell.v),
48116
- originType: (link === null || link === void 0 ? void 0 : link.linkType) || "webpage",
48121
+ originType: (link === null || link === void 0 ? void 0 : link.linkType) || "",
48117
48122
  originAddress: (link === null || link === void 0 ? void 0 : link.linkAddress) || "",
48118
48123
  position: {
48119
48124
  cellLeft: col_pre,
@@ -57139,17 +57144,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57139
57144
  cfg.merge = {};
57140
57145
  }
57141
57146
  var formulaCells = [];
57142
- var modifiedCells = [];
57147
+ var changedCells = [];
57143
57148
  for (var i = 0; i < rowCount; i += 1) {
57144
57149
  for (var j = 0; j < columnCount; j += 1) {
57145
57150
  var row = rowStart + i;
57146
57151
  var column = colStart + j;
57147
57152
  var value = data[i][j];
57148
- modifiedCells.push({
57149
- r: row,
57150
- c: column,
57151
- i: sheet.id
57152
- });
57153
+ if (!isCellValueUnchanged(sheet, row, column, value)) {
57154
+ changedCells.push({
57155
+ r: row,
57156
+ c: column,
57157
+ i: sheet.id
57158
+ });
57159
+ }
57153
57160
  setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
57154
57161
  if (setMerge) {
57155
57162
  var _value$mc, _value$mc2, _value$mc3, _value$mc4;
@@ -57171,22 +57178,23 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
57171
57178
  if (setMerge) {
57172
57179
  sheet.config = cfg;
57173
57180
  }
57174
- if (modifiedCells.length > 0) {
57175
- registerExecFunctionExist(ctx, sheet, formulaCells, modifiedCells);
57176
- for (var k = 0; k < formulaCells.length; k += 1) {
57177
- var fc = formulaCells[k];
57178
- var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57179
- setCellValue(ctx, fc.r, fc.c, flowdata, {
57180
- v: v[1],
57181
- f: v[2]
57182
- });
57183
- }
57184
- ctx.formulaCache.execFunctionExist.reverse();
57185
- execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57186
- groupValuesRefresh(ctx);
57187
- updateFunctionGroup(ctx);
57188
- ctx.formulaCache.execFunctionGlobalData = null;
57181
+ if (formulaCells.length === 0 && changedCells.length === 0) {
57182
+ return;
57189
57183
  }
57184
+ registerExecFunctionExist(ctx, sheet, formulaCells, changedCells);
57185
+ for (var k = 0; k < formulaCells.length; k += 1) {
57186
+ var fc = formulaCells[k];
57187
+ var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
57188
+ setCellValue(ctx, fc.r, fc.c, flowdata, {
57189
+ v: v[1],
57190
+ f: v[2]
57191
+ });
57192
+ }
57193
+ ctx.formulaCache.execFunctionExist.reverse();
57194
+ execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
57195
+ groupValuesRefresh(ctx);
57196
+ updateFunctionGroup(ctx);
57197
+ ctx.formulaCache.execFunctionGlobalData = null;
57190
57198
  }
57191
57199
  function setCellValues(ctx, data, cellInput) {
57192
57200
  var _data$, _data$2;
@@ -57408,6 +57416,8 @@ var defaultSettings = {
57408
57416
  renderTopToolbar: undefined,
57409
57417
  renderBottomToolbar: undefined,
57410
57418
  headerBgColor: "#fff",
57419
+ detailLinkType: "",
57420
+ customLinkTypes: [],
57411
57421
  toolbarRightRender: undefined,
57412
57422
  onClickContentEditable: undefined,
57413
57423
  renderCustomColor: undefined,
@@ -61255,8 +61265,8 @@ function handlePasteByLeanklin(_x2, _x3, _x4) {
61255
61265
  }
61256
61266
  function _handlePasteByLeanklin() {
61257
61267
  _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, e, copyRich) {
61258
- var _ctx$luckysheet_selec8, _data$0$;
61259
- var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range;
61268
+ var _ctx$luckysheet_selec8, _data$0$, _prevSelectSave$, _prevSelectSave$$row, _prevSelectSave$2, _prevSelectSave$2$row, _prevSelectSave$3, _prevSelectSave$3$col, _prevSelectSave$4, _prevSelectSave$4$col;
61269
+ var allowEdit, selectRange, rows, columns, _getClipboardData, copyData, borderInfo, merge, _ctx$config$borderInf, index, data, copyOne, pasteData, r, rIndex, c, row, column, range, nextSelectSave, prevSelectSave, isSame;
61260
61270
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
61261
61271
  while (1) switch (_context2.prev = _context2.next) {
61262
61272
  case 0:
@@ -61319,9 +61329,14 @@ function _handlePasteByLeanklin() {
61319
61329
  console.time('setCellValuesByRange');
61320
61330
  setCellValuesByRange(ctx, pasteData, range, null);
61321
61331
  console.timeEnd('setCellValuesByRange');
61322
- ctx.luckysheet_select_save = [range];
61332
+ nextSelectSave = [range];
61333
+ prevSelectSave = ctx.luckysheet_select_save;
61334
+ isSame = Array.isArray(prevSelectSave) && prevSelectSave.length === 1 && ((_prevSelectSave$ = prevSelectSave[0]) === null || _prevSelectSave$ === void 0 ? void 0 : (_prevSelectSave$$row = _prevSelectSave$.row) === null || _prevSelectSave$$row === void 0 ? void 0 : _prevSelectSave$$row[0]) === range.row[0] && ((_prevSelectSave$2 = prevSelectSave[0]) === null || _prevSelectSave$2 === void 0 ? void 0 : (_prevSelectSave$2$row = _prevSelectSave$2.row) === null || _prevSelectSave$2$row === void 0 ? void 0 : _prevSelectSave$2$row[1]) === range.row[1] && ((_prevSelectSave$3 = prevSelectSave[0]) === null || _prevSelectSave$3 === void 0 ? void 0 : (_prevSelectSave$3$col = _prevSelectSave$3.column) === null || _prevSelectSave$3$col === void 0 ? void 0 : _prevSelectSave$3$col[0]) === range.column[0] && ((_prevSelectSave$4 = prevSelectSave[0]) === null || _prevSelectSave$4 === void 0 ? void 0 : (_prevSelectSave$4$col = _prevSelectSave$4.column) === null || _prevSelectSave$4$col === void 0 ? void 0 : _prevSelectSave$4$col[1]) === range.column[1];
61335
+ if (!isSame) {
61336
+ ctx.luckysheet_select_save = nextSelectSave;
61337
+ }
61323
61338
  console.timeEnd('handlePasteByLeanklin');
61324
- case 30:
61339
+ case 33:
61325
61340
  case "end":
61326
61341
  return _context2.stop();
61327
61342
  }
@@ -61433,6 +61448,7 @@ exports.getArrowCanvasSize = getArrowCanvasSize;
61433
61448
  exports.getBorderInfoCompute = getBorderInfoCompute;
61434
61449
  exports.getBorderInfoComputeRange = getBorderInfoComputeRange;
61435
61450
  exports.getCellHyperlink = getCellHyperlink;
61451
+ exports.getCellHyperlinkWithPayload = getCellHyperlinkWithPayload;
61436
61452
  exports.getCellRowColumn = getCellRowColumn;
61437
61453
  exports.getCellTextInfo = getCellTextInfo;
61438
61454
  exports.getCellTopRightPostion = getCellTopRightPostion;
@@ -7,8 +7,15 @@ export declare function getCellRowColumn(ctx: Context, e: MouseEvent, container:
7
7
  export declare function getCellHyperlink(ctx: Context, r: number, c: number): {
8
8
  linkType: string;
9
9
  linkAddress: string;
10
+ payload?: Record<string, any> | undefined;
10
11
  } | undefined;
11
- export declare function saveHyperlink(ctx: Context, r: number, c: number, linkText: string, linkType: string, linkAddress: string): void;
12
+ export type HyperlinkWithPayload = {
13
+ linkType: string;
14
+ linkAddress: string;
15
+ payload?: Record<string, any>;
16
+ };
17
+ export declare function getCellHyperlinkWithPayload(ctx: Context, r: number, c: number): HyperlinkWithPayload | undefined;
18
+ export declare function saveHyperlink(ctx: Context, r: number, c: number, linkText: string, linkType: string, linkAddress: string, payload?: Record<string, any>): void;
12
19
  export declare function removeHyperlink(ctx: Context, r: number, c: number): void;
13
20
  export declare function showLinkCard(ctx: Context, r: number, c: number, isEditing?: boolean, isMouseDown?: boolean): void;
14
21
  export declare function goToLink(ctx: Context, r: number, c: number, linkType: string, linkAddress: string, scrollbarX: HTMLDivElement, scrollbarY: HTMLDivElement): void;
@@ -1,5 +1,61 @@
1
1
  import React from "react";
2
2
  import { Sheet, Selection, CellMatrix, Cell } from "./types";
3
+ export type LinkTypeSavedValue = {
4
+ linkType: string;
5
+ linkAddress: string;
6
+ payload?: Record<string, any>;
7
+ };
8
+ export type LinkTypeRenderProps = {
9
+ value: string;
10
+ position: {
11
+ r: number;
12
+ c: number;
13
+ };
14
+ onChange: (next: string) => void;
15
+ payload: Record<string, any>;
16
+ setPayload: (next: Record<string, any> | ((prev: Record<string, any>) => Record<string, any>)) => void;
17
+ ctx: any;
18
+ };
19
+ export type LinkTypeSaveProps = {
20
+ linkText: string;
21
+ linkAddress: string;
22
+ position: {
23
+ r: number;
24
+ c: number;
25
+ };
26
+ origin: {
27
+ linkType: string;
28
+ linkAddress: string;
29
+ payload?: any;
30
+ } | undefined;
31
+ };
32
+ export type LinkTypeClickProps = {
33
+ linkType: string;
34
+ linkAddress: string;
35
+ payload?: Record<string, any>;
36
+ position: {
37
+ r: number;
38
+ c: number;
39
+ sheetId: string;
40
+ };
41
+ };
42
+ export type LinkTypeHoverProps = LinkTypeClickProps & {
43
+ event: MouseEvent | TouchEvent;
44
+ };
45
+ export type LinkTypeConfig = {
46
+ type: string;
47
+ text: string;
48
+ render?: (props: LinkTypeRenderProps) => any;
49
+ onSave?: (props: LinkTypeSaveProps) => LinkTypeSavedValue | undefined;
50
+ onClick?: (props: LinkTypeClickProps) => void | boolean;
51
+ onHover?: (props: LinkTypeHoverProps) => void;
52
+ };
53
+ export type HyperlinkHoverInfo = LinkTypeClickProps & {
54
+ event: MouseEvent | TouchEvent;
55
+ };
56
+ export type HyperlinkClickInfo = LinkTypeClickProps & {
57
+ event: any;
58
+ };
3
59
  export type Hooks = {
4
60
  rowColChange?: (conf: {
5
61
  action: "add" | "delete";
@@ -25,6 +81,8 @@ export type Hooks = {
25
81
  afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
26
82
  afterSelectionChange?: (sheetId: string, selection: Selection) => void;
27
83
  afterSheetChange?: (sheetId: string, prevSheetId: string) => void;
84
+ onHyperlinkHover?: (info: HyperlinkHoverInfo) => void;
85
+ onHyperlinkClick?: (info: HyperlinkClickInfo) => void;
28
86
  beforeRenderRowHeaderCell?: (rowNumber: string, rowIndex: number, top: number, width: number, height: number, ctx: CanvasRenderingContext2D) => boolean;
29
87
  afterRenderRowHeaderCell?: (rowNumber: string, rowIndex: number, top: number, width: number, height: number, ctx: CanvasRenderingContext2D) => void;
30
88
  beforeRenderColumnHeaderCell?: (columnChar: string, columnIndex: number, left: number, width: number, height: number, ctx: CanvasRenderingContext2D) => boolean;
@@ -92,6 +150,7 @@ export type Hooks = {
92
150
  afterUpdateSheetName?: (id: string, oldName: string, newName: string) => void;
93
151
  };
94
152
  export type Settings = {
153
+ detailLinkType?: string;
95
154
  headerBgColor?: string;
96
155
  toolbarRightRender?: any;
97
156
  renderBottomToolbar?: any;
@@ -159,5 +218,6 @@ export type Settings = {
159
218
  icon?: React.ReactNode;
160
219
  onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
161
220
  }[];
221
+ customLinkTypes?: LinkTypeConfig[];
162
222
  };
163
223
  export declare const defaultSettings: Required<Settings>;
package/dist/types.d.ts CHANGED
@@ -159,6 +159,7 @@ export type Sheet = {
159
159
  hyperlink?: Record<string, {
160
160
  linkType: string;
161
161
  linkAddress: string;
162
+ payload?: Record<string, any>;
162
163
  }>;
163
164
  dynamicArray_compute?: any;
164
165
  dynamicArray?: any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "5.2.77",
3
+ "version": "6.0.1",
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.77",
16
+ "@leankylin-sheet/formula-parser": "6.0.1",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",