blixify-ui-web 1.2.234 → 1.2.237
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/lib/components/chart/barChart/index.d.ts +2 -1
- package/lib/components/chart/barChart/index.d.ts.map +1 -1
- package/lib/components/chart/barChart/index.js +34 -34
- package/lib/components/chart/barChart/index.js.map +1 -1
- package/lib/components/chat/chatAnchor/index.d.ts +2 -0
- package/lib/components/chat/chatAnchor/index.d.ts.map +1 -1
- package/lib/components/chat/chatAnchor/index.js +45 -12
- package/lib/components/chat/chatAnchor/index.js.map +1 -1
- package/lib/components/chat/chatBase/index.d.ts +1 -0
- package/lib/components/chat/chatBase/index.d.ts.map +1 -1
- package/lib/components/chat/chatBase/index.js +3 -2
- package/lib/components/chat/chatBase/index.js.map +1 -1
- package/lib/components/data/dataGraph/chartResults.d.ts +22 -0
- package/lib/components/data/dataGraph/chartResults.d.ts.map +1 -1
- package/lib/components/data/dataGraph/chartResults.js +46 -1
- package/lib/components/data/dataGraph/chartResults.js.map +1 -1
- package/lib/components/data/dataGraph/filterScope.d.ts +6 -0
- package/lib/components/data/dataGraph/filterScope.d.ts.map +1 -1
- package/lib/components/data/dataGraph/filterScope.js +71 -1
- package/lib/components/data/dataGraph/filterScope.js.map +1 -1
- package/lib/components/data/dataGraph/index.d.ts.map +1 -1
- package/lib/components/data/dataGraph/index.js +135 -48
- package/lib/components/data/dataGraph/index.js.map +1 -1
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +67 -14
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/tail.css +1 -1
- package/package.json +1 -1
|
@@ -119,6 +119,8 @@ var DEFAULT_INTERVAL_SPAN = {
|
|
|
119
119
|
week: [12, "week"],
|
|
120
120
|
month: [12, "month"],
|
|
121
121
|
};
|
|
122
|
+
// INFO: chart reads a page sends at once while it fills
|
|
123
|
+
var GRAPH_LOAD_CONCURRENCY = 4;
|
|
122
124
|
// INFO: written out so Tailwind keeps every width in a consumer's CSS build
|
|
123
125
|
var GRID_SPAN_CLASS = {
|
|
124
126
|
1: "col-span-1",
|
|
@@ -295,7 +297,10 @@ function DataGraph(props) {
|
|
|
295
297
|
? DEFAULT_INTERVAL_SPAN[eachChart.queryDateInterval]
|
|
296
298
|
: undefined;
|
|
297
299
|
var startDate = (_a = dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) !== null && _a !== void 0 ? _a : (span
|
|
298
|
-
? (0, dayjs_1.default)()
|
|
300
|
+
? (0, dayjs_1.default)()
|
|
301
|
+
.subtract(span[0] - 1, span[1])
|
|
302
|
+
.startOf(span[1])
|
|
303
|
+
.toDate()
|
|
299
304
|
: (0, dayjs_1.default)().subtract(7, "days").toDate());
|
|
300
305
|
return {
|
|
301
306
|
startDate: startDate,
|
|
@@ -524,7 +529,7 @@ function DataGraph(props) {
|
|
|
524
529
|
* group set, date buckets as ranges, and each segment as its own pass.
|
|
525
530
|
*/
|
|
526
531
|
var handleReadShapedChart = function (eachChart, filters) { return __awaiter(_this, void 0, void 0, function () {
|
|
527
|
-
var filterRange, filterQuery, spaceRQ, dateId, isDateMode, buckets, range, aggregate, handleRunPoints, columnError, points, groupColumn_1, labels_1,
|
|
532
|
+
var filterRange, filterQuery, spaceRQ, dateId, isDateMode, buckets, range, aggregate, handleRunPoints, columnError, points, groupColumn_1, labels_1, shaped, shapedPoints, segments, segmentTotal, err_3, error;
|
|
528
533
|
var _a;
|
|
529
534
|
var _this = this;
|
|
530
535
|
var _b, _c, _d, _e, _f;
|
|
@@ -579,12 +584,7 @@ function DataGraph(props) {
|
|
|
579
584
|
res = _d.sent();
|
|
580
585
|
return [2 /*return*/, (0, chartResults_1.handleFlattenGroupedResult)(res === null || res === void 0 ? void 0 : res.data).map(function (eachGroup) {
|
|
581
586
|
var _a, _b;
|
|
582
|
-
return ({
|
|
583
|
-
x: "",
|
|
584
|
-
y: (_a = eachGroup.value) !== null && _a !== void 0 ? _a : 0,
|
|
585
|
-
key: eachGroup.key,
|
|
586
|
-
query: (0, chartResults_1.handleGroupOpenQuery)((_b = props.structure) === null || _b === void 0 ? void 0 : _b.find(function (eachColumn) { return eachColumn.id === eachChart.groupBy; }), eachChart.groupBy, eachGroup),
|
|
587
|
-
});
|
|
587
|
+
return (__assign(__assign({ x: "", y: (_a = eachGroup.value) !== null && _a !== void 0 ? _a : 0, key: eachGroup.key }, (eachGroup.ids ? { ids: eachGroup.ids } : {})), { query: (0, chartResults_1.handleGroupOpenQuery)((_b = props.structure) === null || _b === void 0 ? void 0 : _b.find(function (eachColumn) { return eachColumn.id === eachChart.groupBy; }), eachChart.groupBy, eachGroup) }));
|
|
588
588
|
})];
|
|
589
589
|
case 2:
|
|
590
590
|
if (!isDateMode) return [3 /*break*/, 4];
|
|
@@ -702,7 +702,7 @@ function DataGraph(props) {
|
|
|
702
702
|
points = points.map(function (eachPoint) { return (__assign(__assign({}, eachPoint), { x: (0, chartResults_1.handleGroupKeyLabel)(eachPoint.key, groupColumn_1, labels_1) })); });
|
|
703
703
|
_g.label = 4;
|
|
704
704
|
case 4:
|
|
705
|
-
|
|
705
|
+
shaped = (0, chartResults_1.handleShapeChartPoints)(points, {
|
|
706
706
|
sortBy: eachChart.sortBy,
|
|
707
707
|
sortDirection: eachChart.sortDirection,
|
|
708
708
|
// INFO: a time axis keeps every bucket in date order
|
|
@@ -713,16 +713,11 @@ function DataGraph(props) {
|
|
|
713
713
|
cumulative: isDateMode && eachChart.cumulative,
|
|
714
714
|
measure: eachChart.queryBaseType,
|
|
715
715
|
});
|
|
716
|
-
shapedPoints =
|
|
716
|
+
shapedPoints = shaped.points.map(function (eachPoint) {
|
|
717
|
+
var _a;
|
|
717
718
|
return eachPoint.x === chartResults_1.OTHERS_LABEL && eachPoint.key === undefined
|
|
718
719
|
? __assign(__assign({}, eachPoint), { query: eachChart.groupBy
|
|
719
|
-
? [
|
|
720
|
-
{
|
|
721
|
-
type: "in",
|
|
722
|
-
queryId: eachChart.groupBy,
|
|
723
|
-
value: shaped_1.hiddenKeys,
|
|
724
|
-
},
|
|
725
|
-
]
|
|
720
|
+
? (0, chartResults_1.handleOthersQuery)(groupColumn_1, eachChart.groupBy, (_a = eachPoint.shown) !== null && _a !== void 0 ? _a : [])
|
|
726
721
|
: [] }) : eachPoint;
|
|
727
722
|
});
|
|
728
723
|
segments = undefined;
|
|
@@ -807,11 +802,12 @@ function DataGraph(props) {
|
|
|
807
802
|
running = 0;
|
|
808
803
|
return [2 /*return*/, {
|
|
809
804
|
name: (0, chartResults_1.handleGroupKeyLabel)(eachKey, segmentColumn, labels),
|
|
805
|
+
query: (0, chartResults_1.handleGroupKeyQuery)(eachChart.segmentBy, eachKey),
|
|
810
806
|
data: points.map(function (eachPoint) {
|
|
811
807
|
var _a, _b;
|
|
812
808
|
var value = eachPoint.x === chartResults_1.OTHERS_LABEL
|
|
813
809
|
? 0
|
|
814
|
-
: (_b = byKey.get(JSON.stringify((_a = eachPoint.key) !== null && _a !== void 0 ? _a : null))) !== null && _b !== void 0 ? _b : 0;
|
|
810
|
+
: ((_b = byKey.get(JSON.stringify((_a = eachPoint.key) !== null && _a !== void 0 ? _a : null))) !== null && _b !== void 0 ? _b : 0);
|
|
815
811
|
running += value;
|
|
816
812
|
return eachChart.cumulative && eachChart.queryDateInterval
|
|
817
813
|
? Math.round(running * 100) / 100
|
|
@@ -830,7 +826,17 @@ function DataGraph(props) {
|
|
|
830
826
|
return Math.max(0, Math.round((eachPoint.y - covered) * 100) / 100);
|
|
831
827
|
});
|
|
832
828
|
if (rest.some(function (each) { return each > 0; }))
|
|
833
|
-
segments.push({
|
|
829
|
+
segments.push({
|
|
830
|
+
name: chartResults_1.OTHERS_LABEL,
|
|
831
|
+
data: rest,
|
|
832
|
+
query: [
|
|
833
|
+
{
|
|
834
|
+
type: "!in",
|
|
835
|
+
queryId: eachChart.segmentBy,
|
|
836
|
+
value: segmentKeys.map(function (eachKey) { return eachKey !== null && eachKey !== void 0 ? eachKey : null; }),
|
|
837
|
+
},
|
|
838
|
+
],
|
|
839
|
+
});
|
|
834
840
|
}
|
|
835
841
|
return [2 /*return*/, {
|
|
836
842
|
segments: segments.length ? segments : undefined,
|
|
@@ -1000,15 +1006,33 @@ function DataGraph(props) {
|
|
|
1000
1006
|
}
|
|
1001
1007
|
});
|
|
1002
1008
|
}); };
|
|
1009
|
+
// INFO: a page of 30 charts sent 30 reads at once, enough to take down a small
|
|
1010
|
+
// server mid-read; a few at a time keep it up and still fill the page in order
|
|
1003
1011
|
var handleGetGraphDetail = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1012
|
+
var queue, handleNext;
|
|
1013
|
+
var _this = this;
|
|
1004
1014
|
return __generator(this, function (_a) {
|
|
1005
1015
|
switch (_a.label) {
|
|
1006
1016
|
case 0:
|
|
1007
1017
|
if (!props.charts)
|
|
1008
1018
|
return [2 /*return*/];
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1019
|
+
queue = __spreadArray([], props.charts, true);
|
|
1020
|
+
handleNext = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1021
|
+
var eachChart;
|
|
1022
|
+
return __generator(this, function (_a) {
|
|
1023
|
+
switch (_a.label) {
|
|
1024
|
+
case 0:
|
|
1025
|
+
eachChart = queue.shift();
|
|
1026
|
+
if (!eachChart)
|
|
1027
|
+
return [2 /*return*/];
|
|
1028
|
+
return [4 /*yield*/, handleLoadChart(eachChart, graphAnalyticsFilter)];
|
|
1029
|
+
case 1:
|
|
1030
|
+
_a.sent();
|
|
1031
|
+
return [2 /*return*/, handleNext()];
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}); };
|
|
1035
|
+
return [4 /*yield*/, Promise.all(Array.from({ length: Math.min(GRAPH_LOAD_CONCURRENCY, queue.length) }, handleNext))];
|
|
1012
1036
|
case 1:
|
|
1013
1037
|
_a.sent();
|
|
1014
1038
|
return [2 /*return*/];
|
|
@@ -1071,16 +1095,30 @@ function DataGraph(props) {
|
|
|
1071
1095
|
return [2 /*return*/];
|
|
1072
1096
|
});
|
|
1073
1097
|
}); };
|
|
1074
|
-
var
|
|
1098
|
+
var handleIsDateMode = function (eachChart) {
|
|
1099
|
+
return !!eachChart.queryDateInterval &&
|
|
1100
|
+
!!eachChart.queryBaseDateId &&
|
|
1101
|
+
!eachChart.groupBy;
|
|
1102
|
+
};
|
|
1103
|
+
// INFO: a grouped point's records are picked when it is clicked, against
|
|
1104
|
+
// the columns as they are now — they may have arrived after the numbers
|
|
1105
|
+
var handlePointQuery = function (eachChart, point) {
|
|
1106
|
+
var _a;
|
|
1107
|
+
return eachChart.groupBy && !handleIsDateMode(eachChart)
|
|
1108
|
+
? (0, chartResults_1.handleGroupPointQuery)(handleFindColumn(eachChart.groupBy), eachChart.groupBy, point)
|
|
1109
|
+
: ((_a = point.query) !== null && _a !== void 0 ? _a : []);
|
|
1110
|
+
};
|
|
1111
|
+
var handleDrillDown = function (eachChart, point, segment, label) {
|
|
1075
1112
|
var _a, _b;
|
|
1076
1113
|
if (!props.onDrillDown || !point)
|
|
1077
1114
|
return;
|
|
1115
|
+
var ownQuery = __spreadArray(__spreadArray([], ((_a = segment === null || segment === void 0 ? void 0 : segment.query) !== null && _a !== void 0 ? _a : []), true), handlePointQuery(eachChart, point), true);
|
|
1078
1116
|
// INFO: a percentage or running total still opens the records of its own
|
|
1079
|
-
// value, not of everything before it
|
|
1117
|
+
// value, not of everything before it; a date bucket carries its own range
|
|
1080
1118
|
props.onDrillDown({
|
|
1081
1119
|
chart: eachChart,
|
|
1082
|
-
label: point.x,
|
|
1083
|
-
query: __spreadArray(__spreadArray(
|
|
1120
|
+
label: label !== null && label !== void 0 ? label : (segment ? "".concat(point.x, " \u00B7 ").concat(segment.name) : point.x),
|
|
1121
|
+
query: __spreadArray(__spreadArray([], (0, filterScope_1.handleScopeDrillQuery)(ownQuery, handleChartFilterQuery(eachChart, graphAnalyticsFilter)), true), (handleIsDateMode(eachChart)
|
|
1084
1122
|
? []
|
|
1085
1123
|
: handleDateRangeQuery(eachChart, (_b = graphAnalyticsFilter[eachChart.title]) === null || _b === void 0 ? void 0 : _b.range)), true),
|
|
1086
1124
|
});
|
|
@@ -1125,7 +1163,9 @@ function DataGraph(props) {
|
|
|
1125
1163
|
? [selectedChart[index]]
|
|
1126
1164
|
: undefined;
|
|
1127
1165
|
points.push({
|
|
1128
|
-
x: title === null || title === undefined
|
|
1166
|
+
x: title === null || title === undefined
|
|
1167
|
+
? chartResults_1.EMPTY_GROUP_LABEL
|
|
1168
|
+
: String(title),
|
|
1129
1169
|
y: (_k = (0, chartResults_1.handleToChartNumber)(eachData.value)) !== null && _k !== void 0 ? _k : 0,
|
|
1130
1170
|
key: (_l = selectedChart === null || selectedChart === void 0 ? void 0 : selectedChart[index]) === null || _l === void 0 ? void 0 : _l.value,
|
|
1131
1171
|
query: query,
|
|
@@ -1204,13 +1244,19 @@ function DataGraph(props) {
|
|
|
1204
1244
|
} }))),
|
|
1205
1245
|
isOpen && error.details && (react_1.default.createElement("p", { className: "mt-2 break-words font-mono text-xs text-gray-500" }, error.details)))));
|
|
1206
1246
|
};
|
|
1247
|
+
// INFO: a loading chart takes the card it will become — same frame, height
|
|
1248
|
+
// and title — so the page keeps its layout and the spinners line up
|
|
1249
|
+
var renderChartPlaceholder = function (item, spanClass) { return (react_1.default.createElement("div", { className: spanClass },
|
|
1250
|
+
react_1.default.createElement("div", { "data-testid": "chart-loading", className: "flex flex-col overflow-hidden rounded-lg bg-white p-4 shadow ".concat(item.type === "card" ? "h-[92px]" : "h-[352px]") },
|
|
1251
|
+
react_1.default.createElement("p", { className: "truncate text-sm font-medium text-gray-700" }, item.title),
|
|
1252
|
+
react_1.default.createElement("div", { className: "flex flex-1 items-center justify-center" },
|
|
1253
|
+
react_1.default.createElement(loading_1.Loading, null))))); };
|
|
1207
1254
|
var renderChart = function (item, points, index, segments) {
|
|
1208
1255
|
var _a, _b, _c, _d, _e, _f;
|
|
1209
1256
|
var spanClass = (_a = GRID_SPAN_CLASS[item.gridSize]) !== null && _a !== void 0 ? _a : "col-span-1";
|
|
1210
1257
|
if (graphAnalyticsFilter[(_b = item.title) !== null && _b !== void 0 ? _b : ""] &&
|
|
1211
1258
|
graphAnalyticsFilter[item.title].loading) {
|
|
1212
|
-
return (
|
|
1213
|
-
react_1.default.createElement(loading_1.Loading, null)));
|
|
1259
|
+
return renderChartPlaceholder(item, spanClass);
|
|
1214
1260
|
}
|
|
1215
1261
|
var seriesData = points.map(function (eachPoint) { return ({
|
|
1216
1262
|
x: eachPoint.x,
|
|
@@ -1225,8 +1271,14 @@ function DataGraph(props) {
|
|
|
1225
1271
|
var customDate = (_d = (_c = graphAnalyticsFilter[item.title]) === null || _c === void 0 ? void 0 : _c.range) !== null && _d !== void 0 ? _d : (item.queryDateInterval && item.queryBaseDateId && !item.groupBy
|
|
1226
1272
|
? handleResolveRange(item)
|
|
1227
1273
|
: undefined);
|
|
1228
|
-
|
|
1229
|
-
|
|
1274
|
+
// INFO: a bar is found by its place on the axis — two groups can share
|
|
1275
|
+
// a label — and a stacked bar opens the segment that was clicked
|
|
1276
|
+
var handleClickPoint = function (label, _value, seriesIndex, dataPointIndex) {
|
|
1277
|
+
return handleDrillDown(item, dataPointIndex !== undefined && points[dataPointIndex]
|
|
1278
|
+
? points[dataPointIndex]
|
|
1279
|
+
: points.find(function (eachPoint) { return eachPoint.x === label; }), segments && seriesIndex !== undefined
|
|
1280
|
+
? segments[seriesIndex]
|
|
1281
|
+
: undefined);
|
|
1230
1282
|
};
|
|
1231
1283
|
return (react_1.default.createElement("div", { className: spanClass },
|
|
1232
1284
|
item.type === "card" && (react_1.default.createElement(card_1.Card, { icon: renderChartCardIcon(item.cardIcon, item.cardSize === "compact", item.cardEmoji), iconBgColor: item.cardIconBgColor, size: item.cardSize, title: item.title, description: (_e = item.description) !== null && _e !== void 0 ? _e : "", count: points.length > 0 ? points[0].y : 0, dateRangeVisible: !!item.queryBaseDateId && !item.rangeOverride, customDate: customDate, onChangeDate: function (dateRange) {
|
|
@@ -1243,8 +1295,7 @@ function DataGraph(props) {
|
|
|
1243
1295
|
handleUpdateChartData(index, dateRange);
|
|
1244
1296
|
}, colors: (0, chartBuilder_1.handleGetBarColours)(item, props.multicolourDefault), valueFormatter: !isPercent && item.queryBaseType !== "count"
|
|
1245
1297
|
? exports.handleFormatCompact
|
|
1246
|
-
: undefined, stackedVertical: segments ? true : item.stackedVertical, distributed: !segments &&
|
|
1247
|
-
!!(0, chartBuilder_1.handleGetBarColours)(item, props.multicolourDefault), onClick: props.onDrillDown ? handleClickPoint : undefined })),
|
|
1298
|
+
: undefined, stackedVertical: segments ? true : item.stackedVertical, distributed: !segments && !!(0, chartBuilder_1.handleGetBarColours)(item, props.multicolourDefault), onClick: props.onDrillDown ? handleClickPoint : undefined })),
|
|
1248
1299
|
item.type === "table" &&
|
|
1249
1300
|
renderTableChart(item, points, index, customDate, segments),
|
|
1250
1301
|
item.type === "line" && (react_1.default.createElement(lineChart_1.LineChart, { title: item.title, categories: pieLabels, seriesData: pieSeries, multiLineSeries: segments, seriesName: "Value", seriesUnit: unit, showDataLabels: true, xaxisTitle: "Date", yaxisTitle: "Value", containerStyle: "mb-10", customDate: customDate, tool: renderChartOptionFilter(item, index), dateRangeVisible: !!item.queryBaseDateId && !item.rangeOverride, enableGradient: true, colors: item.colors, onChangeDate: function (dateRange) {
|
|
@@ -1275,7 +1326,7 @@ function DataGraph(props) {
|
|
|
1275
1326
|
if (!highlight)
|
|
1276
1327
|
return { row: "", label: "bg-white" };
|
|
1277
1328
|
var colour = highlight.colour
|
|
1278
|
-
? (_a = HIGHLIGHT_ROW_CLASS[highlight.colour]) !== null && _a !== void 0 ? _a : ""
|
|
1329
|
+
? ((_a = HIGHLIGHT_ROW_CLASS[highlight.colour]) !== null && _a !== void 0 ? _a : "")
|
|
1279
1330
|
: "";
|
|
1280
1331
|
var weight = highlight.bold ? "font-semibold" : "";
|
|
1281
1332
|
return {
|
|
@@ -1315,9 +1366,7 @@ function DataGraph(props) {
|
|
|
1315
1366
|
var renderRowLabel = function (item, row, isClickable) {
|
|
1316
1367
|
var isBarOpen = (highlightBar === null || highlightBar === void 0 ? void 0 : highlightBar.chart) === item.title && (highlightBar === null || highlightBar === void 0 ? void 0 : highlightBar.row) === row;
|
|
1317
1368
|
return (react_1.default.createElement("span", { className: "relative inline-flex items-center gap-1.5" },
|
|
1318
|
-
react_1.default.createElement("span", { className: isClickable
|
|
1319
|
-
? "text-primary-600 hover:underline"
|
|
1320
|
-
: "" }, row),
|
|
1369
|
+
react_1.default.createElement("span", { className: isClickable ? "text-primary-600 hover:underline" : "" }, row),
|
|
1321
1370
|
props.onHighlightRow && row !== chartResults_1.OTHERS_LABEL && (react_1.default.createElement("button", { type: "button", "aria-label": "Highlight ".concat(row), className: "text-gray-400 hover:text-gray-700 ".concat(isBarOpen ? "" : "sm:opacity-0 sm:group-hover:opacity-100"), onClick: function (e) {
|
|
1322
1371
|
e.stopPropagation();
|
|
1323
1372
|
setHighlightBar(isBarOpen ? null : { chart: item.title, row: row });
|
|
@@ -1351,7 +1400,7 @@ function DataGraph(props) {
|
|
|
1351
1400
|
// date bucket, one row per segment, each row and each date totalled, with
|
|
1352
1401
|
// the last complete bucket against the one before it in Change
|
|
1353
1402
|
var renderDatesAcrossTable = function (item, points, segments, handleFormat, showTotal) {
|
|
1354
|
-
var _a, _b, _c, _d, _e;
|
|
1403
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1355
1404
|
var canDrill = !!props.onDrillDown;
|
|
1356
1405
|
var measureColumn = handleFindColumn((_a = item.queryAttributeId) === null || _a === void 0 ? void 0 : _a[0]);
|
|
1357
1406
|
var measureLabel = item.queryBaseType === "sum" || item.queryBaseType === "avg"
|
|
@@ -1360,6 +1409,33 @@ function DataGraph(props) {
|
|
|
1360
1409
|
var rows = segments !== null && segments !== void 0 ? segments : [
|
|
1361
1410
|
{ name: measureLabel, data: points.map(function (eachPoint) { return eachPoint.y; }) },
|
|
1362
1411
|
];
|
|
1412
|
+
// INFO: a row's name opens it across every bucket the chart draws — the
|
|
1413
|
+
// buckets carry their own dates, so the range is theirs end to end
|
|
1414
|
+
var rangeStart = (_h = (_g = (_f = (_e = points[0]) === null || _e === void 0 ? void 0 : _e.query) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h[0];
|
|
1415
|
+
var rangeEnd = (_m = (_l = (_k = (_j = points[points.length - 1]) === null || _j === void 0 ? void 0 : _j.query) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m[1];
|
|
1416
|
+
var handleRangePoint = function (row) {
|
|
1417
|
+
return rangeStart && rangeEnd && item.queryBaseDateId
|
|
1418
|
+
? {
|
|
1419
|
+
x: row.name,
|
|
1420
|
+
y: 0,
|
|
1421
|
+
query: [
|
|
1422
|
+
{
|
|
1423
|
+
type: "><",
|
|
1424
|
+
queryId: item.queryBaseDateId,
|
|
1425
|
+
value: [rangeStart, rangeEnd],
|
|
1426
|
+
},
|
|
1427
|
+
],
|
|
1428
|
+
}
|
|
1429
|
+
: undefined;
|
|
1430
|
+
};
|
|
1431
|
+
var handleClickCell = function (row, point) {
|
|
1432
|
+
return segments
|
|
1433
|
+
? handleDrillDown(item, point, row, "".concat(row.name, " \u00B7 ").concat(point.x))
|
|
1434
|
+
: handleDrillDown(item, point);
|
|
1435
|
+
};
|
|
1436
|
+
var handleClickRow = function (row) {
|
|
1437
|
+
return handleDrillDown(item, handleRangePoint(row), segments ? row : undefined, row.name);
|
|
1438
|
+
};
|
|
1363
1439
|
// INFO: a bucket whose end is still ahead is under way — its count is a
|
|
1364
1440
|
// part-period, so it is marked and left out of Change
|
|
1365
1441
|
var now = Date.now();
|
|
@@ -1371,7 +1447,7 @@ function DataGraph(props) {
|
|
|
1371
1447
|
var showChange = points.length > 2 && !item.cumulative;
|
|
1372
1448
|
// INFO: a share only means something across several rows, so a single
|
|
1373
1449
|
// unsplit row keeps its counts
|
|
1374
|
-
var display = segments ? (
|
|
1450
|
+
var display = segments ? ((_o = item.valueDisplay) !== null && _o !== void 0 ? _o : "count") : "count";
|
|
1375
1451
|
var periodTotals = points.map(function (eachPoint) { return eachPoint.y; });
|
|
1376
1452
|
var grandTotal = periodTotals.reduce(function (sum, each) { return sum + each; }, 0);
|
|
1377
1453
|
var handleCell = function (value, total) {
|
|
@@ -1407,11 +1483,18 @@ function DataGraph(props) {
|
|
|
1407
1483
|
showChange && (react_1.default.createElement("th", { className: "py-2 pl-4 text-right font-medium text-gray-500" }, "Change")))),
|
|
1408
1484
|
react_1.default.createElement("tbody", { className: "divide-y divide-gray-100" }, rows.map(function (eachRow) {
|
|
1409
1485
|
var highlight = handleHighlightClass(item, eachRow.name);
|
|
1486
|
+
var isRowClickable = canDrill && !!handleRangePoint(eachRow);
|
|
1410
1487
|
return (react_1.default.createElement("tr", { key: eachRow.name, className: "group ".concat(highlight.row), "data-testid": "chart-row-".concat(eachRow.name) },
|
|
1411
|
-
react_1.default.createElement("td", { className: "".concat(pinnedClass, " ").concat(highlight.label, " whitespace-nowrap py-2 pr-4 ").concat(highlight.row ? "" : "text-gray-600") }, renderRowLabel(item, eachRow.name,
|
|
1488
|
+
react_1.default.createElement("td", { className: "".concat(pinnedClass, " ").concat(highlight.label, " whitespace-nowrap py-2 pr-4 ").concat(highlight.row ? "" : "text-gray-600", " ").concat(isRowClickable ? "cursor-pointer" : ""), onClick: function () { return isRowClickable && handleClickRow(eachRow); } }, renderRowLabel(item, eachRow.name, isRowClickable)),
|
|
1412
1489
|
points.map(function (eachPoint, pointIndex) {
|
|
1413
1490
|
var _a;
|
|
1414
|
-
return (react_1.default.createElement("td", { key: "".concat(pointIndex, "-").concat(eachPoint.x), className: "py-2 pl-4 text-right ".concat(highlight.row ? "" : "text-gray-700"
|
|
1491
|
+
return (react_1.default.createElement("td", { key: "".concat(pointIndex, "-").concat(eachPoint.x), "data-testid": "chart-cell-".concat(eachRow.name, "-").concat(pointIndex), className: "py-2 pl-4 text-right ".concat(highlight.row ? "" : "text-gray-700", " ").concat(canDrill && eachPoint.query
|
|
1492
|
+
? "cursor-pointer hover:bg-gray-50 hover:underline"
|
|
1493
|
+
: ""), onClick: function () {
|
|
1494
|
+
return canDrill &&
|
|
1495
|
+
eachPoint.query &&
|
|
1496
|
+
handleClickCell(eachRow, eachPoint);
|
|
1497
|
+
} }, handleCell((_a = eachRow.data[pointIndex]) !== null && _a !== void 0 ? _a : 0, periodTotals[pointIndex])));
|
|
1415
1498
|
}),
|
|
1416
1499
|
showTotal && (react_1.default.createElement("td", { className: "py-2 pl-4 text-right font-medium text-gray-900" }, handleCell(handleRowTotal(eachRow.data), grandTotal))),
|
|
1417
1500
|
showChange && (react_1.default.createElement("td", { className: "py-2 pl-4 text-right" }, handleRowChange(eachRow.data)))));
|
|
@@ -1455,7 +1538,14 @@ function DataGraph(props) {
|
|
|
1455
1538
|
react_1.default.createElement("td", { className: "py-2 pr-4 ".concat(highlight.row ? "" : "text-gray-600") }, renderRowLabel(item, eachPoint.x, isClickable)), segments === null || segments === void 0 ? void 0 :
|
|
1456
1539
|
segments.map(function (eachSegment) {
|
|
1457
1540
|
var _a;
|
|
1458
|
-
return (react_1.default.createElement("td", { key: eachSegment.name, className: "py-2 pl-4 text-right text-gray-700"
|
|
1541
|
+
return (react_1.default.createElement("td", { key: eachSegment.name, "data-testid": "chart-cell-".concat(eachPoint.x, "-").concat(eachSegment.name), className: "py-2 pl-4 text-right text-gray-700 ".concat(isClickable ? "hover:underline" : ""), onClick: function (e) {
|
|
1542
|
+
if (!isClickable)
|
|
1543
|
+
return;
|
|
1544
|
+
// INFO: the cell opens its row × segment, not the
|
|
1545
|
+
// whole row the row's own click opens
|
|
1546
|
+
e.stopPropagation();
|
|
1547
|
+
handleDrillDown(item, eachPoint, eachSegment);
|
|
1548
|
+
} }, handleFormat((_a = eachSegment.data[pointIndex]) !== null && _a !== void 0 ? _a : 0)));
|
|
1459
1549
|
}),
|
|
1460
1550
|
react_1.default.createElement("td", { className: "py-2 pl-4 text-right font-medium text-gray-900" }, handleFormat(eachPoint.y))));
|
|
1461
1551
|
})),
|
|
@@ -1479,8 +1569,7 @@ function DataGraph(props) {
|
|
|
1479
1569
|
var _a, _b;
|
|
1480
1570
|
var spanClass = (_a = GRID_SPAN_CLASS[item.gridSize]) !== null && _a !== void 0 ? _a : "col-span-1";
|
|
1481
1571
|
if (!graphAnalyticsData[item.title]) {
|
|
1482
|
-
return (
|
|
1483
|
-
react_1.default.createElement(loading_1.Loading, null)));
|
|
1572
|
+
return renderChartPlaceholder(item, spanClass);
|
|
1484
1573
|
}
|
|
1485
1574
|
var radarData = [];
|
|
1486
1575
|
graphAnalyticsData[item.title].forEach(function (eachData) {
|
|
@@ -1534,16 +1623,14 @@ function DataGraph(props) {
|
|
|
1534
1623
|
if ((0, exports.handleIsShapedChart)(eachChart)) {
|
|
1535
1624
|
var series = graphSeries[eachChart.title];
|
|
1536
1625
|
if (!series)
|
|
1537
|
-
return (
|
|
1538
|
-
react_1.default.createElement(loading_1.Loading, null)));
|
|
1626
|
+
return renderChartPlaceholder(eachChart, spanClass);
|
|
1539
1627
|
return renderChart(eachChart, series.points, index, series.segments);
|
|
1540
1628
|
}
|
|
1541
1629
|
// INFO: a chart of fixed queries or a line over dates has no numbers until
|
|
1542
1630
|
// its first read answers, and drew as an empty chart meanwhile
|
|
1543
1631
|
if (graphAnalyticsData[eachChart.title] === undefined &&
|
|
1544
1632
|
reloading[eachChart.title] !== false)
|
|
1545
|
-
return (
|
|
1546
|
-
react_1.default.createElement(loading_1.Loading, null)));
|
|
1633
|
+
return renderChartPlaceholder(eachChart, spanClass);
|
|
1547
1634
|
return renderChart(eachChart, handleBuildLegacyPoints(eachChart), index);
|
|
1548
1635
|
};
|
|
1549
1636
|
var renderCharts = function () {
|