pace-table-lib 1.0.69 → 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.
@@ -17214,8 +17214,8 @@ const DEFAULT_SL_STYLE = {
17214
17214
  hideMarkerButton: false
17215
17215
  };
17216
17216
  function JQuerySparkLine({
17217
- width = 76,
17218
- height = 16,
17217
+ width,
17218
+ height,
17219
17219
  slPropData
17220
17220
  }) {
17221
17221
  const sparkRef = useRef(null);
@@ -17238,7 +17238,7 @@ function JQuerySparkLine({
17238
17238
  case SL_TYPE.LINE:
17239
17239
  {
17240
17240
  const sparkOptions = {
17241
- type: "line",
17241
+ type: SL_TYPE.LINE,
17242
17242
  width: `${width}px`,
17243
17243
  height: `${height}px`,
17244
17244
  lineColor: slPropData.slStyle.lineColor,
@@ -17256,12 +17256,12 @@ function JQuerySparkLine({
17256
17256
  case SL_TYPE.BAR:
17257
17257
  {
17258
17258
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17259
- type: "bar",
17259
+ type: SL_TYPE.BAR,
17260
17260
  width: `${width}px`,
17261
17261
  height: `${height}px`,
17262
- barColor: slPropData.slStyle?.barColor,
17262
+ barColor: slPropData.slStyle?.posBarColor,
17263
17263
  negBarColor: slPropData.slStyle?.negBarColor,
17264
- zeroColor: slPropData.slStyle?.zeroBarColor,
17264
+ zeroColor: slPropData.slStyle?.zeroColor,
17265
17265
  barWidth: slPropData.slStyle?.barWidth,
17266
17266
  barSpacing: slPropData.slStyle?.barSpacing,
17267
17267
  chartRangeMin: 0
@@ -17271,7 +17271,7 @@ function JQuerySparkLine({
17271
17271
  case SL_TYPE.BOX:
17272
17272
  {
17273
17273
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17274
- type: "box",
17274
+ type: SL_TYPE.BOX,
17275
17275
  width: `${width}px`,
17276
17276
  height: `${height}px`,
17277
17277
  boxLineColor: slPropData.slStyle?.boxLineColor,
@@ -17284,7 +17284,7 @@ function JQuerySparkLine({
17284
17284
  case SL_TYPE.DISCRETE:
17285
17285
  {
17286
17286
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17287
- type: "discrete",
17287
+ type: SL_TYPE.DISCRETE,
17288
17288
  width: `${width}`,
17289
17289
  height: `${height}px`,
17290
17290
  lineColor: slPropData.slStyle?.lineColor || "#007bff",
@@ -17296,9 +17296,10 @@ function JQuerySparkLine({
17296
17296
  case SL_TYPE.PIE:
17297
17297
  {
17298
17298
  $(sparkRef.current).sparkline([...slPropData.dataArr], {
17299
- type: "pie",
17300
- // width: `${40}px`,
17301
- height: `${height}px`,
17299
+ type: SL_TYPE.PIE,
17300
+ //Why min in order to center align the pie chart , in case of fit table.
17301
+ width: `${Math.min(height, width)}px`,
17302
+ height: `${Math.min(height, width)}px`,
17302
17303
  borderWidth: 0,
17303
17304
  offset: slPropData.slStyle?.offset || 0,
17304
17305
  tooltipFormatter: function(sparkline, options, fields) {
@@ -17314,14 +17315,14 @@ function JQuerySparkLine({
17314
17315
  case SL_TYPE.TRISTATE:
17315
17316
  {
17316
17317
  $(sparkRef.current).sparkline(slPropData.dataArr, {
17317
- type: "tristate",
17318
+ type: SL_TYPE.TRISTATE,
17318
17319
  width: `${width}px`,
17319
17320
  height: `${height}px`,
17320
17321
  posBarColor: slPropData.slStyle?.posBarColor || "#28a745",
17321
17322
  // positive
17322
17323
  negBarColor: slPropData.slStyle?.negBarColor || "#dc3545",
17323
17324
  // negative
17324
- zeroBarColor: slPropData.slStyle?.zeroBarColor || "#bab0ac",
17325
+ zeroBarColor: slPropData.slStyle?.zeroColor || "#bab0ac",
17325
17326
  // neutral
17326
17327
  barWidth: slPropData.slStyle?.barWidth || 4,
17327
17328
  barSpacing: slPropData.slStyle?.barSpacing || 2,
@@ -17349,7 +17350,7 @@ function JQuerySparkLine({
17349
17350
  "span",
17350
17351
  {
17351
17352
  ref: sparkRef,
17352
- style: { display: "inline-block", verticalAlign: "middle" }
17353
+ style: { display: "inline-block", verticalAlign: "middle", zIndex: 10 }
17353
17354
  }
17354
17355
  );
17355
17356
  }
@@ -17429,6 +17430,7 @@ function StaticTable({
17429
17430
  ...ToolTipVisibility ? { title: getCleanString(toolTip) ?? "" } : {},
17430
17431
  className,
17431
17432
  style: styles,
17433
+ onContextMenu: styles.hasOwnProperty("oncontextmenu") ? styles.oncontextmenu : null,
17432
17434
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
17433
17435
  "div",
17434
17436
  {
@@ -18218,7 +18220,7 @@ function StaticTable({
18218
18220
  height: rowCellHeight,
18219
18221
  top: baseTop + measuresBySlice.length * rowCellHeight,
18220
18222
  left: widthForTheTotal,
18221
- background: getBgColorForCell(rowCount - 1, rowColors),
18223
+ background: finalStyleForRow.background ?? getBgColorForCell(getGroupIndex(measuresBySlice), rowColors),
18222
18224
  fontWeight: "bold"
18223
18225
  };
18224
18226
  let measures = [];
@@ -18579,55 +18581,38 @@ function StaticTable({
18579
18581
  innerDivBg
18580
18582
  );
18581
18583
  };
18582
- function getSparkLineStyleObj(lineType) {
18584
+ function getSparkLineStyleObj() {
18583
18585
  const slStyle = structuredClone(DEFAULT_SL_STYLE);
18584
- switch (lineType) {
18585
- case SL_TYPE.LINE: {
18586
- if (SparkLine?.SparkLineColor)
18587
- slStyle.lineColor = SparkLine.SparkLineColor;
18588
- if (SparkLine?.SparkLineWidth)
18589
- slStyle.lineWidth = SparkLine.SparkLineWidth;
18590
- if (SparkLine?.HideMarkerButton !== void 0)
18591
- slStyle.hideMarkerButton = SparkLine.HideMarkerButton;
18592
- if (SparkLine?.SparkLineMarkerColor)
18593
- slStyle.spotColor = SparkLine.SparkLineMarkerColor;
18594
- break;
18595
- }
18596
- case SL_TYPE.BAR: {
18597
- if (SparkLine?.PositiveBarChartColor)
18598
- slStyle.posBarColor = SparkLine.PositiveBarChartColor;
18599
- if (SparkLine?.NegativeBarChartColor)
18600
- slStyle.negBarColor = SparkLine.NegativeBarChartColor;
18601
- if (SparkLine?.ZeroBarChartColor)
18602
- slStyle.zeroColor = SparkLine.ZeroBarChartColor;
18603
- if (SparkLine?.BarWidth)
18604
- slStyle.barWidth = SparkLine.BarWidth;
18605
- if (SparkLine?.BarSpacing)
18606
- slStyle.barSpacing = SparkLine.BarSpacing;
18607
- break;
18608
- }
18609
- case SL_TYPE.DISCRETE: {
18610
- if (SparkLine?.ThresholdValue !== void 0)
18611
- slStyle.thresholdValue = SparkLine.ThresholdValue;
18612
- if (SparkLine?.ThresholdColor)
18613
- slStyle.thresholdColor = SparkLine.ThresholdColor;
18614
- break;
18615
- }
18616
- case SL_TYPE.BOX: {
18617
- if (SparkLine?.MedianColor)
18618
- slStyle.medianColor = SparkLine.MedianColor;
18619
- if (SparkLine?.BoxFillColor)
18620
- slStyle.boxFillColor = SparkLine.BoxFillColor;
18621
- if (SparkLine?.BoxBorderColor)
18622
- slStyle.boxLineColor = SparkLine.BoxBorderColor;
18623
- if (SparkLine?.MinMaxLineColor)
18624
- slStyle.whiskerColor = SparkLine.MinMaxLineColor;
18625
- break;
18626
- }
18627
- case SL_TYPE.PIE: {
18628
- break;
18629
- }
18630
- }
18586
+ if (SparkLine?.SparkLineColor)
18587
+ slStyle.lineColor = SparkLine.SparkLineColor;
18588
+ if (SparkLine?.SparkLineWidth)
18589
+ slStyle.lineWidth = SparkLine.SparkLineWidth;
18590
+ if (SparkLine?.HideMarkerButton !== void 0)
18591
+ slStyle.hideMarkerButton = SparkLine.HideMarkerButton;
18592
+ if (SparkLine?.SparkLineMarkerColor)
18593
+ slStyle.spotColor = SparkLine.SparkLineMarkerColor;
18594
+ if (SparkLine?.PositiveBarChartColor)
18595
+ slStyle.posBarColor = SparkLine.PositiveBarChartColor;
18596
+ if (SparkLine?.NegativeBarChartColor)
18597
+ slStyle.negBarColor = SparkLine.NegativeBarChartColor;
18598
+ if (SparkLine?.ZeroBarChartColor)
18599
+ slStyle.zeroColor = SparkLine.ZeroBarChartColor;
18600
+ if (SparkLine?.BarWidth)
18601
+ slStyle.barWidth = SparkLine.BarWidth;
18602
+ if (SparkLine?.BarSpacing)
18603
+ slStyle.barSpacing = SparkLine.BarSpacing;
18604
+ if (SparkLine?.ThresholdValue !== void 0)
18605
+ slStyle.thresholdValue = SparkLine.ThresholdValue;
18606
+ if (SparkLine?.ThresholdColor)
18607
+ slStyle.thresholdColor = SparkLine.ThresholdColor;
18608
+ if (SparkLine?.MedianColor)
18609
+ slStyle.medianColor = SparkLine.MedianColor;
18610
+ if (SparkLine?.BoxFillColor)
18611
+ slStyle.boxFillColor = SparkLine.BoxFillColor;
18612
+ if (SparkLine?.BoxBorderColor)
18613
+ slStyle.boxLineColor = SparkLine.BoxBorderColor;
18614
+ if (SparkLine?.MinMaxLineColor)
18615
+ slStyle.whiskerColor = SparkLine.MinMaxLineColor;
18631
18616
  return slStyle;
18632
18617
  }
18633
18618
  function getSparkLine(dataArr, styleObj) {
@@ -18635,7 +18620,7 @@ function StaticTable({
18635
18620
  const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
18636
18621
  const slPropData = {
18637
18622
  dataArr,
18638
- slStyle: getSparkLineStyleObj(lineType),
18623
+ slStyle: getSparkLineStyleObj(),
18639
18624
  slType: lineType
18640
18625
  };
18641
18626
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spark_line_div", style: { ...styleObj }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -18846,15 +18831,27 @@ function hexToRgb(hex) {
18846
18831
  const interpolateColor = (minColor, maxColor, factor) => {
18847
18832
  const toRgb = (hex) => {
18848
18833
  const clean = hex.replace("#", "");
18834
+ if (!/^[0-9A-Fa-f]{6}$/.test(clean)) {
18835
+ return { r: 0, g: 0, b: 0 };
18836
+ }
18849
18837
  const n = parseInt(clean, 16);
18850
- return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
18838
+ return {
18839
+ r: n >> 16 & 255,
18840
+ g: n >> 8 & 255,
18841
+ b: n & 255
18842
+ };
18851
18843
  };
18852
- const toHex = (r2, g, b) => `#${[r2, g, b]?.map((x) => x.toString(16).padStart(2, "0")).join("")}`;
18853
- const c1 = toRgb(minColor), c2 = toRgb(maxColor);
18844
+ const toHex = (r2, g, b) => `#${[r2, g, b].map((x) => {
18845
+ const safe = Number.isFinite(x) ? x : 0;
18846
+ return safe.toString(16).padStart(2, "0");
18847
+ }).join("")}`;
18848
+ const c1 = toRgb(minColor);
18849
+ const c2 = toRgb(maxColor);
18850
+ const safeFactor = Number.isFinite(factor) ? Math.max(0, Math.min(1, factor)) : 0;
18854
18851
  return toHex(
18855
- Math.round(c1.r + (c2.r - c1.r) * factor),
18856
- Math.round(c1.g + (c2.g - c1.g) * factor),
18857
- Math.round(c1.b + (c2.b - c1.b) * factor)
18852
+ Math.round(c1.r + (c2.r - c1.r) * safeFactor),
18853
+ Math.round(c1.g + (c2.g - c1.g) * safeFactor),
18854
+ Math.round(c1.b + (c2.b - c1.b) * safeFactor)
18858
18855
  );
18859
18856
  };
18860
18857
  function getHeatmapColor(value, minValue, maxValue, minColor, maxColor) {
@@ -19158,6 +19155,18 @@ const PivotTable = ({
19158
19155
  const [showCornerMenu, setShowCornerMenu] = useState(false);
19159
19156
  const [collapsedRows, setCollapsedRows] = useState(/* @__PURE__ */ new Set());
19160
19157
  const [collapsedCols, setCollapsedCols] = useState(/* @__PURE__ */ new Set());
19158
+ const cornerMenuRef = useRef(null);
19159
+ useEffect(() => {
19160
+ const handleOutsideClick = (event) => {
19161
+ if (cornerMenuRef.current && !cornerMenuRef.current.contains(event.target)) {
19162
+ setShowCornerMenu(false);
19163
+ }
19164
+ };
19165
+ document.addEventListener("mousedown", handleOutsideClick);
19166
+ return () => {
19167
+ document.removeEventListener("mousedown", handleOutsideClick);
19168
+ };
19169
+ }, []);
19161
19170
  const visibleRows = useMemo(
19162
19171
  () => flatRows?.filter((row) => {
19163
19172
  const nonSubSegs = row.segments?.filter((s) => s !== "!subtotal");
@@ -20117,7 +20126,7 @@ const PivotTable = ({
20117
20126
  children: "+/−"
20118
20127
  }
20119
20128
  ),
20120
- showCornerMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pivot-corner-menu", children: [
20129
+ showCornerMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pivot-corner-menu", ref: cornerMenuRef, children: [
20121
20130
  hasCollapsibleRows && /* @__PURE__ */ jsxRuntimeExports.jsxs(
20122
20131
  "div",
20123
20132
  {