rapid-spreadjs 1.0.51 → 1.0.53
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 +26 -9
- 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 +27 -10
- 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/business.d.ts +5 -3
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -684,12 +684,13 @@ const BusinessUtils = {
|
|
|
684
684
|
* @param gc GC对象
|
|
685
685
|
* @param sheet 工作表实例
|
|
686
686
|
* @param testObjectAttrs 检测对象属性配置集合
|
|
687
|
+
* @param addRowIndex 添加检测对象属性区域的起始行索引,默认为:0
|
|
687
688
|
* @param isVertical 是否为纵表,默认为:true
|
|
688
689
|
* @param contentColStartIndex 表格内容列起始索引,默认为:1
|
|
689
690
|
* @param contentTotalColCount 表格内容列总数,默认为:77
|
|
690
|
-
* @param addRowHeight 添加的表格行高,默认为:24
|
|
691
|
+
* @param addRowHeight 添加的表格行高,默认为:24(单位为像素)
|
|
691
692
|
*/
|
|
692
|
-
createTestObjectAttrsCells: (gc, sheet, testObjectAttrs, isVertical = true, contentColStartIndex = 1, contentTotalColCount = 77, addRowHeight = 24) => {
|
|
693
|
+
createTestObjectAttrsCells: (gc, sheet, testObjectAttrs, addRowIndex = 0, isVertical = true, contentColStartIndex = 1, contentTotalColCount = 77, addRowHeight = 24) => {
|
|
693
694
|
if (!testObjectAttrs || testObjectAttrs.length === 0) {
|
|
694
695
|
return;
|
|
695
696
|
}
|
|
@@ -703,8 +704,14 @@ const BusinessUtils = {
|
|
|
703
704
|
const testObjectAttrsChunk = rapidUtils.chunkJson(testObjectAttrs, rowTestObjectCount);
|
|
704
705
|
// 暂停绘制
|
|
705
706
|
sheet.suspendPaint();
|
|
706
|
-
// 设置工作表行数为0
|
|
707
|
-
sheet.setRowCount(0);
|
|
707
|
+
// // 设置工作表行数为0
|
|
708
|
+
// sheet.setRowCount(0);
|
|
709
|
+
// 获取当前Sheet的行数
|
|
710
|
+
const rowCount = sheet.getRowCount();
|
|
711
|
+
// 如果满足如下条件,则将末尾的行全部删除
|
|
712
|
+
if (addRowIndex > 0 && addRowIndex < rowCount) {
|
|
713
|
+
sheet.deleteRows(addRowIndex, rowCount - addRowIndex);
|
|
714
|
+
}
|
|
708
715
|
/**
|
|
709
716
|
* 设置单元格字体和大小
|
|
710
717
|
* @param row
|
|
@@ -772,11 +779,12 @@ const BusinessUtils = {
|
|
|
772
779
|
* 获取检测对象属性值集合
|
|
773
780
|
* @param sheet 工作表实例
|
|
774
781
|
* @param testObjectAttrs 检测对象属性配置集合
|
|
782
|
+
* @param addRowIndex 添加检测对象属性区域的起始行索引,默认为:0
|
|
775
783
|
* @param isVertical 是否为纵表,默认为:true
|
|
776
784
|
* @param contentColStartIndex 表格内容列起始索引,默认为:1
|
|
777
785
|
* @param contentTotalColCount 表格内容列总数,默认为:77
|
|
778
786
|
*/
|
|
779
|
-
getTestObjectAttrsVals: (sheet, testObjectAttrs, isVertical = true, contentColStartIndex = 1, contentTotalColCount = 77) => {
|
|
787
|
+
getTestObjectAttrsVals: (sheet, testObjectAttrs, addRowIndex = 0, isVertical = true, contentColStartIndex = 1, contentTotalColCount = 77) => {
|
|
780
788
|
// 一行中检测对象属性的个数(纵表为2个,横表为3个)
|
|
781
789
|
const rowTestObjectCount = isVertical ? 2 : 3;
|
|
782
790
|
// 将测试对象属性数据进行分块
|
|
@@ -785,7 +793,7 @@ const BusinessUtils = {
|
|
|
785
793
|
sheet.suspendPaint();
|
|
786
794
|
// 所有单元格对象
|
|
787
795
|
const allCells = SheetUtils.getAllCellObjsByRange(sheet, {
|
|
788
|
-
row:
|
|
796
|
+
row: addRowIndex,
|
|
789
797
|
col: contentColStartIndex,
|
|
790
798
|
rowCount: sheet.getRowCount(),
|
|
791
799
|
colCount: contentTotalColCount,
|
|
@@ -829,6 +837,8 @@ const BusinessUtils = {
|
|
|
829
837
|
}
|
|
830
838
|
// 获取当前工作表
|
|
831
839
|
const sheet = spread.getActiveSheet();
|
|
840
|
+
// 判断要循环的单元格最后一行是否为表格的末尾行,如果是,则在循环创建单元行的最后一行的时候,下边框线位细线样式
|
|
841
|
+
const isCyclicLastRowIsSheetLastRow = cellRange.row + cellRange.rowCount == sheet.getRowCount();
|
|
832
842
|
/**
|
|
833
843
|
* 添加行
|
|
834
844
|
* @param addRowIndex 添加行的索引位置
|
|
@@ -879,6 +889,13 @@ const BusinessUtils = {
|
|
|
879
889
|
else if (curDefaultPointCount > 1 && lastDefaultPointCount == 0) {
|
|
880
890
|
addRowsFun(cellRange.row + cellRange.rowCount, (curDefaultPointCount - 1) * cellRange.rowCount, curDefaultPointCount - 1);
|
|
881
891
|
}
|
|
892
|
+
// 判断要循环的单元格最后一行是否为表格的末尾行,如果是,则在循环创建单元行的最后一行的时候,下边框线位细线样式
|
|
893
|
+
if (isCyclicLastRowIsSheetLastRow) {
|
|
894
|
+
// 设置所有内边框线为细线样式
|
|
895
|
+
sheet
|
|
896
|
+
.getRange(cellRange.row, cellRange.col, curDefaultPointCount * cellRange.rowCount, cellRange.colCount)
|
|
897
|
+
.setBorder(new GC.Spread.Sheets.LineBorder('#000', GC.Spread.Sheets.LineStyle.thin), { inside: true });
|
|
898
|
+
}
|
|
882
899
|
// 恢复绘制
|
|
883
900
|
sheet.resumePaint();
|
|
884
901
|
},
|
|
@@ -12871,10 +12888,10 @@ const FormulaUtils = {
|
|
|
12871
12888
|
}
|
|
12872
12889
|
}
|
|
12873
12890
|
//系数
|
|
12874
|
-
let coefficient = 1 / accuracy;
|
|
12891
|
+
let coefficient = rapidUtils.preciseCalc(1, accuracy, 'div'); // 1 / accuracy;
|
|
12875
12892
|
//换算后的修约值(=修约值*系数)
|
|
12876
12893
|
//注意:此处使用到了toFixed,目的是可能会存在精度的问题
|
|
12877
|
-
let roundingValCal = Number((roundingVal * coefficient).toFixed(8));
|
|
12894
|
+
let roundingValCal = rapidUtils.preciseCalc(roundingVal, coefficient, 'mul'); // Number((roundingVal * coefficient).toFixed(8));
|
|
12878
12895
|
/**
|
|
12879
12896
|
* 计算修约结果函数
|
|
12880
12897
|
* @param inputVal 换算后的修约值
|
|
@@ -12911,7 +12928,7 @@ const FormulaUtils = {
|
|
|
12911
12928
|
return inputVal;
|
|
12912
12929
|
};
|
|
12913
12930
|
//返回最终修约结果(=修约结果/系数)
|
|
12914
|
-
const retNum = calcRoundingRet(roundingValCal) / coefficient;
|
|
12931
|
+
const retNum = rapidUtils.preciseCalc(calcRoundingRet(roundingValCal), coefficient, 'div'); // calcRoundingRet(roundingValCal) / coefficient;
|
|
12915
12932
|
//获取修约精度中的小数位数
|
|
12916
12933
|
let accuracyStr = accuracy + '';
|
|
12917
12934
|
//如果修约精度中没有小数,则直接返回
|