rapid-spreadjs 1.0.134 → 1.0.136
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 +45 -11
- 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 +45 -11
- 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 +3 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1037,8 +1037,7 @@ const BusinessUtils = {
|
|
|
1037
1037
|
cellRange.col, // 目标起始列
|
|
1038
1038
|
cellRange.rowCount, // 源行数
|
|
1039
1039
|
cellRange.colCount, // 源列数
|
|
1040
|
-
GC.Spread.Sheets.CopyToOptions.all
|
|
1041
|
-
);
|
|
1040
|
+
GC.Spread.Sheets.CopyToOptions.all);
|
|
1042
1041
|
// 使用命令的方式
|
|
1043
1042
|
// // 定义源区域
|
|
1044
1043
|
// var fromRange = [new GC.Spread.Sheets.Range(cellRange.row, cellRange.col, cellRange.rowCount, cellRange.colCount)];
|
|
@@ -1370,11 +1369,13 @@ const BusinessUtils = {
|
|
|
1370
1369
|
* @param GC GC对象
|
|
1371
1370
|
* @param spread 工作簿实例
|
|
1372
1371
|
* @param dynamicLoadRangeJson 动态加载的“试验结果”JSON数组范围,格式如:[{row: 1, col: 1, rowCount: 1, colCount: 1}]
|
|
1372
|
+
* @param headerRangeHeight 表头区域总高度
|
|
1373
|
+
* @param footerRangeHeight 表尾区域总高度
|
|
1373
1374
|
* @param pageDir 页面方向(1:纵向、2:横向)
|
|
1374
1375
|
* @param blankRowCellValue 空白行单元格值,默认为:空白
|
|
1375
1376
|
* @returns 返回所有需要显示和隐藏的行索引结果对象,格式如:{hasValueIndex: [1, 2, 3], noValueIndex: [4, 5, 6]},hasValueIndex代表所有显示的行索引,noValueIndex代表所有隐藏的行索引
|
|
1376
1377
|
*/
|
|
1377
|
-
dynamicLoadRows: (GC, spread, dynamicLoadRangeJson, pageDir = 1, blankRowCellValue = '空白') => {
|
|
1378
|
+
dynamicLoadRows: (GC, spread, dynamicLoadRangeJson, headerRangeHeight, footerRangeHeight, pageDir = 1, blankRowCellValue = '空白') => {
|
|
1378
1379
|
const sheet = spread.getActiveSheet();
|
|
1379
1380
|
// 暂停绘制
|
|
1380
1381
|
sheet.suspendPaint();
|
|
@@ -1399,9 +1400,16 @@ const BusinessUtils = {
|
|
|
1399
1400
|
const seqColSpanObj = sheet.getSpans({ row: parseInt(rowIndexKey), col: 1, rowCount: cellItems[0].rowCount, colCount: seqColSpanCount })[0];
|
|
1400
1401
|
// 当前序号跨行单元格对应的所有单元格中是否有值
|
|
1401
1402
|
let curRowHasValue = false;
|
|
1403
|
+
// 当前所有行索引
|
|
1404
|
+
let curRowIndexs = [];
|
|
1402
1405
|
for (let i = 0; i < cellItems.length; i++) {
|
|
1403
1406
|
// 获取当前单元格对象
|
|
1404
1407
|
const cell = cellItems[i];
|
|
1408
|
+
for (let j = cell.row; j < cell.row + cell.rowCount; j++) {
|
|
1409
|
+
if (!curRowIndexs.some((x) => x == j)) {
|
|
1410
|
+
curRowIndexs.push(j);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1405
1413
|
// 获取当前单元格的值
|
|
1406
1414
|
const cellValue = sheet.getValue(cell.row, cell.col);
|
|
1407
1415
|
// 验证是否有值
|
|
@@ -1414,7 +1422,7 @@ const BusinessUtils = {
|
|
|
1414
1422
|
break;
|
|
1415
1423
|
}
|
|
1416
1424
|
}
|
|
1417
|
-
let rowObjs = { row: parseInt(rowIndexKey), cells: cellItems, hasValue: curRowHasValue };
|
|
1425
|
+
let rowObjs = { row: parseInt(rowIndexKey), rows: curRowIndexs, cells: cellItems, hasValue: curRowHasValue };
|
|
1418
1426
|
if (!rowCells.some((x) => x.rowSpan == seqColSpanObj.row)) {
|
|
1419
1427
|
rowCells.push({
|
|
1420
1428
|
rowSpan: seqColSpanObj.row,
|
|
@@ -1429,14 +1437,21 @@ const BusinessUtils = {
|
|
|
1429
1437
|
// 有值和没有值的行索引集合
|
|
1430
1438
|
let hasValueRows = [], noValueRows = [];
|
|
1431
1439
|
rowCells.forEach((rowObj, index) => {
|
|
1432
|
-
if (rowObj.rows.some((x) => x.hasValue)
|
|
1433
|
-
|
|
1440
|
+
if (rowObj.rows.some((x) => x.hasValue)) {
|
|
1441
|
+
rowObj.rows.forEach((x) => {
|
|
1442
|
+
x.rows.forEach((rowIndex) => {
|
|
1443
|
+
if (!hasValueRows.some((hItem) => hItem == rowIndex)) {
|
|
1444
|
+
hasValueRows.push(rowIndex);
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
});
|
|
1434
1448
|
}
|
|
1435
1449
|
else {
|
|
1436
1450
|
rowObj.rows.forEach((x) => {
|
|
1437
|
-
x.
|
|
1438
|
-
if (!noValueRows.some((
|
|
1439
|
-
noValueRows.push(
|
|
1451
|
+
x.rows.forEach((rowIndex) => {
|
|
1452
|
+
if (!noValueRows.some((hItem) => hItem == rowIndex)) {
|
|
1453
|
+
noValueRows.push(rowIndex);
|
|
1454
|
+
}
|
|
1440
1455
|
});
|
|
1441
1456
|
});
|
|
1442
1457
|
}
|
|
@@ -1454,7 +1469,9 @@ const BusinessUtils = {
|
|
|
1454
1469
|
/** 创建空白行单元格 */
|
|
1455
1470
|
const createBlackRowCell = () => {
|
|
1456
1471
|
// 工作表总高度
|
|
1457
|
-
const sheetTotalHeight = pageDir ? 1055 : 615;
|
|
1472
|
+
const sheetTotalHeight = pageDir == 1 ? 1055 : 615;
|
|
1473
|
+
// 之前已经创建的空白行索引
|
|
1474
|
+
let createBlackRowIndex = -1;
|
|
1458
1475
|
// 获取所有可见行的总高度
|
|
1459
1476
|
let allRowHeight = 0;
|
|
1460
1477
|
for (let i = 0; i < sheet.getRowCount(); i++) {
|
|
@@ -1463,9 +1480,26 @@ const BusinessUtils = {
|
|
|
1463
1480
|
if (curRowVisible && (blankRowCell == null || blankRowCell == undefined || blankRowCell != 'BlankCell')) {
|
|
1464
1481
|
allRowHeight += sheet.getRowHeight(i);
|
|
1465
1482
|
}
|
|
1483
|
+
// 设置已创建的空白行索引
|
|
1484
|
+
if (blankRowCell == 'BlankCell') {
|
|
1485
|
+
createBlackRowIndex = i;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
// 针对纵表情况,工作表总高度-表头和表尾总高度>=550,空白行不显示;<550,空白行显示
|
|
1489
|
+
// 是否显示空白行
|
|
1490
|
+
let isShowBlankRow = true;
|
|
1491
|
+
if (pageDir == 1 && allRowHeight - headerRangeHeight - footerRangeHeight >= 550) {
|
|
1492
|
+
isShowBlankRow = false;
|
|
1493
|
+
}
|
|
1494
|
+
if (!isShowBlankRow) {
|
|
1495
|
+
// 设置行不可见
|
|
1496
|
+
if (createBlackRowIndex != -1) {
|
|
1497
|
+
sheet.setRowVisible(createBlackRowIndex, false);
|
|
1498
|
+
}
|
|
1499
|
+
return;
|
|
1466
1500
|
}
|
|
1467
1501
|
// 获取到最后一行动态加载区域的行索引
|
|
1468
|
-
const lastRowIndex =
|
|
1502
|
+
const lastRowIndex = dynamicLoadRangeJson[0].row + dynamicLoadRangeJson[0].rowCount - 1;
|
|
1469
1503
|
// 创建空白行
|
|
1470
1504
|
if (allRowHeight < sheetTotalHeight) {
|
|
1471
1505
|
// 获取空白行单元格的标签
|