pace-table-lib 1.0.68 → 1.0.70

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.
@@ -17232,8 +17232,8 @@
17232
17232
  hideMarkerButton: false
17233
17233
  };
17234
17234
  function JQuerySparkLine({
17235
- width = 76,
17236
- height = 16,
17235
+ width,
17236
+ height,
17237
17237
  slPropData
17238
17238
  }) {
17239
17239
  const sparkRef = React.useRef(null);
@@ -17256,7 +17256,7 @@
17256
17256
  case SL_TYPE.LINE:
17257
17257
  {
17258
17258
  const sparkOptions = {
17259
- type: "line",
17259
+ type: SL_TYPE.LINE,
17260
17260
  width: `${width}px`,
17261
17261
  height: `${height}px`,
17262
17262
  lineColor: slPropData.slStyle.lineColor,
@@ -17274,12 +17274,12 @@
17274
17274
  case SL_TYPE.BAR:
17275
17275
  {
17276
17276
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17277
- type: "bar",
17277
+ type: SL_TYPE.BAR,
17278
17278
  width: `${width}px`,
17279
17279
  height: `${height}px`,
17280
- barColor: slPropData.slStyle?.barColor,
17280
+ barColor: slPropData.slStyle?.posBarColor,
17281
17281
  negBarColor: slPropData.slStyle?.negBarColor,
17282
- zeroColor: slPropData.slStyle?.zeroBarColor,
17282
+ zeroColor: slPropData.slStyle?.zeroColor,
17283
17283
  barWidth: slPropData.slStyle?.barWidth,
17284
17284
  barSpacing: slPropData.slStyle?.barSpacing,
17285
17285
  chartRangeMin: 0
@@ -17289,7 +17289,7 @@
17289
17289
  case SL_TYPE.BOX:
17290
17290
  {
17291
17291
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17292
- type: "box",
17292
+ type: SL_TYPE.BOX,
17293
17293
  width: `${width}px`,
17294
17294
  height: `${height}px`,
17295
17295
  boxLineColor: slPropData.slStyle?.boxLineColor,
@@ -17302,7 +17302,7 @@
17302
17302
  case SL_TYPE.DISCRETE:
17303
17303
  {
17304
17304
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17305
- type: "discrete",
17305
+ type: SL_TYPE.DISCRETE,
17306
17306
  width: `${width}`,
17307
17307
  height: `${height}px`,
17308
17308
  lineColor: slPropData.slStyle?.lineColor || "#007bff",
@@ -17314,9 +17314,10 @@
17314
17314
  case SL_TYPE.PIE:
17315
17315
  {
17316
17316
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17317
- type: "pie",
17318
- // width: `${40}px`,
17319
- height: `${height}px`,
17317
+ type: SL_TYPE.PIE,
17318
+ //Why min in order to center align the pie chart , in case of fit table.
17319
+ width: `${Math.min(height, width)}px`,
17320
+ height: `${Math.min(height, width)}px`,
17320
17321
  borderWidth: 0,
17321
17322
  offset: slPropData.slStyle?.offset || 0,
17322
17323
  tooltipFormatter: function(sparkline, options, fields) {
@@ -17332,14 +17333,14 @@
17332
17333
  case SL_TYPE.TRISTATE:
17333
17334
  {
17334
17335
  $(sparkRef.current).sparkline(slPropData.dataArr, {
17335
- type: "tristate",
17336
+ type: SL_TYPE.TRISTATE,
17336
17337
  width: `${width}px`,
17337
17338
  height: `${height}px`,
17338
17339
  posBarColor: slPropData.slStyle?.posBarColor || "#28a745",
17339
17340
  // positive
17340
17341
  negBarColor: slPropData.slStyle?.negBarColor || "#dc3545",
17341
17342
  // negative
17342
- zeroBarColor: slPropData.slStyle?.zeroBarColor || "#bab0ac",
17343
+ zeroBarColor: slPropData.slStyle?.zeroColor || "#bab0ac",
17343
17344
  // neutral
17344
17345
  barWidth: slPropData.slStyle?.barWidth || 4,
17345
17346
  barSpacing: slPropData.slStyle?.barSpacing || 2,
@@ -17367,7 +17368,7 @@
17367
17368
  "span",
17368
17369
  {
17369
17370
  ref: sparkRef,
17370
- style: { display: "inline-block", verticalAlign: "middle" }
17371
+ style: { display: "inline-block", verticalAlign: "middle", zIndex: 10 }
17371
17372
  }
17372
17373
  );
17373
17374
  }
@@ -17434,23 +17435,33 @@
17434
17435
  const outsideBorder = isOutsideBorderVisible ? createBorder(Border.LineWidth, Border.LineStyle, Border.LineColor) : null;
17435
17436
  const insideVBorder = isInsideVerticalBVisible ? createBorder(Border.VerticalBorderLineWidth, Border.VerticalBorderLineStyle, Border.VerticalBorderLineColor) : null;
17436
17437
  const insideHBorder = isInsideHorizontalBVisible ? createBorder(Border.HorizontalBorderLineWidth, Border.HorizontalBorderLineStyle, Border.HorizontalBorderLineColor) : null;
17438
+ const {
17439
+ ShowHeatMap,
17440
+ HeatMapView,
17441
+ HeatMapMinColor,
17442
+ HeatMapMaxColor
17443
+ } = HeatMap || {};
17444
+ const gridRef = React.useRef(null);
17437
17445
  const renderDataCell = (label, styles, className, childClassName, toolTip, dataBarBg) => /* @__PURE__ */ jsxRuntimeExports.jsx(
17438
17446
  "div",
17439
17447
  {
17440
17448
  ...ToolTipVisibility ? { title: getCleanString(toolTip) ?? "" } : {},
17441
17449
  className,
17442
17450
  style: styles,
17451
+ onContextMenu: styles.hasOwnProperty("oncontextmenu") ? styles.oncontextmenu : null,
17443
17452
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
17444
17453
  "div",
17445
17454
  {
17446
17455
  className: `${childClassName} cell_inner`,
17447
17456
  style: {
17448
17457
  fontFamily: styles.fontFamily,
17449
- background: dataBarBg ?? "none"
17458
+ background: dataBarBg ?? "none",
17459
+ //Show icon only then align icon to center
17460
+ ...styles?.iconPosition === ICON_POSITION.OIcon ? { justifyContent: "center" } : {}
17450
17461
  },
17451
17462
  children: [
17452
17463
  styles && styles?.iconPosition === ICON_POSITION.Left && styles?.iconUrl && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: styles?.iconUrl, className: "cell_icon left" }),
17453
- styles && styles?.iconPosition === ICON_POSITION.OIcon && styles?.iconUrl ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: styles?.iconUrl, className: "cell_icon left" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { textAlign: styles.justifyContent }, className: "cell_text", children: label }),
17464
+ styles && styles?.iconPosition === ICON_POSITION.OIcon && styles?.iconUrl ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: styles?.iconUrl, className: "cell_icon" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { textAlign: styles.justifyContent }, className: "cell_text", children: label }),
17454
17465
  styles && styles?.iconPosition === ICON_POSITION.Right && styles?.iconUrl && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: styles?.iconUrl, className: "cell_icon right" })
17455
17466
  ]
17456
17467
  }
@@ -17497,12 +17508,6 @@
17497
17508
  color: DataFieldColor,
17498
17509
  ...getFontStyleObj(DataFieldFontStyle)
17499
17510
  }), [DataField]);
17500
- const {
17501
- ShowHeatMap,
17502
- HeatMapView,
17503
- HeatMapMinColor,
17504
- HeatMapMaxColor
17505
- } = HeatMap || {};
17506
17511
  const fixedRowCount = React.useMemo(() => {
17507
17512
  if (!isColHeaderVisible) {
17508
17513
  return headerAtStart && isColTotalOn ? 1 : 0;
@@ -17610,7 +17615,6 @@
17610
17615
  Table2.TableWidth,
17611
17616
  Table2.FixHeaderWidth
17612
17617
  ]);
17613
- const gridRef = React.useRef(null);
17614
17618
  React.useEffect(() => {
17615
17619
  const t = setTimeout(() => {
17616
17620
  if (gridRef.current) {
@@ -18234,7 +18238,7 @@
18234
18238
  height: rowCellHeight,
18235
18239
  top: baseTop + measuresBySlice.length * rowCellHeight,
18236
18240
  left: widthForTheTotal,
18237
- background: getBgColorForCell(rowCount - 1, rowColors),
18241
+ background: finalStyleForRow.background ?? getBgColorForCell(getGroupIndex(measuresBySlice), rowColors),
18238
18242
  fontWeight: "bold"
18239
18243
  };
18240
18244
  let measures = [];
@@ -18272,7 +18276,7 @@
18272
18276
  top: fixedRowCount * rowCellHeight + rowIdx * rowCellHeight,
18273
18277
  // directly under headers
18274
18278
  left: sparkColIndex * fixedColWidth,
18275
- background: getBgColorForCell(rowIdx - 1, rowColors),
18279
+ background: rowHeaderBandColorMap[item.sliceMark[0]],
18276
18280
  display: "flex",
18277
18281
  justifyContent: "center",
18278
18282
  alignItems: "center"
@@ -18430,10 +18434,12 @@
18430
18434
  if (operator === "duplicate") {
18431
18435
  const currentVal = value?.toLowerCase();
18432
18436
  if (type === CONDITIONAL_FORMAT_FOR.ROW) {
18433
- const allChildren = measuresBySlice.map((item) => item.sliceMark[level]?.toLowerCase()).filter((v) => v);
18434
- return allChildren.filter((v) => v === currentVal).length > 1;
18437
+ const marks = measuresBySlice.map((m) => m.sliceMark);
18438
+ const renderedValues = measuresBySlice.map((item, i) => isFirstOccurrence(marks, i, level) ? item.sliceMark[level]?.toLowerCase() : null).filter((v) => v !== null && v !== void 0);
18439
+ return renderedValues.filter((v) => v === currentVal).length > 1;
18435
18440
  } else if (type === CONDITIONAL_FORMAT_FOR.COLUMN) {
18436
- return dimensionMarks.filter((row) => row.some((item) => item?.toLowerCase() === currentVal)).length > 1;
18441
+ const renderedValues = dimensionMarks.map((d, i) => isFirstOccurrence(dimensionMarks, i, level) ? d[level]?.toLowerCase() : null).filter((v) => v !== null && v !== void 0);
18442
+ return renderedValues.filter((v) => v === currentVal).length > 1;
18437
18443
  }
18438
18444
  }
18439
18445
  if (type === CONDITIONAL_FORMAT_FOR.VALUE) {
@@ -18593,55 +18599,38 @@
18593
18599
  innerDivBg
18594
18600
  );
18595
18601
  };
18596
- function getSparkLineStyleObj(lineType) {
18602
+ function getSparkLineStyleObj() {
18597
18603
  const slStyle = structuredClone(DEFAULT_SL_STYLE);
18598
- switch (lineType) {
18599
- case SL_TYPE.LINE: {
18600
- if (SparkLine?.SparkLineColor)
18601
- slStyle.lineColor = SparkLine.SparkLineColor;
18602
- if (SparkLine?.SparkLineWidth)
18603
- slStyle.lineWidth = SparkLine.SparkLineWidth;
18604
- if (SparkLine?.HideMarkerButton !== void 0)
18605
- slStyle.hideMarkerButton = SparkLine.HideMarkerButton;
18606
- if (SparkLine?.SparkLineMarkerColor)
18607
- slStyle.spotColor = SparkLine.SparkLineMarkerColor;
18608
- break;
18609
- }
18610
- case SL_TYPE.BAR: {
18611
- if (SparkLine?.PositiveBarChartColor)
18612
- slStyle.posBarColor = SparkLine.PositiveBarChartColor;
18613
- if (SparkLine?.NegativeBarChartColor)
18614
- slStyle.negBarColor = SparkLine.NegativeBarChartColor;
18615
- if (SparkLine?.ZeroBarChartColor)
18616
- slStyle.zeroColor = SparkLine.ZeroBarChartColor;
18617
- if (SparkLine?.BarWidth)
18618
- slStyle.barWidth = SparkLine.BarWidth;
18619
- if (SparkLine?.BarSpacing)
18620
- slStyle.barSpacing = SparkLine.BarSpacing;
18621
- break;
18622
- }
18623
- case SL_TYPE.DISCRETE: {
18624
- if (SparkLine?.ThresholdValue !== void 0)
18625
- slStyle.thresholdValue = SparkLine.ThresholdValue;
18626
- if (SparkLine?.ThresholdColor)
18627
- slStyle.thresholdColor = SparkLine.ThresholdColor;
18628
- break;
18629
- }
18630
- case SL_TYPE.BOX: {
18631
- if (SparkLine?.MedianColor)
18632
- slStyle.medianColor = SparkLine.MedianColor;
18633
- if (SparkLine?.BoxFillColor)
18634
- slStyle.boxFillColor = SparkLine.BoxFillColor;
18635
- if (SparkLine?.BoxBorderColor)
18636
- slStyle.boxLineColor = SparkLine.BoxBorderColor;
18637
- if (SparkLine?.MinMaxLineColor)
18638
- slStyle.whiskerColor = SparkLine.MinMaxLineColor;
18639
- break;
18640
- }
18641
- case SL_TYPE.PIE: {
18642
- break;
18643
- }
18644
- }
18604
+ if (SparkLine?.SparkLineColor)
18605
+ slStyle.lineColor = SparkLine.SparkLineColor;
18606
+ if (SparkLine?.SparkLineWidth)
18607
+ slStyle.lineWidth = SparkLine.SparkLineWidth;
18608
+ if (SparkLine?.HideMarkerButton !== void 0)
18609
+ slStyle.hideMarkerButton = SparkLine.HideMarkerButton;
18610
+ if (SparkLine?.SparkLineMarkerColor)
18611
+ slStyle.spotColor = SparkLine.SparkLineMarkerColor;
18612
+ if (SparkLine?.PositiveBarChartColor)
18613
+ slStyle.posBarColor = SparkLine.PositiveBarChartColor;
18614
+ if (SparkLine?.NegativeBarChartColor)
18615
+ slStyle.negBarColor = SparkLine.NegativeBarChartColor;
18616
+ if (SparkLine?.ZeroBarChartColor)
18617
+ slStyle.zeroColor = SparkLine.ZeroBarChartColor;
18618
+ if (SparkLine?.BarWidth)
18619
+ slStyle.barWidth = SparkLine.BarWidth;
18620
+ if (SparkLine?.BarSpacing)
18621
+ slStyle.barSpacing = SparkLine.BarSpacing;
18622
+ if (SparkLine?.ThresholdValue !== void 0)
18623
+ slStyle.thresholdValue = SparkLine.ThresholdValue;
18624
+ if (SparkLine?.ThresholdColor)
18625
+ slStyle.thresholdColor = SparkLine.ThresholdColor;
18626
+ if (SparkLine?.MedianColor)
18627
+ slStyle.medianColor = SparkLine.MedianColor;
18628
+ if (SparkLine?.BoxFillColor)
18629
+ slStyle.boxFillColor = SparkLine.BoxFillColor;
18630
+ if (SparkLine?.BoxBorderColor)
18631
+ slStyle.boxLineColor = SparkLine.BoxBorderColor;
18632
+ if (SparkLine?.MinMaxLineColor)
18633
+ slStyle.whiskerColor = SparkLine.MinMaxLineColor;
18645
18634
  return slStyle;
18646
18635
  }
18647
18636
  function getSparkLine(dataArr, styleObj) {
@@ -18649,7 +18638,7 @@
18649
18638
  const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
18650
18639
  const slPropData = {
18651
18640
  dataArr,
18652
- slStyle: getSparkLineStyleObj(lineType),
18641
+ slStyle: getSparkLineStyleObj(),
18653
18642
  slType: lineType
18654
18643
  };
18655
18644
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spark_line_div", style: { ...styleObj }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -18860,15 +18849,27 @@
18860
18849
  const interpolateColor = (minColor, maxColor, factor) => {
18861
18850
  const toRgb = (hex) => {
18862
18851
  const clean = hex.replace("#", "");
18852
+ if (!/^[0-9A-Fa-f]{6}$/.test(clean)) {
18853
+ return { r: 0, g: 0, b: 0 };
18854
+ }
18863
18855
  const n = parseInt(clean, 16);
18864
- return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
18856
+ return {
18857
+ r: n >> 16 & 255,
18858
+ g: n >> 8 & 255,
18859
+ b: n & 255
18860
+ };
18865
18861
  };
18866
- const toHex = (r2, g, b) => `#${[r2, g, b]?.map((x) => x.toString(16).padStart(2, "0")).join("")}`;
18867
- const c1 = toRgb(minColor), c2 = toRgb(maxColor);
18862
+ const toHex = (r2, g, b) => `#${[r2, g, b].map((x) => {
18863
+ const safe = Number.isFinite(x) ? x : 0;
18864
+ return safe.toString(16).padStart(2, "0");
18865
+ }).join("")}`;
18866
+ const c1 = toRgb(minColor);
18867
+ const c2 = toRgb(maxColor);
18868
+ const safeFactor = Number.isFinite(factor) ? Math.max(0, Math.min(1, factor)) : 0;
18868
18869
  return toHex(
18869
- Math.round(c1.r + (c2.r - c1.r) * factor),
18870
- Math.round(c1.g + (c2.g - c1.g) * factor),
18871
- Math.round(c1.b + (c2.b - c1.b) * factor)
18870
+ Math.round(c1.r + (c2.r - c1.r) * safeFactor),
18871
+ Math.round(c1.g + (c2.g - c1.g) * safeFactor),
18872
+ Math.round(c1.b + (c2.b - c1.b) * safeFactor)
18872
18873
  );
18873
18874
  };
18874
18875
  function getHeatmapColor(value, minValue, maxValue, minColor, maxColor) {
@@ -19172,6 +19173,18 @@
19172
19173
  const [showCornerMenu, setShowCornerMenu] = React.useState(false);
19173
19174
  const [collapsedRows, setCollapsedRows] = React.useState(/* @__PURE__ */ new Set());
19174
19175
  const [collapsedCols, setCollapsedCols] = React.useState(/* @__PURE__ */ new Set());
19176
+ const cornerMenuRef = React.useRef(null);
19177
+ React.useEffect(() => {
19178
+ const handleOutsideClick = (event) => {
19179
+ if (cornerMenuRef.current && !cornerMenuRef.current.contains(event.target)) {
19180
+ setShowCornerMenu(false);
19181
+ }
19182
+ };
19183
+ document.addEventListener("mousedown", handleOutsideClick);
19184
+ return () => {
19185
+ document.removeEventListener("mousedown", handleOutsideClick);
19186
+ };
19187
+ }, []);
19175
19188
  const visibleRows = React.useMemo(
19176
19189
  () => flatRows?.filter((row) => {
19177
19190
  const nonSubSegs = row.segments?.filter((s) => s !== "!subtotal");
@@ -19979,6 +19992,7 @@
19979
19992
  }
19980
19993
  }
19981
19994
  let percentage = 0;
19995
+ let kpiColor = "";
19982
19996
  if (KPI.KPIVisibility) {
19983
19997
  const baseType = tableStyleProps.KPI.KPIBaseFormat;
19984
19998
  const values = baseType === "Column-wise" ? flatRows?.map(
@@ -19995,7 +20009,7 @@
19995
20009
  0,
19996
20010
  Math.min(100, (Number(rawValue) - min) / (max - min) * 100)
19997
20011
  ) : 0;
19998
- interpolateColor(
20012
+ kpiColor = interpolateColor(
19999
20013
  KPI.KPIMinColor,
20000
20014
  KPI.KPIMaxColor,
20001
20015
  percentage / 100
@@ -20038,7 +20052,7 @@
20038
20052
  "div",
20039
20053
  {
20040
20054
  className: "kpi-wrapper cell_inner_pivot",
20041
- style: { justifyContent: dataCellFont.justifyContent },
20055
+ style: { justifyContent: dataCellFont.justifyContent, background: kpiColor ?? "none" },
20042
20056
  children: [
20043
20057
  conditionalFormatObj && conditionalFormatObj?.iconPosition === ICON_POSITION.Left && conditionalFormatObj?.iconUrl && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: conditionalFormatObj?.iconUrl, className: "cell_icon_pivot left" }),
20044
20058
  conditionalFormatObj && conditionalFormatObj?.iconPosition === ICON_POSITION.OIcon && conditionalFormatObj?.iconUrl ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: conditionalFormatObj?.iconUrl, className: "cell_icon_pivot left" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { textAlign: dataCellFont.justifyContent, ...shouldWrap ? { wordBreak: "break-word", whiteSpace: "normal" } : { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, className: "kpi-text cell_text_pivot_pivot", children: formattedValue }),
@@ -20130,7 +20144,7 @@
20130
20144
  children: "+/−"
20131
20145
  }
20132
20146
  ),
20133
- showCornerMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pivot-corner-menu", children: [
20147
+ showCornerMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pivot-corner-menu", ref: cornerMenuRef, children: [
20134
20148
  hasCollapsibleRows && /* @__PURE__ */ jsxRuntimeExports.jsxs(
20135
20149
  "div",
20136
20150
  {