rapid-spreadjs 1.0.53 → 1.0.55
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 +40 -8
- 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 +40 -8
- 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 +9 -1
- package/dist/utils/sheet.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -520,9 +520,10 @@ const SheetUtils = {
|
|
|
520
520
|
* 设置当前活动工作表的水印和数据绑定是否显示
|
|
521
521
|
* @param spread 工作簿实例
|
|
522
522
|
* @param cells 数据绑定单元格配置集合([{ row: number; col: number; title: string; pathPrev: string; pathField: string }])
|
|
523
|
-
* @param isShow
|
|
523
|
+
* @param isShow 是否显示水印
|
|
524
|
+
* @param isShowBindPath 是否显示数据绑定路径,默认为:true
|
|
524
525
|
*/
|
|
525
|
-
setActiveSheetWatermark: (spread, cells,
|
|
526
|
+
setActiveSheetWatermark: (spread, cells, isShowWatermark, isShowBindPath = true) => {
|
|
526
527
|
if (cells == null || cells == undefined) {
|
|
527
528
|
return;
|
|
528
529
|
}
|
|
@@ -531,9 +532,9 @@ const SheetUtils = {
|
|
|
531
532
|
sheet.suspendPaint();
|
|
532
533
|
cells.forEach((cell) => {
|
|
533
534
|
// 设置或移除水印标签
|
|
534
|
-
sheet.getCell(cell.row, cell.col).watermark(
|
|
535
|
+
sheet.getCell(cell.row, cell.col).watermark(isShowWatermark ? `{${cell.title}}` : undefined);
|
|
535
536
|
// 设置或移除绑定路径
|
|
536
|
-
sheet.setBindingPath(cell.row, cell.col,
|
|
537
|
+
sheet.setBindingPath(cell.row, cell.col, isShowBindPath ? `${cell.pathPrev}.${cell.pathField}` : undefined);
|
|
537
538
|
});
|
|
538
539
|
// 恢复绘制
|
|
539
540
|
sheet.resumePaint();
|
|
@@ -806,9 +807,11 @@ const BusinessUtils = {
|
|
|
806
807
|
* @param cellRange 单元格范围JSON对象,格式为:{row:0, col:0, rowCount:2, colCount:5}
|
|
807
808
|
* @param curDefaultPointCount 本次默认点数
|
|
808
809
|
* @param lastDefaultPointCount 上次默认点数,默认为:0(0代表首次创建)
|
|
810
|
+
* @param isAutoFillFirstCellNumber 是否自动填充第一个单元格为序号数字,默认为:false
|
|
811
|
+
* @param created 创建完成后的回调函数,第一个参数为循环后的所有单元格范围对象(格式为:{row:0, col:0, rowCount:10, colCount:5}),第二个参数为所有循环行的单元格二维数组对象
|
|
809
812
|
* @param rowHeight 创建的行高度,默认为:24(单位为像素)
|
|
810
813
|
*/
|
|
811
|
-
dynamicCreateCyclicRows: (GC, spread, cellRange, curDefaultPointCount, lastDefaultPointCount = 0, rowHeight = 24) => {
|
|
814
|
+
dynamicCreateCyclicRows: (GC, spread, cellRange, curDefaultPointCount, lastDefaultPointCount = 0, isAutoFillFirstCellNumber = false, created = null, rowHeight = 24) => {
|
|
812
815
|
// 不进行动态创建行
|
|
813
816
|
if ((curDefaultPointCount <= 1 && lastDefaultPointCount == 0) || (curDefaultPointCount == lastDefaultPointCount && lastDefaultPointCount > 0)) {
|
|
814
817
|
return;
|
|
@@ -867,12 +870,41 @@ const BusinessUtils = {
|
|
|
867
870
|
else if (curDefaultPointCount > 1 && lastDefaultPointCount == 0) {
|
|
868
871
|
addRowsFun(cellRange.row + cellRange.rowCount, (curDefaultPointCount - 1) * cellRange.rowCount, curDefaultPointCount - 1);
|
|
869
872
|
}
|
|
873
|
+
// 循环后的所有单元格范围
|
|
874
|
+
const cyclicCellsRangeObj = sheet.getRange(cellRange.row, cellRange.col, curDefaultPointCount * cellRange.rowCount, cellRange.colCount);
|
|
870
875
|
// 判断要循环的单元格最后一行是否为表格的末尾行,如果是,则在循环创建单元行的最后一行的时候,下边框线位细线样式
|
|
871
876
|
if (isCyclicLastRowIsSheetLastRow) {
|
|
872
877
|
// 设置所有内边框线为细线样式
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
878
|
+
cyclicCellsRangeObj.setBorder(new GC.Spread.Sheets.LineBorder('#000', GC.Spread.Sheets.LineStyle.thin), { inside: true });
|
|
879
|
+
}
|
|
880
|
+
// 循环后的所有单元格范围JSON对象
|
|
881
|
+
const cyclicCellsRange = {
|
|
882
|
+
row: cyclicCellsRangeObj.row,
|
|
883
|
+
col: cyclicCellsRangeObj.col,
|
|
884
|
+
rowCount: cyclicCellsRangeObj.rowCount,
|
|
885
|
+
colCount: cyclicCellsRangeObj.colCount,
|
|
886
|
+
};
|
|
887
|
+
// 自动填充第一个单元格为序号数字
|
|
888
|
+
const allCells = SheetUtils.getAllCellObjsByRanges(sheet, [cyclicCellsRange]);
|
|
889
|
+
const allCellsByRowObj = groupByJson(allCells, 'row');
|
|
890
|
+
let allCellsByRow = [];
|
|
891
|
+
if (isAutoFillFirstCellNumber) {
|
|
892
|
+
forEachJson(allCellsByRowObj, (value, key, source) => {
|
|
893
|
+
allCellsByRow.push(value);
|
|
894
|
+
});
|
|
895
|
+
let number = 0;
|
|
896
|
+
allCellsByRow.forEach((rowCells, rowIndex) => {
|
|
897
|
+
rowCells.forEach((rowCell, cellIndex) => {
|
|
898
|
+
if (cellIndex == 0) {
|
|
899
|
+
number++;
|
|
900
|
+
sheet.setValue(rowCell.row, rowCell.col, number);
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
// 创建完成后的回调函数
|
|
906
|
+
if (created != null && created != undefined && typeof created === 'function') {
|
|
907
|
+
created(cyclicCellsRange, allCellsByRow);
|
|
876
908
|
}
|
|
877
909
|
// 恢复绘制
|
|
878
910
|
sheet.resumePaint();
|