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.cjs.js CHANGED
@@ -7409,6 +7409,29 @@ const SheetUtils = {
7409
7409
  const sheet = spread.getActiveSheet();
7410
7410
  return SheetUtils.getSheetSelectCellObjs(sheet, isMulColOrder);
7411
7411
  },
7412
+ /**
7413
+ * 获取某工作表指定范围单元格的坐标对象集合(二维数组,格式如:[[{row:0……}],[{row:0……}]])
7414
+ * @param sheet 工作表实例
7415
+ * @param cellRange 单元格范围
7416
+ * @param groupType 分组字段属性(row或col),默认为:row
7417
+ * @returns 返回某工作表指定范围单元格的坐标对象集合(二维数组,格式如:[[{row:0……}],[{row:0……}]])
7418
+ */
7419
+ getSheetCellObjsByGroup: (sheet, cellRange, groupType = 'row') => {
7420
+ // 暂停绘制
7421
+ sheet.suspendPaint();
7422
+ const valCells = SheetUtils.getAllCellObjsByRange(sheet, cellRange);
7423
+ // 按照JSON数组中某个字段进行分组(groupType为row或col)
7424
+ const groupByCells = rapidUtils.groupByJson(valCells, groupType);
7425
+ // 最终返回结果(二维数组)
7426
+ const retCells = [];
7427
+ // 遍历分组JSON对象(groupByCells的格式为:{key1: [cell1, cell2, ...], key2: [cell1, cell2, ...], ...})
7428
+ rapidUtils.forEachJson(groupByCells, (curGroupCells, key, source) => {
7429
+ retCells.push(curGroupCells);
7430
+ });
7431
+ // 恢复绘制
7432
+ sheet.resumePaint();
7433
+ return retCells;
7434
+ },
7412
7435
  /**
7413
7436
  * 获取某工作表选中单元格的值集合
7414
7437
  * @param sheet 工作表实例
@@ -7764,18 +7787,22 @@ const WorkbookUtils = {
7764
7787
  // 文件的字节流对象
7765
7788
  const blob = yield response.blob();
7766
7789
  // 将Blob转换为File或Blob对象
7767
- new File([blob], 'template.sjs', { type: 'application/octet-stream' });
7790
+ // const file = new File([blob], 'template.sjs', { type: 'application/octet-stream' });
7768
7791
  const sjsBlob = new Blob([blob], { type: 'application/zip' });
7769
7792
  // SpreadJS打开文件
7770
- spread.open(sjsBlob, () => {
7793
+ spread.open(sjsBlob, () => __awaiter(void 0, void 0, void 0, function* () {
7771
7794
  if (typeof succFunc === 'function') {
7772
- succFunc(spread);
7795
+ yield succFunc(spread);
7796
+ // // 或者使用then回调
7797
+ // succFunc(spread).then((ret) => {
7798
+ // // return ret;
7799
+ // });
7773
7800
  }
7774
- }, (e) => {
7801
+ }), (e) => __awaiter(void 0, void 0, void 0, function* () {
7775
7802
  if (typeof errorFunc === 'function') {
7776
- errorFunc(e);
7803
+ yield errorFunc(e);
7777
7804
  }
7778
- });
7805
+ }));
7779
7806
  }
7780
7807
  }),
7781
7808
  /**