@splunk/visualizations 27.0.0 → 27.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 (79) hide show
  1. package/Area.config.js +269 -122
  2. package/Area.config.js.map +4 -4
  3. package/Area.js +1065 -209
  4. package/Area.js.map +4 -4
  5. package/Bar.config.js +266 -82
  6. package/Bar.config.js.map +4 -4
  7. package/Bar.js +1065 -171
  8. package/Bar.js.map +4 -4
  9. package/Bubble.config.js +127 -1
  10. package/Bubble.config.js.map +4 -4
  11. package/Bubble.js +323 -80
  12. package/Bubble.js.map +4 -4
  13. package/ChoroplethSvg.js +60 -30
  14. package/ChoroplethSvg.js.map +4 -4
  15. package/Column.config.js +271 -82
  16. package/Column.config.js.map +4 -4
  17. package/Column.js +1070 -171
  18. package/Column.js.map +4 -4
  19. package/Ellipse.js +44 -14
  20. package/Ellipse.js.map +4 -4
  21. package/Events.js +82 -52
  22. package/Events.js.map +4 -4
  23. package/FillerGauge.js +44 -14
  24. package/FillerGauge.js.map +4 -4
  25. package/Image.js +42 -12
  26. package/Image.js.map +4 -4
  27. package/Line.config.js +271 -119
  28. package/Line.config.js.map +4 -4
  29. package/Line.js +1067 -206
  30. package/Line.js.map +4 -4
  31. package/LinkGraph.js +563 -529
  32. package/LinkGraph.js.map +4 -4
  33. package/Map.js +44 -14
  34. package/Map.js.map +4 -4
  35. package/Markdown.js +46 -16
  36. package/Markdown.js.map +4 -4
  37. package/MarkerGauge.js +42 -12
  38. package/MarkerGauge.js.map +4 -4
  39. package/ParallelCoordinates.js +122 -86
  40. package/ParallelCoordinates.js.map +4 -4
  41. package/Pie.js +198 -81
  42. package/Pie.js.map +4 -4
  43. package/Punchcard.js +54 -24
  44. package/Punchcard.js.map +4 -4
  45. package/Rectangle.js +56 -26
  46. package/Rectangle.js.map +4 -4
  47. package/Sankey.js +68 -38
  48. package/Sankey.js.map +4 -4
  49. package/Scatter.config.js +127 -1
  50. package/Scatter.config.js.map +4 -4
  51. package/Scatter.js +323 -80
  52. package/Scatter.js.map +4 -4
  53. package/SingleValue.config.js +43 -67
  54. package/SingleValue.config.js.map +4 -4
  55. package/SingleValue.js +1419 -1351
  56. package/SingleValue.js.map +4 -4
  57. package/SingleValueBasic.js.map +1 -1
  58. package/SingleValueIcon.config.js +45 -69
  59. package/SingleValueIcon.config.js.map +4 -4
  60. package/SingleValueIcon.js +1307 -1238
  61. package/SingleValueIcon.js.map +4 -4
  62. package/SingleValueRadial.config.js +43 -67
  63. package/SingleValueRadial.config.js.map +4 -4
  64. package/SingleValueRadial.js +1352 -1266
  65. package/SingleValueRadial.js.map +4 -4
  66. package/TRELLIS.md +16 -15
  67. package/Table.js +52 -22
  68. package/Table.js.map +4 -4
  69. package/common/Charting.js +133 -27
  70. package/common/Charting.js.map +4 -4
  71. package/common/OptionsDoc.js +6 -1
  72. package/common/OptionsDoc.js.map +2 -2
  73. package/common/utils/singleValueUtils.js +8 -7
  74. package/common/utils/singleValueUtils.js.map +2 -2
  75. package/common/utils/trellisUtils.js +41 -1
  76. package/common/utils/trellisUtils.js.map +2 -2
  77. package/common/withDashboardViz.js +42 -12
  78. package/common/withDashboardViz.js.map +4 -4
  79. package/package.json +17 -18
package/Line.js CHANGED
@@ -195,6 +195,15 @@ var defaultImport14 = __toESM(require("@splunk/visualizations-shared/themeUtils"
195
195
  __reExport(themeUtils_exports, require("@splunk/visualizations-shared/themeUtils"));
196
196
  var themeUtils_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
197
197
 
198
+ // esm-externals:@splunk/visualization-schemas
199
+ var visualization_schemas_exports = {};
200
+ __export(visualization_schemas_exports, {
201
+ default: () => visualization_schemas_default
202
+ });
203
+ var defaultImport15 = __toESM(require("@splunk/visualization-schemas"));
204
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
205
+ var visualization_schemas_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
206
+
198
207
  // src/common/ChartingApi.ts
199
208
  var ChartingApiFunctional = class {
200
209
  // eslint-disable-next-line no-useless-constructor
@@ -248,9 +257,9 @@ var numberUtils_exports = {};
248
257
  __export(numberUtils_exports, {
249
258
  default: () => numberUtils_default
250
259
  });
251
- var defaultImport15 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
260
+ var defaultImport16 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
252
261
  __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
253
- var numberUtils_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
262
+ var numberUtils_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
254
263
 
255
264
  // src/common/interfaces/DataSource.ts
256
265
  var validSortDirs = ["asc", "desc", "none"];
@@ -527,6 +536,57 @@ var downsampleDataSources = ({ dataSources, threshold, options }) => {
527
536
  return downsampledDataSources;
528
537
  };
529
538
 
539
+ // esm-externals:@splunk/visualization-context/FeatureFlagContext
540
+ var FeatureFlagContext_exports = {};
541
+ __export(FeatureFlagContext_exports, {
542
+ default: () => FeatureFlagContext_default
543
+ });
544
+ var defaultImport17 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
545
+ __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
546
+ var FeatureFlagContext_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
547
+
548
+ // src/common/hooks/useTrellisEnabled.ts
549
+ var useTrellisFeatureFlagOn = () => {
550
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
551
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
552
+ };
553
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
554
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
555
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
556
+ };
557
+
558
+ // src/common/components/TrellisTitle.tsx
559
+ var TRELLIS_TITLE_HEIGHT = 28;
560
+ var TrellisTitleText = styled_components_default.div`
561
+ margin-left: 10px;
562
+ margin-right: 10px;
563
+ padding-top: 8px;
564
+ text-overflow: ellipsis;
565
+ white-space: nowrap;
566
+ overflow: hidden;
567
+ `;
568
+ var TrellisTitleDiv = styled_components_default.div`
569
+ height: ${TRELLIS_TITLE_HEIGHT}px;
570
+ font-size: 14px;
571
+ font-weight: 700;
572
+ color: ${(props) => props.fontColor};
573
+ background-color: ${(props) => props.backgroundColor};
574
+ 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.
575
+ `;
576
+ var TrellisTitle = (props) => {
577
+ const titleText = String(props.trellisKey).toString();
578
+ return /* @__PURE__ */ react_exports.createElement(
579
+ TrellisTitleDiv,
580
+ {
581
+ fontColor: props.fontColor,
582
+ backgroundColor: props.backgroundColor,
583
+ "data-test": "trellis-title",
584
+ title: titleText
585
+ },
586
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
587
+ );
588
+ };
589
+
530
590
  // src/common/Charting.tsx
531
591
  var NO_INPLACE_PROPS = [
532
592
  "chart",
@@ -535,6 +595,15 @@ var NO_INPLACE_PROPS = [
535
595
  "chart.style",
536
596
  "legend.placement"
537
597
  ];
598
+ var appendTrellisToPayload = (props, payload) => {
599
+ if (props.trellisSplitBy) {
600
+ payload["trellis.name"] = props.trellisSplitBy;
601
+ }
602
+ if (props.trellisKey) {
603
+ payload["trellis.value"] = props.trellisKey;
604
+ }
605
+ return payload;
606
+ };
538
607
  var changedOptions = (curOptions, nextOptions) => Object.keys(curOptions).filter((key) => !(key in nextOptions)).concat(
539
608
  Object.keys(nextOptions).filter(
540
609
  (key) => !(key in curOptions) || curOptions[key] !== nextOptions[key]
@@ -581,7 +650,12 @@ var propTypes = {
581
650
  originalDataSources: prop_types_exports.object,
582
651
  onDownsamplingThresholdChange: prop_types_exports.func,
583
652
  xField: prop_types_exports.string,
584
- y2Fields: prop_types_exports.array
653
+ y2Fields: prop_types_exports.array,
654
+ splitByLayout: prop_types_exports.oneOf(Object.values(visualization_schemas_exports.LAYOUT_TYPE)),
655
+ trellisKey: prop_types_exports.string,
656
+ trellisSplitBy: prop_types_exports.string,
657
+ backgroundColor: prop_types_exports.string,
658
+ defaultFontColor: prop_types_exports.string
585
659
  };
586
660
  var Charting = (props) => {
587
661
  var _a, _b;
@@ -592,6 +666,7 @@ var Charting = (props) => {
592
666
  const api = (0, react_exports.useRef)(new ChartingApiFunctional(chart));
593
667
  const timezone = (0, react_exports.useContext)(TimezoneContext_default);
594
668
  const selectChartEvent = (0, react_exports.useRef)(null);
669
+ const trellisEnabled = useTrellisEnabled(props.splitByLayout);
595
670
  const computeChartingSize = () => {
596
671
  if (container.current) {
597
672
  const rect = container.current.getBoundingClientRect();
@@ -618,7 +693,10 @@ var Charting = (props) => {
618
693
  onEventTrigger,
619
694
  originalDataSources,
620
695
  onDownsamplingThresholdChange,
621
- xField
696
+ xField,
697
+ backgroundColor,
698
+ defaultFontColor,
699
+ trellisKey
622
700
  } = props;
623
701
  const prevOptions = usePrevious(options);
624
702
  const prevTimezone = usePrevious(timezone);
@@ -637,6 +715,7 @@ var Charting = (props) => {
637
715
  delete payload.value2;
638
716
  payload = updateRowPayload(chartEvent.rowContext, payload);
639
717
  }
718
+ payload = appendTrellisToPayload(props, payload);
640
719
  onClick({
641
720
  type,
642
721
  originalEvent: chartEvent,
@@ -673,18 +752,22 @@ var Charting = (props) => {
673
752
  const handleSelect = useEventCallback_default((chartEvent) => {
674
753
  selectChartEvent.current = chartEvent;
675
754
  recalculateDownsamplingThreshold();
755
+ const payload = appendTrellisToPayload(
756
+ props,
757
+ (0, lodash_exports.pick)(chartEvent, "startXIndex", "endXIndex", "startXValue", "endXValue")
758
+ );
676
759
  if (onSelect && typeof onSelect === "function") {
677
760
  onSelect({
678
761
  type: "range.select",
679
762
  originalEvent: chartEvent,
680
- payload: (0, lodash_exports.pick)(chartEvent, "startXIndex", "endXIndex", "startXValue", "endXValue")
763
+ payload
681
764
  });
682
765
  return;
683
766
  }
684
767
  onEventTrigger({
685
768
  type: "range.select",
686
769
  originalEvent: chartEvent,
687
- payload: (0, lodash_exports.pick)(chartEvent, "startXIndex", "endXIndex", "startXValue", "endXValue")
770
+ payload
688
771
  });
689
772
  });
690
773
  const handlePointMouseOut = useEventCallback_default(
@@ -701,7 +784,7 @@ var Charting = (props) => {
701
784
  delete payload.name2;
702
785
  payload.value = payload.value2;
703
786
  delete payload.value2;
704
- payload = updateRowPayload(chartEvent.rowContext, payload);
787
+ payload = appendTrellisToPayload(props, updateRowPayload(chartEvent.rowContext, payload));
705
788
  onPointMouseOut({
706
789
  type,
707
790
  originalEvent: chartEvent,
@@ -723,7 +806,7 @@ var Charting = (props) => {
723
806
  delete payload.name2;
724
807
  payload.value = payload.value2;
725
808
  delete payload.value2;
726
- payload = updateRowPayload(chartEvent.rowContext, payload);
809
+ payload = appendTrellisToPayload(props, updateRowPayload(chartEvent.rowContext, payload));
727
810
  onPointMouseOver({
728
811
  type,
729
812
  originalEvent: chartEvent,
@@ -787,10 +870,15 @@ var Charting = (props) => {
787
870
  if (colorPalette.length > 0) {
788
871
  charting_bundle_default.setColorPalette(colorPalette);
789
872
  }
873
+ const payload = appendTrellisToPayload(props, {
874
+ width,
875
+ height,
876
+ currentTime: (/* @__PURE__ */ new Date()).getTime()
877
+ });
790
878
  chart.current.prepareAndDraw(chartData, updatedOptions, () => {
791
879
  onEventTrigger({
792
880
  type: "viz.renderedWithData",
793
- payload: { width, height, currentTime: (/* @__PURE__ */ new Date()).getTime() }
881
+ payload
794
882
  });
795
883
  });
796
884
  }
@@ -837,7 +925,23 @@ var Charting = (props) => {
837
925
  themeKey,
838
926
  onClick
839
927
  ]);
840
- return /* @__PURE__ */ react_exports.createElement(ChartingContainer, { style, ref: onContainerMount, width, height }, /* @__PURE__ */ react_exports.createElement(react_event_listener_default, { target: window, onResize: debouncedDrawChart }));
928
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
929
+ TrellisTitle,
930
+ {
931
+ trellisKey,
932
+ backgroundColor,
933
+ fontColor: defaultFontColor
934
+ }
935
+ ), /* @__PURE__ */ react_exports.createElement(
936
+ ChartingContainer,
937
+ {
938
+ style,
939
+ ref: onContainerMount,
940
+ width,
941
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height
942
+ },
943
+ /* @__PURE__ */ react_exports.createElement(react_event_listener_default, { target: window, onResize: debouncedDrawChart })
944
+ ));
841
945
  };
842
946
  var defaultProps = {
843
947
  width: "100%",
@@ -857,81 +961,73 @@ var defaultProps = {
857
961
  onDownsamplingThresholdChange: null,
858
962
  originalDataSources: null,
859
963
  xField: null,
860
- y2Fields: []
964
+ y2Fields: [],
965
+ splitByLayout: void 0,
966
+ trellisKey: void 0,
967
+ trellisSplitBy: void 0,
968
+ backgroundColor: "",
969
+ defaultFontColor: ""
861
970
  };
862
971
  Charting.propTypes = propTypes;
863
972
  Charting.defaultProps = defaultProps;
864
- var withEmptyChartMessage = (Chart) => {
865
- const Wrapper = (props) => {
866
- const { chartData } = props;
867
- if (!chartData) {
868
- return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No DataSource"), level: "warning" });
869
- }
870
- if (chartData && !Object.keys(chartData).length) {
871
- return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No Result"), level: "info" });
872
- }
873
- return /* @__PURE__ */ react_exports.createElement(Chart, __spreadValues({}, props));
874
- };
875
- Wrapper.displayName = "ChartingWrapper";
876
- Wrapper.propTypes = propTypes;
877
- Wrapper.defaultProps = defaultProps;
878
- return Wrapper;
973
+ var ChartingWrapper = (props) => {
974
+ const { chartData } = props;
975
+ if (!chartData) {
976
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No DataSource"), level: "warning" });
977
+ }
978
+ if (!Object.keys(chartData).length) {
979
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No Result"), level: "info" });
980
+ }
981
+ return /* @__PURE__ */ react_exports.createElement(Charting, __spreadValues({}, props));
879
982
  };
880
- var Charting_default = withEmptyChartMessage(Charting);
881
-
882
- // esm-externals:@splunk/visualization-schemas
883
- var visualization_schemas_exports = {};
884
- __export(visualization_schemas_exports, {
885
- default: () => visualization_schemas_default
886
- });
887
- var defaultImport16 = __toESM(require("@splunk/visualization-schemas"));
888
- __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
889
- var visualization_schemas_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
983
+ ChartingWrapper.propTypes = propTypes;
984
+ ChartingWrapper.defaultProps = defaultProps;
985
+ var Charting_default = ChartingWrapper;
890
986
 
891
987
  // esm-externals:@splunk/visualization-icons
892
988
  var visualization_icons_exports = {};
893
989
  __export(visualization_icons_exports, {
894
990
  default: () => visualization_icons_default
895
991
  });
896
- var defaultImport17 = __toESM(require("@splunk/visualization-icons"));
992
+ var defaultImport18 = __toESM(require("@splunk/visualization-icons"));
897
993
  __reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
898
- var visualization_icons_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
994
+ var visualization_icons_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
899
995
 
900
996
  // esm-externals:@splunk/visualization-icons/placeholders
901
997
  var placeholders_exports = {};
902
998
  __export(placeholders_exports, {
903
999
  default: () => placeholders_default
904
1000
  });
905
- var defaultImport18 = __toESM(require("@splunk/visualization-icons/placeholders"));
1001
+ var defaultImport19 = __toESM(require("@splunk/visualization-icons/placeholders"));
906
1002
  __reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
907
- var placeholders_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
1003
+ var placeholders_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
908
1004
 
909
1005
  // esm-externals:@splunk/themes/pick
910
1006
  var pick_exports = {};
911
1007
  __export(pick_exports, {
912
1008
  default: () => pick_default
913
1009
  });
914
- var defaultImport19 = __toESM(require("@splunk/themes/pick"));
1010
+ var defaultImport20 = __toESM(require("@splunk/themes/pick"));
915
1011
  __reExport(pick_exports, require("@splunk/themes/pick"));
916
- var pick_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1012
+ var pick_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
917
1013
 
918
1014
  // esm-externals:@splunk/themes/variables
919
1015
  var variables_exports = {};
920
1016
  __export(variables_exports, {
921
1017
  default: () => variables_default
922
1018
  });
923
- var defaultImport20 = __toESM(require("@splunk/themes/variables"));
1019
+ var defaultImport21 = __toESM(require("@splunk/themes/variables"));
924
1020
  __reExport(variables_exports, require("@splunk/themes/variables"));
925
- var variables_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1021
+ var variables_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
926
1022
 
927
1023
  // esm-externals:@splunk/visualizations-shared/configUtils
928
1024
  var configUtils_exports = {};
929
1025
  __export(configUtils_exports, {
930
1026
  default: () => configUtils_default
931
1027
  });
932
- var defaultImport21 = __toESM(require("@splunk/visualizations-shared/configUtils"));
1028
+ var defaultImport22 = __toESM(require("@splunk/visualizations-shared/configUtils"));
933
1029
  __reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
934
- var configUtils_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1030
+ var configUtils_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
935
1031
 
936
1032
  // src/common/utils/configUtils.ts
937
1033
  function enhanceConfig(vizConfig) {
@@ -953,6 +1049,13 @@ var insertLayout = (layout, index, ...layoutItems) => [
953
1049
  ];
954
1050
 
955
1051
  // src/common/editorConfig/AxesChartDataConfig.ts
1052
+ var isTrellisFeatureFlagOn = ({ featureFlags }) => {
1053
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
1054
+ };
1055
+ var isTrellisEnabled = ({ options, featureFlags }) => {
1056
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
1057
+ return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1058
+ };
956
1059
  var AxesChartDataConfig = {
957
1060
  label: (0, i18n_exports._)("Data configurations"),
958
1061
  layout: [
@@ -1006,7 +1109,8 @@ var AxesChartDataConfigBar = {
1006
1109
  filterByTypes: ["number"],
1007
1110
  supportsDSL: true,
1008
1111
  expectedDataPrimitive: ["series", "frame"]
1009
- }
1112
+ },
1113
+ isDisabled: isTrellisEnabled
1010
1114
  }
1011
1115
  ])
1012
1116
  };
@@ -1109,10 +1213,136 @@ var AxesChartDataConfigAreaColumnLine = {
1109
1213
  ]
1110
1214
  };
1111
1215
 
1216
+ // src/common/editorConfig/TrellisEditors.ts
1217
+ var isTrellisFeatureFlagOn2 = ({ featureFlags }) => {
1218
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
1219
+ };
1220
+ var isTrellisEnabled2 = ({ options, featureFlags }) => {
1221
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
1222
+ return isTrellisFeatureFlagOn2({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1223
+ };
1224
+ var TrellisEditorConfig = [
1225
+ [
1226
+ {
1227
+ label: (0, i18n_exports._)("Trellis layout"),
1228
+ option: "splitByLayout",
1229
+ editor: "editor.toggle",
1230
+ showEditor: isTrellisFeatureFlagOn2
1231
+ }
1232
+ ],
1233
+ [
1234
+ {
1235
+ label: (0, i18n_exports._)("Split by"),
1236
+ option: "trellisSplitBy",
1237
+ editor: "editor.trellisSplitBy",
1238
+ editorProps: {
1239
+ dataSourceKey: "primary"
1240
+ },
1241
+ showEditor: isTrellisEnabled2
1242
+ }
1243
+ ],
1244
+ [
1245
+ {
1246
+ label: (0, i18n_exports._)("Number of columns"),
1247
+ option: "trellisColumns",
1248
+ editor: "editor.number",
1249
+ editorProps: {
1250
+ min: 1
1251
+ },
1252
+ placeholder: (0, i18n_exports._)("Auto"),
1253
+ showEditor: isTrellisEnabled2
1254
+ }
1255
+ ],
1256
+ [
1257
+ {
1258
+ label: (0, i18n_exports._)("Min column width"),
1259
+ option: "trellisMinColumnWidth",
1260
+ editor: "editor.number",
1261
+ editorProps: {
1262
+ min: 1
1263
+ },
1264
+ showEditor: isTrellisEnabled2
1265
+ },
1266
+ {
1267
+ label: (0, i18n_exports._)("Row height"),
1268
+ option: "trellisRowHeight",
1269
+ editor: "editor.number",
1270
+ editorProps: {
1271
+ min: 1
1272
+ },
1273
+ showEditor: isTrellisEnabled2
1274
+ }
1275
+ ],
1276
+ [
1277
+ {
1278
+ label: (0, i18n_exports._)("Max number of components per page"),
1279
+ option: "trellisPageCount",
1280
+ editor: "editor.number",
1281
+ editorProps: {
1282
+ min: 1
1283
+ },
1284
+ showEditor: isTrellisEnabled2
1285
+ }
1286
+ ]
1287
+ ];
1288
+ var TimechartTrellisEditorConfig = [
1289
+ [
1290
+ {
1291
+ label: (0, i18n_exports._)("Trellis layout"),
1292
+ option: "splitByLayout",
1293
+ editor: "editor.toggle",
1294
+ showEditor: isTrellisFeatureFlagOn2,
1295
+ // add help text for timecharts
1296
+ editorProps: {
1297
+ help: (0, i18n_exports._)(
1298
+ "Y2-axis and overlay field configurations are not supported when trellis is enabled."
1299
+ ),
1300
+ helpFormat: "under"
1301
+ }
1302
+ }
1303
+ ],
1304
+ ...TrellisEditorConfig.slice(1),
1305
+ [
1306
+ {
1307
+ label: (0, i18n_exports._)("Shared y-axis scale"),
1308
+ option: "trellisSharedScale",
1309
+ editor: "editor.checkbox",
1310
+ showEditor: isTrellisEnabled2
1311
+ }
1312
+ ]
1313
+ ];
1314
+ var TrellisBackgroundColorEditor = {
1315
+ label: (0, i18n_exports._)("Trellis background"),
1316
+ option: "trellisBackgroundColor",
1317
+ editor: "editor.color",
1318
+ showEditor: isTrellisEnabled2
1319
+ };
1320
+
1112
1321
  // src/common/editorConfig/AxesChartDataDisplay.ts
1113
- var AxesChartDataDisplayLine = {
1322
+ var isTrellisFeatureFlagOn3 = ({ featureFlags }) => {
1323
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
1324
+ };
1325
+ var isTrellisEnabled3 = ({ options, featureFlags }) => {
1326
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
1327
+ return isTrellisFeatureFlagOn3({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1328
+ };
1329
+ var AxesChartDataDisplayBase = {
1114
1330
  label: (0, i18n_exports._)("Data display"),
1115
1331
  layout: [
1332
+ [
1333
+ {
1334
+ label: (0, i18n_exports._)("Stack mode"),
1335
+ option: "stackMode",
1336
+ editor: "editor.select",
1337
+ editorProps: {
1338
+ values: [
1339
+ { label: (0, i18n_exports._)("Not stacked"), value: "auto" },
1340
+ { label: (0, i18n_exports._)("Stacked"), value: "stacked" },
1341
+ { label: (0, i18n_exports._)("Stacked 100%"), value: "stacked100" }
1342
+ ]
1343
+ }
1344
+ }
1345
+ ],
1116
1346
  [
1117
1347
  {
1118
1348
  label: (0, i18n_exports._)("Null value display"),
@@ -1148,7 +1378,8 @@ var AxesChartDataDisplayLine = {
1148
1378
  editor: "editor.columnMultiSelectionByFieldNameEditor",
1149
1379
  editorProps: {
1150
1380
  filterByTypes: ["number"]
1151
- }
1381
+ },
1382
+ isDisabled: isTrellisEnabled3
1152
1383
  }
1153
1384
  ],
1154
1385
  [
@@ -1165,60 +1396,32 @@ var AxesChartDataDisplayLine = {
1165
1396
  editor: "editor.checkbox",
1166
1397
  showEditor: ({ options }) => options.showSplitSeries
1167
1398
  }
1168
- ]
1169
- ]
1170
- };
1171
- var AxesChartDataDisplay = {
1172
- label: AxesChartDataDisplayLine.label,
1173
- layout: [
1174
- [
1175
- {
1176
- label: (0, i18n_exports._)("Stack mode"),
1177
- option: "stackMode",
1178
- editor: "editor.select",
1179
- editorProps: {
1180
- values: [
1181
- { label: (0, i18n_exports._)("Not stacked"), value: "auto" },
1182
- { label: (0, i18n_exports._)("Stacked"), value: "stacked" },
1183
- { label: (0, i18n_exports._)("Stacked 100%"), value: "stacked100" }
1184
- ]
1185
- }
1186
- }
1187
1399
  ],
1188
- ...AxesChartDataDisplayLine.layout
1400
+ ...TimechartTrellisEditorConfig
1189
1401
  ]
1190
1402
  };
1191
1403
  var AxesChartDataDisplayBar = {
1192
- label: AxesChartDataDisplayLine.label,
1404
+ label: AxesChartDataDisplayBase.label,
1193
1405
  layout: [
1194
- [
1195
- {
1196
- label: (0, i18n_exports._)("Stack mode"),
1197
- option: "stackMode",
1198
- editor: "editor.select",
1199
- editorProps: {
1200
- values: [
1201
- { label: (0, i18n_exports._)("Not stacked"), value: "auto" },
1202
- { label: (0, i18n_exports._)("Stacked"), value: "stacked" },
1203
- { label: (0, i18n_exports._)("Stacked 100%"), value: "stacked100" }
1204
- ]
1205
- }
1206
- }
1207
- ],
1208
- // remove nullValueDisplay
1209
- ...(0, lodash_exports.drop)(AxesChartDataDisplayLine.layout)
1406
+ AxesChartDataDisplayBase.layout[0],
1407
+ // remove null value display editor at index 1
1408
+ ...AxesChartDataDisplayBase.layout.slice(2)
1210
1409
  ]
1211
1410
  };
1212
1411
  var AxesChartDataDisplayColumn = {
1213
- label: AxesChartDataDisplayBar.label,
1412
+ label: AxesChartDataDisplayBase.label,
1214
1413
  layout: [
1215
- ...insertLayout(AxesChartDataDisplayBar.layout, 2, [
1414
+ AxesChartDataDisplayBase.layout[0],
1415
+ // remove null value display and add data value display
1416
+ AxesChartDataDisplayBase.layout[2],
1417
+ [
1216
1418
  {
1217
1419
  label: (0, i18n_exports._)("Show tooltip on hover"),
1218
1420
  option: "showTooltip",
1219
1421
  editor: "editor.checkbox"
1220
1422
  }
1221
- ]),
1423
+ ],
1424
+ ...AxesChartDataDisplayBase.layout.slice(3),
1222
1425
  [
1223
1426
  {
1224
1427
  label: (0, i18n_exports._)("Column grouping mode"),
@@ -1234,6 +1437,13 @@ var AxesChartDataDisplayColumn = {
1234
1437
  ]
1235
1438
  ]
1236
1439
  };
1440
+ var AxesChartDataDisplayLine = {
1441
+ label: AxesChartDataDisplayBase.label,
1442
+ layout: [
1443
+ // remove stacked mode editor
1444
+ ...AxesChartDataDisplayBase.layout.slice(1)
1445
+ ]
1446
+ };
1237
1447
 
1238
1448
  // src/common/editorConfig/BackgroundColor.ts
1239
1449
  var background = ({
@@ -1283,7 +1493,19 @@ var AxesChartColorAndStyle = {
1283
1493
  ]
1284
1494
  ]
1285
1495
  };
1286
- var AxesChartColorAndStyle_default = AxesChartColorAndStyle;
1496
+ var AreaAxesChartColorAndStyleWithTrellis = __spreadProps(__spreadValues({}, AxesChartColorAndStyle), {
1497
+ layout: [
1498
+ AxesChartColorAndStyle.layout[0],
1499
+ [
1500
+ __spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
1501
+ editorProps: {
1502
+ themes
1503
+ }
1504
+ })
1505
+ ],
1506
+ ...AxesChartColorAndStyle.layout.slice(1)
1507
+ ]
1508
+ });
1287
1509
 
1288
1510
  // src/common/editorConfig/AxesChartLegend.ts
1289
1511
  var AxesChartLegend = {
@@ -1323,7 +1545,54 @@ var AxesChartLegend = {
1323
1545
  ]
1324
1546
  ]
1325
1547
  };
1326
- var AxesChartLegend_default = AxesChartLegend;
1548
+ var AxesChartLegendWithTrellisAndMode = ({
1549
+ showLegendTooltip = false,
1550
+ hideModeWhenOff = false
1551
+ }) => ({
1552
+ label: AxesChartLegend.label,
1553
+ layout: [
1554
+ [
1555
+ {
1556
+ label: (0, i18n_exports._)("Legend display"),
1557
+ option: "legendDisplay",
1558
+ editor: "editor.select",
1559
+ editorProps: {
1560
+ values: [
1561
+ { label: (0, i18n_exports._)("Right"), value: "right" },
1562
+ { label: (0, i18n_exports._)("Left"), value: "left" },
1563
+ { label: (0, i18n_exports._)("Top"), value: "top" },
1564
+ { label: (0, i18n_exports._)("Bottom"), value: "bottom" },
1565
+ { label: (0, i18n_exports._)("Off"), value: "off" }
1566
+ ],
1567
+ tooltip: showLegendTooltip && (0, i18n_exports._)('Legend mode must be "Standard" to configure legend display')
1568
+ },
1569
+ isDisabled: showLegendTooltip ? ({ options }) => options.legendMode === "seriesCompare" : void 0,
1570
+ overrideDefaultValue: ({ options }) => (options == null ? void 0 : options.splitByLayout) === "trellis" ? "off" : "right"
1571
+ }
1572
+ ],
1573
+ [
1574
+ __spreadProps(__spreadValues({}, AxesChartLegend.layout[1][0]), {
1575
+ showEditor: ({ options }) => options.legendDisplay === "left" || options.legendDisplay === "right" || options.legendDisplay === "top" || options.legendDisplay === "bottom" || // when Trellis is on, the default value of legendDisplay is off
1576
+ options.legendDisplay === void 0 && options.splitByLayout !== "trellis"
1577
+ })
1578
+ ],
1579
+ [
1580
+ {
1581
+ label: (0, i18n_exports._)("Legend mode"),
1582
+ option: "legendMode",
1583
+ editor: "editor.radioBar",
1584
+ editorProps: {
1585
+ values: [
1586
+ { label: (0, i18n_exports._)("Standard"), value: "standard" },
1587
+ { label: (0, i18n_exports._)("Compare series"), value: "seriesCompare" }
1588
+ ]
1589
+ },
1590
+ showEditor: ({ options }) => hideModeWhenOff ? options.legendDisplay === "left" || options.legendDisplay === "right" || options.legendDisplay === "top" || options.legendDisplay === "bottom" || // when Trellis is on, the default value of legendDisplay is off
1591
+ options.legendDisplay === void 0 && options.splitByLayout !== "trellis" : true
1592
+ }
1593
+ ]
1594
+ ]
1595
+ });
1327
1596
 
1328
1597
  // src/common/editorConfig/AxesChartXGridAndLabels.ts
1329
1598
  var AxesChartXGridAndLabelsCommon = {
@@ -1767,6 +2036,13 @@ var AxesChartYGridAndLabels = {
1767
2036
  var AxesChartYGridAndLabels_default = AxesChartYGridAndLabels;
1768
2037
 
1769
2038
  // src/common/editorConfig/AxesChartY2GridAndLabels.ts
2039
+ var isTrellisFeatureFlagOn4 = ({ featureFlags }) => {
2040
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
2041
+ };
2042
+ var isTrellisOff = ({ options, featureFlags }) => {
2043
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
2044
+ return !isTrellisFeatureFlagOn4({ featureFlags }) || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis;
2045
+ };
1770
2046
  var axesChartY2GridAndLabels = {
1771
2047
  label: (0, i18n_exports._)("Y2-axis grid and labels"),
1772
2048
  layout: [
@@ -1774,15 +2050,16 @@ var axesChartY2GridAndLabels = {
1774
2050
  {
1775
2051
  label: (0, i18n_exports._)("Axis title"),
1776
2052
  option: "y2AxisTitleVisibility",
1777
- editor: "editor.toggle"
2053
+ editor: "editor.toggle",
2054
+ showEditor: isTrellisOff
1778
2055
  }
1779
2056
  ],
1780
2057
  [
1781
2058
  {
1782
- label: (0, i18n_exports._)("Axis title"),
2059
+ label: (0, i18n_exports._)("Axis title text"),
1783
2060
  option: "y2AxisTitleText",
1784
2061
  editor: "editor.text",
1785
- showEditor: ({ options }) => options.y2AxisTitleVisibility === "show" || options.y2AxisTitleVisibility === void 0
2062
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisTitleVisibility === "show" || options.y2AxisTitleVisibility === void 0)
1786
2063
  }
1787
2064
  ],
1788
2065
  [
@@ -1790,7 +2067,7 @@ var axesChartY2GridAndLabels = {
1790
2067
  label: (0, i18n_exports._)("Show overlays on the y2-axis"),
1791
2068
  option: "showOverlayY2Axis",
1792
2069
  editor: "editor.checkbox",
1793
- showEditor: ({ options }) => Array.isArray(options.overlayFields) && options.overlayFields.length > 0
2070
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && Array.isArray(options.overlayFields) && options.overlayFields.length > 0
1794
2071
  }
1795
2072
  ],
1796
2073
  [
@@ -1803,7 +2080,8 @@ var axesChartY2GridAndLabels = {
1803
2080
  { label: (0, i18n_exports._)("Linear"), value: "linear" },
1804
2081
  { label: (0, i18n_exports._)("Log"), value: "log" }
1805
2082
  ]
1806
- }
2083
+ },
2084
+ showEditor: isTrellisOff
1807
2085
  }
1808
2086
  ],
1809
2087
  [
@@ -1817,7 +2095,8 @@ var axesChartY2GridAndLabels = {
1817
2095
  { label: (0, i18n_exports._)("Show"), value: "show" },
1818
2096
  { label: (0, i18n_exports._)("Hide"), value: "hide" }
1819
2097
  ]
1820
- }
2098
+ },
2099
+ showEditor: isTrellisOff
1821
2100
  }
1822
2101
  ],
1823
2102
  [
@@ -1825,7 +2104,7 @@ var axesChartY2GridAndLabels = {
1825
2104
  label: (0, i18n_exports._)("Round axis labels"),
1826
2105
  option: "showRoundedY2AxisLabels",
1827
2106
  editor: "editor.checkbox",
1828
- showEditor: ({ options }) => options.y2AxisLabelVisibility === "show" || options.y2AxisLabelVisibility === "auto" || options.y2AxisLabelVisibility === void 0
2107
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisLabelVisibility === "show" || options.y2AxisLabelVisibility === "auto" || options.y2AxisLabelVisibility === void 0)
1829
2108
  }
1830
2109
  ],
1831
2110
  [
@@ -1833,40 +2112,45 @@ var axesChartY2GridAndLabels = {
1833
2112
  label: (0, i18n_exports._)("SI prefix abbreviation for labels"),
1834
2113
  option: "y2AxisAbbreviation",
1835
2114
  editor: "editor.checkbox",
1836
- showEditor: ({ options }) => options.y2AxisLabelVisibility === "show" || options.y2AxisLabelVisibility === "auto" || options.y2AxisLabelVisibility === void 0
2115
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisLabelVisibility === "show" || options.y2AxisLabelVisibility === "auto" || options.y2AxisLabelVisibility === void 0)
1837
2116
  }
1838
2117
  ],
1839
2118
  [
1840
2119
  {
1841
2120
  label: (0, i18n_exports._)("Include zero"),
1842
2121
  option: "showY2AxisWithZero",
1843
- editor: "editor.checkbox"
2122
+ editor: "editor.checkbox",
2123
+ showEditor: isTrellisOff
1844
2124
  }
1845
2125
  ],
1846
2126
  [
1847
2127
  {
1848
2128
  label: (0, i18n_exports._)("Minimum axis value"),
1849
2129
  option: "y2AxisMin",
1850
- editor: "editor.number"
2130
+ editor: "editor.number",
2131
+ showEditor: isTrellisOff
1851
2132
  },
1852
2133
  {
1853
2134
  label: (0, i18n_exports._)("Maximum axis value"),
1854
2135
  option: "y2AxisMax",
1855
- editor: "editor.number"
2136
+ editor: "editor.number",
2137
+ showEditor: isTrellisOff
1856
2138
  }
1857
2139
  ],
1858
2140
  [
1859
2141
  {
1860
2142
  label: (0, i18n_exports._)("Axis line visibility"),
1861
2143
  option: "y2AxisLineVisibility",
1862
- editor: "editor.checkbox"
2144
+ editor: "editor.checkbox",
2145
+ showEditor: isTrellisOff
1863
2146
  }
1864
2147
  ],
1865
2148
  [
1866
2149
  {
1867
2150
  label: (0, i18n_exports._)("Major gridlines"),
1868
2151
  option: "showY2MajorGridLines",
1869
- editor: "editor.checkbox"
2152
+ editor: "editor.checkbox",
2153
+ showEditor: isTrellisOff
1870
2154
  }
1871
2155
  ],
1872
2156
  [
@@ -1880,7 +2164,8 @@ var axesChartY2GridAndLabels = {
1880
2164
  { label: (0, i18n_exports._)("Show"), value: "show" },
1881
2165
  { label: (0, i18n_exports._)("Hide"), value: "hide" }
1882
2166
  ]
1883
- }
2167
+ },
2168
+ showEditor: isTrellisOff
1884
2169
  }
1885
2170
  ],
1886
2171
  [
@@ -1893,7 +2178,7 @@ var axesChartY2GridAndLabels = {
1893
2178
  max: 10,
1894
2179
  step: 1
1895
2180
  },
1896
- showEditor: ({ options }) => options.y2AxisMajorTickVisibility === "show" || options.y2AxisMajorTickVisibility === "auto" || options.y2AxisMajorTickVisibility === void 0
2181
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisMajorTickVisibility === "show" || options.y2AxisMajorTickVisibility === "auto" || options.y2AxisMajorTickVisibility === void 0)
1897
2182
  }
1898
2183
  ],
1899
2184
  [
@@ -1901,14 +2186,15 @@ var axesChartY2GridAndLabels = {
1901
2186
  label: (0, i18n_exports._)("Major tick interval spacing"),
1902
2187
  option: "y2AxisMajorTickInterval",
1903
2188
  editor: "editor.number",
1904
- showEditor: ({ options }) => options.y2AxisMajorTickVisibility === "show" || options.y2AxisMajorTickVisibility === "auto" || options.y2AxisMajorTickVisibility === void 0
2189
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisMajorTickVisibility === "show" || options.y2AxisMajorTickVisibility === "auto" || options.y2AxisMajorTickVisibility === void 0)
1905
2190
  }
1906
2191
  ],
1907
2192
  [
1908
2193
  {
1909
2194
  label: (0, i18n_exports._)("Minor gridlines"),
1910
2195
  option: "showY2MinorGridLines",
1911
- editor: "editor.checkbox"
2196
+ editor: "editor.checkbox",
2197
+ showEditor: isTrellisOff
1912
2198
  }
1913
2199
  ],
1914
2200
  [
@@ -1922,7 +2208,8 @@ var axesChartY2GridAndLabels = {
1922
2208
  { label: (0, i18n_exports._)("Show"), value: "show" },
1923
2209
  { label: (0, i18n_exports._)("Hide"), value: "hide" }
1924
2210
  ]
1925
- }
2211
+ },
2212
+ showEditor: isTrellisOff
1926
2213
  }
1927
2214
  ],
1928
2215
  [
@@ -1935,7 +2222,7 @@ var axesChartY2GridAndLabels = {
1935
2222
  max: 10,
1936
2223
  step: 1
1937
2224
  },
1938
- showEditor: ({ options }) => options.y2AxisMinorTickVisibility === "show" || options.y2AxisMinorTickVisibility === "auto" || options.y2AxisMinorTickVisibility === void 0
2225
+ showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisMinorTickVisibility === "show" || options.y2AxisMinorTickVisibility === "auto" || options.y2AxisMinorTickVisibility === void 0)
1939
2226
  }
1940
2227
  ]
1941
2228
  ]
@@ -1973,15 +2260,22 @@ var themes2 = {
1973
2260
  light: variables_default.backgroundColor(props)
1974
2261
  },
1975
2262
  prisma: variables_default.backgroundColorSidebar(props)
2263
+ })(props),
2264
+ defaultFontColor: (props) => pick_default({
2265
+ enterprise: {
2266
+ dark: variables_default.textColor(props),
2267
+ light: variables_default.textColor(props)
2268
+ },
2269
+ prisma: variables_default.contentColorDefault(props)
1976
2270
  })(props)
1977
2271
  };
1978
2272
  var editorConfig = [
1979
2273
  AxesChartDataConfigAreaColumnLine,
1980
2274
  AxesChartDataDisplayLine,
1981
2275
  {
1982
- label: AxesChartColorAndStyle_default.label,
2276
+ label: AreaAxesChartColorAndStyleWithTrellis.label,
1983
2277
  layout: [
1984
- ...AxesChartColorAndStyle_default.layout,
2278
+ ...AreaAxesChartColorAndStyleWithTrellis.layout,
1985
2279
  // [
1986
2280
  // {
1987
2281
  // label: _('Line dash style'),
@@ -2052,58 +2346,7 @@ var editorConfig = [
2052
2346
  ]
2053
2347
  ]
2054
2348
  },
2055
- {
2056
- label: AxesChartLegend_default.label,
2057
- layout: [
2058
- [
2059
- {
2060
- label: (0, i18n_exports._)("Legend display"),
2061
- option: "legendDisplay",
2062
- editor: "editor.select",
2063
- editorProps: {
2064
- values: [
2065
- { label: (0, i18n_exports._)("Right"), value: "right" },
2066
- { label: (0, i18n_exports._)("Left"), value: "left" },
2067
- { label: (0, i18n_exports._)("Top"), value: "top" },
2068
- { label: (0, i18n_exports._)("Bottom"), value: "bottom" },
2069
- { label: (0, i18n_exports._)("Off"), value: "off" }
2070
- ],
2071
- tooltip: (0, i18n_exports._)('Legend mode must be "Standard" to configure legend display')
2072
- },
2073
- isDisabled: ({ options }) => options.legendMode === "seriesCompare"
2074
- }
2075
- ],
2076
- [
2077
- {
2078
- label: (0, i18n_exports._)("Legend truncation"),
2079
- option: "legendTruncation",
2080
- editor: "editor.radioBar",
2081
- editorProps: {
2082
- values: [
2083
- { label: (0, i18n_exports._)("A..."), value: "ellipsisEnd" },
2084
- { label: (0, i18n_exports._)("A...Z"), value: "ellipsisMiddle" },
2085
- { label: (0, i18n_exports._)("...Z"), value: "ellipsisStart" },
2086
- { label: (0, i18n_exports._)("Off"), value: "ellipsisOff" }
2087
- ]
2088
- },
2089
- showEditor: ({ options }) => options.legendDisplay === "left" || options.legendDisplay === "right" || options.legendDisplay === "top" || options.legendDisplay === "bottom" || options.legendDisplay === void 0
2090
- }
2091
- ],
2092
- [
2093
- {
2094
- label: (0, i18n_exports._)("Legend mode"),
2095
- option: "legendMode",
2096
- editor: "editor.radioBar",
2097
- editorProps: {
2098
- values: [
2099
- { label: (0, i18n_exports._)("Standard"), value: "standard" },
2100
- { label: (0, i18n_exports._)("Compare series"), value: "seriesCompare" }
2101
- ]
2102
- }
2103
- }
2104
- ]
2105
- ]
2106
- },
2349
+ AxesChartLegendWithTrellisAndMode({ showLegendTooltip: true }),
2107
2350
  AxesChartXGridAndLabels_default,
2108
2351
  AxesChartYGridAndLabels_default,
2109
2352
  AxesChartY2GridAndLabels_default
@@ -2145,7 +2388,12 @@ var config = {
2145
2388
  description: "triggered when user moves out of a data point"
2146
2389
  }
2147
2390
  },
2148
- supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "downsampling" /* DOWNSAMPLING */],
2391
+ supports: [
2392
+ "dynamic-options" /* DYNAMIC_OPTIONS */,
2393
+ "placeholder" /* PLACEHOLDER */,
2394
+ "downsampling" /* DOWNSAMPLING */,
2395
+ "trellis" /* TRELLIS */
2396
+ ],
2149
2397
  themes: themes2
2150
2398
  };
2151
2399
  var config_default = enhanceConfig(config);
@@ -2155,45 +2403,36 @@ var getSettingsFromThemedProps_exports = {};
2155
2403
  __export(getSettingsFromThemedProps_exports, {
2156
2404
  default: () => getSettingsFromThemedProps_default
2157
2405
  });
2158
- var defaultImport22 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
2406
+ var defaultImport23 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
2159
2407
  __reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
2160
- var getSettingsFromThemedProps_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
2408
+ var getSettingsFromThemedProps_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
2161
2409
 
2162
2410
  // esm-externals:@splunk/visualization-encoding/Options
2163
2411
  var Options_exports = {};
2164
2412
  __export(Options_exports, {
2165
2413
  default: () => Options_default
2166
2414
  });
2167
- var defaultImport23 = __toESM(require("@splunk/visualization-encoding/Options"));
2415
+ var defaultImport24 = __toESM(require("@splunk/visualization-encoding/Options"));
2168
2416
  __reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
2169
- var Options_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
2417
+ var Options_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
2170
2418
 
2171
2419
  // esm-externals:@splunk/visualizations-shared/SanitizeProps
2172
2420
  var SanitizeProps_exports = {};
2173
2421
  __export(SanitizeProps_exports, {
2174
2422
  default: () => SanitizeProps_default
2175
2423
  });
2176
- var defaultImport24 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
2424
+ var defaultImport25 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
2177
2425
  __reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
2178
- var SanitizeProps_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
2426
+ var SanitizeProps_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
2179
2427
 
2180
2428
  // esm-externals:@splunk/moment
2181
2429
  var moment_exports = {};
2182
2430
  __export(moment_exports, {
2183
2431
  default: () => moment_default
2184
2432
  });
2185
- var defaultImport25 = __toESM(require("@splunk/moment"));
2433
+ var defaultImport26 = __toESM(require("@splunk/moment"));
2186
2434
  __reExport(moment_exports, require("@splunk/moment"));
2187
- var moment_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
2188
-
2189
- // esm-externals:@splunk/visualization-context/FeatureFlagContext
2190
- var FeatureFlagContext_exports = {};
2191
- __export(FeatureFlagContext_exports, {
2192
- default: () => FeatureFlagContext_default
2193
- });
2194
- var defaultImport26 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
2195
- __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
2196
- var FeatureFlagContext_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
2435
+ var moment_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
2197
2436
 
2198
2437
  // esm-externals:@splunk/visualizations-shared/hocUtils
2199
2438
  var hocUtils_exports = {};
@@ -2483,7 +2722,7 @@ var withFixedSizeContainer = (Viz) => {
2483
2722
  FixSizeItem,
2484
2723
  {
2485
2724
  "data-test": "fix-size-item",
2486
- "data-splunk-visualization-version": "27.0.0 - 9bf093b7d",
2725
+ "data-splunk-visualization-version": "27.1.0 - fe8b048df",
2487
2726
  width,
2488
2727
  height,
2489
2728
  backgroundColor
@@ -2549,7 +2788,7 @@ var Cover = styled_components_default.div`
2549
2788
  bottom: 0;
2550
2789
  `;
2551
2790
  var Blocker = styled_components_default.div.attrs({
2552
- "data-splunk-visualization-version": "27.0.0 - 9bf093b7d"
2791
+ "data-splunk-visualization-version": "27.1.0 - fe8b048df"
2553
2792
  })`
2554
2793
  position: relative;
2555
2794
  width: 100%;
@@ -2811,6 +3050,350 @@ var getFeatureFlag = (context, flagName) => {
2811
3050
  return false;
2812
3051
  };
2813
3052
 
3053
+ // esm-externals:@splunk/visualizations-shared/trellisUtils
3054
+ var trellisUtils_exports = {};
3055
+ __export(trellisUtils_exports, {
3056
+ default: () => trellisUtils_default
3057
+ });
3058
+ var defaultImport34 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
3059
+ __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
3060
+ var trellisUtils_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
3061
+
3062
+ // src/common/utils/trellisUtils.ts
3063
+ var AGGREGATIONS = "aggregations";
3064
+ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3065
+ var _a, _b, _c, _d;
3066
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3067
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3068
+ let splitDataSources = null;
3069
+ let errorCode = null;
3070
+ if (fields && fields.length) {
3071
+ splitDataSources = {};
3072
+ for (let i = 0; i < fields.length; i += 1) {
3073
+ const fieldName = fields[i].name;
3074
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
3075
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
3076
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3077
+ );
3078
+ splitDataSources[fieldName].primary.data.fields = [fields[i]];
3079
+ splitDataSources[fieldName].primary.data.columns = [columns[i]];
3080
+ }
3081
+ }
3082
+ } else {
3083
+ errorCode = "INVALID_SPLIT_BY_FIELD";
3084
+ }
3085
+ return { splitDataSources, errorCode };
3086
+ };
3087
+ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3088
+ var _a, _b, _c, _d;
3089
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3090
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3091
+ let splitDataSources = null;
3092
+ let splitByFields = [];
3093
+ let errorCode = null;
3094
+ if (typeof fields[0] !== "string") {
3095
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3096
+ }
3097
+ if (splitByFields && splitByFields.length > 0) {
3098
+ splitDataSources = {};
3099
+ splitByFields.forEach((splitByField) => {
3100
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
3101
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3102
+ );
3103
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
3104
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
3105
+ fields.forEach((field, idx) => {
3106
+ const fieldName = field == null ? void 0 : field.name;
3107
+ if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
3108
+ splitDataSources[splitByField].primary.data.fields.push(field);
3109
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
3110
+ }
3111
+ });
3112
+ });
3113
+ } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
3114
+ splitDataSources = {};
3115
+ for (let i = 1; i < fields.length; i += 1) {
3116
+ const fieldName = fields[i].name;
3117
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
3118
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
3119
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3120
+ );
3121
+ splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
3122
+ splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
3123
+ }
3124
+ }
3125
+ } else {
3126
+ errorCode = "INVALID_SPLIT_BY_FIELD";
3127
+ }
3128
+ return { splitDataSources, errorCode };
3129
+ };
3130
+ var dataSourcesSplitByAggregationsStats = (dataSource) => {
3131
+ var _a, _b, _c, _d;
3132
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3133
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3134
+ let splitDataSources = null;
3135
+ let splitByFields = [];
3136
+ let errorCode = null;
3137
+ if (typeof fields[0] !== "string") {
3138
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
3139
+ }
3140
+ if (splitByFields && splitByFields.length > 0) {
3141
+ splitDataSources = {};
3142
+ splitByFields.forEach((splitByField) => {
3143
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
3144
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3145
+ );
3146
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
3147
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
3148
+ const idx = fields.findIndex((field) => field.name === splitByField);
3149
+ if (idx > 0) {
3150
+ splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
3151
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
3152
+ }
3153
+ });
3154
+ } else {
3155
+ errorCode = "INVALID_SPLIT_BY_FIELD";
3156
+ }
3157
+ return { splitDataSources, errorCode };
3158
+ };
3159
+ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3160
+ var _a, _b, _c, _d, _e;
3161
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3162
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3163
+ let splitDataSources = null;
3164
+ let splitByFields = [];
3165
+ let errorCode = null;
3166
+ if (typeof fields[0] !== "string") {
3167
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3168
+ }
3169
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3170
+ splitDataSources = {};
3171
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3172
+ const valueKeys = [];
3173
+ for (let i = 1; i < fields.length; i += 1) {
3174
+ if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
3175
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
3176
+ }
3177
+ }
3178
+ valueKeys.forEach((val) => {
3179
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3180
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3181
+ );
3182
+ splitDataSources[val].primary.data.fields = [
3183
+ { name: fields[0].name },
3184
+ ...dataSourceKeys.map((k) => ({
3185
+ name: k
3186
+ }))
3187
+ ];
3188
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
3189
+ dataSourceKeys.forEach((dsKey) => {
3190
+ fields.forEach((field, idx) => {
3191
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
3192
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
3193
+ }
3194
+ });
3195
+ });
3196
+ });
3197
+ } else {
3198
+ errorCode = "INVALID_SPLIT_BY_FIELD";
3199
+ }
3200
+ return { splitDataSources, errorCode };
3201
+ };
3202
+ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3203
+ var _a, _b, _c, _d;
3204
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3205
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3206
+ let splitDataSources = null;
3207
+ let splitByFields = [];
3208
+ let errorCode = null;
3209
+ if (typeof fields[0] !== "string") {
3210
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3211
+ }
3212
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3213
+ splitDataSources = {};
3214
+ const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
3215
+ const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
3216
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3217
+ const nonDataSourceAggregations = [];
3218
+ if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
3219
+ for (let i = 1; i < fields.length; i += 1) {
3220
+ nonDataSourceAggregations.push(fields[i].name);
3221
+ }
3222
+ }
3223
+ if (splitByFieldIdx === 0) {
3224
+ const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
3225
+ valueKeys.forEach((val, idx) => {
3226
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3227
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3228
+ );
3229
+ splitDataSources[val].primary.data.fields = [];
3230
+ if (otherSplitBy.length) {
3231
+ splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
3232
+ }
3233
+ if (dataSourceKeys.length) {
3234
+ const columnValues = [[]];
3235
+ splitDataSources[val].primary.data.fields = [
3236
+ ...splitDataSources[val].primary.data.fields,
3237
+ ...dataSourceKeys.map((k) => ({
3238
+ name: k
3239
+ }))
3240
+ ];
3241
+ dataSourceKeys.forEach(() => {
3242
+ columnValues.push([]);
3243
+ });
3244
+ for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
3245
+ columnValues[0].push(
3246
+ fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
3247
+ );
3248
+ dataSourceKeys.forEach((dskey, dsIndx) => {
3249
+ const mul = (fields.length - 1) / dataSourceKeys.length;
3250
+ columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
3251
+ });
3252
+ }
3253
+ splitDataSources[val].primary.data.columns = columnValues;
3254
+ } else if (nonDataSourceAggregations.length) {
3255
+ const columnValues = [];
3256
+ fields.forEach((aggregationField, fieldIdx) => {
3257
+ if (fieldIdx > 0) {
3258
+ splitDataSources[val].primary.data.fields.push(aggregationField);
3259
+ columnValues.push([columns[fieldIdx][idx]]);
3260
+ }
3261
+ });
3262
+ splitDataSources[val].primary.data.columns = columnValues;
3263
+ }
3264
+ });
3265
+ } else {
3266
+ const valueKeys = [];
3267
+ for (let i = 1; i < fields.length; i += 1) {
3268
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
3269
+ }
3270
+ valueKeys.forEach((val) => {
3271
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3272
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3273
+ );
3274
+ splitDataSources[val].primary.data.fields = [
3275
+ { name: otherSplitBy[0] },
3276
+ ...dataSourceKeys.map((k) => ({
3277
+ name: k
3278
+ }))
3279
+ ];
3280
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
3281
+ dataSourceKeys.forEach((dsKey) => {
3282
+ fields.forEach((field, idx) => {
3283
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
3284
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
3285
+ }
3286
+ });
3287
+ });
3288
+ });
3289
+ }
3290
+ } else {
3291
+ errorCode = "INVALID_SPLIT_BY_FIELD";
3292
+ }
3293
+ return { splitDataSources, errorCode };
3294
+ };
3295
+ var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
3296
+ var _a, _b, _c, _d, _e, _f;
3297
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3298
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3299
+ let splitDataSources = null;
3300
+ let splitByFields = [];
3301
+ let errorCode = null;
3302
+ if (typeof fields[0] !== "string") {
3303
+ splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3304
+ }
3305
+ const splitByIndex = fields == null ? void 0 : fields.findIndex(
3306
+ (field) => field === splitBy || field.name === splitBy
3307
+ );
3308
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3309
+ const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
3310
+ splitDataSources = {};
3311
+ splitByColumn.forEach((val, idx) => {
3312
+ if (!splitDataSources[val]) {
3313
+ splitDataSources[val] = [idx];
3314
+ } else {
3315
+ splitDataSources[val].push(idx);
3316
+ }
3317
+ });
3318
+ const cloneFields = (0, lodash_exports.cloneDeep)(fields);
3319
+ cloneFields.splice(splitByIndex, 1);
3320
+ const valueKeys = Object.keys(splitDataSources);
3321
+ valueKeys.forEach((val) => {
3322
+ const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
3323
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3324
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3325
+ );
3326
+ splitDataSources[val].primary.data.fields = cloneFields;
3327
+ splitDataSources[val].primary.data.columns = [];
3328
+ columns.forEach((col, idx) => {
3329
+ if (idx !== splitByIndex) {
3330
+ const newCol = valIndices.map((valIdx) => col[valIdx]);
3331
+ splitDataSources[val].primary.data.columns.push(newCol);
3332
+ }
3333
+ });
3334
+ });
3335
+ } else {
3336
+ errorCode = "INVALID_SPLIT_BY_FIELD";
3337
+ }
3338
+ return { splitDataSources, errorCode };
3339
+ };
3340
+ var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
3341
+ let result = null;
3342
+ try {
3343
+ if (splitMode === trellisUtils_exports.TIMECHART) {
3344
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
3345
+ } else if (splitMode === trellisUtils_exports.STATS) {
3346
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
3347
+ } else if (splitMode === trellisUtils_exports.CHART) {
3348
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
3349
+ } else if (splitMode === trellisUtils_exports.UNKNOWN) {
3350
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
3351
+ }
3352
+ } catch (ex) {
3353
+ console.error("getTrellisDataSourcesBySplitMode ", ex);
3354
+ result = { splitDataSources: null, errorCode: "UNKNOWN" };
3355
+ }
3356
+ return result;
3357
+ };
3358
+ var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
3359
+ if (isTrellisOn && !options.legendDisplay) {
3360
+ return {
3361
+ legendDisplay: "off"
3362
+ };
3363
+ }
3364
+ return {};
3365
+ };
3366
+ var calculateSharedMinMax = (splitData) => {
3367
+ let max = -Infinity;
3368
+ let min = Infinity;
3369
+ Object.keys(splitData).forEach((splitByKey) => {
3370
+ const datasources = splitData[splitByKey];
3371
+ Object.keys(datasources).forEach((datasourceName) => {
3372
+ const dataColumns = datasources[datasourceName].data.columns;
3373
+ dataColumns.forEach((column) => {
3374
+ column.forEach((point) => {
3375
+ const pointNumber = Number(point);
3376
+ if (pointNumber > max) {
3377
+ max = pointNumber;
3378
+ }
3379
+ if (pointNumber < min) {
3380
+ min = pointNumber;
3381
+ }
3382
+ });
3383
+ });
3384
+ });
3385
+ });
3386
+ return [min, max];
3387
+ };
3388
+ var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
3389
+ if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
3390
+ return [yAxisMin, yAxisMax];
3391
+ const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
3392
+ const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
3393
+ const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
3394
+ return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
3395
+ };
3396
+
2814
3397
  // src/common/withDashboardViz.tsx
2815
3398
  var withDashboardViz = (opts) => {
2816
3399
  const {
@@ -2818,6 +3401,8 @@ var withDashboardViz = (opts) => {
2818
3401
  vizConfig,
2819
3402
  computeVizProps: computeVizProps2 = () => {
2820
3403
  },
3404
+ computeVizPropsBeforeEval = () => {
3405
+ },
2821
3406
  disableEditModeCover,
2822
3407
  useIconPlaceholder
2823
3408
  } = opts;
@@ -2867,14 +3452,26 @@ var withDashboardViz = (opts) => {
2867
3452
  const isDownsamplingEnabledByFeatureFlag = Boolean(
2868
3453
  featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
2869
3454
  );
3455
+ const isTrellisFeatureFlagOn5 = Boolean(
3456
+ featureFlagContext && featureFlagContext.visualizations_enableTrellis
3457
+ );
3458
+ const isTrellisOn = isTrellisFeatureFlagOn5 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
2870
3459
  const isMounted = react_exports.useRef(true);
2871
- const optionsToEvaluate = react_exports.useMemo(
2872
- () => ({
3460
+ const optionsToEvaluate = react_exports.useMemo(() => {
3461
+ var _a2;
3462
+ const legendDisplay = turnOffLegendDisplayWhenTrellisIsOn(isTrellisOn, options);
3463
+ const computedOptions = (_a2 = computeVizPropsBeforeEval(options)) != null ? _a2 : {};
3464
+ return {
2873
3465
  context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
2874
- options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
2875
- }),
2876
- [options, context]
2877
- );
3466
+ options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
3467
+ {},
3468
+ legendDisplay,
3469
+ computedOptions,
3470
+ options,
3471
+ defaultOptions
3472
+ )
3473
+ };
3474
+ }, [isTrellisOn, options, context]);
2878
3475
  const [threshold, setThreshold] = react_exports.useState(Number(width));
2879
3476
  const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
2880
3477
  setThreshold(newThreshold);
@@ -2955,11 +3552,8 @@ var withDashboardViz = (opts) => {
2955
3552
  useAsyncEvaluatedOptions
2956
3553
  ]);
2957
3554
  const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
2958
- const isTrellisFeatureFlagOn = Boolean(
2959
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
2960
- );
2961
3555
  let clonedEvaluatedOptions = evaluatedOptionsToUse;
2962
- if (isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.splitByLayout) === "trellis" /* TRELLIS */) {
3556
+ if (isTrellisOn) {
2963
3557
  clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
2964
3558
  backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
2965
3559
  });
@@ -3131,18 +3725,18 @@ var propUtils_exports = {};
3131
3725
  __export(propUtils_exports, {
3132
3726
  default: () => propUtils_default
3133
3727
  });
3134
- var defaultImport34 = __toESM(require("@splunk/visualizations-shared/propUtils"));
3728
+ var defaultImport35 = __toESM(require("@splunk/visualizations-shared/propUtils"));
3135
3729
  __reExport(propUtils_exports, require("@splunk/visualizations-shared/propUtils"));
3136
- var propUtils_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
3730
+ var propUtils_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
3137
3731
 
3138
3732
  // esm-externals:@splunk/visualizations-shared/simpleXMLOptions
3139
3733
  var simpleXMLOptions_exports = {};
3140
3734
  __export(simpleXMLOptions_exports, {
3141
3735
  default: () => simpleXMLOptions_default
3142
3736
  });
3143
- var defaultImport35 = __toESM(require("@splunk/visualizations-shared/simpleXMLOptions"));
3737
+ var defaultImport36 = __toESM(require("@splunk/visualizations-shared/simpleXMLOptions"));
3144
3738
  __reExport(simpleXMLOptions_exports, require("@splunk/visualizations-shared/simpleXMLOptions"));
3145
- var simpleXMLOptions_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
3739
+ var simpleXMLOptions_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
3146
3740
 
3147
3741
  // src/Line/lineUtils.ts
3148
3742
  var transformOptions = (originalOptions) => {
@@ -3228,6 +3822,258 @@ var convertToLineSCProperties = (originalOptions) => {
3228
3822
  );
3229
3823
  };
3230
3824
 
3825
+ // esm-externals:@splunk/react-ui/Paginator
3826
+ var Paginator_exports = {};
3827
+ __export(Paginator_exports, {
3828
+ default: () => Paginator_default
3829
+ });
3830
+ var defaultImport37 = __toESM(require("@splunk/react-ui/Paginator"));
3831
+ __reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
3832
+ var Paginator_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
3833
+
3834
+ // esm-externals:@splunk/themes
3835
+ var themes_exports = {};
3836
+ __export(themes_exports, {
3837
+ default: () => themes_default
3838
+ });
3839
+ var defaultImport38 = __toESM(require("@splunk/themes"));
3840
+ __reExport(themes_exports, require("@splunk/themes"));
3841
+ var themes_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
3842
+
3843
+ // src/common/hocs/withTrellis.tsx
3844
+ var TrellisContainer = styled_components_default.div`
3845
+ overflow: hidden;
3846
+ display: flex;
3847
+ flex-direction: column;
3848
+ background-color: ${(props) => props.backgroundColor};
3849
+ ${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
3850
+ > [data-test='paginator'] {
3851
+ align-self: flex-end;
3852
+ margin-bottom: 10px;
3853
+ }
3854
+ `;
3855
+ var TrellisContainerGrid = styled_components_default.div`
3856
+ display: grid;
3857
+ height: ${(props) => {
3858
+ return `${props.height}px`;
3859
+ }};
3860
+ gap: 10px 10px;
3861
+ grid-template-columns: ${(props) => {
3862
+ return props.colCount ? `repeat(${props.colCount}, minmax(${props.colMinWidth}px, 1fr))` : `repeat(auto-fit, minmax(${props.colMinWidth}px, 1fr))`;
3863
+ }};
3864
+ overflow: auto;
3865
+ justify-items: stretch;
3866
+ grid-auto-rows: ${(props) => `${props.rowHeight}px`};
3867
+ .child {
3868
+ height: ${(props) => `${props.rowHeight}px`};
3869
+ }
3870
+ `;
3871
+ var showErrorMessage = (errorCode, width, height) => {
3872
+ if (errorCode === "INVALID_SPLIT_BY_FIELD") {
3873
+ return /* @__PURE__ */ react_exports.createElement(
3874
+ Message_default,
3875
+ {
3876
+ width,
3877
+ height,
3878
+ message: (0, i18n_exports._)("Select a valid trellis split by field"),
3879
+ level: "info"
3880
+ }
3881
+ );
3882
+ }
3883
+ if (errorCode === "UNKNOWN_DATA_SPLIT_MODE") {
3884
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Unknown data split mode"), level: "info" });
3885
+ }
3886
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
3887
+ };
3888
+ var withTrellis = (Viz) => {
3889
+ const VizWithTrellis = (opts) => {
3890
+ const cachedHandleResize = react_exports.useCallback((w, h) => {
3891
+ setContainerWidth(w);
3892
+ setContainerHeight(h);
3893
+ }, []);
3894
+ const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
3895
+ const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
3896
+ const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
3897
+ const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
3898
+ const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
3899
+ const {
3900
+ trellisColumns,
3901
+ trellisPageCount,
3902
+ trellisMinColumnWidth,
3903
+ trellisRowHeight,
3904
+ splitByLayout,
3905
+ trellisSplitBy,
3906
+ trellisSharedScale,
3907
+ stackMode,
3908
+ yAxisMin,
3909
+ yAxisMax
3910
+ } = mergedOptions;
3911
+ const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
3912
+ const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
3913
+ const colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
3914
+ const rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
3915
+ const [pageNum, setPageNum] = (0, react_exports.useState)(1);
3916
+ const [pagedData, setPagedData] = (0, react_exports.useState)(null);
3917
+ let splitByKeys = [];
3918
+ let totalPages = 0;
3919
+ let showPaginator = false;
3920
+ const { dataSources } = otherProps;
3921
+ const theme = {
3922
+ splunkThemeV1: useSplunkTheme_default()
3923
+ };
3924
+ const {
3925
+ family: currentThemeFamily,
3926
+ colorScheme: currentThemeColorScheme,
3927
+ density: currentThemeDensity
3928
+ } = (0, themes_exports.getSettingsFromThemedProps)({ theme });
3929
+ const trellisBackgroundColor = (0, react_exports.useMemo)(() => {
3930
+ const themeFunc = (themeVar) => {
3931
+ var _a2, _b;
3932
+ return (_b = (_a2 = Viz.config.themes)[themeVar]) == null ? void 0 : _b.call(_a2, {
3933
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
3934
+ theme
3935
+ });
3936
+ };
3937
+ const evaluated = Options_exports.Options.evaluate(
3938
+ {
3939
+ context: Viz.config.context,
3940
+ options: { trellisBackgroundColor: mergedOptions.trellisBackgroundColor }
3941
+ },
3942
+ {},
3943
+ themeFunc
3944
+ );
3945
+ return evaluated.trellisBackgroundColor;
3946
+ }, [
3947
+ mergedOptions.trellisBackgroundColor,
3948
+ currentThemeFamily,
3949
+ currentThemeColorScheme,
3950
+ currentThemeDensity
3951
+ ]);
3952
+ const columns = (0, lodash_exports.get)(dataSources, "primary.data.columns", void 0);
3953
+ const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields", void 0);
3954
+ const noColumns = columns === void 0;
3955
+ const noFields = fields === void 0;
3956
+ const updateDataDisplay = (currPage) => {
3957
+ if (!showPaginator) {
3958
+ setPagedData(splitByKeys);
3959
+ setPageNum(1);
3960
+ } else {
3961
+ const startIdx = pageCount * (currPage - 1);
3962
+ const paged = splitByKeys.slice(startIdx, startIdx + pageCount);
3963
+ setPagedData(paged);
3964
+ }
3965
+ };
3966
+ (0, react_exports.useEffect)(() => {
3967
+ setPageNum(1);
3968
+ updateDataDisplay(1);
3969
+ }, [pageCount, trellisSplitBy]);
3970
+ (0, react_exports.useEffect)(() => {
3971
+ updateDataDisplay(pageNum);
3972
+ }, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
3973
+ const handlePageChange = (0, react_exports.useCallback)(
3974
+ (event, { page }) => {
3975
+ setPageNum(page);
3976
+ },
3977
+ [pageNum, pagedData]
3978
+ );
3979
+ const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3980
+ const isTrellisFeatureFlagOn5 = Boolean(
3981
+ featureFlagContext && featureFlagContext.visualizations_enableTrellis
3982
+ );
3983
+ if (!isTrellisFeatureFlagOn5 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
3984
+ return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
3985
+ }
3986
+ if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
3987
+ if (noColumns || noFields) {
3988
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
3989
+ }
3990
+ let currTrellisSplitBy = trellisSplitBy;
3991
+ if (!trellisSplitBy || trellisSplitBy.length === 0) {
3992
+ const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
3993
+ currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
3994
+ }
3995
+ const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
3996
+ const dataSplitResult = getTrellisDataSourcesBySplitMode(
3997
+ splitMode,
3998
+ dataSources,
3999
+ currTrellisSplitBy
4000
+ );
4001
+ const modifiedDataSourceBySplitBy = dataSplitResult == null ? void 0 : dataSplitResult.splitDataSources;
4002
+ const dataSplitErrorCode = dataSplitResult == null ? void 0 : dataSplitResult.errorCode;
4003
+ if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
4004
+ return showErrorMessage(dataSplitErrorCode, width, height);
4005
+ }
4006
+ const splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
4007
+ if (splitByKeysModified) {
4008
+ showPaginator = splitByKeysModified.length > pageCount;
4009
+ splitByKeys = splitByKeysModified;
4010
+ totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
4011
+ }
4012
+ const [calculatedMin, calculatedMax] = determineMinMax(
4013
+ modifiedDataSourceBySplitBy,
4014
+ trellisSharedScale,
4015
+ yAxisMin,
4016
+ yAxisMax,
4017
+ stackMode
4018
+ );
4019
+ return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
4020
+ TrellisContainerGrid,
4021
+ {
4022
+ height,
4023
+ colCount,
4024
+ colMinWidth,
4025
+ rowHeight
4026
+ },
4027
+ pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
4028
+ "div",
4029
+ {
4030
+ className: "child",
4031
+ "data-test": "trellis-child",
4032
+ key: `div-child-${idx.toString()}`
4033
+ },
4034
+ /* @__PURE__ */ react_exports.createElement(
4035
+ SizeAwareWrapper_default,
4036
+ {
4037
+ width,
4038
+ height,
4039
+ onResize: cachedHandleResize
4040
+ }
4041
+ ),
4042
+ /* @__PURE__ */ react_exports.createElement(
4043
+ Viz,
4044
+ __spreadProps(__spreadValues({}, otherProps), {
4045
+ trellisKey: splitByKey,
4046
+ trellisSplitBy: currTrellisSplitBy,
4047
+ dataSources: modifiedDataSourceBySplitBy[splitByKey],
4048
+ options: __spreadProps(__spreadValues({}, options), {
4049
+ yAxisMin: calculatedMin,
4050
+ yAxisMax: calculatedMax
4051
+ }),
4052
+ key: `viz-${idx.toString()}`,
4053
+ height: containerHeight,
4054
+ width: containerWidth
4055
+ })
4056
+ )
4057
+ ))
4058
+ ), showPaginator && totalPages >= pageNum && /* @__PURE__ */ react_exports.createElement(
4059
+ Paginator_default,
4060
+ {
4061
+ onChange: handlePageChange,
4062
+ current: pageNum,
4063
+ alwaysShowLastPageLink: true,
4064
+ totalPages
4065
+ }
4066
+ ));
4067
+ }
4068
+ return null;
4069
+ };
4070
+ VizWithTrellis.propTypes = Viz.proptypes;
4071
+ VizWithTrellis.defaultProps = Viz.defaultProps;
4072
+ VizWithTrellis.config = Viz.config;
4073
+ return VizWithTrellis;
4074
+ };
4075
+ var withTrellis_default = withTrellis;
4076
+
3231
4077
  // src/Line/Line.tsx
3232
4078
  var computeVizProps = (_a) => {
3233
4079
  var _b = _a, {
@@ -3240,7 +4086,10 @@ var computeVizProps = (_a) => {
3240
4086
  annotationX,
3241
4087
  annotationColor,
3242
4088
  annotationLabel,
3243
- visualizationApiRef
4089
+ visualizationApiRef,
4090
+ trellisKey,
4091
+ trellisSplitBy,
4092
+ themeFunc
3244
4093
  } = _b, otherOptions = __objRest(_b, [
3245
4094
  "dataSources",
3246
4095
  "x",
@@ -3251,9 +4100,19 @@ var computeVizProps = (_a) => {
3251
4100
  "annotationX",
3252
4101
  "annotationColor",
3253
4102
  "annotationLabel",
3254
- "visualizationApiRef"
4103
+ "visualizationApiRef",
4104
+ "trellisKey",
4105
+ "trellisSplitBy",
4106
+ "themeFunc"
3255
4107
  ]);
3256
- const computedProps = { visualizationApiRef, onEventTrigger };
4108
+ const defaultFontColor = themeFunc("defaultFontColor");
4109
+ const computedProps = {
4110
+ visualizationApiRef,
4111
+ onEventTrigger,
4112
+ trellisKey,
4113
+ trellisSplitBy,
4114
+ defaultFontColor
4115
+ };
3257
4116
  const { y2, y2Fields, hasEventHandlers, eventHandlers } = otherOptions;
3258
4117
  computedProps.options = transformOptions(otherOptions);
3259
4118
  const chartingAnnotations = getAnnotations({ annotationX, annotationColor, annotationLabel });
@@ -3279,11 +4138,13 @@ var computeVizProps = (_a) => {
3279
4138
  }
3280
4139
  return computedProps;
3281
4140
  };
3282
- var Line = withDashboardViz_default({
3283
- ReactViz: Charting_default,
3284
- computeVizProps,
3285
- vizConfig: config_default
3286
- });
4141
+ var Line = withTrellis_default(
4142
+ withDashboardViz_default({
4143
+ ReactViz: Charting_default,
4144
+ computeVizProps,
4145
+ vizConfig: config_default
4146
+ })
4147
+ );
3287
4148
  var themes3 = null;
3288
4149
  var Line_default = Line;
3289
4150
  //# sourceMappingURL=Line.js.map