pace-table-lib 1.0.62 → 1.0.64

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.
@@ -18391,7 +18391,7 @@ function StaticTable({
18391
18391
  return false;
18392
18392
  }
18393
18393
  const formattedValue = formatValue(value, void 0, DataFieldDecimalPrecision);
18394
- return compareVal(formattedValue, format.operator, format.checkValue);
18394
+ return compareVal(Number(formattedValue), format?.operator, Number(format?.checkValue));
18395
18395
  } catch {
18396
18396
  return false;
18397
18397
  }
@@ -18981,16 +18981,19 @@ const PivotTable = ({
18981
18981
  KPI,
18982
18982
  SparkLine
18983
18983
  } = tableStyleProps;
18984
- const isFitTableOn = Table2.FitTable;
18985
- const { ToolTipVisibility } = tableStyleProps.ToolTip;
18984
+ const isFitTableOn = Table2?.FitTable;
18985
+ const { ToolTipVisibility } = tableStyleProps?.ToolTip;
18986
18986
  const shouldWrapColumnHeader = Table2?.ColumnWrapText;
18987
18987
  const isSparkLineActive = SparkLine?.SparkLineButton === true;
18988
18988
  const isSlAtStart = SparkLine?.Position === "Start";
18989
+ const isTotalAtStart = tableStyleProps?.DataField?.TotalHeaderPosition === TotalHeaderPos.Start;
18990
+ const isColTotalOn = tableStyleProps?.DataField?.ColumnTotal;
18991
+ const isRowTotalOn = tableStyleProps?.DataField?.RowTotal;
18989
18992
  const isRowHeaderVisible = !RowHeader?.HideRowHeader;
18990
18993
  const isColHeaderVisible = !ColumnHeader?.HideColumnHeader;
18991
- const measureValue = Table2.colOrRowHeaderName;
18992
- const isConditionalFormatOn = Table2.ConditionalformattingOnOff;
18993
- const conditionalFormatArr = Table2.Conditionalformatting;
18994
+ const measureValue = Table2?.colOrRowHeaderName;
18995
+ const isConditionalFormatOn = Table2?.ConditionalformattingOnOff;
18996
+ const conditionalFormatArr = Table2?.Conditionalformatting;
18994
18997
  const conditionalFormatsByType = useMemo(() => {
18995
18998
  const map = {
18996
18999
  value: [],
@@ -19004,11 +19007,11 @@ const PivotTable = ({
19004
19007
  return map;
19005
19008
  }, [conditionalFormatArr]);
19006
19009
  const isPercentageMode = useMemo(() => {
19007
- const pBy = tableStyleProps.DataField?.percentageBy;
19010
+ const pBy = tableStyleProps?.DataField?.percentageBy;
19008
19011
  return pBy && pBy.toLowerCase() !== "absolute";
19009
19012
  }, [tableStyleProps?.DataField?.percentageBy]);
19010
19013
  const percentageBy = useMemo(() => {
19011
- return tableStyleProps.DataField?.percentageBy ?? "absolute";
19014
+ return tableStyleProps?.DataField?.percentageBy ?? "absolute";
19012
19015
  }, [tableStyleProps?.DataField?.percentageBy]);
19013
19016
  const getMeasureFormattingObj = useCallback(
19014
19017
  (measureInfo) => {
@@ -19029,7 +19032,14 @@ const PivotTable = ({
19029
19032
  [DataField, measureFormatConfigs]
19030
19033
  );
19031
19034
  const flatRows = useMemo(() => {
19032
- const rh = tableData?.rowHeaders ?? [];
19035
+ const rh = structuredClone(tableData?.rowHeaders) ?? [];
19036
+ if (isColTotalOn && isRowHeaderVisible) {
19037
+ if (isTotalAtStart) {
19038
+ rh.unshift(TOTAL);
19039
+ } else {
19040
+ rh.push(TOTAL);
19041
+ }
19042
+ }
19033
19043
  return rh?.map((rowPath, i) => {
19034
19044
  const isNoEntry = NO_ENTRY_TOKENS.some(
19035
19045
  (t) => rowPath.toLowerCase().includes(t)
@@ -19057,9 +19067,16 @@ const PivotTable = ({
19057
19067
  rowIndex: i
19058
19068
  };
19059
19069
  });
19060
- }, [tableData]);
19070
+ }, [tableData, isTotalAtStart, isColTotalOn, isRowHeaderVisible]);
19061
19071
  const parsedColumns = useMemo(() => {
19062
- const headers = tableData?.columnHeaders ?? [];
19072
+ const headers = structuredClone(tableData?.columnHeaders) ?? [];
19073
+ if (isRowTotalOn && isColHeaderVisible) {
19074
+ if (isTotalAtStart) {
19075
+ headers.unshift(TOTAL);
19076
+ } else {
19077
+ headers.push(TOTAL);
19078
+ }
19079
+ }
19063
19080
  return headers?.map((h, i) => {
19064
19081
  const parts = h.split("`")?.filter((p) => p !== "");
19065
19082
  const isSubtotal = parts[parts.length - 1] === "!subtotal";
@@ -19081,7 +19098,7 @@ const PivotTable = ({
19081
19098
  colIndex: i
19082
19099
  };
19083
19100
  });
19084
- }, [tableData]);
19101
+ }, [tableData, isTotalAtStart, isRowTotalOn, isColHeaderVisible]);
19085
19102
  const hasCollapsibleRows = useMemo(
19086
19103
  () => flatRows.some((r2) => r2.isSubtotal),
19087
19104
  [flatRows]
@@ -19394,11 +19411,18 @@ const PivotTable = ({
19394
19411
  (row, rowIdx) => {
19395
19412
  if (!isSparkLineActive) return null;
19396
19413
  const rd = tableData;
19397
- const dataArr = visibleColumns?.map((col) => {
19414
+ let dataArr = visibleColumns?.map((col) => {
19398
19415
  const v = rd?.rowData?.[row.rowIndex]?.[col.colIndex];
19399
19416
  const n = parseFloat(String(v));
19400
19417
  return isNaN(n) ? 0 : n;
19401
19418
  });
19419
+ if (isRowTotalOn) {
19420
+ const finalIndex = isTotalAtStart && isColTotalOn ? row.rowIndex - 1 : row.rowIndex;
19421
+ dataArr.push(rd?.rowTotal?.[finalIndex]);
19422
+ }
19423
+ if (isColTotalOn && row.name === TOTAL) {
19424
+ dataArr = rd.columnTotal;
19425
+ }
19402
19426
  const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
19403
19427
  const slPropData = {
19404
19428
  dataArr,
@@ -19768,6 +19792,8 @@ const PivotTable = ({
19768
19792
  const shouldWrap = Table2?.RowWrapText;
19769
19793
  const rd = tableData;
19770
19794
  let rawValue = rd?.rowData?.[row.rowIndex]?.[col.colIndex] ?? 0;
19795
+ const isRenderColTotal = row.name === TOTAL;
19796
+ const isRenderRowTotal = col.path === TOTAL;
19771
19797
  const aggregationType = tableStyleProps.DataField.SubtotalAggregationBy;
19772
19798
  if (row.isSubtotal) {
19773
19799
  const parentSegments = row.segments?.filter((s) => s !== "!subtotal");
@@ -19795,6 +19821,14 @@ const PivotTable = ({
19795
19821
  rawValue = childValues.reduce((a, b) => a + b, 0);
19796
19822
  }
19797
19823
  }
19824
+ if (isRenderRowTotal) {
19825
+ const finalIndex = isTotalAtStart && isColTotalOn ? row.rowIndex - 1 : row.rowIndex;
19826
+ rawValue = rd.rowTotal?.[finalIndex];
19827
+ }
19828
+ if (isRenderColTotal) {
19829
+ const finalIndex = isTotalAtStart && isRowTotalOn ? col.colIndex - 1 : col.colIndex;
19830
+ rawValue = rd.columnTotal?.[finalIndex];
19831
+ }
19798
19832
  if (isPercentageMode) {
19799
19833
  const rd2 = tableData;
19800
19834
  const num = Number(rawValue);
@@ -19925,7 +19959,7 @@ const PivotTable = ({
19925
19959
  justifyContent: dataCellFont.justifyContent,
19926
19960
  fontSize: dataCellFont.fontSize,
19927
19961
  fontFamily: dataCellFont.fontFamily,
19928
- fontWeight: isSubtotalCell ? "bold" : dataCellFont.fontWeight,
19962
+ fontWeight: isSubtotalCell || isRenderRowTotal || isRenderColTotal ? "bold" : dataCellFont.fontWeight,
19929
19963
  fontStyle: dataCellFont.fontStyle,
19930
19964
  textDecoration: dataCellFont.textDecoration,
19931
19965
  color: dataCellFont.color,
@@ -19995,7 +20029,8 @@ const PivotTable = ({
19995
20029
  getConditionalFormat,
19996
20030
  getMeasureFormattingObj,
19997
20031
  isPercentageMode,
19998
- percentageBy
20032
+ percentageBy,
20033
+ isTotalAtStart
19999
20034
  ]
20000
20035
  );
20001
20036
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -20018,7 +20053,7 @@ const PivotTable = ({
20018
20053
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
20019
20054
  "div",
20020
20055
  {
20021
- className: "pivot-table__header-row",
20056
+ className: "pivot-table__header-row s1_scroll",
20022
20057
  style: { display: isColHeaderVisible ? "flex" : "none" },
20023
20058
  children: [
20024
20059
  /* @__PURE__ */ jsxRuntimeExports.jsx(