@leankylin-sheet/core 7.0.23 → 7.0.25

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
@@ -41506,8 +41506,22 @@ function getCellValue(r, c, data, attr) {
41506
41506
  }
41507
41507
  return retv;
41508
41508
  }
41509
+ function setDateCellValue(cell, date) {
41510
+ var _cell$ct3, _cell$ct4;
41511
+ var hasTime = date.getHours() !== 0 || date.getMinutes() !== 0 || date.getSeconds() !== 0;
41512
+ var fa = hasTime ? "yyyy-MM-dd hh:mm:ss" : "yyyy-MM-dd";
41513
+ if (((_cell$ct3 = cell.ct) === null || _cell$ct3 === void 0 ? void 0 : _cell$ct3.t) === "d" && !_.isNil((_cell$ct4 = cell.ct) === null || _cell$ct4 === void 0 ? void 0 : _cell$ct4.fa) && cell.ct.fa !== "General") {
41514
+ fa = cell.ct.fa;
41515
+ }
41516
+ cell.v = datenum_local(date);
41517
+ cell.ct = {
41518
+ fa: fa,
41519
+ t: "d"
41520
+ };
41521
+ cell.m = update(fa, cell.v).toString();
41522
+ }
41509
41523
  function setVUpdateStr(cell, vupdateStr, d, r, c, vupdate) {
41510
- var _cell$ct3, _cell$ct4, _cell$ct5, _cell$ct6, _cell$ct7, _cell$ct8;
41524
+ var _cell$ct5, _cell$ct6, _cell$ct7, _cell$ct8, _cell$ct9, _cell$ct10;
41511
41525
  if (vupdateStr.substr(0, 1) === "'") {
41512
41526
  cell.m = vupdateStr.substr(1);
41513
41527
  cell.ct = {
@@ -41523,21 +41537,21 @@ function setVUpdateStr(cell, vupdateStr, d, r, c, vupdate) {
41523
41537
  t: "s"
41524
41538
  };
41525
41539
  cell.v = vupdateStr;
41526
- } else if (vupdateStr.toUpperCase() === "TRUE" && (_.isNil((_cell$ct3 = cell.ct) === null || _cell$ct3 === void 0 ? void 0 : _cell$ct3.fa) || ((_cell$ct4 = cell.ct) === null || _cell$ct4 === void 0 ? void 0 : _cell$ct4.fa) !== "@")) {
41540
+ } else if (vupdateStr.toUpperCase() === "TRUE" && (_.isNil((_cell$ct5 = cell.ct) === null || _cell$ct5 === void 0 ? void 0 : _cell$ct5.fa) || ((_cell$ct6 = cell.ct) === null || _cell$ct6 === void 0 ? void 0 : _cell$ct6.fa) !== "@")) {
41527
41541
  cell.m = "TRUE";
41528
41542
  cell.ct = {
41529
41543
  fa: "General",
41530
41544
  t: "b"
41531
41545
  };
41532
41546
  cell.v = true;
41533
- } else if (vupdateStr.toUpperCase() === "FALSE" && (_.isNil((_cell$ct5 = cell.ct) === null || _cell$ct5 === void 0 ? void 0 : _cell$ct5.fa) || ((_cell$ct6 = cell.ct) === null || _cell$ct6 === void 0 ? void 0 : _cell$ct6.fa) !== "@")) {
41547
+ } else if (vupdateStr.toUpperCase() === "FALSE" && (_.isNil((_cell$ct7 = cell.ct) === null || _cell$ct7 === void 0 ? void 0 : _cell$ct7.fa) || ((_cell$ct8 = cell.ct) === null || _cell$ct8 === void 0 ? void 0 : _cell$ct8.fa) !== "@")) {
41534
41548
  cell.m = "FALSE";
41535
41549
  cell.ct = {
41536
41550
  fa: "General",
41537
41551
  t: "b"
41538
41552
  };
41539
41553
  cell.v = false;
41540
- } else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (_.isNil((_cell$ct7 = cell.ct) === null || _cell$ct7 === void 0 ? void 0 : _cell$ct7.fa) || ((_cell$ct8 = cell.ct) === null || _cell$ct8 === void 0 ? void 0 : _cell$ct8.fa) !== "@")) {
41554
+ } else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (_.isNil((_cell$ct9 = cell.ct) === null || _cell$ct9 === void 0 ? void 0 : _cell$ct9.fa) || ((_cell$ct10 = cell.ct) === null || _cell$ct10 === void 0 ? void 0 : _cell$ct10.fa) !== "@")) {
41541
41555
  cell.ct = {
41542
41556
  fa: "0%",
41543
41557
  t: "n"
@@ -41555,6 +41569,8 @@ function setVUpdateStr(cell, vupdateStr, d, r, c, vupdate) {
41555
41569
  };
41556
41570
  }
41557
41571
  cell.v = vupdate;
41572
+ } else if (_.isDate(vupdate)) {
41573
+ setDateCellValue(cell, vupdate);
41558
41574
  } else {
41559
41575
  if (!_.isNil(cell.f) && isRealNum(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
41560
41576
  cell.v = parseFloat(vupdate);
@@ -47660,7 +47676,6 @@ function sortDataRange(ctx, sheetData, dataRange, index, isAsc, str, edr, stc, e
47660
47676
  for (var c = stc; c <= edc; c += 1) {
47661
47677
  var cell = sortedData[r - str][c - stc];
47662
47678
  if (cell === null || cell === void 0 ? void 0 : cell.f) {
47663
- var _cell$ct;
47664
47679
  var moveOffset = rowOffsets[r - str];
47665
47680
  var func = cell === null || cell === void 0 ? void 0 : cell.f;
47666
47681
  if (moveOffset > 0) {
@@ -47672,7 +47687,12 @@ function sortDataRange(ctx, sheetData, dataRange, index, isAsc, str, edr, stc, e
47672
47687
  var _funcV = _slicedToArray(funcV, 3);
47673
47688
  cell.v = _funcV[1];
47674
47689
  cell.f = _funcV[2];
47675
- cell.m = update(((_cell$ct = cell.ct) === null || _cell$ct === void 0 ? void 0 : _cell$ct.fa) || "General", cell.v);
47690
+ if (_.isDate(cell.v)) {
47691
+ setDateCellValue(cell, cell.v);
47692
+ } else {
47693
+ var _cell$ct;
47694
+ cell.m = update(((_cell$ct = cell.ct) === null || _cell$ct === void 0 ? void 0 : _cell$ct.fa) || "General", cell.v);
47695
+ }
47676
47696
  }
47677
47697
  sheetData[r][c] = cell;
47678
47698
  }
@@ -51872,14 +51892,16 @@ function updateDropCell(ctx) {
51872
51892
  var _v = _slicedToArray(v, 3);
51873
51893
  cell.v = _v[1];
51874
51894
  cell.f = _v[2];
51875
- if (cell.spl != null) {
51895
+ if (_.isDate(cell.v)) {
51896
+ setDateCellValue(cell, cell.v);
51897
+ } else if (cell.spl != null) {
51876
51898
  cell.spl = v[3].data;
51877
51899
  } else if (cell.v != null && cell.v !== "") {
51878
51900
  if (isRealNum(cell.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(cell.v))) {
51879
51901
  if (cell.v === Infinity || cell.v === -Infinity) {
51880
51902
  cell.m = cell.v.toString();
51881
51903
  } else {
51882
- if (cell.v.toString().indexOf("e") > -1) {
51904
+ if (typeof cell.v === "number" && cell.v.toString().indexOf("e") > -1) {
51883
51905
  var _cell$v, _cell$v$toString$spli, _cell$v$toString$spli2, _cell$v$toString$spli3, _cell$v$toString$spli4;
51884
51906
  var len = (_cell$v = cell.v) === null || _cell$v === void 0 ? void 0 : (_cell$v$toString$spli = _cell$v.toString().split(".")) === null || _cell$v$toString$spli === void 0 ? void 0 : (_cell$v$toString$spli2 = _cell$v$toString$spli[1]) === null || _cell$v$toString$spli2 === void 0 ? void 0 : (_cell$v$toString$spli3 = _cell$v$toString$spli2.split("e")) === null || _cell$v$toString$spli3 === void 0 ? void 0 : (_cell$v$toString$spli4 = _cell$v$toString$spli3[0]) === null || _cell$v$toString$spli4 === void 0 ? void 0 : _cell$v$toString$spli4.length;
51885
51907
  if (len > 5) {
@@ -51956,14 +51978,16 @@ function updateDropCell(ctx) {
51956
51978
  var _v3 = _slicedToArray(_v2, 3);
51957
51979
  _cell.v = _v3[1];
51958
51980
  _cell.f = _v3[2];
51959
- if (_cell.spl != null) {
51981
+ if (_.isDate(_cell.v)) {
51982
+ setDateCellValue(_cell, _cell.v);
51983
+ } else if (_cell.spl != null) {
51960
51984
  _cell.spl = _v2[3].data;
51961
51985
  } else if (_cell.v != null && _cell.v !== "") {
51962
51986
  if (isRealNum(_cell.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(_cell.v))) {
51963
51987
  if (_cell.v === Infinity || _cell.v === -Infinity) {
51964
51988
  _cell.m = _cell.v.toString();
51965
51989
  } else {
51966
- if (_cell.v.toString().indexOf("e") > -1) {
51990
+ if (typeof _cell.v === "number" && _cell.v.toString().indexOf("e") > -1) {
51967
51991
  var _cell$v2, _cell$v2$toString$spl, _cell$v2$toString$spl2, _cell$v2$toString$spl3, _cell$v2$toString$spl4;
51968
51992
  var _len7 = (_cell$v2 = _cell.v) === null || _cell$v2 === void 0 ? void 0 : (_cell$v2$toString$spl = _cell$v2.toString().split(".")) === null || _cell$v2$toString$spl === void 0 ? void 0 : (_cell$v2$toString$spl2 = _cell$v2$toString$spl[1]) === null || _cell$v2$toString$spl2 === void 0 ? void 0 : (_cell$v2$toString$spl3 = _cell$v2$toString$spl2.split("e")) === null || _cell$v2$toString$spl3 === void 0 ? void 0 : (_cell$v2$toString$spl4 = _cell$v2$toString$spl3[0]) === null || _cell$v2$toString$spl4 === void 0 ? void 0 : _cell$v2$toString$spl4.length;
51969
51993
  if (_len7 > 5) {
@@ -52039,14 +52063,16 @@ function updateDropCell(ctx) {
52039
52063
  var _v5 = _slicedToArray(_v4, 3);
52040
52064
  _cell2.v = _v5[1];
52041
52065
  _cell2.f = _v5[2];
52042
- if (_cell2.spl != null) {
52066
+ if (_.isDate(_cell2.v)) {
52067
+ setDateCellValue(_cell2, _cell2.v);
52068
+ } else if (_cell2.spl != null) {
52043
52069
  _cell2.spl = _v4[3].data;
52044
52070
  } else if (_cell2.v != null && _cell2.v !== "") {
52045
52071
  if (isRealNum(_cell2.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(_cell2.v))) {
52046
52072
  if (_cell2.v === Infinity || _cell2.v === -Infinity) {
52047
52073
  _cell2.m = _cell2.v.toString();
52048
52074
  } else {
52049
- if (_cell2.v.toString().indexOf("e") > -1) {
52075
+ if (typeof _cell2.v === "number" && _cell2.v.toString().indexOf("e") > -1) {
52050
52076
  var _cell2$v, _cell2$v$toString$spl, _cell2$v$toString$spl2, _cell2$v$toString$spl3, _cell2$v$toString$spl4;
52051
52077
  var _len8 = (_cell2$v = _cell2.v) === null || _cell2$v === void 0 ? void 0 : (_cell2$v$toString$spl = _cell2$v.toString().split(".")) === null || _cell2$v$toString$spl === void 0 ? void 0 : (_cell2$v$toString$spl2 = _cell2$v$toString$spl[1]) === null || _cell2$v$toString$spl2 === void 0 ? void 0 : (_cell2$v$toString$spl3 = _cell2$v$toString$spl2.split("e")) === null || _cell2$v$toString$spl3 === void 0 ? void 0 : (_cell2$v$toString$spl4 = _cell2$v$toString$spl3[0]) === null || _cell2$v$toString$spl4 === void 0 ? void 0 : _cell2$v$toString$spl4.length;
52052
52078
  if (_len8 > 5) {
@@ -52116,14 +52142,16 @@ function updateDropCell(ctx) {
52116
52142
  var _v7 = _slicedToArray(_v6, 3);
52117
52143
  _cell3.v = _v7[1];
52118
52144
  _cell3.f = _v7[2];
52119
- if (_cell3.spl != null) {
52145
+ if (_.isDate(_cell3.v)) {
52146
+ setDateCellValue(_cell3, _cell3.v);
52147
+ } else if (_cell3.spl != null) {
52120
52148
  _cell3.spl = _v6[3].data;
52121
52149
  } else if (_cell3.v != null && _cell3.v !== "") {
52122
52150
  if (isRealNum(_cell3.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(_cell3.v))) {
52123
52151
  if (_cell3.v === Infinity || _cell3.v === -Infinity) {
52124
52152
  _cell3.m = _cell3.v.toString();
52125
52153
  } else {
52126
- if (_cell3.v.toString().indexOf("e") > -1) {
52154
+ if (typeof _cell3.v === "number" && _cell3.v.toString().indexOf("e") > -1) {
52127
52155
  var _cell3$v, _cell3$v$toString$spl, _cell3$v$toString$spl2, _cell3$v$toString$spl3, _cell3$v$toString$spl4;
52128
52156
  var _len9 = (_cell3$v = _cell3.v) === null || _cell3$v === void 0 ? void 0 : (_cell3$v$toString$spl = _cell3$v.toString().split(".")) === null || _cell3$v$toString$spl === void 0 ? void 0 : (_cell3$v$toString$spl2 = _cell3$v$toString$spl[1]) === null || _cell3$v$toString$spl2 === void 0 ? void 0 : (_cell3$v$toString$spl3 = _cell3$v$toString$spl2.split("e")) === null || _cell3$v$toString$spl3 === void 0 ? void 0 : (_cell3$v$toString$spl4 = _cell3$v$toString$spl3[0]) === null || _cell3$v$toString$spl4 === void 0 ? void 0 : _cell3$v$toString$spl4.length;
52129
52157
  if (_len9 > 5) {
@@ -60718,7 +60746,9 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
60718
60746
  var _funcV = _slicedToArray(funcV, 3);
60719
60747
  value.v = _funcV[1];
60720
60748
  value.f = _funcV[2];
60721
- if (!_.isNil(value.ct) && !_.isNil(value.ct.fa)) {
60749
+ if (_.isDate(value.v)) {
60750
+ setDateCellValue(value, value.v);
60751
+ } else if (!_.isNil(value.ct) && !_.isNil(value.ct.fa)) {
60722
60752
  value.m = update(value.ct.fa, funcV[1]);
60723
60753
  }
60724
60754
  }
@@ -61537,4 +61567,4 @@ function handlePasteByClick(ctx, triggerType) {
61537
61567
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
61538
61568
  }
61539
61569
 
61540
- export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, PAINT_MODEL_CURSOR, 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 };
61570
+ export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, PAINT_MODEL_CURSOR, 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, setDateCellValue, 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
@@ -41516,8 +41516,22 @@ function getCellValue(r, c, data, attr) {
41516
41516
  }
41517
41517
  return retv;
41518
41518
  }
41519
+ function setDateCellValue(cell, date) {
41520
+ var _cell$ct3, _cell$ct4;
41521
+ var hasTime = date.getHours() !== 0 || date.getMinutes() !== 0 || date.getSeconds() !== 0;
41522
+ var fa = hasTime ? "yyyy-MM-dd hh:mm:ss" : "yyyy-MM-dd";
41523
+ if (((_cell$ct3 = cell.ct) === null || _cell$ct3 === void 0 ? void 0 : _cell$ct3.t) === "d" && !___default['default'].isNil((_cell$ct4 = cell.ct) === null || _cell$ct4 === void 0 ? void 0 : _cell$ct4.fa) && cell.ct.fa !== "General") {
41524
+ fa = cell.ct.fa;
41525
+ }
41526
+ cell.v = datenum_local(date);
41527
+ cell.ct = {
41528
+ fa: fa,
41529
+ t: "d"
41530
+ };
41531
+ cell.m = update(fa, cell.v).toString();
41532
+ }
41519
41533
  function setVUpdateStr(cell, vupdateStr, d, r, c, vupdate) {
41520
- var _cell$ct3, _cell$ct4, _cell$ct5, _cell$ct6, _cell$ct7, _cell$ct8;
41534
+ var _cell$ct5, _cell$ct6, _cell$ct7, _cell$ct8, _cell$ct9, _cell$ct10;
41521
41535
  if (vupdateStr.substr(0, 1) === "'") {
41522
41536
  cell.m = vupdateStr.substr(1);
41523
41537
  cell.ct = {
@@ -41533,21 +41547,21 @@ function setVUpdateStr(cell, vupdateStr, d, r, c, vupdate) {
41533
41547
  t: "s"
41534
41548
  };
41535
41549
  cell.v = vupdateStr;
41536
- } else if (vupdateStr.toUpperCase() === "TRUE" && (___default['default'].isNil((_cell$ct3 = cell.ct) === null || _cell$ct3 === void 0 ? void 0 : _cell$ct3.fa) || ((_cell$ct4 = cell.ct) === null || _cell$ct4 === void 0 ? void 0 : _cell$ct4.fa) !== "@")) {
41550
+ } else if (vupdateStr.toUpperCase() === "TRUE" && (___default['default'].isNil((_cell$ct5 = cell.ct) === null || _cell$ct5 === void 0 ? void 0 : _cell$ct5.fa) || ((_cell$ct6 = cell.ct) === null || _cell$ct6 === void 0 ? void 0 : _cell$ct6.fa) !== "@")) {
41537
41551
  cell.m = "TRUE";
41538
41552
  cell.ct = {
41539
41553
  fa: "General",
41540
41554
  t: "b"
41541
41555
  };
41542
41556
  cell.v = true;
41543
- } else if (vupdateStr.toUpperCase() === "FALSE" && (___default['default'].isNil((_cell$ct5 = cell.ct) === null || _cell$ct5 === void 0 ? void 0 : _cell$ct5.fa) || ((_cell$ct6 = cell.ct) === null || _cell$ct6 === void 0 ? void 0 : _cell$ct6.fa) !== "@")) {
41557
+ } else if (vupdateStr.toUpperCase() === "FALSE" && (___default['default'].isNil((_cell$ct7 = cell.ct) === null || _cell$ct7 === void 0 ? void 0 : _cell$ct7.fa) || ((_cell$ct8 = cell.ct) === null || _cell$ct8 === void 0 ? void 0 : _cell$ct8.fa) !== "@")) {
41544
41558
  cell.m = "FALSE";
41545
41559
  cell.ct = {
41546
41560
  fa: "General",
41547
41561
  t: "b"
41548
41562
  };
41549
41563
  cell.v = false;
41550
- } else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (___default['default'].isNil((_cell$ct7 = cell.ct) === null || _cell$ct7 === void 0 ? void 0 : _cell$ct7.fa) || ((_cell$ct8 = cell.ct) === null || _cell$ct8 === void 0 ? void 0 : _cell$ct8.fa) !== "@")) {
41564
+ } else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (___default['default'].isNil((_cell$ct9 = cell.ct) === null || _cell$ct9 === void 0 ? void 0 : _cell$ct9.fa) || ((_cell$ct10 = cell.ct) === null || _cell$ct10 === void 0 ? void 0 : _cell$ct10.fa) !== "@")) {
41551
41565
  cell.ct = {
41552
41566
  fa: "0%",
41553
41567
  t: "n"
@@ -41565,6 +41579,8 @@ function setVUpdateStr(cell, vupdateStr, d, r, c, vupdate) {
41565
41579
  };
41566
41580
  }
41567
41581
  cell.v = vupdate;
41582
+ } else if (___default['default'].isDate(vupdate)) {
41583
+ setDateCellValue(cell, vupdate);
41568
41584
  } else {
41569
41585
  if (!___default['default'].isNil(cell.f) && isRealNum(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
41570
41586
  cell.v = parseFloat(vupdate);
@@ -47670,7 +47686,6 @@ function sortDataRange(ctx, sheetData, dataRange, index, isAsc, str, edr, stc, e
47670
47686
  for (var c = stc; c <= edc; c += 1) {
47671
47687
  var cell = sortedData[r - str][c - stc];
47672
47688
  if (cell === null || cell === void 0 ? void 0 : cell.f) {
47673
- var _cell$ct;
47674
47689
  var moveOffset = rowOffsets[r - str];
47675
47690
  var func = cell === null || cell === void 0 ? void 0 : cell.f;
47676
47691
  if (moveOffset > 0) {
@@ -47682,7 +47697,12 @@ function sortDataRange(ctx, sheetData, dataRange, index, isAsc, str, edr, stc, e
47682
47697
  var _funcV = _slicedToArray(funcV, 3);
47683
47698
  cell.v = _funcV[1];
47684
47699
  cell.f = _funcV[2];
47685
- cell.m = update(((_cell$ct = cell.ct) === null || _cell$ct === void 0 ? void 0 : _cell$ct.fa) || "General", cell.v);
47700
+ if (___default['default'].isDate(cell.v)) {
47701
+ setDateCellValue(cell, cell.v);
47702
+ } else {
47703
+ var _cell$ct;
47704
+ cell.m = update(((_cell$ct = cell.ct) === null || _cell$ct === void 0 ? void 0 : _cell$ct.fa) || "General", cell.v);
47705
+ }
47686
47706
  }
47687
47707
  sheetData[r][c] = cell;
47688
47708
  }
@@ -51882,14 +51902,16 @@ function updateDropCell(ctx) {
51882
51902
  var _v = _slicedToArray(v, 3);
51883
51903
  cell.v = _v[1];
51884
51904
  cell.f = _v[2];
51885
- if (cell.spl != null) {
51905
+ if (___default['default'].isDate(cell.v)) {
51906
+ setDateCellValue(cell, cell.v);
51907
+ } else if (cell.spl != null) {
51886
51908
  cell.spl = v[3].data;
51887
51909
  } else if (cell.v != null && cell.v !== "") {
51888
51910
  if (isRealNum(cell.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(cell.v))) {
51889
51911
  if (cell.v === Infinity || cell.v === -Infinity) {
51890
51912
  cell.m = cell.v.toString();
51891
51913
  } else {
51892
- if (cell.v.toString().indexOf("e") > -1) {
51914
+ if (typeof cell.v === "number" && cell.v.toString().indexOf("e") > -1) {
51893
51915
  var _cell$v, _cell$v$toString$spli, _cell$v$toString$spli2, _cell$v$toString$spli3, _cell$v$toString$spli4;
51894
51916
  var len = (_cell$v = cell.v) === null || _cell$v === void 0 ? void 0 : (_cell$v$toString$spli = _cell$v.toString().split(".")) === null || _cell$v$toString$spli === void 0 ? void 0 : (_cell$v$toString$spli2 = _cell$v$toString$spli[1]) === null || _cell$v$toString$spli2 === void 0 ? void 0 : (_cell$v$toString$spli3 = _cell$v$toString$spli2.split("e")) === null || _cell$v$toString$spli3 === void 0 ? void 0 : (_cell$v$toString$spli4 = _cell$v$toString$spli3[0]) === null || _cell$v$toString$spli4 === void 0 ? void 0 : _cell$v$toString$spli4.length;
51895
51917
  if (len > 5) {
@@ -51966,14 +51988,16 @@ function updateDropCell(ctx) {
51966
51988
  var _v3 = _slicedToArray(_v2, 3);
51967
51989
  _cell.v = _v3[1];
51968
51990
  _cell.f = _v3[2];
51969
- if (_cell.spl != null) {
51991
+ if (___default['default'].isDate(_cell.v)) {
51992
+ setDateCellValue(_cell, _cell.v);
51993
+ } else if (_cell.spl != null) {
51970
51994
  _cell.spl = _v2[3].data;
51971
51995
  } else if (_cell.v != null && _cell.v !== "") {
51972
51996
  if (isRealNum(_cell.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(_cell.v))) {
51973
51997
  if (_cell.v === Infinity || _cell.v === -Infinity) {
51974
51998
  _cell.m = _cell.v.toString();
51975
51999
  } else {
51976
- if (_cell.v.toString().indexOf("e") > -1) {
52000
+ if (typeof _cell.v === "number" && _cell.v.toString().indexOf("e") > -1) {
51977
52001
  var _cell$v2, _cell$v2$toString$spl, _cell$v2$toString$spl2, _cell$v2$toString$spl3, _cell$v2$toString$spl4;
51978
52002
  var _len7 = (_cell$v2 = _cell.v) === null || _cell$v2 === void 0 ? void 0 : (_cell$v2$toString$spl = _cell$v2.toString().split(".")) === null || _cell$v2$toString$spl === void 0 ? void 0 : (_cell$v2$toString$spl2 = _cell$v2$toString$spl[1]) === null || _cell$v2$toString$spl2 === void 0 ? void 0 : (_cell$v2$toString$spl3 = _cell$v2$toString$spl2.split("e")) === null || _cell$v2$toString$spl3 === void 0 ? void 0 : (_cell$v2$toString$spl4 = _cell$v2$toString$spl3[0]) === null || _cell$v2$toString$spl4 === void 0 ? void 0 : _cell$v2$toString$spl4.length;
51979
52003
  if (_len7 > 5) {
@@ -52049,14 +52073,16 @@ function updateDropCell(ctx) {
52049
52073
  var _v5 = _slicedToArray(_v4, 3);
52050
52074
  _cell2.v = _v5[1];
52051
52075
  _cell2.f = _v5[2];
52052
- if (_cell2.spl != null) {
52076
+ if (___default['default'].isDate(_cell2.v)) {
52077
+ setDateCellValue(_cell2, _cell2.v);
52078
+ } else if (_cell2.spl != null) {
52053
52079
  _cell2.spl = _v4[3].data;
52054
52080
  } else if (_cell2.v != null && _cell2.v !== "") {
52055
52081
  if (isRealNum(_cell2.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(_cell2.v))) {
52056
52082
  if (_cell2.v === Infinity || _cell2.v === -Infinity) {
52057
52083
  _cell2.m = _cell2.v.toString();
52058
52084
  } else {
52059
- if (_cell2.v.toString().indexOf("e") > -1) {
52085
+ if (typeof _cell2.v === "number" && _cell2.v.toString().indexOf("e") > -1) {
52060
52086
  var _cell2$v, _cell2$v$toString$spl, _cell2$v$toString$spl2, _cell2$v$toString$spl3, _cell2$v$toString$spl4;
52061
52087
  var _len8 = (_cell2$v = _cell2.v) === null || _cell2$v === void 0 ? void 0 : (_cell2$v$toString$spl = _cell2$v.toString().split(".")) === null || _cell2$v$toString$spl === void 0 ? void 0 : (_cell2$v$toString$spl2 = _cell2$v$toString$spl[1]) === null || _cell2$v$toString$spl2 === void 0 ? void 0 : (_cell2$v$toString$spl3 = _cell2$v$toString$spl2.split("e")) === null || _cell2$v$toString$spl3 === void 0 ? void 0 : (_cell2$v$toString$spl4 = _cell2$v$toString$spl3[0]) === null || _cell2$v$toString$spl4 === void 0 ? void 0 : _cell2$v$toString$spl4.length;
52062
52088
  if (_len8 > 5) {
@@ -52126,14 +52152,16 @@ function updateDropCell(ctx) {
52126
52152
  var _v7 = _slicedToArray(_v6, 3);
52127
52153
  _cell3.v = _v7[1];
52128
52154
  _cell3.f = _v7[2];
52129
- if (_cell3.spl != null) {
52155
+ if (___default['default'].isDate(_cell3.v)) {
52156
+ setDateCellValue(_cell3, _cell3.v);
52157
+ } else if (_cell3.spl != null) {
52130
52158
  _cell3.spl = _v6[3].data;
52131
52159
  } else if (_cell3.v != null && _cell3.v !== "") {
52132
52160
  if (isRealNum(_cell3.v) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test("".concat(_cell3.v))) {
52133
52161
  if (_cell3.v === Infinity || _cell3.v === -Infinity) {
52134
52162
  _cell3.m = _cell3.v.toString();
52135
52163
  } else {
52136
- if (_cell3.v.toString().indexOf("e") > -1) {
52164
+ if (typeof _cell3.v === "number" && _cell3.v.toString().indexOf("e") > -1) {
52137
52165
  var _cell3$v, _cell3$v$toString$spl, _cell3$v$toString$spl2, _cell3$v$toString$spl3, _cell3$v$toString$spl4;
52138
52166
  var _len9 = (_cell3$v = _cell3.v) === null || _cell3$v === void 0 ? void 0 : (_cell3$v$toString$spl = _cell3$v.toString().split(".")) === null || _cell3$v$toString$spl === void 0 ? void 0 : (_cell3$v$toString$spl2 = _cell3$v$toString$spl[1]) === null || _cell3$v$toString$spl2 === void 0 ? void 0 : (_cell3$v$toString$spl3 = _cell3$v$toString$spl2.split("e")) === null || _cell3$v$toString$spl3 === void 0 ? void 0 : (_cell3$v$toString$spl4 = _cell3$v$toString$spl3[0]) === null || _cell3$v$toString$spl4 === void 0 ? void 0 : _cell3$v$toString$spl4.length;
52139
52167
  if (_len9 > 5) {
@@ -60728,7 +60756,9 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
60728
60756
  var _funcV = _slicedToArray(funcV, 3);
60729
60757
  value.v = _funcV[1];
60730
60758
  value.f = _funcV[2];
60731
- if (!___default['default'].isNil(value.ct) && !___default['default'].isNil(value.ct.fa)) {
60759
+ if (___default['default'].isDate(value.v)) {
60760
+ setDateCellValue(value, value.v);
60761
+ } else if (!___default['default'].isNil(value.ct) && !___default['default'].isNil(value.ct.fa)) {
60732
60762
  value.m = update(value.ct.fa, funcV[1]);
60733
60763
  }
60734
60764
  }
@@ -61852,6 +61882,7 @@ exports.seletedHighlistByindex = seletedHighlistByindex;
61852
61882
  exports.setCaretPosition = setCaretPosition;
61853
61883
  exports.setCellValue = setCellValue;
61854
61884
  exports.setConditionRules = setConditionRules;
61885
+ exports.setDateCellValue = setDateCellValue;
61855
61886
  exports.setDropcownValue = setDropcownValue;
61856
61887
  exports.setEditingComment = setEditingComment;
61857
61888
  exports.setNextSheet = setNextSheet;
@@ -3,6 +3,7 @@ import { Cell, CellMatrix, Range, Selection, SingleRange } from "../types";
3
3
  export declare function normalizedCellAttr(cell: Cell, attr: keyof Cell, defaultFontSize?: number): any;
4
4
  export declare function normalizedAttr(data: CellMatrix, r: number, c: number, attr: keyof Cell): any;
5
5
  export declare function getCellValue(r: number, c: number, data: CellMatrix, attr?: keyof Cell): any;
6
+ export declare function setDateCellValue(cell: any, date: Date): void;
6
7
  export declare function setCellValue(ctx: Context, r: number, c: number, d: CellMatrix | null | undefined, v: any, isCache?: boolean): void;
7
8
  export declare function getRealCellValue(r: number, c: number, data: CellMatrix, attr?: keyof Cell): any;
8
9
  export declare function mergeBorder(ctx: Context, d: CellMatrix, row_index: number, col_index: number): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "7.0.23",
3
+ "version": "7.0.25",
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": "7.0.23",
16
+ "@leankylin-sheet/formula-parser": "7.0.25",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",