@leankylin-sheet/core 4.0.0 → 4.0.2

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.
@@ -19,4 +19,5 @@ export declare function getCellsByRange(ctx: Context, range: Selection, options?
19
19
  export declare function getHtmlByRange(ctx: Context, range: Range, options?: CommonOptions): string | null;
20
20
  export declare function setSelection(ctx: Context, range: Range, options: CommonOptions): void;
21
21
  export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
22
+ export declare function setCellValues(ctx: Context, data: any[], cellInput: HTMLDivElement | null, options?: CommonOptions): void;
22
23
  export declare function setCellFormatByRange(ctx: Context, attr: keyof Cell, value: any, range: Range | SingleRange, options?: CommonOptions): void;
package/dist/index.esm.js CHANGED
@@ -36580,22 +36580,15 @@ function searchFunction(ctx, searchtxt) {
36580
36580
  var f = [];
36581
36581
  var s = [];
36582
36582
  var t = [];
36583
- var result_i = 0;
36584
36583
  for (var _i17 = 0; _i17 < functionlist.length; _i17 += 1) {
36585
36584
  var item = functionlist[_i17];
36586
36585
  var n = item.n;
36587
36586
  if (n === searchtxt) {
36588
36587
  f.unshift(item);
36589
- result_i += 1;
36590
36588
  } else if (_.startsWith(n, searchtxt)) {
36591
36589
  s.unshift(item);
36592
- result_i += 1;
36593
36590
  } else if (n.indexOf(searchtxt) > -1) {
36594
36591
  t.unshift(item);
36595
- result_i += 1;
36596
- }
36597
- if (result_i >= 10) {
36598
- break;
36599
36592
  }
36600
36593
  }
36601
36594
  var list = [].concat(f, s, t);
@@ -36693,7 +36686,7 @@ function helpFunctionExe($editer, currSelection, ctx) {
36693
36686
  function rangeHightlightselected(ctx, $editor) {
36694
36687
  var currSelection = getrangeseleciton();
36695
36688
  if (!currSelection) return;
36696
- var currText = _.trim(currSelection.textContent || "");
36689
+ var currText = _.trimStart(currSelection.textContent || "");
36697
36690
  if (currText === null || currText === void 0 ? void 0 : currText.match(/^[a-zA-Z_]+$/)) {
36698
36691
  searchFunction(ctx, currText.toUpperCase());
36699
36692
  ctx.functionHint = null;
@@ -36811,7 +36804,7 @@ function functionHTML(txt) {
36811
36804
  } else if (matchConfig.dquote > 0) {
36812
36805
  function_str += "".concat(str, "</span>");
36813
36806
  } else if (str.indexOf("</span>") === -1 && str.length > 0) {
36814
- var regx = /{.*?}/;
36807
+ var regx = /{{.*?}}/;
36815
36808
  if (regx.test(_.trim(str))) {
36816
36809
  var arraytxt = regx.exec(str)[0];
36817
36810
  var arraystart = str.search(regx);
@@ -36819,7 +36812,7 @@ function functionHTML(txt) {
36819
36812
  if (arraystart > 0) {
36820
36813
  alltxt += "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str.substr(0, arraystart), "</span>");
36821
36814
  }
36822
- alltxt += "<span dir=\"auto\" style=\"color:#959a05\" class=\"luckysheet-formula-text-array\">".concat(arraytxt, "</span>");
36815
+ alltxt += "<span dir=\"auto\" style=\"color:#3b82f4\" class=\"luckysheet-formula-text-var\">".concat(arraytxt, "</span>");
36823
36816
  if (arraystart + arraytxt.length < str.length) {
36824
36817
  alltxt += "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str.substr(arraystart + arraytxt.length, str.length), "</span>");
36825
36818
  }
@@ -36857,7 +36850,9 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
36857
36850
  var value1txt = preText !== null && preText !== void 0 ? preText : $editor.innerText;
36858
36851
  var value = $editor.innerText;
36859
36852
  value = escapeScriptTag(value);
36860
- if (value.length > 0 && value.substring(0, 1) === "=" && (kcode !== 229 || value.length === 1)) {
36853
+ var hasF = value.length > 0 && value.substring(0, 1) === "=" && (kcode !== 229 || value.length === 1);
36854
+ var lastHasF = _.startsWith(value1txt, "=") && !_.startsWith(value, "=");
36855
+ if (hasF) {
36861
36856
  if (!refreshRangeSelect) rangeIndexes = getRangeIndexes($editor);
36862
36857
  value = functionHTMLGenerate(value);
36863
36858
  if (!refreshRangeSelect && functionHTMLIndex < rangeIndexes.length) refreshRangeSelect = true;
@@ -36882,19 +36877,10 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
36882
36877
  $editor.innerHTML = value;
36883
36878
  if ($copyTo) $copyTo.innerHTML = value;
36884
36879
  functionRange(ctx, $editor, value, value1);
36885
- if (refreshRangeSelect) {
36886
- cancelFunctionrangeSelected(ctx);
36887
- if (kcode !== 46) {
36888
- createRangeHightlight(ctx, value);
36889
- }
36890
- ctx.formulaCache.rangestart = false;
36891
- ctx.formulaCache.rangedrag_column_start = false;
36892
- ctx.formulaCache.rangedrag_row_start = false;
36893
- rangeHightlightselected(ctx, $editor);
36894
- }
36895
- } else if (_.startsWith(value1txt, "=") && !_.startsWith(value, "=")) {
36880
+ } else if (lastHasF) {
36896
36881
  if ($copyTo) $copyTo.innerHTML = value;
36897
36882
  $editor.innerHTML = escapeHTMLTag(value);
36883
+ ctx.formulaCache.functionRangeIndex = [0, 1];
36898
36884
  } else if (!_.startsWith(value1txt, "=")) {
36899
36885
  if (!$copyTo) return;
36900
36886
  if ($copyTo.id === "luckysheet-rich-text-editor") {
@@ -36905,6 +36891,18 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
36905
36891
  $copyTo.innerHTML = escapeHTMLTag(value);
36906
36892
  }
36907
36893
  }
36894
+ if (hasF || lastHasF) {
36895
+ if (refreshRangeSelect) {
36896
+ cancelFunctionrangeSelected(ctx);
36897
+ if (kcode !== 46) {
36898
+ createRangeHightlight(ctx, value);
36899
+ }
36900
+ ctx.formulaCache.rangestart = false;
36901
+ ctx.formulaCache.rangedrag_column_start = false;
36902
+ ctx.formulaCache.rangedrag_row_start = false;
36903
+ rangeHightlightselected(ctx, $editor);
36904
+ }
36905
+ }
36908
36906
  }
36909
36907
  function isfreezonFuc(txt) {
36910
36908
  var row = txt.replace(/[^0-9]/g, "");
@@ -42218,6 +42216,11 @@ function rangeValueToHtml(ctx, sheetId, ranges) {
42218
42216
  }
42219
42217
  return "<table data-type=\"leankylin-copy-action-table\">".concat(colgroup).concat(cpdata, "</table>");
42220
42218
  }
42219
+ function ptToPx(pt) {
42220
+ var ppi = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 96;
42221
+ var px = pt * (ppi / 72);
42222
+ return parseFloat(px.toFixed(2));
42223
+ }
42221
42224
  function cellAttrToDomStyle(cell, cellBorderInfo) {
42222
42225
  var _ref = cell || {},
42223
42226
  bg = _ref.bg,
@@ -42238,7 +42241,7 @@ function cellAttrToDomStyle(cell, cellBorderInfo) {
42238
42241
  2: "bottom"
42239
42242
  }[String(vt)] || "middle";
42240
42243
  var fontWeight = bl === 1 ? "bold" : "normal";
42241
- var fontSize = "".concat(parseInt(fs, 10), "px");
42244
+ var fontSize = typeof fs === "number" ? ptToPx(fs) : "".concat(parseInt(fs, 10), "px");
42242
42245
  var result = {
42243
42246
  background: bg || "#fff",
42244
42247
  color: fc || "#000",
@@ -42279,6 +42282,7 @@ function copy(ctx) {
42279
42282
  var data = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r = flowdata[r]) === null || _flowdata$r === void 0 ? void 0 : _flowdata$r[c];
42280
42283
  var value = (_ref2 = (_data$m = data === null || data === void 0 ? void 0 : data.m) !== null && _data$m !== void 0 ? _data$m : data === null || data === void 0 ? void 0 : data.v) !== null && _ref2 !== void 0 ? _ref2 : "";
42281
42284
  var realValue = (_ref3 = (_data$v = data === null || data === void 0 ? void 0 : data.v) !== null && _data$v !== void 0 ? _data$v : data === null || data === void 0 ? void 0 : data.m) !== null && _ref3 !== void 0 ? _ref3 : "";
42285
+ var f = (data === null || data === void 0 ? void 0 : data.f) || "";
42282
42286
  var rowspan = (_data$mc$rs = data === null || data === void 0 ? void 0 : (_data$mc = data.mc) === null || _data$mc === void 0 ? void 0 : _data$mc.rs) !== null && _data$mc$rs !== void 0 ? _data$mc$rs : 1;
42283
42287
  var colspan = (_data$mc$cs = data === null || data === void 0 ? void 0 : (_data$mc2 = data.mc) === null || _data$mc2 === void 0 ? void 0 : _data$mc2.cs) !== null && _data$mc$cs !== void 0 ? _data$mc$cs : 1;
42284
42288
  if (!(data === null || data === void 0 ? void 0 : data.mc) || (data === null || data === void 0 ? void 0 : data.mc) && (data === null || data === void 0 ? void 0 : data.mc.r) === r && data.mc.c === c) {
@@ -42287,7 +42291,7 @@ function copy(ctx) {
42287
42291
  var styleStr = (_Object$keys = Object.keys(style)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(function (item) {
42288
42292
  return "".concat(item, ":").concat(style[item], ";");
42289
42293
  }).join("");
42290
- cpString += "<td x:num='".concat(realValue, "' style='").concat(styleStr, "' rowspan=").concat(rowspan, " colspan=").concat(colspan, ">").concat(value, "</td>");
42294
+ cpString += "<td x:num='".concat(realValue, "' f='").concat(f, "' style='").concat(styleStr, "' rowspan=").concat(rowspan, " colspan=").concat(colspan, ">").concat(value, "</td>");
42291
42295
  }
42292
42296
  };
42293
42297
  for (var c = columns[0]; c <= columns[1]; c += 1) {
@@ -51968,7 +51972,7 @@ var Canvas = /*#__PURE__*/function () {
51968
51972
  continue;
51969
51973
  }
51970
51974
  if (((_this$sheetCtx$config = this.sheetCtx.config) === null || _this$sheetCtx$config === void 0 ? void 0 : (_this$sheetCtx$config2 = _this$sheetCtx$config.rowhidden) === null || _this$sheetCtx$config2 === void 0 ? void 0 : _this$sheetCtx$config2[r]) == null) {
51971
- renderCtx.fillStyle = "#ffffff";
51975
+ renderCtx.fillStyle = "#F8F9FA";
51972
51976
  renderCtx.fillRect(0, start_r + offsetTop + firstOffset, this.sheetCtx.rowHeaderWidth - 1, end_r - start_r + 1 + lastOffset - firstOffset);
51973
51977
  renderCtx.fillStyle = "#000000";
51974
51978
  renderCtx.save();
@@ -52061,7 +52065,7 @@ var Canvas = /*#__PURE__*/function () {
52061
52065
  continue;
52062
52066
  }
52063
52067
  if (((_this$sheetCtx$config5 = this.sheetCtx.config) === null || _this$sheetCtx$config5 === void 0 ? void 0 : (_this$sheetCtx$config6 = _this$sheetCtx$config5.colhidden) === null || _this$sheetCtx$config6 === void 0 ? void 0 : _this$sheetCtx$config6[c]) == null) {
52064
- renderCtx.fillStyle = "#ffffff";
52068
+ renderCtx.fillStyle = "#F8F9FA";
52065
52069
  renderCtx.fillRect(start_c + offsetLeft - 1, 0, end_c - start_c, this.sheetCtx.columnHeaderHeight - 1);
52066
52070
  renderCtx.fillStyle = "#000000";
52067
52071
  renderCtx.save();
@@ -53814,10 +53818,6 @@ function createFilter(ctx) {
53814
53818
  if (_.size(ctx.luckysheet_select_save) > 1) {
53815
53819
  return;
53816
53820
  }
53817
- if (_.size(ctx.luckysheet_filter_save) > 0) {
53818
- clearFilter(ctx);
53819
- return;
53820
- }
53821
53821
  var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
53822
53822
  if (sheetIndex == null || ctx.luckysheetfile[sheetIndex].isPivotTable) {
53823
53823
  return;
@@ -55886,6 +55886,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
55886
55886
  }
55887
55887
  }
55888
55888
  }
55889
+ function setCellValues(ctx, data, cellInput) {
55890
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
55891
+ if (data == null) {
55892
+ throw INVALID_PARAMS;
55893
+ }
55894
+ for (var j = 0; j < data.length; j += 1) {
55895
+ var _data$j = data[j],
55896
+ r = _data$j.r,
55897
+ c = _data$j.c,
55898
+ v = _data$j.v;
55899
+ setCellValue$1(ctx, r, c, v, cellInput, options);
55900
+ }
55901
+ }
55889
55902
  function setCellFormatByRange(ctx, attr, value, range) {
55890
55903
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
55891
55904
  if (_.isPlainObject(range)) {
@@ -56010,6 +56023,7 @@ var index = /*#__PURE__*/Object.freeze({
56010
56023
  getHtmlByRange: getHtmlByRange,
56011
56024
  setSelection: setSelection,
56012
56025
  setCellValuesByRange: setCellValuesByRange,
56026
+ setCellValues: setCellValues,
56013
56027
  setCellFormatByRange: setCellFormatByRange,
56014
56028
  mergeCells: mergeCells$1,
56015
56029
  cancelMerge: cancelMerge,
@@ -56030,8 +56044,12 @@ var index = /*#__PURE__*/Object.freeze({
56030
56044
  });
56031
56045
 
56032
56046
  var defaultSettings = {
56047
+ toolbarRightRender: undefined,
56048
+ onClickContentEditable: undefined,
56049
+ renderCustomColor: undefined,
56033
56050
  renderFormulaHint: undefined,
56034
56051
  renderFormulaSearch: undefined,
56052
+ renderEditorSelector: undefined,
56035
56053
  copyRich: false,
56036
56054
  renderCalcInfo: undefined,
56037
56055
  renderFreezeCol: undefined,
@@ -59652,14 +59670,32 @@ var getCellBorder = function getCellBorder(domStyle, row_index, col_index) {
59652
59670
  };
59653
59671
  };
59654
59672
  var getCellMcBorder = function getCellMcBorder(ctx, domStyle, row_index, col_index, mc) {
59655
- var keys = [["border-left", "borderLeftWidth", "borderLeftColor", "borderLeftStyle"], ["border-top", "borderTopWidth", "borderTopColor", "borderTopStyle"], ["border-right", "borderRightWidth", "borderRightColor", "borderRightStyle"], ["border-bottom", "borderBottomWidth", "borderBottomColor", "borderBottomStyle"]];
59673
+ var keys = [["border-left", "borderLeftWidth", "borderLeftColor", "borderLeftStyle", function (curIndex, rs) {
59674
+ return [curIndex, curIndex + rs - 1];
59675
+ }, function (curIndex) {
59676
+ return [curIndex, curIndex];
59677
+ }], ["border-top", "borderTopWidth", "borderTopColor", "borderTopStyle", function (curIndex) {
59678
+ return [curIndex, curIndex];
59679
+ }, function (curIndex, cs) {
59680
+ return [curIndex, curIndex + cs - 1];
59681
+ }], ["border-right", "borderRightWidth", "borderRightColor", "borderRightStyle", function (curIndex, rs) {
59682
+ return [curIndex, curIndex + rs - 1];
59683
+ }, function (curIndex, cs) {
59684
+ return [curIndex + cs - 1, curIndex + cs - 1];
59685
+ }], ["border-bottom", "borderBottomWidth", "borderBottomColor", "borderBottomStyle", function (curIndex, cs) {
59686
+ return [curIndex + cs - 1, curIndex + cs - 1];
59687
+ }, function (curIndex, cs) {
59688
+ return [curIndex, curIndex + cs - 1];
59689
+ }]];
59656
59690
  var result = [];
59657
59691
  for (var index = 0; index < keys.length; index += 1) {
59658
- var _keys$index2 = _slicedToArray(keys[index], 4),
59692
+ var _keys$index2 = _slicedToArray(keys[index], 6),
59659
59693
  p = _keys$index2[0],
59660
59694
  w = _keys$index2[1],
59661
59695
  c = _keys$index2[2],
59662
- s = _keys$index2[3];
59696
+ s = _keys$index2[3],
59697
+ getRow = _keys$index2[4],
59698
+ getColumn = _keys$index2[5];
59663
59699
  if (parseFloat(domStyle[w]) > 0 && domStyle[s] !== "inset") {
59664
59700
  var _getQKBorder = getQKBorder(domStyle[w], domStyle[s], domStyle[c]),
59665
59701
  _getQKBorder2 = _slicedToArray(_getQKBorder, 2),
@@ -59671,8 +59707,8 @@ var getCellMcBorder = function getCellMcBorder(ctx, domStyle, row_index, col_ind
59671
59707
  color: color,
59672
59708
  style: style,
59673
59709
  range: normalizeSelection(ctx, [{
59674
- row: [row_index, row_index + mc.rs - 1],
59675
- column: [col_index, col_index + mc.cs - 1]
59710
+ row: getRow(row_index, mc.rs),
59711
+ column: getColumn(col_index, mc.cs)
59676
59712
  }])
59677
59713
  });
59678
59714
  }
@@ -59719,34 +59755,73 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59719
59755
  }
59720
59756
  var result = [];
59721
59757
  var borderInfo = [];
59758
+ var startOffColIndexMap = {};
59722
59759
  for (var index = 0; index < (rows === null || rows === void 0 ? void 0 : rows.length); index += 1) {
59723
59760
  var row = rows[index];
59761
+ var isFirstNoRs = false;
59724
59762
  var cells = row.querySelectorAll("td");
59725
59763
  if (!result[index]) {
59726
59764
  result[index] = [];
59727
59765
  }
59766
+ var offsetColIndex = 0;
59728
59767
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
59768
+ var _colIndex = startCol + offsetColIndex + (startOffColIndexMap[index] || 0);
59729
59769
  var cell = cells[cIndex];
59730
59770
  var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
59731
59771
  var v = cell.getAttribute("x:num");
59772
+ var f = cell.getAttribute("f");
59732
59773
  if (copyRich) {
59733
59774
  var style = iframe.contentWindow.getComputedStyle(cell);
59734
59775
  var rowspan = Number(cell.getAttribute("rowspan")) || 1;
59735
59776
  var colspan = Number(cell.getAttribute("colspan")) || 1;
59736
59777
  var mainCell = _objectSpread2({
59737
59778
  v: v || m,
59738
- m: m || v
59779
+ m: m || v,
59780
+ f: f || undefined
59739
59781
  }, domStyleToCellAttr(style));
59740
59782
  if (colspan > 1 || rowspan > 1) {
59741
59783
  mainCell.mc = {
59742
59784
  rs: rowspan,
59743
- cs: colspan
59785
+ cs: colspan,
59786
+ r: index + startRow,
59787
+ c: _colIndex
59744
59788
  };
59745
- borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, cIndex + startCol, mainCell.mc)));
59789
+ borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, _colIndex, mainCell.mc)));
59746
59790
  } else {
59747
- borderInfo.push(getCellBorder(style, index + startRow, cIndex + startCol));
59791
+ isFirstNoRs = true;
59792
+ borderInfo.push(getCellBorder(style, index + startRow, _colIndex));
59748
59793
  }
59749
59794
  result[index].push(mainCell);
59795
+ if (rowspan > 1) {
59796
+ for (var rs_index = 1; rs_index < rowspan; rs_index += 1) {
59797
+ if (!result[index + rs_index]) {
59798
+ result[index + rs_index] = [];
59799
+ }
59800
+ result[index + rs_index].push({
59801
+ mc: {
59802
+ r: index + startRow,
59803
+ c: _colIndex
59804
+ }
59805
+ });
59806
+ if (!isFirstNoRs) {
59807
+ if (!startOffColIndexMap[index + rs_index]) {
59808
+ startOffColIndexMap[index + rs_index] = 0;
59809
+ }
59810
+ startOffColIndexMap[index + rs_index] += colspan || 1;
59811
+ }
59812
+ }
59813
+ }
59814
+ if (colspan > 1) {
59815
+ for (var cs_index = 1; cs_index < colspan; cs_index += 1) {
59816
+ result[index].push({
59817
+ mc: {
59818
+ r: index + startRow,
59819
+ c: _colIndex
59820
+ }
59821
+ });
59822
+ }
59823
+ }
59824
+ offsetColIndex += colspan || 1;
59750
59825
  } else {
59751
59826
  result[index].push({
59752
59827
  m: m,
@@ -59760,57 +59835,6 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59760
59835
  borderInfo: borderInfo
59761
59836
  };
59762
59837
  }
59763
- function expandMergedCells(mergedCells, startRow, startCol) {
59764
- if (!mergedCells || mergedCells.length === 0) {
59765
- return [];
59766
- }
59767
- var totalRows = mergedCells === null || mergedCells === void 0 ? void 0 : mergedCells.length;
59768
- var totalCols = 0;
59769
- for (var j = 0; j < mergedCells[0].length; j += 1) {
59770
- var _mergedCells$0$j, _mergedCells$0$j$mc;
59771
- totalCols += ((_mergedCells$0$j = mergedCells[0][j]) === null || _mergedCells$0$j === void 0 ? void 0 : (_mergedCells$0$j$mc = _mergedCells$0$j.mc) === null || _mergedCells$0$j$mc === void 0 ? void 0 : _mergedCells$0$j$mc.cs) || 1;
59772
- }
59773
- var result = Array.from({
59774
- length: totalRows
59775
- }, function () {
59776
- return new Array(totalCols);
59777
- });
59778
- var currentRow = 0;
59779
- for (var i = 0; i < mergedCells.length; i += 1) {
59780
- var currentCol = 0;
59781
- var rowHeight = 0;
59782
- for (var _j7 = 0; _j7 < mergedCells[i].length; _j7 += 1) {
59783
- var _cell$mc2, _cell$mc3;
59784
- var cell = mergedCells[i][_j7];
59785
- var rs = (cell === null || cell === void 0 ? void 0 : (_cell$mc2 = cell.mc) === null || _cell$mc2 === void 0 ? void 0 : _cell$mc2.rs) || 1;
59786
- var cs = (cell === null || cell === void 0 ? void 0 : (_cell$mc3 = cell.mc) === null || _cell$mc3 === void 0 ? void 0 : _cell$mc3.cs) || 1;
59787
- rowHeight = Math.max(rowHeight, rs);
59788
- for (var r = 0; r < rs; r += 1) {
59789
- for (var c = 0; c < cs; c += 1) {
59790
- var mcR = currentRow + startRow;
59791
- var mcC = currentCol + startCol;
59792
- if (r === 0 && c === 0) {
59793
- result[currentRow + r][currentCol + c] = _objectSpread2({}, cell);
59794
- if (result[currentRow + r][currentCol + c].mc) {
59795
- result[currentRow + r][currentCol + c].mc.r = mcR;
59796
- result[currentRow + r][currentCol + c].mc.c = mcC;
59797
- }
59798
- } else {
59799
- result[currentRow + r][currentCol + c] = {
59800
- mc: {
59801
- r: mcR,
59802
- c: mcC
59803
- }
59804
- };
59805
- }
59806
- }
59807
- }
59808
- currentCol += cs;
59809
- }
59810
- currentRow += rowHeight;
59811
- }
59812
- return result;
59813
- }
59814
59838
  function handlePasteByLeanklin(_x2, _x3, _x4) {
59815
59839
  return _handlePasteByLeanklin.apply(this, arguments);
59816
59840
  }
@@ -59846,7 +59870,7 @@ function _handlePasteByLeanklin() {
59846
59870
  }
59847
59871
  index = getSheetIndex(ctx, ctx.currentSheetId);
59848
59872
  ctx.luckysheetfile[index].config = ctx.config;
59849
- data = expandMergedCells(copyData, rows[0], columns[0]);
59873
+ data = copyData;
59850
59874
  copyOne = data.length === 1 && data[0].length === 1 && !((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.mc);
59851
59875
  pasteData = copyOne ? [] : data;
59852
59876
  if (copyOne) {
@@ -59897,4 +59921,4 @@ function handlePasteByClick(ctx, triggerType) {
59897
59921
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
59898
59922
  }
59899
59923
 
59900
- export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, copy2, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaDragOver, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellDrop, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
59924
+ export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, copy2, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaDragOver, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellDrop, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
package/dist/index.js CHANGED
@@ -36590,22 +36590,15 @@ function searchFunction(ctx, searchtxt) {
36590
36590
  var f = [];
36591
36591
  var s = [];
36592
36592
  var t = [];
36593
- var result_i = 0;
36594
36593
  for (var _i17 = 0; _i17 < functionlist.length; _i17 += 1) {
36595
36594
  var item = functionlist[_i17];
36596
36595
  var n = item.n;
36597
36596
  if (n === searchtxt) {
36598
36597
  f.unshift(item);
36599
- result_i += 1;
36600
36598
  } else if (___default['default'].startsWith(n, searchtxt)) {
36601
36599
  s.unshift(item);
36602
- result_i += 1;
36603
36600
  } else if (n.indexOf(searchtxt) > -1) {
36604
36601
  t.unshift(item);
36605
- result_i += 1;
36606
- }
36607
- if (result_i >= 10) {
36608
- break;
36609
36602
  }
36610
36603
  }
36611
36604
  var list = [].concat(f, s, t);
@@ -36703,7 +36696,7 @@ function helpFunctionExe($editer, currSelection, ctx) {
36703
36696
  function rangeHightlightselected(ctx, $editor) {
36704
36697
  var currSelection = getrangeseleciton();
36705
36698
  if (!currSelection) return;
36706
- var currText = ___default['default'].trim(currSelection.textContent || "");
36699
+ var currText = ___default['default'].trimStart(currSelection.textContent || "");
36707
36700
  if (currText === null || currText === void 0 ? void 0 : currText.match(/^[a-zA-Z_]+$/)) {
36708
36701
  searchFunction(ctx, currText.toUpperCase());
36709
36702
  ctx.functionHint = null;
@@ -36821,7 +36814,7 @@ function functionHTML(txt) {
36821
36814
  } else if (matchConfig.dquote > 0) {
36822
36815
  function_str += "".concat(str, "</span>");
36823
36816
  } else if (str.indexOf("</span>") === -1 && str.length > 0) {
36824
- var regx = /{.*?}/;
36817
+ var regx = /{{.*?}}/;
36825
36818
  if (regx.test(___default['default'].trim(str))) {
36826
36819
  var arraytxt = regx.exec(str)[0];
36827
36820
  var arraystart = str.search(regx);
@@ -36829,7 +36822,7 @@ function functionHTML(txt) {
36829
36822
  if (arraystart > 0) {
36830
36823
  alltxt += "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str.substr(0, arraystart), "</span>");
36831
36824
  }
36832
- alltxt += "<span dir=\"auto\" style=\"color:#959a05\" class=\"luckysheet-formula-text-array\">".concat(arraytxt, "</span>");
36825
+ alltxt += "<span dir=\"auto\" style=\"color:#3b82f4\" class=\"luckysheet-formula-text-var\">".concat(arraytxt, "</span>");
36833
36826
  if (arraystart + arraytxt.length < str.length) {
36834
36827
  alltxt += "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str.substr(arraystart + arraytxt.length, str.length), "</span>");
36835
36828
  }
@@ -36867,7 +36860,9 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
36867
36860
  var value1txt = preText !== null && preText !== void 0 ? preText : $editor.innerText;
36868
36861
  var value = $editor.innerText;
36869
36862
  value = escapeScriptTag(value);
36870
- if (value.length > 0 && value.substring(0, 1) === "=" && (kcode !== 229 || value.length === 1)) {
36863
+ var hasF = value.length > 0 && value.substring(0, 1) === "=" && (kcode !== 229 || value.length === 1);
36864
+ var lastHasF = ___default['default'].startsWith(value1txt, "=") && !___default['default'].startsWith(value, "=");
36865
+ if (hasF) {
36871
36866
  if (!refreshRangeSelect) rangeIndexes = getRangeIndexes($editor);
36872
36867
  value = functionHTMLGenerate(value);
36873
36868
  if (!refreshRangeSelect && functionHTMLIndex < rangeIndexes.length) refreshRangeSelect = true;
@@ -36892,19 +36887,10 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
36892
36887
  $editor.innerHTML = value;
36893
36888
  if ($copyTo) $copyTo.innerHTML = value;
36894
36889
  functionRange(ctx, $editor, value, value1);
36895
- if (refreshRangeSelect) {
36896
- cancelFunctionrangeSelected(ctx);
36897
- if (kcode !== 46) {
36898
- createRangeHightlight(ctx, value);
36899
- }
36900
- ctx.formulaCache.rangestart = false;
36901
- ctx.formulaCache.rangedrag_column_start = false;
36902
- ctx.formulaCache.rangedrag_row_start = false;
36903
- rangeHightlightselected(ctx, $editor);
36904
- }
36905
- } else if (___default['default'].startsWith(value1txt, "=") && !___default['default'].startsWith(value, "=")) {
36890
+ } else if (lastHasF) {
36906
36891
  if ($copyTo) $copyTo.innerHTML = value;
36907
36892
  $editor.innerHTML = escapeHTMLTag(value);
36893
+ ctx.formulaCache.functionRangeIndex = [0, 1];
36908
36894
  } else if (!___default['default'].startsWith(value1txt, "=")) {
36909
36895
  if (!$copyTo) return;
36910
36896
  if ($copyTo.id === "luckysheet-rich-text-editor") {
@@ -36915,6 +36901,18 @@ function handleFormulaInput(ctx, $copyTo, $editor, kcode, preText) {
36915
36901
  $copyTo.innerHTML = escapeHTMLTag(value);
36916
36902
  }
36917
36903
  }
36904
+ if (hasF || lastHasF) {
36905
+ if (refreshRangeSelect) {
36906
+ cancelFunctionrangeSelected(ctx);
36907
+ if (kcode !== 46) {
36908
+ createRangeHightlight(ctx, value);
36909
+ }
36910
+ ctx.formulaCache.rangestart = false;
36911
+ ctx.formulaCache.rangedrag_column_start = false;
36912
+ ctx.formulaCache.rangedrag_row_start = false;
36913
+ rangeHightlightselected(ctx, $editor);
36914
+ }
36915
+ }
36918
36916
  }
36919
36917
  function isfreezonFuc(txt) {
36920
36918
  var row = txt.replace(/[^0-9]/g, "");
@@ -42228,6 +42226,11 @@ function rangeValueToHtml(ctx, sheetId, ranges) {
42228
42226
  }
42229
42227
  return "<table data-type=\"leankylin-copy-action-table\">".concat(colgroup).concat(cpdata, "</table>");
42230
42228
  }
42229
+ function ptToPx(pt) {
42230
+ var ppi = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 96;
42231
+ var px = pt * (ppi / 72);
42232
+ return parseFloat(px.toFixed(2));
42233
+ }
42231
42234
  function cellAttrToDomStyle(cell, cellBorderInfo) {
42232
42235
  var _ref = cell || {},
42233
42236
  bg = _ref.bg,
@@ -42248,7 +42251,7 @@ function cellAttrToDomStyle(cell, cellBorderInfo) {
42248
42251
  2: "bottom"
42249
42252
  }[String(vt)] || "middle";
42250
42253
  var fontWeight = bl === 1 ? "bold" : "normal";
42251
- var fontSize = "".concat(parseInt(fs, 10), "px");
42254
+ var fontSize = typeof fs === "number" ? ptToPx(fs) : "".concat(parseInt(fs, 10), "px");
42252
42255
  var result = {
42253
42256
  background: bg || "#fff",
42254
42257
  color: fc || "#000",
@@ -42289,6 +42292,7 @@ function copy(ctx) {
42289
42292
  var data = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r = flowdata[r]) === null || _flowdata$r === void 0 ? void 0 : _flowdata$r[c];
42290
42293
  var value = (_ref2 = (_data$m = data === null || data === void 0 ? void 0 : data.m) !== null && _data$m !== void 0 ? _data$m : data === null || data === void 0 ? void 0 : data.v) !== null && _ref2 !== void 0 ? _ref2 : "";
42291
42294
  var realValue = (_ref3 = (_data$v = data === null || data === void 0 ? void 0 : data.v) !== null && _data$v !== void 0 ? _data$v : data === null || data === void 0 ? void 0 : data.m) !== null && _ref3 !== void 0 ? _ref3 : "";
42295
+ var f = (data === null || data === void 0 ? void 0 : data.f) || "";
42292
42296
  var rowspan = (_data$mc$rs = data === null || data === void 0 ? void 0 : (_data$mc = data.mc) === null || _data$mc === void 0 ? void 0 : _data$mc.rs) !== null && _data$mc$rs !== void 0 ? _data$mc$rs : 1;
42293
42297
  var colspan = (_data$mc$cs = data === null || data === void 0 ? void 0 : (_data$mc2 = data.mc) === null || _data$mc2 === void 0 ? void 0 : _data$mc2.cs) !== null && _data$mc$cs !== void 0 ? _data$mc$cs : 1;
42294
42298
  if (!(data === null || data === void 0 ? void 0 : data.mc) || (data === null || data === void 0 ? void 0 : data.mc) && (data === null || data === void 0 ? void 0 : data.mc.r) === r && data.mc.c === c) {
@@ -42297,7 +42301,7 @@ function copy(ctx) {
42297
42301
  var styleStr = (_Object$keys = Object.keys(style)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(function (item) {
42298
42302
  return "".concat(item, ":").concat(style[item], ";");
42299
42303
  }).join("");
42300
- cpString += "<td x:num='".concat(realValue, "' style='").concat(styleStr, "' rowspan=").concat(rowspan, " colspan=").concat(colspan, ">").concat(value, "</td>");
42304
+ cpString += "<td x:num='".concat(realValue, "' f='").concat(f, "' style='").concat(styleStr, "' rowspan=").concat(rowspan, " colspan=").concat(colspan, ">").concat(value, "</td>");
42301
42305
  }
42302
42306
  };
42303
42307
  for (var c = columns[0]; c <= columns[1]; c += 1) {
@@ -51978,7 +51982,7 @@ var Canvas = /*#__PURE__*/function () {
51978
51982
  continue;
51979
51983
  }
51980
51984
  if (((_this$sheetCtx$config = this.sheetCtx.config) === null || _this$sheetCtx$config === void 0 ? void 0 : (_this$sheetCtx$config2 = _this$sheetCtx$config.rowhidden) === null || _this$sheetCtx$config2 === void 0 ? void 0 : _this$sheetCtx$config2[r]) == null) {
51981
- renderCtx.fillStyle = "#ffffff";
51985
+ renderCtx.fillStyle = "#F8F9FA";
51982
51986
  renderCtx.fillRect(0, start_r + offsetTop + firstOffset, this.sheetCtx.rowHeaderWidth - 1, end_r - start_r + 1 + lastOffset - firstOffset);
51983
51987
  renderCtx.fillStyle = "#000000";
51984
51988
  renderCtx.save();
@@ -52071,7 +52075,7 @@ var Canvas = /*#__PURE__*/function () {
52071
52075
  continue;
52072
52076
  }
52073
52077
  if (((_this$sheetCtx$config5 = this.sheetCtx.config) === null || _this$sheetCtx$config5 === void 0 ? void 0 : (_this$sheetCtx$config6 = _this$sheetCtx$config5.colhidden) === null || _this$sheetCtx$config6 === void 0 ? void 0 : _this$sheetCtx$config6[c]) == null) {
52074
- renderCtx.fillStyle = "#ffffff";
52078
+ renderCtx.fillStyle = "#F8F9FA";
52075
52079
  renderCtx.fillRect(start_c + offsetLeft - 1, 0, end_c - start_c, this.sheetCtx.columnHeaderHeight - 1);
52076
52080
  renderCtx.fillStyle = "#000000";
52077
52081
  renderCtx.save();
@@ -53824,10 +53828,6 @@ function createFilter(ctx) {
53824
53828
  if (___default['default'].size(ctx.luckysheet_select_save) > 1) {
53825
53829
  return;
53826
53830
  }
53827
- if (___default['default'].size(ctx.luckysheet_filter_save) > 0) {
53828
- clearFilter(ctx);
53829
- return;
53830
- }
53831
53831
  var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
53832
53832
  if (sheetIndex == null || ctx.luckysheetfile[sheetIndex].isPivotTable) {
53833
53833
  return;
@@ -55896,6 +55896,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
55896
55896
  }
55897
55897
  }
55898
55898
  }
55899
+ function setCellValues(ctx, data, cellInput) {
55900
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
55901
+ if (data == null) {
55902
+ throw INVALID_PARAMS;
55903
+ }
55904
+ for (var j = 0; j < data.length; j += 1) {
55905
+ var _data$j = data[j],
55906
+ r = _data$j.r,
55907
+ c = _data$j.c,
55908
+ v = _data$j.v;
55909
+ setCellValue$1(ctx, r, c, v, cellInput, options);
55910
+ }
55911
+ }
55899
55912
  function setCellFormatByRange(ctx, attr, value, range) {
55900
55913
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
55901
55914
  if (___default['default'].isPlainObject(range)) {
@@ -56020,6 +56033,7 @@ var index = /*#__PURE__*/Object.freeze({
56020
56033
  getHtmlByRange: getHtmlByRange,
56021
56034
  setSelection: setSelection,
56022
56035
  setCellValuesByRange: setCellValuesByRange,
56036
+ setCellValues: setCellValues,
56023
56037
  setCellFormatByRange: setCellFormatByRange,
56024
56038
  mergeCells: mergeCells$1,
56025
56039
  cancelMerge: cancelMerge,
@@ -56040,8 +56054,12 @@ var index = /*#__PURE__*/Object.freeze({
56040
56054
  });
56041
56055
 
56042
56056
  var defaultSettings = {
56057
+ toolbarRightRender: undefined,
56058
+ onClickContentEditable: undefined,
56059
+ renderCustomColor: undefined,
56043
56060
  renderFormulaHint: undefined,
56044
56061
  renderFormulaSearch: undefined,
56062
+ renderEditorSelector: undefined,
56045
56063
  copyRich: false,
56046
56064
  renderCalcInfo: undefined,
56047
56065
  renderFreezeCol: undefined,
@@ -59662,14 +59680,32 @@ var getCellBorder = function getCellBorder(domStyle, row_index, col_index) {
59662
59680
  };
59663
59681
  };
59664
59682
  var getCellMcBorder = function getCellMcBorder(ctx, domStyle, row_index, col_index, mc) {
59665
- var keys = [["border-left", "borderLeftWidth", "borderLeftColor", "borderLeftStyle"], ["border-top", "borderTopWidth", "borderTopColor", "borderTopStyle"], ["border-right", "borderRightWidth", "borderRightColor", "borderRightStyle"], ["border-bottom", "borderBottomWidth", "borderBottomColor", "borderBottomStyle"]];
59683
+ var keys = [["border-left", "borderLeftWidth", "borderLeftColor", "borderLeftStyle", function (curIndex, rs) {
59684
+ return [curIndex, curIndex + rs - 1];
59685
+ }, function (curIndex) {
59686
+ return [curIndex, curIndex];
59687
+ }], ["border-top", "borderTopWidth", "borderTopColor", "borderTopStyle", function (curIndex) {
59688
+ return [curIndex, curIndex];
59689
+ }, function (curIndex, cs) {
59690
+ return [curIndex, curIndex + cs - 1];
59691
+ }], ["border-right", "borderRightWidth", "borderRightColor", "borderRightStyle", function (curIndex, rs) {
59692
+ return [curIndex, curIndex + rs - 1];
59693
+ }, function (curIndex, cs) {
59694
+ return [curIndex + cs - 1, curIndex + cs - 1];
59695
+ }], ["border-bottom", "borderBottomWidth", "borderBottomColor", "borderBottomStyle", function (curIndex, cs) {
59696
+ return [curIndex + cs - 1, curIndex + cs - 1];
59697
+ }, function (curIndex, cs) {
59698
+ return [curIndex, curIndex + cs - 1];
59699
+ }]];
59666
59700
  var result = [];
59667
59701
  for (var index = 0; index < keys.length; index += 1) {
59668
- var _keys$index2 = _slicedToArray(keys[index], 4),
59702
+ var _keys$index2 = _slicedToArray(keys[index], 6),
59669
59703
  p = _keys$index2[0],
59670
59704
  w = _keys$index2[1],
59671
59705
  c = _keys$index2[2],
59672
- s = _keys$index2[3];
59706
+ s = _keys$index2[3],
59707
+ getRow = _keys$index2[4],
59708
+ getColumn = _keys$index2[5];
59673
59709
  if (parseFloat(domStyle[w]) > 0 && domStyle[s] !== "inset") {
59674
59710
  var _getQKBorder = getQKBorder(domStyle[w], domStyle[s], domStyle[c]),
59675
59711
  _getQKBorder2 = _slicedToArray(_getQKBorder, 2),
@@ -59681,8 +59717,8 @@ var getCellMcBorder = function getCellMcBorder(ctx, domStyle, row_index, col_ind
59681
59717
  color: color,
59682
59718
  style: style,
59683
59719
  range: normalizeSelection(ctx, [{
59684
- row: [row_index, row_index + mc.rs - 1],
59685
- column: [col_index, col_index + mc.cs - 1]
59720
+ row: getRow(row_index, mc.rs),
59721
+ column: getColumn(col_index, mc.cs)
59686
59722
  }])
59687
59723
  });
59688
59724
  }
@@ -59729,34 +59765,73 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59729
59765
  }
59730
59766
  var result = [];
59731
59767
  var borderInfo = [];
59768
+ var startOffColIndexMap = {};
59732
59769
  for (var index = 0; index < (rows === null || rows === void 0 ? void 0 : rows.length); index += 1) {
59733
59770
  var row = rows[index];
59771
+ var isFirstNoRs = false;
59734
59772
  var cells = row.querySelectorAll("td");
59735
59773
  if (!result[index]) {
59736
59774
  result[index] = [];
59737
59775
  }
59776
+ var offsetColIndex = 0;
59738
59777
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
59778
+ var _colIndex = startCol + offsetColIndex + (startOffColIndexMap[index] || 0);
59739
59779
  var cell = cells[cIndex];
59740
59780
  var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
59741
59781
  var v = cell.getAttribute("x:num");
59782
+ var f = cell.getAttribute("f");
59742
59783
  if (copyRich) {
59743
59784
  var style = iframe.contentWindow.getComputedStyle(cell);
59744
59785
  var rowspan = Number(cell.getAttribute("rowspan")) || 1;
59745
59786
  var colspan = Number(cell.getAttribute("colspan")) || 1;
59746
59787
  var mainCell = _objectSpread2({
59747
59788
  v: v || m,
59748
- m: m || v
59789
+ m: m || v,
59790
+ f: f || undefined
59749
59791
  }, domStyleToCellAttr(style));
59750
59792
  if (colspan > 1 || rowspan > 1) {
59751
59793
  mainCell.mc = {
59752
59794
  rs: rowspan,
59753
- cs: colspan
59795
+ cs: colspan,
59796
+ r: index + startRow,
59797
+ c: _colIndex
59754
59798
  };
59755
- borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, cIndex + startCol, mainCell.mc)));
59799
+ borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, _colIndex, mainCell.mc)));
59756
59800
  } else {
59757
- borderInfo.push(getCellBorder(style, index + startRow, cIndex + startCol));
59801
+ isFirstNoRs = true;
59802
+ borderInfo.push(getCellBorder(style, index + startRow, _colIndex));
59758
59803
  }
59759
59804
  result[index].push(mainCell);
59805
+ if (rowspan > 1) {
59806
+ for (var rs_index = 1; rs_index < rowspan; rs_index += 1) {
59807
+ if (!result[index + rs_index]) {
59808
+ result[index + rs_index] = [];
59809
+ }
59810
+ result[index + rs_index].push({
59811
+ mc: {
59812
+ r: index + startRow,
59813
+ c: _colIndex
59814
+ }
59815
+ });
59816
+ if (!isFirstNoRs) {
59817
+ if (!startOffColIndexMap[index + rs_index]) {
59818
+ startOffColIndexMap[index + rs_index] = 0;
59819
+ }
59820
+ startOffColIndexMap[index + rs_index] += colspan || 1;
59821
+ }
59822
+ }
59823
+ }
59824
+ if (colspan > 1) {
59825
+ for (var cs_index = 1; cs_index < colspan; cs_index += 1) {
59826
+ result[index].push({
59827
+ mc: {
59828
+ r: index + startRow,
59829
+ c: _colIndex
59830
+ }
59831
+ });
59832
+ }
59833
+ }
59834
+ offsetColIndex += colspan || 1;
59760
59835
  } else {
59761
59836
  result[index].push({
59762
59837
  m: m,
@@ -59770,57 +59845,6 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59770
59845
  borderInfo: borderInfo
59771
59846
  };
59772
59847
  }
59773
- function expandMergedCells(mergedCells, startRow, startCol) {
59774
- if (!mergedCells || mergedCells.length === 0) {
59775
- return [];
59776
- }
59777
- var totalRows = mergedCells === null || mergedCells === void 0 ? void 0 : mergedCells.length;
59778
- var totalCols = 0;
59779
- for (var j = 0; j < mergedCells[0].length; j += 1) {
59780
- var _mergedCells$0$j, _mergedCells$0$j$mc;
59781
- totalCols += ((_mergedCells$0$j = mergedCells[0][j]) === null || _mergedCells$0$j === void 0 ? void 0 : (_mergedCells$0$j$mc = _mergedCells$0$j.mc) === null || _mergedCells$0$j$mc === void 0 ? void 0 : _mergedCells$0$j$mc.cs) || 1;
59782
- }
59783
- var result = Array.from({
59784
- length: totalRows
59785
- }, function () {
59786
- return new Array(totalCols);
59787
- });
59788
- var currentRow = 0;
59789
- for (var i = 0; i < mergedCells.length; i += 1) {
59790
- var currentCol = 0;
59791
- var rowHeight = 0;
59792
- for (var _j7 = 0; _j7 < mergedCells[i].length; _j7 += 1) {
59793
- var _cell$mc2, _cell$mc3;
59794
- var cell = mergedCells[i][_j7];
59795
- var rs = (cell === null || cell === void 0 ? void 0 : (_cell$mc2 = cell.mc) === null || _cell$mc2 === void 0 ? void 0 : _cell$mc2.rs) || 1;
59796
- var cs = (cell === null || cell === void 0 ? void 0 : (_cell$mc3 = cell.mc) === null || _cell$mc3 === void 0 ? void 0 : _cell$mc3.cs) || 1;
59797
- rowHeight = Math.max(rowHeight, rs);
59798
- for (var r = 0; r < rs; r += 1) {
59799
- for (var c = 0; c < cs; c += 1) {
59800
- var mcR = currentRow + startRow;
59801
- var mcC = currentCol + startCol;
59802
- if (r === 0 && c === 0) {
59803
- result[currentRow + r][currentCol + c] = _objectSpread2({}, cell);
59804
- if (result[currentRow + r][currentCol + c].mc) {
59805
- result[currentRow + r][currentCol + c].mc.r = mcR;
59806
- result[currentRow + r][currentCol + c].mc.c = mcC;
59807
- }
59808
- } else {
59809
- result[currentRow + r][currentCol + c] = {
59810
- mc: {
59811
- r: mcR,
59812
- c: mcC
59813
- }
59814
- };
59815
- }
59816
- }
59817
- }
59818
- currentCol += cs;
59819
- }
59820
- currentRow += rowHeight;
59821
- }
59822
- return result;
59823
- }
59824
59848
  function handlePasteByLeanklin(_x2, _x3, _x4) {
59825
59849
  return _handlePasteByLeanklin.apply(this, arguments);
59826
59850
  }
@@ -59856,7 +59880,7 @@ function _handlePasteByLeanklin() {
59856
59880
  }
59857
59881
  index = getSheetIndex(ctx, ctx.currentSheetId);
59858
59882
  ctx.luckysheetfile[index].config = ctx.config;
59859
- data = expandMergedCells(copyData, rows[0], columns[0]);
59883
+ data = copyData;
59860
59884
  copyOne = data.length === 1 && data[0].length === 1 && !((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.mc);
59861
59885
  pasteData = copyOne ? [] : data;
59862
59886
  if (copyOne) {
@@ -60044,6 +60068,7 @@ exports.getTypeItemHide = getTypeItemHide;
60044
60068
  exports.getcellFormula = getcellFormula;
60045
60069
  exports.getcellrange = getcellrange;
60046
60070
  exports.getdatabyselection = getdatabyselection;
60071
+ exports.getrangeseleciton = getrangeseleciton;
60047
60072
  exports.goToLink = goToLink;
60048
60073
  exports.groupValuesRefresh = groupValuesRefresh;
60049
60074
  exports.handleArrowKey = handleArrowKey;
@@ -40,6 +40,7 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
40
40
  } & Rect): void;
41
41
  export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
42
42
  export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
43
+ export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
43
44
  export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
44
45
  export declare function functionHTMLGenerate(txt: string): string;
45
46
  export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
@@ -78,8 +78,12 @@ export type Hooks = {
78
78
  afterUpdateSheetName?: (id: string, oldName: string, newName: string) => void;
79
79
  };
80
80
  export type Settings = {
81
+ toolbarRightRender?: any;
82
+ onClickContentEditable?: any;
83
+ renderCustomColor?: any;
81
84
  renderFormulaHint?: any;
82
85
  renderFormulaSearch?: any;
86
+ renderEditorSelector?: any;
83
87
  copyRich?: boolean;
84
88
  renderCalcInfo?: any;
85
89
  renderFreezeCol?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "father-build"
14
14
  },
15
15
  "dependencies": {
16
- "@leankylin-sheet/formula-parser": "4.0.0",
16
+ "@leankylin-sheet/formula-parser": "4.0.2",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",