@splunk/visualizations 27.3.0 → 27.5.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 +24 -3
- package/Area.config.js.map +2 -2
- package/Area.js +53 -9
- package/Area.js.map +2 -2
- package/Bar.config.js +24 -3
- package/Bar.config.js.map +3 -3
- package/Bar.js +54 -11
- package/Bar.js.map +3 -3
- package/Bubble.config.js +8 -1
- package/Bubble.config.js.map +2 -2
- package/Bubble.js +17 -6
- package/Bubble.js.map +2 -2
- package/CHANGELOG.external.md +1629 -0
- package/ChoroplethSvg.js +2 -2
- package/Column.config.js +24 -3
- package/Column.config.js.map +3 -3
- package/Column.js +53 -9
- package/Column.js.map +3 -3
- package/Ellipse.js +65 -7
- package/Ellipse.js.map +4 -4
- package/Events.js +11 -6
- package/Events.js.map +2 -2
- package/FEATUREFLAGS.md +2 -0
- package/FillerGauge.config.js +8 -28
- package/FillerGauge.config.js.map +2 -2
- package/FillerGauge.js +10 -30
- package/FillerGauge.js.map +2 -2
- package/Image.js +2 -2
- package/Line.config.js +24 -3
- package/Line.config.js.map +3 -3
- package/Line.js +53 -9
- package/Line.js.map +3 -3
- package/LinkGraph.js +2 -2
- package/Map.config.js +22 -0
- package/Map.config.js.map +2 -2
- package/Map.js +284 -121
- package/Map.js.map +4 -4
- package/Markdown.js +2 -2
- package/MarkerGauge.config.js +8 -25
- package/MarkerGauge.config.js.map +2 -2
- package/MarkerGauge.js +10 -27
- package/MarkerGauge.js.map +2 -2
- package/ParallelCoordinates.js +2 -2
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +123 -3
- package/Pie.config.js.map +3 -3
- package/Pie.js +743 -19
- package/Pie.js.map +4 -4
- package/Punchcard.js +2 -2
- package/Punchcard.js.map +1 -1
- package/Rectangle.js +64 -7
- package/Rectangle.js.map +4 -4
- package/Sankey.js +36 -35
- package/Sankey.js.map +3 -3
- package/Scatter.config.js +320 -113
- package/Scatter.config.js.map +4 -4
- package/Scatter.js +936 -128
- package/Scatter.js.map +4 -4
- package/SingleValue.js +3 -3
- package/SingleValue.js.map +2 -2
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.js +3 -3
- package/SingleValueIcon.js.map +2 -2
- package/SingleValueRadial.js +3 -3
- package/SingleValueRadial.js.map +2 -2
- package/TRELLIS.md +12 -3
- package/Table.js +2 -2
- package/Timeline.js +81 -63
- package/Timeline.js.map +4 -4
- package/common/Charting.js +7 -3
- package/common/Charting.js.map +2 -2
- package/common/chartingUtils.js +11 -0
- package/common/chartingUtils.js.map +2 -2
- package/common/shapeUtils.js +85 -3
- package/common/shapeUtils.js.map +4 -4
- package/common/utils/mapUtils.js +169 -48
- package/common/utils/mapUtils.js.map +4 -4
- package/common/utils/singleValueUtils.js +1 -1
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/withDashboardViz.js +2 -2
- package/package.json +18 -18
package/Pie.js
CHANGED
|
@@ -654,6 +654,7 @@ var propTypes = {
|
|
|
654
654
|
onDownsamplingThresholdChange: prop_types_exports.func,
|
|
655
655
|
xField: prop_types_exports.string,
|
|
656
656
|
y2Fields: prop_types_exports.array,
|
|
657
|
+
additionalTooltipFields: prop_types_exports.array,
|
|
657
658
|
splitByLayout: prop_types_exports.oneOf(Object.values(visualization_schemas_exports.LAYOUT_TYPE)),
|
|
658
659
|
trellisKey: prop_types_exports.string,
|
|
659
660
|
trellisSplitBy: prop_types_exports.string,
|
|
@@ -699,7 +700,8 @@ var Charting = (props) => {
|
|
|
699
700
|
xField,
|
|
700
701
|
backgroundColor,
|
|
701
702
|
defaultFontColor,
|
|
702
|
-
trellisKey
|
|
703
|
+
trellisKey,
|
|
704
|
+
additionalTooltipFields
|
|
703
705
|
} = props;
|
|
704
706
|
const prevOptions = usePrevious(options);
|
|
705
707
|
const prevTimezone = usePrevious(timezone);
|
|
@@ -926,7 +928,8 @@ var Charting = (props) => {
|
|
|
926
928
|
timezone == null ? void 0 : timezone.utcOffset,
|
|
927
929
|
timezone == null ? void 0 : timezone.serializedTimezone,
|
|
928
930
|
themeKey,
|
|
929
|
-
onClick
|
|
931
|
+
onClick,
|
|
932
|
+
additionalTooltipFields
|
|
930
933
|
]);
|
|
931
934
|
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
932
935
|
TrellisTitle,
|
|
@@ -969,7 +972,8 @@ var defaultProps = {
|
|
|
969
972
|
trellisKey: void 0,
|
|
970
973
|
trellisSplitBy: void 0,
|
|
971
974
|
backgroundColor: "",
|
|
972
|
-
defaultFontColor: ""
|
|
975
|
+
defaultFontColor: "",
|
|
976
|
+
additionalTooltipFields: []
|
|
973
977
|
};
|
|
974
978
|
Charting.propTypes = propTypes;
|
|
975
979
|
Charting.defaultProps = defaultProps;
|
|
@@ -1070,6 +1074,111 @@ var background = ({
|
|
|
1070
1074
|
];
|
|
1071
1075
|
var BackgroundColor_default = background;
|
|
1072
1076
|
|
|
1077
|
+
// src/common/editorConfig/TrellisEditors.ts
|
|
1078
|
+
var isTrellisFeatureFlagOn = ({ featureFlags }) => {
|
|
1079
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
1080
|
+
};
|
|
1081
|
+
var isTrellisEnabled = ({ options, featureFlags }) => {
|
|
1082
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
1083
|
+
return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1084
|
+
};
|
|
1085
|
+
var TrellisEditorConfig = [
|
|
1086
|
+
[
|
|
1087
|
+
{
|
|
1088
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
1089
|
+
option: "splitByLayout",
|
|
1090
|
+
editor: "editor.toggle",
|
|
1091
|
+
showEditor: isTrellisFeatureFlagOn
|
|
1092
|
+
}
|
|
1093
|
+
],
|
|
1094
|
+
[
|
|
1095
|
+
{
|
|
1096
|
+
label: (0, i18n_exports._)("Split by"),
|
|
1097
|
+
option: "trellisSplitBy",
|
|
1098
|
+
editor: "editor.trellisSplitBy",
|
|
1099
|
+
editorProps: {
|
|
1100
|
+
dataSourceKey: "primary"
|
|
1101
|
+
},
|
|
1102
|
+
showEditor: isTrellisEnabled
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1105
|
+
[
|
|
1106
|
+
{
|
|
1107
|
+
label: (0, i18n_exports._)("Number of columns"),
|
|
1108
|
+
option: "trellisColumns",
|
|
1109
|
+
editor: "editor.number",
|
|
1110
|
+
editorProps: {
|
|
1111
|
+
min: 1
|
|
1112
|
+
},
|
|
1113
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
1114
|
+
showEditor: isTrellisEnabled
|
|
1115
|
+
}
|
|
1116
|
+
],
|
|
1117
|
+
[
|
|
1118
|
+
{
|
|
1119
|
+
label: (0, i18n_exports._)("Min column width"),
|
|
1120
|
+
option: "trellisMinColumnWidth",
|
|
1121
|
+
editor: "editor.number",
|
|
1122
|
+
editorProps: {
|
|
1123
|
+
min: 1
|
|
1124
|
+
},
|
|
1125
|
+
showEditor: isTrellisEnabled
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
label: (0, i18n_exports._)("Row height"),
|
|
1129
|
+
option: "trellisRowHeight",
|
|
1130
|
+
editor: "editor.number",
|
|
1131
|
+
editorProps: {
|
|
1132
|
+
min: 1
|
|
1133
|
+
},
|
|
1134
|
+
showEditor: isTrellisEnabled
|
|
1135
|
+
}
|
|
1136
|
+
],
|
|
1137
|
+
[
|
|
1138
|
+
{
|
|
1139
|
+
label: (0, i18n_exports._)("Max number of components per page"),
|
|
1140
|
+
option: "trellisPageCount",
|
|
1141
|
+
editor: "editor.number",
|
|
1142
|
+
editorProps: {
|
|
1143
|
+
min: 1
|
|
1144
|
+
},
|
|
1145
|
+
showEditor: isTrellisEnabled
|
|
1146
|
+
}
|
|
1147
|
+
]
|
|
1148
|
+
];
|
|
1149
|
+
var TimechartTrellisEditorConfig = [
|
|
1150
|
+
[
|
|
1151
|
+
{
|
|
1152
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
1153
|
+
option: "splitByLayout",
|
|
1154
|
+
editor: "editor.toggle",
|
|
1155
|
+
showEditor: isTrellisFeatureFlagOn,
|
|
1156
|
+
// add help text for timecharts
|
|
1157
|
+
editorProps: {
|
|
1158
|
+
help: (0, i18n_exports._)(
|
|
1159
|
+
"Y2-axis and overlay field configurations are not supported when trellis is enabled."
|
|
1160
|
+
),
|
|
1161
|
+
helpFormat: "under"
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
],
|
|
1165
|
+
...TrellisEditorConfig.slice(1),
|
|
1166
|
+
[
|
|
1167
|
+
{
|
|
1168
|
+
label: (0, i18n_exports._)("Shared y-axis scale"),
|
|
1169
|
+
option: "trellisSharedScale",
|
|
1170
|
+
editor: "editor.checkbox",
|
|
1171
|
+
showEditor: isTrellisEnabled
|
|
1172
|
+
}
|
|
1173
|
+
]
|
|
1174
|
+
];
|
|
1175
|
+
var TrellisBackgroundColorEditor = {
|
|
1176
|
+
label: (0, i18n_exports._)("Trellis background"),
|
|
1177
|
+
option: "trellisBackgroundColor",
|
|
1178
|
+
editor: "editor.color",
|
|
1179
|
+
showEditor: isTrellisEnabled
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1073
1182
|
// src/Pie/config.ts
|
|
1074
1183
|
var dataContract = {
|
|
1075
1184
|
requiredDataSources: [
|
|
@@ -1101,6 +1210,13 @@ var themes = {
|
|
|
1101
1210
|
light: variables_default.backgroundColor(props)
|
|
1102
1211
|
},
|
|
1103
1212
|
prisma: variables_default.backgroundColorSidebar(props)
|
|
1213
|
+
})(props),
|
|
1214
|
+
defaultFontColor: (props) => pick_default({
|
|
1215
|
+
enterprise: {
|
|
1216
|
+
dark: variables_default.textColor(props),
|
|
1217
|
+
light: variables_default.textColor(props)
|
|
1218
|
+
},
|
|
1219
|
+
prisma: variables_default.contentColorDefault(props)
|
|
1104
1220
|
})(props)
|
|
1105
1221
|
};
|
|
1106
1222
|
var editorConfig = [
|
|
@@ -1186,7 +1302,8 @@ var editorConfig = [
|
|
|
1186
1302
|
option: "collapseLabel",
|
|
1187
1303
|
editor: "editor.text"
|
|
1188
1304
|
}
|
|
1189
|
-
]
|
|
1305
|
+
],
|
|
1306
|
+
...TrellisEditorConfig
|
|
1190
1307
|
]
|
|
1191
1308
|
},
|
|
1192
1309
|
{
|
|
@@ -1199,7 +1316,14 @@ var editorConfig = [
|
|
|
1199
1316
|
editor: "editor.seriesColors"
|
|
1200
1317
|
}
|
|
1201
1318
|
],
|
|
1202
|
-
BackgroundColor_default({ themes })
|
|
1319
|
+
BackgroundColor_default({ themes }),
|
|
1320
|
+
[
|
|
1321
|
+
__spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
|
|
1322
|
+
editorProps: {
|
|
1323
|
+
themes
|
|
1324
|
+
}
|
|
1325
|
+
})
|
|
1326
|
+
]
|
|
1203
1327
|
]
|
|
1204
1328
|
}
|
|
1205
1329
|
];
|
|
@@ -1228,7 +1352,7 @@ var config = {
|
|
|
1228
1352
|
description: "triggered when user clicks on a point in the pie chart"
|
|
1229
1353
|
}
|
|
1230
1354
|
},
|
|
1231
|
-
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "events" /* EVENTS */],
|
|
1355
|
+
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "events" /* EVENTS */, "trellis" /* TRELLIS */],
|
|
1232
1356
|
themes
|
|
1233
1357
|
};
|
|
1234
1358
|
var config_default = enhanceConfig(config);
|
|
@@ -1557,7 +1681,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
1557
1681
|
FixSizeItem,
|
|
1558
1682
|
{
|
|
1559
1683
|
"data-test": "fix-size-item",
|
|
1560
|
-
"data-splunk-visualization-version": "27.
|
|
1684
|
+
"data-splunk-visualization-version": "27.5.0 - 5cfbc7064",
|
|
1561
1685
|
width,
|
|
1562
1686
|
height,
|
|
1563
1687
|
backgroundColor
|
|
@@ -1623,7 +1747,7 @@ var Cover = styled_components_default.div`
|
|
|
1623
1747
|
bottom: 0;
|
|
1624
1748
|
`;
|
|
1625
1749
|
var Blocker = styled_components_default.div.attrs({
|
|
1626
|
-
"data-splunk-visualization-version": "27.
|
|
1750
|
+
"data-splunk-visualization-version": "27.5.0 - 5cfbc7064"
|
|
1627
1751
|
})`
|
|
1628
1752
|
position: relative;
|
|
1629
1753
|
width: 100%;
|
|
@@ -1895,6 +2019,309 @@ __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisU
|
|
|
1895
2019
|
var trellisUtils_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
|
|
1896
2020
|
|
|
1897
2021
|
// src/common/utils/trellisUtils.ts
|
|
2022
|
+
var AGGREGATIONS = "aggregations";
|
|
2023
|
+
var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
2024
|
+
var _a, _b, _c, _d;
|
|
2025
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2026
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2027
|
+
let splitDataSources = null;
|
|
2028
|
+
let errorCode = null;
|
|
2029
|
+
if (fields && fields.length) {
|
|
2030
|
+
splitDataSources = {};
|
|
2031
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
2032
|
+
const fieldName = fields[i].name;
|
|
2033
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
2034
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
2035
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2036
|
+
);
|
|
2037
|
+
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
2038
|
+
splitDataSources[fieldName].primary.data.columns = [columns[i]];
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
} else {
|
|
2042
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2043
|
+
}
|
|
2044
|
+
return { splitDataSources, errorCode };
|
|
2045
|
+
};
|
|
2046
|
+
var toFieldEntries = (fields) => {
|
|
2047
|
+
return fields.map((field) => {
|
|
2048
|
+
if (typeof field === "string") {
|
|
2049
|
+
return { name: field };
|
|
2050
|
+
}
|
|
2051
|
+
return field;
|
|
2052
|
+
});
|
|
2053
|
+
};
|
|
2054
|
+
var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
2055
|
+
var _a, _b, _c, _d;
|
|
2056
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
2057
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2058
|
+
let splitDataSources = null;
|
|
2059
|
+
let splitByFields = [];
|
|
2060
|
+
let errorCode = null;
|
|
2061
|
+
if (typeof fields[0] !== "string") {
|
|
2062
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2063
|
+
}
|
|
2064
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
2065
|
+
splitDataSources = {};
|
|
2066
|
+
splitByFields.forEach((splitByField) => {
|
|
2067
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
2068
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2069
|
+
);
|
|
2070
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
2071
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
2072
|
+
fields.forEach((field, idx) => {
|
|
2073
|
+
const fieldName = field == null ? void 0 : field.name;
|
|
2074
|
+
if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
|
|
2075
|
+
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
2076
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
2077
|
+
}
|
|
2078
|
+
});
|
|
2079
|
+
});
|
|
2080
|
+
} else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
|
|
2081
|
+
splitDataSources = {};
|
|
2082
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2083
|
+
const fieldName = fields[i].name;
|
|
2084
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
2085
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
2086
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2087
|
+
);
|
|
2088
|
+
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
2089
|
+
splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
} else {
|
|
2093
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2094
|
+
}
|
|
2095
|
+
return { splitDataSources, errorCode };
|
|
2096
|
+
};
|
|
2097
|
+
var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
2098
|
+
var _a, _b, _c, _d;
|
|
2099
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2100
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2101
|
+
let splitDataSources = null;
|
|
2102
|
+
let splitByFields = [];
|
|
2103
|
+
let errorCode = null;
|
|
2104
|
+
if (typeof fields[0] !== "string") {
|
|
2105
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
2106
|
+
}
|
|
2107
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
2108
|
+
splitDataSources = {};
|
|
2109
|
+
splitByFields.forEach((splitByField) => {
|
|
2110
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
2111
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2112
|
+
);
|
|
2113
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
2114
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
2115
|
+
const idx = fields.findIndex((field) => field.name === splitByField);
|
|
2116
|
+
if (idx > 0) {
|
|
2117
|
+
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
2118
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
2119
|
+
}
|
|
2120
|
+
});
|
|
2121
|
+
} else {
|
|
2122
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2123
|
+
}
|
|
2124
|
+
return { splitDataSources, errorCode };
|
|
2125
|
+
};
|
|
2126
|
+
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
2127
|
+
var _a, _b, _c, _d, _e;
|
|
2128
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2129
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2130
|
+
let splitDataSources = null;
|
|
2131
|
+
let splitByFields = [];
|
|
2132
|
+
let errorCode = null;
|
|
2133
|
+
if (typeof fields[0] !== "string") {
|
|
2134
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2135
|
+
}
|
|
2136
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2137
|
+
splitDataSources = {};
|
|
2138
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2139
|
+
const valueKeys = [];
|
|
2140
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2141
|
+
if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
|
|
2142
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
valueKeys.forEach((val) => {
|
|
2146
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2147
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2148
|
+
);
|
|
2149
|
+
splitDataSources[val].primary.data.fields = [
|
|
2150
|
+
{ name: fields[0].name },
|
|
2151
|
+
...dataSourceKeys.map((k) => ({
|
|
2152
|
+
name: k
|
|
2153
|
+
}))
|
|
2154
|
+
];
|
|
2155
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
2156
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
2157
|
+
fields.forEach((field, idx) => {
|
|
2158
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
2159
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
2160
|
+
}
|
|
2161
|
+
});
|
|
2162
|
+
});
|
|
2163
|
+
});
|
|
2164
|
+
} else {
|
|
2165
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2166
|
+
}
|
|
2167
|
+
return { splitDataSources, errorCode };
|
|
2168
|
+
};
|
|
2169
|
+
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
2170
|
+
var _a, _b, _c, _d;
|
|
2171
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2172
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2173
|
+
let splitDataSources = null;
|
|
2174
|
+
let splitByFields = [];
|
|
2175
|
+
let errorCode = null;
|
|
2176
|
+
if (typeof fields[0] !== "string") {
|
|
2177
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2178
|
+
}
|
|
2179
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2180
|
+
splitDataSources = {};
|
|
2181
|
+
const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
|
|
2182
|
+
const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
|
|
2183
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2184
|
+
const nonDataSourceAggregations = [];
|
|
2185
|
+
if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
|
|
2186
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2187
|
+
nonDataSourceAggregations.push(fields[i].name);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
if (splitByFieldIdx === 0) {
|
|
2191
|
+
const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
|
|
2192
|
+
valueKeys.forEach((val, idx) => {
|
|
2193
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2194
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2195
|
+
);
|
|
2196
|
+
splitDataSources[val].primary.data.fields = [];
|
|
2197
|
+
if (otherSplitBy.length) {
|
|
2198
|
+
splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
|
|
2199
|
+
}
|
|
2200
|
+
if (dataSourceKeys.length) {
|
|
2201
|
+
const columnValues = [[]];
|
|
2202
|
+
splitDataSources[val].primary.data.fields = [
|
|
2203
|
+
...splitDataSources[val].primary.data.fields,
|
|
2204
|
+
...dataSourceKeys.map((k) => ({
|
|
2205
|
+
name: k
|
|
2206
|
+
}))
|
|
2207
|
+
];
|
|
2208
|
+
dataSourceKeys.forEach(() => {
|
|
2209
|
+
columnValues.push([]);
|
|
2210
|
+
});
|
|
2211
|
+
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
2212
|
+
columnValues[0].push(
|
|
2213
|
+
fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
|
|
2214
|
+
);
|
|
2215
|
+
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
2216
|
+
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
2217
|
+
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
2221
|
+
} else if (nonDataSourceAggregations.length) {
|
|
2222
|
+
const columnValues = [];
|
|
2223
|
+
fields.forEach((aggregationField, fieldIdx) => {
|
|
2224
|
+
if (fieldIdx > 0) {
|
|
2225
|
+
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
2226
|
+
columnValues.push([columns[fieldIdx][idx]]);
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
2230
|
+
}
|
|
2231
|
+
});
|
|
2232
|
+
} else {
|
|
2233
|
+
const valueKeys = [];
|
|
2234
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2235
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
2236
|
+
}
|
|
2237
|
+
valueKeys.forEach((val) => {
|
|
2238
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2239
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2240
|
+
);
|
|
2241
|
+
splitDataSources[val].primary.data.fields = [
|
|
2242
|
+
{ name: otherSplitBy[0] },
|
|
2243
|
+
...dataSourceKeys.map((k) => ({
|
|
2244
|
+
name: k
|
|
2245
|
+
}))
|
|
2246
|
+
];
|
|
2247
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
2248
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
2249
|
+
fields.forEach((field, idx) => {
|
|
2250
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
2251
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
2252
|
+
}
|
|
2253
|
+
});
|
|
2254
|
+
});
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
} else {
|
|
2258
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2259
|
+
}
|
|
2260
|
+
return { splitDataSources, errorCode };
|
|
2261
|
+
};
|
|
2262
|
+
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
2263
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2264
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2265
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2266
|
+
let splitDataSources = null;
|
|
2267
|
+
let splitByFields = [];
|
|
2268
|
+
let errorCode = null;
|
|
2269
|
+
if (typeof fields[0] !== "string") {
|
|
2270
|
+
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
2271
|
+
}
|
|
2272
|
+
const splitByIndex = fields == null ? void 0 : fields.findIndex(
|
|
2273
|
+
(field) => field === splitBy || field.name === splitBy
|
|
2274
|
+
);
|
|
2275
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2276
|
+
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
2277
|
+
splitDataSources = {};
|
|
2278
|
+
splitByColumn.forEach((val, idx) => {
|
|
2279
|
+
if (!splitDataSources[val]) {
|
|
2280
|
+
splitDataSources[val] = [idx];
|
|
2281
|
+
} else {
|
|
2282
|
+
splitDataSources[val].push(idx);
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
const cloneFields = (0, lodash_exports.cloneDeep)(fields);
|
|
2286
|
+
cloneFields.splice(splitByIndex, 1);
|
|
2287
|
+
const valueKeys = Object.keys(splitDataSources);
|
|
2288
|
+
valueKeys.forEach((val) => {
|
|
2289
|
+
const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
|
|
2290
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2291
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2292
|
+
);
|
|
2293
|
+
splitDataSources[val].primary.data.fields = cloneFields;
|
|
2294
|
+
splitDataSources[val].primary.data.columns = [];
|
|
2295
|
+
columns.forEach((col, idx) => {
|
|
2296
|
+
if (idx !== splitByIndex) {
|
|
2297
|
+
const newCol = valIndices.map((valIdx) => col[valIdx]);
|
|
2298
|
+
splitDataSources[val].primary.data.columns.push(newCol);
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
});
|
|
2302
|
+
} else {
|
|
2303
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2304
|
+
}
|
|
2305
|
+
return { splitDataSources, errorCode };
|
|
2306
|
+
};
|
|
2307
|
+
var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
|
|
2308
|
+
let result = null;
|
|
2309
|
+
try {
|
|
2310
|
+
if (splitMode === trellisUtils_exports.TIMECHART) {
|
|
2311
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
|
|
2312
|
+
} else if (splitMode === trellisUtils_exports.STATS) {
|
|
2313
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
|
|
2314
|
+
} else if (splitMode === trellisUtils_exports.CHART) {
|
|
2315
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
|
|
2316
|
+
} else if (splitMode === trellisUtils_exports.UNKNOWN) {
|
|
2317
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
|
|
2318
|
+
}
|
|
2319
|
+
} catch (ex) {
|
|
2320
|
+
console.error("getTrellisDataSourcesBySplitMode ", ex);
|
|
2321
|
+
result = { splitDataSources: null, errorCode: "UNKNOWN" };
|
|
2322
|
+
}
|
|
2323
|
+
return result;
|
|
2324
|
+
};
|
|
1898
2325
|
var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
|
|
1899
2326
|
if (isTrellisOn && !options.legendDisplay) {
|
|
1900
2327
|
return {
|
|
@@ -1903,6 +2330,36 @@ var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
|
|
|
1903
2330
|
}
|
|
1904
2331
|
return {};
|
|
1905
2332
|
};
|
|
2333
|
+
var calculateSharedMinMax = (splitData) => {
|
|
2334
|
+
let max = -Infinity;
|
|
2335
|
+
let min = Infinity;
|
|
2336
|
+
Object.keys(splitData).forEach((splitByKey) => {
|
|
2337
|
+
const datasources = splitData[splitByKey];
|
|
2338
|
+
Object.keys(datasources).forEach((datasourceName) => {
|
|
2339
|
+
const dataColumns = datasources[datasourceName].data.columns;
|
|
2340
|
+
dataColumns.forEach((column) => {
|
|
2341
|
+
column.forEach((point) => {
|
|
2342
|
+
const pointNumber = Number(point);
|
|
2343
|
+
if (pointNumber > max) {
|
|
2344
|
+
max = pointNumber;
|
|
2345
|
+
}
|
|
2346
|
+
if (pointNumber < min) {
|
|
2347
|
+
min = pointNumber;
|
|
2348
|
+
}
|
|
2349
|
+
});
|
|
2350
|
+
});
|
|
2351
|
+
});
|
|
2352
|
+
});
|
|
2353
|
+
return [min, max];
|
|
2354
|
+
};
|
|
2355
|
+
var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
|
|
2356
|
+
if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
|
|
2357
|
+
return [yAxisMin, yAxisMax];
|
|
2358
|
+
const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
|
|
2359
|
+
const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
|
|
2360
|
+
const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
|
|
2361
|
+
return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
|
|
2362
|
+
};
|
|
1906
2363
|
|
|
1907
2364
|
// src/common/withDashboardViz.tsx
|
|
1908
2365
|
var withDashboardViz = (opts) => {
|
|
@@ -1962,10 +2419,10 @@ var withDashboardViz = (opts) => {
|
|
|
1962
2419
|
const isDownsamplingEnabledByFeatureFlag = Boolean(
|
|
1963
2420
|
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
|
|
1964
2421
|
);
|
|
1965
|
-
const
|
|
2422
|
+
const isTrellisFeatureFlagOn2 = Boolean(
|
|
1966
2423
|
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
1967
2424
|
);
|
|
1968
|
-
const isTrellisOn =
|
|
2425
|
+
const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
|
|
1969
2426
|
const isMounted = react_exports.useRef(true);
|
|
1970
2427
|
const optionsToEvaluate = react_exports.useMemo(() => {
|
|
1971
2428
|
var _a2;
|
|
@@ -2278,6 +2735,258 @@ var truncateData = (dataSet, truncationLimit) => {
|
|
|
2278
2735
|
return truncatedData;
|
|
2279
2736
|
};
|
|
2280
2737
|
|
|
2738
|
+
// esm-externals:@splunk/react-ui/Paginator
|
|
2739
|
+
var Paginator_exports = {};
|
|
2740
|
+
__export(Paginator_exports, {
|
|
2741
|
+
default: () => Paginator_default
|
|
2742
|
+
});
|
|
2743
|
+
var defaultImport38 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
2744
|
+
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
2745
|
+
var Paginator_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
2746
|
+
|
|
2747
|
+
// esm-externals:@splunk/themes
|
|
2748
|
+
var themes_exports = {};
|
|
2749
|
+
__export(themes_exports, {
|
|
2750
|
+
default: () => themes_default
|
|
2751
|
+
});
|
|
2752
|
+
var defaultImport39 = __toESM(require("@splunk/themes"));
|
|
2753
|
+
__reExport(themes_exports, require("@splunk/themes"));
|
|
2754
|
+
var themes_default = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
|
|
2755
|
+
|
|
2756
|
+
// src/common/hocs/withTrellis.tsx
|
|
2757
|
+
var TrellisContainer = styled_components_default.div`
|
|
2758
|
+
overflow: hidden;
|
|
2759
|
+
display: flex;
|
|
2760
|
+
flex-direction: column;
|
|
2761
|
+
background-color: ${(props) => props.backgroundColor};
|
|
2762
|
+
${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
|
|
2763
|
+
> [data-test='paginator'] {
|
|
2764
|
+
align-self: flex-end;
|
|
2765
|
+
margin-bottom: 10px;
|
|
2766
|
+
}
|
|
2767
|
+
`;
|
|
2768
|
+
var TrellisContainerGrid = styled_components_default.div`
|
|
2769
|
+
display: grid;
|
|
2770
|
+
height: ${(props) => {
|
|
2771
|
+
return `${props.height}px`;
|
|
2772
|
+
}};
|
|
2773
|
+
gap: 10px 10px;
|
|
2774
|
+
grid-template-columns: ${(props) => {
|
|
2775
|
+
return props.colCount ? `repeat(${props.colCount}, minmax(${props.colMinWidth}px, 1fr))` : `repeat(auto-fit, minmax(${props.colMinWidth}px, 1fr))`;
|
|
2776
|
+
}};
|
|
2777
|
+
overflow: auto;
|
|
2778
|
+
justify-items: stretch;
|
|
2779
|
+
grid-auto-rows: ${(props) => `${props.rowHeight}px`};
|
|
2780
|
+
.child {
|
|
2781
|
+
height: ${(props) => `${props.rowHeight}px`};
|
|
2782
|
+
}
|
|
2783
|
+
`;
|
|
2784
|
+
var showErrorMessage = (errorCode, width, height) => {
|
|
2785
|
+
if (errorCode === "INVALID_SPLIT_BY_FIELD") {
|
|
2786
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
2787
|
+
Message_default,
|
|
2788
|
+
{
|
|
2789
|
+
width,
|
|
2790
|
+
height,
|
|
2791
|
+
message: (0, i18n_exports._)("Select a valid trellis split by field"),
|
|
2792
|
+
level: "info"
|
|
2793
|
+
}
|
|
2794
|
+
);
|
|
2795
|
+
}
|
|
2796
|
+
if (errorCode === "UNKNOWN_DATA_SPLIT_MODE") {
|
|
2797
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Unknown data split mode"), level: "info" });
|
|
2798
|
+
}
|
|
2799
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
|
|
2800
|
+
};
|
|
2801
|
+
var withTrellis = (Viz) => {
|
|
2802
|
+
const VizWithTrellis = (opts) => {
|
|
2803
|
+
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
2804
|
+
setContainerWidth(w);
|
|
2805
|
+
setContainerHeight(h);
|
|
2806
|
+
}, []);
|
|
2807
|
+
const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
|
|
2808
|
+
const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
|
|
2809
|
+
const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
|
|
2810
|
+
const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
|
|
2811
|
+
const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
2812
|
+
const {
|
|
2813
|
+
trellisColumns,
|
|
2814
|
+
trellisPageCount,
|
|
2815
|
+
trellisMinColumnWidth,
|
|
2816
|
+
trellisRowHeight,
|
|
2817
|
+
splitByLayout,
|
|
2818
|
+
trellisSplitBy,
|
|
2819
|
+
trellisSharedScale,
|
|
2820
|
+
stackMode,
|
|
2821
|
+
yAxisMin,
|
|
2822
|
+
yAxisMax
|
|
2823
|
+
} = mergedOptions;
|
|
2824
|
+
const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
2825
|
+
const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
2826
|
+
const colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
|
|
2827
|
+
const rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
|
|
2828
|
+
const [pageNum, setPageNum] = (0, react_exports.useState)(1);
|
|
2829
|
+
const [pagedData, setPagedData] = (0, react_exports.useState)(null);
|
|
2830
|
+
let splitByKeys = [];
|
|
2831
|
+
let totalPages = 0;
|
|
2832
|
+
let showPaginator = false;
|
|
2833
|
+
const { dataSources } = otherProps;
|
|
2834
|
+
const theme = {
|
|
2835
|
+
splunkThemeV1: useSplunkTheme_default()
|
|
2836
|
+
};
|
|
2837
|
+
const {
|
|
2838
|
+
family: currentThemeFamily,
|
|
2839
|
+
colorScheme: currentThemeColorScheme,
|
|
2840
|
+
density: currentThemeDensity
|
|
2841
|
+
} = (0, themes_exports.getSettingsFromThemedProps)({ theme });
|
|
2842
|
+
const trellisBackgroundColor = (0, react_exports.useMemo)(() => {
|
|
2843
|
+
const themeFunc = (themeVar) => {
|
|
2844
|
+
var _a2, _b;
|
|
2845
|
+
return (_b = (_a2 = Viz.config.themes)[themeVar]) == null ? void 0 : _b.call(_a2, {
|
|
2846
|
+
trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
|
|
2847
|
+
theme
|
|
2848
|
+
});
|
|
2849
|
+
};
|
|
2850
|
+
const evaluated = Options_exports.Options.evaluate(
|
|
2851
|
+
{
|
|
2852
|
+
context: Viz.config.context,
|
|
2853
|
+
options: { trellisBackgroundColor: mergedOptions.trellisBackgroundColor }
|
|
2854
|
+
},
|
|
2855
|
+
{},
|
|
2856
|
+
themeFunc
|
|
2857
|
+
);
|
|
2858
|
+
return evaluated.trellisBackgroundColor;
|
|
2859
|
+
}, [
|
|
2860
|
+
mergedOptions.trellisBackgroundColor,
|
|
2861
|
+
currentThemeFamily,
|
|
2862
|
+
currentThemeColorScheme,
|
|
2863
|
+
currentThemeDensity
|
|
2864
|
+
]);
|
|
2865
|
+
const columns = (0, lodash_exports.get)(dataSources, "primary.data.columns", void 0);
|
|
2866
|
+
const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields", void 0);
|
|
2867
|
+
const noColumns = columns === void 0;
|
|
2868
|
+
const noFields = fields === void 0;
|
|
2869
|
+
const updateDataDisplay = (currPage) => {
|
|
2870
|
+
if (!showPaginator) {
|
|
2871
|
+
setPagedData(splitByKeys);
|
|
2872
|
+
setPageNum(1);
|
|
2873
|
+
} else {
|
|
2874
|
+
const startIdx = pageCount * (currPage - 1);
|
|
2875
|
+
const paged = splitByKeys.slice(startIdx, startIdx + pageCount);
|
|
2876
|
+
setPagedData(paged);
|
|
2877
|
+
}
|
|
2878
|
+
};
|
|
2879
|
+
(0, react_exports.useEffect)(() => {
|
|
2880
|
+
setPageNum(1);
|
|
2881
|
+
updateDataDisplay(1);
|
|
2882
|
+
}, [pageCount, trellisSplitBy]);
|
|
2883
|
+
(0, react_exports.useEffect)(() => {
|
|
2884
|
+
updateDataDisplay(pageNum);
|
|
2885
|
+
}, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
|
|
2886
|
+
const handlePageChange = (0, react_exports.useCallback)(
|
|
2887
|
+
(event, { page }) => {
|
|
2888
|
+
setPageNum(page);
|
|
2889
|
+
},
|
|
2890
|
+
[pageNum, pagedData]
|
|
2891
|
+
);
|
|
2892
|
+
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2893
|
+
const isTrellisFeatureFlagOn2 = Boolean(
|
|
2894
|
+
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2895
|
+
);
|
|
2896
|
+
if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
2897
|
+
return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
|
|
2898
|
+
}
|
|
2899
|
+
if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
2900
|
+
if (noColumns || noFields) {
|
|
2901
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
|
|
2902
|
+
}
|
|
2903
|
+
let currTrellisSplitBy = trellisSplitBy;
|
|
2904
|
+
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
2905
|
+
const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
|
|
2906
|
+
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
|
|
2907
|
+
}
|
|
2908
|
+
const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
|
|
2909
|
+
const dataSplitResult = getTrellisDataSourcesBySplitMode(
|
|
2910
|
+
splitMode,
|
|
2911
|
+
dataSources,
|
|
2912
|
+
currTrellisSplitBy
|
|
2913
|
+
);
|
|
2914
|
+
const modifiedDataSourceBySplitBy = dataSplitResult == null ? void 0 : dataSplitResult.splitDataSources;
|
|
2915
|
+
const dataSplitErrorCode = dataSplitResult == null ? void 0 : dataSplitResult.errorCode;
|
|
2916
|
+
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
2917
|
+
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
2918
|
+
}
|
|
2919
|
+
const splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
|
|
2920
|
+
if (splitByKeysModified) {
|
|
2921
|
+
showPaginator = splitByKeysModified.length > pageCount;
|
|
2922
|
+
splitByKeys = splitByKeysModified;
|
|
2923
|
+
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
2924
|
+
}
|
|
2925
|
+
const [calculatedMin, calculatedMax] = determineMinMax(
|
|
2926
|
+
modifiedDataSourceBySplitBy,
|
|
2927
|
+
trellisSharedScale,
|
|
2928
|
+
yAxisMin,
|
|
2929
|
+
yAxisMax,
|
|
2930
|
+
stackMode
|
|
2931
|
+
);
|
|
2932
|
+
return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
|
|
2933
|
+
TrellisContainerGrid,
|
|
2934
|
+
{
|
|
2935
|
+
height,
|
|
2936
|
+
colCount,
|
|
2937
|
+
colMinWidth,
|
|
2938
|
+
rowHeight
|
|
2939
|
+
},
|
|
2940
|
+
pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
|
|
2941
|
+
"div",
|
|
2942
|
+
{
|
|
2943
|
+
className: "child",
|
|
2944
|
+
"data-test": "trellis-child",
|
|
2945
|
+
key: `div-child-${idx.toString()}`
|
|
2946
|
+
},
|
|
2947
|
+
/* @__PURE__ */ react_exports.createElement(
|
|
2948
|
+
SizeAwareWrapper_default,
|
|
2949
|
+
{
|
|
2950
|
+
width,
|
|
2951
|
+
height,
|
|
2952
|
+
onResize: cachedHandleResize
|
|
2953
|
+
}
|
|
2954
|
+
),
|
|
2955
|
+
/* @__PURE__ */ react_exports.createElement(
|
|
2956
|
+
Viz,
|
|
2957
|
+
__spreadProps(__spreadValues({}, otherProps), {
|
|
2958
|
+
trellisKey: splitByKey,
|
|
2959
|
+
trellisSplitBy: currTrellisSplitBy,
|
|
2960
|
+
dataSources: modifiedDataSourceBySplitBy[splitByKey],
|
|
2961
|
+
options: __spreadProps(__spreadValues({}, options), {
|
|
2962
|
+
yAxisMin: calculatedMin,
|
|
2963
|
+
yAxisMax: calculatedMax
|
|
2964
|
+
}),
|
|
2965
|
+
key: `viz-${idx.toString()}`,
|
|
2966
|
+
height: containerHeight,
|
|
2967
|
+
width: containerWidth
|
|
2968
|
+
})
|
|
2969
|
+
)
|
|
2970
|
+
))
|
|
2971
|
+
), showPaginator && totalPages >= pageNum && /* @__PURE__ */ react_exports.createElement(
|
|
2972
|
+
Paginator_default,
|
|
2973
|
+
{
|
|
2974
|
+
onChange: handlePageChange,
|
|
2975
|
+
current: pageNum,
|
|
2976
|
+
alwaysShowLastPageLink: true,
|
|
2977
|
+
totalPages
|
|
2978
|
+
}
|
|
2979
|
+
));
|
|
2980
|
+
}
|
|
2981
|
+
return null;
|
|
2982
|
+
};
|
|
2983
|
+
VizWithTrellis.propTypes = Viz.proptypes;
|
|
2984
|
+
VizWithTrellis.defaultProps = Viz.defaultProps;
|
|
2985
|
+
VizWithTrellis.config = Viz.config;
|
|
2986
|
+
return VizWithTrellis;
|
|
2987
|
+
};
|
|
2988
|
+
var withTrellis_default = withTrellis;
|
|
2989
|
+
|
|
2281
2990
|
// src/Pie/Pie.tsx
|
|
2282
2991
|
var validOptions = Object.keys(config_default.optionsSchema);
|
|
2283
2992
|
var PieInnerSize = 0.7;
|
|
@@ -2288,16 +2997,29 @@ var computeVizProps = (_a) => {
|
|
|
2288
2997
|
label,
|
|
2289
2998
|
value,
|
|
2290
2999
|
showDonutHole,
|
|
2291
|
-
visualizationApiRef
|
|
3000
|
+
visualizationApiRef,
|
|
3001
|
+
trellisKey,
|
|
3002
|
+
trellisSplitBy,
|
|
3003
|
+
themeFunc
|
|
2292
3004
|
} = _b, otherOptions = __objRest(_b, [
|
|
2293
3005
|
"dataSources",
|
|
2294
3006
|
"onEventTrigger",
|
|
2295
3007
|
"label",
|
|
2296
3008
|
"value",
|
|
2297
3009
|
"showDonutHole",
|
|
2298
|
-
"visualizationApiRef"
|
|
3010
|
+
"visualizationApiRef",
|
|
3011
|
+
"trellisKey",
|
|
3012
|
+
"trellisSplitBy",
|
|
3013
|
+
"themeFunc"
|
|
2299
3014
|
]);
|
|
2300
|
-
const
|
|
3015
|
+
const defaultFontColor = themeFunc("defaultFontColor");
|
|
3016
|
+
const computedProps = {
|
|
3017
|
+
visualizationApiRef,
|
|
3018
|
+
onEventTrigger,
|
|
3019
|
+
trellisKey,
|
|
3020
|
+
trellisSplitBy,
|
|
3021
|
+
defaultFontColor
|
|
3022
|
+
};
|
|
2301
3023
|
const { labelField, valueField, hasEventHandlers } = otherOptions;
|
|
2302
3024
|
computedProps.options = (0, lodash_exports.chain)(otherOptions).pick(validOptions).thru(convertToPieSCProperties).thru((options) => __spreadProps(__spreadValues({}, (0, simpleXMLOptions_exports.getSimpleXMLOptionsForProps)(options)), { chart: "pie" })).value();
|
|
2303
3025
|
const truncationLimit = computedProps.options["chart.resultTruncationLimit"];
|
|
@@ -2333,12 +3055,14 @@ var computeVizProps = (_a) => {
|
|
|
2333
3055
|
return computedProps;
|
|
2334
3056
|
};
|
|
2335
3057
|
var showPlaceHolderIcon = (dataSources, loading, options) => shouldShowIconPlaceholder(dataSources, loading) || invalidOptionField("value", dataSources, options, config_default) || invalidOptionField("label", dataSources, options, config_default) || allInvalidDataValues(dataSources, options, config_default);
|
|
2336
|
-
var Pie =
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
3058
|
+
var Pie = withTrellis_default(
|
|
3059
|
+
withDashboardViz_default({
|
|
3060
|
+
ReactViz: Charting_default,
|
|
3061
|
+
computeVizProps,
|
|
3062
|
+
useIconPlaceholder: (dataSources, loading, options) => showPlaceHolderIcon(dataSources, loading, options),
|
|
3063
|
+
vizConfig: config_default
|
|
3064
|
+
})
|
|
3065
|
+
);
|
|
2342
3066
|
var themes2 = null;
|
|
2343
3067
|
var Pie_default = Pie;
|
|
2344
3068
|
//# sourceMappingURL=Pie.js.map
|