rapid-spreadjs 1.0.89 → 1.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -850,10 +850,29 @@ const BusinessUtils = {
850
850
  cellRange.colCount, // 源列数
851
851
  GC.Spread.Sheets.CopyToOptions.all // 复制内容类型(值、样式、公式等)
852
852
  );
853
+ // 使用命令的方式
854
+ // // 定义源区域
855
+ // var fromRange = [new GC.Spread.Sheets.Range(cellRange.row, cellRange.col, cellRange.rowCount, cellRange.colCount)];
856
+ // // 定义目标区域
857
+ // var toRange = [new GC.Spread.Sheets.Range(targetRow, cellRange.col, cellRange.rowCount, cellRange.colCount)];
858
+ // // 执行复制命令
859
+ // spread.commandManager().execute({
860
+ // cmd: "clipboardPaste",
861
+ // sheetName: sheet.name(), // 目标工作表名称
862
+ // fromSheet: sheet, // 源工作表对象
863
+ // fromRanges: fromRange, // 源区域数组
864
+ // pastedRanges: toRange, // 目标区域数组
865
+ // isCutting: false, // false 表示复制
866
+ // clipboardText: "", // 留空
867
+ // pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all // 粘贴全部内容(数据、样式、公式等)
868
+ // });
853
869
  }
854
870
  };
855
- // 暂停绘制
871
+ // 暂停绘制、计算、事件
856
872
  sheet.suspendPaint();
873
+ sheet.suspendCalcService();
874
+ sheet.suspendDirty();
875
+ sheet.suspendEvent();
857
876
  // 当前默认点数<=1并且上一次默认点数>0的时候,则删除所有循环的行
858
877
  if (curDefaultPointCount <= 1 && lastDefaultPointCount > 0) {
859
878
  sheet.deleteRows(cellRange.row + cellRange.rowCount, (curDefaultPointCount - 1) * cellRange.rowCount);
@@ -874,7 +893,7 @@ const BusinessUtils = {
874
893
  addRowsFun(cellRange.row + cellRange.rowCount, (curDefaultPointCount - 1) * cellRange.rowCount, curDefaultPointCount - 1);
875
894
  }
876
895
  // 循环后的所有单元格范围
877
- const cyclicCellsRangeObj = sheet.getRange(cellRange.row, cellRange.col, curDefaultPointCount * cellRange.rowCount, cellRange.colCount);
896
+ const cyclicCellsRangeObj = sheet.getRange(cellRange.row, cellRange.col, curDefaultPointCount * cellRange.rowCount, cellRange.colCount > 77 ? 77 : cellRange.colCount);
878
897
  // 判断要循环的单元格最后一行是否为表格的末尾行,如果是,则在循环创建单元行的最后一行的时候,下边框线位细线样式
879
898
  if (isCyclicLastRowIsSheetLastRow) {
880
899
  // 设置所有内边框线为细线样式
@@ -905,12 +924,15 @@ const BusinessUtils = {
905
924
  });
906
925
  });
907
926
  }
927
+ // 恢复事件、计算、绘制
928
+ sheet.resumeDirty();
929
+ sheet.resumeEvent();
930
+ sheet.resumeCalcService();
931
+ sheet.resumePaint();
908
932
  // 创建完成后的回调函数
909
933
  if (created != null && created != undefined && typeof created === 'function') {
910
934
  created(cyclicCellsRange, allCellsByRow);
911
935
  }
912
- // 恢复绘制
913
- sheet.resumePaint();
914
936
  },
915
937
  };
916
938
 
@@ -8477,9 +8499,10 @@ const EChartsUtilsAll = {
8477
8499
  {
8478
8500
  show: true,
8479
8501
  text: title,
8502
+ left: 'center',
8480
8503
  top: 2,
8481
8504
  textStyle: {
8482
- fontSize: 12,
8505
+ fontSize: 14,
8483
8506
  fontWeight: 'normal',
8484
8507
  },
8485
8508
  },
@@ -20010,6 +20033,11 @@ const FormulaUtils = {
20010
20033
  repeatable: false,
20011
20034
  optional: false,
20012
20035
  },
20036
+ {
20037
+ name: '是否返回符合或不符合结果的数量(传数字的1或0,0:不返回数量、1:返回数量),默认为:0',
20038
+ repeatable: false,
20039
+ optional: false,
20040
+ },
20013
20041
  ],
20014
20042
  funCallback: (spread, sheet, retData) => {
20015
20043
  // 如果传递的参数小于5个,则返回空字符串
@@ -20017,7 +20045,9 @@ const FormulaUtils = {
20017
20045
  if (retData.allCellValsEw.length < 5) {
20018
20046
  return '/';
20019
20047
  }
20020
- let array1 = retData.allCellValsEw[0], array2 = retData.allCellValsEw[1], operator = retData.allCellValsEw[2], value = retData.allCellValsEw[3], delimiter = retData.allCellValsEw[4], isOpposite = retData.allCellValsEw.length < 6 ? 0 : retData.allCellValsEw[5];
20048
+ let array1 = retData.allCellValsEw[0], array2 = retData.allCellValsEw[1], operator = retData.allCellValsEw[2], value = retData.allCellValsEw[3], delimiter = retData.allCellValsEw[4], isOpposite = retData.allCellValsEw.length < 6 ? 0 : retData.allCellValsEw[5],
20049
+ // 是否返回符合或不符合结果的数量(如最终符合或不符合的结果为“5,6,7”,并且isReturnCount=1,则返回数字3,否则返回“5,6,7”),默认为:0
20050
+ isReturnCount = retData.allCellValsEw.length < 7 ? 0 : retData.allCellValsEw[6];
20021
20051
  try {
20022
20052
  // 处理array1和array2的默认值
20023
20053
  if (array1 == null || array1 == undefined || (typeof array1 == 'string' && array1.trim().length == 0)) {
@@ -20032,7 +20062,7 @@ const FormulaUtils = {
20032
20062
  if (typeof array2 == 'string' && array2.trim().length > 0) {
20033
20063
  array2 = [array2];
20034
20064
  }
20035
- // 如果operator、value、delimiter、isOpposite为数组,则设置其取第一个值
20065
+ // 如果operator、value、delimiter、isOpposite、isReturnCount为数组,则设置其取第一个值
20036
20066
  if (Array.isArray(operator) && operator.length > 0) {
20037
20067
  operator = operator[0];
20038
20068
  }
@@ -20045,6 +20075,9 @@ const FormulaUtils = {
20045
20075
  if (Array.isArray(isOpposite) && isOpposite.length > 0) {
20046
20076
  isOpposite = isOpposite[0];
20047
20077
  }
20078
+ if (Array.isArray(isReturnCount) && isReturnCount.length > 0) {
20079
+ isReturnCount = isReturnCount[0];
20080
+ }
20048
20081
  // 设置isOpposite的默认值
20049
20082
  if (isOpposite == '1' || isOpposite == '0') {
20050
20083
  isOpposite = parseInt(isOpposite);
@@ -20052,6 +20085,13 @@ const FormulaUtils = {
20052
20085
  if (isOpposite != 0 && isOpposite != 1) {
20053
20086
  isOpposite = 0;
20054
20087
  }
20088
+ // 设置isReturnCount的默认值
20089
+ if (isReturnCount == '1' || isReturnCount == '0') {
20090
+ isReturnCount = parseInt(isReturnCount);
20091
+ }
20092
+ if (isReturnCount != 0 && isReturnCount != 1) {
20093
+ isReturnCount = 0;
20094
+ }
20055
20095
  // TODO:暂定此情况
20056
20096
  // 第一个参数是否为单值(array1为一个值的时候,此时array2的所有元素可能需要参与计算,满足要求的就返回array2中的值)
20057
20097
  const isSingleValue1 = array2.length > array1.length && array1.length == 1;
@@ -20156,8 +20196,8 @@ const FormulaUtils = {
20156
20196
  return '';
20157
20197
  })
20158
20198
  .filter((val) => val !== '' && val != '/' && val != 'null' && val != null && val != undefined); // 过滤空值
20159
- // 使用指定的分隔符连接结果[2,3,5](@ref)
20160
- return resultValues.join(delimiter);
20199
+ // 使用指定的分隔符连接结果[2,3,5]
20200
+ return isReturnCount == 1 ? resultValues.length : resultValues.join(delimiter);
20161
20201
  }
20162
20202
  catch (error) {
20163
20203
  // 任何错误都返回"/"