pace-table-lib 1.0.30 → 1.0.32

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.
@@ -18,6 +18,7 @@ type MeasureFormatObj = {
18
18
  numberFormat: string;
19
19
  decimalPrecision: number;
20
20
  displayUnits: DisplayUnitsType;
21
+ measureIndex: number;
21
22
  };
22
23
  export type CellRendererProps = {
23
24
  columnIndex: number;
@@ -8020,9 +8020,16 @@ function getSpan(arr, index, level) {
8020
8020
  return span;
8021
8021
  }
8022
8022
  function getCleanString(dimensionMark) {
8023
- if (!dimensionMark) return dimensionMark;
8024
- const parts = dimensionMark.split("~$~");
8025
- return parts.length > 1 ? parts[1] : dimensionMark;
8023
+ try {
8024
+ if (!dimensionMark) return dimensionMark;
8025
+ if (dimensionMark.includes("~$~")) {
8026
+ const parts = dimensionMark.split("~$~");
8027
+ return parts[1] ?? dimensionMark;
8028
+ }
8029
+ } catch (error) {
8030
+ console.log(error);
8031
+ }
8032
+ return dimensionMark;
8026
8033
  }
8027
8034
  function isFirstOccurrence(arr, index, level) {
8028
8035
  return index === 0 || arr[index].slice(0, level + 1).join("~$~") !== arr[index - 1].slice(0, level + 1).join("~$~");
@@ -18129,17 +18136,23 @@ function StaticTable({
18129
18136
  return `linear-gradient(to right, ${barColor} ${pct * 100}%, transparent ${pct * 100}%)`;
18130
18137
  }
18131
18138
  function getMeasureFormattingObj(givenMeasureName) {
18132
- const numberFormatConfig = {
18139
+ const defaultFormat = {
18133
18140
  numberFormat: NumberFormat,
18134
18141
  decimalPrecision: DataFieldDecimalPrecision,
18135
18142
  displayUnits: DisplayUnits
18136
18143
  };
18137
- if (isConditionalFormatOn) return numberFormatConfig;
18138
- if (!measureFormatConfigs) return numberFormatConfig;
18139
- if (!givenMeasureName) return numberFormatConfig;
18140
- const mIndex = getIndex(givenMeasureName);
18141
- const formattingObj = measureFormatConfigs?.[mIndex];
18142
- return formattingObj ?? numberFormatConfig;
18144
+ if (isConditionalFormatOn) return defaultFormat;
18145
+ if (!givenMeasureName || !measureFormatConfigs?.length) {
18146
+ return defaultFormat;
18147
+ }
18148
+ const measureIndex = getIndex(givenMeasureName);
18149
+ if (measureIndex == null || measureIndex < 0) {
18150
+ return defaultFormat;
18151
+ }
18152
+ const formattingObj = measureFormatConfigs.find(
18153
+ (item) => item.measureIndex === measureIndex
18154
+ );
18155
+ return formattingObj ?? defaultFormat;
18143
18156
  }
18144
18157
  function getConditionalFormat(value, formatFor, level) {
18145
18158
  if (!isConditionalFormatOn) return;