rapid-spreadjs 1.0.38 → 1.0.40
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 +53 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +53 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/utils/sheet.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -573,6 +573,58 @@ const SheetUtils = {
|
|
|
573
573
|
// // 或者使用SpreadJS提供的方法rangeToFormula
|
|
574
574
|
// return GC.Spread.Sheets.CalcEngine.rangeToFormula(cellRange);
|
|
575
575
|
},
|
|
576
|
+
/**
|
|
577
|
+
* 获取工作表中所有纯值或公式单元格的范围选择字符串
|
|
578
|
+
* @param sheet 工作表对象
|
|
579
|
+
* @param isFormulaCells 是否获取公式单元格,默认为:false
|
|
580
|
+
*/
|
|
581
|
+
getCellsRangeStr: (sheet, isFormulaCells = false) => {
|
|
582
|
+
const range = { row: 0, col: 1, rowCount: sheet.getRowCount(), colCount: 77 };
|
|
583
|
+
// 所有单元格对象集合
|
|
584
|
+
const allCells = SheetUtils.getAllCellObjsByRanges(sheet, [range]);
|
|
585
|
+
// 最终需要的单元格对象集合
|
|
586
|
+
let retCells = [];
|
|
587
|
+
// 遍历所有单元格
|
|
588
|
+
allCells.forEach((cell) => {
|
|
589
|
+
const value = sheet.getValue(cell.row, cell.col);
|
|
590
|
+
const formula = sheet.getFormula(cell.row, cell.col);
|
|
591
|
+
// 非公式+有值(非空) || 公式
|
|
592
|
+
if ((!isFormulaCells && !formula && value !== null && value !== undefined && value !== '') || (isFormulaCells && formula)) {
|
|
593
|
+
retCells.push(cell);
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
// 辅助函数:将列索引转为大写字母(如 0->A, 1->B, 26->AA)
|
|
597
|
+
const indexToAlpha = (index) => {
|
|
598
|
+
let alpha = '';
|
|
599
|
+
while (index >= 0) {
|
|
600
|
+
alpha = String.fromCharCode(65 + (index % 26)) + alpha;
|
|
601
|
+
index = Math.floor(index / 26) - 1;
|
|
602
|
+
if (index < 0)
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
return alpha;
|
|
606
|
+
};
|
|
607
|
+
// Sheet名称
|
|
608
|
+
const sheetName = sheet.name();
|
|
609
|
+
// 处理每个单元格/区域
|
|
610
|
+
const cellStrings = retCells.map((cell) => {
|
|
611
|
+
// 起始列字母
|
|
612
|
+
const colAlpha = indexToAlpha(cell.col);
|
|
613
|
+
// 起始行号(从1计数)
|
|
614
|
+
const startRow = cell.row + 1;
|
|
615
|
+
// 合并单元格只返回左上角单元格
|
|
616
|
+
const isMerged = cell.rowCount > 1 || cell.colCount > 1;
|
|
617
|
+
// 处理区域范围(合并单元格只返回左上角)
|
|
618
|
+
if (isMerged) {
|
|
619
|
+
return `${sheetName}!${colAlpha}${startRow}`;
|
|
620
|
+
}
|
|
621
|
+
// 处理单单元格
|
|
622
|
+
else {
|
|
623
|
+
return `${sheetName}!${colAlpha}${startRow}`;
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
return '=' + cellStrings.join(',');
|
|
627
|
+
},
|
|
576
628
|
};
|
|
577
629
|
|
|
578
630
|
/**
|
|
@@ -18606,7 +18658,7 @@ const FormulaUtils = {
|
|
|
18606
18658
|
}
|
|
18607
18659
|
let djtlx = retData.allCellVals[0], xzhjs = retData.allCellVals[1];
|
|
18608
18660
|
var czl; //最后输出的值
|
|
18609
|
-
if (djtlx == '
|
|
18661
|
+
if (djtlx == '中砂、粗砂、砾砂') {
|
|
18610
18662
|
var arr = new Array('15-0.002', '16-0.003', '17-0.003', '18-0.004', '19-0.004', '20-0.005', '21-0.005', '22-0.006', '23-0.006', '24-0.007', '25-0.008');
|
|
18611
18663
|
}
|
|
18612
18664
|
else {
|