@splunk/visualizations 28.2.0 → 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 (61) hide show
  1. package/Area.js +11 -12
  2. package/Area.js.map +2 -2
  3. package/Bar.js +11 -12
  4. package/Bar.js.map +2 -2
  5. package/Bubble.js +11 -12
  6. package/Bubble.js.map +2 -2
  7. package/CHANGELOG.external.md +36 -0
  8. package/ChoroplethSvg.js +11 -12
  9. package/ChoroplethSvg.js.map +2 -2
  10. package/Column.js +11 -12
  11. package/Column.js.map +2 -2
  12. package/Ellipse.js +11 -12
  13. package/Ellipse.js.map +2 -2
  14. package/Events.js +11 -12
  15. package/Events.js.map +2 -2
  16. package/FillerGauge.js +11 -12
  17. package/FillerGauge.js.map +2 -2
  18. package/Image.js +11 -12
  19. package/Image.js.map +2 -2
  20. package/Line.js +11 -12
  21. package/Line.js.map +2 -2
  22. package/LinkGraph.js +11 -12
  23. package/LinkGraph.js.map +2 -2
  24. package/Map.js +11 -12
  25. package/Map.js.map +2 -2
  26. package/Markdown.js +11 -12
  27. package/Markdown.js.map +2 -2
  28. package/MarkerGauge.js +11 -12
  29. package/MarkerGauge.js.map +2 -2
  30. package/ParallelCoordinates.js +11 -12
  31. package/ParallelCoordinates.js.map +2 -2
  32. package/Pie.js +11 -12
  33. package/Pie.js.map +2 -2
  34. package/Punchcard.js +11 -12
  35. package/Punchcard.js.map +2 -2
  36. package/Rectangle.js +11 -12
  37. package/Rectangle.js.map +2 -2
  38. package/Sankey.js +11 -12
  39. package/Sankey.js.map +2 -2
  40. package/Scatter.js +11 -12
  41. package/Scatter.js.map +2 -2
  42. package/SingleValue.js +11 -12
  43. package/SingleValue.js.map +2 -2
  44. package/SingleValueIcon.js +11 -12
  45. package/SingleValueIcon.js.map +2 -2
  46. package/SingleValueRadial.js +11 -12
  47. package/SingleValueRadial.js.map +2 -2
  48. package/Table.js +105 -43
  49. package/Table.js.map +3 -3
  50. package/Timeline.js +11 -12
  51. package/Timeline.js.map +2 -2
  52. package/common/withDashboardViz.js +11 -12
  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/components/IconPlaceholder.d.ts.map +1 -1
  60. package/dist/types/common/hocs/FixedSizeContainer.d.ts.map +1 -1
  61. 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.0 - 7eea200d8"
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.0 - 7eea200d8",
1273
+ "data-splunk-visualization-version": "28.2.2 - b595a32f1",
1269
1274
  width,
1270
1275
  height,
1271
1276
  backgroundColor
@@ -1294,12 +1299,6 @@ var IconPlaceholder = (props) => {
1294
1299
  iconColor,
1295
1300
  backgroundColor
1296
1301
  } = props;
1297
- const cachedHandleResize = react_exports.useCallback((w, h) => {
1298
- setContainerWidth(w);
1299
- setContainerHeight(h);
1300
- }, []);
1301
- const [containerWidth, setContainerWidth] = react_exports.useState(Number(width));
1302
- const [containerHeight, setContainerHeight] = react_exports.useState(Number(height));
1303
1302
  let content = /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, level: "warning", message: (0, i18n_exports._)("No DataSource Connected") });
1304
1303
  if (icon) {
1305
1304
  content = react_exports.createElement(icon, {
@@ -1316,7 +1315,7 @@ var IconPlaceholder = (props) => {
1316
1315
  "data-test": "icon-placeholder"
1317
1316
  });
1318
1317
  }
1319
- return /* @__PURE__ */ react_exports.createElement("div", { style: { width: containerWidth, height: containerHeight, background: backgroundColor } }, /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }), content);
1318
+ return /* @__PURE__ */ react_exports.createElement("div", { style: { width, height, background: backgroundColor } }, content);
1320
1319
  };
1321
1320
  var IconPlaceholder_default = FixedSizeContainer_default(IconPlaceholder);
1322
1321
 
@@ -2473,12 +2472,14 @@ var Message_default2 = "default" in defaultImport39 ? defaultImport39.default :
2473
2472
  var isArray2 = (v) => Array.isArray(v);
2474
2473
  var textOverflowStyles = {
2475
2474
  anywhere: {
2476
- wordBreak: "break-all"
2475
+ wordBreak: "break-all",
2476
+ whiteSpace: "pre-wrap"
2477
2477
  },
2478
2478
  "break-word": {
2479
2479
  wordBreak: "break-word",
2480
2480
  wordWrap: "break-word",
2481
- overflowWrap: "break-word"
2481
+ overflowWrap: "break-word",
2482
+ whiteSpace: "pre-wrap"
2482
2483
  },
2483
2484
  ellipsis: {
2484
2485
  whiteSpace: "nowrap",
@@ -2486,12 +2487,34 @@ var textOverflowStyles = {
2486
2487
  textOverflow: "ellipsis"
2487
2488
  }
2488
2489
  };
2489
- var empty = {};
2490
2490
  var getOverflowStyles = ({ textOverflow }) => {
2491
- return textOverflowStyles[textOverflow] || empty;
2491
+ return textOverflowStyles[textOverflow] || textOverflowStyles["break-word"];
2492
2492
  };
2493
2493
  var generateKey = (i = "", value = "") => `${value}-${i}`;
2494
- 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
+ };
2495
2518
  var generateHeader = (value, columnId, i, columnFormat, tableFormat, showInternalFields) => {
2496
2519
  const ret = {
2497
2520
  key: generateKey(value, String(i)),
@@ -2505,14 +2528,12 @@ var generateHeader = (value, columnId, i, columnFormat, tableFormat, showInterna
2505
2528
  ret.showCell = false;
2506
2529
  }
2507
2530
  const headerAlign = getColumnFormatHeaderAlign(columnFormat, columnId, value) || getTableFormatHeaderAlign(tableFormat) || "left";
2508
- const textOverflowType = getTextOverflowType(columnFormat, columnId, value);
2509
- const textOverflowStyle = getOverflowStyles({
2510
- textOverflow: textOverflowType
2511
- });
2512
2531
  ret.align = headerAlign;
2513
2532
  ret.truncate = true;
2514
- ret.textOverflowType = textOverflowType;
2515
- ret.style = textOverflowStyle;
2533
+ const textOverflow = getTextOverflow(columnFormat, columnId, tableFormat, value);
2534
+ if (textOverflow) {
2535
+ ret.textOverflowType = textOverflow;
2536
+ }
2516
2537
  return ret;
2517
2538
  };
2518
2539
  var getColumnFormatAlign = (columnFormat, currentColumn, currentRow) => {
@@ -2878,6 +2899,7 @@ var useTable = (tableArgs = {}) => {
2878
2899
  const textOverflowType = getTextOverflowType(
2879
2900
  cfmt,
2880
2901
  cids[i],
2902
+ tfmt,
2881
2903
  currentHeader.value
2882
2904
  );
2883
2905
  const textOverflowStyle = getOverflowStyles({
@@ -2990,7 +3012,14 @@ var SwitchTableCell = ({ type, children }) => children.filter((child) => child.t
2990
3012
  // src/Table/cells/TextCell.tsx
2991
3013
  var noop4 = () => void 0;
2992
3014
  var TextCell = ({ cell, useMouseOverEffect }) => {
2993
- 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]);
2994
3023
  return /* @__PURE__ */ react_exports.createElement(
2995
3024
  Table_default.Cell,
2996
3025
  {
@@ -3002,21 +3031,31 @@ var TextCell = ({ cell, useMouseOverEffect }) => {
3002
3031
  "data-col-index": cell.columnIndex,
3003
3032
  onClick: useMouseOverEffect ? noop4 : void 0
3004
3033
  },
3005
- cell.value.toString()
3034
+ /* @__PURE__ */ react_exports.createElement("span", { style: textStyle }, cell.value.toString())
3006
3035
  );
3007
3036
  };
3008
3037
  TextCell.displayName = "TextCell";
3009
3038
 
3010
3039
  // src/Table/cells/ArrayCell.tsx
3011
3040
  var StyledTableCell = styled_components_default(Table_default.Cell)`
3012
- div {
3041
+ & > div {
3013
3042
  flex-direction: column;
3014
3043
  }
3015
3044
  `;
3016
- var noop5 = () => void 0;
3045
+ var ArrayItemDiv = styled_components_default.div`
3046
+ min-width: 0;
3047
+ max-width: 100%;
3048
+ `;
3017
3049
  var ArrayCell = ({ cell, useMouseOverEffect }) => {
3018
3050
  const value = react_exports.useMemo(() => Array.isArray(cell.value) ? cell.value : [cell.value], [cell.value]);
3019
- 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]);
3020
3059
  return /* @__PURE__ */ react_exports.createElement(
3021
3060
  StyledTableCell,
3022
3061
  {
@@ -3024,16 +3063,17 @@ var ArrayCell = ({ cell, useMouseOverEffect }) => {
3024
3063
  align: cell.align,
3025
3064
  "data-test-align-value": cell.align,
3026
3065
  "data-test-cell-type": "ArrayCell",
3027
- onClick: useMouseOverEffect ? noop5 : void 0
3066
+ onClick: useMouseOverEffect ? lodash_exports.noop : void 0
3028
3067
  },
3029
- value.map(
3068
+ value.filter((v) => v !== null).map(
3030
3069
  (v, i) => /* @__PURE__ */ react_exports.createElement(
3031
- "div",
3070
+ ArrayItemDiv,
3032
3071
  {
3033
- key: v.toString(),
3072
+ key: (0, id_exports.createDOMID)(),
3034
3073
  "data-row-index": cell.rowIndex,
3035
3074
  "data-col-index": cell.columnIndex,
3036
- "data-array-index": i
3075
+ "data-array-index": i,
3076
+ style: itemStyle
3037
3077
  },
3038
3078
  v.toString()
3039
3079
  )
@@ -3655,12 +3695,30 @@ var FixedTableHead = styled_components_default(Table_default.Head)`
3655
3695
  position: sticky;
3656
3696
  top: 0;
3657
3697
  `;
3658
- var TableHeadCell = styled_components_default(Table_default.HeadCell)`
3659
- button > span {
3698
+ var headerTextOverflowStyles = {
3699
+ ellipsis: `
3660
3700
  word-break: inherit;
3661
3701
  word-wrap: inherit;
3662
- white-space: ${(props) => props.textOverflowType === "ellipsis" ? "nowrap" : "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;
3663
3710
  display: inline;
3711
+ `,
3712
+ default: `
3713
+ word-break: inherit;
3714
+ word-wrap: inherit;
3715
+ white-space: inherit;
3716
+ display: inline;
3717
+ `
3718
+ };
3719
+ var TableHeadCell = styled_components_default(Table_default.HeadCell)`
3720
+ button > span {
3721
+ ${(props) => headerTextOverflowStyles[props.textOverflowType] || headerTextOverflowStyles.default}
3664
3722
  }
3665
3723
  `;
3666
3724
  var VizTableContainer = styled_components_default.div`
@@ -3669,7 +3727,8 @@ var VizTableContainer = styled_components_default.div`
3669
3727
  background-color: ${(props) => (0, colorUtils_exports.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor};
3670
3728
  display: flex;
3671
3729
  flex-flow: column nowrap;
3672
- overflow: hidden;
3730
+ overflow: hidden !important;
3731
+ height: 100%;
3673
3732
 
3674
3733
  td,
3675
3734
  * > td:hover {
@@ -3700,14 +3759,16 @@ var SUITableContainer = styled_components_default.div`
3700
3759
  }
3701
3760
  box-sizing: border-box;
3702
3761
  flex-grow: 1;
3703
- overflow: hidden;
3762
+ overflow: auto;
3704
3763
 
3705
3764
  ${({ width, height, isPaging, theme }) => {
3706
3765
  const padding = variables_default.spacingSmall({ theme });
3707
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);
3708
3769
  return (0, style_exports.toDimension)({
3709
3770
  width: width - paddingOffset,
3710
- height: isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset
3771
+ height: finalHeight
3711
3772
  });
3712
3773
  }};
3713
3774
 
@@ -3814,9 +3875,9 @@ var useTableHead = (visibility) => {
3814
3875
  return Table_default.Head;
3815
3876
  };
3816
3877
  var HeadCell = (_a) => {
3817
- var _b = _a, { value } = _b, props = __objRest(_b, ["value"]);
3878
+ var _b = _a, { value, textOverflowType } = _b, props = __objRest(_b, ["value", "textOverflowType"]);
3818
3879
  const cellRef = react_exports.useRef(null);
3819
- return /* @__PURE__ */ react_exports.createElement(TableHeadCell, __spreadValues({ elementRef: cellRef }, props), value);
3880
+ return /* @__PURE__ */ react_exports.createElement(TableHeadCell, __spreadValues({ elementRef: cellRef, textOverflowType }, props), value);
3820
3881
  };
3821
3882
  var fontMap = {
3822
3883
  proportional: "Splunk Platform Sans",
@@ -3868,7 +3929,7 @@ var PureTable = (props) => {
3868
3929
  firstRenderCount.current = count;
3869
3930
  paginatorOnChange(null, { count });
3870
3931
  }
3871
- }, [count, paginatorProps]);
3932
+ }, [count, paginatorOnChange, paginatorProps]);
3872
3933
  const stringifiedColumnFormat = JSON.stringify(columnFormat);
3873
3934
  const columnFormatRef = react_exports.useRef(stringifiedColumnFormat);
3874
3935
  const modeRef = react_exports.useRef(mode);
@@ -3878,7 +3939,7 @@ var PureTable = (props) => {
3878
3939
  modeRef.current = mode;
3879
3940
  setColumns(columnFormat);
3880
3941
  }
3881
- }, [mode, stringifiedColumnFormat]);
3942
+ }, [columnFormat, mode, stringifiedColumnFormat]);
3882
3943
  const TableHead = useTableHead(headerVisibility);
3883
3944
  const debouncedDrilldown = react_exports.useMemo(
3884
3945
  () => debounce_default((e, payload) => {
@@ -4084,6 +4145,7 @@ var PureTable = (props) => {
4084
4145
  onSort: showRowNumbers && value === "#" || isHeaderHidden ? null : onSortToUse,
4085
4146
  resizable: !isHeaderHidden,
4086
4147
  style: showRowNumbers && value === "#" ? __spreadProps(__spreadValues({}, style), { cursor: "auto" }) : style,
4148
+ textOverflowType,
4087
4149
  headerVisibility
4088
4150
  })
4089
4151
  );