@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.
- package/Area.config.js +269 -122
- package/Area.config.js.map +4 -4
- package/Area.js +1065 -209
- package/Area.js.map +4 -4
- package/Bar.config.js +266 -82
- package/Bar.config.js.map +4 -4
- package/Bar.js +1065 -171
- package/Bar.js.map +4 -4
- package/Bubble.config.js +127 -1
- package/Bubble.config.js.map +4 -4
- package/Bubble.js +323 -80
- package/Bubble.js.map +4 -4
- package/ChoroplethSvg.js +60 -30
- package/ChoroplethSvg.js.map +4 -4
- package/Column.config.js +271 -82
- package/Column.config.js.map +4 -4
- package/Column.js +1070 -171
- package/Column.js.map +4 -4
- package/Ellipse.js +44 -14
- package/Ellipse.js.map +4 -4
- package/Events.js +82 -52
- package/Events.js.map +4 -4
- package/FillerGauge.js +44 -14
- package/FillerGauge.js.map +4 -4
- package/Image.js +42 -12
- package/Image.js.map +4 -4
- package/Line.config.js +271 -119
- package/Line.config.js.map +4 -4
- package/Line.js +1067 -206
- package/Line.js.map +4 -4
- package/LinkGraph.js +563 -529
- package/LinkGraph.js.map +4 -4
- package/Map.js +44 -14
- package/Map.js.map +4 -4
- package/Markdown.js +46 -16
- package/Markdown.js.map +4 -4
- package/MarkerGauge.js +42 -12
- package/MarkerGauge.js.map +4 -4
- package/ParallelCoordinates.js +122 -86
- package/ParallelCoordinates.js.map +4 -4
- package/Pie.js +198 -81
- package/Pie.js.map +4 -4
- package/Punchcard.js +54 -24
- package/Punchcard.js.map +4 -4
- package/Rectangle.js +56 -26
- package/Rectangle.js.map +4 -4
- package/Sankey.js +68 -38
- package/Sankey.js.map +4 -4
- package/Scatter.config.js +127 -1
- package/Scatter.config.js.map +4 -4
- package/Scatter.js +323 -80
- package/Scatter.js.map +4 -4
- package/SingleValue.config.js +43 -67
- package/SingleValue.config.js.map +4 -4
- package/SingleValue.js +1419 -1351
- package/SingleValue.js.map +4 -4
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +45 -69
- package/SingleValueIcon.config.js.map +4 -4
- package/SingleValueIcon.js +1307 -1238
- package/SingleValueIcon.js.map +4 -4
- package/SingleValueRadial.config.js +43 -67
- package/SingleValueRadial.config.js.map +4 -4
- package/SingleValueRadial.js +1352 -1266
- package/SingleValueRadial.js.map +4 -4
- package/TRELLIS.md +16 -15
- package/Table.js +52 -22
- package/Table.js.map +4 -4
- package/common/Charting.js +133 -27
- package/common/Charting.js.map +4 -4
- package/common/OptionsDoc.js +6 -1
- package/common/OptionsDoc.js.map +2 -2
- package/common/utils/singleValueUtils.js +8 -7
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/trellisUtils.js +41 -1
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.js +42 -12
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +17 -18
package/Bar.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
|
|
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
|
|
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
|
|
763
|
+
payload
|
|
681
764
|
});
|
|
682
765
|
return;
|
|
683
766
|
}
|
|
684
767
|
onEventTrigger({
|
|
685
768
|
type: "range.select",
|
|
686
769
|
originalEvent: chartEvent,
|
|
687
|
-
payload
|
|
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
|
|
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(
|
|
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,90 +961,82 @@ 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
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
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
|
-
|
|
983
|
+
ChartingWrapper.propTypes = propTypes;
|
|
984
|
+
ChartingWrapper.defaultProps = defaultProps;
|
|
985
|
+
var Charting_default = ChartingWrapper;
|
|
881
986
|
|
|
882
987
|
// esm-externals:@splunk/visualizations-shared/simpleXMLOptions
|
|
883
988
|
var simpleXMLOptions_exports = {};
|
|
884
989
|
__export(simpleXMLOptions_exports, {
|
|
885
990
|
default: () => simpleXMLOptions_default
|
|
886
991
|
});
|
|
887
|
-
var
|
|
992
|
+
var defaultImport18 = __toESM(require("@splunk/visualizations-shared/simpleXMLOptions"));
|
|
888
993
|
__reExport(simpleXMLOptions_exports, require("@splunk/visualizations-shared/simpleXMLOptions"));
|
|
889
|
-
var simpleXMLOptions_default = "default" in
|
|
994
|
+
var simpleXMLOptions_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
|
|
890
995
|
|
|
891
996
|
// esm-externals:@splunk/visualization-icons
|
|
892
997
|
var visualization_icons_exports = {};
|
|
893
998
|
__export(visualization_icons_exports, {
|
|
894
999
|
default: () => visualization_icons_default
|
|
895
1000
|
});
|
|
896
|
-
var
|
|
1001
|
+
var defaultImport19 = __toESM(require("@splunk/visualization-icons"));
|
|
897
1002
|
__reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
|
|
898
|
-
var visualization_icons_default = "default" in
|
|
1003
|
+
var visualization_icons_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
|
|
899
1004
|
|
|
900
1005
|
// esm-externals:@splunk/visualization-icons/placeholders
|
|
901
1006
|
var placeholders_exports = {};
|
|
902
1007
|
__export(placeholders_exports, {
|
|
903
1008
|
default: () => placeholders_default
|
|
904
1009
|
});
|
|
905
|
-
var
|
|
1010
|
+
var defaultImport20 = __toESM(require("@splunk/visualization-icons/placeholders"));
|
|
906
1011
|
__reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
|
|
907
|
-
var placeholders_default = "default" in
|
|
908
|
-
|
|
909
|
-
// esm-externals:@splunk/visualization-schemas
|
|
910
|
-
var visualization_schemas_exports = {};
|
|
911
|
-
__export(visualization_schemas_exports, {
|
|
912
|
-
default: () => visualization_schemas_default
|
|
913
|
-
});
|
|
914
|
-
var defaultImport19 = __toESM(require("@splunk/visualization-schemas"));
|
|
915
|
-
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
916
|
-
var visualization_schemas_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
|
|
1012
|
+
var placeholders_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
|
|
917
1013
|
|
|
918
1014
|
// esm-externals:@splunk/themes/pick
|
|
919
1015
|
var pick_exports = {};
|
|
920
1016
|
__export(pick_exports, {
|
|
921
1017
|
default: () => pick_default
|
|
922
1018
|
});
|
|
923
|
-
var
|
|
1019
|
+
var defaultImport21 = __toESM(require("@splunk/themes/pick"));
|
|
924
1020
|
__reExport(pick_exports, require("@splunk/themes/pick"));
|
|
925
|
-
var pick_default = "default" in
|
|
1021
|
+
var pick_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
|
|
926
1022
|
|
|
927
1023
|
// esm-externals:@splunk/themes/variables
|
|
928
1024
|
var variables_exports = {};
|
|
929
1025
|
__export(variables_exports, {
|
|
930
1026
|
default: () => variables_default
|
|
931
1027
|
});
|
|
932
|
-
var
|
|
1028
|
+
var defaultImport22 = __toESM(require("@splunk/themes/variables"));
|
|
933
1029
|
__reExport(variables_exports, require("@splunk/themes/variables"));
|
|
934
|
-
var variables_default = "default" in
|
|
1030
|
+
var variables_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
|
|
935
1031
|
|
|
936
1032
|
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
937
1033
|
var configUtils_exports = {};
|
|
938
1034
|
__export(configUtils_exports, {
|
|
939
1035
|
default: () => configUtils_default
|
|
940
1036
|
});
|
|
941
|
-
var
|
|
1037
|
+
var defaultImport23 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
942
1038
|
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
943
|
-
var configUtils_default = "default" in
|
|
1039
|
+
var configUtils_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
|
|
944
1040
|
|
|
945
1041
|
// src/common/utils/configUtils.ts
|
|
946
1042
|
function enhanceConfig(vizConfig) {
|
|
@@ -962,6 +1058,13 @@ var insertLayout = (layout, index, ...layoutItems) => [
|
|
|
962
1058
|
];
|
|
963
1059
|
|
|
964
1060
|
// src/common/editorConfig/AxesChartDataConfig.ts
|
|
1061
|
+
var isTrellisFeatureFlagOn = ({ featureFlags }) => {
|
|
1062
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
1063
|
+
};
|
|
1064
|
+
var isTrellisEnabled = ({ options, featureFlags }) => {
|
|
1065
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
1066
|
+
return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1067
|
+
};
|
|
965
1068
|
var AxesChartDataConfig = {
|
|
966
1069
|
label: (0, i18n_exports._)("Data configurations"),
|
|
967
1070
|
layout: [
|
|
@@ -1015,7 +1118,8 @@ var AxesChartDataConfigBar = {
|
|
|
1015
1118
|
filterByTypes: ["number"],
|
|
1016
1119
|
supportsDSL: true,
|
|
1017
1120
|
expectedDataPrimitive: ["series", "frame"]
|
|
1018
|
-
}
|
|
1121
|
+
},
|
|
1122
|
+
isDisabled: isTrellisEnabled
|
|
1019
1123
|
}
|
|
1020
1124
|
])
|
|
1021
1125
|
};
|
|
@@ -1118,10 +1222,136 @@ var AxesChartDataConfigAreaColumnLine = {
|
|
|
1118
1222
|
]
|
|
1119
1223
|
};
|
|
1120
1224
|
|
|
1225
|
+
// src/common/editorConfig/TrellisEditors.ts
|
|
1226
|
+
var isTrellisFeatureFlagOn2 = ({ featureFlags }) => {
|
|
1227
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
1228
|
+
};
|
|
1229
|
+
var isTrellisEnabled2 = ({ options, featureFlags }) => {
|
|
1230
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
1231
|
+
return isTrellisFeatureFlagOn2({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1232
|
+
};
|
|
1233
|
+
var TrellisEditorConfig = [
|
|
1234
|
+
[
|
|
1235
|
+
{
|
|
1236
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
1237
|
+
option: "splitByLayout",
|
|
1238
|
+
editor: "editor.toggle",
|
|
1239
|
+
showEditor: isTrellisFeatureFlagOn2
|
|
1240
|
+
}
|
|
1241
|
+
],
|
|
1242
|
+
[
|
|
1243
|
+
{
|
|
1244
|
+
label: (0, i18n_exports._)("Split by"),
|
|
1245
|
+
option: "trellisSplitBy",
|
|
1246
|
+
editor: "editor.trellisSplitBy",
|
|
1247
|
+
editorProps: {
|
|
1248
|
+
dataSourceKey: "primary"
|
|
1249
|
+
},
|
|
1250
|
+
showEditor: isTrellisEnabled2
|
|
1251
|
+
}
|
|
1252
|
+
],
|
|
1253
|
+
[
|
|
1254
|
+
{
|
|
1255
|
+
label: (0, i18n_exports._)("Number of columns"),
|
|
1256
|
+
option: "trellisColumns",
|
|
1257
|
+
editor: "editor.number",
|
|
1258
|
+
editorProps: {
|
|
1259
|
+
min: 1
|
|
1260
|
+
},
|
|
1261
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
1262
|
+
showEditor: isTrellisEnabled2
|
|
1263
|
+
}
|
|
1264
|
+
],
|
|
1265
|
+
[
|
|
1266
|
+
{
|
|
1267
|
+
label: (0, i18n_exports._)("Min column width"),
|
|
1268
|
+
option: "trellisMinColumnWidth",
|
|
1269
|
+
editor: "editor.number",
|
|
1270
|
+
editorProps: {
|
|
1271
|
+
min: 1
|
|
1272
|
+
},
|
|
1273
|
+
showEditor: isTrellisEnabled2
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
label: (0, i18n_exports._)("Row height"),
|
|
1277
|
+
option: "trellisRowHeight",
|
|
1278
|
+
editor: "editor.number",
|
|
1279
|
+
editorProps: {
|
|
1280
|
+
min: 1
|
|
1281
|
+
},
|
|
1282
|
+
showEditor: isTrellisEnabled2
|
|
1283
|
+
}
|
|
1284
|
+
],
|
|
1285
|
+
[
|
|
1286
|
+
{
|
|
1287
|
+
label: (0, i18n_exports._)("Max number of components per page"),
|
|
1288
|
+
option: "trellisPageCount",
|
|
1289
|
+
editor: "editor.number",
|
|
1290
|
+
editorProps: {
|
|
1291
|
+
min: 1
|
|
1292
|
+
},
|
|
1293
|
+
showEditor: isTrellisEnabled2
|
|
1294
|
+
}
|
|
1295
|
+
]
|
|
1296
|
+
];
|
|
1297
|
+
var TimechartTrellisEditorConfig = [
|
|
1298
|
+
[
|
|
1299
|
+
{
|
|
1300
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
1301
|
+
option: "splitByLayout",
|
|
1302
|
+
editor: "editor.toggle",
|
|
1303
|
+
showEditor: isTrellisFeatureFlagOn2,
|
|
1304
|
+
// add help text for timecharts
|
|
1305
|
+
editorProps: {
|
|
1306
|
+
help: (0, i18n_exports._)(
|
|
1307
|
+
"Y2-axis and overlay field configurations are not supported when trellis is enabled."
|
|
1308
|
+
),
|
|
1309
|
+
helpFormat: "under"
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
],
|
|
1313
|
+
...TrellisEditorConfig.slice(1),
|
|
1314
|
+
[
|
|
1315
|
+
{
|
|
1316
|
+
label: (0, i18n_exports._)("Shared y-axis scale"),
|
|
1317
|
+
option: "trellisSharedScale",
|
|
1318
|
+
editor: "editor.checkbox",
|
|
1319
|
+
showEditor: isTrellisEnabled2
|
|
1320
|
+
}
|
|
1321
|
+
]
|
|
1322
|
+
];
|
|
1323
|
+
var TrellisBackgroundColorEditor = {
|
|
1324
|
+
label: (0, i18n_exports._)("Trellis background"),
|
|
1325
|
+
option: "trellisBackgroundColor",
|
|
1326
|
+
editor: "editor.color",
|
|
1327
|
+
showEditor: isTrellisEnabled2
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1121
1330
|
// src/common/editorConfig/AxesChartDataDisplay.ts
|
|
1122
|
-
var
|
|
1331
|
+
var isTrellisFeatureFlagOn3 = ({ featureFlags }) => {
|
|
1332
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
1333
|
+
};
|
|
1334
|
+
var isTrellisEnabled3 = ({ options, featureFlags }) => {
|
|
1335
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
1336
|
+
return isTrellisFeatureFlagOn3({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1337
|
+
};
|
|
1338
|
+
var AxesChartDataDisplayBase = {
|
|
1123
1339
|
label: (0, i18n_exports._)("Data display"),
|
|
1124
1340
|
layout: [
|
|
1341
|
+
[
|
|
1342
|
+
{
|
|
1343
|
+
label: (0, i18n_exports._)("Stack mode"),
|
|
1344
|
+
option: "stackMode",
|
|
1345
|
+
editor: "editor.select",
|
|
1346
|
+
editorProps: {
|
|
1347
|
+
values: [
|
|
1348
|
+
{ label: (0, i18n_exports._)("Not stacked"), value: "auto" },
|
|
1349
|
+
{ label: (0, i18n_exports._)("Stacked"), value: "stacked" },
|
|
1350
|
+
{ label: (0, i18n_exports._)("Stacked 100%"), value: "stacked100" }
|
|
1351
|
+
]
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
],
|
|
1125
1355
|
[
|
|
1126
1356
|
{
|
|
1127
1357
|
label: (0, i18n_exports._)("Null value display"),
|
|
@@ -1157,7 +1387,8 @@ var AxesChartDataDisplayLine = {
|
|
|
1157
1387
|
editor: "editor.columnMultiSelectionByFieldNameEditor",
|
|
1158
1388
|
editorProps: {
|
|
1159
1389
|
filterByTypes: ["number"]
|
|
1160
|
-
}
|
|
1390
|
+
},
|
|
1391
|
+
isDisabled: isTrellisEnabled3
|
|
1161
1392
|
}
|
|
1162
1393
|
],
|
|
1163
1394
|
[
|
|
@@ -1174,60 +1405,32 @@ var AxesChartDataDisplayLine = {
|
|
|
1174
1405
|
editor: "editor.checkbox",
|
|
1175
1406
|
showEditor: ({ options }) => options.showSplitSeries
|
|
1176
1407
|
}
|
|
1177
|
-
]
|
|
1178
|
-
]
|
|
1179
|
-
};
|
|
1180
|
-
var AxesChartDataDisplay = {
|
|
1181
|
-
label: AxesChartDataDisplayLine.label,
|
|
1182
|
-
layout: [
|
|
1183
|
-
[
|
|
1184
|
-
{
|
|
1185
|
-
label: (0, i18n_exports._)("Stack mode"),
|
|
1186
|
-
option: "stackMode",
|
|
1187
|
-
editor: "editor.select",
|
|
1188
|
-
editorProps: {
|
|
1189
|
-
values: [
|
|
1190
|
-
{ label: (0, i18n_exports._)("Not stacked"), value: "auto" },
|
|
1191
|
-
{ label: (0, i18n_exports._)("Stacked"), value: "stacked" },
|
|
1192
|
-
{ label: (0, i18n_exports._)("Stacked 100%"), value: "stacked100" }
|
|
1193
|
-
]
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
1408
|
],
|
|
1197
|
-
...
|
|
1409
|
+
...TimechartTrellisEditorConfig
|
|
1198
1410
|
]
|
|
1199
1411
|
};
|
|
1200
1412
|
var AxesChartDataDisplayBar = {
|
|
1201
|
-
label:
|
|
1413
|
+
label: AxesChartDataDisplayBase.label,
|
|
1202
1414
|
layout: [
|
|
1203
|
-
[
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
option: "stackMode",
|
|
1207
|
-
editor: "editor.select",
|
|
1208
|
-
editorProps: {
|
|
1209
|
-
values: [
|
|
1210
|
-
{ label: (0, i18n_exports._)("Not stacked"), value: "auto" },
|
|
1211
|
-
{ label: (0, i18n_exports._)("Stacked"), value: "stacked" },
|
|
1212
|
-
{ label: (0, i18n_exports._)("Stacked 100%"), value: "stacked100" }
|
|
1213
|
-
]
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
],
|
|
1217
|
-
// remove nullValueDisplay
|
|
1218
|
-
...(0, lodash_exports.drop)(AxesChartDataDisplayLine.layout)
|
|
1415
|
+
AxesChartDataDisplayBase.layout[0],
|
|
1416
|
+
// remove null value display editor at index 1
|
|
1417
|
+
...AxesChartDataDisplayBase.layout.slice(2)
|
|
1219
1418
|
]
|
|
1220
1419
|
};
|
|
1221
1420
|
var AxesChartDataDisplayColumn = {
|
|
1222
|
-
label:
|
|
1421
|
+
label: AxesChartDataDisplayBase.label,
|
|
1223
1422
|
layout: [
|
|
1224
|
-
|
|
1423
|
+
AxesChartDataDisplayBase.layout[0],
|
|
1424
|
+
// remove null value display and add data value display
|
|
1425
|
+
AxesChartDataDisplayBase.layout[2],
|
|
1426
|
+
[
|
|
1225
1427
|
{
|
|
1226
1428
|
label: (0, i18n_exports._)("Show tooltip on hover"),
|
|
1227
1429
|
option: "showTooltip",
|
|
1228
1430
|
editor: "editor.checkbox"
|
|
1229
1431
|
}
|
|
1230
|
-
]
|
|
1432
|
+
],
|
|
1433
|
+
...AxesChartDataDisplayBase.layout.slice(3),
|
|
1231
1434
|
[
|
|
1232
1435
|
{
|
|
1233
1436
|
label: (0, i18n_exports._)("Column grouping mode"),
|
|
@@ -1243,6 +1446,13 @@ var AxesChartDataDisplayColumn = {
|
|
|
1243
1446
|
]
|
|
1244
1447
|
]
|
|
1245
1448
|
};
|
|
1449
|
+
var AxesChartDataDisplayLine = {
|
|
1450
|
+
label: AxesChartDataDisplayBase.label,
|
|
1451
|
+
layout: [
|
|
1452
|
+
// remove stacked mode editor
|
|
1453
|
+
...AxesChartDataDisplayBase.layout.slice(1)
|
|
1454
|
+
]
|
|
1455
|
+
};
|
|
1246
1456
|
|
|
1247
1457
|
// src/common/editorConfig/AxesChartXGridAndLabels.ts
|
|
1248
1458
|
var AxesChartXGridAndLabelsCommon = {
|
|
@@ -1565,7 +1775,19 @@ var AxesChartColorAndStyle = {
|
|
|
1565
1775
|
]
|
|
1566
1776
|
]
|
|
1567
1777
|
};
|
|
1568
|
-
var
|
|
1778
|
+
var AreaAxesChartColorAndStyleWithTrellis = __spreadProps(__spreadValues({}, AxesChartColorAndStyle), {
|
|
1779
|
+
layout: [
|
|
1780
|
+
AxesChartColorAndStyle.layout[0],
|
|
1781
|
+
[
|
|
1782
|
+
__spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
|
|
1783
|
+
editorProps: {
|
|
1784
|
+
themes
|
|
1785
|
+
}
|
|
1786
|
+
})
|
|
1787
|
+
],
|
|
1788
|
+
...AxesChartColorAndStyle.layout.slice(1)
|
|
1789
|
+
]
|
|
1790
|
+
});
|
|
1569
1791
|
|
|
1570
1792
|
// src/common/editorConfig/AxesChartLegend.ts
|
|
1571
1793
|
var AxesChartLegend = {
|
|
@@ -1605,7 +1827,54 @@ var AxesChartLegend = {
|
|
|
1605
1827
|
]
|
|
1606
1828
|
]
|
|
1607
1829
|
};
|
|
1608
|
-
var
|
|
1830
|
+
var AxesChartLegendWithTrellisAndMode = ({
|
|
1831
|
+
showLegendTooltip = false,
|
|
1832
|
+
hideModeWhenOff = false
|
|
1833
|
+
}) => ({
|
|
1834
|
+
label: AxesChartLegend.label,
|
|
1835
|
+
layout: [
|
|
1836
|
+
[
|
|
1837
|
+
{
|
|
1838
|
+
label: (0, i18n_exports._)("Legend display"),
|
|
1839
|
+
option: "legendDisplay",
|
|
1840
|
+
editor: "editor.select",
|
|
1841
|
+
editorProps: {
|
|
1842
|
+
values: [
|
|
1843
|
+
{ label: (0, i18n_exports._)("Right"), value: "right" },
|
|
1844
|
+
{ label: (0, i18n_exports._)("Left"), value: "left" },
|
|
1845
|
+
{ label: (0, i18n_exports._)("Top"), value: "top" },
|
|
1846
|
+
{ label: (0, i18n_exports._)("Bottom"), value: "bottom" },
|
|
1847
|
+
{ label: (0, i18n_exports._)("Off"), value: "off" }
|
|
1848
|
+
],
|
|
1849
|
+
tooltip: showLegendTooltip && (0, i18n_exports._)('Legend mode must be "Standard" to configure legend display')
|
|
1850
|
+
},
|
|
1851
|
+
isDisabled: showLegendTooltip ? ({ options }) => options.legendMode === "seriesCompare" : void 0,
|
|
1852
|
+
overrideDefaultValue: ({ options }) => (options == null ? void 0 : options.splitByLayout) === "trellis" ? "off" : "right"
|
|
1853
|
+
}
|
|
1854
|
+
],
|
|
1855
|
+
[
|
|
1856
|
+
__spreadProps(__spreadValues({}, AxesChartLegend.layout[1][0]), {
|
|
1857
|
+
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
|
|
1858
|
+
options.legendDisplay === void 0 && options.splitByLayout !== "trellis"
|
|
1859
|
+
})
|
|
1860
|
+
],
|
|
1861
|
+
[
|
|
1862
|
+
{
|
|
1863
|
+
label: (0, i18n_exports._)("Legend mode"),
|
|
1864
|
+
option: "legendMode",
|
|
1865
|
+
editor: "editor.radioBar",
|
|
1866
|
+
editorProps: {
|
|
1867
|
+
values: [
|
|
1868
|
+
{ label: (0, i18n_exports._)("Standard"), value: "standard" },
|
|
1869
|
+
{ label: (0, i18n_exports._)("Compare series"), value: "seriesCompare" }
|
|
1870
|
+
]
|
|
1871
|
+
},
|
|
1872
|
+
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
|
|
1873
|
+
options.legendDisplay === void 0 && options.splitByLayout !== "trellis" : true
|
|
1874
|
+
}
|
|
1875
|
+
]
|
|
1876
|
+
]
|
|
1877
|
+
});
|
|
1609
1878
|
|
|
1610
1879
|
// src/common/editorConfig/AxesChartYGridAndLabels.ts
|
|
1611
1880
|
var AxesChartYGridAndLabels = {
|
|
@@ -1775,6 +2044,13 @@ var AxesChartYGridAndLabels = {
|
|
|
1775
2044
|
var AxesChartYGridAndLabels_default = AxesChartYGridAndLabels;
|
|
1776
2045
|
|
|
1777
2046
|
// src/common/editorConfig/AxesChartY2GridAndLabels.ts
|
|
2047
|
+
var isTrellisFeatureFlagOn4 = ({ featureFlags }) => {
|
|
2048
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
2049
|
+
};
|
|
2050
|
+
var isTrellisOff = ({ options, featureFlags }) => {
|
|
2051
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
2052
|
+
return !isTrellisFeatureFlagOn4({ featureFlags }) || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2053
|
+
};
|
|
1778
2054
|
var axesChartY2GridAndLabels = {
|
|
1779
2055
|
label: (0, i18n_exports._)("Y2-axis grid and labels"),
|
|
1780
2056
|
layout: [
|
|
@@ -1782,15 +2058,16 @@ var axesChartY2GridAndLabels = {
|
|
|
1782
2058
|
{
|
|
1783
2059
|
label: (0, i18n_exports._)("Axis title"),
|
|
1784
2060
|
option: "y2AxisTitleVisibility",
|
|
1785
|
-
editor: "editor.toggle"
|
|
2061
|
+
editor: "editor.toggle",
|
|
2062
|
+
showEditor: isTrellisOff
|
|
1786
2063
|
}
|
|
1787
2064
|
],
|
|
1788
2065
|
[
|
|
1789
2066
|
{
|
|
1790
|
-
label: (0, i18n_exports._)("Axis title"),
|
|
2067
|
+
label: (0, i18n_exports._)("Axis title text"),
|
|
1791
2068
|
option: "y2AxisTitleText",
|
|
1792
2069
|
editor: "editor.text",
|
|
1793
|
-
showEditor: ({ options }) => options.y2AxisTitleVisibility === "show" || options.y2AxisTitleVisibility === void 0
|
|
2070
|
+
showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisTitleVisibility === "show" || options.y2AxisTitleVisibility === void 0)
|
|
1794
2071
|
}
|
|
1795
2072
|
],
|
|
1796
2073
|
[
|
|
@@ -1798,7 +2075,7 @@ var axesChartY2GridAndLabels = {
|
|
|
1798
2075
|
label: (0, i18n_exports._)("Show overlays on the y2-axis"),
|
|
1799
2076
|
option: "showOverlayY2Axis",
|
|
1800
2077
|
editor: "editor.checkbox",
|
|
1801
|
-
showEditor: ({ options }) => Array.isArray(options.overlayFields) && options.overlayFields.length > 0
|
|
2078
|
+
showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && Array.isArray(options.overlayFields) && options.overlayFields.length > 0
|
|
1802
2079
|
}
|
|
1803
2080
|
],
|
|
1804
2081
|
[
|
|
@@ -1811,7 +2088,8 @@ var axesChartY2GridAndLabels = {
|
|
|
1811
2088
|
{ label: (0, i18n_exports._)("Linear"), value: "linear" },
|
|
1812
2089
|
{ label: (0, i18n_exports._)("Log"), value: "log" }
|
|
1813
2090
|
]
|
|
1814
|
-
}
|
|
2091
|
+
},
|
|
2092
|
+
showEditor: isTrellisOff
|
|
1815
2093
|
}
|
|
1816
2094
|
],
|
|
1817
2095
|
[
|
|
@@ -1825,7 +2103,8 @@ var axesChartY2GridAndLabels = {
|
|
|
1825
2103
|
{ label: (0, i18n_exports._)("Show"), value: "show" },
|
|
1826
2104
|
{ label: (0, i18n_exports._)("Hide"), value: "hide" }
|
|
1827
2105
|
]
|
|
1828
|
-
}
|
|
2106
|
+
},
|
|
2107
|
+
showEditor: isTrellisOff
|
|
1829
2108
|
}
|
|
1830
2109
|
],
|
|
1831
2110
|
[
|
|
@@ -1833,7 +2112,7 @@ var axesChartY2GridAndLabels = {
|
|
|
1833
2112
|
label: (0, i18n_exports._)("Round axis labels"),
|
|
1834
2113
|
option: "showRoundedY2AxisLabels",
|
|
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
|
[
|
|
@@ -1841,40 +2120,45 @@ var axesChartY2GridAndLabels = {
|
|
|
1841
2120
|
label: (0, i18n_exports._)("SI prefix abbreviation for labels"),
|
|
1842
2121
|
option: "y2AxisAbbreviation",
|
|
1843
2122
|
editor: "editor.checkbox",
|
|
1844
|
-
showEditor: ({ options }) => options.y2AxisLabelVisibility === "show" || options.y2AxisLabelVisibility === "auto" || options.y2AxisLabelVisibility === void 0
|
|
2123
|
+
showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisLabelVisibility === "show" || options.y2AxisLabelVisibility === "auto" || options.y2AxisLabelVisibility === void 0)
|
|
1845
2124
|
}
|
|
1846
2125
|
],
|
|
1847
2126
|
[
|
|
1848
2127
|
{
|
|
1849
2128
|
label: (0, i18n_exports._)("Include zero"),
|
|
1850
2129
|
option: "showY2AxisWithZero",
|
|
1851
|
-
editor: "editor.checkbox"
|
|
2130
|
+
editor: "editor.checkbox",
|
|
2131
|
+
showEditor: isTrellisOff
|
|
1852
2132
|
}
|
|
1853
2133
|
],
|
|
1854
2134
|
[
|
|
1855
2135
|
{
|
|
1856
2136
|
label: (0, i18n_exports._)("Minimum axis value"),
|
|
1857
2137
|
option: "y2AxisMin",
|
|
1858
|
-
editor: "editor.number"
|
|
2138
|
+
editor: "editor.number",
|
|
2139
|
+
showEditor: isTrellisOff
|
|
1859
2140
|
},
|
|
1860
2141
|
{
|
|
1861
2142
|
label: (0, i18n_exports._)("Maximum axis value"),
|
|
1862
2143
|
option: "y2AxisMax",
|
|
1863
|
-
editor: "editor.number"
|
|
2144
|
+
editor: "editor.number",
|
|
2145
|
+
showEditor: isTrellisOff
|
|
1864
2146
|
}
|
|
1865
2147
|
],
|
|
1866
2148
|
[
|
|
1867
2149
|
{
|
|
1868
2150
|
label: (0, i18n_exports._)("Axis line visibility"),
|
|
1869
2151
|
option: "y2AxisLineVisibility",
|
|
1870
|
-
editor: "editor.checkbox"
|
|
2152
|
+
editor: "editor.checkbox",
|
|
2153
|
+
showEditor: isTrellisOff
|
|
1871
2154
|
}
|
|
1872
2155
|
],
|
|
1873
2156
|
[
|
|
1874
2157
|
{
|
|
1875
2158
|
label: (0, i18n_exports._)("Major gridlines"),
|
|
1876
2159
|
option: "showY2MajorGridLines",
|
|
1877
|
-
editor: "editor.checkbox"
|
|
2160
|
+
editor: "editor.checkbox",
|
|
2161
|
+
showEditor: isTrellisOff
|
|
1878
2162
|
}
|
|
1879
2163
|
],
|
|
1880
2164
|
[
|
|
@@ -1888,7 +2172,8 @@ var axesChartY2GridAndLabels = {
|
|
|
1888
2172
|
{ label: (0, i18n_exports._)("Show"), value: "show" },
|
|
1889
2173
|
{ label: (0, i18n_exports._)("Hide"), value: "hide" }
|
|
1890
2174
|
]
|
|
1891
|
-
}
|
|
2175
|
+
},
|
|
2176
|
+
showEditor: isTrellisOff
|
|
1892
2177
|
}
|
|
1893
2178
|
],
|
|
1894
2179
|
[
|
|
@@ -1901,7 +2186,7 @@ var axesChartY2GridAndLabels = {
|
|
|
1901
2186
|
max: 10,
|
|
1902
2187
|
step: 1
|
|
1903
2188
|
},
|
|
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
|
[
|
|
@@ -1909,14 +2194,15 @@ var axesChartY2GridAndLabels = {
|
|
|
1909
2194
|
label: (0, i18n_exports._)("Major tick interval spacing"),
|
|
1910
2195
|
option: "y2AxisMajorTickInterval",
|
|
1911
2196
|
editor: "editor.number",
|
|
1912
|
-
showEditor: ({ options }) => options.y2AxisMajorTickVisibility === "show" || options.y2AxisMajorTickVisibility === "auto" || options.y2AxisMajorTickVisibility === void 0
|
|
2197
|
+
showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisMajorTickVisibility === "show" || options.y2AxisMajorTickVisibility === "auto" || options.y2AxisMajorTickVisibility === void 0)
|
|
1913
2198
|
}
|
|
1914
2199
|
],
|
|
1915
2200
|
[
|
|
1916
2201
|
{
|
|
1917
2202
|
label: (0, i18n_exports._)("Minor gridlines"),
|
|
1918
2203
|
option: "showY2MinorGridLines",
|
|
1919
|
-
editor: "editor.checkbox"
|
|
2204
|
+
editor: "editor.checkbox",
|
|
2205
|
+
showEditor: isTrellisOff
|
|
1920
2206
|
}
|
|
1921
2207
|
],
|
|
1922
2208
|
[
|
|
@@ -1930,7 +2216,8 @@ var axesChartY2GridAndLabels = {
|
|
|
1930
2216
|
{ label: (0, i18n_exports._)("Show"), value: "show" },
|
|
1931
2217
|
{ label: (0, i18n_exports._)("Hide"), value: "hide" }
|
|
1932
2218
|
]
|
|
1933
|
-
}
|
|
2219
|
+
},
|
|
2220
|
+
showEditor: isTrellisOff
|
|
1934
2221
|
}
|
|
1935
2222
|
],
|
|
1936
2223
|
[
|
|
@@ -1943,7 +2230,7 @@ var axesChartY2GridAndLabels = {
|
|
|
1943
2230
|
max: 10,
|
|
1944
2231
|
step: 1
|
|
1945
2232
|
},
|
|
1946
|
-
showEditor: ({ options }) => options.y2AxisMinorTickVisibility === "show" || options.y2AxisMinorTickVisibility === "auto" || options.y2AxisMinorTickVisibility === void 0
|
|
2233
|
+
showEditor: ({ options, featureFlags }) => isTrellisOff({ options, featureFlags }) && (options.y2AxisMinorTickVisibility === "show" || options.y2AxisMinorTickVisibility === "auto" || options.y2AxisMinorTickVisibility === void 0)
|
|
1947
2234
|
}
|
|
1948
2235
|
]
|
|
1949
2236
|
]
|
|
@@ -1981,29 +2268,22 @@ var themes2 = {
|
|
|
1981
2268
|
light: variables_default.backgroundColor(props)
|
|
1982
2269
|
},
|
|
1983
2270
|
prisma: variables_default.backgroundColorSidebar(props)
|
|
2271
|
+
})(props),
|
|
2272
|
+
defaultFontColor: (props) => pick_default({
|
|
2273
|
+
enterprise: {
|
|
2274
|
+
dark: variables_default.textColor(props),
|
|
2275
|
+
light: variables_default.textColor(props)
|
|
2276
|
+
},
|
|
2277
|
+
prisma: variables_default.contentColorDefault(props)
|
|
1984
2278
|
})(props)
|
|
1985
2279
|
};
|
|
1986
|
-
var updatedAxesChartLegend = (0, lodash_exports.cloneDeep)(AxesChartLegend_default);
|
|
1987
|
-
updatedAxesChartLegend.layout.push([
|
|
1988
|
-
{
|
|
1989
|
-
label: (0, i18n_exports._)("Legend mode"),
|
|
1990
|
-
option: "legendMode",
|
|
1991
|
-
editor: "editor.radioBar",
|
|
1992
|
-
editorProps: {
|
|
1993
|
-
values: [
|
|
1994
|
-
{ label: (0, i18n_exports._)("Standard"), value: "standard" },
|
|
1995
|
-
{ label: (0, i18n_exports._)("Compare series"), value: "seriesCompare" }
|
|
1996
|
-
]
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
]);
|
|
2000
2280
|
var editorConfig = [
|
|
2001
2281
|
AxesChartDataConfigBar,
|
|
2002
2282
|
AxesChartDataDisplayBar,
|
|
2003
2283
|
{
|
|
2004
|
-
label:
|
|
2284
|
+
label: AreaAxesChartColorAndStyleWithTrellis.label,
|
|
2005
2285
|
layout: [
|
|
2006
|
-
...
|
|
2286
|
+
...AreaAxesChartColorAndStyleWithTrellis.layout,
|
|
2007
2287
|
[
|
|
2008
2288
|
{
|
|
2009
2289
|
label: (0, i18n_exports._)("Line width"),
|
|
@@ -2033,7 +2313,7 @@ var editorConfig = [
|
|
|
2033
2313
|
]
|
|
2034
2314
|
]
|
|
2035
2315
|
},
|
|
2036
|
-
|
|
2316
|
+
AxesChartLegendWithTrellisAndMode({ showLegendTooltip: false }),
|
|
2037
2317
|
{
|
|
2038
2318
|
label: (0, i18n_exports._)("X-axis grid and labels (vertical axis)"),
|
|
2039
2319
|
layout: [
|
|
@@ -2131,7 +2411,7 @@ var config = {
|
|
|
2131
2411
|
description: "triggered when user moves out of a data point"
|
|
2132
2412
|
}
|
|
2133
2413
|
},
|
|
2134
|
-
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "events" /* EVENTS */],
|
|
2414
|
+
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "events" /* EVENTS */, "trellis" /* TRELLIS */],
|
|
2135
2415
|
themes: themes2
|
|
2136
2416
|
};
|
|
2137
2417
|
var config_default = enhanceConfig(config);
|
|
@@ -2141,45 +2421,36 @@ var getSettingsFromThemedProps_exports = {};
|
|
|
2141
2421
|
__export(getSettingsFromThemedProps_exports, {
|
|
2142
2422
|
default: () => getSettingsFromThemedProps_default
|
|
2143
2423
|
});
|
|
2144
|
-
var
|
|
2424
|
+
var defaultImport24 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
|
|
2145
2425
|
__reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
|
|
2146
|
-
var getSettingsFromThemedProps_default = "default" in
|
|
2426
|
+
var getSettingsFromThemedProps_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
|
|
2147
2427
|
|
|
2148
2428
|
// esm-externals:@splunk/visualization-encoding/Options
|
|
2149
2429
|
var Options_exports = {};
|
|
2150
2430
|
__export(Options_exports, {
|
|
2151
2431
|
default: () => Options_default
|
|
2152
2432
|
});
|
|
2153
|
-
var
|
|
2433
|
+
var defaultImport25 = __toESM(require("@splunk/visualization-encoding/Options"));
|
|
2154
2434
|
__reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
|
|
2155
|
-
var Options_default = "default" in
|
|
2435
|
+
var Options_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
|
|
2156
2436
|
|
|
2157
2437
|
// esm-externals:@splunk/visualizations-shared/SanitizeProps
|
|
2158
2438
|
var SanitizeProps_exports = {};
|
|
2159
2439
|
__export(SanitizeProps_exports, {
|
|
2160
2440
|
default: () => SanitizeProps_default
|
|
2161
2441
|
});
|
|
2162
|
-
var
|
|
2442
|
+
var defaultImport26 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
|
|
2163
2443
|
__reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
|
|
2164
|
-
var SanitizeProps_default = "default" in
|
|
2444
|
+
var SanitizeProps_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
|
|
2165
2445
|
|
|
2166
2446
|
// esm-externals:@splunk/moment
|
|
2167
2447
|
var moment_exports = {};
|
|
2168
2448
|
__export(moment_exports, {
|
|
2169
2449
|
default: () => moment_default
|
|
2170
2450
|
});
|
|
2171
|
-
var
|
|
2451
|
+
var defaultImport27 = __toESM(require("@splunk/moment"));
|
|
2172
2452
|
__reExport(moment_exports, require("@splunk/moment"));
|
|
2173
|
-
var moment_default = "default" in
|
|
2174
|
-
|
|
2175
|
-
// esm-externals:@splunk/visualization-context/FeatureFlagContext
|
|
2176
|
-
var FeatureFlagContext_exports = {};
|
|
2177
|
-
__export(FeatureFlagContext_exports, {
|
|
2178
|
-
default: () => FeatureFlagContext_default
|
|
2179
|
-
});
|
|
2180
|
-
var defaultImport27 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
|
|
2181
|
-
__reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
|
|
2182
|
-
var FeatureFlagContext_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
|
|
2453
|
+
var moment_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
|
|
2183
2454
|
|
|
2184
2455
|
// esm-externals:@splunk/visualizations-shared/hocUtils
|
|
2185
2456
|
var hocUtils_exports = {};
|
|
@@ -2469,7 +2740,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
2469
2740
|
FixSizeItem,
|
|
2470
2741
|
{
|
|
2471
2742
|
"data-test": "fix-size-item",
|
|
2472
|
-
"data-splunk-visualization-version": "27.
|
|
2743
|
+
"data-splunk-visualization-version": "27.1.0 - fe8b048df",
|
|
2473
2744
|
width,
|
|
2474
2745
|
height,
|
|
2475
2746
|
backgroundColor
|
|
@@ -2535,7 +2806,7 @@ var Cover = styled_components_default.div`
|
|
|
2535
2806
|
bottom: 0;
|
|
2536
2807
|
`;
|
|
2537
2808
|
var Blocker = styled_components_default.div.attrs({
|
|
2538
|
-
"data-splunk-visualization-version": "27.
|
|
2809
|
+
"data-splunk-visualization-version": "27.1.0 - fe8b048df"
|
|
2539
2810
|
})`
|
|
2540
2811
|
position: relative;
|
|
2541
2812
|
width: 100%;
|
|
@@ -2797,6 +3068,350 @@ var getFeatureFlag = (context, flagName) => {
|
|
|
2797
3068
|
return false;
|
|
2798
3069
|
};
|
|
2799
3070
|
|
|
3071
|
+
// esm-externals:@splunk/visualizations-shared/trellisUtils
|
|
3072
|
+
var trellisUtils_exports = {};
|
|
3073
|
+
__export(trellisUtils_exports, {
|
|
3074
|
+
default: () => trellisUtils_default
|
|
3075
|
+
});
|
|
3076
|
+
var defaultImport35 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
|
|
3077
|
+
__reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
|
|
3078
|
+
var trellisUtils_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
|
|
3079
|
+
|
|
3080
|
+
// src/common/utils/trellisUtils.ts
|
|
3081
|
+
var AGGREGATIONS = "aggregations";
|
|
3082
|
+
var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
3083
|
+
var _a, _b, _c, _d;
|
|
3084
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3085
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3086
|
+
let splitDataSources = null;
|
|
3087
|
+
let errorCode = null;
|
|
3088
|
+
if (fields && fields.length) {
|
|
3089
|
+
splitDataSources = {};
|
|
3090
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
3091
|
+
const fieldName = fields[i].name;
|
|
3092
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
3093
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
3094
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3095
|
+
);
|
|
3096
|
+
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
3097
|
+
splitDataSources[fieldName].primary.data.columns = [columns[i]];
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
} else {
|
|
3101
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3102
|
+
}
|
|
3103
|
+
return { splitDataSources, errorCode };
|
|
3104
|
+
};
|
|
3105
|
+
var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
3106
|
+
var _a, _b, _c, _d;
|
|
3107
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3108
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3109
|
+
let splitDataSources = null;
|
|
3110
|
+
let splitByFields = [];
|
|
3111
|
+
let errorCode = null;
|
|
3112
|
+
if (typeof fields[0] !== "string") {
|
|
3113
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3114
|
+
}
|
|
3115
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
3116
|
+
splitDataSources = {};
|
|
3117
|
+
splitByFields.forEach((splitByField) => {
|
|
3118
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
3119
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3120
|
+
);
|
|
3121
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
3122
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
3123
|
+
fields.forEach((field, idx) => {
|
|
3124
|
+
const fieldName = field == null ? void 0 : field.name;
|
|
3125
|
+
if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
|
|
3126
|
+
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
3127
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
3128
|
+
}
|
|
3129
|
+
});
|
|
3130
|
+
});
|
|
3131
|
+
} else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
|
|
3132
|
+
splitDataSources = {};
|
|
3133
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3134
|
+
const fieldName = fields[i].name;
|
|
3135
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
3136
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
3137
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3138
|
+
);
|
|
3139
|
+
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
3140
|
+
splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
} else {
|
|
3144
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3145
|
+
}
|
|
3146
|
+
return { splitDataSources, errorCode };
|
|
3147
|
+
};
|
|
3148
|
+
var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
3149
|
+
var _a, _b, _c, _d;
|
|
3150
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3151
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3152
|
+
let splitDataSources = null;
|
|
3153
|
+
let splitByFields = [];
|
|
3154
|
+
let errorCode = null;
|
|
3155
|
+
if (typeof fields[0] !== "string") {
|
|
3156
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
3157
|
+
}
|
|
3158
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
3159
|
+
splitDataSources = {};
|
|
3160
|
+
splitByFields.forEach((splitByField) => {
|
|
3161
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
3162
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3163
|
+
);
|
|
3164
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
3165
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
3166
|
+
const idx = fields.findIndex((field) => field.name === splitByField);
|
|
3167
|
+
if (idx > 0) {
|
|
3168
|
+
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
3169
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
3170
|
+
}
|
|
3171
|
+
});
|
|
3172
|
+
} else {
|
|
3173
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3174
|
+
}
|
|
3175
|
+
return { splitDataSources, errorCode };
|
|
3176
|
+
};
|
|
3177
|
+
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
3178
|
+
var _a, _b, _c, _d, _e;
|
|
3179
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3180
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3181
|
+
let splitDataSources = null;
|
|
3182
|
+
let splitByFields = [];
|
|
3183
|
+
let errorCode = null;
|
|
3184
|
+
if (typeof fields[0] !== "string") {
|
|
3185
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3186
|
+
}
|
|
3187
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3188
|
+
splitDataSources = {};
|
|
3189
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3190
|
+
const valueKeys = [];
|
|
3191
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3192
|
+
if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
|
|
3193
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
valueKeys.forEach((val) => {
|
|
3197
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3198
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3199
|
+
);
|
|
3200
|
+
splitDataSources[val].primary.data.fields = [
|
|
3201
|
+
{ name: fields[0].name },
|
|
3202
|
+
...dataSourceKeys.map((k) => ({
|
|
3203
|
+
name: k
|
|
3204
|
+
}))
|
|
3205
|
+
];
|
|
3206
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3207
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
3208
|
+
fields.forEach((field, idx) => {
|
|
3209
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3210
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3211
|
+
}
|
|
3212
|
+
});
|
|
3213
|
+
});
|
|
3214
|
+
});
|
|
3215
|
+
} else {
|
|
3216
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3217
|
+
}
|
|
3218
|
+
return { splitDataSources, errorCode };
|
|
3219
|
+
};
|
|
3220
|
+
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
3221
|
+
var _a, _b, _c, _d;
|
|
3222
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3223
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3224
|
+
let splitDataSources = null;
|
|
3225
|
+
let splitByFields = [];
|
|
3226
|
+
let errorCode = null;
|
|
3227
|
+
if (typeof fields[0] !== "string") {
|
|
3228
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3229
|
+
}
|
|
3230
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3231
|
+
splitDataSources = {};
|
|
3232
|
+
const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
|
|
3233
|
+
const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
|
|
3234
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3235
|
+
const nonDataSourceAggregations = [];
|
|
3236
|
+
if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
|
|
3237
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3238
|
+
nonDataSourceAggregations.push(fields[i].name);
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
if (splitByFieldIdx === 0) {
|
|
3242
|
+
const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
|
|
3243
|
+
valueKeys.forEach((val, idx) => {
|
|
3244
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3245
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3246
|
+
);
|
|
3247
|
+
splitDataSources[val].primary.data.fields = [];
|
|
3248
|
+
if (otherSplitBy.length) {
|
|
3249
|
+
splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
|
|
3250
|
+
}
|
|
3251
|
+
if (dataSourceKeys.length) {
|
|
3252
|
+
const columnValues = [[]];
|
|
3253
|
+
splitDataSources[val].primary.data.fields = [
|
|
3254
|
+
...splitDataSources[val].primary.data.fields,
|
|
3255
|
+
...dataSourceKeys.map((k) => ({
|
|
3256
|
+
name: k
|
|
3257
|
+
}))
|
|
3258
|
+
];
|
|
3259
|
+
dataSourceKeys.forEach(() => {
|
|
3260
|
+
columnValues.push([]);
|
|
3261
|
+
});
|
|
3262
|
+
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
3263
|
+
columnValues[0].push(
|
|
3264
|
+
fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
|
|
3265
|
+
);
|
|
3266
|
+
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
3267
|
+
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
3268
|
+
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3271
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
3272
|
+
} else if (nonDataSourceAggregations.length) {
|
|
3273
|
+
const columnValues = [];
|
|
3274
|
+
fields.forEach((aggregationField, fieldIdx) => {
|
|
3275
|
+
if (fieldIdx > 0) {
|
|
3276
|
+
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
3277
|
+
columnValues.push([columns[fieldIdx][idx]]);
|
|
3278
|
+
}
|
|
3279
|
+
});
|
|
3280
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
3281
|
+
}
|
|
3282
|
+
});
|
|
3283
|
+
} else {
|
|
3284
|
+
const valueKeys = [];
|
|
3285
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3286
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3287
|
+
}
|
|
3288
|
+
valueKeys.forEach((val) => {
|
|
3289
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3290
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3291
|
+
);
|
|
3292
|
+
splitDataSources[val].primary.data.fields = [
|
|
3293
|
+
{ name: otherSplitBy[0] },
|
|
3294
|
+
...dataSourceKeys.map((k) => ({
|
|
3295
|
+
name: k
|
|
3296
|
+
}))
|
|
3297
|
+
];
|
|
3298
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3299
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
3300
|
+
fields.forEach((field, idx) => {
|
|
3301
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3302
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3303
|
+
}
|
|
3304
|
+
});
|
|
3305
|
+
});
|
|
3306
|
+
});
|
|
3307
|
+
}
|
|
3308
|
+
} else {
|
|
3309
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3310
|
+
}
|
|
3311
|
+
return { splitDataSources, errorCode };
|
|
3312
|
+
};
|
|
3313
|
+
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
3314
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3315
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3316
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3317
|
+
let splitDataSources = null;
|
|
3318
|
+
let splitByFields = [];
|
|
3319
|
+
let errorCode = null;
|
|
3320
|
+
if (typeof fields[0] !== "string") {
|
|
3321
|
+
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
3322
|
+
}
|
|
3323
|
+
const splitByIndex = fields == null ? void 0 : fields.findIndex(
|
|
3324
|
+
(field) => field === splitBy || field.name === splitBy
|
|
3325
|
+
);
|
|
3326
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3327
|
+
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
3328
|
+
splitDataSources = {};
|
|
3329
|
+
splitByColumn.forEach((val, idx) => {
|
|
3330
|
+
if (!splitDataSources[val]) {
|
|
3331
|
+
splitDataSources[val] = [idx];
|
|
3332
|
+
} else {
|
|
3333
|
+
splitDataSources[val].push(idx);
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
const cloneFields = (0, lodash_exports.cloneDeep)(fields);
|
|
3337
|
+
cloneFields.splice(splitByIndex, 1);
|
|
3338
|
+
const valueKeys = Object.keys(splitDataSources);
|
|
3339
|
+
valueKeys.forEach((val) => {
|
|
3340
|
+
const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
|
|
3341
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3342
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3343
|
+
);
|
|
3344
|
+
splitDataSources[val].primary.data.fields = cloneFields;
|
|
3345
|
+
splitDataSources[val].primary.data.columns = [];
|
|
3346
|
+
columns.forEach((col, idx) => {
|
|
3347
|
+
if (idx !== splitByIndex) {
|
|
3348
|
+
const newCol = valIndices.map((valIdx) => col[valIdx]);
|
|
3349
|
+
splitDataSources[val].primary.data.columns.push(newCol);
|
|
3350
|
+
}
|
|
3351
|
+
});
|
|
3352
|
+
});
|
|
3353
|
+
} else {
|
|
3354
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3355
|
+
}
|
|
3356
|
+
return { splitDataSources, errorCode };
|
|
3357
|
+
};
|
|
3358
|
+
var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
|
|
3359
|
+
let result = null;
|
|
3360
|
+
try {
|
|
3361
|
+
if (splitMode === trellisUtils_exports.TIMECHART) {
|
|
3362
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
|
|
3363
|
+
} else if (splitMode === trellisUtils_exports.STATS) {
|
|
3364
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
|
|
3365
|
+
} else if (splitMode === trellisUtils_exports.CHART) {
|
|
3366
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
|
|
3367
|
+
} else if (splitMode === trellisUtils_exports.UNKNOWN) {
|
|
3368
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
|
|
3369
|
+
}
|
|
3370
|
+
} catch (ex) {
|
|
3371
|
+
console.error("getTrellisDataSourcesBySplitMode ", ex);
|
|
3372
|
+
result = { splitDataSources: null, errorCode: "UNKNOWN" };
|
|
3373
|
+
}
|
|
3374
|
+
return result;
|
|
3375
|
+
};
|
|
3376
|
+
var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
|
|
3377
|
+
if (isTrellisOn && !options.legendDisplay) {
|
|
3378
|
+
return {
|
|
3379
|
+
legendDisplay: "off"
|
|
3380
|
+
};
|
|
3381
|
+
}
|
|
3382
|
+
return {};
|
|
3383
|
+
};
|
|
3384
|
+
var calculateSharedMinMax = (splitData) => {
|
|
3385
|
+
let max = -Infinity;
|
|
3386
|
+
let min = Infinity;
|
|
3387
|
+
Object.keys(splitData).forEach((splitByKey) => {
|
|
3388
|
+
const datasources = splitData[splitByKey];
|
|
3389
|
+
Object.keys(datasources).forEach((datasourceName) => {
|
|
3390
|
+
const dataColumns = datasources[datasourceName].data.columns;
|
|
3391
|
+
dataColumns.forEach((column) => {
|
|
3392
|
+
column.forEach((point) => {
|
|
3393
|
+
const pointNumber = Number(point);
|
|
3394
|
+
if (pointNumber > max) {
|
|
3395
|
+
max = pointNumber;
|
|
3396
|
+
}
|
|
3397
|
+
if (pointNumber < min) {
|
|
3398
|
+
min = pointNumber;
|
|
3399
|
+
}
|
|
3400
|
+
});
|
|
3401
|
+
});
|
|
3402
|
+
});
|
|
3403
|
+
});
|
|
3404
|
+
return [min, max];
|
|
3405
|
+
};
|
|
3406
|
+
var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
|
|
3407
|
+
if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
|
|
3408
|
+
return [yAxisMin, yAxisMax];
|
|
3409
|
+
const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
|
|
3410
|
+
const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
|
|
3411
|
+
const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
|
|
3412
|
+
return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
|
|
3413
|
+
};
|
|
3414
|
+
|
|
2800
3415
|
// src/common/withDashboardViz.tsx
|
|
2801
3416
|
var withDashboardViz = (opts) => {
|
|
2802
3417
|
const {
|
|
@@ -2804,6 +3419,8 @@ var withDashboardViz = (opts) => {
|
|
|
2804
3419
|
vizConfig,
|
|
2805
3420
|
computeVizProps: computeVizProps2 = () => {
|
|
2806
3421
|
},
|
|
3422
|
+
computeVizPropsBeforeEval = () => {
|
|
3423
|
+
},
|
|
2807
3424
|
disableEditModeCover,
|
|
2808
3425
|
useIconPlaceholder
|
|
2809
3426
|
} = opts;
|
|
@@ -2853,14 +3470,26 @@ var withDashboardViz = (opts) => {
|
|
|
2853
3470
|
const isDownsamplingEnabledByFeatureFlag = Boolean(
|
|
2854
3471
|
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
|
|
2855
3472
|
);
|
|
3473
|
+
const isTrellisFeatureFlagOn5 = Boolean(
|
|
3474
|
+
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3475
|
+
);
|
|
3476
|
+
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 */;
|
|
2856
3477
|
const isMounted = react_exports.useRef(true);
|
|
2857
|
-
const optionsToEvaluate = react_exports.useMemo(
|
|
2858
|
-
|
|
3478
|
+
const optionsToEvaluate = react_exports.useMemo(() => {
|
|
3479
|
+
var _a2;
|
|
3480
|
+
const legendDisplay = turnOffLegendDisplayWhenTrellisIsOn(isTrellisOn, options);
|
|
3481
|
+
const computedOptions = (_a2 = computeVizPropsBeforeEval(options)) != null ? _a2 : {};
|
|
3482
|
+
return {
|
|
2859
3483
|
context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2860
|
-
options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
3484
|
+
options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
|
|
3485
|
+
{},
|
|
3486
|
+
legendDisplay,
|
|
3487
|
+
computedOptions,
|
|
3488
|
+
options,
|
|
3489
|
+
defaultOptions
|
|
3490
|
+
)
|
|
3491
|
+
};
|
|
3492
|
+
}, [isTrellisOn, options, context]);
|
|
2864
3493
|
const [threshold, setThreshold] = react_exports.useState(Number(width));
|
|
2865
3494
|
const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
|
|
2866
3495
|
setThreshold(newThreshold);
|
|
@@ -2941,11 +3570,8 @@ var withDashboardViz = (opts) => {
|
|
|
2941
3570
|
useAsyncEvaluatedOptions
|
|
2942
3571
|
]);
|
|
2943
3572
|
const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
2944
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2945
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2946
|
-
);
|
|
2947
3573
|
let clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2948
|
-
if (
|
|
3574
|
+
if (isTrellisOn) {
|
|
2949
3575
|
clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
|
|
2950
3576
|
backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2951
3577
|
});
|
|
@@ -3056,9 +3682,9 @@ var propUtils_exports = {};
|
|
|
3056
3682
|
__export(propUtils_exports, {
|
|
3057
3683
|
default: () => propUtils_default
|
|
3058
3684
|
});
|
|
3059
|
-
var
|
|
3685
|
+
var defaultImport36 = __toESM(require("@splunk/visualizations-shared/propUtils"));
|
|
3060
3686
|
__reExport(propUtils_exports, require("@splunk/visualizations-shared/propUtils"));
|
|
3061
|
-
var propUtils_default = "default" in
|
|
3687
|
+
var propUtils_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
|
|
3062
3688
|
|
|
3063
3689
|
// src/common/chartingUtils.ts
|
|
3064
3690
|
var truncateData = (dataSet, truncationLimit) => {
|
|
@@ -3165,7 +3791,8 @@ var barOptionsSCMapping = {
|
|
|
3165
3791
|
seriesColorsByField: "fieldColors",
|
|
3166
3792
|
xAxisLineVisibility: "xAxisVisibility",
|
|
3167
3793
|
yAxisLineVisibility: "yAxisVisibility",
|
|
3168
|
-
y2AxisLineVisibility: "y2AxisVisibility"
|
|
3794
|
+
y2AxisLineVisibility: "y2AxisVisibility",
|
|
3795
|
+
lineDashStylesByField: "fieldDashStyles"
|
|
3169
3796
|
};
|
|
3170
3797
|
var barOptionValuesSCMapping = {
|
|
3171
3798
|
xAxisTitleVisibility: {
|
|
@@ -3202,13 +3829,265 @@ var barOptionValuesSCMapping = {
|
|
|
3202
3829
|
var convertToStringValues = (options) => {
|
|
3203
3830
|
const updatedOptions = (0, propUtils_exports.convertPropsToString)({
|
|
3204
3831
|
vizProps: options,
|
|
3205
|
-
propNames: ["seriesColors", "fieldColors", "legendLabels"]
|
|
3832
|
+
propNames: ["seriesColors", "fieldColors", "legendLabels", "fieldDashStyles"]
|
|
3206
3833
|
});
|
|
3207
3834
|
return __spreadValues(__spreadValues({}, options), updatedOptions);
|
|
3208
3835
|
};
|
|
3209
3836
|
var mapToOldKey = (options) => (0, lodash_exports.mapKeys)(options, (val, key) => barOptionsSCMapping[key] ? barOptionsSCMapping[key] : key);
|
|
3210
3837
|
var convertToBarSCProperties = (originalOptions) => (0, lodash_exports.chain)(mapToOldKey(originalOptions)).thru(mapToValues(barOptionValuesSCMapping)).thru(convertY2AxisOptions).thru(convertOverlayFields).thru(convertToStringValues).value();
|
|
3211
3838
|
|
|
3839
|
+
// esm-externals:@splunk/react-ui/Paginator
|
|
3840
|
+
var Paginator_exports = {};
|
|
3841
|
+
__export(Paginator_exports, {
|
|
3842
|
+
default: () => Paginator_default
|
|
3843
|
+
});
|
|
3844
|
+
var defaultImport37 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
3845
|
+
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
3846
|
+
var Paginator_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
|
|
3847
|
+
|
|
3848
|
+
// esm-externals:@splunk/themes
|
|
3849
|
+
var themes_exports = {};
|
|
3850
|
+
__export(themes_exports, {
|
|
3851
|
+
default: () => themes_default
|
|
3852
|
+
});
|
|
3853
|
+
var defaultImport38 = __toESM(require("@splunk/themes"));
|
|
3854
|
+
__reExport(themes_exports, require("@splunk/themes"));
|
|
3855
|
+
var themes_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
3856
|
+
|
|
3857
|
+
// src/common/hocs/withTrellis.tsx
|
|
3858
|
+
var TrellisContainer = styled_components_default.div`
|
|
3859
|
+
overflow: hidden;
|
|
3860
|
+
display: flex;
|
|
3861
|
+
flex-direction: column;
|
|
3862
|
+
background-color: ${(props) => props.backgroundColor};
|
|
3863
|
+
${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
|
|
3864
|
+
> [data-test='paginator'] {
|
|
3865
|
+
align-self: flex-end;
|
|
3866
|
+
margin-bottom: 10px;
|
|
3867
|
+
}
|
|
3868
|
+
`;
|
|
3869
|
+
var TrellisContainerGrid = styled_components_default.div`
|
|
3870
|
+
display: grid;
|
|
3871
|
+
height: ${(props) => {
|
|
3872
|
+
return `${props.height}px`;
|
|
3873
|
+
}};
|
|
3874
|
+
gap: 10px 10px;
|
|
3875
|
+
grid-template-columns: ${(props) => {
|
|
3876
|
+
return props.colCount ? `repeat(${props.colCount}, minmax(${props.colMinWidth}px, 1fr))` : `repeat(auto-fit, minmax(${props.colMinWidth}px, 1fr))`;
|
|
3877
|
+
}};
|
|
3878
|
+
overflow: auto;
|
|
3879
|
+
justify-items: stretch;
|
|
3880
|
+
grid-auto-rows: ${(props) => `${props.rowHeight}px`};
|
|
3881
|
+
.child {
|
|
3882
|
+
height: ${(props) => `${props.rowHeight}px`};
|
|
3883
|
+
}
|
|
3884
|
+
`;
|
|
3885
|
+
var showErrorMessage = (errorCode, width, height) => {
|
|
3886
|
+
if (errorCode === "INVALID_SPLIT_BY_FIELD") {
|
|
3887
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
3888
|
+
Message_default,
|
|
3889
|
+
{
|
|
3890
|
+
width,
|
|
3891
|
+
height,
|
|
3892
|
+
message: (0, i18n_exports._)("Select a valid trellis split by field"),
|
|
3893
|
+
level: "info"
|
|
3894
|
+
}
|
|
3895
|
+
);
|
|
3896
|
+
}
|
|
3897
|
+
if (errorCode === "UNKNOWN_DATA_SPLIT_MODE") {
|
|
3898
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Unknown data split mode"), level: "info" });
|
|
3899
|
+
}
|
|
3900
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
|
|
3901
|
+
};
|
|
3902
|
+
var withTrellis = (Viz) => {
|
|
3903
|
+
const VizWithTrellis = (opts) => {
|
|
3904
|
+
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
3905
|
+
setContainerWidth(w);
|
|
3906
|
+
setContainerHeight(h);
|
|
3907
|
+
}, []);
|
|
3908
|
+
const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
|
|
3909
|
+
const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
|
|
3910
|
+
const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
|
|
3911
|
+
const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
|
|
3912
|
+
const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
3913
|
+
const {
|
|
3914
|
+
trellisColumns,
|
|
3915
|
+
trellisPageCount,
|
|
3916
|
+
trellisMinColumnWidth,
|
|
3917
|
+
trellisRowHeight,
|
|
3918
|
+
splitByLayout,
|
|
3919
|
+
trellisSplitBy,
|
|
3920
|
+
trellisSharedScale,
|
|
3921
|
+
stackMode,
|
|
3922
|
+
yAxisMin,
|
|
3923
|
+
yAxisMax
|
|
3924
|
+
} = mergedOptions;
|
|
3925
|
+
const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
3926
|
+
const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
3927
|
+
const colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
|
|
3928
|
+
const rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
|
|
3929
|
+
const [pageNum, setPageNum] = (0, react_exports.useState)(1);
|
|
3930
|
+
const [pagedData, setPagedData] = (0, react_exports.useState)(null);
|
|
3931
|
+
let splitByKeys = [];
|
|
3932
|
+
let totalPages = 0;
|
|
3933
|
+
let showPaginator = false;
|
|
3934
|
+
const { dataSources } = otherProps;
|
|
3935
|
+
const theme = {
|
|
3936
|
+
splunkThemeV1: useSplunkTheme_default()
|
|
3937
|
+
};
|
|
3938
|
+
const {
|
|
3939
|
+
family: currentThemeFamily,
|
|
3940
|
+
colorScheme: currentThemeColorScheme,
|
|
3941
|
+
density: currentThemeDensity
|
|
3942
|
+
} = (0, themes_exports.getSettingsFromThemedProps)({ theme });
|
|
3943
|
+
const trellisBackgroundColor = (0, react_exports.useMemo)(() => {
|
|
3944
|
+
const themeFunc = (themeVar) => {
|
|
3945
|
+
var _a2, _b;
|
|
3946
|
+
return (_b = (_a2 = Viz.config.themes)[themeVar]) == null ? void 0 : _b.call(_a2, {
|
|
3947
|
+
trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
|
|
3948
|
+
theme
|
|
3949
|
+
});
|
|
3950
|
+
};
|
|
3951
|
+
const evaluated = Options_exports.Options.evaluate(
|
|
3952
|
+
{
|
|
3953
|
+
context: Viz.config.context,
|
|
3954
|
+
options: { trellisBackgroundColor: mergedOptions.trellisBackgroundColor }
|
|
3955
|
+
},
|
|
3956
|
+
{},
|
|
3957
|
+
themeFunc
|
|
3958
|
+
);
|
|
3959
|
+
return evaluated.trellisBackgroundColor;
|
|
3960
|
+
}, [
|
|
3961
|
+
mergedOptions.trellisBackgroundColor,
|
|
3962
|
+
currentThemeFamily,
|
|
3963
|
+
currentThemeColorScheme,
|
|
3964
|
+
currentThemeDensity
|
|
3965
|
+
]);
|
|
3966
|
+
const columns = (0, lodash_exports.get)(dataSources, "primary.data.columns", void 0);
|
|
3967
|
+
const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields", void 0);
|
|
3968
|
+
const noColumns = columns === void 0;
|
|
3969
|
+
const noFields = fields === void 0;
|
|
3970
|
+
const updateDataDisplay = (currPage) => {
|
|
3971
|
+
if (!showPaginator) {
|
|
3972
|
+
setPagedData(splitByKeys);
|
|
3973
|
+
setPageNum(1);
|
|
3974
|
+
} else {
|
|
3975
|
+
const startIdx = pageCount * (currPage - 1);
|
|
3976
|
+
const paged = splitByKeys.slice(startIdx, startIdx + pageCount);
|
|
3977
|
+
setPagedData(paged);
|
|
3978
|
+
}
|
|
3979
|
+
};
|
|
3980
|
+
(0, react_exports.useEffect)(() => {
|
|
3981
|
+
setPageNum(1);
|
|
3982
|
+
updateDataDisplay(1);
|
|
3983
|
+
}, [pageCount, trellisSplitBy]);
|
|
3984
|
+
(0, react_exports.useEffect)(() => {
|
|
3985
|
+
updateDataDisplay(pageNum);
|
|
3986
|
+
}, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
|
|
3987
|
+
const handlePageChange = (0, react_exports.useCallback)(
|
|
3988
|
+
(event, { page }) => {
|
|
3989
|
+
setPageNum(page);
|
|
3990
|
+
},
|
|
3991
|
+
[pageNum, pagedData]
|
|
3992
|
+
);
|
|
3993
|
+
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3994
|
+
const isTrellisFeatureFlagOn5 = Boolean(
|
|
3995
|
+
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3996
|
+
);
|
|
3997
|
+
if (!isTrellisFeatureFlagOn5 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
3998
|
+
return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
|
|
3999
|
+
}
|
|
4000
|
+
if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
4001
|
+
if (noColumns || noFields) {
|
|
4002
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
|
|
4003
|
+
}
|
|
4004
|
+
let currTrellisSplitBy = trellisSplitBy;
|
|
4005
|
+
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
4006
|
+
const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
|
|
4007
|
+
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
|
|
4008
|
+
}
|
|
4009
|
+
const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
|
|
4010
|
+
const dataSplitResult = getTrellisDataSourcesBySplitMode(
|
|
4011
|
+
splitMode,
|
|
4012
|
+
dataSources,
|
|
4013
|
+
currTrellisSplitBy
|
|
4014
|
+
);
|
|
4015
|
+
const modifiedDataSourceBySplitBy = dataSplitResult == null ? void 0 : dataSplitResult.splitDataSources;
|
|
4016
|
+
const dataSplitErrorCode = dataSplitResult == null ? void 0 : dataSplitResult.errorCode;
|
|
4017
|
+
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
4018
|
+
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
4019
|
+
}
|
|
4020
|
+
const splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
|
|
4021
|
+
if (splitByKeysModified) {
|
|
4022
|
+
showPaginator = splitByKeysModified.length > pageCount;
|
|
4023
|
+
splitByKeys = splitByKeysModified;
|
|
4024
|
+
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
4025
|
+
}
|
|
4026
|
+
const [calculatedMin, calculatedMax] = determineMinMax(
|
|
4027
|
+
modifiedDataSourceBySplitBy,
|
|
4028
|
+
trellisSharedScale,
|
|
4029
|
+
yAxisMin,
|
|
4030
|
+
yAxisMax,
|
|
4031
|
+
stackMode
|
|
4032
|
+
);
|
|
4033
|
+
return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
|
|
4034
|
+
TrellisContainerGrid,
|
|
4035
|
+
{
|
|
4036
|
+
height,
|
|
4037
|
+
colCount,
|
|
4038
|
+
colMinWidth,
|
|
4039
|
+
rowHeight
|
|
4040
|
+
},
|
|
4041
|
+
pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
|
|
4042
|
+
"div",
|
|
4043
|
+
{
|
|
4044
|
+
className: "child",
|
|
4045
|
+
"data-test": "trellis-child",
|
|
4046
|
+
key: `div-child-${idx.toString()}`
|
|
4047
|
+
},
|
|
4048
|
+
/* @__PURE__ */ react_exports.createElement(
|
|
4049
|
+
SizeAwareWrapper_default,
|
|
4050
|
+
{
|
|
4051
|
+
width,
|
|
4052
|
+
height,
|
|
4053
|
+
onResize: cachedHandleResize
|
|
4054
|
+
}
|
|
4055
|
+
),
|
|
4056
|
+
/* @__PURE__ */ react_exports.createElement(
|
|
4057
|
+
Viz,
|
|
4058
|
+
__spreadProps(__spreadValues({}, otherProps), {
|
|
4059
|
+
trellisKey: splitByKey,
|
|
4060
|
+
trellisSplitBy: currTrellisSplitBy,
|
|
4061
|
+
dataSources: modifiedDataSourceBySplitBy[splitByKey],
|
|
4062
|
+
options: __spreadProps(__spreadValues({}, options), {
|
|
4063
|
+
yAxisMin: calculatedMin,
|
|
4064
|
+
yAxisMax: calculatedMax
|
|
4065
|
+
}),
|
|
4066
|
+
key: `viz-${idx.toString()}`,
|
|
4067
|
+
height: containerHeight,
|
|
4068
|
+
width: containerWidth
|
|
4069
|
+
})
|
|
4070
|
+
)
|
|
4071
|
+
))
|
|
4072
|
+
), showPaginator && totalPages >= pageNum && /* @__PURE__ */ react_exports.createElement(
|
|
4073
|
+
Paginator_default,
|
|
4074
|
+
{
|
|
4075
|
+
onChange: handlePageChange,
|
|
4076
|
+
current: pageNum,
|
|
4077
|
+
alwaysShowLastPageLink: true,
|
|
4078
|
+
totalPages
|
|
4079
|
+
}
|
|
4080
|
+
));
|
|
4081
|
+
}
|
|
4082
|
+
return null;
|
|
4083
|
+
};
|
|
4084
|
+
VizWithTrellis.propTypes = Viz.proptypes;
|
|
4085
|
+
VizWithTrellis.defaultProps = Viz.defaultProps;
|
|
4086
|
+
VizWithTrellis.config = Viz.config;
|
|
4087
|
+
return VizWithTrellis;
|
|
4088
|
+
};
|
|
4089
|
+
var withTrellis_default = withTrellis;
|
|
4090
|
+
|
|
3212
4091
|
// src/Bar/Bar.tsx
|
|
3213
4092
|
var validOptions = Object.keys(config_default.optionsSchema);
|
|
3214
4093
|
var computeVizProps = (_a) => {
|
|
@@ -3219,7 +4098,10 @@ var computeVizProps = (_a) => {
|
|
|
3219
4098
|
xField,
|
|
3220
4099
|
yFields,
|
|
3221
4100
|
onEventTrigger,
|
|
3222
|
-
visualizationApiRef
|
|
4101
|
+
visualizationApiRef,
|
|
4102
|
+
trellisKey,
|
|
4103
|
+
trellisSplitBy,
|
|
4104
|
+
themeFunc
|
|
3223
4105
|
} = _b, otherOptions = __objRest(_b, [
|
|
3224
4106
|
"dataSources",
|
|
3225
4107
|
"x",
|
|
@@ -3227,9 +4109,19 @@ var computeVizProps = (_a) => {
|
|
|
3227
4109
|
"xField",
|
|
3228
4110
|
"yFields",
|
|
3229
4111
|
"onEventTrigger",
|
|
3230
|
-
"visualizationApiRef"
|
|
4112
|
+
"visualizationApiRef",
|
|
4113
|
+
"trellisKey",
|
|
4114
|
+
"trellisSplitBy",
|
|
4115
|
+
"themeFunc"
|
|
3231
4116
|
]);
|
|
3232
|
-
const
|
|
4117
|
+
const defaultFontColor = themeFunc("defaultFontColor");
|
|
4118
|
+
const computedProps = {
|
|
4119
|
+
visualizationApiRef,
|
|
4120
|
+
onEventTrigger,
|
|
4121
|
+
trellisKey,
|
|
4122
|
+
trellisSplitBy,
|
|
4123
|
+
defaultFontColor
|
|
4124
|
+
};
|
|
3233
4125
|
const { y2, y2Fields } = otherOptions;
|
|
3234
4126
|
computedProps.options = (0, lodash_exports.chain)(otherOptions).pick(validOptions).thru(convertToBarSCProperties).thru((options) => __spreadProps(__spreadValues({}, (0, simpleXMLOptions_exports.getSimpleXMLOptionsForProps)(options)), { chart: "bar" })).value();
|
|
3235
4127
|
const truncationLimit = computedProps.options["chart.resultTruncationLimit"];
|
|
@@ -3249,11 +4141,13 @@ var computeVizProps = (_a) => {
|
|
|
3249
4141
|
}
|
|
3250
4142
|
return computedProps;
|
|
3251
4143
|
};
|
|
3252
|
-
var Bar =
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
4144
|
+
var Bar = withTrellis_default(
|
|
4145
|
+
withDashboardViz_default({
|
|
4146
|
+
ReactViz: Charting_default,
|
|
4147
|
+
computeVizProps,
|
|
4148
|
+
vizConfig: config_default
|
|
4149
|
+
})
|
|
4150
|
+
);
|
|
3257
4151
|
var themes3 = null;
|
|
3258
4152
|
var Bar_default = Bar;
|
|
3259
4153
|
//# sourceMappingURL=Bar.js.map
|