pace-table-lib 1.0.16 → 1.0.18

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.
@@ -8318,6 +8318,8 @@
8318
8318
  const rowColors = getBgColor(RowHeader, "row");
8319
8319
  const colColors = getBgColor(ColumnHeader, "column");
8320
8320
  const dataColors = getBgColor(DataField, "dataField");
8321
+ const isColHeaderVisible = !ColumnHeader?.HideColumnHeader;
8322
+ const isRowHeaderVisible = !RowHeader?.HideRowHeader;
8321
8323
  const rowHeaderFont = React.useMemo(() => ({
8322
8324
  color: RowHeader.RowHeaderColor,
8323
8325
  fontFamily: RowHeader.RowHeaderFontFamily,
@@ -8346,10 +8348,16 @@
8346
8348
  HeatMapMaxColor
8347
8349
  } = HeatMap || {};
8348
8350
  const fixedRowCount = React.useMemo(() => {
8351
+ if (!isColHeaderVisible) {
8352
+ return headerAtStart && isColTotalOn ? 1 : 0;
8353
+ }
8349
8354
  const base = Math.max(...dimensionMarks.map((d) => d.length));
8350
8355
  return base + (headerAtStart && isColTotalOn ? 1 : 0);
8351
8356
  }, [dimensionMarks, headerAtStart, isColTotalOn]);
8352
8357
  const fixedColCount = React.useMemo(() => {
8358
+ if (!isRowHeaderVisible) {
8359
+ return headerAtStart && isRowTotalOn ? 1 : 0;
8360
+ }
8353
8361
  const base = leftFixedCellNameList ? leftFixedCellNameList.length : 1;
8354
8362
  return base + (headerAtStart && isRowTotalOn ? 1 : 0);
8355
8363
  }, [leftFixedCellNameList, headerAtStart, isRowTotalOn]);
@@ -8380,6 +8388,15 @@
8380
8388
  return { cellHeight: Number(dynHeight), cellWidth: Number(dWidth), fixedColWidth: Number(fWidth) };
8381
8389
  }, [isFitTableOn, columnCount, rowCount, fixedColCount, tableWidth, tableHeight]);
8382
8390
  const gridRef = React.useRef(null);
8391
+ React.useEffect(() => {
8392
+ const t = setTimeout(() => {
8393
+ if (gridRef.current) {
8394
+ gridRef.current.recomputeGridSize();
8395
+ gridRef.current.forceUpdateGrids();
8396
+ }
8397
+ }, 0);
8398
+ return () => clearTimeout(t);
8399
+ }, [tableWidth, tableHeight, tableData, isFitTableOn]);
8383
8400
  const conditionalFormatsByType = React.useMemo(() => {
8384
8401
  const map = { value: [], "row header": [], "column header": [] };
8385
8402
  conditionalFormatArr?.forEach((format) => {
@@ -8460,35 +8477,43 @@
8460
8477
  borderTop: "none",
8461
8478
  fontWeight: "bold"
8462
8479
  };
8463
- if (leftFixedCellNameList && leftFixedCellNameList.length > 0) {
8464
- leftFixedCellNameList.forEach((label, col) => {
8465
- baseStyle.background = getBgColorForCell(col, colColors);
8466
- const finalStyleForColumn = getFinalStyleObj(STYLE_FOR.COLUMN, baseStyle, label, col);
8480
+ if (isColHeaderVisible && isRowHeaderVisible) {
8481
+ if (leftFixedCellNameList && leftFixedCellNameList.length > 0) {
8482
+ leftFixedCellNameList.forEach((label, col) => {
8483
+ baseStyle.background = getBgColorForCell(col, colColors);
8484
+ const finalStyleForColumn = getFinalStyleObj(STYLE_FOR.COLUMN, baseStyle, label, col);
8485
+ cells.push({
8486
+ label,
8487
+ style: {
8488
+ ...finalStyleForColumn,
8489
+ borderLeft: col === 0 ? BORDER_STYLE : "none",
8490
+ left: col * fixedColWidth
8491
+ },
8492
+ childClassName: "left_fixed_data_cell"
8493
+ });
8494
+ });
8495
+ } else {
8467
8496
  cells.push({
8468
- label,
8497
+ label: "",
8469
8498
  style: {
8470
- ...finalStyleForColumn,
8471
- borderLeft: col === 0 ? BORDER_STYLE : "none",
8472
- left: col * fixedColWidth
8499
+ ...baseStyle,
8500
+ borderLeft: BORDER_STYLE,
8501
+ left: 0,
8502
+ background: getBgColorForCell(1, colColors)
8503
+ // or keep a default color
8473
8504
  },
8474
8505
  childClassName: "left_fixed_data_cell"
8475
8506
  });
8476
- });
8477
- } else {
8478
- cells.push({
8479
- label: "",
8480
- style: {
8481
- ...baseStyle,
8482
- borderLeft: BORDER_STYLE,
8483
- left: 0,
8484
- background: getBgColorForCell(1, colColors)
8485
- // or keep a default color
8486
- },
8487
- childClassName: "left_fixed_data_cell"
8488
- });
8507
+ }
8489
8508
  }
8490
8509
  if (headerAtStart && isRowTotalOn) {
8491
- const colIndex = leftFixedCellNameList ? leftFixedCellNameList.length : 1;
8510
+ let colIndex = 1;
8511
+ if (leftFixedCellNameList) {
8512
+ colIndex = leftFixedCellNameList.length;
8513
+ }
8514
+ if (!isRowHeaderVisible) {
8515
+ colIndex = 0;
8516
+ }
8492
8517
  baseStyle.background = getBgColorForCell(colIndex, colColors);
8493
8518
  const finalStyleForColumn = getFinalStyleObj(STYLE_FOR.COLUMN, baseStyle, TOTAL, colIndex);
8494
8519
  cells.push({
@@ -8497,7 +8522,7 @@
8497
8522
  ...finalStyleForColumn,
8498
8523
  left: colIndex * fixedColWidth,
8499
8524
  fontWeight: "bold",
8500
- borderLeft: "none"
8525
+ borderLeft: !isRowHeaderVisible ? BORDER_STYLE : "none"
8501
8526
  },
8502
8527
  childClassName: "left_fixed_data_cell_total"
8503
8528
  });
@@ -8505,7 +8530,7 @@
8505
8530
  if (headerAtStart && isColTotalOn) {
8506
8531
  cells.push({
8507
8532
  label: TOTAL,
8508
- style: bottomRowStyle,
8533
+ style: { ...bottomRowStyle, borderTop: !isColHeaderVisible ? BORDER_STYLE : "none" },
8509
8534
  childClassName: "left_fixed_data_cell_total"
8510
8535
  });
8511
8536
  }
@@ -8538,8 +8563,8 @@
8538
8563
  left: (fixedColCount - 1) * fixedColWidth,
8539
8564
  background: outerBg,
8540
8565
  border: BORDER_STYLE,
8541
- borderTop: "none",
8542
- borderLeft: "none",
8566
+ borderTop: !isColHeaderVisible ? BORDER_STYLE : "none",
8567
+ borderLeft: !isRowHeaderVisible ? BORDER_STYLE : "none",
8543
8568
  fontWeight: "bold"
8544
8569
  },
8545
8570
  childClassName: "left_fixed_data_cell_grand_total",
@@ -8573,7 +8598,7 @@
8573
8598
  DisplayUnits
8574
8599
  ]);
8575
8600
  const renderLeftFixedHeaders = React.useMemo(
8576
- () => cornerCells.map((c) => renderDataCell(c.label, c.style, "left_fixed_div", c.childClassName, void 0, c.dataBarColor)),
8601
+ () => cornerCells?.map((c) => renderDataCell(c.label, c.style, "left_fixed_div", c.childClassName, void 0, c.dataBarColor)),
8577
8602
  [cornerCells]
8578
8603
  );
8579
8604
  const colHeadersBase = React.useMemo(() => {
@@ -8617,6 +8642,7 @@
8617
8642
  width: cellWidth * span,
8618
8643
  height: cellHeight,
8619
8644
  borderTop: level === 0 ? BORDER_STYLE : "none",
8645
+ borderLeft: i === 0 && !isRowHeaderVisible && !(headerAtStart && isRowTotalOn) ? BORDER_STYLE : "none",
8620
8646
  childClassName: "col_header_data_cell"
8621
8647
  });
8622
8648
  }
@@ -8634,6 +8660,7 @@
8634
8660
  label,
8635
8661
  left: offsetLeft,
8636
8662
  top: level * cellHeight,
8663
+ borderTop: !isColHeaderVisible && (headerAtStart && isColTotalOn) ? BORDER_STYLE : "none",
8637
8664
  width: cellWidth,
8638
8665
  height: cellHeight,
8639
8666
  background: ShowHeatMap ? getBgColorForHetMap(0, idx) : getBgColorForCell(rowCount, dataColors),
@@ -8645,7 +8672,7 @@
8645
8672
  });
8646
8673
  }
8647
8674
  }
8648
- if (isRowTotalOn && !headerAtStart) {
8675
+ if (isRowTotalOn && !headerAtStart && isColHeaderVisible) {
8649
8676
  headers.push({
8650
8677
  ...colHeaderFont,
8651
8678
  label: TOTAL,
@@ -8708,6 +8735,8 @@
8708
8735
  left: level * fixedColWidth,
8709
8736
  width: fixedColWidth,
8710
8737
  height: cellHeight * span,
8738
+ //Border condition for the col header visibility with total
8739
+ borderTop: i === 0 && !isColHeaderVisible && !(headerAtStart && isColTotalOn) ? BORDER_STYLE : "none",
8711
8740
  borderLeft: level === 0 ? BORDER_STYLE : "none"
8712
8741
  });
8713
8742
  }
@@ -8737,13 +8766,14 @@
8737
8766
  fontWeight: "bold",
8738
8767
  rowIdxHeat: i,
8739
8768
  colIdxHeat: level,
8769
+ borderLeft: !isRowHeaderVisible ? BORDER_STYLE : "none",
8740
8770
  dataBarColor: innerBg
8741
8771
  });
8742
8772
  offsetTop += cellHeight;
8743
8773
  }
8744
8774
  }
8745
8775
  }
8746
- if (isColTotalOn && !headerAtStart) {
8776
+ if (isColTotalOn && !headerAtStart && isRowHeaderVisible) {
8747
8777
  headers.push({
8748
8778
  ...rowHeaderFont,
8749
8779
  label: TOTAL,
@@ -8859,6 +8889,12 @@
8859
8889
  if (conditionalFormatObj.backgroundColor) finalStyle.background = conditionalFormatObj.backgroundColor;
8860
8890
  if (conditionalFormatObj.color) finalStyle.color = conditionalFormatObj.color;
8861
8891
  }
8892
+ if (rowIdxHeat === 0 && !isColHeaderVisible && !(headerAtStart && isColTotalOn)) {
8893
+ finalStyle.borderTop = BORDER_STYLE;
8894
+ }
8895
+ if (colIdxHeat === 0 && !isRowHeaderVisible && !(isRowTotalOn && headerAtStart)) {
8896
+ finalStyle.borderLeft = BORDER_STYLE;
8897
+ }
8862
8898
  return renderDataCell(
8863
8899
  formattedValue,
8864
8900
  finalStyle,