rapid-spreadjs 1.0.20 → 1.0.22

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
@@ -7387,6 +7387,29 @@ const SheetUtils = {
7387
7387
  const sheet = spread.getActiveSheet();
7388
7388
  return SheetUtils.getSheetSelectCellObjs(sheet, isMulColOrder);
7389
7389
  },
7390
+ /**
7391
+ * 获取某工作表指定范围单元格的坐标对象集合(二维数组,格式如:[[{row:0……}],[{row:0……}]])
7392
+ * @param sheet 工作表实例
7393
+ * @param cellRange 单元格范围
7394
+ * @param groupType 分组字段属性(row或col),默认为:row
7395
+ * @returns 返回某工作表指定范围单元格的坐标对象集合(二维数组,格式如:[[{row:0……}],[{row:0……}]])
7396
+ */
7397
+ getSheetCellObjsByGroup: (sheet, cellRange, groupType = 'row') => {
7398
+ // 暂停绘制
7399
+ sheet.suspendPaint();
7400
+ const valCells = SheetUtils.getAllCellObjsByRange(sheet, cellRange);
7401
+ // 按照JSON数组中某个字段进行分组(groupType为row或col)
7402
+ const groupByCells = groupByJson(valCells, groupType);
7403
+ // 最终返回结果(二维数组)
7404
+ const retCells = [];
7405
+ // 遍历分组JSON对象(groupByCells的格式为:{key1: [cell1, cell2, ...], key2: [cell1, cell2, ...], ...})
7406
+ forEachJson(groupByCells, (curGroupCells, key, source) => {
7407
+ retCells.push(curGroupCells);
7408
+ });
7409
+ // 恢复绘制
7410
+ sheet.resumePaint();
7411
+ return retCells;
7412
+ },
7390
7413
  /**
7391
7414
  * 获取某工作表选中单元格的值集合
7392
7415
  * @param sheet 工作表实例
@@ -7742,18 +7765,22 @@ const WorkbookUtils = {
7742
7765
  // 文件的字节流对象
7743
7766
  const blob = yield response.blob();
7744
7767
  // 将Blob转换为File或Blob对象
7745
- new File([blob], 'template.sjs', { type: 'application/octet-stream' });
7768
+ // const file = new File([blob], 'template.sjs', { type: 'application/octet-stream' });
7746
7769
  const sjsBlob = new Blob([blob], { type: 'application/zip' });
7747
7770
  // SpreadJS打开文件
7748
- spread.open(sjsBlob, () => {
7771
+ spread.open(sjsBlob, () => __awaiter(void 0, void 0, void 0, function* () {
7749
7772
  if (typeof succFunc === 'function') {
7750
- succFunc(spread);
7773
+ yield succFunc(spread);
7774
+ // // 或者使用then回调
7775
+ // succFunc(spread).then((ret) => {
7776
+ // // return ret;
7777
+ // });
7751
7778
  }
7752
- }, (e) => {
7779
+ }), (e) => __awaiter(void 0, void 0, void 0, function* () {
7753
7780
  if (typeof errorFunc === 'function') {
7754
- errorFunc(e);
7781
+ yield errorFunc(e);
7755
7782
  }
7756
- });
7783
+ }));
7757
7784
  }
7758
7785
  }),
7759
7786
  /**