rapid-spreadjs 1.0.162 → 1.0.164

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
@@ -1414,12 +1414,14 @@ const BusinessUtils = {
1414
1414
  * @param dynamicLoadRangeJson 动态加载的“试验结果”JSON数组范围,格式如:[{row: 1, col: 1, rowCount: 1, colCount: 1}]
1415
1415
  * @param headerRangeHeight 表头区域总高度
1416
1416
  * @param footerRangeHeight 表尾区域总高度
1417
+ * @param isEnable 是否启用动态加载行,默认为:true(true:启用动态加载行,false:不启用动态加载行)
1418
+ * @param ended 绘制完成后的回调函数,返回一个参数rowIndex,格式如:{hasValueIndex: [1, 2, 3], noValueIndex: [4, 5, 6]},hasValueIndex代表所有显示的行索引,noValueIndex代表所有隐藏的行索引
1417
1419
  * @param remainingHeight 剩余高度(针对纵表情况,工作表总高度-表头和表尾总高度>=remainingHeight,空白行不显示;<remainingHeight,空白行显示)
1418
1420
  * @param pageDir 页面方向(1:纵向、2:横向)
1419
1421
  * @param blankRowCellValue 空白行单元格值,默认为:空白
1420
1422
  * @returns 返回所有需要显示和隐藏的行索引结果对象,格式如:{hasValueIndex: [1, 2, 3], noValueIndex: [4, 5, 6]},hasValueIndex代表所有显示的行索引,noValueIndex代表所有隐藏的行索引
1421
1423
  */
1422
- dynamicLoadRows: (GC, spread, dynamicLoadRangeJson, headerRangeHeight, footerRangeHeight, remainingHeight = 500, pageDir = 1, blankRowCellValue = '空白') => {
1424
+ dynamicLoadRows: (GC, spread, dynamicLoadRangeJson, headerRangeHeight, footerRangeHeight, isEnable = true, ended = null, remainingHeight = 500, pageDir = 1, blankRowCellValue = '空白') => {
1423
1425
  const sheet = spread.getActiveSheet();
1424
1426
  // 暂停绘制
1425
1427
  sheet.suspendPaint();
@@ -1566,7 +1568,7 @@ const BusinessUtils = {
1566
1568
  }
1567
1569
  if (!isShowBlankRow) {
1568
1570
  // 设置行不可见
1569
- if (createBlackRowIndex != -1) {
1571
+ if (!isEnable && createBlackRowIndex != -1) {
1570
1572
  sheet.setRowVisible(createBlackRowIndex, false);
1571
1573
  }
1572
1574
  return;
@@ -1604,15 +1606,20 @@ const BusinessUtils = {
1604
1606
  else {
1605
1607
  // 设置添加这一行的行高
1606
1608
  sheet.setRowHeight(lastRowIndex + 1, sheetTotalHeight - allRowHeight);
1607
- // 显示空白行单元格
1608
- sheet.setRowVisible(lastRowIndex + 1, true);
1609
+ if (!isEnable) {
1610
+ sheet.setRowVisible(lastRowIndex + 1, false);
1611
+ }
1612
+ else {
1613
+ // 显示空白行单元格
1614
+ sheet.setRowVisible(lastRowIndex + 1, true);
1615
+ }
1609
1616
  }
1610
1617
  }
1611
1618
  // 隐藏空白行单元格
1612
1619
  else {
1613
1620
  const blankRowCell = sheet.getTag(lastRowIndex + 1, 1);
1614
1621
  // 如果空白行单元格标签存在,则隐藏
1615
- if (blankRowCell && blankRowCell == 'BlankCell') {
1622
+ if (!isEnable && blankRowCell && blankRowCell == 'BlankCell') {
1616
1623
  sheet.setRowVisible(lastRowIndex + 1, false);
1617
1624
  }
1618
1625
  }
@@ -1628,8 +1635,23 @@ const BusinessUtils = {
1628
1635
  // top: false,
1629
1636
  // bottom: false,
1630
1637
  // });
1638
+ // 没有启用动态加载行的时候,将所有的行都显示出来
1639
+ if (!isEnable) {
1640
+ hasValueRows.forEach((rowIndex, index) => {
1641
+ // 设置行可见
1642
+ sheet.setRowVisible(rowIndex, true);
1643
+ });
1644
+ noValueRows.forEach((rowIndex) => {
1645
+ // 设置行可见
1646
+ sheet.setRowVisible(rowIndex, true);
1647
+ });
1648
+ }
1631
1649
  // 恢复绘制
1632
1650
  sheet.resumePaint();
1651
+ // 执行绘制完成后的回调函数
1652
+ if (ended != null && ended != undefined && typeof ended === 'function') {
1653
+ ended({ hasValueIndex: hasValueRows, noValueIndex: noValueRows });
1654
+ }
1633
1655
  return { hasValueIndex: hasValueRows, noValueIndex: noValueRows };
1634
1656
  },
1635
1657
  /**