pace-table-lib 1.0.69 → 1.0.71

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
  }
@@ -17447,6 +17448,7 @@
17447
17448
  ...ToolTipVisibility ? { title: getCleanString(toolTip) ?? "" } : {},
17448
17449
  className,
17449
17450
  style: styles,
17451
+ onContextMenu: styles.hasOwnProperty("oncontextmenu") ? styles.oncontextmenu : null,
17450
17452
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
17451
17453
  "div",
17452
17454
  {
@@ -18236,7 +18238,7 @@
18236
18238
  height: rowCellHeight,
18237
18239
  top: baseTop + measuresBySlice.length * rowCellHeight,
18238
18240
  left: widthForTheTotal,
18239
- background: getBgColorForCell(rowCount - 1, rowColors),
18241
+ background: finalStyleForRow.background ?? getBgColorForCell(getGroupIndex(measuresBySlice), rowColors),
18240
18242
  fontWeight: "bold"
18241
18243
  };
18242
18244
  let measures = [];
@@ -18597,55 +18599,38 @@
18597
18599
  innerDivBg
18598
18600
  );
18599
18601
  };
18600
- function getSparkLineStyleObj(lineType) {
18602
+ function getSparkLineStyleObj() {
18601
18603
  const slStyle = structuredClone(DEFAULT_SL_STYLE);
18602
- switch (lineType) {
18603
- case SL_TYPE.LINE: {
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
- break;
18613
- }
18614
- case SL_TYPE.BAR: {
18615
- if (SparkLine?.PositiveBarChartColor)
18616
- slStyle.posBarColor = SparkLine.PositiveBarChartColor;
18617
- if (SparkLine?.NegativeBarChartColor)
18618
- slStyle.negBarColor = SparkLine.NegativeBarChartColor;
18619
- if (SparkLine?.ZeroBarChartColor)
18620
- slStyle.zeroColor = SparkLine.ZeroBarChartColor;
18621
- if (SparkLine?.BarWidth)
18622
- slStyle.barWidth = SparkLine.BarWidth;
18623
- if (SparkLine?.BarSpacing)
18624
- slStyle.barSpacing = SparkLine.BarSpacing;
18625
- break;
18626
- }
18627
- case SL_TYPE.DISCRETE: {
18628
- if (SparkLine?.ThresholdValue !== void 0)
18629
- slStyle.thresholdValue = SparkLine.ThresholdValue;
18630
- if (SparkLine?.ThresholdColor)
18631
- slStyle.thresholdColor = SparkLine.ThresholdColor;
18632
- break;
18633
- }
18634
- case SL_TYPE.BOX: {
18635
- if (SparkLine?.MedianColor)
18636
- slStyle.medianColor = SparkLine.MedianColor;
18637
- if (SparkLine?.BoxFillColor)
18638
- slStyle.boxFillColor = SparkLine.BoxFillColor;
18639
- if (SparkLine?.BoxBorderColor)
18640
- slStyle.boxLineColor = SparkLine.BoxBorderColor;
18641
- if (SparkLine?.MinMaxLineColor)
18642
- slStyle.whiskerColor = SparkLine.MinMaxLineColor;
18643
- break;
18644
- }
18645
- case SL_TYPE.PIE: {
18646
- break;
18647
- }
18648
- }
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;
18649
18634
  return slStyle;
18650
18635
  }
18651
18636
  function getSparkLine(dataArr, styleObj) {
@@ -18653,7 +18638,7 @@
18653
18638
  const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
18654
18639
  const slPropData = {
18655
18640
  dataArr,
18656
- slStyle: getSparkLineStyleObj(lineType),
18641
+ slStyle: getSparkLineStyleObj(),
18657
18642
  slType: lineType
18658
18643
  };
18659
18644
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spark_line_div", style: { ...styleObj }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -18864,15 +18849,27 @@
18864
18849
  const interpolateColor = (minColor, maxColor, factor) => {
18865
18850
  const toRgb = (hex) => {
18866
18851
  const clean = hex.replace("#", "");
18852
+ if (!/^[0-9A-Fa-f]{6}$/.test(clean)) {
18853
+ return { r: 0, g: 0, b: 0 };
18854
+ }
18867
18855
  const n = parseInt(clean, 16);
18868
- 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
+ };
18869
18861
  };
18870
- const toHex = (r2, g, b) => `#${[r2, g, b]?.map((x) => x.toString(16).padStart(2, "0")).join("")}`;
18871
- 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;
18872
18869
  return toHex(
18873
- Math.round(c1.r + (c2.r - c1.r) * factor),
18874
- Math.round(c1.g + (c2.g - c1.g) * factor),
18875
- 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)
18876
18873
  );
18877
18874
  };
18878
18875
  function getHeatmapColor(value, minValue, maxValue, minColor, maxColor) {
@@ -19176,6 +19173,18 @@
19176
19173
  const [showCornerMenu, setShowCornerMenu] = React.useState(false);
19177
19174
  const [collapsedRows, setCollapsedRows] = React.useState(/* @__PURE__ */ new Set());
19178
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
+ }, []);
19179
19188
  const visibleRows = React.useMemo(
19180
19189
  () => flatRows?.filter((row) => {
19181
19190
  const nonSubSegs = row.segments?.filter((s) => s !== "!subtotal");
@@ -19399,88 +19408,42 @@
19399
19408
  [isSparkLineActive, isFitTableOn, colCellWidth, Table2.FixHeaderWidth]
19400
19409
  );
19401
19410
  const getSparkLineStyleObj = React.useCallback(
19402
- (lineType) => {
19411
+ () => {
19403
19412
  const slStyle = structuredClone(DEFAULT_SL_STYLE);
19404
- switch (lineType) {
19405
- case SL_TYPE.LINE:
19406
- if (SparkLine?.SparkLineColor)
19407
- slStyle.lineColor = SparkLine.SparkLineColor;
19408
- if (SparkLine?.SparkLineWidth)
19409
- slStyle.lineWidth = SparkLine.SparkLineWidth;
19410
- if (SparkLine?.SparkLineMarkerColor)
19411
- slStyle.spotColor = SparkLine.SparkLineMarkerColor;
19412
- break;
19413
- case SL_TYPE.BAR:
19414
- if (SparkLine?.PositiveBarChartColor)
19415
- slStyle.posBarColor = SparkLine.PositiveBarChartColor;
19416
- if (SparkLine?.NegativeBarChartColor)
19417
- slStyle.negBarColor = SparkLine.NegativeBarChartColor;
19418
- if (SparkLine?.ZeroBarChartColor)
19419
- slStyle.zeroColor = SparkLine.ZeroBarChartColor;
19420
- if (SparkLine?.BarWidth) slStyle.barWidth = SparkLine.BarWidth;
19421
- if (SparkLine?.BarSpacing) slStyle.barSpacing = SparkLine.BarSpacing;
19422
- break;
19423
- case SL_TYPE.DISCRETE:
19424
- if (SparkLine?.ThresholdValue !== void 0)
19425
- slStyle.thresholdValue = SparkLine.ThresholdValue;
19426
- if (SparkLine?.ThresholdColor)
19427
- slStyle.thresholdColor = SparkLine.ThresholdColor;
19428
- if (SparkLine?.SparkLineColor)
19429
- slStyle.lineColor = SparkLine.SparkLineColor;
19430
- break;
19431
- case SL_TYPE.BOX:
19432
- if (SparkLine?.MedianColor)
19433
- slStyle.medianColor = SparkLine.MedianColor;
19434
- if (SparkLine?.BoxFillColor)
19435
- slStyle.boxFillColor = SparkLine.BoxFillColor;
19436
- if (SparkLine?.BoxBorderColor)
19437
- slStyle.boxLineColor = SparkLine.BoxBorderColor;
19438
- if (SparkLine?.MinMaxLineColor)
19439
- slStyle.whiskerColor = SparkLine.MinMaxLineColor;
19440
- break;
19441
- case SL_TYPE.TRISTATE:
19442
- if (SparkLine?.PositiveBarChartColor)
19443
- slStyle.posBarColor = SparkLine.PositiveBarChartColor;
19444
- if (SparkLine?.NegativeBarChartColor)
19445
- slStyle.negBarColor = SparkLine.NegativeBarChartColor;
19446
- if (SparkLine?.ZeroBarChartColor)
19447
- slStyle.zeroBarColor = SparkLine.ZeroBarChartColor;
19448
- if (SparkLine?.BarWidth) slStyle.barWidth = SparkLine.BarWidth;
19449
- if (SparkLine?.BarSpacing) slStyle.barSpacing = SparkLine.BarSpacing;
19450
- break;
19451
- case SL_TYPE.PIE:
19452
- if (SparkLine?.SparkLineColor)
19453
- slStyle.lineColor = SparkLine.SparkLineColor;
19454
- if (SparkLine?.SparkLineWidth)
19455
- slStyle.lineWidth = SparkLine.SparkLineWidth;
19456
- if (SparkLine?.SparkLineMarkerColor)
19457
- slStyle.spotColor = SparkLine.SparkLineMarkerColor;
19458
- break;
19459
- }
19413
+ if (SparkLine?.SparkLineColor)
19414
+ slStyle.lineColor = SparkLine.SparkLineColor;
19415
+ if (SparkLine?.SparkLineWidth)
19416
+ slStyle.lineWidth = SparkLine.SparkLineWidth;
19417
+ if (SparkLine?.HideMarkerButton !== void 0)
19418
+ slStyle.hideMarkerButton = SparkLine.HideMarkerButton;
19419
+ if (SparkLine?.SparkLineMarkerColor)
19420
+ slStyle.spotColor = SparkLine.SparkLineMarkerColor;
19421
+ if (SparkLine?.PositiveBarChartColor)
19422
+ slStyle.posBarColor = SparkLine.PositiveBarChartColor;
19423
+ if (SparkLine?.NegativeBarChartColor)
19424
+ slStyle.negBarColor = SparkLine.NegativeBarChartColor;
19425
+ if (SparkLine?.ZeroBarChartColor)
19426
+ slStyle.zeroColor = SparkLine.ZeroBarChartColor;
19427
+ if (SparkLine?.BarWidth)
19428
+ slStyle.barWidth = SparkLine.BarWidth;
19429
+ if (SparkLine?.BarSpacing)
19430
+ slStyle.barSpacing = SparkLine.BarSpacing;
19431
+ if (SparkLine?.ThresholdValue !== void 0)
19432
+ slStyle.thresholdValue = SparkLine.ThresholdValue;
19433
+ if (SparkLine?.ThresholdColor)
19434
+ slStyle.thresholdColor = SparkLine.ThresholdColor;
19435
+ if (SparkLine?.MedianColor)
19436
+ slStyle.medianColor = SparkLine.MedianColor;
19437
+ if (SparkLine?.BoxFillColor)
19438
+ slStyle.boxFillColor = SparkLine.BoxFillColor;
19439
+ if (SparkLine?.BoxBorderColor)
19440
+ slStyle.boxLineColor = SparkLine.BoxBorderColor;
19441
+ if (SparkLine?.MinMaxLineColor)
19442
+ slStyle.whiskerColor = SparkLine.MinMaxLineColor;
19460
19443
  return slStyle;
19461
19444
  },
19462
19445
  [SparkLine]
19463
19446
  );
19464
- React.useCallback(
19465
- (dataArr, containerStyle) => {
19466
- if (!isSparkLineActive) return null;
19467
- const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
19468
- const slPropData = {
19469
- dataArr,
19470
- slStyle: getSparkLineStyleObj(lineType),
19471
- slType: lineType
19472
- };
19473
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spark_line_div", style: { ...containerStyle }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
19474
- JQuerySparkLine,
19475
- {
19476
- width: Number(containerStyle.width) - 4,
19477
- height: Number(containerStyle.height) - 4,
19478
- slPropData
19479
- }
19480
- ) });
19481
- },
19482
- [isSparkLineActive, SparkLine, getSparkLineStyleObj]
19483
- );
19484
19447
  const renderSparkLineDataCell = React.useCallback(
19485
19448
  (row, rowIdx) => {
19486
19449
  if (!isSparkLineActive) return null;
@@ -19500,7 +19463,7 @@
19500
19463
  const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
19501
19464
  const slPropData = {
19502
19465
  dataArr,
19503
- slStyle: getSparkLineStyleObj(lineType),
19466
+ slStyle: getSparkLineStyleObj(),
19504
19467
  slType: lineType
19505
19468
  };
19506
19469
  const isLastRow = rowIdx === visibleRows.length - 1;
@@ -20135,7 +20098,7 @@
20135
20098
  children: "+/−"
20136
20099
  }
20137
20100
  ),
20138
- showCornerMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pivot-corner-menu", children: [
20101
+ showCornerMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pivot-corner-menu", ref: cornerMenuRef, children: [
20139
20102
  hasCollapsibleRows && /* @__PURE__ */ jsxRuntimeExports.jsxs(
20140
20103
  "div",
20141
20104
  {