@leankylin-sheet/core 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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) {
@@ -55886,6 +55890,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
55886
55890
  }
55887
55891
  }
55888
55892
  }
55893
+ function setCellValues(ctx, data, cellInput) {
55894
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
55895
+ if (data == null) {
55896
+ throw INVALID_PARAMS;
55897
+ }
55898
+ for (var j = 0; j < data.length; j += 1) {
55899
+ var _data$j = data[j],
55900
+ r = _data$j.r,
55901
+ c = _data$j.c,
55902
+ v = _data$j.v;
55903
+ setCellValue$1(ctx, r, c, v, cellInput, options);
55904
+ }
55905
+ }
55889
55906
  function setCellFormatByRange(ctx, attr, value, range) {
55890
55907
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
55891
55908
  if (_.isPlainObject(range)) {
@@ -56010,6 +56027,7 @@ var index = /*#__PURE__*/Object.freeze({
56010
56027
  getHtmlByRange: getHtmlByRange,
56011
56028
  setSelection: setSelection,
56012
56029
  setCellValuesByRange: setCellValuesByRange,
56030
+ setCellValues: setCellValues,
56013
56031
  setCellFormatByRange: setCellFormatByRange,
56014
56032
  mergeCells: mergeCells$1,
56015
56033
  cancelMerge: cancelMerge,
@@ -56030,8 +56048,12 @@ var index = /*#__PURE__*/Object.freeze({
56030
56048
  });
56031
56049
 
56032
56050
  var defaultSettings = {
56051
+ toolbarRightRender: undefined,
56052
+ onClickContentEditable: undefined,
56053
+ renderCustomColor: undefined,
56033
56054
  renderFormulaHint: undefined,
56034
56055
  renderFormulaSearch: undefined,
56056
+ renderEditorSelector: undefined,
56035
56057
  copyRich: false,
56036
56058
  renderCalcInfo: undefined,
56037
56059
  renderFreezeCol: undefined,
@@ -59652,14 +59674,32 @@ var getCellBorder = function getCellBorder(domStyle, row_index, col_index) {
59652
59674
  };
59653
59675
  };
59654
59676
  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"]];
59677
+ var keys = [["border-left", "borderLeftWidth", "borderLeftColor", "borderLeftStyle", function (curIndex, rs) {
59678
+ return [curIndex, curIndex + rs - 1];
59679
+ }, function (curIndex) {
59680
+ return [curIndex, curIndex];
59681
+ }], ["border-top", "borderTopWidth", "borderTopColor", "borderTopStyle", function (curIndex) {
59682
+ return [curIndex, curIndex];
59683
+ }, function (curIndex, cs) {
59684
+ return [curIndex, curIndex + cs - 1];
59685
+ }], ["border-right", "borderRightWidth", "borderRightColor", "borderRightStyle", function (curIndex, rs) {
59686
+ return [curIndex, curIndex + rs - 1];
59687
+ }, function (curIndex, cs) {
59688
+ return [curIndex + cs - 1, curIndex + cs - 1];
59689
+ }], ["border-bottom", "borderBottomWidth", "borderBottomColor", "borderBottomStyle", function (curIndex, cs) {
59690
+ return [curIndex + cs - 1, curIndex + cs - 1];
59691
+ }, function (curIndex, cs) {
59692
+ return [curIndex, curIndex + cs - 1];
59693
+ }]];
59656
59694
  var result = [];
59657
59695
  for (var index = 0; index < keys.length; index += 1) {
59658
- var _keys$index2 = _slicedToArray(keys[index], 4),
59696
+ var _keys$index2 = _slicedToArray(keys[index], 6),
59659
59697
  p = _keys$index2[0],
59660
59698
  w = _keys$index2[1],
59661
59699
  c = _keys$index2[2],
59662
- s = _keys$index2[3];
59700
+ s = _keys$index2[3],
59701
+ getRow = _keys$index2[4],
59702
+ getColumn = _keys$index2[5];
59663
59703
  if (parseFloat(domStyle[w]) > 0 && domStyle[s] !== "inset") {
59664
59704
  var _getQKBorder = getQKBorder(domStyle[w], domStyle[s], domStyle[c]),
59665
59705
  _getQKBorder2 = _slicedToArray(_getQKBorder, 2),
@@ -59671,8 +59711,8 @@ var getCellMcBorder = function getCellMcBorder(ctx, domStyle, row_index, col_ind
59671
59711
  color: color,
59672
59712
  style: style,
59673
59713
  range: normalizeSelection(ctx, [{
59674
- row: [row_index, row_index + mc.rs - 1],
59675
- column: [col_index, col_index + mc.cs - 1]
59714
+ row: getRow(row_index, mc.rs),
59715
+ column: getColumn(col_index, mc.cs)
59676
59716
  }])
59677
59717
  });
59678
59718
  }
@@ -59719,34 +59759,73 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59719
59759
  }
59720
59760
  var result = [];
59721
59761
  var borderInfo = [];
59762
+ var startOffColIndexMap = {};
59722
59763
  for (var index = 0; index < (rows === null || rows === void 0 ? void 0 : rows.length); index += 1) {
59723
59764
  var row = rows[index];
59765
+ var isFirstNoRs = false;
59724
59766
  var cells = row.querySelectorAll("td");
59725
59767
  if (!result[index]) {
59726
59768
  result[index] = [];
59727
59769
  }
59770
+ var offsetColIndex = 0;
59728
59771
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
59772
+ var _colIndex = startCol + offsetColIndex + (startOffColIndexMap[index] || 0);
59729
59773
  var cell = cells[cIndex];
59730
59774
  var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
59731
59775
  var v = cell.getAttribute("x:num");
59776
+ var f = cell.getAttribute("f");
59732
59777
  if (copyRich) {
59733
59778
  var style = iframe.contentWindow.getComputedStyle(cell);
59734
59779
  var rowspan = Number(cell.getAttribute("rowspan")) || 1;
59735
59780
  var colspan = Number(cell.getAttribute("colspan")) || 1;
59736
59781
  var mainCell = _objectSpread2({
59737
59782
  v: v || m,
59738
- m: m || v
59783
+ m: m || v,
59784
+ f: f || undefined
59739
59785
  }, domStyleToCellAttr(style));
59740
59786
  if (colspan > 1 || rowspan > 1) {
59741
59787
  mainCell.mc = {
59742
59788
  rs: rowspan,
59743
- cs: colspan
59789
+ cs: colspan,
59790
+ r: index + startRow,
59791
+ c: _colIndex
59744
59792
  };
59745
- borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, cIndex + startCol, mainCell.mc)));
59793
+ borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, _colIndex, mainCell.mc)));
59746
59794
  } else {
59747
- borderInfo.push(getCellBorder(style, index + startRow, cIndex + startCol));
59795
+ isFirstNoRs = true;
59796
+ borderInfo.push(getCellBorder(style, index + startRow, _colIndex));
59748
59797
  }
59749
59798
  result[index].push(mainCell);
59799
+ if (rowspan > 1) {
59800
+ for (var rs_index = 1; rs_index < rowspan; rs_index += 1) {
59801
+ if (!result[index + rs_index]) {
59802
+ result[index + rs_index] = [];
59803
+ }
59804
+ result[index + rs_index].push({
59805
+ mc: {
59806
+ r: index + startRow,
59807
+ c: _colIndex
59808
+ }
59809
+ });
59810
+ if (!isFirstNoRs) {
59811
+ if (!startOffColIndexMap[index + rs_index]) {
59812
+ startOffColIndexMap[index + rs_index] = 0;
59813
+ }
59814
+ startOffColIndexMap[index + rs_index] += colspan || 1;
59815
+ }
59816
+ }
59817
+ }
59818
+ if (colspan > 1) {
59819
+ for (var cs_index = 1; cs_index < colspan; cs_index += 1) {
59820
+ result[index].push({
59821
+ mc: {
59822
+ r: index + startRow,
59823
+ c: _colIndex
59824
+ }
59825
+ });
59826
+ }
59827
+ }
59828
+ offsetColIndex += colspan || 1;
59750
59829
  } else {
59751
59830
  result[index].push({
59752
59831
  m: m,
@@ -59760,57 +59839,6 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59760
59839
  borderInfo: borderInfo
59761
59840
  };
59762
59841
  }
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
59842
  function handlePasteByLeanklin(_x2, _x3, _x4) {
59815
59843
  return _handlePasteByLeanklin.apply(this, arguments);
59816
59844
  }
@@ -59846,7 +59874,7 @@ function _handlePasteByLeanklin() {
59846
59874
  }
59847
59875
  index = getSheetIndex(ctx, ctx.currentSheetId);
59848
59876
  ctx.luckysheetfile[index].config = ctx.config;
59849
- data = expandMergedCells(copyData, rows[0], columns[0]);
59877
+ data = copyData;
59850
59878
  copyOne = data.length === 1 && data[0].length === 1 && !((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.mc);
59851
59879
  pasteData = copyOne ? [] : data;
59852
59880
  if (copyOne) {
@@ -59897,4 +59925,4 @@ function handlePasteByClick(ctx, triggerType) {
59897
59925
  } else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
59898
59926
  }
59899
59927
 
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 };
59928
+ 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) {
@@ -55896,6 +55900,19 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
55896
55900
  }
55897
55901
  }
55898
55902
  }
55903
+ function setCellValues(ctx, data, cellInput) {
55904
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
55905
+ if (data == null) {
55906
+ throw INVALID_PARAMS;
55907
+ }
55908
+ for (var j = 0; j < data.length; j += 1) {
55909
+ var _data$j = data[j],
55910
+ r = _data$j.r,
55911
+ c = _data$j.c,
55912
+ v = _data$j.v;
55913
+ setCellValue$1(ctx, r, c, v, cellInput, options);
55914
+ }
55915
+ }
55899
55916
  function setCellFormatByRange(ctx, attr, value, range) {
55900
55917
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
55901
55918
  if (___default['default'].isPlainObject(range)) {
@@ -56020,6 +56037,7 @@ var index = /*#__PURE__*/Object.freeze({
56020
56037
  getHtmlByRange: getHtmlByRange,
56021
56038
  setSelection: setSelection,
56022
56039
  setCellValuesByRange: setCellValuesByRange,
56040
+ setCellValues: setCellValues,
56023
56041
  setCellFormatByRange: setCellFormatByRange,
56024
56042
  mergeCells: mergeCells$1,
56025
56043
  cancelMerge: cancelMerge,
@@ -56040,8 +56058,12 @@ var index = /*#__PURE__*/Object.freeze({
56040
56058
  });
56041
56059
 
56042
56060
  var defaultSettings = {
56061
+ toolbarRightRender: undefined,
56062
+ onClickContentEditable: undefined,
56063
+ renderCustomColor: undefined,
56043
56064
  renderFormulaHint: undefined,
56044
56065
  renderFormulaSearch: undefined,
56066
+ renderEditorSelector: undefined,
56045
56067
  copyRich: false,
56046
56068
  renderCalcInfo: undefined,
56047
56069
  renderFreezeCol: undefined,
@@ -59662,14 +59684,32 @@ var getCellBorder = function getCellBorder(domStyle, row_index, col_index) {
59662
59684
  };
59663
59685
  };
59664
59686
  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"]];
59687
+ var keys = [["border-left", "borderLeftWidth", "borderLeftColor", "borderLeftStyle", function (curIndex, rs) {
59688
+ return [curIndex, curIndex + rs - 1];
59689
+ }, function (curIndex) {
59690
+ return [curIndex, curIndex];
59691
+ }], ["border-top", "borderTopWidth", "borderTopColor", "borderTopStyle", function (curIndex) {
59692
+ return [curIndex, curIndex];
59693
+ }, function (curIndex, cs) {
59694
+ return [curIndex, curIndex + cs - 1];
59695
+ }], ["border-right", "borderRightWidth", "borderRightColor", "borderRightStyle", function (curIndex, rs) {
59696
+ return [curIndex, curIndex + rs - 1];
59697
+ }, function (curIndex, cs) {
59698
+ return [curIndex + cs - 1, curIndex + cs - 1];
59699
+ }], ["border-bottom", "borderBottomWidth", "borderBottomColor", "borderBottomStyle", function (curIndex, cs) {
59700
+ return [curIndex + cs - 1, curIndex + cs - 1];
59701
+ }, function (curIndex, cs) {
59702
+ return [curIndex, curIndex + cs - 1];
59703
+ }]];
59666
59704
  var result = [];
59667
59705
  for (var index = 0; index < keys.length; index += 1) {
59668
- var _keys$index2 = _slicedToArray(keys[index], 4),
59706
+ var _keys$index2 = _slicedToArray(keys[index], 6),
59669
59707
  p = _keys$index2[0],
59670
59708
  w = _keys$index2[1],
59671
59709
  c = _keys$index2[2],
59672
- s = _keys$index2[3];
59710
+ s = _keys$index2[3],
59711
+ getRow = _keys$index2[4],
59712
+ getColumn = _keys$index2[5];
59673
59713
  if (parseFloat(domStyle[w]) > 0 && domStyle[s] !== "inset") {
59674
59714
  var _getQKBorder = getQKBorder(domStyle[w], domStyle[s], domStyle[c]),
59675
59715
  _getQKBorder2 = _slicedToArray(_getQKBorder, 2),
@@ -59681,8 +59721,8 @@ var getCellMcBorder = function getCellMcBorder(ctx, domStyle, row_index, col_ind
59681
59721
  color: color,
59682
59722
  style: style,
59683
59723
  range: normalizeSelection(ctx, [{
59684
- row: [row_index, row_index + mc.rs - 1],
59685
- column: [col_index, col_index + mc.cs - 1]
59724
+ row: getRow(row_index, mc.rs),
59725
+ column: getColumn(col_index, mc.cs)
59686
59726
  }])
59687
59727
  });
59688
59728
  }
@@ -59729,34 +59769,73 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59729
59769
  }
59730
59770
  var result = [];
59731
59771
  var borderInfo = [];
59772
+ var startOffColIndexMap = {};
59732
59773
  for (var index = 0; index < (rows === null || rows === void 0 ? void 0 : rows.length); index += 1) {
59733
59774
  var row = rows[index];
59775
+ var isFirstNoRs = false;
59734
59776
  var cells = row.querySelectorAll("td");
59735
59777
  if (!result[index]) {
59736
59778
  result[index] = [];
59737
59779
  }
59780
+ var offsetColIndex = 0;
59738
59781
  for (var cIndex = 0; cIndex < cells.length; cIndex += 1) {
59782
+ var _colIndex = startCol + offsetColIndex + (startOffColIndexMap[index] || 0);
59739
59783
  var cell = cells[cIndex];
59740
59784
  var m = cell === null || cell === void 0 ? void 0 : cell.textContent;
59741
59785
  var v = cell.getAttribute("x:num");
59786
+ var f = cell.getAttribute("f");
59742
59787
  if (copyRich) {
59743
59788
  var style = iframe.contentWindow.getComputedStyle(cell);
59744
59789
  var rowspan = Number(cell.getAttribute("rowspan")) || 1;
59745
59790
  var colspan = Number(cell.getAttribute("colspan")) || 1;
59746
59791
  var mainCell = _objectSpread2({
59747
59792
  v: v || m,
59748
- m: m || v
59793
+ m: m || v,
59794
+ f: f || undefined
59749
59795
  }, domStyleToCellAttr(style));
59750
59796
  if (colspan > 1 || rowspan > 1) {
59751
59797
  mainCell.mc = {
59752
59798
  rs: rowspan,
59753
- cs: colspan
59799
+ cs: colspan,
59800
+ r: index + startRow,
59801
+ c: _colIndex
59754
59802
  };
59755
- borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, cIndex + startCol, mainCell.mc)));
59803
+ borderInfo.push.apply(borderInfo, _toConsumableArray(getCellMcBorder(ctx, style, index + startRow, _colIndex, mainCell.mc)));
59756
59804
  } else {
59757
- borderInfo.push(getCellBorder(style, index + startRow, cIndex + startCol));
59805
+ isFirstNoRs = true;
59806
+ borderInfo.push(getCellBorder(style, index + startRow, _colIndex));
59758
59807
  }
59759
59808
  result[index].push(mainCell);
59809
+ if (rowspan > 1) {
59810
+ for (var rs_index = 1; rs_index < rowspan; rs_index += 1) {
59811
+ if (!result[index + rs_index]) {
59812
+ result[index + rs_index] = [];
59813
+ }
59814
+ result[index + rs_index].push({
59815
+ mc: {
59816
+ r: index + startRow,
59817
+ c: _colIndex
59818
+ }
59819
+ });
59820
+ if (!isFirstNoRs) {
59821
+ if (!startOffColIndexMap[index + rs_index]) {
59822
+ startOffColIndexMap[index + rs_index] = 0;
59823
+ }
59824
+ startOffColIndexMap[index + rs_index] += colspan || 1;
59825
+ }
59826
+ }
59827
+ }
59828
+ if (colspan > 1) {
59829
+ for (var cs_index = 1; cs_index < colspan; cs_index += 1) {
59830
+ result[index].push({
59831
+ mc: {
59832
+ r: index + startRow,
59833
+ c: _colIndex
59834
+ }
59835
+ });
59836
+ }
59837
+ }
59838
+ offsetColIndex += colspan || 1;
59760
59839
  } else {
59761
59840
  result[index].push({
59762
59841
  m: m,
@@ -59770,57 +59849,6 @@ function getClipboardData(ctx, e, copyRich, startRow, startCol) {
59770
59849
  borderInfo: borderInfo
59771
59850
  };
59772
59851
  }
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
59852
  function handlePasteByLeanklin(_x2, _x3, _x4) {
59825
59853
  return _handlePasteByLeanklin.apply(this, arguments);
59826
59854
  }
@@ -59856,7 +59884,7 @@ function _handlePasteByLeanklin() {
59856
59884
  }
59857
59885
  index = getSheetIndex(ctx, ctx.currentSheetId);
59858
59886
  ctx.luckysheetfile[index].config = ctx.config;
59859
- data = expandMergedCells(copyData, rows[0], columns[0]);
59887
+ data = copyData;
59860
59888
  copyOne = data.length === 1 && data[0].length === 1 && !((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.mc);
59861
59889
  pasteData = copyOne ? [] : data;
59862
59890
  if (copyOne) {
@@ -60044,6 +60072,7 @@ exports.getTypeItemHide = getTypeItemHide;
60044
60072
  exports.getcellFormula = getcellFormula;
60045
60073
  exports.getcellrange = getcellrange;
60046
60074
  exports.getdatabyselection = getdatabyselection;
60075
+ exports.getrangeseleciton = getrangeseleciton;
60047
60076
  exports.goToLink = goToLink;
60048
60077
  exports.groupValuesRefresh = groupValuesRefresh;
60049
60078
  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.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "father-build"
14
14
  },
15
15
  "dependencies": {
16
- "@leankylin-sheet/formula-parser": "4.0.0",
16
+ "@leankylin-sheet/formula-parser": "4.0.1",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",