@splunk/visualizations 28.2.1 → 28.2.2

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.
Files changed (60) hide show
  1. package/Area.js +10 -5
  2. package/Area.js.map +2 -2
  3. package/Bar.js +10 -5
  4. package/Bar.js.map +2 -2
  5. package/Bubble.js +10 -5
  6. package/Bubble.js.map +2 -2
  7. package/CHANGELOG.external.md +21 -1
  8. package/ChoroplethSvg.js +10 -5
  9. package/ChoroplethSvg.js.map +2 -2
  10. package/Column.js +10 -5
  11. package/Column.js.map +2 -2
  12. package/Ellipse.js +10 -5
  13. package/Ellipse.js.map +2 -2
  14. package/Events.js +10 -5
  15. package/Events.js.map +2 -2
  16. package/FillerGauge.js +10 -5
  17. package/FillerGauge.js.map +2 -2
  18. package/Image.js +10 -5
  19. package/Image.js.map +2 -2
  20. package/Line.js +10 -5
  21. package/Line.js.map +2 -2
  22. package/LinkGraph.js +10 -5
  23. package/LinkGraph.js.map +2 -2
  24. package/Map.js +10 -5
  25. package/Map.js.map +2 -2
  26. package/Markdown.js +10 -5
  27. package/Markdown.js.map +2 -2
  28. package/MarkerGauge.js +10 -5
  29. package/MarkerGauge.js.map +2 -2
  30. package/ParallelCoordinates.js +10 -5
  31. package/ParallelCoordinates.js.map +2 -2
  32. package/Pie.js +10 -5
  33. package/Pie.js.map +2 -2
  34. package/Punchcard.js +10 -5
  35. package/Punchcard.js.map +2 -2
  36. package/Rectangle.js +10 -5
  37. package/Rectangle.js.map +2 -2
  38. package/Sankey.js +10 -5
  39. package/Sankey.js.map +2 -2
  40. package/Scatter.js +10 -5
  41. package/Scatter.js.map +2 -2
  42. package/SingleValue.js +10 -5
  43. package/SingleValue.js.map +2 -2
  44. package/SingleValueIcon.js +10 -5
  45. package/SingleValueIcon.js.map +2 -2
  46. package/SingleValueRadial.js +10 -5
  47. package/SingleValueRadial.js.map +2 -2
  48. package/Table.js +104 -36
  49. package/Table.js.map +3 -3
  50. package/Timeline.js +10 -5
  51. package/Timeline.js.map +2 -2
  52. package/common/withDashboardViz.js +10 -5
  53. package/common/withDashboardViz.js.map +2 -2
  54. package/dist/types/Table/PureTable.d.ts.map +1 -1
  55. package/dist/types/Table/cells/ArrayCell.d.ts.map +1 -1
  56. package/dist/types/Table/cells/TextCell.d.ts.map +1 -1
  57. package/dist/types/Table/hooks.d.ts +2 -1
  58. package/dist/types/Table/hooks.d.ts.map +1 -1
  59. package/dist/types/common/hocs/FixedSizeContainer.d.ts.map +1 -1
  60. package/package.json +15 -15
package/Table.js CHANGED
@@ -1189,7 +1189,7 @@ var Cover = styled_components_default.div`
1189
1189
  bottom: 0;
1190
1190
  `;
1191
1191
  var Blocker = styled_components_default.div.attrs({
1192
- "data-splunk-visualization-version": "28.2.1 - b6faf8893"
1192
+ "data-splunk-visualization-version": "28.2.2 - b595a32f1"
1193
1193
  })`
1194
1194
  position: relative;
1195
1195
  width: 100%;
@@ -1228,14 +1228,18 @@ var FixSizeItem = styled_components_default.div.attrs(
1228
1228
  ({
1229
1229
  width,
1230
1230
  height
1231
- }) => ({
1232
- style: __spreadValues(__spreadValues({}, width && { width: (0, style_exports.toPx)(width) }), height && { height: (0, style_exports.toPx)(height) })
1233
- })
1231
+ }) => {
1232
+ const validHeight = typeof height === "number" ? Math.max(height, 1) : height;
1233
+ return {
1234
+ style: __spreadValues(__spreadValues({}, width && { width: (0, style_exports.toPx)(width) }), validHeight && { height: (0, style_exports.toPx)(validHeight) })
1235
+ };
1236
+ }
1234
1237
  )`
1235
1238
  position: relative;
1236
1239
  flex-direction: column;
1237
1240
  flex: 1;
1238
1241
  display: flex;
1242
+ overflow: hidden !important;
1239
1243
  background-color: ${(props) => (0, colorUtils_exports.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor}};
1240
1244
  `;
1241
1245
  var ItemContent = styled_components_default.div`
@@ -1248,6 +1252,7 @@ var FixSizeItemContent = styled_components_default.div`
1248
1252
  flex: 1;
1249
1253
  position: relative;
1250
1254
  box-sizing: border-box;
1255
+ overflow: hidden !important;
1251
1256
  `;
1252
1257
  var withFixedSizeContainer = (Viz) => {
1253
1258
  const FixedSizeContainer = (props) => {
@@ -1265,7 +1270,7 @@ var withFixedSizeContainer = (Viz) => {
1265
1270
  FixSizeItem,
1266
1271
  {
1267
1272
  "data-test": "fix-size-item",
1268
- "data-splunk-visualization-version": "28.2.1 - b6faf8893",
1273
+ "data-splunk-visualization-version": "28.2.2 - b595a32f1",
1269
1274
  width,
1270
1275
  height,
1271
1276
  backgroundColor
@@ -2467,12 +2472,14 @@ var Message_default2 = "default" in defaultImport39 ? defaultImport39.default :
2467
2472
  var isArray2 = (v) => Array.isArray(v);
2468
2473
  var textOverflowStyles = {
2469
2474
  anywhere: {
2470
- wordBreak: "break-all"
2475
+ wordBreak: "break-all",
2476
+ whiteSpace: "pre-wrap"
2471
2477
  },
2472
2478
  "break-word": {
2473
2479
  wordBreak: "break-word",
2474
2480
  wordWrap: "break-word",
2475
- overflowWrap: "break-word"
2481
+ overflowWrap: "break-word",
2482
+ whiteSpace: "pre-wrap"
2476
2483
  },
2477
2484
  ellipsis: {
2478
2485
  whiteSpace: "nowrap",
@@ -2480,12 +2487,34 @@ var textOverflowStyles = {
2480
2487
  textOverflow: "ellipsis"
2481
2488
  }
2482
2489
  };
2483
- var empty = {};
2484
2490
  var getOverflowStyles = ({ textOverflow }) => {
2485
- return textOverflowStyles[textOverflow] || empty;
2491
+ return textOverflowStyles[textOverflow] || textOverflowStyles["break-word"];
2486
2492
  };
2487
2493
  var generateKey = (i = "", value = "") => `${value}-${i}`;
2488
- var getTextOverflowType = (columnFormat, columnId, currentColumn) => getAttributeFromColumnFormat("textOverflow", columnFormat, columnId, currentColumn);
2494
+ var getTextOverflowType = (columnFormat, columnId, tableFormat, currentColumn, defaultValue = "break-word") => {
2495
+ const columnTextOverflow = getAttributeFromColumnFormat(
2496
+ "textOverflow",
2497
+ columnFormat,
2498
+ columnId,
2499
+ currentColumn
2500
+ );
2501
+ if (columnTextOverflow) {
2502
+ return columnTextOverflow;
2503
+ }
2504
+ return (tableFormat == null ? void 0 : tableFormat.textOverflow) || defaultValue;
2505
+ };
2506
+ var getTextOverflow = (columnFormat, columnId, tableFormat, currentColumn) => {
2507
+ const columnTextOverflow = getAttributeFromColumnFormat(
2508
+ "textOverflow",
2509
+ columnFormat,
2510
+ columnId,
2511
+ currentColumn
2512
+ );
2513
+ if (columnTextOverflow) {
2514
+ return columnTextOverflow;
2515
+ }
2516
+ return tableFormat == null ? void 0 : tableFormat.textOverflow;
2517
+ };
2489
2518
  var generateHeader = (value, columnId, i, columnFormat, tableFormat, showInternalFields) => {
2490
2519
  const ret = {
2491
2520
  key: generateKey(value, String(i)),
@@ -2499,14 +2528,12 @@ var generateHeader = (value, columnId, i, columnFormat, tableFormat, showInterna
2499
2528
  ret.showCell = false;
2500
2529
  }
2501
2530
  const headerAlign = getColumnFormatHeaderAlign(columnFormat, columnId, value) || getTableFormatHeaderAlign(tableFormat) || "left";
2502
- const textOverflowType = getTextOverflowType(columnFormat, columnId, value);
2503
- const textOverflowStyle = getOverflowStyles({
2504
- textOverflow: textOverflowType
2505
- });
2506
2531
  ret.align = headerAlign;
2507
2532
  ret.truncate = true;
2508
- ret.textOverflowType = textOverflowType;
2509
- ret.style = textOverflowStyle;
2533
+ const textOverflow = getTextOverflow(columnFormat, columnId, tableFormat, value);
2534
+ if (textOverflow) {
2535
+ ret.textOverflowType = textOverflow;
2536
+ }
2510
2537
  return ret;
2511
2538
  };
2512
2539
  var getColumnFormatAlign = (columnFormat, currentColumn, currentRow) => {
@@ -2872,6 +2899,7 @@ var useTable = (tableArgs = {}) => {
2872
2899
  const textOverflowType = getTextOverflowType(
2873
2900
  cfmt,
2874
2901
  cids[i],
2902
+ tfmt,
2875
2903
  currentHeader.value
2876
2904
  );
2877
2905
  const textOverflowStyle = getOverflowStyles({
@@ -2984,7 +3012,14 @@ var SwitchTableCell = ({ type, children }) => children.filter((child) => child.t
2984
3012
  // src/Table/cells/TextCell.tsx
2985
3013
  var noop4 = () => void 0;
2986
3014
  var TextCell = ({ cell, useMouseOverEffect }) => {
2987
- const cellStyle = react_exports.useMemo(() => __spreadValues({}, cell.style), [cell.style]);
3015
+ const { cellStyle, textStyle } = react_exports.useMemo(() => {
3016
+ const style = cell.style || {};
3017
+ const _a = style, { whiteSpace, overflow, textOverflow, wordBreak, wordWrap, overflowWrap } = _a, rest = __objRest(_a, ["whiteSpace", "overflow", "textOverflow", "wordBreak", "wordWrap", "overflowWrap"]);
3018
+ return {
3019
+ cellStyle: rest,
3020
+ textStyle: { whiteSpace, overflow, textOverflow, wordBreak, wordWrap, overflowWrap }
3021
+ };
3022
+ }, [cell.style]);
2988
3023
  return /* @__PURE__ */ react_exports.createElement(
2989
3024
  Table_default.Cell,
2990
3025
  {
@@ -2996,21 +3031,31 @@ var TextCell = ({ cell, useMouseOverEffect }) => {
2996
3031
  "data-col-index": cell.columnIndex,
2997
3032
  onClick: useMouseOverEffect ? noop4 : void 0
2998
3033
  },
2999
- cell.value.toString()
3034
+ /* @__PURE__ */ react_exports.createElement("span", { style: textStyle }, cell.value.toString())
3000
3035
  );
3001
3036
  };
3002
3037
  TextCell.displayName = "TextCell";
3003
3038
 
3004
3039
  // src/Table/cells/ArrayCell.tsx
3005
3040
  var StyledTableCell = styled_components_default(Table_default.Cell)`
3006
- div {
3041
+ & > div {
3007
3042
  flex-direction: column;
3008
3043
  }
3009
3044
  `;
3010
- var noop5 = () => void 0;
3045
+ var ArrayItemDiv = styled_components_default.div`
3046
+ min-width: 0;
3047
+ max-width: 100%;
3048
+ `;
3011
3049
  var ArrayCell = ({ cell, useMouseOverEffect }) => {
3012
3050
  const value = react_exports.useMemo(() => Array.isArray(cell.value) ? cell.value : [cell.value], [cell.value]);
3013
- const cellStyle = react_exports.useMemo(() => __spreadValues({}, cell.style), [cell.style]);
3051
+ const { cellStyle, itemStyle } = react_exports.useMemo(() => {
3052
+ const style = cell.style || {};
3053
+ const _a = style, { whiteSpace, overflow, textOverflow, wordBreak, wordWrap, overflowWrap } = _a, rest = __objRest(_a, ["whiteSpace", "overflow", "textOverflow", "wordBreak", "wordWrap", "overflowWrap"]);
3054
+ return {
3055
+ cellStyle: rest,
3056
+ itemStyle: { whiteSpace, overflow, textOverflow, wordBreak, wordWrap, overflowWrap }
3057
+ };
3058
+ }, [cell.style]);
3014
3059
  return /* @__PURE__ */ react_exports.createElement(
3015
3060
  StyledTableCell,
3016
3061
  {
@@ -3018,16 +3063,17 @@ var ArrayCell = ({ cell, useMouseOverEffect }) => {
3018
3063
  align: cell.align,
3019
3064
  "data-test-align-value": cell.align,
3020
3065
  "data-test-cell-type": "ArrayCell",
3021
- onClick: useMouseOverEffect ? noop5 : void 0
3066
+ onClick: useMouseOverEffect ? lodash_exports.noop : void 0
3022
3067
  },
3023
- value.map(
3068
+ value.filter((v) => v !== null).map(
3024
3069
  (v, i) => /* @__PURE__ */ react_exports.createElement(
3025
- "div",
3070
+ ArrayItemDiv,
3026
3071
  {
3027
- key: v.toString(),
3072
+ key: (0, id_exports.createDOMID)(),
3028
3073
  "data-row-index": cell.rowIndex,
3029
3074
  "data-col-index": cell.columnIndex,
3030
- "data-array-index": i
3075
+ "data-array-index": i,
3076
+ style: itemStyle
3031
3077
  },
3032
3078
  v.toString()
3033
3079
  )
@@ -3649,12 +3695,30 @@ var FixedTableHead = styled_components_default(Table_default.Head)`
3649
3695
  position: sticky;
3650
3696
  top: 0;
3651
3697
  `;
3652
- var TableHeadCell = styled_components_default(Table_default.HeadCell)`
3653
- button > span {
3698
+ var headerTextOverflowStyles = {
3699
+ ellipsis: `
3700
+ word-break: inherit;
3701
+ word-wrap: inherit;
3702
+ white-space: nowrap;
3703
+ display: inline;
3704
+ overflow: hidden;
3705
+ text-overflow: ellipsis;
3706
+ `,
3707
+ anywhere: `
3708
+ word-break: break-all;
3709
+ white-space: inherit;
3710
+ display: inline;
3711
+ `,
3712
+ default: `
3654
3713
  word-break: inherit;
3655
3714
  word-wrap: inherit;
3656
- white-space: ${(props) => props.textOverflowType === "ellipsis" ? "nowrap" : "inherit"};
3715
+ white-space: inherit;
3657
3716
  display: inline;
3717
+ `
3718
+ };
3719
+ var TableHeadCell = styled_components_default(Table_default.HeadCell)`
3720
+ button > span {
3721
+ ${(props) => headerTextOverflowStyles[props.textOverflowType] || headerTextOverflowStyles.default}
3658
3722
  }
3659
3723
  `;
3660
3724
  var VizTableContainer = styled_components_default.div`
@@ -3663,7 +3727,8 @@ var VizTableContainer = styled_components_default.div`
3663
3727
  background-color: ${(props) => (0, colorUtils_exports.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor};
3664
3728
  display: flex;
3665
3729
  flex-flow: column nowrap;
3666
- overflow: hidden;
3730
+ overflow: hidden !important;
3731
+ height: 100%;
3667
3732
 
3668
3733
  td,
3669
3734
  * > td:hover {
@@ -3694,14 +3759,16 @@ var SUITableContainer = styled_components_default.div`
3694
3759
  }
3695
3760
  box-sizing: border-box;
3696
3761
  flex-grow: 1;
3697
- overflow: hidden;
3762
+ overflow: auto;
3698
3763
 
3699
3764
  ${({ width, height, isPaging, theme }) => {
3700
3765
  const padding = variables_default.spacingSmall({ theme });
3701
3766
  const paddingOffset = parseInt(padding, 10) * 2;
3767
+ const calculatedHeight = isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset;
3768
+ const finalHeight = Math.max(calculatedHeight, 1);
3702
3769
  return (0, style_exports.toDimension)({
3703
3770
  width: width - paddingOffset,
3704
- height: isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset
3771
+ height: finalHeight
3705
3772
  });
3706
3773
  }};
3707
3774
 
@@ -3808,9 +3875,9 @@ var useTableHead = (visibility) => {
3808
3875
  return Table_default.Head;
3809
3876
  };
3810
3877
  var HeadCell = (_a) => {
3811
- var _b = _a, { value } = _b, props = __objRest(_b, ["value"]);
3878
+ var _b = _a, { value, textOverflowType } = _b, props = __objRest(_b, ["value", "textOverflowType"]);
3812
3879
  const cellRef = react_exports.useRef(null);
3813
- return /* @__PURE__ */ react_exports.createElement(TableHeadCell, __spreadValues({ elementRef: cellRef }, props), value);
3880
+ return /* @__PURE__ */ react_exports.createElement(TableHeadCell, __spreadValues({ elementRef: cellRef, textOverflowType }, props), value);
3814
3881
  };
3815
3882
  var fontMap = {
3816
3883
  proportional: "Splunk Platform Sans",
@@ -3862,7 +3929,7 @@ var PureTable = (props) => {
3862
3929
  firstRenderCount.current = count;
3863
3930
  paginatorOnChange(null, { count });
3864
3931
  }
3865
- }, [count, paginatorProps]);
3932
+ }, [count, paginatorOnChange, paginatorProps]);
3866
3933
  const stringifiedColumnFormat = JSON.stringify(columnFormat);
3867
3934
  const columnFormatRef = react_exports.useRef(stringifiedColumnFormat);
3868
3935
  const modeRef = react_exports.useRef(mode);
@@ -3872,7 +3939,7 @@ var PureTable = (props) => {
3872
3939
  modeRef.current = mode;
3873
3940
  setColumns(columnFormat);
3874
3941
  }
3875
- }, [mode, stringifiedColumnFormat]);
3942
+ }, [columnFormat, mode, stringifiedColumnFormat]);
3876
3943
  const TableHead = useTableHead(headerVisibility);
3877
3944
  const debouncedDrilldown = react_exports.useMemo(
3878
3945
  () => debounce_default((e, payload) => {
@@ -4078,6 +4145,7 @@ var PureTable = (props) => {
4078
4145
  onSort: showRowNumbers && value === "#" || isHeaderHidden ? null : onSortToUse,
4079
4146
  resizable: !isHeaderHidden,
4080
4147
  style: showRowNumbers && value === "#" ? __spreadProps(__spreadValues({}, style), { cursor: "auto" }) : style,
4148
+ textOverflowType,
4081
4149
  headerVisibility
4082
4150
  })
4083
4151
  );