pace-table-lib 1.0.63 → 1.0.65

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.
@@ -18382,6 +18382,7 @@
18382
18382
  if (!format.formattingScheme || format.formattingScheme.toLowerCase() !== "conditionally") {
18383
18383
  return true;
18384
18384
  }
18385
+ const formattedValue = formatValue(value, void 0, DataFieldDecimalPrecision);
18385
18386
  const operator = format.operator?.toLowerCase();
18386
18387
  if (operator === "contains" && format.containsStr) {
18387
18388
  return value?.toLowerCase().includes(format.containsStr.toLowerCase());
@@ -18399,16 +18400,15 @@
18399
18400
  try {
18400
18401
  if (operator === "in between") {
18401
18402
  if (format.checkValue && format.secondCheckValue) {
18402
- return value >= format.checkValue && value <= format.secondCheckValue;
18403
+ return formattedValue >= format.checkValue && formattedValue <= format.secondCheckValue;
18403
18404
  }
18404
18405
  return false;
18405
18406
  } else if (operator === "not between") {
18406
18407
  if (format.checkValue && format.secondCheckValue) {
18407
- return value < format.checkValue || value > format.secondCheckValue;
18408
+ return formattedValue < format.checkValue || formattedValue > format.secondCheckValue;
18408
18409
  }
18409
18410
  return false;
18410
18411
  }
18411
- const formattedValue = formatValue(value, void 0, DataFieldDecimalPrecision);
18412
18412
  return compareVal(Number(formattedValue), format?.operator, Number(format?.checkValue));
18413
18413
  } catch {
18414
18414
  return false;
@@ -18999,16 +18999,19 @@
18999
18999
  KPI,
19000
19000
  SparkLine
19001
19001
  } = tableStyleProps;
19002
- const isFitTableOn = Table2.FitTable;
19003
- const { ToolTipVisibility } = tableStyleProps.ToolTip;
19002
+ const isFitTableOn = Table2?.FitTable;
19003
+ const { ToolTipVisibility } = tableStyleProps?.ToolTip;
19004
19004
  const shouldWrapColumnHeader = Table2?.ColumnWrapText;
19005
19005
  const isSparkLineActive = SparkLine?.SparkLineButton === true;
19006
19006
  const isSlAtStart = SparkLine?.Position === "Start";
19007
+ const isTotalAtStart = tableStyleProps?.DataField?.TotalHeaderPosition === TotalHeaderPos.Start;
19008
+ const isColTotalOn = tableStyleProps?.DataField?.ColumnTotal;
19009
+ const isRowTotalOn = tableStyleProps?.DataField?.RowTotal;
19007
19010
  const isRowHeaderVisible = !RowHeader?.HideRowHeader;
19008
19011
  const isColHeaderVisible = !ColumnHeader?.HideColumnHeader;
19009
- const measureValue = Table2.colOrRowHeaderName;
19010
- const isConditionalFormatOn = Table2.ConditionalformattingOnOff;
19011
- const conditionalFormatArr = Table2.Conditionalformatting;
19012
+ const measureValue = Table2?.colOrRowHeaderName;
19013
+ const isConditionalFormatOn = Table2?.ConditionalformattingOnOff;
19014
+ const conditionalFormatArr = Table2?.Conditionalformatting;
19012
19015
  const conditionalFormatsByType = React.useMemo(() => {
19013
19016
  const map = {
19014
19017
  value: [],
@@ -19022,11 +19025,11 @@
19022
19025
  return map;
19023
19026
  }, [conditionalFormatArr]);
19024
19027
  const isPercentageMode = React.useMemo(() => {
19025
- const pBy = tableStyleProps.DataField?.percentageBy;
19028
+ const pBy = tableStyleProps?.DataField?.percentageBy;
19026
19029
  return pBy && pBy.toLowerCase() !== "absolute";
19027
19030
  }, [tableStyleProps?.DataField?.percentageBy]);
19028
19031
  const percentageBy = React.useMemo(() => {
19029
- return tableStyleProps.DataField?.percentageBy ?? "absolute";
19032
+ return tableStyleProps?.DataField?.percentageBy ?? "absolute";
19030
19033
  }, [tableStyleProps?.DataField?.percentageBy]);
19031
19034
  const getMeasureFormattingObj = React.useCallback(
19032
19035
  (measureInfo) => {
@@ -19047,7 +19050,14 @@
19047
19050
  [DataField, measureFormatConfigs]
19048
19051
  );
19049
19052
  const flatRows = React.useMemo(() => {
19050
- const rh = tableData?.rowHeaders ?? [];
19053
+ const rh = structuredClone(tableData?.rowHeaders) ?? [];
19054
+ if (isColTotalOn && isRowHeaderVisible) {
19055
+ if (isTotalAtStart) {
19056
+ rh.unshift(TOTAL);
19057
+ } else {
19058
+ rh.push(TOTAL);
19059
+ }
19060
+ }
19051
19061
  return rh?.map((rowPath, i) => {
19052
19062
  const isNoEntry = NO_ENTRY_TOKENS.some(
19053
19063
  (t) => rowPath.toLowerCase().includes(t)
@@ -19075,9 +19085,16 @@
19075
19085
  rowIndex: i
19076
19086
  };
19077
19087
  });
19078
- }, [tableData]);
19088
+ }, [tableData, isTotalAtStart, isColTotalOn, isRowHeaderVisible]);
19079
19089
  const parsedColumns = React.useMemo(() => {
19080
- const headers = tableData?.columnHeaders ?? [];
19090
+ const headers = structuredClone(tableData?.columnHeaders) ?? [];
19091
+ if (isRowTotalOn && isColHeaderVisible) {
19092
+ if (isTotalAtStart) {
19093
+ headers.unshift(TOTAL);
19094
+ } else {
19095
+ headers.push(TOTAL);
19096
+ }
19097
+ }
19081
19098
  return headers?.map((h, i) => {
19082
19099
  const parts = h.split("`")?.filter((p) => p !== "");
19083
19100
  const isSubtotal = parts[parts.length - 1] === "!subtotal";
@@ -19099,7 +19116,7 @@
19099
19116
  colIndex: i
19100
19117
  };
19101
19118
  });
19102
- }, [tableData]);
19119
+ }, [tableData, isTotalAtStart, isRowTotalOn, isColHeaderVisible]);
19103
19120
  const hasCollapsibleRows = React.useMemo(
19104
19121
  () => flatRows.some((r2) => r2.isSubtotal),
19105
19122
  [flatRows]
@@ -19412,11 +19429,18 @@
19412
19429
  (row, rowIdx) => {
19413
19430
  if (!isSparkLineActive) return null;
19414
19431
  const rd = tableData;
19415
- const dataArr = visibleColumns?.map((col) => {
19432
+ let dataArr = visibleColumns?.map((col) => {
19416
19433
  const v = rd?.rowData?.[row.rowIndex]?.[col.colIndex];
19417
19434
  const n = parseFloat(String(v));
19418
19435
  return isNaN(n) ? 0 : n;
19419
19436
  });
19437
+ if (isRowTotalOn) {
19438
+ const finalIndex = isTotalAtStart && isColTotalOn ? row.rowIndex - 1 : row.rowIndex;
19439
+ dataArr.push(rd?.rowTotal?.[finalIndex]);
19440
+ }
19441
+ if (isColTotalOn && row.name === TOTAL) {
19442
+ dataArr = rd.columnTotal;
19443
+ }
19420
19444
  const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
19421
19445
  const slPropData = {
19422
19446
  dataArr,
@@ -19786,6 +19810,8 @@
19786
19810
  const shouldWrap = Table2?.RowWrapText;
19787
19811
  const rd = tableData;
19788
19812
  let rawValue = rd?.rowData?.[row.rowIndex]?.[col.colIndex] ?? 0;
19813
+ const isRenderColTotal = row.name === TOTAL;
19814
+ const isRenderRowTotal = col.path === TOTAL;
19789
19815
  const aggregationType = tableStyleProps.DataField.SubtotalAggregationBy;
19790
19816
  if (row.isSubtotal) {
19791
19817
  const parentSegments = row.segments?.filter((s) => s !== "!subtotal");
@@ -19813,6 +19839,14 @@
19813
19839
  rawValue = childValues.reduce((a, b) => a + b, 0);
19814
19840
  }
19815
19841
  }
19842
+ if (isRenderRowTotal) {
19843
+ const finalIndex = isTotalAtStart && isColTotalOn ? row.rowIndex - 1 : row.rowIndex;
19844
+ rawValue = rd.rowTotal?.[finalIndex];
19845
+ }
19846
+ if (isRenderColTotal) {
19847
+ const finalIndex = isTotalAtStart && isRowTotalOn ? col.colIndex - 1 : col.colIndex;
19848
+ rawValue = rd.columnTotal?.[finalIndex];
19849
+ }
19816
19850
  if (isPercentageMode) {
19817
19851
  const rd2 = tableData;
19818
19852
  const num = Number(rawValue);
@@ -19943,7 +19977,7 @@
19943
19977
  justifyContent: dataCellFont.justifyContent,
19944
19978
  fontSize: dataCellFont.fontSize,
19945
19979
  fontFamily: dataCellFont.fontFamily,
19946
- fontWeight: isSubtotalCell ? "bold" : dataCellFont.fontWeight,
19980
+ fontWeight: isSubtotalCell || isRenderRowTotal || isRenderColTotal ? "bold" : dataCellFont.fontWeight,
19947
19981
  fontStyle: dataCellFont.fontStyle,
19948
19982
  textDecoration: dataCellFont.textDecoration,
19949
19983
  color: dataCellFont.color,
@@ -20013,7 +20047,8 @@
20013
20047
  getConditionalFormat,
20014
20048
  getMeasureFormattingObj,
20015
20049
  isPercentageMode,
20016
- percentageBy
20050
+ percentageBy,
20051
+ isTotalAtStart
20017
20052
  ]
20018
20053
  );
20019
20054
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -20036,7 +20071,7 @@
20036
20071
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
20037
20072
  "div",
20038
20073
  {
20039
- className: "pivot-table__header-row",
20074
+ className: "pivot-table__header-row s1_scroll",
20040
20075
  style: { display: isColHeaderVisible ? "flex" : "none" },
20041
20076
  children: [
20042
20077
  /* @__PURE__ */ jsxRuntimeExports.jsx(