@splunk/visualizations 28.0.0 → 28.1.0

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 (63) hide show
  1. package/Area.js +3 -3
  2. package/Area.js.map +2 -2
  3. package/Bar.js +3 -3
  4. package/Bar.js.map +2 -2
  5. package/Bubble.js +3 -3
  6. package/Bubble.js.map +2 -2
  7. package/CHANGELOG.external.md +30 -2
  8. package/ChoroplethSvg.js +15 -11
  9. package/ChoroplethSvg.js.map +2 -2
  10. package/Column.js +3 -3
  11. package/Column.js.map +2 -2
  12. package/Ellipse.js +3 -3
  13. package/Ellipse.js.map +2 -2
  14. package/Events.js +3 -3
  15. package/Events.js.map +2 -2
  16. package/FillerGauge.config.js +124 -3
  17. package/FillerGauge.config.js.map +3 -3
  18. package/FillerGauge.js +816 -75
  19. package/FillerGauge.js.map +4 -4
  20. package/Image.js +3 -3
  21. package/Image.js.map +2 -2
  22. package/Line.js +3 -3
  23. package/Line.js.map +2 -2
  24. package/LinkGraph.js +4 -4
  25. package/LinkGraph.js.map +2 -2
  26. package/Map.config.js +47 -3
  27. package/Map.config.js.map +2 -2
  28. package/Map.js +50 -6
  29. package/Map.js.map +2 -2
  30. package/Markdown.js +7 -4
  31. package/Markdown.js.map +2 -2
  32. package/MarkerGauge.js +3 -3
  33. package/MarkerGauge.js.map +2 -2
  34. package/ParallelCoordinates.js +3 -3
  35. package/ParallelCoordinates.js.map +2 -2
  36. package/Pie.js +3 -3
  37. package/Pie.js.map +2 -2
  38. package/Punchcard.js +3 -3
  39. package/Punchcard.js.map +2 -2
  40. package/Rectangle.js +3 -3
  41. package/Rectangle.js.map +2 -2
  42. package/Sankey.js +3 -3
  43. package/Sankey.js.map +2 -2
  44. package/Scatter.js +3 -3
  45. package/Scatter.js.map +2 -2
  46. package/SingleValue.js +5 -3
  47. package/SingleValue.js.map +2 -2
  48. package/SingleValueIcon.js +3 -3
  49. package/SingleValueIcon.js.map +2 -2
  50. package/SingleValueRadial.js +3 -3
  51. package/SingleValueRadial.js.map +2 -2
  52. package/TRELLIS.md +2 -2
  53. package/Table.config.js +22 -1
  54. package/Table.config.js.map +2 -2
  55. package/Table.js +233 -59
  56. package/Table.js.map +4 -4
  57. package/Timeline.js +66 -26
  58. package/Timeline.js.map +2 -2
  59. package/common/utils/tableUtils.js +59 -0
  60. package/common/utils/tableUtils.js.map +7 -0
  61. package/common/withDashboardViz.js +3 -3
  62. package/common/withDashboardViz.js.map +2 -2
  63. package/package.json +25 -25
package/FillerGauge.js CHANGED
@@ -306,6 +306,110 @@ var defaultBackgroundColor = (props) => pick_default({
306
306
  prisma: variables_default.backgroundColorSection(props)
307
307
  })(props);
308
308
 
309
+ // src/common/editorConfig/TrellisEditors.ts
310
+ var isTrellisFeatureFlagOn = ({ featureFlags }) => {
311
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
312
+ };
313
+ var isTrellisEnabled = ({ options, featureFlags }) => {
314
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
315
+ return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
316
+ };
317
+ var TrellisEditorConfig = [
318
+ [
319
+ {
320
+ label: (0, i18n_exports._)("Trellis layout"),
321
+ option: "splitByLayout",
322
+ editor: "editor.toggle",
323
+ showEditor: isTrellisFeatureFlagOn
324
+ }
325
+ ],
326
+ [
327
+ {
328
+ label: (0, i18n_exports._)("Split by"),
329
+ option: "trellisSplitBy",
330
+ editor: "editor.trellisSplitBy",
331
+ editorProps: {
332
+ dataSourceKey: "primary"
333
+ },
334
+ showEditor: isTrellisEnabled
335
+ }
336
+ ],
337
+ [
338
+ {
339
+ label: (0, i18n_exports._)("Number of columns"),
340
+ option: "trellisColumns",
341
+ editor: "editor.number",
342
+ editorProps: {
343
+ min: 1
344
+ },
345
+ showEditor: isTrellisEnabled
346
+ }
347
+ ],
348
+ [
349
+ {
350
+ label: (0, i18n_exports._)("Min column width"),
351
+ option: "trellisMinColumnWidth",
352
+ editor: "editor.number",
353
+ editorProps: {
354
+ min: 1
355
+ },
356
+ showEditor: isTrellisEnabled
357
+ },
358
+ {
359
+ label: (0, i18n_exports._)("Row height"),
360
+ option: "trellisRowHeight",
361
+ editor: "editor.number",
362
+ editorProps: {
363
+ min: 1
364
+ },
365
+ showEditor: isTrellisEnabled
366
+ }
367
+ ],
368
+ [
369
+ {
370
+ label: (0, i18n_exports._)("Max number of components per page"),
371
+ option: "trellisPageCount",
372
+ editor: "editor.number",
373
+ editorProps: {
374
+ min: 1
375
+ },
376
+ showEditor: isTrellisEnabled
377
+ }
378
+ ]
379
+ ];
380
+ var TimechartTrellisEditorConfig = [
381
+ [
382
+ {
383
+ label: (0, i18n_exports._)("Trellis layout"),
384
+ option: "splitByLayout",
385
+ editor: "editor.toggle",
386
+ showEditor: isTrellisFeatureFlagOn,
387
+ // add help text for timecharts
388
+ editorProps: {
389
+ help: (0, i18n_exports._)(
390
+ "Y2-axis and overlay field configurations are not supported when trellis is enabled."
391
+ ),
392
+ helpFormat: "under"
393
+ }
394
+ }
395
+ ],
396
+ ...TrellisEditorConfig.slice(1),
397
+ [
398
+ {
399
+ label: (0, i18n_exports._)("Shared y-axis scale"),
400
+ option: "trellisSharedScale",
401
+ editor: "editor.checkbox",
402
+ showEditor: isTrellisEnabled
403
+ }
404
+ ]
405
+ ];
406
+ var TrellisBackgroundColorEditor = {
407
+ label: (0, i18n_exports._)("Trellis background"),
408
+ option: "trellisBackgroundColor",
409
+ editor: "editor.color",
410
+ showEditor: isTrellisEnabled
411
+ };
412
+
309
413
  // src/FillerGauge/config.ts
310
414
  var dataContract = {
311
415
  requiredDataSources: [
@@ -356,6 +460,13 @@ var themes = {
356
460
  valueMarkerLabelFillColor: (props) => pick_default({
357
461
  light: variables_default.gray96(props),
358
462
  dark: variables_default.black(props)
463
+ })(props),
464
+ defaultFontColor: (props) => pick_default({
465
+ enterprise: {
466
+ dark: variables_default.textColor(props),
467
+ light: variables_default.textColor(props)
468
+ },
469
+ prisma: variables_default.contentColorDefault(props)
359
470
  })(props)
360
471
  };
361
472
  var basePresetContext = {
@@ -415,7 +526,10 @@ var editorConfig = [
415
526
  ]
416
527
  ]
417
528
  },
418
- Gauge_default,
529
+ {
530
+ label: Gauge_default.label,
531
+ layout: [...Gauge_default.layout, ...TrellisEditorConfig]
532
+ },
419
533
  {
420
534
  label: (0, i18n_exports._)("Color and style"),
421
535
  layout: [
@@ -446,7 +560,14 @@ var editorConfig = [
446
560
  }
447
561
  })
448
562
  ],
449
- BackgroundColor_default({ themes })
563
+ BackgroundColor_default({ themes }),
564
+ [
565
+ __spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
566
+ editorProps: {
567
+ themes
568
+ }
569
+ })
570
+ ]
450
571
  ]
451
572
  }
452
573
  ];
@@ -470,7 +591,7 @@ var config = {
470
591
  defaultContext,
471
592
  optionsSchema: visualization_schemas_exports.fillerGaugeOptionsSchema,
472
593
  editorConfig,
473
- supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */],
594
+ supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "trellis" /* TRELLIS */],
474
595
  themes
475
596
  };
476
597
  var config_default = enhanceConfig(config);
@@ -879,7 +1000,7 @@ var withFixedSizeContainer = (Viz) => {
879
1000
  FixSizeItem,
880
1001
  {
881
1002
  "data-test": "fix-size-item",
882
- "data-splunk-visualization-version": "28.0.0 - 0c5f07712",
1003
+ "data-splunk-visualization-version": "28.1.0 - 4a1bff08b",
883
1004
  width,
884
1005
  height,
885
1006
  backgroundColor
@@ -945,7 +1066,7 @@ var Cover = styled_components_default.div`
945
1066
  bottom: 0;
946
1067
  `;
947
1068
  var Blocker = styled_components_default.div.attrs({
948
- "data-splunk-visualization-version": "28.0.0 - 0c5f07712"
1069
+ "data-splunk-visualization-version": "28.1.0 - 4a1bff08b"
949
1070
  })`
950
1071
  position: relative;
951
1072
  width: 100%;
@@ -1447,6 +1568,309 @@ __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisU
1447
1568
  var trellisUtils_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
1448
1569
 
1449
1570
  // src/common/utils/trellisUtils.ts
1571
+ var AGGREGATIONS = "aggregations";
1572
+ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
1573
+ var _a, _b, _c, _d;
1574
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1575
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1576
+ let splitDataSources = null;
1577
+ let errorCode = null;
1578
+ if (fields && fields.length) {
1579
+ splitDataSources = {};
1580
+ for (let i = 0; i < fields.length; i += 1) {
1581
+ const fieldName = fields[i].name;
1582
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
1583
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
1584
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1585
+ );
1586
+ splitDataSources[fieldName].primary.data.fields = [fields[i]];
1587
+ splitDataSources[fieldName].primary.data.columns = [columns[i]];
1588
+ }
1589
+ }
1590
+ } else {
1591
+ errorCode = "INVALID_SPLIT_BY_FIELD";
1592
+ }
1593
+ return { splitDataSources, errorCode };
1594
+ };
1595
+ var toFieldEntries = (fields) => {
1596
+ return fields.map((field) => {
1597
+ if (typeof field === "string") {
1598
+ return { name: field };
1599
+ }
1600
+ return field;
1601
+ });
1602
+ };
1603
+ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
1604
+ var _a, _b, _c, _d;
1605
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
1606
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1607
+ let splitDataSources = null;
1608
+ let splitByFields = [];
1609
+ let errorCode = null;
1610
+ if (typeof fields[0] !== "string") {
1611
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
1612
+ }
1613
+ if (splitByFields && splitByFields.length > 0) {
1614
+ splitDataSources = {};
1615
+ splitByFields.forEach((splitByField) => {
1616
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
1617
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1618
+ );
1619
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
1620
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
1621
+ fields.forEach((field, idx) => {
1622
+ const fieldName = field == null ? void 0 : field.name;
1623
+ if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
1624
+ splitDataSources[splitByField].primary.data.fields.push(field);
1625
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
1626
+ }
1627
+ });
1628
+ });
1629
+ } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
1630
+ splitDataSources = {};
1631
+ for (let i = 1; i < fields.length; i += 1) {
1632
+ const fieldName = fields[i].name;
1633
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
1634
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
1635
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1636
+ );
1637
+ splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
1638
+ splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
1639
+ }
1640
+ }
1641
+ } else {
1642
+ errorCode = "INVALID_SPLIT_BY_FIELD";
1643
+ }
1644
+ return { splitDataSources, errorCode };
1645
+ };
1646
+ var dataSourcesSplitByAggregationsStats = (dataSource) => {
1647
+ var _a, _b, _c, _d;
1648
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1649
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1650
+ let splitDataSources = null;
1651
+ let splitByFields = [];
1652
+ let errorCode = null;
1653
+ if (typeof fields[0] !== "string") {
1654
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
1655
+ }
1656
+ if (splitByFields && splitByFields.length > 0) {
1657
+ splitDataSources = {};
1658
+ splitByFields.forEach((splitByField) => {
1659
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
1660
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1661
+ );
1662
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
1663
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
1664
+ const idx = fields.findIndex((field) => field.name === splitByField);
1665
+ if (idx > 0) {
1666
+ splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
1667
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
1668
+ }
1669
+ });
1670
+ } else {
1671
+ errorCode = "INVALID_SPLIT_BY_FIELD";
1672
+ }
1673
+ return { splitDataSources, errorCode };
1674
+ };
1675
+ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
1676
+ var _a, _b, _c, _d, _e;
1677
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1678
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1679
+ let splitDataSources = null;
1680
+ let splitByFields = [];
1681
+ let errorCode = null;
1682
+ if (typeof fields[0] !== "string") {
1683
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
1684
+ }
1685
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
1686
+ splitDataSources = {};
1687
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
1688
+ const valueKeys = [];
1689
+ for (let i = 1; i < fields.length; i += 1) {
1690
+ if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
1691
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
1692
+ }
1693
+ }
1694
+ valueKeys.forEach((val) => {
1695
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
1696
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1697
+ );
1698
+ splitDataSources[val].primary.data.fields = [
1699
+ { name: fields[0].name },
1700
+ ...dataSourceKeys.map((k) => ({
1701
+ name: k
1702
+ }))
1703
+ ];
1704
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
1705
+ dataSourceKeys.forEach((dsKey) => {
1706
+ fields.forEach((field, idx) => {
1707
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
1708
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
1709
+ }
1710
+ });
1711
+ });
1712
+ });
1713
+ } else {
1714
+ errorCode = "INVALID_SPLIT_BY_FIELD";
1715
+ }
1716
+ return { splitDataSources, errorCode };
1717
+ };
1718
+ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
1719
+ var _a, _b, _c, _d;
1720
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1721
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1722
+ let splitDataSources = null;
1723
+ let splitByFields = [];
1724
+ let errorCode = null;
1725
+ if (typeof fields[0] !== "string") {
1726
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
1727
+ }
1728
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
1729
+ splitDataSources = {};
1730
+ const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
1731
+ const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
1732
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
1733
+ const nonDataSourceAggregations = [];
1734
+ if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
1735
+ for (let i = 1; i < fields.length; i += 1) {
1736
+ nonDataSourceAggregations.push(fields[i].name);
1737
+ }
1738
+ }
1739
+ if (splitByFieldIdx === 0) {
1740
+ const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
1741
+ valueKeys.forEach((val, idx) => {
1742
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
1743
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1744
+ );
1745
+ splitDataSources[val].primary.data.fields = [];
1746
+ if (otherSplitBy.length) {
1747
+ splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
1748
+ }
1749
+ if (dataSourceKeys.length) {
1750
+ const columnValues = [[]];
1751
+ splitDataSources[val].primary.data.fields = [
1752
+ ...splitDataSources[val].primary.data.fields,
1753
+ ...dataSourceKeys.map((k) => ({
1754
+ name: k
1755
+ }))
1756
+ ];
1757
+ dataSourceKeys.forEach(() => {
1758
+ columnValues.push([]);
1759
+ });
1760
+ for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
1761
+ columnValues[0].push(
1762
+ fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
1763
+ );
1764
+ dataSourceKeys.forEach((dskey, dsIndx) => {
1765
+ const mul = (fields.length - 1) / dataSourceKeys.length;
1766
+ columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
1767
+ });
1768
+ }
1769
+ splitDataSources[val].primary.data.columns = columnValues;
1770
+ } else if (nonDataSourceAggregations.length) {
1771
+ const columnValues = [];
1772
+ fields.forEach((aggregationField, fieldIdx) => {
1773
+ if (fieldIdx > 0) {
1774
+ splitDataSources[val].primary.data.fields.push(aggregationField);
1775
+ columnValues.push([columns[fieldIdx][idx]]);
1776
+ }
1777
+ });
1778
+ splitDataSources[val].primary.data.columns = columnValues;
1779
+ }
1780
+ });
1781
+ } else {
1782
+ const valueKeys = [];
1783
+ for (let i = 1; i < fields.length; i += 1) {
1784
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
1785
+ }
1786
+ valueKeys.forEach((val) => {
1787
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
1788
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1789
+ );
1790
+ splitDataSources[val].primary.data.fields = [
1791
+ { name: otherSplitBy[0] },
1792
+ ...dataSourceKeys.map((k) => ({
1793
+ name: k
1794
+ }))
1795
+ ];
1796
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
1797
+ dataSourceKeys.forEach((dsKey) => {
1798
+ fields.forEach((field, idx) => {
1799
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
1800
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
1801
+ }
1802
+ });
1803
+ });
1804
+ });
1805
+ }
1806
+ } else {
1807
+ errorCode = "INVALID_SPLIT_BY_FIELD";
1808
+ }
1809
+ return { splitDataSources, errorCode };
1810
+ };
1811
+ var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
1812
+ var _a, _b, _c, _d, _e, _f;
1813
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1814
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1815
+ let splitDataSources = null;
1816
+ let splitByFields = [];
1817
+ let errorCode = null;
1818
+ if (typeof fields[0] !== "string") {
1819
+ splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
1820
+ }
1821
+ const splitByIndex = fields == null ? void 0 : fields.findIndex(
1822
+ (field) => field === splitBy || field.name === splitBy
1823
+ );
1824
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
1825
+ const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
1826
+ splitDataSources = {};
1827
+ splitByColumn.forEach((val, idx) => {
1828
+ if (!splitDataSources[val]) {
1829
+ splitDataSources[val] = [idx];
1830
+ } else {
1831
+ splitDataSources[val].push(idx);
1832
+ }
1833
+ });
1834
+ const cloneFields = (0, lodash_exports.cloneDeep)(fields);
1835
+ cloneFields.splice(splitByIndex, 1);
1836
+ const valueKeys = Object.keys(splitDataSources);
1837
+ valueKeys.forEach((val) => {
1838
+ const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
1839
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
1840
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1841
+ );
1842
+ splitDataSources[val].primary.data.fields = cloneFields;
1843
+ splitDataSources[val].primary.data.columns = [];
1844
+ columns.forEach((col, idx) => {
1845
+ if (idx !== splitByIndex) {
1846
+ const newCol = valIndices.map((valIdx) => col[valIdx]);
1847
+ splitDataSources[val].primary.data.columns.push(newCol);
1848
+ }
1849
+ });
1850
+ });
1851
+ } else {
1852
+ errorCode = "INVALID_SPLIT_BY_FIELD";
1853
+ }
1854
+ return { splitDataSources, errorCode };
1855
+ };
1856
+ var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
1857
+ let result = null;
1858
+ try {
1859
+ if (splitMode === trellisUtils_exports.TIMECHART) {
1860
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
1861
+ } else if (splitMode === trellisUtils_exports.STATS) {
1862
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
1863
+ } else if (splitMode === trellisUtils_exports.CHART) {
1864
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
1865
+ } else if (splitMode === trellisUtils_exports.UNKNOWN) {
1866
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
1867
+ }
1868
+ } catch (ex) {
1869
+ console.error("getTrellisDataSourcesBySplitMode ", ex);
1870
+ result = { splitDataSources: null, errorCode: "UNKNOWN" };
1871
+ }
1872
+ return result;
1873
+ };
1450
1874
  var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
1451
1875
  if (isTrellisOn && !options.legendDisplay) {
1452
1876
  return {
@@ -1455,6 +1879,36 @@ var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
1455
1879
  }
1456
1880
  return {};
1457
1881
  };
1882
+ var calculateSharedMinMax = (splitData) => {
1883
+ let max = -Infinity;
1884
+ let min = Infinity;
1885
+ Object.keys(splitData).forEach((splitByKey) => {
1886
+ const datasources = splitData[splitByKey];
1887
+ Object.keys(datasources).forEach((datasourceName) => {
1888
+ const dataColumns = datasources[datasourceName].data.columns;
1889
+ dataColumns.forEach((column) => {
1890
+ column.forEach((point) => {
1891
+ const pointNumber = Number(point);
1892
+ if (pointNumber > max) {
1893
+ max = pointNumber;
1894
+ }
1895
+ if (pointNumber < min) {
1896
+ min = pointNumber;
1897
+ }
1898
+ });
1899
+ });
1900
+ });
1901
+ });
1902
+ return [min, max];
1903
+ };
1904
+ var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
1905
+ if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
1906
+ return [yAxisMin, yAxisMax];
1907
+ const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
1908
+ const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
1909
+ const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
1910
+ return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
1911
+ };
1458
1912
 
1459
1913
  // src/common/withDashboardViz.tsx
1460
1914
  var withDashboardViz = (opts) => {
@@ -1514,10 +1968,10 @@ var withDashboardViz = (opts) => {
1514
1968
  const isDownsamplingEnabledByFeatureFlag = Boolean(
1515
1969
  featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
1516
1970
  );
1517
- const isTrellisFeatureFlagOn = Boolean(
1971
+ const isTrellisFeatureFlagOn2 = Boolean(
1518
1972
  featureFlagContext && featureFlagContext.visualizations_enableTrellis
1519
1973
  );
1520
- const isTrellisOn = isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
1974
+ const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
1521
1975
  const isMounted = react_exports.useRef(true);
1522
1976
  const optionsToEvaluate = react_exports.useMemo(() => {
1523
1977
  var _a2;
@@ -1659,7 +2113,7 @@ var withDashboardViz = (opts) => {
1659
2113
  }
1660
2114
  eventCallbackProps[eventCallbackPropName] = (ev) => {
1661
2115
  if (ev && ev.payload) {
1662
- payload = ev.payload;
2116
+ payload = __spreadValues({}, ev.payload);
1663
2117
  }
1664
2118
  return onEventTrigger({
1665
2119
  originalEvent: ev,
@@ -2249,6 +2703,48 @@ ValueMarker.defaultProps = {
2249
2703
  };
2250
2704
  var GaugeValueMarker_default = ValueMarker;
2251
2705
 
2706
+ // src/common/hooks/useTrellisEnabled.ts
2707
+ var useTrellisFeatureFlagOn = () => {
2708
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
2709
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
2710
+ };
2711
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
2712
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
2713
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
2714
+ };
2715
+
2716
+ // src/common/components/TrellisTitle.tsx
2717
+ var TRELLIS_TITLE_HEIGHT = 28;
2718
+ var TrellisTitleText = styled_components_default.div`
2719
+ margin-left: 10px;
2720
+ margin-right: 10px;
2721
+ padding-top: 8px;
2722
+ text-overflow: ellipsis;
2723
+ white-space: nowrap;
2724
+ overflow: hidden;
2725
+ `;
2726
+ var TrellisTitleDiv = styled_components_default.div`
2727
+ height: ${TRELLIS_TITLE_HEIGHT}px;
2728
+ font-size: 14px;
2729
+ font-weight: 700;
2730
+ color: ${(props) => props.fontColor};
2731
+ background-color: ${(props) => props.backgroundColor};
2732
+ box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
2733
+ `;
2734
+ var TrellisTitle = (props) => {
2735
+ const titleText = String(props.trellisKey).toString();
2736
+ return /* @__PURE__ */ react_exports.createElement(
2737
+ TrellisTitleDiv,
2738
+ {
2739
+ fontColor: props.fontColor,
2740
+ backgroundColor: props.backgroundColor,
2741
+ "data-test": "trellis-title",
2742
+ title: titleText
2743
+ },
2744
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
2745
+ );
2746
+ };
2747
+
2252
2748
  // src/FillerGauge/PureFillerGauge/FillerGauge.tsx
2253
2749
  var Container = styled_components_default.div`
2254
2750
  overflow: hidden;
@@ -2286,25 +2782,29 @@ var MIN_HORIZONTAL_CONTAINER_HEIGHT = 100;
2286
2782
  var FillerGauge = (_a) => {
2287
2783
  var props = __objRest(_a, []);
2288
2784
  const {
2289
- width,
2290
- height,
2785
+ width = "100%",
2786
+ height = 250,
2291
2787
  value,
2292
2788
  gaugeColor,
2293
- min,
2294
- max,
2295
- orientation,
2296
- majorUnit,
2297
- showLabels,
2298
- showValue,
2299
- usePercentageRange,
2300
- usePercentageValue,
2301
- backgroundColor,
2302
- backgroundBarFillColor,
2303
- majorTickFillColor,
2304
- majorTickStrokeColor,
2305
- valueMarkerFillColor,
2306
- valueMarkerLabelFillColor
2789
+ min = 0,
2790
+ max = 100,
2791
+ orientation = "vertical",
2792
+ majorUnit = "auto",
2793
+ showLabels = true,
2794
+ showValue = true,
2795
+ usePercentageRange = false,
2796
+ usePercentageValue = false,
2797
+ backgroundColor = "transparent",
2798
+ backgroundBarFillColor = "#f2f4f5",
2799
+ majorTickFillColor = "#3c444d",
2800
+ majorTickStrokeColor = "#6b7785",
2801
+ valueMarkerFillColor = "#3c444d",
2802
+ valueMarkerLabelFillColor = "#f2f4f5",
2803
+ splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off,
2804
+ defaultFontColor = "#000",
2805
+ trellisKey = ""
2307
2806
  } = props;
2807
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
2308
2808
  const cachedHandleResize = react_exports.useCallback((w, h) => {
2309
2809
  setContainerWidth(w);
2310
2810
  setContainerHeight(h);
@@ -2420,54 +2920,292 @@ var FillerGauge = (_a) => {
2420
2920
  )
2421
2921
  ));
2422
2922
  };
2923
+ if (trellisEnabled) {
2924
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, /* @__PURE__ */ react_exports.createElement(
2925
+ TrellisTitle,
2926
+ {
2927
+ fontColor: defaultFontColor,
2928
+ backgroundColor,
2929
+ trellisKey
2930
+ }
2931
+ ), /* @__PURE__ */ react_exports.createElement(
2932
+ Container,
2933
+ {
2934
+ width,
2935
+ height: Number(height) - TRELLIS_TITLE_HEIGHT,
2936
+ backgroundColor
2937
+ },
2938
+ /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
2939
+ renderVisualization()
2940
+ ));
2941
+ }
2423
2942
  return /* @__PURE__ */ react_exports.createElement(Container, { width, height, backgroundColor }, /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }), renderVisualization());
2424
2943
  };
2425
- var propTypes3 = {
2426
- width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
2427
- height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
2428
- value: prop_types_exports.number,
2429
- gaugeColor: prop_types_exports.string,
2430
- min: prop_types_exports.number,
2431
- max: prop_types_exports.number,
2432
- // valueFieldName: T.string, // todo: need add it back when displaying name later
2433
- // gaugeColorFieldName: T.string, // todo: may need add it back may not
2434
- orientation: prop_types_exports.oneOf(["horizontal", "vertical"]),
2435
- majorUnit: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
2436
- showLabels: prop_types_exports.bool,
2437
- showValue: prop_types_exports.bool,
2438
- usePercentageRange: prop_types_exports.bool,
2439
- usePercentageValue: prop_types_exports.bool,
2440
- backgroundColor: prop_types_exports.string,
2441
- backgroundBarFillColor: prop_types_exports.string,
2442
- majorTickFillColor: prop_types_exports.string,
2443
- majorTickStrokeColor: prop_types_exports.string,
2444
- valueMarkerFillColor: prop_types_exports.string,
2445
- valueMarkerLabelFillColor: prop_types_exports.string
2446
- };
2447
- var defaultProps = {
2448
- width: "100%",
2449
- height: 250,
2450
- value: void 0,
2451
- gaugeColor: void 0,
2452
- orientation: "vertical",
2453
- min: 0,
2454
- max: 100,
2455
- majorUnit: "auto",
2456
- showLabels: true,
2457
- showValue: true,
2458
- usePercentageRange: false,
2459
- usePercentageValue: false,
2460
- backgroundColor: "transparent",
2461
- backgroundBarFillColor: "#f2f4f5",
2462
- majorTickFillColor: "#3c444d",
2463
- majorTickStrokeColor: "#6b7785",
2464
- valueMarkerFillColor: "#3c444d",
2465
- valueMarkerLabelFillColor: "#f2f4f5"
2466
- };
2467
- FillerGauge.propTypes = propTypes3;
2468
- FillerGauge.defaultProps = defaultProps;
2469
2944
  var FillerGauge_default = FillerGauge;
2470
2945
 
2946
+ // esm-externals:@splunk/react-ui/Paginator
2947
+ var Paginator_exports = {};
2948
+ __export(Paginator_exports, {
2949
+ default: () => Paginator_default
2950
+ });
2951
+ var defaultImport33 = __toESM(require("@splunk/react-ui/Paginator"));
2952
+ __reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
2953
+ var Paginator_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
2954
+
2955
+ // esm-externals:@splunk/themes
2956
+ var themes_exports = {};
2957
+ __export(themes_exports, {
2958
+ default: () => themes_default
2959
+ });
2960
+ var defaultImport34 = __toESM(require("@splunk/themes"));
2961
+ __reExport(themes_exports, require("@splunk/themes"));
2962
+ var themes_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
2963
+
2964
+ // esm-externals:@splunk/themes/useSplunkTheme
2965
+ var useSplunkTheme_exports = {};
2966
+ __export(useSplunkTheme_exports, {
2967
+ default: () => useSplunkTheme_default
2968
+ });
2969
+ var defaultImport35 = __toESM(require("@splunk/themes/useSplunkTheme"));
2970
+ __reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
2971
+ var useSplunkTheme_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
2972
+
2973
+ // src/common/hocs/withTrellis.tsx
2974
+ var TrellisContainer = styled_components_default.div`
2975
+ overflow: hidden;
2976
+ display: flex;
2977
+ flex-direction: column;
2978
+ background-color: ${(props) => props.backgroundColor};
2979
+ ${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
2980
+ > [data-test='paginator'] {
2981
+ align-self: flex-end;
2982
+ margin-bottom: 10px;
2983
+ }
2984
+ `;
2985
+ var TrellisContainerGrid = styled_components_default.div`
2986
+ display: grid;
2987
+ height: ${(props) => {
2988
+ return `${props.height}px`;
2989
+ }};
2990
+ gap: 10px 10px;
2991
+ grid-template-columns: ${(props) => {
2992
+ return props.colCount ? `repeat(${props.colCount}, minmax(${props.colMinWidth}px, 1fr))` : `repeat(auto-fit, minmax(${props.colMinWidth}px, 1fr))`;
2993
+ }};
2994
+ overflow: auto;
2995
+ justify-items: stretch;
2996
+ grid-auto-rows: ${(props) => `${props.rowHeight}px`};
2997
+ .child {
2998
+ height: ${(props) => `${props.rowHeight}px`};
2999
+ }
3000
+ `;
3001
+ var showErrorMessage = (errorCode, width, height) => {
3002
+ if (errorCode === "INVALID_SPLIT_BY_FIELD") {
3003
+ return /* @__PURE__ */ react_exports.createElement(
3004
+ Message_default,
3005
+ {
3006
+ width,
3007
+ height,
3008
+ message: (0, i18n_exports._)("Select a valid trellis split by field"),
3009
+ level: "info"
3010
+ }
3011
+ );
3012
+ }
3013
+ if (errorCode === "UNKNOWN_DATA_SPLIT_MODE") {
3014
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Unknown data split mode"), level: "info" });
3015
+ }
3016
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
3017
+ };
3018
+ var withTrellis = (Viz) => {
3019
+ const VizWithTrellis = (opts) => {
3020
+ const cachedHandleResize = react_exports.useCallback((w, h) => {
3021
+ setContainerWidth(w);
3022
+ setContainerHeight(h);
3023
+ }, []);
3024
+ const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
3025
+ const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
3026
+ const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
3027
+ const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
3028
+ const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
3029
+ const {
3030
+ trellisColumns,
3031
+ trellisPageCount,
3032
+ trellisMinColumnWidth,
3033
+ trellisRowHeight,
3034
+ splitByLayout,
3035
+ trellisSplitBy,
3036
+ trellisSharedScale,
3037
+ stackMode,
3038
+ yAxisMin,
3039
+ yAxisMax
3040
+ } = mergedOptions;
3041
+ const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
3042
+ const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
3043
+ const colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
3044
+ const rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
3045
+ const [pageNum, setPageNum] = (0, react_exports.useState)(1);
3046
+ const [pagedData, setPagedData] = (0, react_exports.useState)(null);
3047
+ let splitByKeys = [];
3048
+ let totalPages = 0;
3049
+ let showPaginator = false;
3050
+ const { dataSources } = otherProps;
3051
+ const theme = {
3052
+ splunkThemeV1: useSplunkTheme_default()
3053
+ };
3054
+ const {
3055
+ family: currentThemeFamily,
3056
+ colorScheme: currentThemeColorScheme,
3057
+ density: currentThemeDensity
3058
+ } = (0, themes_exports.getSettingsFromThemedProps)({ theme });
3059
+ const trellisBackgroundColor = (0, react_exports.useMemo)(() => {
3060
+ const themeFunc = (themeVar) => {
3061
+ var _a2, _b;
3062
+ return (_b = (_a2 = Viz.config.themes)[themeVar]) == null ? void 0 : _b.call(_a2, {
3063
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
3064
+ theme
3065
+ });
3066
+ };
3067
+ const evaluated = Options_exports.Options.evaluate(
3068
+ {
3069
+ context: Viz.config.context,
3070
+ options: {
3071
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor
3072
+ }
3073
+ },
3074
+ {},
3075
+ themeFunc
3076
+ );
3077
+ return evaluated.trellisBackgroundColor;
3078
+ }, [
3079
+ mergedOptions.trellisBackgroundColor,
3080
+ currentThemeFamily,
3081
+ currentThemeColorScheme,
3082
+ currentThemeDensity
3083
+ ]);
3084
+ const columns = (0, lodash_exports.get)(dataSources, "primary.data.columns", void 0);
3085
+ const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields", void 0);
3086
+ const noColumns = columns === void 0;
3087
+ const noFields = fields === void 0;
3088
+ const updateDataDisplay = (currPage) => {
3089
+ if (!showPaginator) {
3090
+ setPagedData(splitByKeys);
3091
+ setPageNum(1);
3092
+ } else {
3093
+ const startIdx = pageCount * (currPage - 1);
3094
+ const paged = splitByKeys.slice(startIdx, startIdx + pageCount);
3095
+ setPagedData(paged);
3096
+ }
3097
+ };
3098
+ (0, react_exports.useEffect)(() => {
3099
+ setPageNum(1);
3100
+ updateDataDisplay(1);
3101
+ }, [pageCount, trellisSplitBy]);
3102
+ (0, react_exports.useEffect)(() => {
3103
+ updateDataDisplay(pageNum);
3104
+ }, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
3105
+ const handlePageChange = (0, react_exports.useCallback)(
3106
+ (event, { page }) => {
3107
+ setPageNum(page);
3108
+ },
3109
+ [pageNum, pagedData]
3110
+ );
3111
+ const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3112
+ const isTrellisFeatureFlagOn2 = Boolean(
3113
+ featureFlagContext && featureFlagContext.visualizations_enableTrellis
3114
+ );
3115
+ if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
3116
+ return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
3117
+ }
3118
+ if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
3119
+ if (noColumns || noFields) {
3120
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
3121
+ }
3122
+ let currTrellisSplitBy = trellisSplitBy;
3123
+ if (!trellisSplitBy || trellisSplitBy.length === 0) {
3124
+ const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
3125
+ currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
3126
+ }
3127
+ const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
3128
+ const dataSplitResult = getTrellisDataSourcesBySplitMode(
3129
+ splitMode,
3130
+ dataSources,
3131
+ currTrellisSplitBy
3132
+ );
3133
+ const modifiedDataSourceBySplitBy = dataSplitResult == null ? void 0 : dataSplitResult.splitDataSources;
3134
+ const dataSplitErrorCode = dataSplitResult == null ? void 0 : dataSplitResult.errorCode;
3135
+ if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
3136
+ return showErrorMessage(dataSplitErrorCode, width, height);
3137
+ }
3138
+ const splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
3139
+ if (splitByKeysModified) {
3140
+ showPaginator = splitByKeysModified.length > pageCount;
3141
+ splitByKeys = splitByKeysModified;
3142
+ totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
3143
+ }
3144
+ const [calculatedMin, calculatedMax] = determineMinMax(
3145
+ modifiedDataSourceBySplitBy,
3146
+ trellisSharedScale,
3147
+ yAxisMin,
3148
+ yAxisMax,
3149
+ stackMode
3150
+ );
3151
+ return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
3152
+ TrellisContainerGrid,
3153
+ {
3154
+ height,
3155
+ colCount,
3156
+ colMinWidth,
3157
+ rowHeight
3158
+ },
3159
+ pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
3160
+ "div",
3161
+ {
3162
+ className: "child",
3163
+ "data-test": "trellis-child",
3164
+ key: `div-child-${idx.toString()}`
3165
+ },
3166
+ /* @__PURE__ */ react_exports.createElement(
3167
+ SizeAwareWrapper_default,
3168
+ {
3169
+ width,
3170
+ height,
3171
+ onResize: cachedHandleResize
3172
+ }
3173
+ ),
3174
+ /* @__PURE__ */ react_exports.createElement(
3175
+ Viz,
3176
+ __spreadProps(__spreadValues({}, otherProps), {
3177
+ trellisKey: splitByKey,
3178
+ trellisSplitBy: currTrellisSplitBy,
3179
+ dataSources: modifiedDataSourceBySplitBy[splitByKey],
3180
+ options: __spreadProps(__spreadValues({}, options), {
3181
+ yAxisMin: calculatedMin,
3182
+ yAxisMax: calculatedMax
3183
+ }),
3184
+ key: `viz-${idx.toString()}`,
3185
+ height: containerHeight,
3186
+ width: containerWidth
3187
+ })
3188
+ )
3189
+ ))
3190
+ ), showPaginator && totalPages >= pageNum && /* @__PURE__ */ react_exports.createElement(
3191
+ Paginator_default,
3192
+ {
3193
+ onChange: handlePageChange,
3194
+ current: pageNum,
3195
+ alwaysShowLastPageLink: true,
3196
+ totalPages
3197
+ }
3198
+ ));
3199
+ }
3200
+ return null;
3201
+ };
3202
+ VizWithTrellis.propTypes = Viz.proptypes;
3203
+ VizWithTrellis.defaultProps = Viz.defaultProps;
3204
+ VizWithTrellis.config = Viz.config;
3205
+ return VizWithTrellis;
3206
+ };
3207
+ var withTrellis_default = withTrellis;
3208
+
2471
3209
  // src/FillerGauge/FillerGauge.ts
2472
3210
  var config2 = config_default;
2473
3211
  var PureFillerGauge = FillerGauge_default;
@@ -2480,15 +3218,18 @@ var computeVizProps = (_a) => {
2480
3218
  majorTickFillColor: config2.themes.majorTickFillColor(props),
2481
3219
  majorTickStrokeColor: config2.themes.majorTickStrokeColor(props),
2482
3220
  valueMarkerFillColor: config2.themes.valueMarkerFillColor(props),
2483
- valueMarkerLabelFillColor: config2.themes.valueMarkerLabelFillColor(props)
3221
+ valueMarkerLabelFillColor: config2.themes.valueMarkerLabelFillColor(props),
3222
+ defaultFontColor: props.themeFunc("defaultFontColor")
2484
3223
  };
2485
- return __spreadValues(__spreadValues({}, options), defaultColors);
3224
+ return __spreadProps(__spreadValues(__spreadValues({}, options), defaultColors), { trellisKey: props.trellisKey });
2486
3225
  };
2487
- var viz = withDashboardViz_default({
2488
- ReactViz: FillerGauge_default,
2489
- computeVizProps,
2490
- vizConfig: config_default
2491
- });
3226
+ var viz = withTrellis_default(
3227
+ withDashboardViz_default({
3228
+ ReactViz: FillerGauge_default,
3229
+ computeVizProps,
3230
+ vizConfig: config_default
3231
+ })
3232
+ );
2492
3233
  var { themes: themes2 } = config_default;
2493
3234
  var FillerGauge_default2 = viz;
2494
3235
  //# sourceMappingURL=FillerGauge.js.map